Zebra uses string attributes for indexing internally. Using set+numeric
[idzebra-moved-to-github.git] / data1 / d1_absyn.c
index 9c784cb..a1bc53d 100644 (file)
@@ -1,6 +1,6 @@
-/* $Id: d1_absyn.c,v 1.13 2004-09-30 18:30:35 adam Exp $
-   Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
-   Index Data Aps
+/* $Id: d1_absyn.c,v 1.25 2006-05-19 13:49:33 adam Exp $
+   Copyright (C) 1995-2006
+   Index Data ApS
 
 This file is part of the Zebra server.
 
@@ -25,9 +25,10 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include <stdlib.h>
 #include <string.h>
 
-#include <yaz/oid.h>
 #include <yaz/log.h>
+#include <yaz/oid.h>
 #include <idzebra/data1.h>
+#include <idzebra/recctrl.h>
 #include <zebra_xpath.h>
 #include <d1_absyn.h>
 
@@ -79,7 +80,7 @@ struct data1_hash_table *data1_hash_open(int size, NMEM nmem)
 void data1_hash_insert(struct data1_hash_table *ht, const char *str,
                       void *clientData, int copy)
 {
-    char *dstr = copy ? nmem_strdup(ht->nmem, str) : str;
+    char *dstr = copy ? nmem_strdup(ht->nmem, str) : (char*) str;
     if (strchr(str, '?') || strchr(str, '.'))
     {
        int i;
@@ -183,7 +184,7 @@ void data1_absyn_destroy (data1_handle dh)
        {
            data1_xpelement *xpe = abs->xp_elements;
            while (xpe) {
-               logf (LOG_DEBUG,"Destroy xp element %s",xpe->xpath_expr);
+               yaz_log (YLOG_DEBUG,"Destroy xp element %s",xpe->xpath_expr);
                if (xpe->dfa) {  dfa_delete (&xpe->dfa); }
                xpe = xpe->next;
            } 
@@ -273,7 +274,7 @@ data1_attset *data1_attset_add (data1_handle dh, const char *name)
            *cp = '\0';
     }
     if (!attset)
-       yaz_log (LOG_WARN|LOG_ERRNO, "Couldn't load attribute set %s", name);
+       yaz_log (YLOG_WARN|YLOG_ERRNO, "Couldn't load attribute set %s", name);
     else
     {
        data1_attset_cache p = (data1_attset_cache)
@@ -413,7 +414,7 @@ void fix_element_ref (data1_handle dh, data1_absyn *absyn, data1_element *e)
            if (sub_e)
                e->children = sub_e->elements;
            else
-               yaz_log (LOG_WARN, "Unresolved reference to sub-elements %s",
+               yaz_log (YLOG_WARN, "Unresolved reference to sub-elements %s",
                      e->sub_name);
        }
     }
@@ -439,78 +440,81 @@ void fix_element_ref (data1_handle dh, data1_absyn *absyn, data1_element *e)
 
  */
 
