1 /* $Id: d1_absyn.c,v 1.20 2005-06-23 06:45:46 adam Exp $
2 Copyright (C) 1995-2005
5 This file is part of the Zebra server.
7 Zebra is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
12 Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with Zebra; see the file LICENSE.zebra. If not, write to the
19 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
30 #include <idzebra/data1.h>
31 #include <zebra_xpath.h>
34 #define D1_MAX_NESTING 128
36 struct data1_hash_table {
39 struct data1_hash_entry **ar;
42 struct data1_hash_entry {
45 struct data1_hash_entry *next;
48 unsigned data1_hash_calc(struct data1_hash_table *ht, const char *str)
54 if (*str >= 'a' && *str <= 'z')
55 v = v*65509 + *str -'a'+10;
56 else if (*str >= 'A' && *str <= 'Z')
57 v = v*65509 + *str -'A'+10;
58 else if (*str >= '0' && *str <= '9')
59 v = v*65509 + *str -'0';
65 struct data1_hash_table *data1_hash_open(int size, NMEM nmem)
68 struct data1_hash_table *ht = nmem_malloc(nmem, sizeof(*ht));
73 ht->ar = nmem_malloc(nmem, sizeof(*ht->ar) * ht->size);
74 for (i = 0; i<ht->size; i++)
79 void data1_hash_insert(struct data1_hash_table *ht, const char *str,
80 void *clientData, int copy)
82 char *dstr = copy ? nmem_strdup(ht->nmem, str) : (char*) str;
83 if (strchr(str, '?') || strchr(str, '.'))
86 for (i = 0; i<ht->size; i++)
88 struct data1_hash_entry **he = &ht->ar[i];
89 for (; *he && strcmp(str, (*he)->str); he = &(*he)->next)
93 *he = nmem_malloc(ht->nmem, sizeof(**he));
97 (*he)->clientData = clientData;
102 struct data1_hash_entry **he = &ht->ar[data1_hash_calc(ht, str)];
103 for (; *he && strcmp(str, (*he)->str); he = &(*he)->next)
107 *he = nmem_malloc(ht->nmem, sizeof(**he));
111 (*he)->clientData = clientData;
115 void *data1_hash_lookup(struct data1_hash_table *ht, const char *str)
117 struct data1_hash_entry **he = &ht->ar[data1_hash_calc(ht, str)];
119 for (; *he && yaz_matchstr(str, (*he)->str); he = &(*he)->next)
122 return (*he)->clientData;
126 struct data1_systag {
129 struct data1_systag *next;
132 struct data1_absyn_cache_info
136 data1_absyn_cache next;
139 struct data1_attset_cache_info
142 data1_attset *attset;
143 data1_attset_cache next;
146 data1_element *data1_mk_element(data1_handle dh)
148 data1_element *e = nmem_malloc(data1_nmem_get(dh), sizeof(*e));
152 e->next = e->children = 0;
158 data1_absyn *data1_absyn_search (data1_handle dh, const char *name)
160 data1_absyn_cache p = *data1_absyn_cache_get (dh);
164 if (!yaz_matchstr (name, p->name))
171 We need to destroy DFAs, in xp_element (xelm) definitions
175 void data1_absyn_destroy (data1_handle dh)
177 data1_absyn_cache p = *data1_absyn_cache_get (dh);
181 data1_absyn *abs = p->absyn;
184 data1_xpelement *xpe = abs->xp_elements;
186 yaz_log (YLOG_DEBUG,"Destroy xp element %s",xpe->xpath_expr);
187 if (xpe->dfa) { dfa_delete (&xpe->dfa); }
196 void data1_absyn_trav (data1_handle dh, void *handle,
197 void (*fh)(data1_handle dh, void *h, data1_absyn *a))
199 data1_absyn_cache p = *data1_absyn_cache_get (dh);
203 (*fh)(dh, handle, p->absyn);
208 data1_absyn *data1_absyn_add (data1_handle dh, const char *name)
211 NMEM mem = data1_nmem_get (dh);
213 data1_absyn_cache p = (data1_absyn_cache)nmem_malloc (mem, sizeof(*p));
214 data1_absyn_cache *pp = data1_absyn_cache_get (dh);
216 sprintf(fname, "%s.abs", name);
217 p->absyn = data1_read_absyn (dh, fname, 0);
218 p->name = nmem_strdup (mem, name);
224 data1_absyn *data1_get_absyn (data1_handle dh, const char *name)
228 if (!(absyn = data1_absyn_search (dh, name)))
229 absyn = data1_absyn_add (dh, name);
233 data1_attset *data1_attset_search_name (data1_handle dh, const char *name)
235 data1_attset_cache p = *data1_attset_cache_get (dh);
239 if (!yaz_matchstr (name, p->name))
246 data1_attset *data1_attset_search_id (data1_handle dh, int id)
248 data1_attset_cache p = *data1_attset_cache_get (dh);
252 if (id == p->attset->reference)
259 data1_attset *data1_attset_add (data1_handle dh, const char *name)
261 char fname[512], aname[512];
262 NMEM mem = data1_nmem_get (dh);
263 data1_attset *attset;
265 strcpy (aname, name);
266 sprintf(fname, "%s.att", name);
267 attset = data1_read_attset (dh, fname);
271 attset = data1_read_attset (dh, name);
272 if (attset && (cp = strrchr (aname, '.')))
276 yaz_log (YLOG_WARN|YLOG_ERRNO, "Couldn't load attribute set %s", name);
279 data1_attset_cache p = (data1_attset_cache)
280 nmem_malloc (mem, sizeof(*p));
281 data1_attset_cache *pp = data1_attset_cache_get (dh);
283 attset->name = p->name = nmem_strdup (mem, aname);
291 data1_attset *data1_get_attset (data1_handle dh, const char *name)
293 data1_attset *attset;
295 if (!(attset = data1_attset_search_name (dh, name)))
296 attset = data1_attset_add (dh, name);
300 data1_esetname *data1_getesetbyname(data1_handle dh, data1_absyn *a,
305 for (r = a->esetnames; r; r = r->next)
306 if (!data1_matchstr(r->name, name))
311 /* we have multiple versions of data1_getelementbyname */
312 #define DATA1_GETELEMENTBYTAGNAME_VERSION 1
314 #if DATA1_GETELEMENTBYTAGNAME_VERSION==0
315 /* straight linear search */
316 data1_element *data1_getelementbytagname (data1_handle dh, data1_absyn *abs,
317 data1_element *parent,
322 /* It's now possible to have a data1 tree with no abstract syntax */
327 r = abs->main_elements;
329 r = parent->children;
331 for (; r; r = r->next)
335 for (n = r->tag->names; n; n = n->next)
336 if (!data1_matchstr(tagname, n->name))
343 #if DATA1_GETELEMENTBYTAGNAME_VERSION==1
344 /* using hash search */
345 data1_element *data1_getelementbytagname (data1_handle dh, data1_absyn *abs,
346 data1_element *parent,
350 struct data1_hash_table *ht;
352 /* It's now possible to have a data1 tree with no abstract syntax */
357 r = abs->main_elements;
359 r = parent->children;
367 ht = r->hash = data1_hash_open(29, data1_nmem_get(dh));
368 for (; r; r = r->next)
372 for (n = r->tag->names; n; n = n->next)
373 data1_hash_insert(ht, n->name, r, 0);
376 return data1_hash_lookup(ht, tagname);
380 data1_element *data1_getelementbyname (data1_handle dh, data1_absyn *absyn,
385 /* It's now possible to have a data1 tree with no abstract syntax */
388 for (r = absyn->main_elements; r; r = r->next)
389 if (!data1_matchstr(r->name, name))
395 void fix_element_ref (data1_handle dh, data1_absyn *absyn, data1_element *e)
397 /* It's now possible to have a data1 tree with no abstract syntax */
401 for (; e; e = e->next)
406 fix_element_ref (dh, absyn, e->children);
410 data1_sub_elements *sub_e = absyn->sub_elements;
411 while (sub_e && strcmp (e->sub_name, sub_e->name))
414 e->children = sub_e->elements;
416 yaz_log (YLOG_WARN, "Unresolved reference to sub-elements %s",
423 New function, a bit dummy now... I've seen it in zrpn.c... We should build
424 more clever regexps...
436 Now [] predicates are supported
442 const char * mk_xpath_regexp (data1_handle dh, char *expr)
451 int is_predicate = 0;
453 static char *stack[32];
454 static char res[1024];
457 if (*p != '/') { return (""); }
459 if (*p == '/') { abs=0; p++; }
463 while (*p && !strchr("/",*p)) {
466 stack[e] = (char *) nmem_malloc (data1_nmem_get (dh), i+1);
468 for (j=0; j< i; j++) {
473 else if (*pp == ']') {
488 e--; p = &res[0]; i=0;
489 sprintf (p, "^"); p++;
491 /* !!! res size is not checked !!! */
492 sprintf (p, "%s/",stack[e]);
493 p += strlen(stack[e]) + 1;
496 if (!abs) { sprintf (p, ".*"); p+=2; }
497 sprintf (p, "$"); p++;
498 r = nmem_strdup (data1_nmem_get (dh), res);
499 yaz_log(YLOG_DEBUG,"Got regexp: %s",r);
505 added arg xpelement... when called from xelm context, it's 1, saying
506 that ! means xpath, not element name as attribute name...
510 static int parse_termlists (data1_handle dh, data1_termlist ***tpp,
511 char *cp, const char *file, int lineno,
512 const char *element_name, data1_absyn *res,
515 data1_termlist **tp = *tpp;
518 char attname[512], structure[512];
523 for (i = 0; cp[i] && i<sizeof(attname)-1; i++)
524 if (strchr(":,", cp[i]))
532 "%s:%d: Syntax error in termlistspec '%s'",
542 for (i = 0; cp[i] && i<sizeof(structure)-1; i++)
543 if (level == 0 && strchr(",", cp[i]))
547 structure[i] = cp[i];
550 else if (cp[i] == ')')
560 *tp = (data1_termlist *)
561 nmem_malloc(data1_nmem_get(dh), sizeof(**tp));
565 (*tp)->index_name = nmem_strdup(data1_nmem_get(dh), element_name);
566 if (*attname == '!' && xpelement)
567 (*tp)->index_name = 0;
571 strcpy(attname, element_name);
573 if (!((*tp)->att = data1_getattbyname(dh, res->attset, attname)))
575 if ((!xpelement) || (*attname != '!')) {
577 "%s:%d: Couldn't find att '%s' in attset",
578 file, lineno, attname);
585 if (r == 2 && (source = strchr(structure, ':')))
586 *source++ = '\0'; /* cut off structure .. */
588 source = "data"; /* ok: default is leaf data */
589 (*tp)->source = (char *)
590 nmem_strdup (data1_nmem_get (dh), source);
592 if (r < 2) /* is the structure qualified? */
593 (*tp)->structure = "w";
595 (*tp)->structure = (char *)
596 nmem_strdup (data1_nmem_get (dh), structure);
605 * Converts a 'melm' field[$subfield] pattern to a simple xpath
607 static int melm2xpath(char *melm, char *buf)
613 if ((dollar = strchr(melm, '$'))) {
618 if (field[0] == '0' && field[1] == '0')
619 fieldtype = "controlfield";
621 fieldtype = "datafield";
622 sprintf(buf, "/*/%s[@tag=\"%s\"]", fieldtype, field);
624 sprintf(buf + strlen(buf), "/subfield[@code=\"%s\"]", subfield);
625 else if (field[0] != '0' || field[1] != '0')
626 strcat(buf, "/subfield");
627 yaz_log(YLOG_DEBUG, "Created xpath: '%s'", buf);
631 const char *data1_systag_lookup(data1_absyn *absyn, const char *tag,
632 const char *default_value)
634 struct data1_systag *p = absyn->systags;
635 for (; p; p = p->next)
636 if (!strcmp(p->name, tag))
638 return default_value;
641 #define l_isspace(c) ((c) == '\t' || (c) == ' ' || (c) == '\n' || (c) == '\r')
643 int read_absyn_line(FILE *f, int *lineno, char *line, int len,
644 char *argv[], int num)
650 while ((p = fgets(line, len, f)))
653 while (*p && l_isspace(*p))
661 for (argc = 0; *p ; argc++)
663 if (*p == '#') /* trailing comment */
666 while (*p && !(l_isspace(*p) && !quoted)) {
667 if (*p =='"') quoted = 1 - quoted;
668 if (*p =='[') quoted = 1;
669 if (*p ==']') quoted = 0;
675 while (*p && l_isspace(*p))
682 data1_marctab *data1_absyn_getmarctab(data1_handle dh, data1_absyn *absyn)
687 YAZ_EXPORT data1_element *data1_absyn_getelements(data1_handle dh,
690 return absyn->main_elements;
693 data1_absyn *data1_read_absyn (data1_handle dh, const char *file,
696 data1_sub_elements *cur_elements = NULL;
697 data1_xpelement *cur_xpelement = NULL;
699 data1_absyn *res = 0;
701 data1_element **ppl[D1_MAX_NESTING];
702 data1_esetname **esetpp;
703 data1_maptab **maptabp;
704 data1_marctab **marcp;
705 data1_termlist *all = 0;
706 data1_attset_child **attset_childp;
707 data1_tagset **tagset_childp;
708 struct data1_systag **systagsp;
712 char *argv[50], line[512];
714 if (!(f = data1_path_fopen(dh, file, "r")))
716 yaz_log(YLOG_WARN|YLOG_ERRNO, "Couldn't open %s", file);
721 res = (data1_absyn *) nmem_malloc(data1_nmem_get(dh), sizeof(*res));
723 res->reference = VAL_NONE;
726 res->enable_xpath_indexing = (f ? 0 : 1);
728 systagsp = &res->systags;
729 tagset_childp = &res->tagset;
731 res->attset = data1_empty_attset (dh);
732 attset_childp = &res->attset->children;
736 esetpp = &res->esetnames;
738 maptabp = &res->maptabs;
741 res->sub_elements = NULL;
742 res->main_elements = NULL;
743 res->xp_elements = NULL;
745 while (f && (argc = read_absyn_line(f, &lineno, line, 512, argv, 50)))
748 if (!strcmp(cmd, "elm") || !strcmp(cmd, "element"))
750 data1_element *new_element;
752 char *p, *sub_p, *path, *name, *termlists;
758 yaz_log(YLOG_WARN, "%s:%d: Bad # of args to elm", file, lineno);
767 cur_elements = (data1_sub_elements *)
768 nmem_malloc(data1_nmem_get(dh), sizeof(*cur_elements));
769 cur_elements->next = res->sub_elements;
770 cur_elements->elements = NULL;
771 cur_elements->name = "main";
772 res->sub_elements = cur_elements;
775 ppl[level] = &cur_elements->elements;
782 if ((e = strchr(p, '/')))
789 yaz_log(YLOG_WARN, "%s:%d: Bad level increase", file, lineno);
794 new_element = *ppl[level-1] = data1_mk_element(dh);
796 tp = &new_element->termlists;
797 ppl[level-1] = &new_element->next;
798 ppl[level] = &new_element->children;
800 /* consider subtree (if any) ... */
801 if ((sub_p = strchr (p, ':')) && sub_p[1])
804 new_element->sub_name =
805 nmem_strdup (data1_nmem_get(dh), sub_p);
807 /* well-defined tag */
808 if (sscanf(p, "(%d,%d)", &type, &value) == 2)
812 yaz_log(YLOG_WARN, "%s:%d: No tagset loaded", file, lineno);
816 if (!(new_element->tag = data1_gettagbynum (dh, res->tagset,
819 yaz_log(YLOG_WARN, "%s:%d: Couldn't find tag %s in tagset",
829 new_element->tag = (data1_tag *)
830 nmem_malloc(data1_nmem_get (dh),
831 sizeof(*new_element->tag));
832 nt->which = DATA1T_string;
833 nt->value.string = nmem_strdup(data1_nmem_get (dh), p);
834 nt->names = (data1_name *)
835 nmem_malloc(data1_nmem_get(dh),
836 sizeof(*new_element->tag->names));
837 nt->names->name = nt->value.string;
839 nt->kind = DATA1K_string;
845 yaz_log(YLOG_WARN, "%s:%d: Bad element", file, lineno);
849 /* parse termList definitions */
853 assert (res->attset);
855 if (parse_termlists (dh, &tp, p, file, lineno, name, res, 0))
860 *tp = all; /* append any ALL entries to the list */
862 new_element->name = nmem_strdup(data1_nmem_get (dh), name);
865 New code to support xelm directive
866 for each xelm a dfa is built. xelms are stored in res->xp_elements
868 maybe we should use a simple sscanf instead of dfa?
872 Now [] predicates are supported. regexps and xpath structure is
873 a bit redundant, however it's comfortable later...
878 else if (!strcmp(cmd, "xelm") || !strcmp(cmd, "melm")) {
881 char *p, *xpath_expr, *termlists;
883 struct DFA *dfa = dfa = dfa_init();
885 char melm_xpath[128];
889 yaz_log(YLOG_WARN, "%s:%d: Bad # of args to xelm", file, lineno);
893 if (!strcmp(cmd, "melm")) {
894 if (melm2xpath(argv[1], melm_xpath) < 0)
896 xpath_expr = melm_xpath;
898 xpath_expr = argv[1];
901 regexp = mk_xpath_regexp(dh, xpath_expr);
902 i = dfa_parse (dfa, ®exp);
904 yaz_log(YLOG_WARN, "%s:%d: Bad xpath to xelm", file, lineno);
911 cur_xpelement = (data1_xpelement *)
912 nmem_malloc(data1_nmem_get(dh), sizeof(*cur_xpelement));
913 res->xp_elements = cur_xpelement;
915 cur_xpelement->next = (data1_xpelement *)
916 nmem_malloc(data1_nmem_get(dh), sizeof(*cur_xpelement));
917 cur_xpelement = cur_xpelement->next;
919 cur_xpelement->next = NULL;
920 cur_xpelement->xpath_expr = nmem_strdup(data1_nmem_get (dh),
924 cur_xpelement->dfa = dfa;
927 cur_xpelement->xpath_len =
928 zebra_parse_xpath_str(xpath_expr,
929 cur_xpelement->xpath, XPATH_STEP_COUNT,
933 dump_xp_steps(cur_xpelement->xpath,cur_xpelement->xpath_len);
936 cur_xpelement->termlists = 0;
937 tp = &cur_xpelement->termlists;
939 /* parse termList definitions */
943 assert (res->attset);
945 if (parse_termlists (dh, &tp, p, file, lineno,
951 *tp = all; /* append any ALL entries to the list */
954 else if (!strcmp(cmd, "section"))
960 yaz_log(YLOG_WARN, "%s:%d: Bad # of args to section",
966 cur_elements = (data1_sub_elements *)
967 nmem_malloc(data1_nmem_get(dh), sizeof(*cur_elements));
968 cur_elements->next = res->sub_elements;
969 cur_elements->elements = NULL;
970 cur_elements->name = nmem_strdup (data1_nmem_get(dh), name);
971 res->sub_elements = cur_elements;
974 ppl[level] = &cur_elements->elements;
976 else if (!strcmp(cmd, "xpath"))
980 yaz_log(YLOG_WARN, "%s:%d: Bad # of args to 'xpath' directive",
984 if (!strcmp(argv[1], "enable"))
985 res->enable_xpath_indexing = 1;
986 else if (!strcmp (argv[1], "disable"))
987 res->enable_xpath_indexing = 0;
990 yaz_log(YLOG_WARN, "%s:%d: Expecting disable/enable "
991 "after 'xpath' directive", file, lineno);
994 else if (!strcmp(cmd, "all"))
996 data1_termlist **tp = &all;
999 yaz_log(YLOG_WARN, "%s:%d: Too many 'all' directives - ignored",
1005 yaz_log(YLOG_WARN, "%s:%d: Bad # of args to 'all' directive",
1009 if (parse_termlists (dh, &tp, argv[1], file, lineno, 0, res, 0))
1015 else if (!strcmp(cmd, "name"))
1019 yaz_log(YLOG_WARN, "%s:%d: Bad # of args to name directive",
1023 res->name = nmem_strdup(data1_nmem_get(dh), argv[1]);
1025 else if (!strcmp(cmd, "reference"))
1031 yaz_log(YLOG_WARN, "%s:%d: Bad # of args to reference",
1036 if ((res->reference = oid_getvalbyname(name)) == VAL_NONE)
1038 yaz_log(YLOG_WARN, "%s:%d: Unknown tagset ref '%s'",
1039 file, lineno, name);
1043 else if (!strcmp(cmd, "attset"))
1046 yaz_log(YLOG_WARN, "%s:%d: attset obsolete", file, lineno);
1049 data1_attset *attset;
1053 yaz_log(YLOG_WARN, "%s:%d: Bad # of args to attset",
1058 if (!(attset = data1_get_attset (dh, name)))
1060 yaz_log(YLOG_WARN, "%s:%d: Couldn't find attset %s",
1061 file, lineno, name);
1064 *attset_childp = (data1_attset_child *)
1065 nmem_malloc (data1_nmem_get(dh), sizeof(**attset_childp));
1066 (*attset_childp)->child = attset;
1067 (*attset_childp)->next = 0;
1068 attset_childp = &(*attset_childp)->next;
1071 else if (!strcmp(cmd, "tagset"))
1077 yaz_log(YLOG_WARN, "%s:%d: Bad # of args to tagset",
1083 type = atoi(argv[2]);
1084 *tagset_childp = data1_read_tagset (dh, name, type);
1085 if (!(*tagset_childp))
1087 yaz_log(YLOG_WARN, "%s:%d: Couldn't load tagset %s",
1088 file, lineno, name);
1091 tagset_childp = &(*tagset_childp)->next;
1093 else if (!strcmp(cmd, "varset"))
1099 yaz_log(YLOG_WARN, "%s:%d: Bad # of args in varset",
1104 if (!(res->varset = data1_read_varset (dh, name)))
1106 yaz_log(YLOG_WARN, "%s:%d: Couldn't load Varset %s",
1107 file, lineno, name);
1111 else if (!strcmp(cmd, "esetname"))
1117 yaz_log(YLOG_WARN, "%s:%d: Bad # of args in esetname",
1124 *esetpp = (data1_esetname *)
1125 nmem_malloc(data1_nmem_get(dh), sizeof(**esetpp));
1126 (*esetpp)->name = nmem_strdup(data1_nmem_get(dh), name);
1127 (*esetpp)->next = 0;
1129 (*esetpp)->spec = 0;
1130 else if (!((*esetpp)->spec = data1_read_espec1 (dh, fname)))
1132 yaz_log(YLOG_WARN, "%s:%d: Espec-1 read failed for %s",
1133 file, lineno, fname);
1136 esetpp = &(*esetpp)->next;
1138 else if (!strcmp(cmd, "maptab"))
1144 yaz_log(YLOG_WARN, "%s:%d: Bad # of args for maptab",
1149 if (!(*maptabp = data1_read_maptab (dh, name)))
1151 yaz_log(YLOG_WARN, "%s:%d: Couldn't load maptab %s",
1152 file, lineno, name);
1155 maptabp = &(*maptabp)->next;
1157 else if (!strcmp(cmd, "marc"))
1163 yaz_log(YLOG_WARN, "%s:%d: Bad # or args for marc",
1168 if (!(*marcp = data1_read_marctab (dh, name)))
1170 yaz_log(YLOG_WARN, "%s:%d: Couldn't read marctab %s",
1171 file, lineno, name);
1174 marcp = &(*marcp)->next;
1176 else if (!strcmp(cmd, "encoding"))
1180 yaz_log(YLOG_WARN, "%s:%d: Bad # or args for encoding",
1184 res->encoding = nmem_strdup (data1_nmem_get(dh), argv[1]);
1186 else if (!strcmp(cmd, "systag"))
1190 yaz_log(YLOG_WARN, "%s:%d: Bad # or args for systag",
1194 *systagsp = nmem_malloc (data1_nmem_get(dh), sizeof(**systagsp));
1196 (*systagsp)->name = nmem_strdup(data1_nmem_get(dh), argv[1]);
1197 (*systagsp)->value = nmem_strdup(data1_nmem_get(dh), argv[2]);
1198 systagsp = &(*systagsp)->next;
1202 yaz_log(YLOG_WARN, "%s:%d: Unknown directive '%s'", file,
1210 for (cur_elements = res->sub_elements; cur_elements;
1211 cur_elements = cur_elements->next)
1213 if (!strcmp (cur_elements->name, "main"))
1214 res->main_elements = cur_elements->elements;
1215 fix_element_ref (dh, res, cur_elements->elements);
1218 yaz_log(YLOG_DEBUG, "%s: data1_read_absyn end", file);