X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=retrieval%2Fd1_read.c;h=1740c21494fe295caacd0f8c58d5b223fe0a33c9;hp=17622488d1345701f9dff40b735138aaa1abe5f0;hb=88941d4a9e272daca9323cd19bf4829b6d32871b;hpb=ef96020a7ee2ee72323f043a4257d332b91ee353 diff --git a/retrieval/d1_read.c b/retrieval/d1_read.c index 1762248..1740c21 100644 --- a/retrieval/d1_read.c +++ b/retrieval/d1_read.c @@ -4,7 +4,20 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: d1_read.c,v $ - * Revision 1.10 1996-01-19 15:41:47 quinn + * Revision 1.14 1997-05-14 06:54:04 adam + * C++ support. + * + * Revision 1.13 1996/10/29 13:35:38 adam + * Implemented data1_set_tabpath and data1_get_tabpath. + * + * Revision 1.12 1996/10/11 10:35:38 adam + * Fixed a bug that caused data1_read_node to core dump when no abstract + * syntax was defined in a "sgml"-record. + * + * Revision 1.11 1996/07/06 19:58:35 quinn + * System headerfiles gathered in yconfig + * + * Revision 1.10 1996/01/19 15:41:47 quinn * Fixed uninitialized boolean. * * Revision 1.9 1996/01/17 14:52:47 adam @@ -90,8 +103,24 @@ char *data1_tabpath = 0; /* global path for tables */ -void data1_set_tabpath(char *p) -{ data1_tabpath = p; } +void data1_set_tabpath(const char *p) +{ + if (data1_tabpath) + { + xfree (data1_tabpath); + data1_tabpath = NULL; + } + if (p) + { + data1_tabpath = xmalloc (strlen(p)+1); + strcpy (data1_tabpath, p); + } +} + +const char *data1_get_tabpath (void) +{ + return data1_tabpath; +} #if 0 static data1_node *freelist = 0; @@ -170,6 +199,7 @@ data1_node *data1_insert_taggeddata(data1_node *root, data1_node *at, tagn->u.tag.node_selected = 0; tagn->u.tag.make_variantlist = 0; tagn->u.tag.no_data_requested = 0; + tagn->u.tag.get_bytes = -1; if (!(tagn->u.tag.element = data1_getelementbytagname(root->u.root.absyn, 0, tagname))) return 0; @@ -275,18 +305,18 @@ data1_node *data1_read_node(char **buf, data1_node *parent, int *line, } else if (!strncmp(tag, "var", 3)) { - char class[DATA1_MAX_SYMBOL], type[DATA1_MAX_SYMBOL]; + char tclass[DATA1_MAX_SYMBOL], type[DATA1_MAX_SYMBOL]; data1_vartype *tp; int val_offset; data1_node *p; - if (sscanf(args, "%s %s %n", class, type, &val_offset) != 2) + if (sscanf(args, "%s %s %n", tclass, type, &val_offset) != 2) { logf(LOG_WARN, "Malformed variant triple at '%s'", tag); return 0; } if (!(tp = data1_getvartypebyct(parent->root->u.root.absyn->varset, - class, type))) + tclass, type))) return 0; /* @@ -360,6 +390,7 @@ data1_node *data1_read_node(char **buf, data1_node *parent, int *line, res->u.tag.node_selected = 0; res->u.tag.make_variantlist = 0; res->u.tag.no_data_requested = 0; + res->u.tag.get_bytes = -1; res->root = parent->root; *buf = t + 1; } @@ -386,6 +417,8 @@ data1_node *data1_read_node(char **buf, data1_node *parent, int *line, data1_node *partag = get_parent_tag(parent); #endif + if (!parent) /* abort if abstract syntax is undefined */ + return 0; /* Determine length and remove newlines/extra blanks */ while (**buf && **buf != '<') {