-const char * mk_xpath_regexp (data1_handle dh, char *expr) 
+static const char * mk_xpath_regexp (data1_handle dh, const char *expr) 
 {
-    char *p = expr;
-    char *pp;
-    char *s;
+    const char *p = expr;
     int abs = 1;
-    int i;
-    int j;
-    int e=0;
-    int is_predicate = 0;
-    
-    static char *stack[32];
-    static char res[1024];
-    char *r = "";
+    int e = 0;
+    char *stack[32];
+    char *res_p, *res = 0;
+    size_t res_size = 1;
     
-    if (*p != '/') { return (""); }
+    if (*p != '/')
+       return ("");
     p++;
-    if (*p == '/') { abs=0; p++; }
-    
-    while (*p) {
-        i=0;
-        while (*p && !strchr("/",*p)) { 
-         i++; p++; 
-       }
-        stack[e] = (char *) nmem_malloc (data1_nmem_get (dh), i+1);
+    if (*p == '/') 
+    { 
+       abs =0;
+       p++;
+    }
+    while (*p)
+    {
+       int is_predicate = 0;
+       char *s;
+       int i, j;
+        for (i = 0; *p && !strchr("/",*p); i++, p++)
+           ;
+       res_size += (i+3); /* we'll add / between later .. */
+        stack[e] = (char *) nmem_malloc(data1_nmem_get(dh), i+1);
        s = stack[e];
-       for (j=0; j< i; j++) {
-         pp = p-i+j;
-         if (*pp == '[') {
-           is_predicate=1;
-         }
-         else if (*pp == ']') {
-           is_predicate=0;
-         }
-         else {
-           if (!is_predicate) {
-             if (*pp == '*') 
-                *s++ = '.';
-             *s++ = *pp;
+       for (j = 0; j < i; j++)
+       {
+           const char *pp = p-i+j;
+           if (*pp == '[')
+               is_predicate=1;
+           else if (*pp == ']')
+               is_predicate=0;
+           else 
+           {
+               if (!is_predicate) {
+                   if (*pp == '*') 
+                       *s++ = '.';
+                   *s++ = *pp;
+               }
            }
-         }
        }
        *s = 0;
         e++;
-        if (*p) {p++;}
+        if (*p)
+           p++;
     }
-    e--;  p = &res[0]; i=0;
-    sprintf (p, "^"); p++;
-    while (e >= 0) {
-        /* !!! res size is not checked !!! */
-        sprintf (p, "%s/",stack[e]);
-        p += strlen(stack[e]) + 1;
-        e--;
+    res_p = res = nmem_malloc(data1_nmem_get(dh), res_size + 10);
+
+    if (stack[e-1][0] == '@')  /* path/@attr spec (leaf is attribute) */
+       strcpy(res_p, "/");
+    else
+       strcpy(res_p, "[^@]*/");  /* path .. (index all cdata below it) */
+    res_p = res_p + strlen(res_p);
+    while (--e >= 0) {
+       sprintf(res_p, "%s/", stack[e]);
+       res_p += strlen(stack[e]) + 1;
     }
-    if (!abs) { sprintf (p, ".*"); p+=2; }
-    sprintf (p, "$"); p++;
-    r = nmem_strdup (data1_nmem_get (dh), res);
-    yaz_log(LOG_DEBUG,"Got regexp: %s",r);
-    return (r);
+    if (!abs)
+    {
+       sprintf(res_p, ".*"); 
+       res_p += 2;
+    }
+    sprintf (res_p, "$");
+    res_p++;
+    yaz_log(YLOG_DEBUG, "Got regexp: %s", res);
+    return res;
 }
 
-/* *ostrich*
-
-   added arg xpelement... when called from xelm context, it's 1, saying
-   that ! means xpath, not element name as attribute name...
-
-   pop, 2002-12-13
- */
-static int parse_termlists (data1_handle dh, data1_termlist ***tpp,
-                           char *cp, const char *file, int lineno,
-                           const char *element_name, data1_absyn *res,
-                           int xpelement)
+static int parse_termlists(data1_handle dh, data1_termlist ***tpp,
+                           char *cp, const char *file, int lineno,
+                           const char *element_name, data1_absyn *res,
+                           int xpelement,
+                           data1_attset *attset)
 {
     data1_termlist **tp = *tpp;
     while(1)
@@ -528,7 +532,7 @@ static int parse_termlists (data1_handle dh, data1_termlist ***tpp,
        if (i == 0)
        {
            if (*cp)
-               yaz_log(LOG_WARN,
+               yaz_log(YLOG_WARN,
                        "%s:%d: Syntax error in termlistspec '%s'",
                        file, lineno, cp);
            break;
@@ -561,22 +565,24 @@ static int parse_termlists (data1_handle dh, data1_termlist ***tpp,
            nmem_malloc(data1_nmem_get(dh), sizeof(**tp));
        (*tp)->next = 0;
         
-       if (!xpelement) {
-            if (*attname == '!')
+        if (*attname == '!')
+        {
+            if (!xpelement && element_name)
                 strcpy(attname, element_name);
-       }
-       if (!((*tp)->att = data1_getattbyname(dh, res->attset,
-                                              attname))) {
-            if ((!xpelement) || (*attname != '!')) {
-                yaz_log(LOG_WARN,
-                        "%s:%d: Couldn't find att '%s' in attset",
-                        file, lineno, attname);
-                return -1;
-            } else {
-                (*tp)->att = 0;
+            else if (xpelement)
+                strcpy(attname, ZEBRA_XPATH_CDATA);
+        }
+        if (attset)
+        {
+            if (!data1_getattbyname(dh, attset, attname))
+            {
+                yaz_log(YLOG_WARN, "Index '%s' not found in attset(s)",
+                        attname);
             }
-       }
-        
+        }
+
+        (*tp)->index_name = nmem_strdup(data1_nmem_get(dh), attname);
+        assert (*(*tp)->index_name != '!');
        if (r == 2 && (source = strchr(structure, ':')))
            *source++ = '\0';   /* cut off structure .. */
        else
@@ -596,6 +602,33 @@ static int parse_termlists (data1_handle dh, data1_termlist ***tpp,
     return 0;
 }
 
+/* quinn
+ * Converts a 'melm' field[$subfield] pattern to a simple xpath
+ */
+static int melm2xpath(char *melm, char *buf)
+{
+    char *dollar;
+    char *field = melm;
+    char *subfield;
+    char *fieldtype;
+    if ((dollar = strchr(melm, '$'))) {
+       *dollar = '\0';
+       subfield = ++dollar;
+    } else
+       subfield = "";
+    if (field[0] == '0' && field[1] == '0')
+       fieldtype = "controlfield";
+    else
+       fieldtype = "datafield";
+    sprintf(buf, "/*/%s[@tag=\"%s\"]", fieldtype, field);
+    if (*subfield) 
+       sprintf(buf + strlen(buf), "/subfield[@code=\"%s\"]", subfield);
+    else if (field[0] != '0' || field[1] != '0')
+       strcat(buf, "/subfield");
+    yaz_log(YLOG_DEBUG, "Created xpath: '%s'", buf);
+    return 0;
+}
+
 const char *data1_systag_lookup(data1_absyn *absyn, const char *tag,
                                 const char *default_value)
 {
@@ -663,6 +696,8 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file,
 {
     data1_sub_elements *cur_elements = NULL;
     data1_xpelement *cur_xpelement = NULL;
+    data1_attset *attset_list = data1_empty_attset(dh);
+    data1_attset_child **attset_childp = &attset_list->children;
 
     data1_absyn *res = 0;
     FILE *f;
@@ -671,7 +706,6 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file,
     data1_maptab **maptabp;
     data1_marctab **marcp;
     data1_termlist *all = 0;
-    data1_attset_child **attset_childp;
     data1_tagset **tagset_childp;
     struct data1_systag **systagsp;
     int level = 0;
@@ -681,7 +715,7 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file,
 
     if (!(f = data1_path_fopen(dh, file, "r")))
     {
-       yaz_log(LOG_WARN|LOG_ERRNO, "Couldn't open %s", file);
+       yaz_log(YLOG_WARN|YLOG_ERRNO, "Couldn't open %s", file);
         if (file_must_exist)
             return 0;
     }
@@ -696,9 +730,6 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file,
     systagsp = &res->systags;
     tagset_childp = &res->tagset;
 
-    res->attset = data1_empty_attset (dh);
-    attset_childp =  &res->attset->children;
-
     res->varset = 0;
     res->esetnames = 0;
     esetpp = &res->esetnames;
@@ -709,7 +740,7 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file,
     res->sub_elements = NULL;
     res->main_elements = NULL;
     res->xp_elements = NULL;
-    
+
     while (f && (argc = read_absyn_line(f, &lineno, line, 512, argv, 50)))
     {
        char *cmd = *argv;
@@ -723,7 +754,7 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file,
 
            if (argc < 4)
            {
-               yaz_log(LOG_WARN, "%s:%d: Bad # of args to elm", file, lineno);
+               yaz_log(YLOG_WARN, "%s:%d: Bad # of args to elm", file, lineno);
                continue;
            }
            path = argv[1];
@@ -754,7 +785,7 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file,
            }
            if (i > level+1)
            {
-               yaz_log(LOG_WARN, "%s:%d: Bad level increase", file, lineno);
+               yaz_log(YLOG_WARN, "%s:%d: Bad level increase", file, lineno);
                fclose(f);
                return 0;
            }
@@ -777,14 +808,14 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file,
            {
                if (!res->tagset)
                {
-                   yaz_log(LOG_WARN, "%s:%d: No tagset loaded", file, lineno);
+                   yaz_log(YLOG_WARN, "%s:%d: No tagset loaded", file, lineno);
                    fclose(f);
                    return 0;
                }
                if (!(new_element->tag = data1_gettagbynum (dh, res->tagset,
                                                            type, value)))
                {
-                   yaz_log(LOG_WARN, "%s:%d: Couldn't find tag %s in tagset",
+                   yaz_log(YLOG_WARN, "%s:%d: Couldn't find tag %s in tagset",
                         file, lineno, p);
                    fclose(f);
                    return 0;
@@ -810,7 +841,7 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file,
            }
            else
            {
-               yaz_log(LOG_WARN, "%s:%d: Bad element", file, lineno);
+               yaz_log(YLOG_WARN, "%s:%d: Bad element", file, lineno);
                fclose(f);
                return 0;
            }
@@ -818,9 +849,8 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file,
            p = termlists;
            if (*p != '-')
            {
-               assert (res->attset);
-               
-               if (parse_termlists (dh, &tp, p, file, lineno, name, res, 0))
+               if (parse_termlists (dh, &tp, p, file, lineno, name, res, 0,
+                                     attset_list))
                {
                    fclose (f);
                    return 0;
@@ -843,25 +873,33 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file,
           pop, 2003-01-17
        */
 
-       else if (!strcmp(cmd, "xelm")) {
+       else if (!strcmp(cmd, "xelm") || !strcmp(cmd, "melm")) {
 
            int i;
            char *p, *xpath_expr, *termlists;
            const char *regexp;
            struct DFA *dfa = dfa = dfa_init();
            data1_termlist **tp;
+           char melm_xpath[128];
             
            if (argc < 3)
            {
-               yaz_log(LOG_WARN, "%s:%d: Bad # of args to xelm", file, lineno);
+               yaz_log(YLOG_WARN, "%s:%d: Bad # of args to xelm", file, lineno);
                continue;
            }
-           xpath_expr = argv[1];
+
+           if (!strcmp(cmd, "melm")) {
+               if (melm2xpath(argv[1], melm_xpath) < 0)
+                   continue;
+               xpath_expr = melm_xpath;
+           } else {
+               xpath_expr = argv[1];
+           }
            termlists = argv[2];
            regexp = mk_xpath_regexp(dh, xpath_expr);
            i = dfa_parse (dfa, &regexp);
            if (i || *regexp) {
-                yaz_log(LOG_WARN, "%s:%d: Bad xpath to xelm", file, lineno);
+                yaz_log(YLOG_WARN, "%s:%d: Bad xpath to xelm", file, lineno);
                 dfa_delete (&dfa);
                 continue;
            }
@@ -900,10 +938,8 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file,
            p = termlists;
            if (*p != '-')
            {
-               assert (res->attset);
-               
                if (parse_termlists (dh, &tp, p, file, lineno,
-                                     xpath_expr, res, 1))
+                                     xpath_expr, res, 1, attset_list))
                {
                    fclose (f);
                    return 0;
@@ -917,7 +953,7 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file,
            
            if (argc < 2)
            {
-               yaz_log(LOG_WARN, "%s:%d: Bad # of args to section",
+               yaz_log(YLOG_WARN, "%s:%d: Bad # of args to section",
                         file, lineno);
                continue;
            }
@@ -937,7 +973,7 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file,
         {
             if (argc != 2)
             {
-               yaz_log(LOG_WARN, "%s:%d: Bad # of args to 'xpath' directive",
+               yaz_log(YLOG_WARN, "%s:%d: Bad # of args to 'xpath' directive",
                     file, lineno);
                continue;
             }
@@ -947,7 +983,7 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file,
                 res->enable_xpath_indexing = 0;
             else
             {
-               yaz_log(LOG_WARN, "%s:%d: Expecting disable/enable "
+               yaz_log(YLOG_WARN, "%s:%d: Expecting disable/enable "
                         "after 'xpath' directive", file, lineno);
             }
         }
@@ -956,17 +992,18 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file,
            data1_termlist **tp = &all;
            if (all)
            {
-               yaz_log(LOG_WARN, "%s:%d: Too many 'all' directives - ignored",
+               yaz_log(YLOG_WARN, "%s:%d: Too many 'all' directives - ignored",
                     file, lineno);
                continue;
            }
            if (argc != 2)
            {
-               yaz_log(LOG_WARN, "%s:%d: Bad # of args to 'all' directive",
+               yaz_log(YLOG_WARN, "%s:%d: Bad # of args to 'all' directive",
                     file, lineno);
                continue;
            }
-           if (parse_termlists (dh, &tp, argv[1], file, lineno, 0, res, 0))
+           if (parse_termlists (dh, &tp, argv[1], file, lineno, 0, res, 0,
+                                 attset_list))
            {
                fclose (f);
                return 0;
@@ -976,7 +1013,7 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file,
        {
            if (argc != 2)
            {
-               yaz_log(LOG_WARN, "%s:%d: Bad # of args to name directive",
+               yaz_log(YLOG_WARN, "%s:%d: Bad # of args to name directive",
                     file, lineno);
                continue;
            }
@@ -988,41 +1025,41 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file,
            
            if (argc != 2)
            {
-               yaz_log(LOG_WARN, "%s:%d: Bad # of args to reference",
+               yaz_log(YLOG_WARN, "%s:%d: Bad # of args to reference",
                     file, lineno);
                continue;
            }
            name = argv[1];
            if ((res->reference = oid_getvalbyname(name)) == VAL_NONE)
            {
-               yaz_log(LOG_WARN, "%s:%d: Unknown tagset ref '%s'", 
+               yaz_log(YLOG_WARN, "%s:%d: Unknown tagset ref '%s'", 
                     file, lineno, name);
                continue;
            }
        }
        else if (!strcmp(cmd, "attset"))
        {
-           char *name;
-           data1_attset *attset;
-           
-           if (argc != 2)
-           {
-               yaz_log(LOG_WARN, "%s:%d: Bad # of args to attset",
-                    file, lineno);
-               continue;
-           }
-           name = argv[1];
-           if (!(attset = data1_get_attset (dh, name)))
-           {
-               yaz_log(LOG_WARN, "%s:%d: Couldn't find attset  %s",
-                    file, lineno, name);
-               continue;
-           }
-           *attset_childp = (data1_attset_child *)
-               nmem_malloc (data1_nmem_get(dh), sizeof(**attset_childp));
-           (*attset_childp)->child = attset;
-           (*attset_childp)->next = 0;
-           attset_childp = &(*attset_childp)->next;
+           char *name;
+           data1_attset *attset;
+           
+           if (argc != 2)
+           {
+               yaz_log(YLOG_WARN, "%s:%d: Bad # of args to attset",
+                    file, lineno);
+               continue;
+           }
+           name = argv[1];
+           if (!(attset = data1_get_attset (dh, name)))
+           {
+               yaz_log(YLOG_WARN, "%s:%d: Couldn't find attset  %s",
+                       file, lineno, name);
+               continue;
+           }
+           *attset_childp = (data1_attset_child *)
+               nmem_malloc (data1_nmem_get(dh), sizeof(**attset_childp));
+           (*attset_childp)->child = attset;
+           (*attset_childp)->next = 0;
+           attset_childp = &(*attset_childp)->next;
        }
        else if (!strcmp(cmd, "tagset"))
        {
@@ -1030,7 +1067,7 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file,
            int type = 0;
            if (argc < 2)
            {
-               yaz_log(LOG_WARN, "%s:%d: Bad # of args to tagset",
+               yaz_log(YLOG_WARN, "%s:%d: Bad # of args to tagset",
                     file, lineno);
                continue;
            }
@@ -1040,7 +1077,7 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file,
            *tagset_childp = data1_read_tagset (dh, name, type);
            if (!(*tagset_childp))
            {
-               yaz_log(LOG_WARN, "%s:%d: Couldn't load tagset %s",
+               yaz_log(YLOG_WARN, "%s:%d: Couldn't load tagset %s",
                     file, lineno, name);
                continue;
            }
@@ -1052,14 +1089,14 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file,
 
            if (argc != 2)
            {
-               yaz_log(LOG_WARN, "%s:%d: Bad # of args in varset",
+               yaz_log(YLOG_WARN, "%s:%d: Bad # of args in varset",
                     file, lineno);
                continue;
            }
            name = argv[1];
            if (!(res->varset = data1_read_varset (dh, name)))
            {
-               yaz_log(LOG_WARN, "%s:%d: Couldn't load Varset %s",
+               yaz_log(YLOG_WARN, "%s:%d: Couldn't load Varset %s",
                     file, lineno, name);
                continue;
            }
@@ -1070,7 +1107,7 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file,
 
            if (argc != 3)
            {
-               yaz_log(LOG_WARN, "%s:%d: Bad # of args in esetname",
+               yaz_log(YLOG_WARN, "%s:%d: Bad # of args in esetname",
                     file, lineno);
                continue;
            }
@@ -1085,7 +1122,7 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file,
                (*esetpp)->spec = 0;
            else if (!((*esetpp)->spec = data1_read_espec1 (dh, fname)))
            {
-               yaz_log(LOG_WARN, "%s:%d: Espec-1 read failed for %s",
+               yaz_log(YLOG_WARN, "%s:%d: Espec-1 read failed for %s",
                     file, lineno, fname);
                continue;
            }
@@ -1097,14 +1134,14 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file,
            
            if (argc != 2)
            {
-               yaz_log(LOG_WARN, "%s:%d: Bad # of args for maptab",
+               yaz_log(YLOG_WARN, "%s:%d: Bad # of args for maptab",
                      file, lineno);
                continue;
            }
            name = argv[1];
            if (!(*maptabp = data1_read_maptab (dh, name)))
            {
-               yaz_log(LOG_WARN, "%s:%d: Couldn't load maptab %s",
+               yaz_log(YLOG_WARN, "%s:%d: Couldn't load maptab %s",
                      file, lineno, name);
                continue;
            }
@@ -1116,14 +1153,14 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file,
            
            if (argc != 2)
            {
-               yaz_log(LOG_WARN, "%s:%d: Bad # or args for marc",
+               yaz_log(YLOG_WARN, "%s:%d: Bad # or args for marc",
                     file, lineno);
                continue;
            }
            name = argv[1];
            if (!(*marcp = data1_read_marctab (dh, name)))
            {
-               yaz_log(LOG_WARN, "%s:%d: Couldn't read marctab %s",
+               yaz_log(YLOG_WARN, "%s:%d: Couldn't read marctab %s",
                      file, lineno, name);
                continue;
            }
@@ -1133,7 +1170,7 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file,
        {
            if (argc != 2)
            {
-               yaz_log(LOG_WARN, "%s:%d: Bad # or args for encoding",
+               yaz_log(YLOG_WARN, "%s:%d: Bad # or args for encoding",
                     file, lineno);
                continue;
            }
@@ -1143,7 +1180,7 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file,
         {
             if (argc != 3)
             {
-               yaz_log(LOG_WARN, "%s:%d: Bad # or args for systag",
+               yaz_log(YLOG_WARN, "%s:%d: Bad # or args for systag",
                     file, lineno);
                continue;
             }
@@ -1155,7 +1192,7 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file,
         }
        else
        {
-           yaz_log(LOG_WARN, "%s:%d: Unknown directive '%s'", file, 
+           yaz_log(YLOG_WARN, "%s:%d: Unknown directive '%s'", file, 
                     lineno, cmd);
            continue;
        }
@@ -1171,6 +1208,14 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file,
        fix_element_ref (dh, res, cur_elements->elements);
     }
     *systagsp = 0;
-    yaz_log(LOG_DEBUG, "%s: data1_read_absyn end", file);
+    yaz_log(YLOG_DEBUG, "%s: data1_read_absyn end", file);
     return res;
 }
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+