+ yaz_log(YLOG_WARN, "%s:%d: Too many arguments for '%s'",
+ fname, lineno, argv[0]);
+ return -1;
+ }
+ if (!yaz_matchstr(argv[0], "index"))
+ {
+ zm = zebra_add_map(zms, argv[1], ZEBRA_MAP_TYPE_INDEX);
+ zm->positioned = 1;
+ }
+ else if (!yaz_matchstr(argv[0], "sort"))
+ {
+ zm = zebra_add_map(zms, argv[1], ZEBRA_MAP_TYPE_SORT);
+ zm->u.sort.entry_size = 80;
+ }
+ else if (!yaz_matchstr(argv[0], "staticrank"))
+ {
+ zm = zebra_add_map(zms, argv[1], ZEBRA_MAP_TYPE_STATICRANK);
+ zm->completeness = 1;
+ }
+ else if (!zm)
+ {
+ yaz_log(YLOG_WARN, "%s:%d: Missing sort/index before '%s'",
+ fname, lineno, argv[0]);
+ return -1;
+ }
+ else if (!yaz_matchstr(argv[0], "charmap") && argc == 2)
+ {
+ if (zm->type != ZEBRA_MAP_TYPE_STATICRANK)
+ zm->maptab_name = nmem_strdup(zms->nmem, argv[1]);
+ else
+ {
+ yaz_log(YLOG_WARN|YLOG_FATAL, "%s:%d: charmap for "
+ "staticrank is invalid", fname, lineno);
+ yaz_log(YLOG_LOG, "Type is %d", zm->type);
+ return -1;
+ }
+ }
+ else if (!yaz_matchstr(argv[0], "completeness") && argc == 2)
+ {
+ zm->completeness = atoi(argv[1]);
+ }
+ else if (!yaz_matchstr(argv[0], "position") && argc == 2)
+ {
+ zm->positioned = atoi(argv[1]);
+ }
+ else if (!yaz_matchstr(argv[0], "alwaysmatches") && argc == 2)
+ {
+ if (zm->type != ZEBRA_MAP_TYPE_STATICRANK)
+ zm->alwaysmatches = atoi(argv[1]);
+ else
+ {
+ yaz_log(YLOG_WARN|YLOG_FATAL, "%s:%d: alwaysmatches for "
+ "staticrank is invalid", fname, lineno);
+ return -1;
+ }
+ }
+ else if (!yaz_matchstr(argv[0], "firstinfield") && argc == 2)
+ {
+ zm->first_in_field = atoi(argv[1]);
+ }
+ else if (!yaz_matchstr(argv[0], "entrysize") && argc == 2)
+ {
+ if (zm->type == ZEBRA_MAP_TYPE_SORT)
+ zm->u.sort.entry_size = atoi(argv[1]);
+ else
+ {
+ yaz_log(YLOG_WARN,
+ "%s:%d: entrysize only valid in sort section",
+ fname, lineno);
+ return -1;
+ }
+ }
+ else if (!yaz_matchstr(argv[0], "simplechain"))
+ {
+ zm->use_chain = 1;
+#if YAZ_HAVE_ICU
+ zm->icu_chain = 0;
+#endif
+ }
+ else if (!yaz_matchstr(argv[0], "icuchain"))
+ {
+#if YAZ_HAVE_XML2
+ zm->doc = xmlParseFile(argv[1]);
+ if (!zm->doc)
+ {
+ yaz_log(YLOG_WARN, "%s:%d: Could not load icuchain config '%s'",
+ fname, lineno, argv[1]);
+ return -1;
+ }
+ else
+ {
+#if YAZ_HAVE_ICU
+ UErrorCode status;
+ xmlNode *xml_node = xmlDocGetRootElement(zm->doc);
+ zm->icu_chain =
+ icu_chain_xml_config(xml_node,
+/* not sure about sort for this function yet.. */
+#if 1
+ 1,
+#else
+ zm->type == ZEBRA_MAP_TYPE_SORT,
+#endif
+ &status);
+ if (!zm->icu_chain)
+ {
+ yaz_log(YLOG_WARN, "%s:%d: Failed to load ICU chain %s",
+ fname, lineno, argv[1]);
+ }
+ zm->use_chain = 1;
+#else
+ yaz_log(YLOG_WARN, "%s:%d: ICU support unavailable",
+ fname, lineno);
+ return -1;
+#endif
+ }
+#else
+ yaz_log(YLOG_WARN, "%s:%d: XML support unavailable",
+ fname, lineno);
+ return -1;
+#endif
+ }
+ else if (!yaz_matchstr(argv[0], "debug") && argc == 2)
+ {
+ zm->debug = atoi(argv[1]);