that some characters are not surrounded by spaces in resulting term.
ILL-code updates.
* Europagate, 1995
*
* $Log: cclfind.c,v $
- * Revision 1.13 1999-12-22 13:13:32 adam
+ * 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
#include <stdio.h>
#include <stdlib.h>
-#include <assert.h>
#include <string.h>
#include <yaz/ccl.h>
static char *copy_token_name (struct ccl_token *tp)
{
char *str = (char *)malloc (tp->len + 1);
- assert (str);
+ ccl_assert (str);
memcpy (str, tp->name, tp->len);
str[tp->len] = '\0';
return str;
{
struct ccl_rpn_node *p;
p = (struct ccl_rpn_node *)malloc (sizeof(*p));
- assert (p);
+ ccl_assert (p);
p->kind = kind;
return p;
}
struct ccl_rpn_attr *n;
n = (struct ccl_rpn_attr *)malloc (sizeof(*n));
- assert (n);
+ ccl_assert (n);
n->type = type;
n->value = value;
n->next = p->u.t.attr_list;
/* no qualifier(s) applied. Use 'term' if it is defined */
qa = (struct ccl_rpn_attr **)malloc (2*sizeof(*qa));
- assert (qa);
+ ccl_assert (qa);
qa[0] = ccl_qual_search (cclp, "term", 4);
qa[1] = NULL;
}
/* make the RPN token */
p->u.t.term = (char *)malloc (len);
- assert (p->u.t.term);
+ ccl_assert (p->u.t.term);
p->u.t.term[0] = '\0';
for (i = 0; i<no; i++)
{
}
else if (i == no-1 && right_trunc)
src_len--;
- if (i)
- strcat (p->u.t.term, " ");
+ if (src_len)
+ {
+ int len = strlen(p->u.t.term);
+ if (len &&
+ !strchr("-+", *src_str) &&
+ !strchr("-+", p->u.t.term[len-1]))
+ {
+ strcat (p->u.t.term, " ");
+ }
+ }
strxcat (p->u.t.term, src_str, src_len);
ADVANCE;
}
for (i=0; qa[i]; i++)
no++;
ap = (struct ccl_rpn_attr **)malloc ((no+1) * sizeof(*ap));
- assert (ap);
+ ccl_assert (ap);
for (i = 0; cclp->look_token != la; i++)
{
ap[i] = ccl_qual_search (cclp, cclp->look_token->name,
* Europagate, 1995
*
* $Log: cclptree.c,v $
- * Revision 1.6 1999-11-30 13:47:11 adam
+ * 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
*/
#include <stdio.h>
-#include <assert.h>
#include <string.h>
#include <yaz/ccl.h>
fprintf (fd_out, ")");
break;
default:
- assert (0);
+ ccl_assert (0);
}
}
* Europagate, 1995
*
* $Log: cclqfile.c,v $
- * Revision 1.3 1999-11-30 13:47:11 adam
+ * 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
#include <stdio.h>
#include <stdlib.h>
-#include <assert.h>
#include <string.h>
#include <yaz/ccl.h>
* Europagate, 1995
*
* $Log: cclqual.c,v $
- * Revision 1.12 1999-11-30 13:47:11 adam
+ * 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
#include <stdio.h>
#include <stdlib.h>
-#include <assert.h>
#include <string.h>
#include <yaz/ccl.h>
struct ccl_qualifier *q;
struct ccl_rpn_attr **attrp;
- assert (b);
+ 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 *)malloc (sizeof(*new_qual));
- assert (new_qual);
+ struct ccl_qualifier *new_qual =
+ (struct ccl_qualifier *)malloc (sizeof(*new_qual));
+ ccl_assert (new_qual);
new_qual->next = b->list;
b->list = new_qual;
new_qual->name = (char *)malloc (strlen(name)+1);
- assert (new_qual->name);
+ ccl_assert (new_qual->name);
strcpy (new_qual->name, name);
attrp = &new_qual->attr_list;
}
struct ccl_rpn_attr *attr;
attr = (struct ccl_rpn_attr *)malloc (sizeof(*attr));
- assert (attr);
+ ccl_assert (attr);
attr->type = *pairs++;
attr->value = *pairs++;
*attrp = attr;
CCL_bibset ccl_qual_mk (void)
{
CCL_bibset b = (CCL_bibset)malloc (sizeof(*b));
- assert (b);
+ ccl_assert (b);
b->list = NULL;
return b;
}
{
struct ccl_qualifier *q;
- assert (cclp);
+ ccl_assert (cclp);
if (!cclp->bibset)
return NULL;
for (q = cclp->bibset->list; q; q = q->next)
* Europagate 1995
*
* $Log: cclsh.c,v $
- * Revision 1.5 1999-12-16 23:36:19 adam
+ * 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
#include <stdio.h>
#include <stdlib.h>
-#include <assert.h>
#include <yaz/ccl.h>
}
else
{
- assert (rpn);
- if (i == 0)
+ if (rpn && i == 0)
{
ccl_pr_tree (rpn, stdout);
putchar ('\n');
* Europagate, 1995
*
* $Log: ccltoken.c,v $
- * Revision 1.11 1999-11-30 13:47:11 adam
+ * 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
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
-#include <assert.h>
#include <yaz/ccl.h>
if (!first)
{
first = last = (struct ccl_token *)malloc (sizeof (*first));
- assert (first);
+ ccl_assert (first);
last->prev = NULL;
}
else
{
last->next = (struct ccl_token *)malloc (sizeof(*first));
- assert (last->next);
+ ccl_assert (last->next);
last->next->prev = last;
last = last->next;
}
if (!first)
{
first = last = (struct ccl_token *)malloc (sizeof (*first));
- assert (first);
+ ccl_assert (first);
last->prev = NULL;
}
else
{
last->next = (struct ccl_token *)malloc (sizeof(*first));
- assert (last->next);
+ ccl_assert (last->next);
last->next->prev = last;
last = last->next;
}
/*
- * Copyright (c) 1995-1999, Index Data
+ * Copyright (c) 1995-2000, Index Data
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: client.c,v $
- * Revision 1.93 2000-01-15 09:39:50 adam
+ * Revision 1.94 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.93 2000/01/15 09:39:50 adam
* Implemented ill_get_ILLRequest. More ILL testing for client.
*
* Revision 1.92 1999/12/21 16:24:48 adam
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
-#include <assert.h>
#include <yaz/yaz-util.h>
odr_reset(print);
}
buf = odr_getbuf(out, &len, 0);
+ /* printf ("sending APDU of size %d\n", len); */
if (cs_put(conn, buf, len) < 0)
{
fprintf(stderr, "cs_put: %s", cs_errmsg(cs_errno(conn)));
case QueryType_CCL2RPN:
query.which = Z_Query_type_1;
RPNquery = ccl_rpn_query(out, rpn);
- assert(RPNquery);
+ if (!RPNquery)
+ {
+ printf ("Couldn't convert from CCL to RPN\n");
+ return 0;
+ }
bib1.proto = protocol;
bib1.oclass = CLASS_ATTSET;
bib1.value = VAL_BIB1;
}
#ifdef ASN_COMPILED
+
+const char *get_ill_element (void *clientData, const char *element)
+{
+ /* printf ("asking for %s\n", element); */
+ if (!strcmp (element, "ill,transaction-id,transaction-group-qualifier"))
+ return "1";
+ if (!strcmp (element, "ill,transaction-id,transaction-qualifier"))
+ return "1";
+ return 0;
+}
+
static Z_External *create_external_itemRequest()
{
- ILL_ItemRequest *req = ill_get_ItemRequest(out);
+ struct ill_get_ctl ctl;
+ ILL_ItemRequest *req;
Z_External *r = 0;
+ int item_request_size = 0;
+ char *item_request_buf = 0;
+
+ ctl.odr = out;
+ ctl.clientData = 0;
+ ctl.f = get_ill_element;
+
+ req = ill_get_ItemRequest(&ctl, "ill", 0);
if (!ill_ItemRequest (out, &req, 0, 0))
+ {
+ if (apdu_file)
+ {
+ ill_ItemRequest(print, &req, 0, 0);
+ odr_reset(print);
+ }
+ item_request_buf = odr_getbuf (out, &item_request_size, 0);
+ if (item_request_buf)
+ odr_setbuf (out, item_request_buf, item_request_size, 1);
+ printf ("Couldn't encode ItemRequest, size %d\n", item_request_size);
return 0;
+ }
else
{
oident oid;
- int itemRequest_size = 0;
- char *itemRequest_buf = odr_getbuf (out, &itemRequest_size, 0);
+ item_request_buf = odr_getbuf (out, &item_request_size, 0);
oid.proto = PROTO_GENERAL;
oid.oclass = CLASS_GENERAL;
oid.value = VAL_ISO_ILL_1;
r->u.single_ASN1_type = (Odr_oct *)
odr_malloc (out, sizeof(*r->u.single_ASN1_type));
- r->u.single_ASN1_type->buf = odr_malloc (out, itemRequest_size);
- r->u.single_ASN1_type->len = itemRequest_size;
- r->u.single_ASN1_type->size = itemRequest_size;
- memcpy (r->u.single_ASN1_type->buf, itemRequest_buf, itemRequest_size);
- printf ("len = %d\n", itemRequest_size);
+ r->u.single_ASN1_type->buf = odr_malloc (out, item_request_size);
+ r->u.single_ASN1_type->len = item_request_size;
+ r->u.single_ASN1_type->size = item_request_size;
+ memcpy (r->u.single_ASN1_type->buf, item_request_buf,
+ item_request_size);
+ printf ("len = %d\n", item_request_size);
}
return r;
}
#ifdef ASN_COMPILED
static Z_External *create_external_ILLRequest()
{
- ILL_Request *req = ill_get_ILLRequest(out);
+ struct ill_get_ctl ctl;
+ ILL_Request *req;
Z_External *r = 0;
+ int ill_request_size = 0;
+ char *ill_request_buf = 0;
+
+ ctl.odr = out;
+ ctl.clientData = 0;
+ ctl.f = get_ill_element;
+
+ req = ill_get_ILLRequest(&ctl, "ill", 0);
if (!ill_Request (out, &req, 0, 0))
+ {
+ if (apdu_file)
+ {
+ printf ("-------------------\n");
+ ill_Request(print, &req, 0, 0);
+ odr_reset(print);
+ printf ("-------------------\n");
+ }
+ ill_request_buf = odr_getbuf (out, &ill_request_size, 0);
+ if (ill_request_buf)
+ odr_setbuf (out, ill_request_buf, ill_request_size, 1);
+ printf ("Couldn't encode ILL-Request, size %d\n", ill_request_size);
return 0;
+ }
else
{
oident oid;
- int ill_request_size = 0;
- char *ill_request_buf = odr_getbuf (out, &ill_request_size, 0);
+ ill_request_buf = odr_getbuf (out, &ill_request_size, 0);
oid.proto = PROTO_GENERAL;
oid.oclass = CLASS_GENERAL;
switch (*type)
{
case '2':
+ printf ("using item-request\n");
r->u.itemOrder->u.esRequest->notToKeep->itemRequest =
create_external_itemRequest();
break;
case '1':
+ printf ("using ILL-request\n");
r->u.itemOrder->u.esRequest->notToKeep->itemRequest =
create_external_ILLRequest();
break;
{
char type[12];
int itemno;
- printf("Item order request\n");
- fflush(stdout);
if (sscanf (arg, "%10s %d", type, &itemno) != 2)
return 0;
+ printf("Item order request\n");
+ fflush(stdout);
send_itemorder(type, itemno);
return(2);
}
fprintf(stderr, "Packet dump:\n---------\n");
odr_dumpBER(stderr, netbuffer, res);
fprintf(stderr, "---------\n");
+ if (apdu_file)
+ z_APDU(print, &apdu, 0, 0);
exit(1);
}
if (apdu_file && !z_APDU(print, &apdu, 0, 0))
* See the file LICENSE for details.
*
* $Log: ill-get.c,v $
- * Revision 1.2 2000-01-15 09:38:51 adam
+ * Revision 1.3 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.2 2000/01/15 09:38:51 adam
* Implemented ill_get_ILLRequest. Added some type mappings for ILL protocol.
*
* Revision 1.1 1999/12/16 23:36:19 adam
#include <yaz/ill.h>
-ILL_String *ill_get_ILL_String (ODR o, const char *str)
+bool_t *ill_get_bool (struct ill_get_ctl *gc, const char *name,
+ const char *sub, int val)
{
- ILL_String *r = (ILL_String *) odr_malloc (o, sizeof(*r));
+ ODR o = gc->odr;
+ char element[128];
+ const char *v;
+ bool_t *r = odr_malloc (o, sizeof(*r));
+
+ strcpy(element, name);
+ if (sub)
+ {
+ strcat (element, ",");
+ strcat (element, sub);
+ }
- r->which = ILL_String_GeneralString;
- r->u.GeneralString = odr_strdup (o, str);
+ v = (gc->f)(gc->clientData, element);
+ if (v)
+ val = atoi(v);
+ else if (val < 0)
+ return 0;
+ *r = val;
return r;
}
-ILL_Transaction_Id *ill_get_Transaction_Id (ODR o)
+int *ill_get_int (struct ill_get_ctl *gc, const char *name,
+ const char *sub, int val)
{
- ILL_Transaction_Id *r = (ILL_Transaction_Id *) odr_malloc (o, sizeof(*r));
+ ODR o = gc->odr;
+ char element[128];
+ const char *v;
+ int *r = odr_malloc (o, sizeof(*r));
- r->initial_requester_id = 0;
- r->transaction_group_qualifier = ill_get_ILL_String (o, "group");
- r->transaction_qualifier = ill_get_ILL_String (o, "qual");
- r->sub_transaction_qualifier = 0;
+ strcpy(element, name);
+ if (sub)
+ {
+ strcat (element, ",");
+ strcat (element, sub);
+ }
+ v = (gc->f)(gc->clientData, element);
+ if (v)
+ val = atoi(v);
+ *r = val;
return r;
}
-
-ILL_Service_Date_this *ill_get_Service_Date_this (ODR o)
+int *ill_get_enumerated (struct ill_get_ctl *gc, const char *name,
+ const char *sub, int val)
{
- ILL_Service_Date_this *r =
- (ILL_Service_Date_this *) odr_malloc (o, sizeof(*r));
- r->date = odr_strdup (o, "14012000");
- r->time = 0;
- return r;
+ return ill_get_int(gc, name, sub, val);
}
-ILL_Service_Date_Time *ill_get_Service_Date_Time (ODR o)
+ILL_String *ill_get_ILL_String (struct ill_get_ctl *gc, const char *name,
+ const char *sub)
{
- ILL_Service_Date_Time *r =
- (ILL_Service_Date_Time *) odr_malloc (o, sizeof(*r));
- r->date_time_of_this_service = ill_get_Service_Date_this (o);
- r->date_time_of_original_service = 0;
+ ILL_String *r = (ILL_String *) odr_malloc (gc->odr, sizeof(*r));
+ char element[128];
+ const char *v;
+
+ strcpy(element, name);
+ if (sub)
+ {
+ strcat (element, ",");
+ strcat (element, sub);
+ }
+ v = (gc->f)(gc->clientData, element);
+ if (!v)
+ return 0;
+ r->which = ILL_String_GeneralString;
+ r->u.GeneralString = odr_strdup (gc->odr, v);
return r;
}
-ILL_Transaction_Type *ill_get_Transaction_Type (ODR o)
+ILL_Person_Or_Institution_Symbol *ill_get_Person_Or_Insitution_Symbol (
+ struct ill_get_ctl *gc, const char *name, const char *sub)
{
- ILL_Transaction_Type *r =
- (ILL_Transaction_Type *) odr_malloc (o, sizeof(*r));
- *r = 1;
- return r;
+ char element[128];
+ ODR o = gc->odr;
+ ILL_Person_Or_Institution_Symbol *p = odr_malloc (o, sizeof(*p));
+
+ strcpy(element, name);
+ if (sub)
+ {
+ strcat (element, ",");
+ strcat (element, sub);
+ }
+ p->which = ILL_Person_Or_Institution_Symbol_person_symbol;
+ if ((p->u.person_symbol = ill_get_ILL_String (gc, element, "person")))
+ return p;
+
+ p->which = ILL_Person_Or_Institution_Symbol_institution_symbol;
+ if ((p->u.institution_symbol =
+ ill_get_ILL_String (gc, element, "institution")))
+ return p;
+ return 0;
}
+static ILL_Name_Of_Person_Or_Institution *ill_get_Name_Of_Person_Or_Institution(
+ struct ill_get_ctl *gc, const char *name, const char *sub)
+{
+ char element[128];
+ ODR o = gc->odr;
+ ILL_Name_Of_Person_Or_Institution *p = odr_malloc (o, sizeof(*p));
+
+ strcpy(element, name);
+ if (sub)
+ {
+ strcat (element, ",");
+ strcat (element, sub);
+ }
+ p->which = ILL_Name_Of_Person_Or_Institution_name_of_person;
+ if ((p->u.name_of_person =
+ ill_get_ILL_String (gc, element, "name-of-person")))
+ return p;
-bool_t *ill_get_bool (ODR o, int val)
+ p->which = ILL_Name_Of_Person_Or_Institution_name_of_institution;
+ if ((p->u.name_of_institution =
+ ill_get_ILL_String (gc, element, "name-of-institution")))
+ return p;
+ return 0;
+}
+
+ILL_System_Id *ill_get_System_Id(struct ill_get_ctl *gc,
+ const char *name, const char *sub)
{
- bool_t *r = odr_malloc (o, sizeof(*r));
- *r = val;
- return r;
+ ODR o = gc->odr;
+ char element[128];
+ ILL_System_Id *p;
+
+ strcpy(element, name);
+ if (sub)
+ {
+ strcat (element, ",");
+ strcat (element, sub);
+ }
+ p = (ILL_System_Id *) odr_malloc (o, sizeof(*p));
+ p->person_or_institution_symbol =
+ ill_get_Person_Or_Insitution_Symbol (gc, element,
+ "person-or-institution-symbol");
+ p->name_of_person_or_institution =
+ ill_get_Name_Of_Person_Or_Institution (gc, element,
+ "name-of-person-or-institution");
+ return p;
}
-int *ill_get_enumerated (ODR o, int val)
+ILL_Transaction_Id *ill_get_Transaction_Id (struct ill_get_ctl *gc,
+ const char *name, const char *sub)
{
- int *r = odr_malloc (o, sizeof(*r));
- *r = val;
+ ODR o = gc->odr;
+ ILL_Transaction_Id *r = (ILL_Transaction_Id *) odr_malloc (o, sizeof(*r));
+ char element[128];
+
+ strcpy(element, name);
+ if (sub)
+ {
+ strcat (element, ",");
+ strcat (element, sub);
+ }
+ r->initial_requester_id =
+ ill_get_System_Id (gc, element, "initial-requester-id");
+ r->transaction_group_qualifier =
+ ill_get_ILL_String (gc, element, "transaction-group-qualifier");
+ r->transaction_qualifier =
+ ill_get_ILL_String (gc, element, "transaction-qualifier");
+ r->sub_transaction_qualifier =
+ ill_get_ILL_String (gc, element, "sub-transaction-qualifier");
return r;
}
-int *ill_get_int (ODR o, int val)
+
+ILL_Service_Date_this *ill_get_Service_Date_this (
+ struct ill_get_ctl *gc, const char *name, const char *sub)
{
- return ill_get_enumerated (o, val);
+ ODR o = gc->odr;
+ ILL_Service_Date_this *r =
+ (ILL_Service_Date_this *) odr_malloc (o, sizeof(*r));
+ char element[128];
+
+ strcpy(element, name);
+ if (sub)
+ {
+ strcat (element, ",");
+ strcat (element, sub);
+ }
+ r->date = odr_strdup (o, "14012000");
+ r->time = 0;
+ return r;
}
+ILL_Service_Date_Time *ill_get_Service_Date_Time (
+ struct ill_get_ctl *gc, const char *name, const char *sub)
+{
+ ODR o = gc->odr;
+ ILL_Service_Date_Time *r =
+ (ILL_Service_Date_Time *) odr_malloc (o, sizeof(*r));
+ char element[128];
+
+ strcpy(element, name);
+ if (sub)
+ {
+ strcat (element, ",");
+ strcat (element, sub);
+ }
+ r->date_time_of_this_service = ill_get_Service_Date_this (gc, element,
+ "this");
+ r->date_time_of_original_service = 0;
+ return r;
+}
-ILL_Requester_Optional_Messages_Type *ill_get_Requester_Optional_Messages_Type (ODR o)
+ILL_Requester_Optional_Messages_Type *ill_get_Requester_Optional_Messages_Type (
+ struct ill_get_ctl *gc, const char *name, const char *sub)
{
+ ODR o = gc->odr;
ILL_Requester_Optional_Messages_Type *r =
(ILL_Requester_Optional_Messages_Type *) odr_malloc (o, sizeof(*r));
- r->can_send_RECEIVED = ill_get_bool (o, 0);
- r->can_send_RETURNED = ill_get_bool (o, 0);
+ char element[128];
+
+ strcpy(element, name);
+ if (sub)
+ {
+ strcat (element, ",");
+ strcat (element, sub);
+ }
+ r->can_send_RECEIVED = ill_get_bool (gc, element, "can-send-RECEIVED", 0);
+ r->can_send_RETURNED = ill_get_bool (gc, element, "can-send-RETURNED", 0);
r->requester_SHIPPED =
- ill_get_enumerated (o, ILL_Requester_Optional_Messages_Type_requires);
+ ill_get_enumerated (gc, element, "requester-SHIPPED", 1);
r->requester_CHECKED_IN =
- ill_get_enumerated (o, ILL_Requester_Optional_Messages_Type_requires);
+ ill_get_enumerated (gc, element, "requester-CHECKED-IN", 1);
return r;
}
-ILL_Item_Id *ill_get_Item_Id (ODR o)
+ILL_Item_Id *ill_get_Item_Id (
+ struct ill_get_ctl *gc, const char *name, const char *sub)
{
+ ODR o = gc->odr;
ILL_Item_Id *r = (ILL_Item_Id *) odr_malloc (o, sizeof(*r));
-
- r->item_type = ill_get_enumerated (o, ILL_Item_Id_monograph);
+ char element[128];
+
+ strcpy(element, name);
+ if (sub)
+ {
+ strcat (element, ",");
+ strcat (element, sub);
+ }
+ r->item_type = ill_get_enumerated (gc, element, "item-type",
+ ILL_Item_Id_monograph);
r->held_medium_type = 0;
- r->call_number = 0;
- r->author = 0;
- r->title = 0;
- r->sub_title = 0;
- r->sponsoring_body = 0;
- r->place_of_publication = 0;
- r->publisher = 0;
- r->series_title_number = 0;
- r->volume_issue = 0;
- r->edition = 0;
- r->publication_date = 0;
- r->publication_date_of_component = 0;
- r->author_of_article = 0;
- r->title_of_article = 0;
- r->pagination = 0;
+ r->call_number = ill_get_ILL_String(gc, element, "call-number");
+ r->author = ill_get_ILL_String(gc, element, "author");
+ r->title = ill_get_ILL_String(gc, element, "title");
+ r->sub_title = ill_get_ILL_String(gc, element, "sub-title");
+ r->sponsoring_body = ill_get_ILL_String(gc, element, "sponsoring-body");
+ r->place_of_publication =
+ ill_get_ILL_String(gc, element, "place-of-publication");
+ r->publisher = ill_get_ILL_String(gc, element, "publisher");
+ r->series_title_number =
+ ill_get_ILL_String(gc, element, "series-title-number");
+ r->volume_issue = ill_get_ILL_String(gc, element, "volume-issue");
+ r->edition = ill_get_ILL_String(gc, element, "edition");
+ r->publication_date = ill_get_ILL_String(gc, element, "publication-date");
+ r->publication_date_of_component =
+ ill_get_ILL_String(gc, element, "publication-date-of-component");
+ r->author_of_article = ill_get_ILL_String(gc, element,
+ "author-of-article");
+ r->title_of_article = ill_get_ILL_String(gc, element, "title-or-article");
+ r->pagination = ill_get_ILL_String(gc, element, "pagination");
r->national_bibliography_no = 0;
- r->iSBN = 0;
- r->iSSN = 0;
+ r->iSBN = ill_get_ILL_String(gc, element, "ISBN");
+ r->iSSN = ill_get_ILL_String(gc, element, "ISSN");
r->system_no = 0;
- r->additional_no_letters = 0;
- r->verification_reference_source = 0;
+ r->additional_no_letters =
+ ill_get_ILL_String(gc, element, "additional-no-letters");
+ r->verification_reference_source =
+ ill_get_ILL_String(gc, element, "verification-reference-source");
return r;
}
-ILL_ItemRequest *ill_get_ItemRequest (ODR o)
+ILL_ItemRequest *ill_get_ItemRequest (
+ struct ill_get_ctl *gc, const char *name, const char *sub)
{
+ ODR o = gc->odr;
ILL_ItemRequest *r = (ILL_ItemRequest *)odr_malloc(o, sizeof(*r));
-
- r->protocol_version_num = ill_get_enumerated (o, ILL_Request_version_2);
-
- r->transaction_id = 0;
- r->service_date_time = 0;
- r->requester_id = 0;
- r->responder_id = 0;
- r->transaction_type = ill_get_Transaction_Type (o);
- r->delivery_address = 0;
- r->delivery_service = 0;
- r->billing_address = 0;
-
- r->num_iLL_service_type = 1;
- r->iLL_service_type = (ILL_Service_Type **)
- odr_malloc (o, sizeof(*r->iLL_service_type));
- *r->iLL_service_type =
- ill_get_enumerated (o, ILL_Service_Type_copy_non_returnable);
-
- r->responder_specific_service = 0;
- r->requester_optional_messages = 0;
- r->search_type = 0;
- r->num_supply_medium_info_type = 0;
- r->supply_medium_info_type = 0;
-
- r->place_on_hold = (int*) odr_malloc(o, sizeof(int));
- *r->place_on_hold = ILL_Place_On_Hold_Type_according_to_responder_policy;
-
- r->client_id = 0;
- r->item_id = 0;
- r->supplemental_item_description = 0;
- r->cost_info_type = 0;
- r->copyright_compliance = 0;
- r->third_party_info_type = 0;
- r->retry_flag = ill_get_bool (o, 0);
- r->forward_flag = ill_get_bool (o, 0);
- r->requester_note = 0;
- r->forward_note = 0;
- r->num_iLL_request_extensions = 0;
- r->iLL_request_extensions = 0;
- return r;
+ return 0;
}
-ILL_Request *ill_get_ILLRequest (ODR o)
+ILL_Request *ill_get_ILLRequest (
+ struct ill_get_ctl *gc, const char *name, const char *sub)
{
+ ODR o = gc->odr;
ILL_Request *r = (ILL_Request *) odr_malloc(o, sizeof(*r));
-
- r->protocol_version_num = ill_get_enumerated (o, ILL_Request_version_2);
-
- r->transaction_id = ill_get_Transaction_Id (o);
-
- r->service_date_time = ill_get_Service_Date_Time (o);
- r->requester_id = 0;
- r->responder_id = 0;
- r->transaction_type = ill_get_Transaction_Type(o);
- r->delivery_address = 0;
- r->delivery_service = 0;
- r->billing_address = 0;
+ char element[128];
+
+ strcpy(element, name);
+ if (sub)
+ {
+ strcat (element, ",");
+ strcat (element, sub);
+ }
+ r->protocol_version_num =
+ ill_get_enumerated (gc, element, "protocol-version-num",
+ ILL_Request_version_2);
+
+ r->transaction_id = ill_get_Transaction_Id (gc, element, "transaction-id");
+ r->service_date_time =
+ ill_get_Service_Date_Time (gc, element, "service-date-time");
+ r->requester_id = ill_get_System_Id (gc, element, "requester-id");
+ r->responder_id = ill_get_System_Id (gc, element, "responder-id");
+ r->transaction_type =
+ ill_get_enumerated(gc, element, "transaction-type", 1);
+ r->delivery_address = 0; /* TODO */
+ r->delivery_service = 0; /* TODO */
+ r->billing_address = 0; /* TODO */
r->num_iLL_service_type = 1;
r->iLL_service_type = (ILL_Service_Type **)
odr_malloc (o, sizeof(*r->iLL_service_type));
*r->iLL_service_type =
- ill_get_enumerated (o, ILL_Service_Type_copy_non_returnable);
+ ill_get_enumerated (gc, element, "ill-service-type",
+ ILL_Service_Type_copy_non_returnable);
r->responder_specific_service = 0;
r->requester_optional_messages =
- ill_get_Requester_Optional_Messages_Type (o);;
- r->search_type = 0;
+ ill_get_Requester_Optional_Messages_Type (
+ gc, element,"requester-optional-messages");
+ r->search_type = 0; /* TODO */
r->num_supply_medium_info_type = 0;
r->supply_medium_info_type = 0;
- r->place_on_hold = (int*) odr_malloc(o, sizeof(int));
- *r->place_on_hold = ILL_Place_On_Hold_Type_according_to_responder_policy;
-
- r->client_id = 0;
- r->item_id = ill_get_Item_Id (o);
+ r->place_on_hold =
+ ill_get_enumerated (gc, element, "place-on-hold",
+ ILL_Place_On_Hold_Type_according_to_responder_policy);
+ r->client_id = 0; /* TODO */
+ r->item_id = ill_get_Item_Id (gc, element, "item-id");
r->supplemental_item_description = 0;
r->cost_info_type = 0;
- r->copyright_compliance = 0;
+ r->copyright_compliance =
+ ill_get_ILL_String(gc, element, "copyright-complicance");
r->third_party_info_type = 0;
- r->retry_flag = ill_get_bool (o, 0);
- r->forward_flag = ill_get_bool (o, 0);
- r->requester_note = 0;
- r->forward_note = 0;
+ r->retry_flag = ill_get_bool (gc, element, "retry-flag", 0);
+ r->forward_flag = ill_get_bool (gc, element, "forward-flag", 0);
+ r->requester_note = ill_get_ILL_String(gc, element, "requester-note");
+ r->forward_note = ill_get_ILL_String(gc, element, "forward-note");
r->num_iLL_request_extensions = 0;
r->iLL_request_extensions = 0;
return r;
* CCL - header file
*
* $Log: ccl.h,v $
- * Revision 1.1 1999-11-30 13:47:11 adam
+ * 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
/* Destroy CCL parser */
void ccl_parser_destroy (CCL_parser p);
+#ifndef ccl_assert
+#define ccl_assert(x) ;
+#endif
+
#ifdef __cplusplus
}
#endif
* See the file LICENSE for details.
*
* $Log: ill.h,v $
- * Revision 1.2 2000-01-15 09:39:50 adam
+ * Revision 1.3 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.2 2000/01/15 09:39:50 adam
* Implemented ill_get_ILLRequest. More ILL testing for client.
*
* Revision 1.1 1999/12/16 23:36:19 adam
extern "C" {
#endif
-YAZ_EXPORT ILL_ItemRequest *ill_get_ItemRequest (ODR o);
-YAZ_EXPORT ILL_Request *ill_get_ILLRequest (ODR o);
+struct ill_get_ctl {
+ ODR odr;
+ void *clientData;
+ const char *(*f)(void *clientData, const char *element);
+};
+
+YAZ_EXPORT ILL_ItemRequest *ill_get_ItemRequest (
+ struct ill_get_ctl *gs, const char *name, const char *sub);
+
+YAZ_EXPORT ILL_Request *ill_get_ILLRequest (
+ struct ill_get_ctl *gs, const char *name, const char *sub);
#ifdef __cplusplus
}
/*
- * Copyright (c) 1995-1999, Index Data.
+ * Copyright (c) 1995-2000, Index Data.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation, in whole or in part, for any purpose, is hereby granted,
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*
- * $Id: odr.h,v 1.1 1999-11-30 13:47:11 adam Exp $
+ * $Id: odr.h,v 1.2 2000-01-31 13:15:21 adam Exp $
*/
#ifndef ODR_H
#define ODR_S_CUR 1
#define ODR_S_END 2
-typedef struct odr_ecblock
-{
- int can_grow; /* are we allowed to reallocate */
- unsigned char *buf; /* memory handle */
- int pos; /* current position */
- int top; /* top of buffer */
- int size; /* current buffer size */
-} odr_ecblock;
-
typedef struct { /* used to be statics in ber_tag... */
int lclass;
int ltag;
int direction; /* the direction of this stream */
int error; /* current error state (0==OK) */
- const unsigned char *buf; /* for encoding or decoding */
- int buflen; /* size of buffer for encoding, len for decoding */
- const unsigned char *bp; /* position in buffer */
- int left; /* bytes remaining in buffer */
- odr_ecblock ecb; /* memory control block */
+ int can_grow; /* are we allowed to reallocate */
+ unsigned char *buf; /* memory handle */
+ int size; /* current buffer size */
+
+ int pos; /* current position */
+ int top; /* top of buffer (max pos when decoding) */
+
+ const unsigned char *bp; /* position in buffer (decoding) */
int t_class; /* implicit tagging (-1==default tag) */
int t_tag;
#define odr_putc(o, c) \
( \
( \
- (o)->ecb.pos < (o)->ecb.size ? \
+ (o)->pos < (o)->size ? \
( \
- (o)->ecb.buf[(o)->ecb.pos++] = (c), \
+ (o)->buf[(o)->pos++] = (c), \
0 \
) : \
( \
- odr_grow_block(&(o)->ecb, 1) == 0 ? \
+ odr_grow_block((o), 1) == 0 ? \
( \
- (o)->ecb.buf[(o)->ecb.pos++] = (c), \
+ (o)->buf[(o)->pos++] = (c), \
0 \
) : \
( \
) \
) == 0 ? \
( \
- (o)->ecb.pos > (o)->ecb.top ? \
+ (o)->pos > (o)->top ? \
( \
- (o)->ecb.top = (o)->ecb.pos, \
+ (o)->top = (o)->pos, \
0 \
) : \
0 \
-1 \
) \
-#define odr_tell(o) ((o)->ecb.pos)
+#define odr_tell(o) ((o)->pos)
#define odr_offset(o) ((o)->bp - (o)->buf)
#define odr_ok(o) (!(o)->error)
#define odr_getmem(o) ((o)->mem)
YAZ_EXPORT void odr_end(ODR o);
YAZ_EXPORT Odr_oid *odr_oiddup(ODR odr, Odr_oid *o);
YAZ_EXPORT Odr_oid *odr_oiddup_nmem(NMEM nmem, Odr_oid *o);
-YAZ_EXPORT int odr_grow_block(odr_ecblock *b, int min_bytes);
+YAZ_EXPORT int odr_grow_block(ODR b, int min_bytes);
YAZ_EXPORT int odr_write(ODR o, unsigned char *buf, int bytes);
YAZ_EXPORT int odr_seek(ODR o, int whence, int offset);
YAZ_EXPORT int odr_dumpBER(FILE *f, const char *buf, int len);
/*
- * Copyright (c) 1995-1999, Index Data
+ * Copyright (c) 1995-2000, Index Data
* See the file LICENSE for details.
- * Sebastian Hammer, Adam Dickmeiss
*
* $Log: ber_any.c,v $
- * Revision 1.16 1999-11-30 13:47:11 adam
+ * Revision 1.17 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.16 1999/11/30 13:47:11 adam
* Improved installation. Moved header files to include/yaz.
*
* Revision 1.15 1999/01/08 11:23:20 adam
int ber_any(ODR o, Odr_any **p)
{
int res;
+ int left = o->size - (o->bp - o->buf);
switch (o->direction)
{
case ODR_DECODE:
- if ((res = completeBER(o->bp, o->left)) <= 0) /* FIX THIS */
+ if ((res = completeBER(o->bp, left)) <= 0) /* FIX THIS */
{
o->error = OPROTO;
return 0;
memcpy((*p)->buf, o->bp, res);
(*p)->len = (*p)->size = res;
o->bp += res;
- o->left -= res;
return 1;
case ODR_ENCODE:
if (odr_write(o, (*p)->buf, (*p)->len) < 0)
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: ber_bit.c,v $
- * Revision 1.10 1999-11-30 13:47:11 adam
+ * Revision 1.11 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.10 1999/11/30 13:47:11 adam
* Improved installation. Moved header files to include/yaz.
*
* Revision 1.9 1999/04/20 09:56:48 adam
return 0;
}
o->bp += res;
- o->left -= res;
if (cons) /* fetch component strings */
{
base = o->bp;
return 0;
}
o->bp++; /* silently ignore the unused-bits field */
- o->left--;
len--;
memcpy(p->bits + p->top + 1, o->bp, len);
p->top += len;
o->bp += len;
- o->left -= len;
return 1;
case ODR_ENCODE:
if ((res = ber_enclen(o, p->top + 2, 5, 0)) < 0)
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: ber_bool.c,v $
- * Revision 1.9 1999-11-30 13:47:11 adam
+ * Revision 1.10 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.9 1999/11/30 13:47:11 adam
* Improved installation. Moved header files to include/yaz.
*
* Revision 1.8 1995/09/29 17:12:16 quinn
return 0;
}
o->bp+= res;
- o->left -= res;
*val = *o->bp;
o->bp++;
- o->left--;
#ifdef ODR_DEBUG
fprintf(stderr, "[val=%d]\n", *val);
#endif
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: ber_int.c,v $
- * Revision 1.15 1999-11-30 13:47:11 adam
+ * Revision 1.16 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.15 1999/11/30 13:47:11 adam
* Improved installation. Moved header files to include/yaz.
*
* Revision 1.14 1999/05/26 07:49:35 adam
return 0;
}
o->bp += res;
- o->left -= res;
return 1;
case ODR_ENCODE:
if ((res = ber_encinteger(o, *val)) < 0)
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: ber_null.c,v $
- * Revision 1.9 1999-11-30 13:47:11 adam
+ * Revision 1.10 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.9 1999/11/30 13:47:11 adam
* Improved installation. Moved header files to include/yaz.
*
* Revision 1.8 1995/09/29 17:12:18 quinn
o->error = OPROTO;
return 0;
}
- o->left--;
#ifdef ODR_DEBUG
fprintf(stderr, "[NULL]\n");
#endif
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: ber_oct.c,v $
- * Revision 1.14 1999-11-30 13:47:11 adam
+ * Revision 1.15 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.14 1999/11/30 13:47:11 adam
* Improved installation. Moved header files to include/yaz.
*
* Revision 1.13 1999/04/20 09:56:48 adam
return 0;
}
o->bp += res;
- o->left -= res;
if (cons) /* fetch component strings */
{
base = o->bp;
memcpy(p->buf + p->len, o->bp, len);
p->len += len;
o->bp += len;
- o->left -= len;
return 1;
case ODR_ENCODE:
if ((res = ber_enclen(o, p->len, 5, 0)) < 0)
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: ber_oid.c,v $
- * Revision 1.10 1999-11-30 13:47:11 adam
+ * Revision 1.11 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.10 1999/11/30 13:47:11 adam
* Improved installation. Moved header files to include/yaz.
*
* Revision 1.9 1995/09/29 17:12:19 quinn
return 0;
}
o->bp += res;
- o->left -= res;
if (len == 0)
{
*p = -1;
p[0] = 2;
p[1] = *o->bp - p[0] * 40;
o->bp++;
- o->left--;
pos = 2;
len--;
while (len)
p[pos] <<= 7;
p[pos] |= *o->bp & 0X7F;
len--;
- o->left--;
}
while (*(o->bp++) & 0X80);
pos++;
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: ber_tag.c,v $
- * Revision 1.20 1999-11-30 13:47:11 adam
+ * Revision 1.21 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.20 1999/11/30 13:47:11 adam
* Improved installation. Moved header files to include/yaz.
*
* Revision 1.19 1999/01/08 11:23:25 adam
if (o->stackp < 0)
{
odr_seek(o, ODR_S_SET, 0);
- o->ecb.top = 0;
+ o->top = 0;
o->bp = o->buf;
odr_ber_tag->lclass = -1;
}
if (zclass == odr_ber_tag->lclass && tag == odr_ber_tag->ltag)
{
o->bp += odr_ber_tag->br;
- o->left -= odr_ber_tag->br;
*constructed = odr_ber_tag->lcons;
odr_ber_tag->lclass = -1;
return 1;
/*
- * Copyright (c) 1995-1999, Index Data
+ * Copyright (c) 1995-2000, Index Data
* See the file LICENSE for details.
- * Sebastian Hammer, Adam Dickmeiss
*
* $Log: odr.c,v $
- * Revision 1.31 1999-11-30 13:47:11 adam
+ * Revision 1.32 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.31 1999/11/30 13:47:11 adam
* Improved installation. Moved header files to include/yaz.
*
* Revision 1.30 1999/08/27 09:40:32 adam
r->direction = direction;
r->print = stderr;
r->buf = 0;
- r->ecb.buf = 0;
- r->ecb.size = r->ecb.pos = r->ecb.top = 0;
- r->ecb.can_grow = 1;
- r->buflen = 0;
+ r->size = r->pos = r->top = 0;
+ r->can_grow = 1;
r->mem = nmem_create();
r->enable_bias = 1;
r->odr_ber_tag.lclass = -1;
o->error = ONONE;
o->bp = o->buf;
odr_seek(o, ODR_S_SET, 0);
- o->ecb.top = 0;
- o->left = o->buflen;
+ o->top = 0;
o->t_class = -1;
o->t_tag = -1;
o->indent = 0;
void odr_destroy(ODR o)
{
nmem_destroy(o->mem);
- if (o->ecb.buf && o->ecb.can_grow)
- xfree(o->ecb.buf);
+ if (o->buf && o->can_grow)
+ xfree(o->buf);
if (o->print && o->print != stderr)
fclose(o->print);
xfree(o);
void odr_setbuf(ODR o, char *buf, int len, int can_grow)
{
- o->buf = o->bp = (unsigned char *) buf;
- o->buflen = o->left = len;
+ o->bp = (unsigned char *) buf;
- o->ecb.buf = (unsigned char *) buf;
- o->ecb.can_grow = can_grow;
- o->ecb.top = o->ecb.pos = 0;
- o->ecb.size = len;
+ o->buf = (unsigned char *) buf;
+ o->can_grow = can_grow;
+ o->top = o->pos = 0;
+ o->size = len;
}
char *odr_getbuf(ODR o, int *len, int *size)
{
- *len = o->ecb.top;
+ *len = o->top;
if (size)
- *size = o->ecb.size;
- return (char*) o->ecb.buf;
+ *size = o->size;
+ return (char*) o->buf;
}
/*
- * Copyright (c) 1995-1999, Index Data
+ * Copyright (c) 1995-2000, Index Data
* See the file LICENSE for details.
- * Sebastian Hammer, Adam Dickmeiss
*
* $Log: odr_cons.c,v $
- * Revision 1.20 1999-11-30 13:47:11 adam
+ * Revision 1.21 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.20 1999/11/30 13:47:11 adam
* Improved installation. Moved header files to include/yaz.
*
* Revision 1.19 1999/04/20 09:56:48 adam
*
*/
-#include <assert.h>
#include <yaz/odr.h>
void odr_setlenlen(ODR o, int len)
return 0;
o->stack[o->stackp].lenlen = res;
o->bp += res;
- o->left -= res;
}
else if (o->direction == ODR_PRINT)
{
{
if (*o->bp++ == 0 && *(o->bp++) == 0)
{
- o->left -= 2;
o->stackp--;
return 1;
}
o->stackp--;
return 1;
case ODR_PRINT:
- assert(o->indent > 0);
o->stackp--;
o->indent--;
odr_prname(o, 0);
/*
- * Copyright (c) 1995-1998, Index Data
+ * Copyright (c) 1995-2000, Index Data
* See the file LICENSE for details.
- * Sebastian Hammer, Adam Dickmeiss
*
* $Log: odr_mem.c,v $
- * Revision 1.16 1999-11-30 13:47:11 adam
+ * Revision 1.17 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.16 1999/11/30 13:47:11 adam
* Improved installation. Moved header files to include/yaz.
*
* Revision 1.15 1999/03/31 11:18:25 adam
/* ---------- memory management for data encoding ----------*/
-int odr_grow_block(odr_ecblock *b, int min_bytes)
+int odr_grow_block(ODR b, int min_bytes)
{
int togrow;
togrow = b->size;
if (togrow < min_bytes)
togrow = min_bytes;
- if (b->size && !(b->buf =(unsigned char *)xrealloc(b->buf, b->size += togrow)))
+ if (b->size && !(b->buf =
+ (unsigned char *) xrealloc(b->buf, b->size += togrow)))
abort();
- else if (!b->size && !(b->buf = (unsigned char *)xmalloc(b->size = togrow)))
+ else if (!b->size && !(b->buf = (unsigned char *)
+ xmalloc(b->size = togrow)))
abort();
#ifdef ODR_DEBUG
fprintf(stderr, "New size for encode_buffer: %d\n", b->size);
int odr_write(ODR o, unsigned char *buf, int bytes)
{
- if (o->ecb.pos + bytes >= o->ecb.size && odr_grow_block(&o->ecb, bytes))
+ if (o->pos + bytes >= o->size && odr_grow_block(o, bytes))
{
o->error = OSPACE;
return -1;
}
- memcpy(o->ecb.buf + o->ecb.pos, buf, bytes);
- o->ecb.pos += bytes;
- if (o->ecb.pos > o->ecb.top)
- o->ecb.top = o->ecb.pos;
+ memcpy(o->buf + o->pos, buf, bytes);
+ o->pos += bytes;
+ if (o->pos > o->top)
+ o->top = o->pos;
return 0;
}
int odr_seek(ODR o, int whence, int offset)
{
if (whence == ODR_S_CUR)
- offset += o->ecb.pos;
+ offset += o->pos;
else if (whence == ODR_S_END)
- offset += o->ecb.top;
- if (offset > o->ecb.size && odr_grow_block(&o->ecb, offset - o->ecb.size))
+ offset += o->top;
+ if (offset > o->size && odr_grow_block(o, offset - o->size))
{
o->error = OSPACE;
return -1;
}
- o->ecb.pos = offset;
+ o->pos = offset;
return 0;
}
/*
- * Copyright (c) 1995-1999, Index Data
+ * Copyright (c) 1995-2000, Index Data
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: odr_seq.c,v $
- * Revision 1.25 1999-11-30 13:47:11 adam
+ * Revision 1.26 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.25 1999/11/30 13:47:11 adam
* Improved installation. Moved header files to include/yaz.
*
* Revision 1.24 1999/04/20 09:56:48 adam
*
*/
-#include <assert.h>
#include <yaz/odr.h>
int odr_sequence_begin(ODR o, void *p, int size, const char *name)
/*
- * Copyright (c) 1995-1999, Index Data
+ * Copyright (c) 1995-2000, Index Data
* See the file LICENSE for details.
- * Sebastian Hammer, Adam Dickmeiss
*
* $Log: odr_util.c,v $
- * Revision 1.17 1999-11-30 13:47:12 adam
+ * Revision 1.18 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.17 1999/11/30 13:47:12 adam
* Improved installation. Moved header files to include/yaz.
*
* Revision 1.16 1999/04/20 09:56:48 adam
if (*o->bp == 0 && *(o->bp + 1) == 0)
{
o->bp += 2;
- o->left -= 2;
return 0;
}
else
* Chas Woodfield, Fretwell Downing Datasystems.
*
* $Log: ztest.c,v $
- * Revision 1.30 2000-01-13 23:05:50 adam
+ * Revision 1.31 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.30 2000/01/13 23:05:50 adam
* Fixed tagging for member requester-CHECKED-IN in ILL ASN.1 spec.
*
* Revision 1.29 2000/01/12 14:36:07 adam
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
-#include <assert.h>
#include <yaz/backend.h>
#include <yaz/log.h>
if (num == 98)
{
buf = (char*) odr_malloc(odr, 2101);
- assert(buf);
memset(buf, 'A', 2100);
buf[2100] = '\0';
break;
/*
- * Copyright (C) 1995-1999, Index Data
+ * Copyright (C) 1995-2000, Index Data
* All rights reserved.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: logrpn.c,v $
- * Revision 1.3 1999-11-30 13:47:12 adam
+ * Revision 1.4 2000-01-31 13:15:22 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:12 adam
* Improved installation. Moved header files to include/yaz.
*
* Revision 1.2 1999/08/27 09:40:33 adam
*
*/
#include <stdio.h>
-#include <assert.h>
#include <yaz/log.h>
#include <yaz/logrpn.h>
/*
- * Copyright (c) 1996-1999, Index Data.
+ * Copyright (c) 1996-2000, Index Data.
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: yaz-ccl.c,v $
- * Revision 1.4 1999-12-20 15:20:13 adam
+ * Revision 1.5 2000-01-31 13:15:22 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.4 1999/12/20 15:20:13 adam
* Implemented ccl_pquery to convert from CCL tree to prefix query.
*
* Revision 1.3 1999/11/30 13:47:12 adam
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <assert.h>
#include <yaz/yaz-ccl.h>
Z_AttributeElement **elements;
zapt = (Z_AttributesPlusTerm *)odr_malloc (o, sizeof(*zapt));
- assert (zapt);
term_octet = (Odr_oct *)odr_malloc (o, sizeof(*term_octet));
- assert (term_octet);
term = (Z_Term *)odr_malloc (o, sizeof(*term));
- assert(term);
for (attr = p->u.t.attr_list; attr; attr = attr->next)
num++;
{
elements[i] = (Z_AttributeElement *)
odr_malloc (o, sizeof(**elements));
- assert (elements[i]);
elements[i]->attributeType =
(int *)odr_malloc(o, sizeof(int));
*elements[i]->attributeType = attr->type;
Z_Operand *zo;
zo = (Z_Operand *)odr_malloc (o, sizeof(*zo));
- assert (zo);
switch (p->kind)
{
zo->u.resultSetId = p->u.setname;
break;
default:
- assert (0);
+ return 0;
}
return zo;
}
Z_Operator *zo;
zc = (Z_Complex *)odr_malloc (o, sizeof(*zc));
- assert (zc);
zo = (Z_Operator *)odr_malloc (o, sizeof(*zo));
- assert (zo);
zc->roperator = zo;
switch (p->kind)
#endif
break;
default:
- assert (0);
+ return 0;
}
zc->s1 = ccl_rpn_structure (o, p->u.p[0]);
zc->s2 = ccl_rpn_structure (o, p->u.p[1]);
Z_RPNStructure *zs;
zs = (Z_RPNStructure *)odr_malloc (o, sizeof(*zs));
- assert (zs);
switch (p->kind)
{
case CCL_RPN_AND:
zs->u.simple = ccl_rpn_simple (o, p);
break;
default:
- assert (0);
+ return 0;
}
return zs;
}
Z_RPNQuery *zq;
zq = (Z_RPNQuery *)odr_malloc (o, sizeof(*zq));
- assert (zq);
zq->attributeSetId = NULL;
zq->RPNStructure = ccl_rpn_structure (o, p);
return zq;
wrbuf_puts(w, "@prox 0 2 0 1 known 2 ");
break;
default:
- assert(0);
+ wrbuf_puts(w, "@ bad op (unknown) ");
};
ccl_pquery(w, p->u.p[0]);
ccl_pquery(w, p->u.p[1]);
wrbuf_puts (w, "} ");
break;
default:
- assert (0);
- };
+ }
}