⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ill-get.c

📁 harvest是一个下载html网页得机器人
💻 C
📖 第 1 页 / 共 2 页
字号:
/* * Copyright (c) 1999-2001, Index Data. * See the file LICENSE for details. * * $Log: ill-get.c,v $ * Revision 1.9  2001/03/25 21:55:12  adam * Added odr_intdup. Ztest server returns TaskPackage for ItemUpdate. * * Revision 1.8  2001/02/21 13:46:53  adam * C++ fixes. * * Revision 1.7  2001/02/20 11:25:32  adam * Added ill_get_APDU and ill_get_Cancel. * * Revision 1.6  2000/08/10 08:41:26  adam * Fixes for ILL. * * Revision 1.5  2000/02/24 08:52:01  adam * Bug fix. * * Revision 1.4  2000/02/04 11:01:15  adam * Added more elements. * * 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 * Implemented ILL protocol. Minor updates ASN.1 compiler. * */#include <yaz/ill.h>bool_t *ill_get_bool (struct ill_get_ctl *gc, const char *name,		      const char *sub, int val){    ODR o = gc->odr;    char element[128];    const char *v;    bool_t *r = (bool_t *) odr_malloc (o, sizeof(*r));        strcpy(element, name);    if (sub)    {	strcat (element, ",");	strcat (element, sub);    }        v = (gc->f)(gc->clientData, element);    if (v)	val = atoi(v);    else if (val < 0)	return 0;    *r = val;    return r;}int *ill_get_int (struct ill_get_ctl *gc, const char *name,		  const char *sub, int val){    ODR o = gc->odr;    char element[128];    const char *v;        strcpy(element, name);    if (sub)    {	strcat (element, ",");	strcat (element, sub);    }        v = (gc->f)(gc->clientData, element);    if (v)	val = atoi(v);    return odr_intdup(o, val);}int *ill_get_enumerated (struct ill_get_ctl *gc, const char *name,			 const char *sub, int val){    return ill_get_int(gc, name, sub, val);}ILL_String *ill_get_ILL_String_x (struct ill_get_ctl *gc, const char *name,			 	  const char *sub, const char *vdefault){    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)        v = vdefault;    if (!v)	return 0;    r->which = ILL_String_GeneralString;    r->u.GeneralString = odr_strdup (gc->odr, v);    return r;}ILL_String *ill_get_ILL_String(struct ill_get_ctl *gc, const char *name,			       const char *sub){    return ill_get_ILL_String_x (gc, name, sub, 0);}ILL_ISO_Date *ill_get_ILL_ISO_Date (struct ill_get_ctl *gc, const char *name,				    const char *sub, const char *val){    char element[128];    const char *v;    strcpy(element, name);    if (sub)    {	strcat (element, ",");	strcat (element, sub);    }    v = (gc->f)(gc->clientData, element);    if (!v)	v = val;    if (!v)	return 0;    return odr_strdup (gc->odr, v);}ILL_ISO_Time *ill_get_ILL_ISO_Time (struct ill_get_ctl *gc, const char *name,				    const char *sub, const char *val){    char element[128];    const char *v;    strcpy(element, name);    if (sub)    {	strcat (element, ",");	strcat (element, sub);    }    v = (gc->f)(gc->clientData, element);    if (!v)	v = val;    if (!v)	return 0;    return odr_strdup (gc->odr, v);}ILL_Person_Or_Institution_Symbol *ill_get_Person_Or_Insitution_Symbol (    struct ill_get_ctl *gc, const char *name, const char *sub){    char element[128];    ODR o = gc->odr;    ILL_Person_Or_Institution_Symbol *p =	(ILL_Person_Or_Institution_Symbol *) 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 =	(ILL_Name_Of_Person_Or_Institution *) 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;    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){    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;}ILL_Transaction_Id *ill_get_Transaction_Id (struct ill_get_ctl *gc,					    const char *name, const char *sub){    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_x (gc, element, "transaction-group-qualifier", "");    r->transaction_qualifier =	ill_get_ILL_String_x (gc, element, "transaction-qualifier", "");    r->sub_transaction_qualifier =	ill_get_ILL_String (gc, element, "sub-transaction-qualifier");    return r;}ILL_Service_Date_this *ill_get_Service_Date_this (    struct ill_get_ctl *gc, const char *name, const char *sub){    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 = ill_get_ILL_ISO_Date (gc, element, "date", "20000101");    r->time = ill_get_ILL_ISO_Time (gc, element, "time", 0);    return r;}ILL_Service_Date_original *ill_get_Service_Date_original (    struct ill_get_ctl *gc, const char *name, const char *sub){    ODR o = gc->odr;    ILL_Service_Date_original *r =	(ILL_Service_Date_original *) odr_malloc (o, sizeof(*r));    char element[128];        strcpy(element, name);    if (sub)    {	strcat (element, ",");	strcat (element, sub);    }    r->date = ill_get_ILL_ISO_Date (gc, element, "date", 0);    r->time = ill_get_ILL_ISO_Time (gc, element, "time", 0);    if (!r->date && !r->time)	return 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 = ill_get_Service_Date_original (	gc, element, "original");    return r;}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));    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 (gc, element, "requester-SHIPPED", 1);    r->requester_CHECKED_IN =	ill_get_enumerated (gc, element, "requester-CHECKED-IN", 1);    return r;}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));    char element[128];        strcpy(element, name);    if (sub)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -