/*
* IR toolkit for tcl/tk
- * (c) Index Data 1996-1997
+ * (c) Index Data 1996-1998
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: explain.c,v $
- * Revision 1.9 1997-11-24 11:34:38 adam
+ * Revision 1.10 1998-04-02 14:31:08 adam
+ * This version works with compiled ASN.1 code.
+ *
+ * Revision 1.9 1997/11/24 11:34:38 adam
* Using odr_nullval() instead of ODR_NULLVAL when appropriate.
*
* Revision 1.8 1997/09/09 10:19:51 adam
int (*handle)();
} IrExpChoice;
+#ifdef ASN_COMPILED
+#else
typedef char *Z_ElementSetName;
typedef Odr_oid *Z_AttributeSetId;
typedef char *Z_InternationalString;
typedef char *Z_LanguageCode;
-
+#endif
static int ir_UnitType (IrExpArg *iea,
Z_UnitType *p, const char *name, int argi);
Z_DatabaseInfo *p, const char *name, int argi)
{
static IrExpChoice arm_recordCount [] = {
- { "actualNumber", Z_Exp_RecordCount_actualNumber,
+ { "actualNumber", Z_DatabaseInfo_actualNumber,
ir_integer },
- { "approxNumber", Z_Exp_RecordCount_approxNumber,
+ { "approxNumber", Z_DatabaseInfo_approxNumber,
ir_integer },
{ NULL, 0, NULL }};
ir_HumanString (iea, p->disclaimers, "disclaimers", argi);
ir_HumanString (iea, p->news, "news", argi);
- ir_choice (iea, arm_recordCount, &p->recordCount_which,
- p->recordCount, argi);
+ ir_choice (iea, arm_recordCount, &p->which,
+ p->u.actualNumber, argi);
ir_HumanString (iea, p->defaultOrder, "defaultOrder", argi);
ir_integer (iea, p->avRecordSize, "avRecordSize", argi);
int *p, const char *name, int argi)
{
static IrExpChoice arm[] = {
- {"octetString", Z_PrimitiveElement_octetString, ir_choice_nop },
- {"numeric", Z_PrimitiveElement_numeric, ir_choice_nop },
+ {"octetString", Z_PrimitiveDataType_octetString, ir_choice_nop },
+ {"numeric", Z_PrimitiveDataType_numeric, ir_choice_nop },
{NULL, 0, NULL}};
if (!ir_match_start (name, p, iea, ++argi))
{
if (!ir_match_start (name, p, iea, ++argi))
return TCL_OK;
- ir_sequence (ir_ElementInfo, iea, p->list,
- &p->num, "list", argi);
+ ir_sequence (ir_ElementInfo, iea, p->elements,
+ &p->num, "elements", argi);
return ir_match_end (name, iea, argi);
}
{
if (!ir_match_start (name, p, iea, ++argi))
return TCL_OK;
- ir_sequence (ir_PathUnit, iea, p->list,
- &p->num, "list", argi);
+ ir_sequence (ir_PathUnit, iea, p->elements,
+ &p->num, "elements", argi);
return ir_match_end (name, iea, argi);
}
-static int ir_TagSetInfoElements (IrExpArg *iea,
- Z_TagSetInfoElements *p, const char *name, int argi)
+static int ir_TagSetElements (IrExpArg *iea,
+ Z_TagSetElements *p, const char *name, int argi)
{
if (!ir_match_start (name, p, iea, ++argi))
return TCL_OK;
- ir_InternationalString (iea, p->elementName, "elementname", argi);
+ ir_InternationalString (iea, p->elementname, "elementname", argi);
ir_sequence (ir_InternationalString, iea, p->nicknames,
&p->num_nicknames, "nicknames", argi);
ir_StringOrNumeric (iea, p->elementTag, "elementTag", argi);
ir_oid (iea, p->tagSet, "tagSet", argi);
ir_InternationalString (iea, p->name, "name", argi);
ir_HumanString (iea, p->description, "description", argi);
- ir_sequence (ir_TagSetInfoElements, iea, p->elements,
+ ir_sequence (ir_TagSetElements, iea, p->elements,
&p->num_elements, "elements", argi);
return ir_match_end (name, iea, argi);
}
Z_TermListElement *p, const char *name, int argi)
{
static IrExpChoice searchCostArm [] = {
- { "optimized", Z_TermListInfo_optimized, ir_choice_nop },
- { "normal", Z_TermListInfo_normal, ir_choice_nop },
- { "expensive", Z_TermListInfo_expensive, ir_choice_nop },
- { "filter", Z_TermListInfo_filter, ir_choice_nop },
+ { "optimized", Z_TermListElement_optimized, ir_choice_nop },
+ { "normal", Z_TermListElement_normal, ir_choice_nop },
+ { "expensive", Z_TermListElement_expensive, ir_choice_nop },
+ { "filter", Z_TermListElement_filter, ir_choice_nop },
{ NULL, 0, NULL }};
ir_InternationalString (iea, p->name, "name", argi);
ir_HumanString (iea, p->title, "title", argi);
if (!ir_match_start (name, p, iea, ++argi))
return TCL_OK;
ir_integer (iea, p->attributeType, "attributeType", argi);
- ir_OmittedAttributeInterpretation (iea, p->optionalType,
- "optionalType", argi);
+ ir_OmittedAttributeInterpretation (iea, p->defaultIfOmitted,
+ "defaultIfOmitted", argi);
ir_sequence (ir_AttributeValue, iea, p->attributeValues,
&p->num_attributeValues, "attributeValues", argi);
return ir_match_end (name, iea, argi);
return ir_match_end (name, iea, argi);
}
-static int ir_SortKeyDetailsSortType (IrExpArg *iea,
- Z_SortKeyDetailsSortType *p, const char *name, int argi)
-{
- static IrExpChoice sortArm [] = {
- { "character", Z_SortKeyDetailsSortType_character,
- ir_null },
- { "numeric", Z_SortKeyDetailsSortType_numeric,
- ir_null },
- { "structured", Z_SortKeyDetailsSortType_structured,
- ir_HumanString },
- { NULL, 0, NULL }};
- return ir_choice (iea, sortArm, &p->which, p->u.character, argi);
-}
-
static int ir_SortKeyDetails (IrExpArg *iea,
Z_SortKeyDetails *p, const char *name, int argi)
{
ir_choice_nop },
{ "never", Z_SortKeyDetails_never,
ir_choice_nop },
- { "defaultYes", Z_SortKeyDetails_defaultYes,
+ { "defaultYes", Z_SortKeyDetails_default_yes,
ir_choice_nop },
- { "defaultNo", Z_SortKeyDetails_defaultNo,
+ { "defaultNo", Z_SortKeyDetails_default_no,
ir_choice_nop },
{ NULL, 0, NULL }};
+ static IrExpChoice sortArm2 [] = {
+ { "character", Z_SortKeyDetails_character,
+ ir_null },
+ { "numeric", Z_SortKeyDetails_numeric,
+ ir_null },
+ { "structured", Z_SortKeyDetails_structured,
+ ir_HumanString },
+ { NULL, 0, NULL }};
+
if (!ir_match_start (name, p, iea, ++argi))
return TCL_OK;
ir_HumanString (iea, p->description, "description", argi);
&p->num_elementSpecifications, "elementSpecifications", argi);
ir_AttributeCombinations (iea, p->attributeSpecifications,
"attributeSpecifications", argi);
- ir_SortKeyDetailsSortType (iea, p->sortType, "sortType", argi);
-
+ ir_choice (iea, sortArm2, &p->which, p->u.character, argi);
+
if (p->caseSensitivity)
ir_choice (iea, sortArm, p->caseSensitivity, odr_nullval(), argi);
ir_choice_nop },
{ "retrieval", Z_ProcessingInformation_retrieval,
ir_choice_nop },
- { "recordPresentation", Z_ProcessingInformation_recordPresentation,
+ { "recordPresentation", Z_ProcessingInformation_record_presentation,
ir_choice_nop },
- { "recordHandling", Z_ProcessingInformation_recordHandling,
+ { "recordHandling", Z_ProcessingInformation_record_handling,
ir_choice_nop },
{ NULL, 0, NULL }};
if (!ir_match_start (name, p, iea, ++argi))
{
if (!ir_match_start (name, p, iea, ++argi))
return TCL_OK;
- ir_sequence (ir_ValueDescription, iea, p->enumerated,
- &p->num_enumerated, "enumerated", argi);
+ ir_sequence (ir_ValueDescription, iea, p->elements,
+ &p->num, "enumerated", argi);
return ir_match_end (name, iea, argi);
}
Z_IconObjectUnit *p, const char *name, int argi)
{
static IrExpChoice arm [] = {
- { "ianaType", Z_IconObject_ianaType, ir_choice_nop },
- { "z3950type", Z_IconObject_z3950type, ir_choice_nop },
- { "otherType", Z_IconObject_otherType, ir_choice_nop },
+ { "ianaType", Z_IconObjectUnit_ianaType, ir_InternationalString },
+ { "z3950type", Z_IconObjectUnit_z3950type, ir_InternationalString },
+ { "otherType", Z_IconObjectUnit_otherType, ir_InternationalString },
{ NULL, 0, NULL }};
if (!ir_match_start (name, p, iea, ++argi))
return TCL_OK;
ir_choice (iea, arm, &p->which, odr_nullval(), argi);
- ir_InternationalString (iea, p->bodyType, "bodyType", argi);
ir_octet (iea, p->content, "content", argi);
return ir_match_end (name, iea, argi);
}
{
if (!ir_match_start (name, p, iea, ++argi))
return TCL_OK;
- ir_sequence (ir_IconObjectUnit, iea, p->iconUnits,
- &p->num_iconUnits, "iconUnits", argi);
+ ir_sequence (ir_IconObjectUnit, iea, p->elements,
+ &p->num, "iconUnits", argi);
return ir_match_end (name, iea, argi);
}
ir_RpnCapabilities },
{ "iso8777", Z_QueryTypeDetails_iso8777,
ir_Iso8777Capabilities },
- { "z3958", Z_QueryTypeDetails_z3958,
+ { "z39_58", Z_QueryTypeDetails_z39_58,
ir_HumanString },
{ "erpn", Z_QueryTypeDetails_erpn,
ir_RpnCapabilities },
Z_AccessRestrictionsUnit *p, const char *name, int argi)
{
static IrExpChoice arm[] = {
- { "any", Z_AccessRestrictions_any,
+ { "any", Z_AccessRestrictionsUnit_any,
ir_choice_nop },
- { "search", Z_AccessRestrictions_search,
+ { "search", Z_AccessRestrictionsUnit_search,
ir_choice_nop },
- { "present", Z_AccessRestrictions_present,
+ { "present", Z_AccessRestrictionsUnit_present,
ir_choice_nop },
- { "specificElements", Z_AccessRestrictions_specific_elements,
+ { "specificElements", Z_AccessRestrictionsUnit_specific_elements,
ir_choice_nop },
- { "extendedServices", Z_AccessRestrictions_extended_services,
+ { "extendedServices", Z_AccessRestrictionsUnit_extended_services,
ir_choice_nop },
- { "byDatabase", Z_AccessRestrictions_by_database,
+ { "byDatabase", Z_AccessRestrictionsUnit_by_database,
ir_choice_nop },
{ NULL, 0, NULL }};
{
if (!ir_match_start (name, p, iea, ++argi))
return TCL_OK;
- ir_sequence (ir_AccessRestrictionsUnit, iea, p->restrictions,
- &p->num_restrictions, "restrictions", argi);
+ ir_sequence (ir_AccessRestrictionsUnit, iea, p->elements,
+ &p->num, "restrictions", argi);
return ir_match_end (name, iea, argi);
}
{
if (!ir_match_start (name, p, iea, ++argi))
return TCL_OK;
- ir_sequence (ir_AttributeOccurrence, iea, p->occurrences,
- &p->num_occurrences, "occurrences", argi);
+ ir_sequence (ir_AttributeOccurrence, iea, p->elements,
+ &p->num, "occurrences", argi);
return ir_match_end (name, iea, argi);
}
{
if (!ir_match_start (name, p, iea, ++argi))
return TCL_OK;
- ir_sequence (ir_StringOrNumeric, iea, p->attributes,
- &p->num_attributes, "attributes", argi);
+ ir_sequence (ir_StringOrNumeric, iea, p->elements,
+ &p->num, "attributes", argi);
return ir_match_end (name, iea, argi);
}
Z_AttributeOccurrence *p, const char *name, int argi)
{
static IrExpChoice arm [] = {
- { "anyOrNone", Z_AttributeOcc_anyOrNone, ir_null },
- { "specific", Z_AttributeOcc_specific, ir_AttributeValueList },
+ { "anyOrNone", Z_AttributeOccurrence_any_or_none, ir_null },
+ { "specific", Z_AttributeOccurrence_specific,
+ ir_AttributeValueList },
{ NULL, 0, NULL } };
if (!ir_match_start (name, p, iea, ++argi))
return TCL_OK;
ir_oid (iea, p->attributeSet, "attributeSet", argi);
ir_integer (iea, p->attributeType, "attributeType", argi);
ir_null (iea, p->mustBeSupplied, "mustBeSupplied", argi);
- ir_choice (iea, arm, &p->which, p->attributeValues.anyOrNone, argi);
+ ir_choice (iea, arm, &p->which, p->u.any_or_none, argi);
return ir_match_end (name, iea, argi);
}
Z_OtherInformationUnit *p, const char *name, int argi)
{
static IrExpChoice arm[] = {
- { "characterInfo", Z_OtherInfo_characterInfo,
- ir_InternationalString },
- { "binaryInfo", Z_OtherInfo_binaryInfo,
- ir_octet},
- { "externallyDefinedInfo", Z_OtherInfo_externallyDefinedInfo,
- ir_External},
- { "oid", Z_OtherInfo_oid,
- ir_oid},
+ { "characterInfo",
+ Z_OtherInformationUnit_characterInfo, ir_InternationalString },
+ { "binaryInfo",
+ Z_OtherInformationUnit_binaryInfo, ir_octet},
+ { "externallyDefinedInfo",
+ Z_OtherInformationUnit_externallyDefinedInfo,
+ ir_External},
+ { "oid",
+ Z_OtherInformationUnit_oid, ir_oid},
{ NULL, 0, NULL }};
if (!ir_match_start (name, p, iea, ++argi))
return TCL_OK;
ir_InfoCategory (iea, p->category, "category", argi);
- ir_choice (iea, arm, &p->which, p->information.characterInfo, argi);
+ ir_choice (iea, arm, &p->which, p->u.characterInfo, argi);
return ir_match_end (name, iea, argi);
}
{
if (!ir_match_start (name, p, iea, ++argi))
return TCL_OK;
- ir_sequence (ir_OtherInformationUnit, iea, p->list,
- &p->num_elements, "list", argi);
+ ir_sequence (ir_OtherInformationUnit, iea, p->elements,
+ &p->num, "list", argi);
return ir_match_end (name, iea, argi);
}
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: ir-tcl.c,v $
- * Revision 1.104 1998-02-27 14:26:07 adam
+ * Revision 1.105 1998-04-02 14:31:08 adam
+ * This version works with compiled ASN.1 code.
+ *
+ * Revision 1.104 1998/02/27 14:26:07 adam
* Changed client so that it still works if target sets numberOfRecords
* in response to an illegal value.
*
" position\"", NULL);
return TCL_ERROR;
}
+ printf ("argv[2]=%s\n", argv[2]);
if (Tcl_GetInt (interp, argv[2], &i) == TCL_ERROR)
return TCL_ERROR;
- if (!p->entries_flag || p->which != Z_ListEntries_entries || !p->entries
- || i >= p->num_entries || i < 0)
+ if (!p->entries_flag || !p->entries || i >= p->num_entries || i < 0)
return TCL_OK;
switch (p->entries[i].which)
{
Z_DiagRec **list, int num)
{
int i;
- char *addinfo;
+ char *addinfo = NULL;
*dst_num = num;
*dst_list = ir_tcl_malloc (sizeof(**dst_list) * num);
{
case Z_DiagRec_defaultFormat:
(*dst_list)[i].condition = *list[i]->u.defaultFormat->condition;
+#ifdef ASN_COMPILED
+ switch (list[i]->u.defaultFormat->which)
+ {
+ case Z_DefaultDiagFormat_v2Addinfo:
+ addinfo = list[i]->u.defaultFormat->u.v2Addinfo;
+ break;
+ case Z_DefaultDiagFormat_v3Addinfo:
+ addinfo = list[i]->u.defaultFormat->u.v3Addinfo;
+ break;
+ }
+#else
addinfo = list[i]->u.defaultFormat->addinfo;
+#endif
if (addinfo &&
((*dst_list)[i].addinfo = ir_tcl_malloc (strlen(addinfo)+1)))
strcpy ((*dst_list)[i].addinfo, addinfo);
}
else
{
+#ifdef ASN_COMPILED
+ Z_DiagRec dr, *dr_p = &dr;
+ dr.which = Z_DiagRec_defaultFormat;
+ dr.u.defaultFormat = zrs->u.nonSurrogateDiagnostic;
+#else
+ Z_DiagRec *dr_p = zrs->u.nonSurrogateDiagnostic;
+#endif
logf (LOG_DEBUG, "NonSurrogateDiagnostic");
+
setobj->numberOfRecordsReturned = 0;
ir_handleDiags (&setobj->nonSurrogateDiagnosticList,
&setobj->nonSurrogateDiagnosticNum,
- &zrs->u.nonSurrogateDiagnostic,
- 1);
+ &dr_p, 1);
}
}
xfree (scanobj->entries);
scanobj->entries = NULL;
-
+ scanobj->num_entries = 0;
+ scanobj->entries_flag = 0;
+
ir_deleteDiags (&scanobj->nonSurrogateDiagnosticList,
&scanobj->nonSurrogateDiagnosticNum);
if (scanrs->entries)
{
int i;
- Z_Entry *ze;
+ Z_Entry **ze;
scanobj->entries_flag = 1;
- scanobj->which = scanrs->entries->which;
- switch (scanobj->which)
- {
- case Z_ListEntries_entries:
+#ifdef ASN_COMPILED
+ if (scanrs->entries)
+ {
+ scanobj->num_entries = scanrs->entries->num_entries;
+ scanobj->entries = ir_tcl_malloc (scanobj->num_entries *
+ sizeof(*scanobj->entries));
+ ze = scanrs->entries->entries;
+ }
+#else
+ if (scanrs->entries->which == Z_ListEntries_entries)
+ {
scanobj->num_entries = scanrs->entries->u.entries->num_entries;
scanobj->entries = ir_tcl_malloc (scanobj->num_entries *
- sizeof(*scanobj->entries));
- for (i=0; i<scanobj->num_entries; i++)
- {
- ze = scanrs->entries->u.entries->entries[i];
- scanobj->entries[i].which = ze->which;
- switch (ze->which)
- {
- case Z_Entry_termInfo:
- if (ze->u.termInfo->term->which == Z_Term_general)
- {
- int l = ze->u.termInfo->term->u.general->len;
- scanobj->entries[i].u.term.buf = ir_tcl_malloc (1+l);
- memcpy (scanobj->entries[i].u.term.buf,
- ze->u.termInfo->term->u.general->buf,
- l);
- scanobj->entries[i].u.term.buf[l] = '\0';
- }
- else
- scanobj->entries[i].u.term.buf = NULL;
- if (ze->u.termInfo->globalOccurrences)
- scanobj->entries[i].u.term.globalOccurrences =
- *ze->u.termInfo->globalOccurrences;
- else
- scanobj->entries[i].u.term.globalOccurrences = 0;
- break;
- case Z_Entry_surrogateDiagnostic:
- ir_handleDiags (&scanobj->entries[i].u.diag.list,
- &scanobj->entries[i].u.diag.num,
- &ze->u.surrogateDiagnostic,
- 1);
- break;
- }
- }
- break;
- case Z_ListEntries_nonSurrogateDiagnostics:
+ sizeof(*scanobj->entries));
+ ze = scanrs->entries->u.entries->entries;
+ }
+#endif
+ for (i=0; i<scanobj->num_entries; i++, ze++)
+ {
+ scanobj->entries[i].which = (*ze)->which;
+ switch ((*ze)->which)
+ {
+ case Z_Entry_termInfo:
+ if ((*ze)->u.termInfo->term->which == Z_Term_general)
+ {
+ int l = (*ze)->u.termInfo->term->u.general->len;
+ scanobj->entries[i].u.term.buf = ir_tcl_malloc (1+l);
+ memcpy (scanobj->entries[i].u.term.buf,
+ (*ze)->u.termInfo->term->u.general->buf,
+ l);
+ scanobj->entries[i].u.term.buf[l] = '\0';
+ }
+ else
+ scanobj->entries[i].u.term.buf = NULL;
+ if ((*ze)->u.termInfo->globalOccurrences)
+ scanobj->entries[i].u.term.globalOccurrences =
+ *(*ze)->u.termInfo->globalOccurrences;
+ else
+ scanobj->entries[i].u.term.globalOccurrences = 0;
+ break;
+ case Z_Entry_surrogateDiagnostic:
+ ir_handleDiags (&scanobj->entries[i].u.diag.list,
+ &scanobj->entries[i].u.diag.num,
+ &(*ze)->u.surrogateDiagnostic,
+ 1);
+ break;
+ }
+ }
+#ifdef ASN_COMPILED
+ if (scanrs->entries->nonsurrogateDiagnostics)
+ ir_handleDiags (&scanobj->nonSurrogateDiagnosticList,
+ &scanobj->nonSurrogateDiagnosticNum,
+ scanrs->entries->nonsurrogateDiagnostics,
+ scanrs->entries->num_nonsurrogateDiagnostics);
+#else
+ if (scanrs->entries->which == Z_ListEntries_nonSurrogateDiagnostics)
ir_handleDiags (&scanobj->nonSurrogateDiagnosticList,
&scanobj->nonSurrogateDiagnosticNum,
scanrs->entries->u.nonSurrogateDiagnostics->
diagRecs,
scanrs->entries->u.nonSurrogateDiagnostics->
num_diagRecs);
- break;
- }
+#endif
}
- else
- scanobj->entries_flag = 0;
}
/*