2 * Copyright (C) 1994-2001, Index Data
6 * Revision 1.47 2002-05-03 13:50:25 adam
9 * Revision 1.46 2002/04/13 18:16:43 adam
10 * More XPATH work; common sequence numbers for extract keys
12 * Revision 1.45 2002/04/12 14:40:42 adam
15 * Revision 1.44 2002/04/11 20:09:47 adam
16 * work on string tag indexing
18 * Revision 1.43 2002/03/21 23:06:36 adam
19 * Source 'tag' in abs-file
21 * Revision 1.42 2002/02/20 17:30:01 adam
22 * Work on new API. Locking system re-implemented
24 * Revision 1.41 2001/05/22 21:01:47 adam
25 * Removed print of data1 tree on stdout so that inetd works again.
27 * Revision 1.40 2001/03/29 21:31:31 adam
28 * Fixed "record begin" for Tcl filter.
30 * Revision 1.39 2000/12/05 19:09:15 adam
31 * Fixed problem where indexer could crash if abstract syntax was undefined.
33 * Revision 1.38 2000/12/05 14:44:58 adam
34 * Fixed minor bug that could cause zmbol to break it data were emitted
35 * with not parent tags.
37 * Revision 1.37 2000/12/05 12:22:53 adam
38 * Termlist source implemented (so that we can index values of XML/SGML
41 * Revision 1.36 2000/12/05 10:01:44 adam
42 * Fixed bug regarding user-defined attribute sets.
44 * Revision 1.35 2000/11/29 15:21:31 adam
45 * Fixed problem with passwd db.
47 * Revision 1.34 2000/02/25 13:24:49 adam
48 * Fixed bug regarding pointer conversion that showed up on OSF V5.
50 * Revision 1.33 1999/11/30 13:48:04 adam
51 * Improved installation. Updated for inclusion of YAZ header files.
53 * Revision 1.32 1999/09/07 07:19:21 adam
54 * Work on character mapping. Implemented replace rules.
56 * Revision 1.31 1999/07/14 10:56:43 adam
57 * Fixed potential memory leak.
59 * Revision 1.30 1999/07/06 12:26:41 adam
60 * Retrieval handler obeys schema and handles XML transfer syntax.
62 * Revision 1.29 1999/05/26 07:49:14 adam
65 * Revision 1.28 1999/05/21 12:00:17 adam
66 * Better diagnostics for extraction process.
68 * Revision 1.27 1999/05/20 12:57:18 adam
69 * Implemented TCL filter. Updated recctrl system.
71 * Revision 1.26 1999/03/02 16:15:44 quinn
72 * Added "tagsysno" and "tagrank" directives to zebra.cfg.
74 * Revision 1.25 1999/02/18 15:01:26 adam
77 * Revision 1.24 1999/02/02 14:51:28 adam
78 * Updated WIN32 code specific sections. Changed header.
80 * Revision 1.23 1998/10/18 07:51:10 adam
81 * Changed one logf call.
83 * Revision 1.22 1998/10/16 08:14:37 adam
84 * Updated record control system.
86 * Revision 1.21 1998/07/01 09:16:10 adam
87 * Element localno only added when it's greater than 0.
89 * Revision 1.20 1998/05/20 10:12:26 adam
90 * Implemented automatic EXPLAIN database maintenance.
91 * Modified Zebra to work with ASN.1 compiled version of YAZ.
93 * Revision 1.19 1998/03/11 11:19:05 adam
94 * Changed the way sequence numbers are generated.
96 * Revision 1.18 1998/03/05 08:41:31 adam
99 * Revision 1.17 1998/02/10 12:03:06 adam
102 * Revision 1.16 1998/01/29 13:38:17 adam
103 * Fixed problem with mapping to record with unknown schema.
105 * Revision 1.15 1998/01/26 10:37:57 adam
106 * Better diagnostics.
108 * Revision 1.14 1997/11/06 11:41:01 adam
109 * Implemented "begin variant" for the sgml.regx filter.
111 * Revision 1.13 1997/10/31 12:35:44 adam
112 * Added a few log statements.
114 * Revision 1.12 1997/10/29 12:02:22 adam
115 * Using oid_ent_to_oid used instead of the non thread-safe oid_getoidbyent.
117 * Revision 1.11 1997/10/27 14:34:00 adam
118 * Work on generic character mapping depending on "structure" field
119 * in abstract syntax file.
121 * Revision 1.10 1997/09/18 08:59:21 adam
122 * Extra generic handle for the character mapping routines.
124 * Revision 1.9 1997/09/17 12:19:21 adam
125 * Zebra version corresponds to YAZ version 1.4.
126 * Changed Zebra server so that it doesn't depend on global common_resource.
128 * Revision 1.8 1997/09/09 13:38:14 adam
129 * Partial port to WIN95/NT.
131 * Revision 1.7 1997/09/05 15:30:10 adam
132 * Changed prototype for chr_map_input - added const.
133 * Added support for C++, headers uses extern "C" for public definitions.
135 * Revision 1.6 1997/09/04 13:54:40 adam
136 * Added MARC filter - type grs.marc.<syntax> where syntax refers
137 * to abstract syntax. New method tellf in retrieve/extract method.
139 * Revision 1.5 1997/07/15 16:29:03 adam
140 * Initialized dummy variable to keep checker gcc happy.
142 * Revision 1.4 1997/04/30 08:56:08 quinn
145 * Revision 1.2 1996/10/11 16:06:43 quinn
146 * Revision 1.3 1997/02/24 10:41:50 adam
147 * Cleanup of code and commented out the "end element-end-record" code.
149 * Revision 1.2 1996/10/11 16:06:43 quinn
150 * Fixed arguments to nodetogr
152 * Revision 1.1 1996/10/11 10:57:25 adam
153 * New module recctrl. Used to manage records (extract/retrieval).
155 * Revision 1.29 1996/10/08 10:30:21 quinn
156 * Fixed type mismatch
158 * Revision 1.28 1996/10/07 16:06:40 quinn
161 * Revision 1.27 1996/06/11 10:54:12 quinn
164 * Revision 1.26 1996/06/06 12:08:45 quinn
165 * Added showRecord function
167 * Revision 1.25 1996/06/04 14:18:53 quinn
170 * Revision 1.24 1996/06/04 13:27:54 quinn
171 * More work on charmapping
173 * Revision 1.23 1996/06/04 10:19:01 adam
174 * Minor changes - removed include of ctype.h.
176 * Revision 1.22 1996/06/03 10:15:27 quinn
177 * Various character-mapping.
179 * Revision 1.21 1996/05/31 13:27:24 quinn
180 * Character-conversion in phrases, too.
182 * Revision 1.19 1996/05/16 15:31:14 quinn
185 * Revision 1.18 1996/05/09 07:28:56 quinn
186 * Work towards phrases and multiple registers
188 * Revision 1.17 1996/05/01 13:46:37 adam
189 * First work on multiple records in one file.
190 * New option, -offset, to the "unread" command in the filter module.
192 * Revision 1.16 1996/01/17 14:57:54 adam
193 * Prototype changed for reader functions in extract/retrieve. File
194 * is identified by 'void *' instead of 'int.
196 * Revision 1.15 1996/01/08 19:15:47 adam
197 * New input filter that works!
199 * Revision 1.14 1995/12/15 12:36:11 adam
200 * Retrieval calls data1_read_regx when subType is specified.
202 * Revision 1.13 1995/12/15 12:24:43 quinn
203 * *** empty log message ***
205 * Revision 1.12 1995/12/15 12:20:28 quinn
206 * *** empty log message ***
208 * Revision 1.11 1995/12/15 12:07:57 quinn
209 * Changed extraction strategy.
211 * Revision 1.10 1995/12/14 11:10:48 quinn
214 * Revision 1.9 1995/12/13 17:14:05 quinn
215 * *** empty log message ***
217 * Revision 1.8 1995/12/13 15:33:18 quinn
218 * *** empty log message ***
220 * Revision 1.7 1995/12/13 13:45:39 quinn
221 * Changed data1 to use nmem.
223 * Revision 1.6 1995/12/04 14:22:30 adam
224 * Extra arg to recType_byName.
225 * Started work on new regular expression parsed input to
226 * structured records.
228 * Revision 1.5 1995/11/28 14:18:37 quinn
231 * Revision 1.4 1995/11/21 13:14:49 quinn
232 * Fixed end-of-data-field problem (maybe).
234 * Revision 1.3 1995/11/15 19:13:09 adam
235 * Work on record management.
241 #include <sys/types.h>
252 #define GRS_MAX_WORD 512
258 struct grs_handler *next;
261 struct grs_handlers {
262 struct grs_handler *handlers;
265 static int read_grs_type (struct grs_handlers *h,
266 struct grs_read_info *p, const char *type,
269 struct grs_handler *gh = h->handlers;
270 const char *cp = strchr (type, '.');
272 if (cp == NULL || cp == type)
274 cp = strlen(type) + type;
278 strcpy (p->type, cp+1);
279 for (gh = h->handlers; gh; gh = gh->next)
281 if (!memcmp (type, gh->type->type, cp-type))
286 gh->clientData = (*gh->type->init)();
288 p->clientData = gh->clientData;
289 *root = (gh->type->read)(p);
290 gh->clientData = p->clientData;
297 static void grs_add_handler (struct grs_handlers *h, RecTypeGrs t)
299 struct grs_handler *gh = (struct grs_handler *) malloc (sizeof(*gh));
300 gh->next = h->handlers;
307 static void *grs_init(RecType recType)
309 struct grs_handlers *h = (struct grs_handlers *) malloc (sizeof(*h));
312 grs_add_handler (h, recTypeGrs_sgml);
313 grs_add_handler (h, recTypeGrs_regx);
315 grs_add_handler (h, recTypeGrs_tcl);
317 grs_add_handler (h, recTypeGrs_marc);
321 static void grs_destroy(void *clientData)
323 struct grs_handlers *h = (struct grs_handlers *) clientData;
324 struct grs_handler *gh = h->handlers, *gh_next;
329 (*gh->type->destroy)(gh->clientData);
336 static void index_xpath (data1_node *n, struct recExtractCtrl *p,
337 int level, RecWord *wrd, int use)
340 char tag_path_full[1024];
348 wrd->string = n->u.data.data;
349 wrd->length = n->u.data.len;
350 wrd->attrSet = VAL_IDXPATH,
352 if (p->flagShowRecords)
354 printf("%*s data=", (level + 1) * 4, "");
355 for (i = 0; i<wrd->length && i < 8; i++)
356 fputc (wrd->string[i], stdout);
365 for (nn = n; nn; nn = nn->parent)
367 if (n->which == DATA1N_tag)
369 size_t tlen = strlen(nn->u.tag.tag);
370 if (tlen + flen > (sizeof(tag_path_full)-2))
372 memcpy (tag_path_full + flen, nn->u.tag.tag, tlen);
374 tag_path_full[flen++] = '/';
376 else if (n->which == DATA1N_root)
378 size_t tlen = strlen(nn->u.root.type);
379 if (tlen + flen > (sizeof(tag_path_full)-2))
381 memcpy (tag_path_full + flen, nn->u.root.type, tlen);
383 tag_path_full[flen++] = '/';
388 wrd->string = tag_path_full;
390 wrd->attrSet = VAL_IDXPATH,
392 if (p->flagShowRecords)
394 printf("%*s tag=", (level + 1) * 4, "");
395 for (i = 0; i<wrd->length && i < 40; i++)
396 fputc (wrd->string[i], stdout);
409 static void index_termlist (data1_node *par, data1_node *n,
410 struct recExtractCtrl *p, int level, RecWord *wrd)
412 data1_termlist *tlist = 0;
413 data1_datatype dtype = DATA1K_string;
415 * cycle up towards the root until we find a tag with an att..
416 * this has the effect of indexing locally defined tags with
417 * the attribute of their ancestor in the record.
420 while (!par->u.tag.element)
421 if (!par->parent || !(par=get_parent_tag(p->dh, par->parent)))
423 if (!par || !(tlist = par->u.tag.element->termlists))
425 if (par->u.tag.element->tag)
426 dtype = par->u.tag.element->tag->kind;
428 for (; tlist; tlist = tlist->next)
431 /* consider source */
434 if (!strcmp (tlist->source, "data") && n->which == DATA1N_data)
436 wrd->string = n->u.data.data;
437 wrd->length = n->u.data.len;
439 else if (!strcmp (tlist->source, "tag") && n->which == DATA1N_tag)
441 wrd->string = n->u.tag.tag;
442 wrd->length = strlen(n->u.tag.tag);
444 else if (sscanf (tlist->source, "attr(%511[^)])", xattr) == 1 &&
445 n->which == DATA1N_tag)
447 data1_xattr *p = n->u.tag.attributes;
448 while (p && strcmp (p->name, xattr))
452 wrd->string = p->value;
453 wrd->length = strlen(p->value);
458 if (p->flagShowRecords)
461 printf("%*sIdx: [%s]", (level + 1) * 4, "",
463 printf("%s:%s [%d] %s",
464 tlist->att->parent->name,
465 tlist->att->name, tlist->att->value,
468 for (i = 0; i<wrd->length && i < 8; i++)
469 fputc (wrd->string[i], stdout);
473 fputc ('\n', stdout);
477 wrd->reg_type = *tlist->structure;
478 wrd->attrSet = (int) (tlist->att->parent->reference);
479 wrd->attrUse = tlist->att->locals->local;
486 static int dumpkeys(data1_node *n, struct recExtractCtrl *p, int level,
489 for (; n; n = n->next)
491 if (p->flagShowRecords) /* display element description to user */
493 if (n->which == DATA1N_root)
495 printf("%*s", level * 4, "");
496 printf("Record type: '%s'\n", n->u.root.type);
498 else if (n->which == DATA1N_tag)
502 printf("%*s", level * 4, "");
503 if (!(e = n->u.tag.element))
504 printf("Local tag: '%s'\n", n->u.tag.tag);
507 printf("Elm: '%s' ", e->name);
510 data1_tag *t = e->tag;
512 printf("TagNam: '%s' ", t->names->name);
515 printf("%s[%d],", t->tagset->name, t->tagset->type);
518 if (t->which == DATA1T_numeric)
519 printf("%d)", t->value.numeric);
521 printf("'%s')", t->value.string);
528 if (n->which == DATA1N_tag)
530 index_termlist (n, n, p, level, wrd);
531 /* index start tag */
532 if (!n->root->u.root.absyn)
533 index_xpath (n, p, level, wrd, 1);
537 if (dumpkeys(n->child, p, level + 1, wrd) < 0)
541 if (n->which == DATA1N_data)
543 data1_node *par = get_parent_tag(p->dh, n);
545 if (p->flagShowRecords)
547 printf("%*s", level * 4, "");
549 if (n->u.data.len > 32)
550 printf("'%.24s ... %.6s'\n", n->u.data.data,
551 n->u.data.data + n->u.data.len-6);
552 else if (n->u.data.len > 0)
553 printf("'%.*s'\n", n->u.data.len, n->u.data.data);
559 index_termlist (par, n, p, level, wrd);
560 if (!n->root->u.root.absyn)
561 index_xpath (n, p, level, wrd, 1016);
565 if (n->which == DATA1N_tag)
568 if (!n->root->u.root.absyn)
569 index_xpath (n, p, level, wrd, 2);
573 if (p->flagShowRecords && n->which == DATA1N_root)
575 printf("%*s-------------\n\n", level * 4, "");
581 int grs_extract_tree(struct recExtractCtrl *p, data1_node *n)
584 int oidtmp[OID_SIZE];
587 oe.proto = PROTO_Z3950;
588 oe.oclass = CLASS_SCHEMA;
591 oe.value = n->u.root.absyn->reference;
593 if ((oid_ent_to_oid (&oe, oidtmp)))
594 (*p->schemaAdd)(p, oidtmp);
597 return dumpkeys(n, p, 0, &wrd);
600 static int grs_extract_sub(struct grs_handlers *h, struct recExtractCtrl *p,
604 struct grs_read_info gri;
606 int oidtmp[OID_SIZE];
609 gri.readf = p->readf;
610 gri.seekf = p->seekf;
611 gri.tellf = p->tellf;
614 gri.offset = p->offset;
618 if (read_grs_type (h, &gri, p->subType, &n))
619 return RECCTRL_EXTRACT_ERROR;
621 return RECCTRL_EXTRACT_EOF;
622 oe.proto = PROTO_Z3950;
623 oe.oclass = CLASS_SCHEMA;
625 if (!n->u.root.absyn)
626 return RECCTRL_EXTRACT_ERROR;
630 oe.value = n->u.root.absyn->reference;
631 if ((oid_ent_to_oid (&oe, oidtmp)))
632 (*p->schemaAdd)(p, oidtmp);
635 data1_pr_tree (p->dh, n, stdout);
638 if (dumpkeys(n, p, 0, &wrd) < 0)
640 data1_free_tree(p->dh, n);
641 return RECCTRL_EXTRACT_ERROR;
643 data1_free_tree(p->dh, n);
644 return RECCTRL_EXTRACT_OK;
647 static int grs_extract(void *clientData, struct recExtractCtrl *p)
650 NMEM mem = nmem_create ();
651 struct grs_handlers *h = (struct grs_handlers *) clientData;
653 ret = grs_extract_sub(h, p, mem);
659 * Return: -1: Nothing done. 0: Ok. >0: Bib-1 diagnostic.
661 static int process_comp(data1_handle dh, data1_node *n, Z_RecordComposition *c)
663 data1_esetname *eset;
669 case Z_RecordComp_simple:
670 if (c->u.simple->which != Z_ElementSetNames_generic)
671 return 26; /* only generic form supported. Fix this later */
672 if (!(eset = data1_getesetbyname(dh, n->u.root.absyn,
673 c->u.simple->u.generic)))
675 logf(LOG_LOG, "Unknown esetname '%s'", c->u.simple->u.generic);
676 return 25; /* invalid esetname */
678 logf(LOG_DEBUG, "Esetname '%s' in simple compspec",
679 c->u.simple->u.generic);
682 case Z_RecordComp_complex:
683 if (c->u.complex->generic)
685 /* insert check for schema */
686 if ((p = c->u.complex->generic->elementSpec))
690 case Z_ElementSpec_elementSetName:
692 data1_getesetbyname(dh, n->u.root.absyn,
693 p->u.elementSetName)))
695 logf(LOG_LOG, "Unknown esetname '%s'",
696 p->u.elementSetName);
697 return 25; /* invalid esetname */
699 logf(LOG_DEBUG, "Esetname '%s' in complex compspec",
700 p->u.elementSetName);
703 case Z_ElementSpec_externalSpec:
704 if (p->u.externalSpec->which == Z_External_espec1)
706 logf(LOG_DEBUG, "Got Espec-1");
707 espec = p->u.externalSpec-> u.espec1;
711 logf(LOG_LOG, "Unknown external espec.");
712 return 25; /* bad. what is proper diagnostic? */
723 logf (LOG_DEBUG, "Element: Espec-1 match");
724 return data1_doespec1(dh, n, espec);
728 logf (LOG_DEBUG, "Element: all match");
733 static int grs_retrieve(void *clientData, struct recRetrieveCtrl *p)
735 data1_node *node = 0, *onode = 0;
738 int res, selected = 0;
740 struct grs_read_info gri;
742 struct grs_handlers *h = (struct grs_handlers *) clientData;
743 int requested_schema = VAL_NONE;
746 gri.readf = p->readf;
747 gri.seekf = p->seekf;
748 gri.tellf = p->tellf;
755 logf (LOG_DEBUG, "grs_retrieve");
756 if (read_grs_type (h, &gri, p->subType, &node))
769 data1_pr_tree (p->dh, node, stdout);
771 logf (LOG_DEBUG, "grs_retrieve: size");
772 if ((dnew = data1_mk_tag_data_wd(p->dh, node, node,"size", mem)))
774 dnew->u.data.what = DATA1I_text;
775 dnew->u.data.data = dnew->lbuf;
776 sprintf(dnew->u.data.data, "%d", p->recordSize);
777 dnew->u.data.len = strlen(dnew->u.data.data);
780 tagname = res_get_def(p->res, "tagrank", "rank");
781 if (strcmp(tagname, "0") && p->score >= 0 &&
782 (dnew = data1_mk_tag_data_wd(p->dh, node, node, tagname, mem)))
784 logf (LOG_DEBUG, "grs_retrieve: %s", tagname);
785 dnew->u.data.what = DATA1I_num;
786 dnew->u.data.data = dnew->lbuf;
787 sprintf(dnew->u.data.data, "%d", p->score);
788 dnew->u.data.len = strlen(dnew->u.data.data);
791 tagname = res_get_def(p->res, "tagsysno", "localControlNumber");
792 if (strcmp(tagname, "0") && p->localno > 0 &&
793 (dnew = data1_mk_tag_data_wd(p->dh, node, node, tagname, mem)))
795 logf (LOG_DEBUG, "grs_retrieve: %s", tagname);
796 dnew->u.data.what = DATA1I_text;
797 dnew->u.data.data = dnew->lbuf;
798 sprintf(dnew->u.data.data, "%d", p->localno);
799 dnew->u.data.len = strlen(dnew->u.data.data);
802 data1_pr_tree (p->dh, node, stdout);
804 if (p->comp && p->comp->which == Z_RecordComp_complex &&
805 p->comp->u.complex->generic &&
806 p->comp->u.complex->generic->schema)
808 oident *oe = oid_getentbyoid (p->comp->u.complex->generic->schema);
810 requested_schema = oe->value;
813 /* If schema has been specified, map if possible, then check that
814 * we got the right one
816 if (requested_schema != VAL_NONE)
818 logf (LOG_DEBUG, "grs_retrieve: schema mapping");
819 for (map = node->u.root.absyn->maptabs; map; map = map->next)
821 if (map->target_absyn_ref == requested_schema)
824 if (!(node = data1_map_record(p->dh, onode, map, mem)))
833 if (node->u.root.absyn &&
834 requested_schema != node->u.root.absyn->reference)
842 * Does the requested format match a known syntax-mapping? (this reflects
843 * the overlap of schema and formatting which is inherent in the MARC
846 logf (LOG_DEBUG, "grs_retrieve: syntax mapping");
847 if (node->u.root.absyn)
848 for (map = node->u.root.absyn->maptabs; map; map = map->next)
850 if (map->target_absyn_ref == p->input_format)
853 if (!(node = data1_map_record(p->dh, onode, map, mem)))
862 logf (LOG_DEBUG, "grs_retrieve: schemaIdentifier");
863 if (node->u.root.absyn &&
864 node->u.root.absyn->reference != VAL_NONE &&
865 p->input_format == VAL_GRS1)
869 int oidtmp[OID_SIZE];
871 oe.proto = PROTO_Z3950;
872 oe.oclass = CLASS_SCHEMA;
873 oe.value = node->u.root.absyn->reference;
875 if ((oid = oid_ent_to_oid (&oe, oidtmp)))
878 data1_handle dh = p->dh;
882 for (ii = oid; *ii >= 0; ii++)
886 sprintf(p, "%d", *ii);
891 if ((dnew = data1_mk_tag_data_wd(dh, node, node,
892 "schemaIdentifier", mem)))
894 dnew->u.data.what = DATA1I_oid;
895 dnew->u.data.data = (char *) nmem_malloc(mem, p - tmp);
896 memcpy(dnew->u.data.data, tmp, p - tmp);
897 dnew->u.data.len = p - tmp;
902 logf (LOG_DEBUG, "grs_retrieve: element spec");
903 if (p->comp && (res = process_comp(p->dh, node, p->comp)) > 0)
907 data1_free_tree(p->dh, onode);
908 data1_free_tree(p->dh, node);
912 else if (p->comp && !res)
916 data1_pr_tree (p->dh, node, stdout);
918 logf (LOG_DEBUG, "grs_retrieve: transfer syntax mapping");
919 switch (p->output_format = (p->input_format != VAL_NONE ?
920 p->input_format : VAL_SUTRS))
922 data1_marctab *marctab;
926 if (!(p->rec_buf = data1_nodetoidsgml(p->dh, node, selected,
931 char *new_buf = (char*) odr_malloc (p->odr, p->rec_len);
932 memcpy (new_buf, p->rec_buf, p->rec_len);
933 p->rec_buf = new_buf;
938 if (!(p->rec_buf = data1_nodetogr(p->dh, node, selected,
940 p->diagnostic = 238; /* not available in requested syntax */
942 p->rec_len = (size_t) (-1);
945 if (!(p->rec_buf = data1_nodetoexplain(p->dh, node, selected,
949 p->rec_len = (size_t) (-1);
952 if (!(p->rec_buf = data1_nodetosummary(p->dh, node, selected,
956 p->rec_len = (size_t) (-1);
959 if (!(p->rec_buf = data1_nodetobuf(p->dh, node, selected,
964 char *new_buf = (char*) odr_malloc (p->odr, p->rec_len);
965 memcpy (new_buf, p->rec_buf, p->rec_len);
966 p->rec_buf = new_buf;
970 if (!(p->rec_buf = data1_nodetosoif(p->dh, node, selected,
975 char *new_buf = (char*) odr_malloc (p->odr, p->rec_len);
976 memcpy (new_buf, p->rec_buf, p->rec_len);
977 p->rec_buf = new_buf;
981 if (!node->u.root.absyn)
986 for (marctab = node->u.root.absyn->marc; marctab;
987 marctab = marctab->next)
988 if (marctab->reference == p->input_format)
995 if (!(p->rec_buf = data1_nodetomarc(p->dh, marctab, node,
996 selected, &p->rec_len)))
1000 char *new_buf = (char*) odr_malloc (p->odr, p->rec_len);
1001 memcpy (new_buf, p->rec_buf, p->rec_len);
1002 p->rec_buf = new_buf;
1006 data1_free_tree(p->dh, node);
1008 data1_free_tree(p->dh, onode);
1013 static struct recType grs_type =
1022 RecType recTypeGrs = &grs_type;