From 971894f6614f5e7a4560ed0b8094a7eb1a668bde Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Fri, 5 Jul 2002 12:43:30 +0000 Subject: [PATCH] Fix MARC and REGX/TCL filter for new data1 structure --- recctrl/marcread.c | 10 +++++----- recctrl/regxread.c | 20 +++++++++++++++----- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/recctrl/marcread.c b/recctrl/marcread.c index 7125bc9..b3f5190 100644 --- a/recctrl/marcread.c +++ b/recctrl/marcread.c @@ -3,7 +3,7 @@ * All rights reserved. * Sebastian Hammer, Adam Dickmeiss * - * $Id: marcread.c,v 1.15 2002-05-28 21:10:34 adam Exp $ + * $Id: marcread.c,v 1.16 2002-07-05 12:43:30 adam Exp $ */ #include #include @@ -31,8 +31,7 @@ data1_node *grs_read_marc (struct grs_read_info *p) #if MARC_DEBUG FILE *outf = stdout; #endif - - data1_node *res_root; + data1_node *res_root, *res_top; char *absynName; data1_marctab *marctab; @@ -66,6 +65,7 @@ data1_node *grs_read_marc (struct grs_read_info *p) yaz_log (LOG_WARN, "cannot read MARC without an abstract syntax"); return 0; } + res_top = data1_mk_tag (p->dh, p->mem, absynName, 0, res_root); marctab = res_root->u.root.absyn->marc; @@ -94,7 +94,7 @@ data1_node *grs_read_marc (struct grs_read_info *p) int i, i0; char tag[4]; data1_node *res; - data1_node *parent = res_root; + data1_node *parent = res_top; memcpy (tag, buf+entry_p, 3); entry_p += 3; @@ -102,7 +102,7 @@ data1_node *grs_read_marc (struct grs_read_info *p) /* generate field node */ - res = data1_mk_tag_n (p->dh, p->mem, tag, 3, 0 /* attr */, res_root); + res = data1_mk_tag_n (p->dh, p->mem, tag, 3, 0 /* attr */, parent); #if MARC_DEBUG fprintf (outf, "%s ", tag); diff --git a/recctrl/regxread.c b/recctrl/regxread.c index 5d9ce2f..0bf186c 100644 --- a/recctrl/regxread.c +++ b/recctrl/regxread.c @@ -2,7 +2,7 @@ * Copyright (C) 1994-2002, Index Data * All rights reserved. * - * $Id: regxread.c,v 1.42 2002-05-07 11:05:20 adam Exp $ + * $Id: regxread.c,v 1.43 2002-07-05 12:43:30 adam Exp $ */ #include #include @@ -1038,8 +1038,13 @@ static int cmd_tcl_begin (ClientData clientData, Tcl_Interp *interp, #endif res = data1_mk_root (spec->dh, spec->m, absynName); - spec->d1_stack[spec->d1_level] = res; - spec->d1_stack[++(spec->d1_level)] = NULL; + spec->d1_stack[spec->d1_level++] = res; + + res = data1_mk_tag (spec->dh, spec->m, absynName, 0, res); + + spec->d1_stack[spec->d1_level++] = res; + + spec->d1_stack[spec->d1_level] = NULL; } else if (!strcmp(argv[1], "element") && argc == 3) { @@ -1282,8 +1287,13 @@ static void execCode (struct lexSpec *spec, struct regxCode *code) #endif res = data1_mk_root (spec->dh, spec->m, absynName); - spec->d1_stack[spec->d1_level] = res; - spec->d1_stack[++(spec->d1_level)] = NULL; + spec->d1_stack[spec->d1_level++] = res; + + res = data1_mk_tag (spec->dh, spec->m, absynName, 0, res); + + spec->d1_stack[spec->d1_level++] = res; + + spec->d1_stack[spec->d1_level] = NULL; } r = execTok (spec, &s, &cmd_str, &cmd_len); } -- 1.7.10.4