Logo Search packages:      
Sourcecode: yaz version File versions

YAZ_EXPORT void ccl_qual_add_set ( CCL_bibset  b,
const char *  name,
int  no,
int *  type_ar,
int *  value_ar,
char **  svalue_ar,
char **  attsets 
)

Add qualifier and supply attributes pairs+attribute set for it

ccl_qual_add: Add qualifier to Bibset. If qualifier already exists, then attributes are appendend to old definition. name: name of qualifier no: No of attribute type/value pairs. pairs: Attributes. pairs[0] first type, pair[1] first value, ... pair[2*no-2] last type, pair[2*no-1] last value.

Definition at line 201 of file cclqual.c.

References ccl_qualifier::attr_list, ccl_strdup(), ccl_rpn_attr::kind, ccl_qualifiers::list, ccl_qualifier::name, ccl_rpn_attr::next, ccl_qualifier::next, ccl_qualifier::no_sub, ccl_rpn_attr::numeric, ccl_rpn_attr::set, ccl_rpn_attr::str, ccl_qualifier::sub, ccl_rpn_attr::type, and ccl_rpn_attr::value.

{
    struct ccl_qualifier *q;
    struct ccl_rpn_attr **attrp;

    ccl_assert (b);
    for (q = b->list; q; q = q->next)
        if (!strcmp (name, q->name))
            break;
    if (!q)
    {
        struct ccl_qualifier *new_qual =
          (struct ccl_qualifier *)xmalloc (sizeof(*new_qual));
        ccl_assert (new_qual);
        
        new_qual->next = b->list;
        b->list = new_qual;
        
        new_qual->name = ccl_strdup (name);
        attrp = &new_qual->attr_list;

        new_qual->no_sub = 0;
        new_qual->sub = 0;
    }
    else
    {
        if (q->sub)  /* suspect.. */
            xfree (q->sub);
        attrp = &q->attr_list;
        while (*attrp)
            attrp = &(*attrp)->next;
    }
    while (--no >= 0)
    {
        struct ccl_rpn_attr *attr;

        attr = (struct ccl_rpn_attr *)xmalloc (sizeof(*attr));
        ccl_assert (attr);
      attr->set = *attsets++;
        attr->type = *type_ar++;
      if (*svalue_ar)
      {
          attr->kind = CCL_RPN_ATTR_STRING;
          attr->value.str = *svalue_ar;
      }
      else
      {
          attr->kind = CCL_RPN_ATTR_NUMERIC;
          attr->value.numeric = *value_ar;
      }
      svalue_ar++;
      value_ar++;
        *attrp = attr;
        attrp = &attr->next;
    }
    *attrp = NULL;
}


Generated by  Doxygen 1.6.0   Back to index