From: Sebastian Hammer Date: Wed, 1 May 1996 12:45:28 +0000 (+0000) Subject: Support use of local tag names in abs file. X-Git-Tag: YAZ.1.8~764 X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=commitdiff_plain;h=e42d9ee8961aed7ac5750a4eccbbe681da92df0c;ds=sidebyside Support use of local tag names in abs file. --- diff --git a/retrieval/d1_absyn.c b/retrieval/d1_absyn.c index 142b998..349821d 100644 --- a/retrieval/d1_absyn.c +++ b/retrieval/d1_absyn.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: d1_absyn.c,v $ - * Revision 1.3 1995-11-01 16:34:55 quinn + * Revision 1.4 1996-05-01 12:45:28 quinn + * Support use of local tag names in abs file. + * + * Revision 1.3 1995/11/01 16:34:55 quinn * Making data1 look for tables in data1_tabpath * * Revision 1.2 1995/11/01 13:54:44 quinn @@ -184,29 +187,47 @@ data1_absyn *data1_read_absyn(char *file) level = i; if (!(new = *ppl[level] = xmalloc(sizeof(*new)))) abort; - new ->next = new->children = 0; + new->next = new->children = 0; + new->tag = 0; + new->att = 0; ppl[level] = &new->next; ppl[level+1] = &new->children; - if (sscanf(p, "(%d,%d)", &type, &value) < 2) + /* well-defined tag */ + if (sscanf(p, "(%d,%d)", &type, &value) == 2) { - logf(LOG_WARN, "Malformed element '%s' in %s", p, file); - fclose(f); - return 0; + if (!res->tagset) + { + logf(LOG_WARN, "No tagset loaded in %s", file); + fclose(f); + return 0; + } + if (!(new->tag = data1_gettagbynum(res->tagset, type, value))) + { + logf(LOG_WARN, "Couldn't find tag %s in tagset in %s", + p, file); + fclose(f); + return 0; + } } - if (!res->tagset) + /* private tag */ + else if (*p) { - logf(LOG_WARN, "No tagset loaded in %s", file); - fclose(f); - return 0; + data1_tag *nt = new->tag = xmalloc(sizeof(*new->tag)); + nt->which = DATA1T_string; + nt->value.string = xstrdup(p); + nt->names = xmalloc(sizeof(*new->tag->names)); + nt->names->name = nt->value.string; + nt->names->next = 0; + nt->kind = DATA1K_string; } - if (!(new->tag = data1_gettagbynum(res->tagset, type, value))) + else { - logf(LOG_WARN, "Couldn't find tag %s in tagset in %s", - p, file); + logf(LOG_WARN, "Bad element is %s", file); fclose(f); return 0; } + if (*att == '!') strcpy(att, name); if (*att == '-') diff --git a/retrieval/d1_grs.c b/retrieval/d1_grs.c index 7c863b0..1077c52 100644 --- a/retrieval/d1_grs.c +++ b/retrieval/d1_grs.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: d1_grs.c,v $ - * Revision 1.3 1995-11-13 09:27:35 quinn + * Revision 1.4 1996-05-01 12:45:30 quinn + * Support use of local tag names in abs file. + * + * Revision 1.3 1995/11/13 09:27:35 quinn * Fiddling with the variant stuff. * * Revision 1.2 1995/11/01 13:54:46 quinn @@ -202,7 +205,7 @@ static Z_TaggedElement *nodetotaggedelement(data1_node *n, int select, ODR o) } res->tagType = odr_malloc(o, sizeof(int)); - *res->tagType = tag ? tag->tagset->type : 3; + *res->tagType = (tag && tag->tagset) ? tag->tagset->type : 3; res->tagValue = odr_malloc(o, sizeof(Z_StringOrNumeric)); if (tag && tag->which == DATA1T_numeric) { diff --git a/retrieval/d1_map.c b/retrieval/d1_map.c index 9a04303..c6bae5a 100644 --- a/retrieval/d1_map.c +++ b/retrieval/d1_map.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: d1_map.c,v $ - * Revision 1.7 1995-12-13 13:44:31 quinn + * Revision 1.8 1996-05-01 12:45:31 quinn + * Support use of local tag names in abs file. + * + * Revision 1.7 1995/12/13 13:44:31 quinn * Modified Data1-system to use nmem * * Revision 1.6 1995/12/12 16:37:08 quinn @@ -198,7 +201,12 @@ static int tagmatch(data1_node *n, data1_maptag *t) return 0; if (n->u.tag.element) { - if (n->u.tag.element->tag->tagset->type != t->type) + if (n->u.tag.element->tag->tagset) + { + if (n->u.tag.element->tag->tagset->type != t->type) + return 0; + } + else if (t->type != 3) return 0; if (n->u.tag.element->tag->which == DATA1T_numeric) {