* Sebastian Hammer, Adam Dickmeiss
*
* $Log: ir-tcl.c,v $
- * Revision 1.81 1996-02-26 18:38:32 adam
+ * Revision 1.82 1996-02-29 15:30:21 adam
+ * Export of IrTcl functionality to extensions.
+ *
+ * Revision 1.81 1996/02/26 18:38:32 adam
* Work on export of set methods.
*
* Revision 1.80 1996/02/23 17:31:39 adam
}
/*
- * get_set_int: Set/get integer value
+ * ir_tcl_get_set_int: Set/get integer value
*/
-static int get_set_int (int *val, Tcl_Interp *interp, int argc, char **argv)
+int ir_tcl_get_set_int (int *val, Tcl_Interp *interp, int argc, char **argv)
{
char buf[20];
/*
* ir_tcl_method: Search for method in table and invoke method handler
*/
-int ir_tcl_method (Tcl_Interp *interp, int argc, char **argv, IrTcl_Methods *tab)
+int ir_tcl_method (Tcl_Interp *interp, int argc, char **argv,
+ IrTcl_Methods *tab, int *ret)
{
IrTcl_Methods *tab_i = tab;
IrTcl_Method *t;
}
else
if (!strcmp (t->name, argv[1]))
- return (*t->method)(tab_i->obj, interp, argc, argv);
+ {
+ *ret = (*t->method)(tab_i->obj, interp, argc, argv);
+ return TCL_OK;
+ }
if (argc <= 0)
return TCL_OK;
for (t = tab_i->tab; t->name; t++)
Tcl_AppendResult (interp, " ", t->name, NULL);
#endif
+ *ret = TCL_ERROR;
return TCL_ERROR;
}
/*
- * ir_named_bits: get/set named bits
+ * ir_tcl_named_bits: get/set named bits
*/
-int ir_named_bits (struct ir_named_entry *tab, Odr_bitmask *ob,
- Tcl_Interp *interp, int argc, char **argv)
+int ir_tcl_named_bits (struct ir_named_entry *tab, Odr_bitmask *ob,
+ Tcl_Interp *interp, int argc, char **argv)
{
struct ir_named_entry *ti;
if (argc > 0)
ODR_MASK_SET (&p->options, 14);
return TCL_OK;
}
- return ir_named_bits (options_tab, &p->options, interp, argc-2, argv+2);
+ return ir_tcl_named_bits (options_tab, &p->options, interp, argc-2, argv+2);
}
/*
p->preferredMessageSize = 30000;
return TCL_OK;
}
- return get_set_int (&p->preferredMessageSize, interp, argc, argv);
+ return ir_tcl_get_set_int (&p->preferredMessageSize, interp, argc, argv);
}
/*
p->maximumRecordSize = 30000;
return TCL_OK;
}
- return get_set_int (&p->maximumRecordSize, interp, argc, argv);
+ return ir_tcl_get_set_int (&p->maximumRecordSize, interp, argc, argv);
}
/*
if (argc <= 0)
return TCL_OK;
- return get_set_int (&p->initResult, interp, argc, argv);
+ return ir_tcl_get_set_int (&p->initResult, interp, argc, argv);
}
p->replaceIndicator = 1;
return TCL_OK;
}
- return get_set_int (&p->replaceIndicator, interp, argc, argv);
+ return ir_tcl_get_set_int (&p->replaceIndicator, interp, argc, argv);
}
/*
p->smallSetUpperBound = 0;
return TCL_OK;
}
- return get_set_int (&p->smallSetUpperBound, interp, argc, argv);
+ return ir_tcl_get_set_int (&p->smallSetUpperBound, interp, argc, argv);
}
/*
p->largeSetLowerBound = 2;
return TCL_OK;
}
- return get_set_int (&p->largeSetLowerBound, interp, argc, argv);
+ return ir_tcl_get_set_int (&p->largeSetLowerBound, interp, argc, argv);
}
/*
p->mediumSetPresentNumber = 0;
return TCL_OK;
}
- return get_set_int (&p->mediumSetPresentNumber, interp, argc, argv);
+ return ir_tcl_get_set_int (&p->mediumSetPresentNumber, interp, argc, argv);
}
/*
{
IrTcl_Methods tab[3];
IrTcl_Obj *p = clientData;
+ int r;
if (argc < 2)
return TCL_ERROR;
tab[1].obj = &p->set_inher;
tab[2].tab = NULL;
- return ir_tcl_method (interp, argc, argv, tab);
+ ir_tcl_method (interp, argc, argv, tab, &r);
+ return r;
}
/*
tab[1].obj = &obj->set_inher;
tab[2].tab = NULL;
- ir_tcl_method (NULL, -1, NULL, tab);
+ ir_tcl_method (NULL, -1, NULL, tab, NULL);
ir_tcl_del_q (obj);
odr_destroy (obj->odr_in);
tab[1].obj = &obj->set_inher;
tab[2].tab = NULL;
- if (ir_tcl_method (interp, 0, NULL, tab) == TCL_ERROR)
+ if (ir_tcl_method (interp, 0, NULL, tab, NULL) == TCL_ERROR)
{
Tcl_AppendResult (interp, "Failed to initialize ", argv[1], NULL);
return TCL_ERROR;
obj->resultCount = 0;
return TCL_OK;
}
- return get_set_int (&obj->resultCount, interp, argc, argv);
+ return ir_tcl_get_set_int (&obj->resultCount, interp, argc, argv);
}
/*
if (argc <= 0)
return TCL_OK;
- return get_set_int (&obj->searchStatus, interp, argc, argv);
+ return ir_tcl_get_set_int (&obj->searchStatus, interp, argc, argv);
}
/*
if (argc <= 0)
return TCL_OK;
- return get_set_int (&obj->presentStatus, interp, argc, argv);
+ return ir_tcl_get_set_int (&obj->presentStatus, interp, argc, argv);
}
/*
obj->nextResultSetPosition = 0;
return TCL_OK;
}
- return get_set_int (&obj->nextResultSetPosition, interp, argc, argv);
+ return ir_tcl_get_set_int (&obj->nextResultSetPosition, interp,
+ argc, argv);
}
/*
obj->numberOfRecordsReturned = 0;
return TCL_OK;
}
- return get_set_int (&obj->numberOfRecordsReturned, interp, argc, argv);
+ return ir_tcl_get_set_int (&obj->numberOfRecordsReturned, interp,
+ argc, argv);
}
/*
{
IrTcl_Methods tabs[3];
IrTcl_SetObj *p = clientData;
+ int r;
if (argc < 2)
{
tabs[1].obj = &p->set_inher;
tabs[2].tab = NULL;
- return ir_tcl_method (interp, argc, argv, tabs);
+ ir_tcl_method (interp, argc, argv, tabs, &r);
+ return r;
}
/*
tabs[1].obj = &p->set_inher;
tabs[2].tab = NULL;
- ir_tcl_method (NULL, -1, NULL, tabs);
+ ir_tcl_method (NULL, -1, NULL, tabs, NULL);
free (p);
}
tabs[0].obj = obj;
tabs[1].tab = NULL;
- if (ir_tcl_method (interp, 0, NULL, tabs) == TCL_ERROR)
+ if (ir_tcl_method (interp, 0, NULL, tabs, NULL) == TCL_ERROR)
return TCL_ERROR;
*subData = obj;
p->stepSize = 0;
return TCL_OK;
}
- return get_set_int (&p->stepSize, interp, argc, argv);
+ return ir_tcl_get_set_int (&p->stepSize, interp, argc, argv);
}
/*
p->numberOfTermsRequested = 20;
return TCL_OK;
}
- return get_set_int (&p->numberOfTermsRequested, interp, argc, argv);
+ return ir_tcl_get_set_int (&p->numberOfTermsRequested, interp, argc, argv);
}
p->preferredPositionInResponse = 1;
return TCL_OK;
}
- return get_set_int (&p->preferredPositionInResponse, interp, argc, argv);
+ return ir_tcl_get_set_int (&p->preferredPositionInResponse, interp,
+ argc, argv);
}
/*
if (argc <= 0)
return TCL_OK;
- return get_set_int (&p->scanStatus, interp, argc, argv);
+ return ir_tcl_get_set_int (&p->scanStatus, interp, argc, argv);
}
/*
if (argc <= 0)
return TCL_OK;
- return get_set_int (&p->numberOfEntriesReturned, interp, argc, argv);
+ return ir_tcl_get_set_int (&p->numberOfEntriesReturned, interp,
+ argc, argv);
}
/*
if (argc <= 0)
return TCL_OK;
- return get_set_int (&p->positionOfTerm, interp, argc, argv);
+ return ir_tcl_get_set_int (&p->positionOfTerm, interp, argc, argv);
}
/*
int argc, char **argv)
{
IrTcl_Methods tabs[2];
+ int r;
if (argc < 2)
{
tabs[0].obj = clientData;
tabs[1].tab = NULL;
- return ir_tcl_method (interp, argc, argv, tabs);
+ ir_tcl_method (interp, argc, argv, tabs, &r);
+ return r;
}
/*
tabs[0].obj = obj;
tabs[1].tab = NULL;
- ir_tcl_method (NULL, -1, NULL, tabs);
+ ir_tcl_method (NULL, -1, NULL, tabs, NULL);
free (obj);
}
tabs[0].obj = obj;
tabs[1].tab = NULL;
- if (ir_tcl_method (interp, 0, NULL, tabs) == TCL_ERROR)
+ if (ir_tcl_method (interp, 0, NULL, tabs, NULL) == TCL_ERROR)
return TCL_ERROR;
Tcl_CreateCommand (interp, argv[1], ir_scan_obj_method,
(ClientData) obj, ir_scan_obj_delete);