2 * Copyright (C) 1994-2001, Index Data
6 * Revision 1.48 2002-05-07 11:05:20 adam
7 * data1 updates. Run number fix
9 * Revision 1.47 2002/05/03 13:50:25 adam
12 * Revision 1.46 2002/04/13 18:16:43 adam
13 * More XPATH work; common sequence numbers for extract keys
15 * Revision 1.45 2002/04/12 14:40:42 adam
18 * Revision 1.44 2002/04/11 20:09:47 adam
19 * work on string tag indexing
21 * Revision 1.43 2002/03/21 23:06:36 adam
22 * Source 'tag' in abs-file
24 * Revision 1.42 2002/02/20 17:30:01 adam
25 * Work on new API. Locking system re-implemented
27 * Revision 1.41 2001/05/22 21:01:47 adam
28 * Removed print of data1 tree on stdout so that inetd works again.
30 * Revision 1.40 2001/03/29 21:31:31 adam
31 * Fixed "record begin" for Tcl filter.
33 * Revision 1.39 2000/12/05 19:09:15 adam
34 * Fixed problem where indexer could crash if abstract syntax was undefined.
36 * Revision 1.38 2000/12/05 14:44:58 adam
37 * Fixed minor bug that could cause zmbol to break it data were emitted
38 * with not parent tags.
40 * Revision 1.37 2000/12/05 12:22:53 adam
41 * Termlist source implemented (so that we can index values of XML/SGML
44 * Revision 1.36 2000/12/05 10:01:44 adam
45 * Fixed bug regarding user-defined attribute sets.
47 * Revision 1.35 2000/11/29 15:21:31 adam
48 * Fixed problem with passwd db.
50 * Revision 1.34 2000/02/25 13:24:49 adam
51 * Fixed bug regarding pointer conversion that showed up on OSF V5.
53 * Revision 1.33 1999/11/30 13:48:04 adam
54 * Improved installation. Updated for inclusion of YAZ header files.
56 * Revision 1.32 1999/09/07 07:19:21 adam
57 * Work on character mapping. Implemented replace rules.
59 * Revision 1.31 1999/07/14 10:56:43 adam
60 * Fixed potential memory leak.
62 * Revision 1.30 1999/07/06 12:26:41 adam
63 * Retrieval handler obeys schema and handles XML transfer syntax.
65 * Revision 1.29 1999/05/26 07:49:14 adam
68 * Revision 1.28 1999/05/21 12:00:17 adam
69 * Better diagnostics for extraction process.
71 * Revision 1.27 1999/05/20 12:57:18 adam
72 * Implemented TCL filter. Updated recctrl system.
74 * Revision 1.26 1999/03/02 16:15:44 quinn
75 * Added "tagsysno" and "tagrank" directives to zebra.cfg.
77 * Revision 1.25 1999/02/18 15:01:26 adam
80 * Revision 1.24 1999/02/02 14:51:28 adam
81 * Updated WIN32 code specific sections. Changed header.
83 * Revision 1.23 1998/10/18 07:51:10 adam
84 * Changed one logf call.
86 * Revision 1.22 1998/10/16 08:14:37 adam
87 * Updated record control system.
89 * Revision 1.21 1998/07/01 09:16:10 adam
90 * Element localno only added when it's greater than 0.
92 * Revision 1.20 1998/05/20 10:12:26 adam
93 * Implemented automatic EXPLAIN database maintenance.
94 * Modified Zebra to work with ASN.1 compiled version of YAZ.
96 * Revision 1.19 1998/03/11 11:19:05 adam
97 * Changed the way sequence numbers are generated.
99 * Revision 1.18 1998/03/05 08:41:31 adam
102 * Revision 1.17 1998/02/10 12:03:06 adam
105 * Revision 1.16 1998/01/29 13:38:17 adam
106 * Fixed problem with mapping to record with unknown schema.
108 * Revision 1.15 1998/01/26 10:37:57 adam
109 * Better diagnostics.
111 * Revision 1.14 1997/11/06 11:41:01 adam
112 * Implemented "begin variant" for the sgml.regx filter.
114 * Revision 1.13 1997/10/31 12:35:44 adam
115 * Added a few log statements.
117 * Revision 1.12 1997/10/29 12:02:22 adam
118 * Using oid_ent_to_oid used instead of the non thread-safe oid_getoidbyent.
120 * Revision 1.11 1997/10/27 14:34:00 adam
121 * Work on generic character mapping depending on "structure" field
122 * in abstract syntax file.
124 * Revision 1.10 1997/09/18 08:59:21 adam
125 * Extra generic handle for the character mapping routines.
127 * Revision 1.9 1997/09/17 12:19:21 adam
128 * Zebra version corresponds to YAZ version 1.4.
129 * Changed Zebra server so that it doesn't depend on global common_resource.
131 * Revision 1.8 1997/09/09 13:38:14 adam
132 * Partial port to WIN95/NT.
134 * Revision 1.7 1997/09/05 15:30:10 adam
135 * Changed prototype for chr_map_input - added const.
136 * Added support for C++, headers uses extern "C" for public definitions.
138 * Revision 1.6 1997/09/04 13:54:40 adam
139 * Added MARC filter - type grs.marc.<syntax> where syntax refers
140 * to abstract syntax. New method tellf in retrieve/extract method.
142 * Revision 1.5 1997/07/15 16:29:03 adam
143 * Initialized dummy variable to keep checker gcc happy.
145 * Revision 1.4 1997/04/30 08:56:08 quinn
148 * Revision 1.2 1996/10/11 16:06:43 quinn
149 * Revision 1.3 1997/02/24 10:41:50 adam
150 * Cleanup of code and commented out the "end element-end-record" code.
152 * Revision 1.2 1996/10/11 16:06:43 quinn
153 * Fixed arguments to nodetogr
155 * Revision 1.1 1996/10/11 10:57:25 adam
156 * New module recctrl. Used to manage records (extract/retrieval).
158 * Revision 1.29 1996/10/08 10:30:21 quinn
159 * Fixed type mismatch
161 * Revision 1.28 1996/10/07 16:06:40 quinn
164 * Revision 1.27 1996/06/11 10:54:12 quinn
167 * Revision 1.26 1996/06/06 12:08:45 quinn
168 * Added showRecord function
170 * Revision 1.25 1996/06/04 14:18:53 quinn
173 * Revision 1.24 1996/06/04 13:27:54 quinn
174 * More work on charmapping
176 * Revision 1.23 1996/06/04 10:19:01 adam
177 * Minor changes - removed include of ctype.h.
179 * Revision 1.22 1996/06/03 10:15:27 quinn
180 * Various character-mapping.
182 * Revision 1.21 1996/05/31 13:27:24 quinn
183 * Character-conversion in phrases, too.
185 * Revision 1.19 1996/05/16 15:31:14 quinn
188 * Revision 1.18 1996/05/09 07:28:56 quinn
189 * Work towards phrases and multiple registers
191 * Revision 1.17 1996/05/01 13:46:37 adam
192 * First work on multiple records in one file.
193 * New option, -offset, to the "unread" command in the filter module.
195 * Revision 1.16 1996/01/17 14:57:54 adam
196 * Prototype changed for reader functions in extract/retrieve. File
197 * is identified by 'void *' instead of 'int.
199 * Revision 1.15 1996/01/08 19:15:47 adam
200 * New input filter that works!
202 * Revision 1.14 1995/12/15 12:36:11 adam
203 * Retrieval calls data1_read_regx when subType is specified.
205 * Revision 1.13 1995/12/15 12:24:43 quinn
206 * *** empty log message ***
208 * Revision 1.12 1995/12/15 12:20:28 quinn
209 * *** empty log message ***
211 * Revision 1.11 1995/12/15 12:07:57 quinn
212 * Changed extraction strategy.
214 * Revision 1.10 1995/12/14 11:10:48 quinn
217 * Revision 1.9 1995/12/13 17:14:05 quinn
218 * *** empty log message ***
220 * Revision 1.8 1995/12/13 15:33:18 quinn
221 * *** empty log message ***
223 * Revision 1.7 1995/12/13 13:45:39 quinn
224 * Changed data1 to use nmem.
226 * Revision 1.6 1995/12/04 14:22:30 adam
227 * Extra arg to recType_byName.
228 * Started work on new regular expression parsed input to
229 * structured records.
231 * Revision 1.5 1995/11/28 14:18:37 quinn
234 * Revision 1.4 1995/11/21 13:14:49 quinn
235 * Fixed end-of-data-field problem (maybe).
237 * Revision 1.3 1995/11/15 19:13:09 adam
238 * Work on record management.
244 #include <sys/types.h>
255 #define GRS_MAX_WORD 512
261 struct grs_handler *next;
264 struct grs_handlers {
265 struct grs_handler *handlers;
268 static int read_grs_type (struct grs_handlers *h,
269 struct grs_read_info *p, const char *type,
272 struct grs_handler *gh = h->handlers;
273 const char *cp = strchr (type, '.');
275 if (cp == NULL || cp == type)
277 cp = strlen(type) + type;
281 strcpy (p->type, cp+1);
282 for (gh = h->handlers; gh; gh = gh->next)
284 if (!memcmp (type, gh->type->type, cp-type))
289 gh->clientData = (*gh->type->init)();
291 p->clientData = gh->clientData;
292 *root = (gh->type->read)(p);
293 gh->clientData = p->clientData;
300 static void grs_add_handler (struct grs_handlers *h, RecTypeGrs t)
302 struct grs_handler *gh = (struct grs_handler *) malloc (sizeof(*gh));
303 gh->next = h->handlers;
310 static void *grs_init(RecType recType)
312 struct grs_handlers *h = (struct grs_handlers *) malloc (sizeof(*h));
315 grs_add_handler (h, recTypeGrs_sgml);
316 grs_add_handler (h, recTypeGrs_regx);
318 grs_add_handler (h, recTypeGrs_tcl);
320 grs_add_handler (h, recTypeGrs_marc);
324 static void grs_destroy(void *clientData)
326 struct grs_handlers *h = (struct grs_handlers *) clientData;
327 struct grs_handler *gh = h->handlers, *gh_next;
332 (*gh->type->destroy)(gh->clientData);
339 static void index_xpath (data1_node *n, struct recExtractCtrl *p,
340 int level, RecWord *wrd, int use)
343 char tag_path_full[1024];
351 wrd->string = n->u.data.data;
352 wrd->length = n->u.data.len;
353 wrd->attrSet = VAL_IDXPATH,
355 if (p->flagShowRecords)
357 printf("%*s data=", (level + 1) * 4, "");
358 for (i = 0; i<wrd->length && i < 8; i++)
359 fputc (wrd->string[i], stdout);
368 for (nn = n; nn; nn = nn->parent)
370 if (n->which == DATA1N_tag)
372 size_t tlen = strlen(nn->u.tag.tag);
373 if (tlen + flen > (sizeof(tag_path_full)-2))
375 memcpy (tag_path_full + flen, nn->u.tag.tag, tlen);
377 tag_path_full[flen++] = '/';
379 else if (n->which == DATA1N_root)
381 size_t tlen = strlen(nn->u.root.type);
382 if (tlen + flen > (sizeof(tag_path_full)-2))
384 memcpy (tag_path_full + flen, nn->u.root.type, tlen);
386 tag_path_full[flen++] = '/';
391 wrd->string = tag_path_full;
393 wrd->attrSet = VAL_IDXPATH,
395 if (p->flagShowRecords)
397 printf("%*s tag=", (level + 1) * 4, "");
398 for (i = 0; i<wrd->length && i < 40; i++)
399 fputc (wrd->string[i], stdout);
412 static void index_termlist (data1_node *par, data1_node *n,
413 struct recExtractCtrl *p, int level, RecWord *wrd)
415 data1_termlist *tlist = 0;
416 data1_datatype dtype = DATA1K_string;
418 * cycle up towards the root until we find a tag with an att..
419 * this has the effect of indexing locally defined tags with
420 * the attribute of their ancestor in the record.
423 while (!par->u.tag.element)
424 if (!par->parent || !(par=get_parent_tag(p->dh, par->parent)))
426 if (!par || !(tlist = par->u.tag.element->termlists))
428 if (par->u.tag.element->tag)
429 dtype = par->u.tag.element->tag->kind;
431 for (; tlist; tlist = tlist->next)
434 /* consider source */
437 if (!strcmp (tlist->source, "data") && n->which == DATA1N_data)
439 wrd->string = n->u.data.data;
440 wrd->length = n->u.data.len;
442 else if (!strcmp (tlist->source, "tag") && n->which == DATA1N_tag)
444 wrd->string = n->u.tag.tag;
445 wrd->length = strlen(n->u.tag.tag);
447 else if (sscanf (tlist->source, "attr(%511[^)])", xattr) == 1 &&
448 n->which == DATA1N_tag)
450 data1_xattr *p = n->u.tag.attributes;
451 while (p && strcmp (p->name, xattr))
455 wrd->string = p->value;
456 wrd->length = strlen(p->value);
461 if (p->flagShowRecords)
464 printf("%*sIdx: [%s]", (level + 1) * 4, "",
466 printf("%s:%s [%d] %s",
467 tlist->att->parent->name,
468 tlist->att->name, tlist->att->value,
471 for (i = 0; i<wrd->length && i < 8; i++)
472 fputc (wrd->string[i], stdout);
476 fputc ('\n', stdout);
480 wrd->reg_type = *tlist->structure;
481 wrd->attrSet = (int) (tlist->att->parent->reference);
482 wrd->attrUse = tlist->att->locals->local;
489 static int dumpkeys(data1_node *n, struct recExtractCtrl *p, int level,
492 for (; n; n = n->next)
494 if (p->flagShowRecords) /* display element description to user */
496 if (n->which == DATA1N_root)
498 printf("%*s", level * 4, "");
499 printf("Record type: '%s'\n", n->u.root.type);
501 else if (n->which == DATA1N_tag)
505 printf("%*s", level * 4, "");
506 if (!(e = n->u.tag.element))
507 printf("Local tag: '%s'\n", n->u.tag.tag);
510 printf("Elm: '%s' ", e->name);
513 data1_tag *t = e->tag;
515 printf("TagNam: '%s' ", t->names->name);
518 printf("%s[%d],", t->tagset->name, t->tagset->type);
521 if (t->which == DATA1T_numeric)
522 printf("%d)", t->value.numeric);
524 printf("'%s')", t->value.string);
531 if (n->which == DATA1N_tag)
533 index_termlist (n, n, p, level, wrd);
534 /* index start tag */
535 if (!n->root->u.root.absyn)
536 index_xpath (n, p, level, wrd, 1);
540 if (dumpkeys(n->child, p, level + 1, wrd) < 0)
544 if (n->which == DATA1N_data)
546 data1_node *par = get_parent_tag(p->dh, n);
548 if (p->flagShowRecords)
550 printf("%*s", level * 4, "");
552 if (n->u.data.len > 32)
553 printf("'%.24s ... %.6s'\n", n->u.data.data,
554 n->u.data.data + n->u.data.len-6);
555 else if (n->u.data.len > 0)
556 printf("'%.*s'\n", n->u.data.len, n->u.data.data);
562 index_termlist (par, n, p, level, wrd);
563 if (!n->root->u.root.absyn)
564 index_xpath (n, p, level, wrd, 1016);
568 if (n->which == DATA1N_tag)
571 if (!n->root->u.root.absyn)
572 index_xpath (n, p, level, wrd, 2);
576 if (p->flagShowRecords && n->which == DATA1N_root)
578 printf("%*s-------------\n\n", level * 4, "");
584 int grs_extract_tree(struct recExtractCtrl *p, data1_node *n)
587 int oidtmp[OID_SIZE];
590 oe.proto = PROTO_Z3950;
591 oe.oclass = CLASS_SCHEMA;
594 oe.value = n->u.root.absyn->reference;
596 if ((oid_ent_to_oid (&oe, oidtmp)))
597 (*p->schemaAdd)(p, oidtmp);
600 return dumpkeys(n, p, 0, &wrd);
603 static int grs_extract_sub(struct grs_handlers *h, struct recExtractCtrl *p,
607 struct grs_read_info gri;
609 int oidtmp[OID_SIZE];
612 gri.readf = p->readf;
613 gri.seekf = p->seekf;
614 gri.tellf = p->tellf;
617 gri.offset = p->offset;
621 if (read_grs_type (h, &gri, p->subType, &n))
622 return RECCTRL_EXTRACT_ERROR;
624 return RECCTRL_EXTRACT_EOF;
625 oe.proto = PROTO_Z3950;
626 oe.oclass = CLASS_SCHEMA;
628 if (!n->u.root.absyn)
629 return RECCTRL_EXTRACT_ERROR;
633 oe.value = n->u.root.absyn->reference;
634 if ((oid_ent_to_oid (&oe, oidtmp)))
635 (*p->schemaAdd)(p, oidtmp);
638 data1_pr_tree (p->dh, n, stdout);
641 if (dumpkeys(n, p, 0, &wrd) < 0)
643 data1_free_tree(p->dh, n);
644 return RECCTRL_EXTRACT_ERROR;
646 data1_free_tree(p->dh, n);
647 return RECCTRL_EXTRACT_OK;
650 static int grs_extract(void *clientData, struct recExtractCtrl *p)
653 NMEM mem = nmem_create ();
654 struct grs_handlers *h = (struct grs_handlers *) clientData;
656 ret = grs_extract_sub(h, p, mem);
662 * Return: -1: Nothing done. 0: Ok. >0: Bib-1 diagnostic.
664 static int process_comp(data1_handle dh, data1_node *n, Z_RecordComposition *c)
666 data1_esetname *eset;
672 case Z_RecordComp_simple:
673 if (c->u.simple->which != Z_ElementSetNames_generic)
674 return 26; /* only generic form supported. Fix this later */
675 if (!(eset = data1_getesetbyname(dh, n->u.root.absyn,
676 c->u.simple->u.generic)))
678 logf(LOG_LOG, "Unknown esetname '%s'", c->u.simple->u.generic);
679 return 25; /* invalid esetname */
681 logf(LOG_DEBUG, "Esetname '%s' in simple compspec",
682 c->u.simple->u.generic);
685 case Z_RecordComp_complex:
686 if (c->u.complex->generic)
688 /* insert check for schema */
689 if ((p = c->u.complex->generic->elementSpec))
693 case Z_ElementSpec_elementSetName:
695 data1_getesetbyname(dh, n->u.root.absyn,
696 p->u.elementSetName)))
698 logf(LOG_LOG, "Unknown esetname '%s'",
699 p->u.elementSetName);
700 return 25; /* invalid esetname */
702 logf(LOG_DEBUG, "Esetname '%s' in complex compspec",
703 p->u.elementSetName);
706 case Z_ElementSpec_externalSpec:
707 if (p->u.externalSpec->which == Z_External_espec1)
709 logf(LOG_DEBUG, "Got Espec-1");
710 espec = p->u.externalSpec-> u.espec1;
714 logf(LOG_LOG, "Unknown external espec.");
715 return 25; /* bad. what is proper diagnostic? */
726 logf (LOG_DEBUG, "Element: Espec-1 match");
727 return data1_doespec1(dh, n, espec);
731 logf (LOG_DEBUG, "Element: all match");
736 static int grs_retrieve(void *clientData, struct recRetrieveCtrl *p)
738 data1_node *node = 0, *onode = 0;
741 int res, selected = 0;
743 struct grs_read_info gri;
745 struct grs_handlers *h = (struct grs_handlers *) clientData;
746 int requested_schema = VAL_NONE;
749 gri.readf = p->readf;
750 gri.seekf = p->seekf;
751 gri.tellf = p->tellf;
758 logf (LOG_DEBUG, "grs_retrieve");
759 if (read_grs_type (h, &gri, p->subType, &node))
772 data1_pr_tree (p->dh, node, stdout);
774 logf (LOG_DEBUG, "grs_retrieve: size");
775 if ((dnew = data1_mk_tag_data_wd(p->dh, node, "size", mem)))
777 dnew->u.data.what = DATA1I_text;
778 dnew->u.data.data = dnew->lbuf;
779 sprintf(dnew->u.data.data, "%d", p->recordSize);
780 dnew->u.data.len = strlen(dnew->u.data.data);
783 tagname = res_get_def(p->res, "tagrank", "rank");
784 if (strcmp(tagname, "0") && p->score >= 0 &&
785 (dnew = data1_mk_tag_data_wd(p->dh, node, tagname, mem)))
787 logf (LOG_DEBUG, "grs_retrieve: %s", tagname);
788 dnew->u.data.what = DATA1I_num;
789 dnew->u.data.data = dnew->lbuf;
790 sprintf(dnew->u.data.data, "%d", p->score);
791 dnew->u.data.len = strlen(dnew->u.data.data);
794 tagname = res_get_def(p->res, "tagsysno", "localControlNumber");
795 if (strcmp(tagname, "0") && p->localno > 0 &&
796 (dnew = data1_mk_tag_data_wd(p->dh, node, tagname, mem)))
798 logf (LOG_DEBUG, "grs_retrieve: %s", tagname);
799 dnew->u.data.what = DATA1I_text;
800 dnew->u.data.data = dnew->lbuf;
801 sprintf(dnew->u.data.data, "%d", p->localno);
802 dnew->u.data.len = strlen(dnew->u.data.data);
805 data1_pr_tree (p->dh, node, stdout);
807 if (p->comp && p->comp->which == Z_RecordComp_complex &&
808 p->comp->u.complex->generic &&
809 p->comp->u.complex->generic->schema)
811 oident *oe = oid_getentbyoid (p->comp->u.complex->generic->schema);
813 requested_schema = oe->value;
816 /* If schema has been specified, map if possible, then check that
817 * we got the right one
819 if (requested_schema != VAL_NONE)
821 logf (LOG_DEBUG, "grs_retrieve: schema mapping");
822 for (map = node->u.root.absyn->maptabs; map; map = map->next)
824 if (map->target_absyn_ref == requested_schema)
827 if (!(node = data1_map_record(p->dh, onode, map, mem)))
836 if (node->u.root.absyn &&
837 requested_schema != node->u.root.absyn->reference)
845 * Does the requested format match a known syntax-mapping? (this reflects
846 * the overlap of schema and formatting which is inherent in the MARC
849 logf (LOG_DEBUG, "grs_retrieve: syntax mapping");
850 if (node->u.root.absyn)
851 for (map = node->u.root.absyn->maptabs; map; map = map->next)
853 if (map->target_absyn_ref == p->input_format)
856 if (!(node = data1_map_record(p->dh, onode, map, mem)))
865 logf (LOG_DEBUG, "grs_retrieve: schemaIdentifier");
866 if (node->u.root.absyn &&
867 node->u.root.absyn->reference != VAL_NONE &&
868 p->input_format == VAL_GRS1)
872 int oidtmp[OID_SIZE];
874 oe.proto = PROTO_Z3950;
875 oe.oclass = CLASS_SCHEMA;
876 oe.value = node->u.root.absyn->reference;
878 if ((oid = oid_ent_to_oid (&oe, oidtmp)))
881 data1_handle dh = p->dh;
885 for (ii = oid; *ii >= 0; ii++)
889 sprintf(p, "%d", *ii);
894 if ((dnew = data1_mk_tag_data_wd(dh, node,
895 "schemaIdentifier", mem)))
897 dnew->u.data.what = DATA1I_oid;
898 dnew->u.data.data = (char *) nmem_malloc(mem, p - tmp);
899 memcpy(dnew->u.data.data, tmp, p - tmp);
900 dnew->u.data.len = p - tmp;
905 logf (LOG_DEBUG, "grs_retrieve: element spec");
906 if (p->comp && (res = process_comp(p->dh, node, p->comp)) > 0)
910 data1_free_tree(p->dh, onode);
911 data1_free_tree(p->dh, node);
915 else if (p->comp && !res)
919 data1_pr_tree (p->dh, node, stdout);
921 logf (LOG_DEBUG, "grs_retrieve: transfer syntax mapping");
922 switch (p->output_format = (p->input_format != VAL_NONE ?
923 p->input_format : VAL_SUTRS))
925 data1_marctab *marctab;
929 if (!(p->rec_buf = data1_nodetoidsgml(p->dh, node, selected,
934 char *new_buf = (char*) odr_malloc (p->odr, p->rec_len);
935 memcpy (new_buf, p->rec_buf, p->rec_len);
936 p->rec_buf = new_buf;
941 if (!(p->rec_buf = data1_nodetogr(p->dh, node, selected,
943 p->diagnostic = 238; /* not available in requested syntax */
945 p->rec_len = (size_t) (-1);
948 if (!(p->rec_buf = data1_nodetoexplain(p->dh, node, selected,
952 p->rec_len = (size_t) (-1);
955 if (!(p->rec_buf = data1_nodetosummary(p->dh, node, selected,
959 p->rec_len = (size_t) (-1);
962 if (!(p->rec_buf = data1_nodetobuf(p->dh, node, selected,
967 char *new_buf = (char*) odr_malloc (p->odr, p->rec_len);
968 memcpy (new_buf, p->rec_buf, p->rec_len);
969 p->rec_buf = new_buf;
973 if (!(p->rec_buf = data1_nodetosoif(p->dh, node, selected,
978 char *new_buf = (char*) odr_malloc (p->odr, p->rec_len);
979 memcpy (new_buf, p->rec_buf, p->rec_len);
980 p->rec_buf = new_buf;
984 if (!node->u.root.absyn)
989 for (marctab = node->u.root.absyn->marc; marctab;
990 marctab = marctab->next)
991 if (marctab->reference == p->input_format)
998 if (!(p->rec_buf = data1_nodetomarc(p->dh, marctab, node,
999 selected, &p->rec_len)))
1000 p->diagnostic = 238;
1003 char *new_buf = (char*) odr_malloc (p->odr, p->rec_len);
1004 memcpy (new_buf, p->rec_buf, p->rec_len);
1005 p->rec_buf = new_buf;
1009 data1_free_tree(p->dh, node);
1011 data1_free_tree(p->dh, onode);
1016 static struct recType grs_type =
1025 RecType recTypeGrs = &grs_type;