From: Adam Dickmeiss Date: Tue, 27 Nov 2001 22:38:50 +0000 (+0000) Subject: CCL qualifier aliases (use OR for more than one qualifier). X-Git-Tag: YAZ.1.8.4~12 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=cb9bad819f13e44d7af6753bfa1bc8274ca37b9b;p=yaz-moved-to-github.git CCL qualifier aliases (use OR for more than one qualifier). --- diff --git a/CHANGELOG b/CHANGELOG index 0345c56..2e286f7 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,9 @@ Possible compatibility problems with earlier versions marked with '*'. --- 1.8.4 2001/XX/XX +New CCL feature. Qualifiers can be aliases for one or more +other qualifiers (if more than one is given, OR is used). + ZOOM allocates result set name if target supports it. Two new YAZ client commands: . (dot, which sources a script of YAZ diff --git a/ccl/bib1 b/ccl/bib1 index 0e9459c..241ad79 100644 --- a/ccl/bib1 +++ b/ccl/bib1 @@ -1,4 +1,4 @@ -# $Id: bib1,v 1.8 2001-03-22 21:23:30 adam Exp $ +# $Id: bib1,v 1.9 2001-11-27 22:38:50 adam Exp $ # CCL qualifiers and their mappings # # Each line takes the form: @@ -104,3 +104,10 @@ exp:category exp1,1=1 @set s set @case 0 # case insenstive (1 for case sensitive) @truncation * ? + +# Aliases +# +# forfatter=x is equivalent to au=x +forfatter au +# tiau=x is equivalent to ti=x or ti=x +tiau ti au diff --git a/ccl/cclerrms.c b/ccl/cclerrms.c index 09ec4a5..f9a6658 100644 --- a/ccl/cclerrms.c +++ b/ccl/cclerrms.c @@ -44,26 +44,9 @@ /* * Europagate, 1995 * - * $Log: cclerrms.c,v $ - * Revision 1.9 2000-03-14 09:06:11 adam - * Added POSIX threads support for frontend server. + * $Id: cclerrms.c,v 1.10 2001-11-27 22:38:50 adam Exp $ * - * Revision 1.8 1999/11/30 13:47:11 adam - * Improved installation. Moved header files to include/yaz. - * - * Revision 1.7 1998/02/11 11:53:33 adam - * Changed code so that it compiles as C++. - * - * Revision 1.6 1997/09/29 08:56:37 adam - * Changed CCL parser to be thread safe. New type, CCL_parser, declared - * and a create/destructers ccl_parser_create/ccl_parser/destory has - * been added. - * - * Revision 1.5 1997/04/30 08:52:06 quinn - * Null - * - * Revision 1.4 1996/10/11 15:00:24 adam - * CCL parser from Europagate Email gateway 1.0. + * Old Europagate Log: * * Revision 1.8 1995/05/16 09:39:25 adam * LICENSE. diff --git a/ccl/cclfind.c b/ccl/cclfind.c index 6e85b22..a7d19b5 100644 --- a/ccl/cclfind.c +++ b/ccl/cclfind.c @@ -44,79 +44,9 @@ /* CCL find (to rpn conversion) * Europagate, 1995 * - * $Log: cclfind.c,v $ - * Revision 1.26 2001-11-12 11:24:45 adam - * Ignore comma when dealing with and-lists. + * $Id: cclfind.c,v 1.27 2001-11-27 22:38:50 adam Exp $ * - * Revision 1.25 2001/10/03 23:54:41 adam - * Fixes for numeric ranges (date=1980-1990). - * - * Revision 1.24 2001/03/22 21:23:30 adam - * Directive s=pw sets structure to phrase if term includes blank(s). - * - * Revision 1.23 2001/03/20 11:22:58 adam - * CCL Truncation character may be defined. - * - * Revision 1.22 2001/03/07 13:24:40 adam - * Member and_not in Z_Operator is kept for backwards compatibility. - * Added support for definition of CCL operators in field spec file. - * - * Revision 1.21 2001/02/21 13:46:53 adam - * C++ fixes. - * - * Revision 1.20 2000/11/16 13:03:12 adam - * Function ccl_rpn_query sets attributeSet to Bib-1. - * - * Revision 1.19 2000/11/16 09:58:02 adam - * Implemented local AttributeSet setting for CCL field maps. - * - * Revision 1.18 2000/10/17 19:50:28 adam - * Implemented and-list and or-list for CCL module. - * - * Revision 1.17 2000/05/01 09:36:50 adam - * Range operator only treated in ordered ranges so that minus (-) can be - * used for, say, the and-not operator. - * - * Revision 1.16 2000/03/14 09:06:11 adam - * Added POSIX threads support for frontend server. - * - * Revision 1.15 2000/02/24 23:49:13 adam - * Fixed memory allocation problem. - * - * Revision 1.14 2000/01/31 13:15:21 adam - * Removed uses of assert(3). Cleanup of ODR. CCL parser update so - * that some characters are not surrounded by spaces in resulting term. - * ILL-code updates. - * - * Revision 1.13 1999/12/22 13:13:32 adam - * Search terms may include "operators" without causing error. - * - * Revision 1.12 1999/11/30 13:47:11 adam - * Improved installation. Moved header files to include/yaz. - * - * Revision 1.11 1999/03/31 11:15:37 adam - * Fixed memory leaks in ccl_find_str and ccl_qual_rm. - * - * Revision 1.10 1998/02/11 11:53:33 adam - * Changed code so that it compiles as C++. - * - * Revision 1.9 1997/09/29 08:56:37 adam - * Changed CCL parser to be thread safe. New type, CCL_parser, declared - * and a create/destructers ccl_parser_create/ccl_parser/destory has - * been added. - * - * Revision 1.8 1997/09/01 08:48:11 adam - * New windows NT/95 port using MSV5.0. Only a few changes made - * to avoid warnings. - * - * Revision 1.7 1997/05/14 06:53:26 adam - * C++ support. - * - * Revision 1.6 1997/04/30 08:52:06 quinn - * Null - * - * Revision 1.5 1996/10/11 15:00:24 adam - * CCL parser from Europagate Email gateway 1.0. + * Old Europagate log: * * Revision 1.16 1996/01/08 08:41:13 adam * Removed unused function. @@ -342,7 +272,6 @@ static struct ccl_rpn_node *search_term_x (CCL_parser cclp, struct ccl_rpn_attr **qa, int *term_list, int multi) { - struct ccl_rpn_attr *qa_tmp[2]; struct ccl_rpn_node *p_top = 0; struct ccl_token *lookahead = cclp->look_token; int and_list = 0; @@ -355,15 +284,6 @@ static struct ccl_rpn_node *search_term_x (CCL_parser cclp, if (!truncation_aliases) truncation_aliases = "?"; - if (!qa) - { - /* no qualifier(s) applied. Use 'term' if it is defined */ - - qa = qa_tmp; - ccl_assert (qa); - qa[0] = ccl_qual_search (cclp, "term", 4); - qa[1] = NULL; - } if (qual_val_type (qa, CCL_BIB1_STR, CCL_BIB1_STR_AND_LIST, 0)) and_list = 1; if (qual_val_type (qa, CCL_BIB1_STR, CCL_BIB1_STR_OR_LIST, 0)) @@ -579,54 +499,12 @@ static struct ccl_rpn_node *search_term (CCL_parser cclp, return search_term_x(cclp, qa, list, 0); } -/* - * qualifiers: Parse CCL qualifiers and search terms. - * cclp: CCL Parser - * la: Token pointer to RELATION token. - * qa: Qualifier attributes already applied. - * return: pointer to node(s); NULL on error. - */ -static struct ccl_rpn_node *qualifiers (CCL_parser cclp, struct ccl_token *la, - struct ccl_rpn_attr **qa) +static struct ccl_rpn_node *qualifiers2 (CCL_parser cclp, + struct ccl_rpn_attr **ap) { - struct ccl_token *lookahead = cclp->look_token; - struct ccl_rpn_attr **ap; - int no = 0; - int i, rel; char *attset; -#if 0 - if (qa) - { - cclp->error_code = CCL_ERR_DOUBLE_QUAL; - return NULL; - } -#endif - for (lookahead = cclp->look_token; lookahead != la; - lookahead=lookahead->next) - no++; - if (qa) - for (i=0; qa[i]; i++) - no++; - ap = (struct ccl_rpn_attr **)malloc ((no+1) * sizeof(*ap)); - ccl_assert (ap); - for (i = 0; cclp->look_token != la; i++) - { - ap[i] = ccl_qual_search (cclp, cclp->look_token->name, - cclp->look_token->len); - if (!ap[i]) - { - cclp->error_code = CCL_ERR_UNKNOWN_QUAL; - free (ap); - return NULL; - } - ADVANCE; - if (KIND == CCL_TOK_COMMA) - ADVANCE; - } - if (qa) - while (*qa) - ap[i++] = *qa++; - ap[i] = NULL; + int rel; + if (!qual_val_type(ap, CCL_BIB1_REL, CCL_BIB1_REL_ORDER, &attset)) { /* unordered relation */ @@ -634,7 +512,6 @@ static struct ccl_rpn_node *qualifiers (CCL_parser cclp, struct ccl_token *la, if (KIND != CCL_TOK_EQ) { cclp->error_code = CCL_ERR_EQ_EXPECTED; - free (ap); return NULL; } ADVANCE; @@ -643,21 +520,18 @@ static struct ccl_rpn_node *qualifiers (CCL_parser cclp, struct ccl_token *la, ADVANCE; if (!(p = find_spec (cclp, ap))) { - free (ap); return NULL; } if (KIND != CCL_TOK_RP) { cclp->error_code = CCL_ERR_RP_EXPECTED; ccl_rpn_delete (p); - free (ap); return NULL; } ADVANCE; } else p = search_terms (cclp, ap); - free (ap); return p; } /* ordered relation ... */ @@ -685,19 +559,16 @@ static struct ccl_rpn_node *qualifiers (CCL_parser cclp, struct ccl_token *la, else { struct ccl_rpn_node *p; - + ADVANCE; /* skip relation */ if (KIND == CCL_TOK_TERM && cclp->look_token->next && cclp->look_token->next->len == 1 && - cclp->look_token->next->name[0] == '-') + cclp->look_token->next->name[0] == '-') { struct ccl_rpn_node *p1; if (!(p1 = search_term (cclp, ap))) - { - free (ap); return NULL; - } - ADVANCE; /* skip '-' */ + ADVANCE; /* skip '-' */ if (KIND == CCL_TOK_TERM) /* = term - term ? */ { struct ccl_rpn_node *p2; @@ -705,7 +576,6 @@ static struct ccl_rpn_node *qualifiers (CCL_parser cclp, struct ccl_token *la, if (!(p2 = search_term (cclp, ap))) { ccl_rpn_delete (p1); - free (ap); return NULL; } p = mk_node (CCL_RPN_AND); @@ -713,13 +583,11 @@ static struct ccl_rpn_node *qualifiers (CCL_parser cclp, struct ccl_token *la, add_attr (p1, attset, CCL_BIB1_REL, 4); p->u.p[1] = p2; add_attr (p2, attset, CCL_BIB1_REL, 2); - free (ap); return p; } else /* = term - */ { add_attr (p1, attset, CCL_BIB1_REL, 4); - free (ap); return p1; } } @@ -728,51 +596,127 @@ static struct ccl_rpn_node *qualifiers (CCL_parser cclp, struct ccl_token *la, { ADVANCE; if (!(p = search_term (cclp, ap))) - { - free (ap); return NULL; - } add_attr (p, attset, CCL_BIB1_REL, 2); - free (ap); return p; } else if (KIND == CCL_TOK_LP) { ADVANCE; if (!(p = find_spec (cclp, ap))) - { - free (ap); return NULL; - } if (KIND != CCL_TOK_RP) { cclp->error_code = CCL_ERR_RP_EXPECTED; ccl_rpn_delete (p); - free (ap); return NULL; } ADVANCE; - free (ap); return p; } else { if (!(p = search_terms (cclp, ap))) - { - free (ap); return NULL; - } add_attr (p, attset, CCL_BIB1_REL, rel); - free (ap); return p; } cclp->error_code = CCL_ERR_TERM_EXPECTED; } - free (ap); return NULL; } /* + * qualifiers: Parse CCL qualifiers and search terms. + * cclp: CCL Parser + * la: Token pointer to RELATION token. + * qa: Qualifier attributes already applied. + * return: pointer to node(s); NULL on error. + */ +static struct ccl_rpn_node *qualifiers (CCL_parser cclp, struct ccl_token *la, + struct ccl_rpn_attr **qa) +{ + struct ccl_token *lookahead = cclp->look_token; + struct ccl_token *look_start = cclp->look_token; + struct ccl_rpn_attr **ap; + struct ccl_rpn_node *node = 0; + int no = 0; + int seq = 0; + int i; +#if 0 + if (qa) + { + cclp->error_code = CCL_ERR_DOUBLE_QUAL; + return NULL; + } +#endif + for (lookahead = cclp->look_token; lookahead != la; + lookahead=lookahead->next) + no++; + if (qa) + for (i=0; qa[i]; i++) + no++; + ap = (struct ccl_rpn_attr **)malloc ((no+1) * sizeof(*ap)); + ccl_assert (ap); + + while (1) + { + struct ccl_rpn_node *node_sub; + int found = 0; + lookahead = look_start; + for (i = 0; lookahead != la; i++) + { + ap[i] = ccl_qual_search (cclp, lookahead->name, + lookahead->len, seq); + if (ap[i]) + found++; + if (!ap[i] && seq > 0) + ap[i] = ccl_qual_search (cclp, lookahead->name, + lookahead->len, 0); + if (!ap[i]) + { + cclp->look_token = lookahead; + cclp->error_code = CCL_ERR_UNKNOWN_QUAL; + free (ap); + return NULL; + } + lookahead = lookahead->next; + if (lookahead->kind == CCL_TOK_COMMA) + lookahead = lookahead->next; + } + if (qa) + while (*qa) + ap[i++] = *qa++; + ap[i] = NULL; + + if (!found) + break; + + cclp->look_token = lookahead; + + node_sub = qualifiers2(cclp, ap); + if (!node_sub) + { + ccl_rpn_delete (node); + break; + } + if (node) + { + struct ccl_rpn_node *node_this = mk_node(CCL_RPN_OR); + node_this->u.p[0] = node; + node_this->u.p[1] = node_sub; + node = node_this; + } + else + node = node_sub; + seq++; + } + free (ap); + return node; +} + + +/* * search_terms: Parse CCL search terms - including proximity. * cclp: CCL Parser * qa: Qualifier attributes already applied. @@ -874,7 +818,45 @@ static struct ccl_rpn_node *search_elements (CCL_parser cclp, break; lookahead = lookahead->next; } - return search_terms (cclp, qa); + if (qa) + return search_terms (cclp, qa); + else + { + struct ccl_rpn_attr *qa[2]; + struct ccl_rpn_node *node = 0; + int seq; + lookahead = cclp->look_token; + + qa[1] = 0; + for(seq = 0; ;seq++) + { + struct ccl_rpn_node *node_sub; + qa[0] = ccl_qual_search(cclp, "term", 4, seq); + if (!qa[0]) + break; + + cclp->look_token = lookahead; + + node_sub = search_terms (cclp, qa); + if (!node_sub) + { + ccl_rpn_delete (node); + return 0; + } + if (node) + { + struct ccl_rpn_node *node_this = mk_node(CCL_RPN_OR); + node_this->u.p[0] = node; + node_this->u.p[1] = node_sub; + node = node_this; + } + else + node = node_sub; + } + if (!node) + node = search_terms (cclp, 0); + return node; + } } /* diff --git a/ccl/cclptree.c b/ccl/cclptree.c index 0f50a94..79f4523 100644 --- a/ccl/cclptree.c +++ b/ccl/cclptree.c @@ -44,23 +44,9 @@ /* CCL print rpn tree - infix notation * Europagate, 1995 * - * $Log: cclptree.c,v $ - * Revision 1.8 2000-11-16 09:58:02 adam - * Implemented local AttributeSet setting for CCL field maps. + * $Id: cclptree.c,v 1.9 2001-11-27 22:38:50 adam Exp $ * - * Revision 1.7 2000/01/31 13:15:21 adam - * Removed uses of assert(3). Cleanup of ODR. CCL parser update so - * that some characters are not surrounded by spaces in resulting term. - * ILL-code updates. - * - * Revision 1.6 1999/11/30 13:47:11 adam - * Improved installation. Moved header files to include/yaz. - * - * Revision 1.5 1997/04/30 08:52:06 quinn - * Null - * - * Revision 1.4 1996/10/11 15:00:25 adam - * CCL parser from Europagate Email gateway 1.0. + * Old Europagate Log: * * Revision 1.6 1995/05/16 09:39:26 adam * LICENSE. diff --git a/ccl/cclqfile.c b/ccl/cclqfile.c index af18a4b..230492b 100644 --- a/ccl/cclqfile.c +++ b/ccl/cclqfile.c @@ -44,43 +44,9 @@ /* CCL qualifiers * Europagate, 1995 * - * $Log: cclqfile.c,v $ - * Revision 1.11 2001-09-14 10:49:51 adam - * Bug fix: file wasn't closed in ccl_qual_fname. + * $Id: cclqfile.c,v 1.12 2001-11-27 22:38:50 adam Exp $ * - * Revision 1.10 2001/05/16 07:30:16 adam - * Minor cosmetic changes that makes checker gcc happier. - * - * Revision 1.9 2001/03/07 13:24:40 adam - * Member and_not in Z_Operator is kept for backwards compatibility. - * Added support for definition of CCL operators in field spec file. - * - * Revision 1.8 2001/02/21 13:46:53 adam - * C++ fixes. - * - * Revision 1.7 2001/01/24 11:55:31 adam - * Fixed nasty bug introduced by previous commit (attribute sets not - * properly allocated). - * - * Revision 1.6 2000/11/16 09:58:02 adam - * Implemented local AttributeSet setting for CCL field maps. - * - * Revision 1.5 2000/10/17 19:50:28 adam - * Implemented and-list and or-list for CCL module. - * - * Revision 1.4 2000/01/31 13:15:21 adam - * Removed uses of assert(3). Cleanup of ODR. CCL parser update so - * that some characters are not surrounded by spaces in resulting term. - * ILL-code updates. - * - * Revision 1.3 1999/11/30 13:47:11 adam - * Improved installation. Moved header files to include/yaz. - * - * Revision 1.2 1997/04/30 08:52:06 quinn - * Null - * - * Revision 1.1 1996/10/11 15:00:25 adam - * CCL parser from Europagate Email gateway 1.0. + * Old Europagate Log: * * Revision 1.3 1995/05/16 09:39:26 adam * LICENSE. @@ -118,7 +84,14 @@ void ccl_qual_field (CCL_bibset bibset, const char *cp, const char *qual_name) break; if (!(split = strchr (qual_spec, '='))) + { + if (pair_no == 0) + { + ccl_qual_add_combi (bibset, qual_name, cp); + return; + } break; + } cp += no_scan; *split++ = '\0'; diff --git a/ccl/cclqual.c b/ccl/cclqual.c index 8ccc643..5dcbd72 100644 --- a/ccl/cclqual.c +++ b/ccl/cclqual.c @@ -44,45 +44,9 @@ /* CCL qualifiers * Europagate, 1995 * - * $Log: cclqual.c,v $ - * Revision 1.15 2001-03-07 13:24:40 adam - * Member and_not in Z_Operator is kept for backwards compatibility. - * Added support for definition of CCL operators in field spec file. + * $Id: cclqual.c,v 1.16 2001-11-27 22:38:50 adam Exp $ * - * Revision 1.14 2000/11/16 09:58:02 adam - * Implemented local AttributeSet setting for CCL field maps. - * - * Revision 1.13 2000/01/31 13:15:21 adam - * Removed uses of assert(3). Cleanup of ODR. CCL parser update so - * that some characters are not surrounded by spaces in resulting term. - * ILL-code updates. - * - * Revision 1.12 1999/11/30 13:47:11 adam - * Improved installation. Moved header files to include/yaz. - * - * Revision 1.11 1999/03/31 11:15:37 adam - * Fixed memory leaks in ccl_find_str and ccl_qual_rm. - * - * Revision 1.10 1998/07/07 15:49:40 adam - * Added braces to avoid warning. - * - * Revision 1.9 1998/02/11 11:53:33 adam - * Changed code so that it compiles as C++. - * - * Revision 1.8 1997/09/29 08:56:38 adam - * Changed CCL parser to be thread safe. New type, CCL_parser, declared - * and a create/destructers ccl_parser_create/ccl_parser/destory has - * been added. - * - * Revision 1.7 1997/09/01 08:48:12 adam - * New windows NT/95 port using MSV5.0. Only a few changes made - * to avoid warnings. - * - * Revision 1.6 1997/04/30 08:52:07 quinn - * Null - * - * Revision 1.5 1996/10/11 15:00:25 adam - * CCL parser from Europagate Email gateway 1.0. + * Old Europagate Log: * * Revision 1.9 1995/05/16 09:39:27 adam * LICENSE. @@ -134,6 +98,18 @@ struct ccl_qualifier_special { struct ccl_qualifier_special *next; }; + +static struct ccl_qualifier *ccl_qual_lookup (CCL_bibset b, + const char *n, size_t len) +{ + struct ccl_qualifier *q; + for (q = b->list; q; q = q->next) + if (len == strlen(q->name) && !memcmp (q->name, n, len)) + break; + return q; +} + + void ccl_qual_add_special (CCL_bibset bibset, const char *n, const char *v) { struct ccl_qualifier_special *p; @@ -162,6 +138,51 @@ void ccl_qual_add_special (CCL_bibset bibset, const char *n, const char *v) p->value[pe - v] = '\0'; } +static int next_token(const char **cpp, const char **dst) +{ + int len = 0; + const char *cp = *cpp; + while (*cp && strchr(" \r\n\t\f", *cp)) + cp++; + if (dst) + *dst = cp; + len = 0; + while (*cp && !strchr(" \r\n\t\f", *cp)) + { + cp++; + len++; + } + *cpp = cp; + return len; +} + +void ccl_qual_add_combi (CCL_bibset b, const char *n, const char *names) +{ + const char *cp, *cp1; + int i, len; + struct ccl_qualifier *q; + for (q = b->list; q && strcmp(q->name, n); q = q->next) + ; + if (q) + return ; + q = (struct ccl_qualifier *) malloc (sizeof(*q)); + q->name = ccl_strdup (n); + q->attr_list = 0; + q->next = b->list; + b->list = q; + + cp = names; + for (i = 0; next_token(&cp, 0); i++) + ; + q->no_sub = i; + q->sub = (struct ccl_qualifier **) malloc (sizeof(*q->sub) * + (1+q->no_sub)); + cp = names; + for (i = 0; (len = next_token(&cp, &cp1)); i++) + { + q->sub[i] = ccl_qual_lookup (b, cp1, len); + } +} /* * ccl_qual_add: Add qualifier to Bibset. If qualifier already @@ -191,13 +212,16 @@ void ccl_qual_add_set (CCL_bibset b, const char *name, int no, int *pairs, new_qual->next = b->list; b->list = new_qual; - new_qual->name = (char *)malloc (strlen(name)+1); - ccl_assert (new_qual->name); - strcpy (new_qual->name, name); + new_qual->name = ccl_strdup (name); attrp = &new_qual->attr_list; + + new_qual->no_sub = 0; + new_qual->sub = 0; } else { + if (q->sub) + free (q->sub); attrp = &q->attr_list; while (*attrp) attrp = &(*attrp)->next; @@ -254,6 +278,8 @@ void ccl_qual_rm (CCL_bibset *b) } q1 = q->next; free (q->name); + if (q->sub) + free (q->sub); free (q); } for (sp = (*b)->special; sp; sp = sp1) @@ -275,7 +301,8 @@ void ccl_qual_rm (CCL_bibset *b) * return: Attribute info. NULL if not found. */ struct ccl_rpn_attr *ccl_qual_search (CCL_parser cclp, - const char *name, size_t len) + const char *name, size_t len, + int seq) { struct ccl_qualifier *q; @@ -288,15 +315,24 @@ struct ccl_rpn_attr *ccl_qual_search (CCL_parser cclp, if (cclp->ccl_case_sensitive) { if (!memcmp (name, q->name, len)) - return q->attr_list; + break; } else { if (!ccl_memicmp (name, q->name, len)) - return q->attr_list; + break; } } - return NULL; + if (q) + { + if (q->attr_list && seq == 0) + return q->attr_list; + if (seq < q->no_sub && q->sub[seq]) + { + return q->sub[seq]->attr_list; + } + } + return 0; } const char *ccl_qual_search_special (CCL_bibset b, diff --git a/ccl/cclsh.c b/ccl/cclsh.c index 080bc85..27b3464 100644 --- a/ccl/cclsh.c +++ b/ccl/cclsh.c @@ -44,35 +44,9 @@ /* CCL shell. * Europagate 1995 * - * $Log: cclsh.c,v $ - * Revision 1.10 2001-10-03 23:54:41 adam - * Fixes for numeric ranges (date=1980-1990). + * $Id: cclsh.c,v 1.11 2001-11-27 22:38:50 adam Exp $ * - * Revision 1.9 2001/05/16 07:30:16 adam - * Minor cosmetic changes that makes checker gcc happier. - * - * Revision 1.8 2001/03/18 20:45:39 ja7 - * Added readline and history support to cclsh - * - * Revision 1.7 2000/10/17 19:50:28 adam - * Implemented and-list and or-list for CCL module. - * - * Revision 1.6 2000/01/31 13:15:21 adam - * Removed uses of assert(3). Cleanup of ODR. CCL parser update so - * that some characters are not surrounded by spaces in resulting term. - * ILL-code updates. - * - * Revision 1.5 1999/12/16 23:36:19 adam - * Implemented ILL protocol. Minor updates ASN.1 compiler. - * - * Revision 1.4 1999/03/31 11:15:37 adam - * Fixed memory leaks in ccl_find_str and ccl_qual_rm. - * - * Revision 1.3 1997/04/30 08:52:07 quinn - * Null - * - * Revision 1.2 1996/10/11 15:00:25 adam - * CCL parser from Europagate Email gateway 1.0. + * Old Europagate Log: * * Revision 1.11 1995/05/16 09:39:27 adam * LICENSE. @@ -108,7 +82,6 @@ * * Revision 1.1 1995/02/13 12:35:21 adam * First version of CCL. Qualifiers aren't handled yet. - * */ #include @@ -199,10 +172,10 @@ int main (int argc, char **argv) if (*line_in) add_history(line_in); #endif - if(strlen(line_in) > 999) { - fprintf(stderr,"Input line to long\n"); - break; - }; + if (strlen(line_in) > 999) { + fprintf(stderr,"Input line to long\n"); + break; + } strcpy(buf,line_in); free (line_in); #else @@ -215,7 +188,6 @@ int main (int argc, char **argv) { CCL_parser cclp = ccl_parser_create (); struct ccl_token *list; - struct ccl_rpn_node *p; cclp->bibset = bibset; @@ -243,7 +215,7 @@ int main (int argc, char **argv) { struct ccl_token *lp; for (lp = list; lp; lp = lp->next) - printf ("%d %.*s\n", lp->kind, lp->len, lp->name); + printf ("%d %.*s\n", lp->kind, (int) (lp->len), lp->name); } ccl_token_del (list); ccl_parser_destroy (cclp); diff --git a/ccl/cclstr.c b/ccl/cclstr.c index f414dd6..12d8d8b 100644 --- a/ccl/cclstr.c +++ b/ccl/cclstr.c @@ -44,15 +44,9 @@ /* CCL string compare utilities * Europagate, 1995 * - * $Log: cclstr.c,v $ - * Revision 1.3 1999-11-30 13:47:11 adam - * Improved installation. Moved header files to include/yaz. + * $Id: cclstr.c,v 1.4 2001-11-27 22:38:50 adam Exp $ * - * Revision 1.2 1997/04/30 08:52:07 quinn - * Null - * - * Revision 1.1 1996/10/11 15:00:26 adam - * CCL parser from Europagate Email gateway 1.0. + * Old Europagate Log: * * Revision 1.3 1996/01/24 10:11:19 adam * Added include of stdlib.h. diff --git a/ccl/ccltoken.c b/ccl/ccltoken.c index c89b155..12111b1 100644 --- a/ccl/ccltoken.c +++ b/ccl/ccltoken.c @@ -44,52 +44,9 @@ /* CCL - lexical analysis * Europagate, 1995 * - * $Log: ccltoken.c,v $ - * Revision 1.17 2001-10-03 23:54:41 adam - * Fixes for numeric ranges (date=1980-1990). + * $Id: ccltoken.c,v 1.18 2001-11-27 22:38:50 adam Exp $ * - * Revision 1.16 2001/03/07 13:24:40 adam - * Member and_not in Z_Operator is kept for backwards compatibility. - * Added support for definition of CCL operators in field spec file. - * - * Revision 1.15 2000/05/01 09:36:50 adam - * Range operator only treated in ordered ranges so that minus (-) can be - * used for, say, the and-not operator. - * - * Revision 1.14 2000/03/14 09:06:11 adam - * Added POSIX threads support for frontend server. - * - * Revision 1.13 2000/02/08 10:39:53 adam - * Added a few functions to set name of operands, etc. - * - * Revision 1.12 2000/01/31 13:15:21 adam - * Removed uses of assert(3). Cleanup of ODR. CCL parser update so - * that some characters are not surrounded by spaces in resulting term. - * ILL-code updates. - * - * Revision 1.11 1999/11/30 13:47:11 adam - * Improved installation. Moved header files to include/yaz. - * - * Revision 1.10 1998/07/07 15:49:41 adam - * Added braces to avoid warning. - * - * Revision 1.9 1998/02/11 11:53:33 adam - * Changed code so that it compiles as C++. - * - * Revision 1.8 1997/09/29 08:56:38 adam - * Changed CCL parser to be thread safe. New type, CCL_parser, declared - * and a create/destructers ccl_parser_create/ccl_parser/destory has - * been added. - * - * Revision 1.7 1997/09/01 08:48:12 adam - * New windows NT/95 port using MSV5.0. Only a few changes made - * to avoid warnings. - * - * Revision 1.6 1997/04/30 08:52:07 quinn - * Null - * - * Revision 1.5 1996/10/11 15:00:26 adam - * CCL parser from Europagate Email gateway 1.0. + * Old Europagate Log: * * Revision 1.10 1995/07/11 12:28:31 adam * New function: ccl_token_simple (split into simple tokens) and diff --git a/include/yaz/ccl.h b/include/yaz/ccl.h index beca689..5970e4f 100644 --- a/include/yaz/ccl.h +++ b/include/yaz/ccl.h @@ -45,60 +45,9 @@ /* * CCL - header file * - * $Log: ccl.h,v $ - * Revision 1.10 2001-06-28 12:42:01 adam - * Added prototype for ccl_qual_add_special. + * $Id: ccl.h,v 1.11 2001-11-27 22:38:50 adam Exp $ * - * Revision 1.9 2001/03/07 13:24:40 adam - * Member and_not in Z_Operator is kept for backwards compatibility. - * Added support for definition of CCL operators in field spec file. - * - * Revision 1.8 2000/11/16 09:58:02 adam - * Implemented local AttributeSet setting for CCL field maps. - * - * Revision 1.7 2000/11/01 14:47:00 adam - * Added CCL support for WIN32. - * - * Revision 1.6 2000/10/17 19:50:28 adam - * Implemented and-list and or-list for CCL module. - * - * Revision 1.5 2000/05/02 17:19:58 adam - * Removed MINUS token. - * - * Revision 1.4 2000/03/14 09:06:11 adam - * Added POSIX threads support for frontend server. - * - * Revision 1.3 2000/02/08 10:39:53 adam - * Added a few functions to set name of operands, etc. - * - * Revision 1.2 2000/01/31 13:15:21 adam - * Removed uses of assert(3). Cleanup of ODR. CCL parser update so - * that some characters are not surrounded by spaces in resulting term. - * ILL-code updates. - * - * Revision 1.1 1999/11/30 13:47:11 adam - * Improved installation. Moved header files to include/yaz. - * - * Revision 1.9 1998/02/11 11:53:33 adam - * Changed code so that it compiles as C++. - * - * Revision 1.8 1997/09/29 09:01:19 adam - * Changed CCL parser to be thread safe. New type, CCL-parser, declared - * and a create/destructor ccl_parser_create/ccl_parser_destroy has been - * added. - * - * Revision 1.7 1997/09/01 08:49:47 adam - * New windows NT/95 port using MSV5.0. To export DLL functions the - * YAZ_EXPORT modifier was added. Defined in yconfig.h. - * - * Revision 1.6 1997/05/14 06:53:37 adam - * C++ support. - * - * Revision 1.5 1997/04/30 08:52:08 quinn - * Null - * - * Revision 1.4 1996/10/11 15:02:26 adam - * CCL parser from Europagate Email gateway 1.0. + * Old Europagate Log: * * Revision 1.10 1996/01/08 08:41:22 adam * Minor changes. @@ -256,6 +205,8 @@ struct ccl_token { /* CCL Qualifier */ struct ccl_qualifier { char *name; + int no_sub; + struct ccl_qualifier **sub; struct ccl_rpn_attr *attr_list; struct ccl_qualifier *next; }; @@ -327,7 +278,11 @@ YAZ_EXPORT void ccl_qual_add (CCL_bibset b, const char *name, int no, YAZ_EXPORT void ccl_qual_add_set (CCL_bibset b, const char *name, int no, int *attr, char **attsets); -YAZ_EXPORT void ccl_qual_add_special (CCL_bibset bibset, const char *n, const char *v); +YAZ_EXPORT void ccl_qual_add_special (CCL_bibset bibset, + const char *n, const char *v); + +YAZ_EXPORT void ccl_qual_add_combi (CCL_bibset b, const char *n, + const char *names); /* Read CCL qualifier list spec from file inf */ YAZ_EXPORT void ccl_qual_file (CCL_bibset bibset, FILE *inf); @@ -336,7 +291,8 @@ YAZ_EXPORT void ccl_qual_file (CCL_bibset bibset, FILE *inf); YAZ_EXPORT int ccl_qual_fname (CCL_bibset bibset, const char *fname); /* Add CCL qualifier by using single-line spec */ -YAZ_EXPORT void ccl_qual_fitem (CCL_bibset bibset, const char *cp, const char *qual_name); +YAZ_EXPORT void ccl_qual_fitem (CCL_bibset bibset, const char *cp, + const char *qual_name); /* Make CCL qualifier set */ YAZ_EXPORT CCL_bibset ccl_qual_mk (void); @@ -352,8 +308,10 @@ YAZ_EXPORT int ccl_stricmp (const char *s1, const char *s2); YAZ_EXPORT int ccl_memicmp (const char *s1, const char *s2, size_t n); /* Search for qualifier 'name' in set 'b'. */ -YAZ_EXPORT struct ccl_rpn_attr *ccl_qual_search (CCL_parser cclp, const char *name, - size_t len); +YAZ_EXPORT struct ccl_rpn_attr *ccl_qual_search (CCL_parser cclp, + const char *name, + size_t len, + int seq); /* Create CCL parser */ YAZ_EXPORT CCL_parser ccl_parser_create (void);