* Europagate, 1995
*
* $Log: cclfind.c,v $
- * Revision 1.5 1995/02/14 14:12:41 adam
+ * Revision 1.6 1995/02/14 16:20:55 adam
+ * Qualifiers are read from a file now.
+ *
+ * Revision 1.5 1995/02/14 14:12:41 adam
* Ranges for ordered qualfiers implemented (e.g. pd=1980-1990).
*
* Revision 1.4 1995/02/14 13:16:29 adam
return NULL;
}
+static int qual_val_type (struct ccl_rpn_attr *list, int type, int value)
+{
+ while (list)
+ {
+ if (list->type == type && list->value == value)
+ return 1;
+ list = list->next;
+ }
+ return 0;
+}
+
static void strxcat (char *n, const char *src, int len)
{
while (*n)
static struct ccl_rpn_node *search_term (struct ccl_rpn_attr **qa)
{
struct ccl_rpn_node *p;
+ struct ccl_rpn_attr *attr;
struct ccl_token *lookahead = look_token;
int len = 0;
int no, i;
if (i)
strcat (p->u.t.term, " ");
strxcat (p->u.t.term, src_str, src_len);
- ADVANCE;
+ ADVANCE;
}
if (qa)
{
int i;
- struct ccl_rpn_attr *attr;
for (i=0; qa[i]; i++)
{
struct ccl_rpn_attr *attr;
if (attr->value > 0)
add_attr (p, attr->type, attr->value);
}
- if ((attr = qual_val (qa[0], CCL_BIB1_STR)) &&
- attr->value == CCL_BIB1_STR_WP)
- {
- if (no == 1)
- add_attr (p, CCL_BIB1_STR, 2);
- else
- add_attr (p, CCL_BIB1_STR, 1);
- }
+ attr = qa[0];
+ }
+ else
+ attr = ccl_qual_search (bibset, "term", 4);
+ if (attr && qual_val_type (attr, CCL_BIB1_STR, CCL_BIB1_STR_WP))
+ {
+ if (no == 1)
+ add_attr (p, CCL_BIB1_STR, 2);
+ else
+ add_attr (p, CCL_BIB1_STR, 1);
}
if (left_trunc && right_trunc)
+ {
+ if (attr && !qual_val_type (attr, CCL_BIB1_TRU, CCL_BIB1_TRU_CAN_BOTH))
+ {
+ ccl_error = CCL_ERR_TRUNC_NOT_BOTH;
+ if (qa)
+ free (qa);
+ ccl_rpn_delete (p);
+ return NULL;
+ }
add_attr (p, CCL_BIB1_TRU, 3);
+ }
else if (right_trunc)
+ {
+ if (attr && !qual_val_type (attr, CCL_BIB1_TRU, CCL_BIB1_TRU_CAN_RIGHT))
+ {
+ ccl_error = CCL_ERR_TRUNC_NOT_RIGHT;
+ if (qa)
+ free (qa);
+ ccl_rpn_delete (p);
+ return NULL;
+ }
add_attr (p, CCL_BIB1_TRU, 1);
+ }
else if (left_trunc)
+ {
+ if (attr && !qual_val_type (attr, CCL_BIB1_TRU, CCL_BIB1_TRU_CAN_LEFT))
+ {
+ ccl_error = CCL_ERR_TRUNC_NOT_LEFT;
+ if (qa)
+ free (qa);
+ ccl_rpn_delete (p);
+ return NULL;
+ }
add_attr (p, CCL_BIB1_TRU, 2);
+ }
+ else
+ {
+ if (attr && qual_val_type (attr, CCL_BIB1_TRU, CCL_BIB1_TRU_CAN_NONE))
+ add_attr (p, CCL_BIB1_TRU, 100);
+ }
return p;
}
ADVANCE;
}
ap[i] = NULL;
- if (! (attr = qual_val (ap[0], CCL_BIB1_REL)) || attr->value == 3)
+ if (! (attr = qual_val (ap[0], CCL_BIB1_REL)) ||
+ attr->value != CCL_BIB1_REL_ORDER)
{
/* unordered relation */
struct ccl_rpn_node *p;