2 * Copyright (C) 1994-2001, Index Data
6 * Revision 1.46 2002-04-13 18:16:43 adam
7 * More XPATH work; common sequence numbers for extract keys
9 * Revision 1.45 2002/04/12 14:40:42 adam
12 * Revision 1.44 2002/04/11 20:09:47 adam
13 * work on string tag indexing
15 * Revision 1.43 2002/03/21 23:06:36 adam
16 * Source 'tag' in abs-file
18 * Revision 1.42 2002/02/20 17:30:01 adam
19 * Work on new API. Locking system re-implemented
21 * Revision 1.41 2001/05/22 21:01:47 adam
22 * Removed print of data1 tree on stdout so that inetd works again.
24 * Revision 1.40 2001/03/29 21:31:31 adam
25 * Fixed "record begin" for Tcl filter.
27 * Revision 1.39 2000/12/05 19:09:15 adam
28 * Fixed problem where indexer could crash if abstract syntax was undefined.
30 * Revision 1.38 2000/12/05 14:44:58 adam
31 * Fixed minor bug that could cause zmbol to break it data were emitted
32 * with not parent tags.
34 * Revision 1.37 2000/12/05 12:22:53 adam
35 * Termlist source implemented (so that we can index values of XML/SGML
38 * Revision 1.36 2000/12/05 10:01:44 adam
39 * Fixed bug regarding user-defined attribute sets.
41 * Revision 1.35 2000/11/29 15:21:31 adam
42 * Fixed problem with passwd db.
44 * Revision 1.34 2000/02/25 13:24:49 adam
45 * Fixed bug regarding pointer conversion that showed up on OSF V5.
47 * Revision 1.33 1999/11/30 13:48:04 adam
48 * Improved installation. Updated for inclusion of YAZ header files.
50 * Revision 1.32 1999/09/07 07:19:21 adam
51 * Work on character mapping. Implemented replace rules.
53 * Revision 1.31 1999/07/14 10:56:43 adam
54 * Fixed potential memory leak.
56 * Revision 1.30 1999/07/06 12:26:41 adam
57 * Retrieval handler obeys schema and handles XML transfer syntax.
59 * Revision 1.29 1999/05/26 07:49:14 adam
62 * Revision 1.28 1999/05/21 12:00:17 adam
63 * Better diagnostics for extraction process.
65 * Revision 1.27 1999/05/20 12:57:18 adam
66 * Implemented TCL filter. Updated recctrl system.
68 * Revision 1.26 1999/03/02 16:15:44 quinn
69 * Added "tagsysno" and "tagrank" directives to zebra.cfg.
71 * Revision 1.25 1999/02/18 15:01:26 adam
74 * Revision 1.24 1999/02/02 14:51:28 adam
75 * Updated WIN32 code specific sections. Changed header.
77 * Revision 1.23 1998/10/18 07:51:10 adam
78 * Changed one logf call.
80 * Revision 1.22 1998/10/16 08:14:37 adam
81 * Updated record control system.
83 * Revision 1.21 1998/07/01 09:16:10 adam
84 * Element localno only added when it's greater than 0.
86 * Revision 1.20 1998/05/20 10:12:26 adam
87 * Implemented automatic EXPLAIN database maintenance.
88 * Modified Zebra to work with ASN.1 compiled version of YAZ.
90 * Revision 1.19 1998/03/11 11:19:05 adam
91 * Changed the way sequence numbers are generated.
93 * Revision 1.18 1998/03/05 08:41:31 adam
96 * Revision 1.17 1998/02/10 12:03:06 adam
99 * Revision 1.16 1998/01/29 13:38:17 adam
100 * Fixed problem with mapping to record with unknown schema.
102 * Revision 1.15 1998/01/26 10:37:57 adam
103 * Better diagnostics.
105 * Revision 1.14 1997/11/06 11:41:01 adam
106 * Implemented "begin variant" for the sgml.regx filter.
108 * Revision 1.13 1997/10/31 12:35:44 adam
109 * Added a few log statements.
111 * Revision 1.12 1997/10/29 12:02:22 adam
112 * Using oid_ent_to_oid used instead of the non thread-safe oid_getoidbyent.
114 * Revision 1.11 1997/10/27 14:34:00 adam
115 * Work on generic character mapping depending on "structure" field
116 * in abstract syntax file.
118 * Revision 1.10 1997/09/18 08:59:21 adam
119 * Extra generic handle for the character mapping routines.
121 * Revision 1.9 1997/09/17 12:19:21 adam
122 * Zebra version corresponds to YAZ version 1.4.
123 * Changed Zebra server so that it doesn't depend on global common_resource.
125 * Revision 1.8 1997/09/09 13:38:14 adam
126 * Partial port to WIN95/NT.
128 * Revision 1.7 1997/09/05 15:30:10 adam
129 * Changed prototype for chr_map_input - added const.
130 * Added support for C++, headers uses extern "C" for public definitions.
132 * Revision 1.6 1997/09/04 13:54:40 adam
133 * Added MARC filter - type grs.marc.<syntax> where syntax refers
134 * to abstract syntax. New method tellf in retrieve/extract method.
136 * Revision 1.5 1997/07/15 16:29:03 adam
137 * Initialized dummy variable to keep checker gcc happy.
139 * Revision 1.4 1997/04/30 08:56:08 quinn
142 * Revision 1.2 1996/10/11 16:06:43 quinn
143 * Revision 1.3 1997/02/24 10:41:50 adam
144 * Cleanup of code and commented out the "end element-end-record" code.
146 * Revision 1.2 1996/10/11 16:06:43 quinn
147 * Fixed arguments to nodetogr
149 * Revision 1.1 1996/10/11 10:57:25 adam
150 * New module recctrl. Used to manage records (extract/retrieval).
152 * Revision 1.29 1996/10/08 10:30:21 quinn
153 * Fixed type mismatch
155 * Revision 1.28 1996/10/07 16:06:40 quinn
158 * Revision 1.27 1996/06/11 10:54:12 quinn
161 * Revision 1.26 1996/06/06 12:08:45 quinn
162 * Added showRecord function
164 * Revision 1.25 1996/06/04 14:18:53 quinn
167 * Revision 1.24 1996/06/04 13:27:54 quinn
168 * More work on charmapping
170 * Revision 1.23 1996/06/04 10:19:01 adam
171 * Minor changes - removed include of ctype.h.
173 * Revision 1.22 1996/06/03 10:15:27 quinn
174 * Various character-mapping.
176 * Revision 1.21 1996/05/31 13:27:24 quinn
177 * Character-conversion in phrases, too.
179 * Revision 1.19 1996/05/16 15:31:14 quinn
182 * Revision 1.18 1996/05/09 07:28:56 quinn
183 * Work towards phrases and multiple registers
185 * Revision 1.17 1996/05/01 13:46:37 adam
186 * First work on multiple records in one file.
187 * New option, -offset, to the "unread" command in the filter module.
189 * Revision 1.16 1996/01/17 14:57:54 adam
190 * Prototype changed for reader functions in extract/retrieve. File
191 * is identified by 'void *' instead of 'int.
193 * Revision 1.15 1996/01/08 19:15:47 adam
194 * New input filter that works!
196 * Revision 1.14 1995/12/15 12:36:11 adam
197 * Retrieval calls data1_read_regx when subType is specified.
199 * Revision 1.13 1995/12/15 12:24:43 quinn
200 * *** empty log message ***
202 * Revision 1.12 1995/12/15 12:20:28 quinn
203 * *** empty log message ***
205 * Revision 1.11 1995/12/15 12:07:57 quinn
206 * Changed extraction strategy.
208 * Revision 1.10 1995/12/14 11:10:48 quinn
211 * Revision 1.9 1995/12/13 17:14:05 quinn
212 * *** empty log message ***
214 * Revision 1.8 1995/12/13 15:33:18 quinn
215 * *** empty log message ***
217 * Revision 1.7 1995/12/13 13:45:39 quinn
218 * Changed data1 to use nmem.
220 * Revision 1.6 1995/12/04 14:22:30 adam
221 * Extra arg to recType_byName.
222 * Started work on new regular expression parsed input to
223 * structured records.
225 * Revision 1.5 1995/11/28 14:18:37 quinn
228 * Revision 1.4 1995/11/21 13:14:49 quinn
229 * Fixed end-of-data-field problem (maybe).
231 * Revision 1.3 1995/11/15 19:13:09 adam
232 * Work on record management.
238 #include <sys/types.h>
249 #define GRS_MAX_WORD 512
255 struct grs_handler *next;
258 struct grs_handlers {
259 struct grs_handler *handlers;
262 static int read_grs_type (struct grs_handlers *h,
263 struct grs_read_info *p, const char *type,
266 struct grs_handler *gh = h->handlers;
267 const char *cp = strchr (type, '.');
269 if (cp == NULL || cp == type)
271 cp = strlen(type) + type;
275 strcpy (p->type, cp+1);
276 for (gh = h->handlers; gh; gh = gh->next)
278 if (!memcmp (type, gh->type->type, cp-type))
283 gh->clientData = (*gh->type->init)();
285 p->clientData = gh->clientData;
286 *root = (gh->type->read)(p);
287 gh->clientData = p->clientData;
294 static void grs_add_handler (struct grs_handlers *h, RecTypeGrs t)
296 struct grs_handler *gh = (struct grs_handler *) malloc (sizeof(*gh));
297 gh->next = h->handlers;
304 static void *grs_init(RecType recType)
306 struct grs_handlers *h = (struct grs_handlers *) malloc (sizeof(*h));
309 grs_add_handler (h, recTypeGrs_sgml);
310 grs_add_handler (h, recTypeGrs_regx);
312 grs_add_handler (h, recTypeGrs_tcl);
314 grs_add_handler (h, recTypeGrs_marc);
318 static void grs_destroy(void *clientData)
320 struct grs_handlers *h = (struct grs_handlers *) clientData;
321 struct grs_handler *gh = h->handlers, *gh_next;
326 (*gh->type->destroy)(gh->clientData);
333 static void index_xpath (data1_node *n, struct recExtractCtrl *p,
334 int level, RecWord *wrd, int use)
337 char tag_path_full[1024];
345 wrd->string = n->u.data.data;
346 wrd->length = n->u.data.len;
347 wrd->attrSet = VAL_IDXPATH,
349 if (p->flagShowRecords)
351 printf("%*s data=", (level + 1) * 4, "");
352 for (i = 0; i<wrd->length && i < 8; i++)
353 fputc (wrd->string[i], stdout);
362 for (nn = n; nn; nn = nn->parent)
364 if (n->which == DATA1N_tag)
366 size_t tlen = strlen(nn->u.tag.tag);
367 if (tlen + flen > (sizeof(tag_path_full)-2))
369 memcpy (tag_path_full + flen, nn->u.tag.tag, tlen);
371 tag_path_full[flen++] = '/';
373 else if (n->which == DATA1N_root)
375 size_t tlen = strlen(nn->u.root.type);
376 if (tlen + flen > (sizeof(tag_path_full)-2))
378 memcpy (tag_path_full + flen, nn->u.root.type, tlen);
380 tag_path_full[flen++] = '/';
385 wrd->string = tag_path_full;
387 wrd->attrSet = VAL_IDXPATH,
389 if (p->flagShowRecords)
391 printf("%*s tag=", (level + 1) * 4, "");
392 for (i = 0; i<wrd->length && i < 40; i++)
393 fputc (wrd->string[i], stdout);
406 static void index_termlist (data1_node *par, data1_node *n,
407 struct recExtractCtrl *p, int level, RecWord *wrd)
409 data1_termlist *tlist = 0;
410 data1_datatype dtype = DATA1K_string;
412 * cycle up towards the root until we find a tag with an att..
413 * this has the effect of indexing locally defined tags with
414 * the attribute of their ancestor in the record.
417 while (!par->u.tag.element)
418 if (!par->parent || !(par=get_parent_tag(p->dh, par->parent)))
420 if (!par || !(tlist = par->u.tag.element->termlists))
422 if (par->u.tag.element->tag)
423 dtype = par->u.tag.element->tag->kind;
425 for (; tlist; tlist = tlist->next)
428 /* consider source */
431 if (!strcmp (tlist->source, "data") && n->which == DATA1N_data)
433 wrd->string = n->u.data.data;
434 wrd->length = n->u.data.len;
436 else if (!strcmp (tlist->source, "tag") && n->which == DATA1N_tag)
438 wrd->string = n->u.tag.tag;
439 wrd->length = strlen(n->u.tag.tag);
441 else if (sscanf (tlist->source, "attr(%511[^)])", xattr) == 1 &&
442 n->which == DATA1N_tag)
444 data1_xattr *p = n->u.tag.attributes;
445 while (p && strcmp (p->name, xattr))
449 wrd->string = p->value;
450 wrd->length = strlen(p->value);
455 if (p->flagShowRecords)
458 printf("%*sIdx: [%s]", (level + 1) * 4, "",
460 printf("%s:%s [%d] %s",
461 tlist->att->parent->name,
462 tlist->att->name, tlist->att->value,
465 for (i = 0; i<wrd->length && i < 8; i++)
466 fputc (wrd->string[i], stdout);
470 fputc ('\n', stdout);
474 wrd->reg_type = *tlist->structure;
475 wrd->attrSet = (int) (tlist->att->parent->reference);
476 wrd->attrUse = tlist->att->locals->local;
483 static int dumpkeys(data1_node *n, struct recExtractCtrl *p, int level,
486 for (; n; n = n->next)
488 if (p->flagShowRecords) /* display element description to user */
490 if (n->which == DATA1N_root)
492 printf("%*s", level * 4, "");
493 printf("Record type: '%s'\n", n->u.root.type);
495 else if (n->which == DATA1N_tag)
499 printf("%*s", level * 4, "");
500 if (!(e = n->u.tag.element))
501 printf("Local tag: '%s'\n", n->u.tag.tag);
504 printf("Elm: '%s' ", e->name);
507 data1_tag *t = e->tag;
509 printf("TagNam: '%s' ", t->names->name);
512 printf("%s[%d],", t->tagset->name, t->tagset->type);
515 if (t->which == DATA1T_numeric)
516 printf("%d)", t->value.numeric);
518 printf("'%s')", t->value.string);
525 if (n->which == DATA1N_tag)
527 index_termlist (n, n, p, level, wrd);
528 /* index start tag */
529 if (!n->root->u.root.absyn)
530 index_xpath (n, p, level, wrd, 1);
534 if (dumpkeys(n->child, p, level + 1, wrd) < 0)
538 if (n->which == DATA1N_data)
540 data1_node *par = get_parent_tag(p->dh, n);
542 if (p->flagShowRecords)
544 printf("%*s", level * 4, "");
546 if (n->u.data.len > 32)
547 printf("'%.24s ... %.6s'\n", n->u.data.data,
548 n->u.data.data + n->u.data.len-6);
549 else if (n->u.data.len > 0)
550 printf("'%.*s'\n", n->u.data.len, n->u.data.data);
556 index_termlist (par, n, p, level, wrd);
557 if (!n->root->u.root.absyn)
558 index_xpath (n, p, level, wrd, 1016);
562 if (n->which == DATA1N_tag)
565 if (!n->root->u.root.absyn)
566 index_xpath (n, p, level, wrd, 2);
570 if (p->flagShowRecords && n->which == DATA1N_root)
572 printf("%*s-------------\n\n", level * 4, "");
578 int grs_extract_tree(struct recExtractCtrl *p, data1_node *n)
581 int oidtmp[OID_SIZE];
584 oe.proto = PROTO_Z3950;
585 oe.oclass = CLASS_SCHEMA;
588 oe.value = n->u.root.absyn->reference;
590 if ((oid_ent_to_oid (&oe, oidtmp)))
591 (*p->schemaAdd)(p, oidtmp);
594 return dumpkeys(n, p, 0, &wrd);
597 static int grs_extract_sub(struct grs_handlers *h, struct recExtractCtrl *p,
601 struct grs_read_info gri;
603 int oidtmp[OID_SIZE];
606 gri.readf = p->readf;
607 gri.seekf = p->seekf;
608 gri.tellf = p->tellf;
611 gri.offset = p->offset;
615 if (read_grs_type (h, &gri, p->subType, &n))
616 return RECCTRL_EXTRACT_ERROR;
618 return RECCTRL_EXTRACT_EOF;
619 oe.proto = PROTO_Z3950;
620 oe.oclass = CLASS_SCHEMA;
622 if (!n->u.root.absyn)
623 return RECCTRL_EXTRACT_ERROR;
627 oe.value = n->u.root.absyn->reference;
628 if ((oid_ent_to_oid (&oe, oidtmp)))
629 (*p->schemaAdd)(p, oidtmp);
632 data1_pr_tree (p->dh, n, stdout);
635 if (dumpkeys(n, p, 0, &wrd) < 0)
637 data1_free_tree(p->dh, n);
638 return RECCTRL_EXTRACT_ERROR;
640 data1_free_tree(p->dh, n);
641 return RECCTRL_EXTRACT_OK;
644 static int grs_extract(void *clientData, struct recExtractCtrl *p)
647 NMEM mem = nmem_create ();
648 struct grs_handlers *h = (struct grs_handlers *) clientData;
650 ret = grs_extract_sub(h, p, mem);
656 * Return: -1: Nothing done. 0: Ok. >0: Bib-1 diagnostic.
658 static int process_comp(data1_handle dh, data1_node *n, Z_RecordComposition *c)
660 data1_esetname *eset;
666 case Z_RecordComp_simple:
667 if (c->u.simple->which != Z_ElementSetNames_generic)
668 return 26; /* only generic form supported. Fix this later */
669 if (!(eset = data1_getesetbyname(dh, n->u.root.absyn,
670 c->u.simple->u.generic)))
672 logf(LOG_LOG, "Unknown esetname '%s'", c->u.simple->u.generic);
673 return 25; /* invalid esetname */
675 logf(LOG_DEBUG, "Esetname '%s' in simple compspec",
676 c->u.simple->u.generic);
679 case Z_RecordComp_complex:
680 if (c->u.complex->generic)
682 /* insert check for schema */
683 if ((p = c->u.complex->generic->elementSpec))
687 case Z_ElementSpec_elementSetName:
689 data1_getesetbyname(dh, n->u.root.absyn,
690 p->u.elementSetName)))
692 logf(LOG_LOG, "Unknown esetname '%s'",
693 p->u.elementSetName);
694 return 25; /* invalid esetname */
696 logf(LOG_DEBUG, "Esetname '%s' in complex compspec",
697 p->u.elementSetName);
700 case Z_ElementSpec_externalSpec:
701 if (p->u.externalSpec->which == Z_External_espec1)
703 logf(LOG_DEBUG, "Got Espec-1");
704 espec = p->u.externalSpec-> u.espec1;
708 logf(LOG_LOG, "Unknown external espec.");
709 return 25; /* bad. what is proper diagnostic? */
720 logf (LOG_DEBUG, "Element: Espec-1 match");
721 return data1_doespec1(dh, n, espec);
725 logf (LOG_DEBUG, "Element: all match");
730 static int grs_retrieve(void *clientData, struct recRetrieveCtrl *p)
732 data1_node *node = 0, *onode = 0;
735 int res, selected = 0;
737 struct grs_read_info gri;
739 struct grs_handlers *h = (struct grs_handlers *) clientData;
740 int requested_schema = VAL_NONE;
743 gri.readf = p->readf;
744 gri.seekf = p->seekf;
745 gri.tellf = p->tellf;
752 logf (LOG_DEBUG, "grs_retrieve");
753 if (read_grs_type (h, &gri, p->subType, &node))
766 data1_pr_tree (p->dh, node, stdout);
768 logf (LOG_DEBUG, "grs_retrieve: size");
769 if ((dnew = data1_insert_taggeddata(p->dh, node, node,
772 dnew->u.data.what = DATA1I_text;
773 dnew->u.data.data = dnew->lbuf;
774 sprintf(dnew->u.data.data, "%d", p->recordSize);
775 dnew->u.data.len = strlen(dnew->u.data.data);
778 tagname = res_get_def(p->res, "tagrank", "rank");
779 if (strcmp(tagname, "0") && p->score >= 0 &&
780 (dnew = data1_insert_taggeddata(p->dh, node, node, tagname, mem)))
782 logf (LOG_DEBUG, "grs_retrieve: %s", tagname);
783 dnew->u.data.what = DATA1I_num;
784 dnew->u.data.data = dnew->lbuf;
785 sprintf(dnew->u.data.data, "%d", p->score);
786 dnew->u.data.len = strlen(dnew->u.data.data);
789 tagname = res_get_def(p->res, "tagsysno", "localControlNumber");
790 if (strcmp(tagname, "0") && p->localno > 0 &&
791 (dnew = data1_insert_taggeddata(p->dh, node, node, tagname, mem)))
793 logf (LOG_DEBUG, "grs_retrieve: %s", tagname);
794 dnew->u.data.what = DATA1I_text;
795 dnew->u.data.data = dnew->lbuf;
796 sprintf(dnew->u.data.data, "%d", p->localno);
797 dnew->u.data.len = strlen(dnew->u.data.data);
800 if (p->comp && p->comp->which == Z_RecordComp_complex &&
801 p->comp->u.complex->generic &&
802 p->comp->u.complex->generic->schema)
804 oident *oe = oid_getentbyoid (p->comp->u.complex->generic->schema);
806 requested_schema = oe->value;
809 /* If schema has been specified, map if possible, then check that
810 * we got the right one
812 if (requested_schema != VAL_NONE)
814 logf (LOG_DEBUG, "grs_retrieve: schema mapping");
815 for (map = node->u.root.absyn->maptabs; map; map = map->next)
817 if (map->target_absyn_ref == requested_schema)
820 if (!(node = data1_map_record(p->dh, onode, map, mem)))
829 if (node->u.root.absyn &&
830 requested_schema != node->u.root.absyn->reference)
838 * Does the requested format match a known syntax-mapping? (this reflects
839 * the overlap of schema and formatting which is inherent in the MARC
842 logf (LOG_DEBUG, "grs_retrieve: syntax mapping");
843 if (node->u.root.absyn)
844 for (map = node->u.root.absyn->maptabs; map; map = map->next)
846 if (map->target_absyn_ref == p->input_format)
849 if (!(node = data1_map_record(p->dh, onode, map, mem)))
858 logf (LOG_DEBUG, "grs_retrieve: schemaIdentifier");
859 if (node->u.root.absyn &&
860 node->u.root.absyn->reference != VAL_NONE &&
861 p->input_format == VAL_GRS1)
865 int oidtmp[OID_SIZE];
867 oe.proto = PROTO_Z3950;
868 oe.oclass = CLASS_SCHEMA;
869 oe.value = node->u.root.absyn->reference;
871 if ((oid = oid_ent_to_oid (&oe, oidtmp)))
874 data1_handle dh = p->dh;
878 for (ii = oid; *ii >= 0; ii++)
882 sprintf(p, "%d", *ii);
887 if ((dnew = data1_insert_taggeddata(dh, node, node,
888 "schemaIdentifier", mem)))
890 dnew->u.data.what = DATA1I_oid;
891 dnew->u.data.data = (char *) nmem_malloc(mem, p - tmp);
892 memcpy(dnew->u.data.data, tmp, p - tmp);
893 dnew->u.data.len = p - tmp;
898 logf (LOG_DEBUG, "grs_retrieve: element spec");
899 if (p->comp && (res = process_comp(p->dh, node, p->comp)) > 0)
903 data1_free_tree(p->dh, onode);
904 data1_free_tree(p->dh, node);
908 else if (p->comp && !res)
912 data1_pr_tree (p->dh, node, stdout);
914 logf (LOG_DEBUG, "grs_retrieve: transfer syntax mapping");
915 switch (p->output_format = (p->input_format != VAL_NONE ?
916 p->input_format : VAL_SUTRS))
918 data1_marctab *marctab;
922 if (!(p->rec_buf = data1_nodetoidsgml(p->dh, node, selected,
927 char *new_buf = (char*) odr_malloc (p->odr, p->rec_len);
928 memcpy (new_buf, p->rec_buf, p->rec_len);
929 p->rec_buf = new_buf;
934 if (!(p->rec_buf = data1_nodetogr(p->dh, node, selected,
936 p->diagnostic = 238; /* not available in requested syntax */
938 p->rec_len = (size_t) (-1);
941 if (!(p->rec_buf = data1_nodetoexplain(p->dh, node, selected,
945 p->rec_len = (size_t) (-1);
948 if (!(p->rec_buf = data1_nodetosummary(p->dh, node, selected,
952 p->rec_len = (size_t) (-1);
955 if (!(p->rec_buf = data1_nodetobuf(p->dh, node, selected,
960 char *new_buf = (char*) odr_malloc (p->odr, p->rec_len);
961 memcpy (new_buf, p->rec_buf, p->rec_len);
962 p->rec_buf = new_buf;
966 if (!(p->rec_buf = data1_nodetosoif(p->dh, node, selected,
971 char *new_buf = (char*) odr_malloc (p->odr, p->rec_len);
972 memcpy (new_buf, p->rec_buf, p->rec_len);
973 p->rec_buf = new_buf;
977 if (!node->u.root.absyn)
982 for (marctab = node->u.root.absyn->marc; marctab;
983 marctab = marctab->next)
984 if (marctab->reference == p->input_format)
991 if (!(p->rec_buf = data1_nodetomarc(p->dh, marctab, node,
992 selected, &p->rec_len)))
996 char *new_buf = (char*) odr_malloc (p->odr, p->rec_len);
997 memcpy (new_buf, p->rec_buf, p->rec_len);
998 p->rec_buf = new_buf;
1002 data1_free_tree(p->dh, node);
1004 data1_free_tree(p->dh, onode);
1009 static struct recType grs_type =
1018 RecType recTypeGrs = &grs_type;