oid_getoidbyent, which is not thread safe.
--- XXXXX
+Revised the CCL parser utility to be thread safe.
+
+Added function, oid_ent_to_oid, to replace the function
+oid_getoidbyent, which is not thread safe.
+
* Added nmem_init and nmem_exit to initialize and release
NMEM resources. Function nmem_init should be called once in the
initial thread before NMEM/ODR is used. statserv.c and client.c
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: client.c,v $
- * Revision 1.52 1997-09-29 07:20:31 adam
+ * Revision 1.53 1997-09-29 13:18:59 adam
+ * Added function, oid_ent_to_oid, to replace the function
+ * oid_getoidbyent, which is not thread safe.
+ *
+ * Revision 1.52 1997/09/29 07:20:31 adam
* Client code uses nmem_init.
*
* Revision 1.51 1997/09/26 09:41:55 adam
Z_APDU *apdu = zget_APDU(out, Z_APDU_searchRequest);
Z_SearchRequest *req = apdu->u.searchRequest;
Z_Query query;
+ int oid[OID_SIZE];
#if CCL2RPN
struct ccl_rpn_node *rpn;
int error, pos;
mediumSetPresentNumber > 0))
{
oident prefsyn;
+ int oid[OID_SIZE];
prefsyn.proto = protocol;
prefsyn.oclass = CLASS_RECSYN;
prefsyn.value = recordsyntax;
req->preferredRecordSyntax =
- odr_oiddup(out, oid_getoidbyent(&prefsyn));
+ odr_oiddup(out, oid_ent_to_oid(&prefsyn, oid));
req->smallSetElementSetNames =
req->mediumSetElementSetNames = elementSetNames;
}
bib1.proto = protocol;
bib1.oclass = CLASS_ATTSET;
bib1.value = VAL_BIB1;
- RPNquery->attributeSetId = oid_getoidbyent(&bib1);
+ RPNquery->attributeSetId = oid_ent_to_oid(&bib1, oid);
query.u.type_1 = RPNquery;
ccl_rpn_delete (rpn);
break;
Z_RecordComposition compo;
oident prefsyn;
int nos = 1;
+ int oid[OID_SIZE];
char *p;
char setstring[100];
prefsyn.proto = protocol;
prefsyn.oclass = CLASS_RECSYN;
prefsyn.value = recordsyntax;
- req->preferredRecordSyntax = oid_getoidbyent(&prefsyn);
+ req->preferredRecordSyntax = oid_ent_to_oid(&prefsyn, oid);
+
if (elementSetNames)
{
req->recordComposition = &compo;
printf("Usage: format <recordsyntax>\n");
return 0;
}
- if (!strcmp(arg, "sutrs"))
- {
- printf("Preferred format is SUTRS.\n");
- recordsyntax = VAL_SUTRS;
- return 1;
- }
- else if (!strcmp(arg, "usmarc"))
- {
- printf("Preferred format is USMARC\n");
- recordsyntax = VAL_USMARC;
- return 1;
- }
- else if (!strcmp(arg, "danmarc"))
+ recordsyntax = oid_getvalbyname (arg);
+ if (recordsyntax == VAL_NONE)
{
- printf("Preferred format is DANMARC\n");
- recordsyntax = VAL_DANMARC;
- return 1;
- }
- else if (!strcmp(arg, "ukmarc"))
- {
- printf("Preferred format is UKMARC\n");
- recordsyntax = VAL_UKMARC;
- return 1;
- }
- else if (!strcmp(arg, "unimarc"))
- {
- printf("Preferred format is UNIMARC\n");
- recordsyntax = VAL_UNIMARC;
- return 1;
- }
- else if (!strcmp(arg, "grs1"))
- {
- printf("Preferred format is GRS1\n");
- recordsyntax = VAL_GRS1;
- return 1;
- }
- else if (!strcmp(arg, "soif"))
- {
- printf("Preferred format is SOIF\n");
- recordsyntax = VAL_SOIF;
- return 1;
- }
- else if (!strcmp(arg, "summary"))
- {
- printf("Preferred format is Summary\n");
- recordsyntax = VAL_SUMMARY;
- return 1;
- }
- else if (!strcmp(arg, "explain"))
- {
- printf("Preferred format is Explain\n");
- recordsyntax = VAL_EXPLAIN;
- return 1;
- }
- else
- {
- printf("Specify one of {sutrs,usmarc,danmarc,ukmarc,unimarc,grs1,summary,explain}.\n");
+ printf ("unknown record syntax\n");
return 0;
}
+ return 1;
}
int cmd_elements(char *arg)
/*
- * Copyright (c) 1995, Index Data.
+ * Copyright (c) 1995-1997, 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,
* OF THIS SOFTWARE.
*
* $Log: oid.h,v $
- * Revision 1.23 1997-09-01 08:49:50 adam
+ * Revision 1.24 1997-09-29 13:18:59 adam
+ * Added function, oid_ent_to_oid, to replace the function
+ * oid_getoidbyent, which is not thread safe.
+ *
+ * Revision 1.23 1997/09/01 08:49:50 adam
* New windows NT/95 port using MSV5.0. To export DLL functions the
* YAZ_EXPORT modifier was added. Defined in yconfig.h.
*
extern "C" {
#endif
-#define OID_SIZE 100
+#define OID_SIZE 20
typedef enum oid_proto
{
} oident;
YAZ_EXPORT int *oid_getoidbyent(struct oident *ent);
+YAZ_EXPORT int *oid_ent_to_oid(struct oident *ent, int *dst);
YAZ_EXPORT struct oident *oid_getentbyoid(int *o);
YAZ_EXPORT void oid_oidcpy(int *t, int *s);
YAZ_EXPORT void oid_oidcat(int *t, int *s);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: d1_espec.c,v $
- * Revision 1.10 1997-09-29 07:21:10 adam
+ * Revision 1.11 1997-09-29 13:18:59 adam
+ * Added function, oid_ent_to_oid, to replace the function
+ * oid_getoidbyent, which is not thread safe.
+ *
+ * Revision 1.10 1997/09/29 07:21:10 adam
* Added typecast to avoid warnings on MSVC.
*
* Revision 1.9 1997/09/17 12:10:35 adam
Z_Variant *r = odr_malloc(o, sizeof(*r));
oident var1;
int i;
+ int oid[OID_SIZE];
var1.proto = PROTO_Z3950;
var1.oclass = CLASS_VARSET;
var1.value = VAL_VAR1;
- r->globalVariantSetId = odr_oiddup(o, oid_getoidbyent(&var1));
+ r->globalVariantSetId = odr_oiddup(o, oid_ent_to_oid(&var1, oid));
if (argc)
r->triples = odr_malloc(o, sizeof(Z_Triple*) * argc);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: seshigh.c,v $
- * Revision 1.67 1997-09-17 12:10:40 adam
+ * Revision 1.68 1997-09-29 13:18:59 adam
+ * Added function, oid_ent_to_oid, to replace the function
+ * oid_getoidbyent, which is not thread safe.
+ *
+ * Revision 1.67 1997/09/17 12:10:40 adam
* YAZ version 1.4.
*
* Revision 1.66 1997/09/05 15:26:44 adam
*/
static Z_Records *diagrec(association *assoc, int error, char *addinfo)
{
+ int oid[OID_SIZE];
Z_Records *rec = odr_malloc (assoc->encode, sizeof(*rec));
oident bib1;
int *err = odr_malloc (assoc->encode, sizeof(*err));
#else
rec->u.nonSurrogateDiagnostic = dr;
#endif
- dr->diagnosticSetId = oid_getoidbyent(&bib1);
+ dr->diagnosticSetId = oid_ent_to_oid(&bib1, oid);
dr->condition = err;
dr->which = Z_DiagForm_v2AddInfo;
dr->addinfo = addinfo ? addinfo : "";
static Z_NamePlusRecord *surrogatediagrec(association *assoc, char *dbname,
int error, char *addinfo)
{
+ int oid[OID_SIZE];
Z_NamePlusRecord *rec = odr_malloc (assoc->encode, sizeof(*rec));
int *err = odr_malloc (assoc->encode, sizeof(*err));
oident bib1;
rec->u.surrogateDiagnostic = drec;
drec->which = Z_DiagRec_defaultFormat;
drec->u.defaultFormat = dr;
- dr->diagnosticSetId = oid_getoidbyent(&bib1);
+ dr->diagnosticSetId = oid_ent_to_oid(&bib1, oid);
dr->condition = err;
dr->which = Z_DiagForm_v2AddInfo;
dr->addinfo = addinfo ? addinfo : "";
*/
static Z_DiagRecs *diagrecs(association *assoc, int error, char *addinfo)
{
+ int oid[OID_SIZE];
Z_DiagRecs *recs = odr_malloc (assoc->encode, sizeof(*recs));
int *err = odr_malloc (assoc->encode, sizeof(*err));
oident bib1;
drec->which = Z_DiagRec_defaultFormat;
drec->u.defaultFormat = rec;
- rec->diagnosticSetId = oid_getoidbyent(&bib1);
+ rec->diagnosticSetId = oid_ent_to_oid(&bib1, oid);
rec->condition = err;
rec->which = Z_DiagForm_v2AddInfo;
rec->addinfo = addinfo ? addinfo : "";
int *num, Z_RecordComposition *comp,
int *next, int *pres, oid_value format)
{
+ int oid[OID_SIZE];
int recno, total_length = 0, toget = *num, dumped_records = 0;
Z_Records *records = odr_malloc (a->encode, sizeof(*records));
Z_NamePlusRecordList *reclist = odr_malloc (a->encode, sizeof(*reclist));
recform.oclass = CLASS_RECSYN;
recform.value = fres->format;
thisext->direct_reference = odr_oiddup(a->encode,
- oid_getoidbyent(&recform));
+ oid_ent_to_oid(&recform, oid));
thisext->indirect_reference = 0;
thisext->descriptor = 0;
if (fres->len < 0) /* Structured data */
/*
- * Copyright (c) 1995, Index Data
+ * Copyright (c) 1995-1997, Index Data
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: oid.c,v $
- * Revision 1.23 1997-09-09 10:10:19 adam
+ * Revision 1.24 1997-09-29 13:19:00 adam
+ * Added function, oid_ent_to_oid, to replace the function
+ * oid_getoidbyent, which is not thread safe.
+ *
+ * Revision 1.23 1997/09/09 10:10:19 adam
* Another MSV5.0 port. Changed projects to include proper
* library/include paths.
* Server starts server in test-mode when no options are given.
return 0;
}
+
/*
* To query, fill out proto, class, and value of the ent parameter.
*/
-int *oid_getoidbyent(struct oident *ent)
+int *oid_ent_to_oid(struct oident *ent, int *ret)
{
struct oident *p;
- static int ret[OID_SIZE];
for (p = oids; *p->oidsuffix >= 0; p++)
if (ent->proto == p->proto &&
}
return 0;
}
+/*
+ * To query, fill out proto, class, and value of the ent parameter.
+ */
+int *oid_getoidbyent(struct oident *ent)
+{
+ static int ret[OID_SIZE];
+
+ return oid_ent_to_oid (ent, ret);
+}
oid_value oid_getvalbyname(const char *name)
{
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: pquery.c,v $
- * Revision 1.15 1997-09-29 07:13:43 adam
+ * Revision 1.16 1997-09-29 13:19:00 adam
+ * Added function, oid_ent_to_oid, to replace the function
+ * oid_getoidbyent, which is not thread safe.
+ *
+ * Revision 1.15 1997/09/29 07:13:43 adam
* Changed type of a few variables to avoid warnings.
*
* Revision 1.14 1997/09/22 12:33:41 adam
else
{
oident attrid;
+ int oid[OID_SIZE];
attrid.proto = PROTO_Z3950;
attrid.oclass = CLASS_ATTSET;
attrid.value = attr_set[i];
zapt->attributeList[i]->attributeSet =
- odr_oiddup (o, oid_getoidbyent (&attrid));
+ odr_oiddup (o, oid_ent_to_oid (&attrid, oid));
}
zapt->attributeList[i]->which = Z_AttributeValue_numeric;
zapt->attributeList[i]->value.numeric = &attr_tmp[2*i+1];
oid_value attr_set[512];
oid_value topSet = VAL_NONE;
oident oset;
+ int oid[OID_SIZE];
zq = odr_malloc (o, sizeof(*zq));
lex (li);
oset.oclass = CLASS_ATTSET;
oset.value = topSet;
- zq->attributeSetId = odr_oiddup (o, oid_getoidbyent (&oset));
+ zq->attributeSetId = odr_oiddup (o, oid_ent_to_oid (&oset, oid));
if (!(zq->RPNStructure = rpn_structure (li, o, proto, 0, 512,
attr_array, attr_set)))
const char *cp;
oid_value topSet = VAL_NONE;
oident oset;
+ int oid[OID_SIZE];
lex (li);
if (li->query_look == 'r')
oset.oclass = CLASS_ATTSET;
oset.value = topSet;
- *attributeSetP = odr_oiddup (o, oid_getoidbyent (&oset));
+ *attributeSetP = odr_oiddup (o, oid_ent_to_oid (&oset, oid));
while (li->query_look == 'l')
{