* Sebastian Hammer, Adam Dickmeiss
*
* $Log: explain.c,v $
- * Revision 1.1 1996-08-16 15:07:43 adam
+ * Revision 1.2 1996-08-20 09:27:48 adam
+ * More work on explain.
+ * Renamed tkinit.c to tkmain.c. The tcl shell uses the Tcl 7.5 interface
+ * for socket i/o instead of the handcrafted one (for Tcl 7.3 and Tcl7.4).
+ *
+ * Revision 1.1 1996/08/16 15:07:43 adam
* First work on Explain.
*
*/
typedef char *Z_ElementSetName;
typedef Odr_oid *Z_AttributeSetId;
-typedef int Z_integer;
typedef char *Z_InternationalString;
typedef char *Z_LanguageCode;
Z_RetrievalRecordDetails *p, const char *name, int argi);
static int ir_ElementInfo (IrExpArg *iea,
Z_ElementInfo *p, const char *name, int argi);
-static int ir_integer (IrExpArg *iea,
- Z_integer *p, const char *name, int argi);
static int ir_InternationalString (IrExpArg *iea,
char *p, const char *name, int argi);
static int ir_TagSetInfo (IrExpArg *iea,
{
if (!p)
return 0;
- Tcl_AppendResult (iea->interp, name, " {", NULL);
+ if (argi < iea->argc)
+ {
+ if (strcmp (name, iea->argv[argi]))
+ return 0;
+ }
+ Tcl_AppendResult (iea->interp, "{", name, " ", NULL);
return 1;
}
static int ir_null (IrExpArg *iea,
Odr_null *p, const char *name, int argi)
{
- if (p)
- Tcl_AppendResult (iea->interp, name, " ", NULL);
- return TCL_OK;
+ if (!ir_match_start (name, p, iea, ++argi))
+ return TCL_OK;
+ Tcl_AppendResult (iea->interp, "{} ", NULL);
+ return ir_match_end (name, iea, argi);
}
static int ir_CString (IrExpArg *iea,
char *p, const char *name, int argi)
{
- Tcl_AppendResult (iea->interp, "{", name, " ", NULL);
- if (p)
- Tcl_AppendElement (iea->interp, p);
- Tcl_AppendResult (iea->interp, "} ", NULL);
- return TCL_OK;
+ if (!ir_match_start (name, p, iea, ++argi))
+ return TCL_OK;
+ Tcl_AppendElement (iea->interp, p);
+ return ir_match_end (name, iea, argi);
}
-
-
static int ir_ElementSetName (IrExpArg *iea,
char *p, const char *name, int argi)
{
static int ir_oid (IrExpArg *iea,
Odr_oid *p, const char *name, int argi)
{
- return TCL_OK;
+ int first = ' ';
+ if (!ir_match_start (name, p, iea, ++argi))
+ return TCL_OK;
+ while (*p != -1)
+ {
+ char buf[32];
+
+ sprintf (buf, "%c%d", first, *p);
+ Tcl_AppendResult (iea->interp, buf, NULL);
+ first = '.';
+ }
+ return ir_match_end (name, iea, argi);
}
static int ir_TagTypeMapping (IrExpArg *iea,
Z_TagTypeMapping **p, const char *name, int argi)
{
- return TCL_OK;
+ if (!ir_match_start (name, p, iea, ++argi))
+ return TCL_OK;
+ /* missing */
+ return ir_match_end (name, iea, argi);
}
static int ir_PrimitiveDataType (IrExpArg *iea,
int *p, const char *name, int argi)
{
- return TCL_OK;
+ if (!ir_match_start (name, p, iea, ++argi))
+ return TCL_OK;
+ /* missing */
+ return ir_match_end (name, iea, argi);
}
static int ir_octet (IrExpArg *iea,
Odr_oct *p, const char *name, int argi)
{
- return TCL_OK;
+ if (!ir_match_start (name, p, iea, ++argi))
+ return TCL_OK;
+ /* missing */
+ return ir_match_end (name, iea, argi);
}
static int ir_choice_nop (IrExpArg *iea,
return TCL_OK;
}
-static int ir_Term (IrExpArg *iea,
- Z_Term *p, const char *name, int argi)
-{
- return TCL_OK;
-}
-
static int ir_bool (IrExpArg *iea,
bool_t *p, const char *name, int argi)
{
- Tcl_AppendResult (iea->interp, "{", name, " ", NULL);
- if (p)
- Tcl_AppendResult (iea->interp, *p ? "1" : "0", NULL);
- Tcl_AppendResult (iea->interp, "} ", NULL);
- return TCL_OK;
+ if (!ir_match_start (name, p, iea, ++argi))
+ return TCL_OK;
+ Tcl_AppendResult (iea->interp, *p ? "1" : "0", NULL);
+ return ir_match_end (name, iea, argi);
}
static int ir_integer (IrExpArg *iea,
int *p, const char *name, int argi)
{
- Tcl_AppendResult (iea->interp, "{", name, NULL);
- if (p)
- {
- char buf[64];
- sprintf (buf, " %d", *p);
- Tcl_AppendResult (iea->interp, buf, NULL);
- }
- Tcl_AppendResult (iea->interp, "} ", NULL);
- return TCL_OK;
+ char buf[64];
+ if (!ir_match_start (name, p, iea, ++argi))
+ return TCL_OK;
+ sprintf (buf, " %d", *p);
+ Tcl_AppendResult (iea->interp, buf, NULL);
+ return ir_match_end (name, iea, argi);
}
static int ir_LanguageCode (IrExpArg *iea,
char *p, const char *name, int argi)
{
- if (p)
- Tcl_AppendResult (iea->interp, name, " ", p, " ", NULL);
- return TCL_OK;
+ return ir_CString (iea, p, name, argi);
}
static int ir_External (IrExpArg *iea,
Z_External *p, const char *name, int argi)
{
- return TCL_OK;
+ if (!ir_match_start (name, p, iea, ++argi))
+ return TCL_OK;
+ /* missing */
+ return ir_match_end (name, iea, argi);
}
static int ir_sequence (int (*fh)(), IrExpArg *iea, void *p, int num,
const char *name, int argi)
{
void **pp = (void **) p;
- if (num > 0 && ir_match_start (name, p, iea, argi))
- {
- int i;
- for (i = 0; i<num; i++)
- (*fh)(iea, pp[i], "", argi);
- return ir_match_end (name, iea, argi);
- }
- return TCL_OK;
+ int i;
+
+ if (!ir_match_start (name, p, iea, ++argi))
+ return TCL_OK;
+ for (i = 0; i<num; i++)
+ (*fh)(iea, pp[i], "", argi);
+ return ir_match_end (name, iea, argi);
}
+static int ir_Term (IrExpArg *iea,
+ Z_Term *p, const char *name, int argi)
+{
+ static IrExpChoice arm [] = {
+ { "general", Z_Term_general,
+ ir_octet },
+ { "numeric", Z_Term_numeric,
+ ir_integer },
+ { "characterString", Z_Term_characterString,
+ ir_InternationalString },
+ { "oid", Z_Term_oid,
+ ir_oid },
+ { "dateTime", Z_Term_dateTime,
+ ir_GeneralizedTime },
+ { "external", Z_Term_external,
+ ir_External },
+ { "null", Z_Term_null,
+ ir_null },
+ { NULL, 0, NULL }};
+
+ if (!ir_match_start (name, p, iea, ++argi))
+ return TCL_OK;
+
+ ir_choice (iea, arm, p->which, p->u.general, argi);
+ return ir_match_end (name, iea, argi);
+}
static int ir_TargetInfo (IrExpArg *iea,
Z_TargetInfo *p, const char *name, int argi)
return TCL_OK;
ir_CommonInfo (iea, p->commonInfo, "commonInfo", argi);
ir_InternationalString (iea, p->name, "name", argi);
- ir_HumanString (iea, p->recentNews, "recent-news", argi);
+ ir_HumanString (iea, p->recentNews, "recentNews", argi);
ir_IconObject (iea, p->icon, "icon", argi);
ir_bool (iea, p->namedResultSets, "namedResultSets", argi);
ir_bool (iea, p->multipleDBsearch, "multipleDBsearch", argi);
ir_HumanString (iea, p->description, "description", argi);
ir_sequence (ir_InternationalString, iea, p->nicknames,
p->num_nicknames, "nicknames", argi);
- ir_HumanString (iea, p->usageRest, "usage-rest", argi);
+ ir_HumanString (iea, p->usageRest, "usageRest", argi);
ir_HumanString (iea, p->paymentAddr, "paymentAddr", argi);
ir_HumanString (iea, p->hours, "hours", argi);
ir_sequence (ir_DatabaseList, iea, p->dbCombinations,
ir_sequence (ir_DatabaseName, iea, p->nicknames,
p->num_nicknames, "nicknames", argi);
ir_IconObject (iea, p->icon, "icon", argi);
- ir_bool (iea, p->userFee, "user-fee", argi);
+ ir_bool (iea, p->userFee, "userFee", argi);
ir_bool (iea, p->available, "available", argi);
ir_HumanString (iea, p->titleString, "titleString", argi);
ir_sequence (ir_HumanString, iea, p->keywords,
ir_choice_nop },
{ "present", Z_AccessRestrictions_present,
ir_choice_nop },
- { "specific-elements", Z_AccessRestrictions_specific_elements,
+ { "specificElements", Z_AccessRestrictions_specific_elements,
ir_choice_nop },
- { "extended-services", Z_AccessRestrictions_extended_services,
+ { "extendedServices", Z_AccessRestrictions_extended_services,
ir_choice_nop },
- { "by-database", Z_AccessRestrictions_by_database,
+ { "byDatabase", Z_AccessRestrictions_by_database,
ir_choice_nop },
{ NULL, 0, NULL }};
Z_AttributeOccurrence *p, const char *name, int argi)
{
static IrExpChoice arm [] = {
- { "any-or-none", Z_AttributeOcc_anyOrNone, ir_null },
+ { "anyOrNone", Z_AttributeOcc_anyOrNone, ir_null },
{ "specific", Z_AttributeOcc_specific, ir_AttributeValueList },
{ NULL, 0, NULL } };
if (!ir_match_start (name, p, iea, ++argi))
/*
* IR toolkit for tcl/tk
- * (c) Index Data 1995
+ * (c) Index Data 1995-1996
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: tclmain.c,v $
- * Revision 1.18 1996-02-23 17:31:42 adam
- * More functions made available to the wais tcl extension.
- *
- * Revision 1.17 1996/02/21 10:16:21 adam
- * Simplified select handling. Only one function ir_tcl_select_set has
- * to be externally defined.
- *
- * Revision 1.16 1996/02/05 17:58:05 adam
- * Ported ir-tcl to use the beta releases of tcl7.5/tk4.1.
- *
- * Revision 1.15 1996/01/10 09:18:45 adam
- * PDU specific callbacks implemented: initRespnse, searchResponse,
- * presentResponse and scanResponse.
- * Bug fix in the command line shell (tclmain.c) - discovered on OSF/1.
- *
- * Revision 1.14 1995/09/21 13:11:53 adam
- * Support of dynamic loading.
- * Test script uses load command if necessary.
- *
- * Revision 1.13 1995/08/28 12:21:22 adam
- * Removed lines and list as synonyms of list in MARC extractron.
- * Configure searches also for tk4.0 / tcl7.4.
- *
- * Revision 1.12 1995/08/28 11:07:16 adam
- * Minor changes.
- *
- * Revision 1.11 1995/08/03 13:23:02 adam
- * Request queue.
- *
- * Revision 1.10 1995/06/30 12:39:28 adam
- * Bug fix: loadFile didn't set record type.
- * The MARC routines are a little less strict in the interpretation.
- * Script display.tcl replaces the old marc.tcl.
- * New interactive script: shell.tcl.
- *
- * Revision 1.9 1995/06/26 10:20:20 adam
- * ir-tk works like wish.
- *
- * Revision 1.8 1995/06/21 15:16:44 adam
- * More work on configuration.
- *
- * Revision 1.7 1995/06/21 11:04:54 adam
- * Uses GNU autoconf 2.3.
- * Install procedure implemented.
- * boook bitmaps moved to sub directory bitmaps.
- *
- * Revision 1.6 1995/05/29 08:44:28 adam
- * Work on delete of objects.
- *
- * Revision 1.5 1995/03/20 08:53:30 adam
- * Event loop in tclmain.c rewritten. New method searchStatus.
- *
- * Revision 1.4 1995/03/17 07:50:31 adam
- * Headers have changed a little.
+ * Revision 1.19 1996-08-20 09:27:49 adam
+ * More work on explain.
+ * Renamed tkinit.c to tkmain.c. The tcl shell uses the Tcl 7.5 interface
+ * for socket i/o instead of the handcrafted one (for Tcl 7.3 and Tcl7.4).
*
*/
#ifdef _AIX
#include <sys/select.h>
#endif
+
#include <assert.h>
#include <tcl.h>
#include <log.h>
#include "ir-tcl.h"
+int Tcl_AppInit (Tcl_Interp *interp)
+{
+ if (Tcl_Init(interp) == TCL_ERROR)
+ return TCL_ERROR;
+ if (Irtcl_Init(interp) == TCL_ERROR)
+ return TCL_ERROR;
+#if USE_WAIS
+ if (Waistcl_Init(interp) == TCL_ERROR)
+ return TCL_ERROR;
+#endif
+ return TCL_OK;
+}
+
+#if TCL_MAJOR_VERSION > 7 || (TCL_MAJOR_VERSION == 7 && TCL_MINOR_VERSION > 4)
+extern int matherr ();
+int *tclDummyMathPtr = (int*) matherr;
+
+int main (int argc, char **argv)
+{
+ Tcl_Main (argc, argv, Tcl_AppInit);
+ return 0;
+}
+
+#else
static char *fileName = NULL;
+extern int main ();
+int *tclDummyMainPtr = (int*) main;
/* select(2) callbacks */
struct callback {
void tcl_mainloop (Tcl_Interp *interp, int interactive);
-int Tcl_AppInit (Tcl_Interp *interp)
-{
- if (Tcl_Init(interp) == TCL_ERROR)
- return TCL_ERROR;
- if (Irtcl_Init(interp) == TCL_ERROR)
- return TCL_ERROR;
-#if USE_WAIS
- if (Waistcl_Init(interp) == TCL_ERROR)
- return TCL_ERROR;
-#endif
- return TCL_OK;
-}
-
int main (int argc, char **argv)
{
Tcl_Interp *interp;
max_fd = fd;
}
+#endif