X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=ccl%2Fcclqfile.c;h=339447619ed889d5859eb42ba94fcf1dde096872;hb=0f72f09a46621eb0aa9960b990dd35c221333e4d;hp=a4ab07b10860f16ce639c9e5c4e1561dec166650;hpb=85a2e7affad79fd8bd59b403ba7b5f7867d60523;p=yaz-moved-to-github.git diff --git a/ccl/cclqfile.c b/ccl/cclqfile.c index a4ab07b..3394476 100644 --- a/ccl/cclqfile.c +++ b/ccl/cclqfile.c @@ -45,7 +45,21 @@ * Europagate, 1995 * * $Log: cclqfile.c,v $ - * Revision 1.2 1997-04-30 08:52:06 quinn + * 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 @@ -66,32 +80,47 @@ #include #include -#include #include -#include +#include void ccl_qual_fitem (CCL_bibset bibset, const char *cp, const char *qual_name) { - char qual_type[128]; + char qual_spec[128]; int no_scan; - int pair[128]; + int pair[256]; + char *attsets[128]; int pair_no = 0; - while (1) + while (pair_no < 128) { - char *qual_value; - char *split; + char *qual_value, *qual_type; + char *split, *setp; - if (sscanf (cp, "%s%n", qual_type, &no_scan) != 1) - break; - - if (!(split = strchr (qual_type, '='))) + if (sscanf (cp, "%s%n", qual_spec, &no_scan) != 1) + break; + + if (!(split = strchr (qual_spec, '='))) break; cp += no_scan; *split++ = '\0'; - while (1) + + setp = strchr (qual_spec, ','); + if (setp) + { + + *setp++ = '\0'; + attsets[pair_no] = malloc (strlen(qual_spec)+1); + strcpy (attsets[pair_no], qual_spec); + qual_type = setp; + } + else + { + attsets[pair_no] = 0; + qual_type = qual_spec; + } + while (pair_no < 128) { int type, value; @@ -120,6 +149,10 @@ void ccl_qual_fitem (CCL_bibset bibset, const char *cp, const char *qual_name) type = CCL_BIB1_STR; if (!ccl_stricmp (qual_value, "pw")) value = CCL_BIB1_STR_WP; + if (!ccl_stricmp (qual_value, "al")) + value = CCL_BIB1_STR_AND_LIST; + if (!ccl_stricmp (qual_value, "ol")) + value = CCL_BIB1_STR_OR_LIST; break; case 't': case 'T': @@ -136,7 +169,7 @@ void ccl_qual_fitem (CCL_bibset bibset, const char *cp, const char *qual_name) case 'c': case 'C': type = CCL_BIB1_COM; - break; + break; default: type = atoi (qual_type); } @@ -147,7 +180,7 @@ void ccl_qual_fitem (CCL_bibset bibset, const char *cp, const char *qual_name) break; } } - ccl_qual_add (bibset, qual_name, pair_no, pair); + ccl_qual_add_set (bibset, qual_name, pair_no, pair, attsets); } /* @@ -181,3 +214,13 @@ void ccl_qual_file (CCL_bibset bibset, FILE *inf) ccl_qual_fitem (bibset, cp, qual_name); } } + +int ccl_qual_fname (CCL_bibset bibset, const char *fname) +{ + FILE *inf; + inf = fopen (fname, "r"); + if (!inf) + return -1; + ccl_qual_file (bibset, inf); + return 0; +}