Index: TODO =================================================================== diff -u -re87eb2ded5035dc51ba89af4f68a0925db664024 -r5a7f6e086d300a9d0ad9178d7ea934b697708c07 --- TODO (.../TODO) (revision e87eb2ded5035dc51ba89af4f68a0925db664024) +++ TODO (.../TODO) (revision 5a7f6e086d300a9d0ad9178d7ea934b697708c07) @@ -4992,14 +4992,13 @@ - use in forwarders "-frame object" instead of "-objframe" in nx for consistency with other calls (e.g. dispatch). Other values for "-frame" are not allowed. (btw, XOTcl has "-objscope") +- deactivated "-onerror", since its semantics are expressible via + try/catch, and there are no regression tests for xotcl and nx, + and we could not find any script that uses this ======================================================================== TODO: -- Is -onerror for forwarders really needed?! Can we pull it out from - NX, at least? I can't see what -onerror should achieve that cannot - be done using catch. - - Revisit nsf::*::assertion interface? Why does nsf::method::assertion allow for setting invariants. One would rather expect a ::nsf::object|class::assertion or the like? Index: generic/nsf.c =================================================================== diff -u -ra35803ea84148ebadd79d8527830dcbdebd8873e -r5a7f6e086d300a9d0ad9178d7ea934b697708c07 --- generic/nsf.c (.../nsf.c) (revision a35803ea84148ebadd79d8527830dcbdebd8873e) +++ generic/nsf.c (.../nsf.c) (revision 5a7f6e086d300a9d0ad9178d7ea934b697708c07) @@ -128,7 +128,9 @@ int nr_args; Tcl_Obj *args; int objframe; +#if defined(NSF_FORWARD_WITH_ONERROR) Tcl_Obj *onerror; +#endif Tcl_Obj *prefix; int nr_subcommands; Tcl_Obj *subcommands; @@ -273,7 +275,7 @@ static void ForwardCmdDeleteProc(ClientData clientData); static int ForwardProcessOptions(Tcl_Interp *interp, Tcl_Obj *nameObj, Tcl_Obj *withDefault, int withEarlybinding, Tcl_Obj *withMethodprefix, - int withObjframe, Tcl_Obj *withOnerror, int withVerbose, + int withObjframe, int withVerbose, Tcl_Obj *target, int objc, Tcl_Obj * CONST objv[], ForwardCmdClientData **tcdPtr); @@ -12986,7 +12988,7 @@ result = ForwardProcessOptions(interp, methodObj, NULL /*withDefault*/, 0 /*withEarlybinding*/, NULL /*withMethodprefix*/, 0 /*withObjframe*/, - NULL /*withOnerror*/, 0 /*withVerbose*/, + 0 /*withVerbose*/, nobjv[0], nobjc-1, nobjv+1, &tcd); if (result != TCL_OK) { if (tcd) ForwardCmdDeleteProc(tcd); @@ -13874,7 +13876,9 @@ if (tcd->cmdName) {DECR_REF_COUNT(tcd->cmdName);} if (tcd->subcommands) {DECR_REF_COUNT(tcd->subcommands);} +#if defined(NSF_FORWARD_WITH_ONERROR) if (tcd->onerror) {DECR_REF_COUNT(tcd->onerror);} +#endif if (tcd->prefix) {DECR_REF_COUNT(tcd->prefix);} if (tcd->args) {DECR_REF_COUNT(tcd->args);} FREE(ForwardCmdClientData, tcd); @@ -14030,7 +14034,7 @@ static int ForwardProcessOptions(Tcl_Interp *interp, Tcl_Obj *nameObj, Tcl_Obj *withDefault, int withEarlybinding, Tcl_Obj *withMethodprefix, - int withObjframe, Tcl_Obj *withOnerror, int withVerbose, + int withObjframe, int withVerbose, Tcl_Obj *target, int objc, Tcl_Obj * CONST objv[], ForwardCmdClientData **tcdPtr) { ForwardCmdClientData *tcd; @@ -14056,10 +14060,12 @@ tcd->prefix = withMethodprefix; INCR_REF_COUNT(tcd->prefix); } +#if defined(NSF_FORWARD_WITH_ONERROR) if (withOnerror) { tcd->onerror = withOnerror; INCR_REF_COUNT(tcd->onerror); } +#endif tcd->objframe = withObjframe; tcd->verbose = withVerbose; tcd->needobjmap = 0; @@ -16717,6 +16723,8 @@ if (tcd->objframe) { Nsf_PopFrameObj(interp, framePtr); } + +#if defined(NSF_FORWARD_WITH_ONERROR) if (unlikely(result == TCL_ERROR && tcd->onerror)) { Tcl_Obj *ov[2]; ov[0] = tcd->onerror; @@ -16726,6 +16734,8 @@ Tcl_EvalObjv(interp, 2, ov, 0); DECR_REF_COUNT(ov[1]); } +#endif + return result; } @@ -20532,14 +20542,14 @@ NsfObject *object, int withPer_object, Tcl_Obj *methodObj, Tcl_Obj *withDefault, int withEarlybinding, Tcl_Obj *withMethodprefix, - int withObjframe, Tcl_Obj *withOnerror, int withVerbose, + int withObjframe, int withVerbose, Tcl_Obj *target, int nobjc, Tcl_Obj *CONST nobjv[]) { ForwardCmdClientData *tcd = NULL; int result; result = ForwardProcessOptions(interp, methodObj, withDefault, withEarlybinding, withMethodprefix, - withObjframe, withOnerror, withVerbose, + withObjframe, withVerbose, target, nobjc, nobjv, &tcd); if (result == TCL_OK) { Index: generic/nsfAPI.decls =================================================================== diff -u -rd66258cafa0a21e1b10fa42951de7e71f63a1817 -r5a7f6e086d300a9d0ad9178d7ea934b697708c07 --- generic/nsfAPI.decls (.../nsfAPI.decls) (revision d66258cafa0a21e1b10fa42951de7e71f63a1817) +++ generic/nsfAPI.decls (.../nsfAPI.decls) (revision 5a7f6e086d300a9d0ad9178d7ea934b697708c07) @@ -148,7 +148,6 @@ {-argName "-earlybinding" -nrargs 0} {-argName "-methodprefix" -type tclobj} {-argName "-objframe" -nrargs 0} - {-argName "-onerror" -type tclobj} {-argName "-verbose" -nrargs 0} {-argName "target" -type tclobj} {-argName "args" -type args} Index: generic/nsfAPI.h =================================================================== diff -u -rd66258cafa0a21e1b10fa42951de7e71f63a1817 -r5a7f6e086d300a9d0ad9178d7ea934b697708c07 --- generic/nsfAPI.h (.../nsfAPI.h) (revision d66258cafa0a21e1b10fa42951de7e71f63a1817) +++ generic/nsfAPI.h (.../nsfAPI.h) (revision 5a7f6e086d300a9d0ad9178d7ea934b697708c07) @@ -434,7 +434,7 @@ static int NsfMethodAssertionCmd(Tcl_Interp *interp, NsfObject *object, int subcmd, Tcl_Obj *arg); static int NsfMethodCreateCmd(Tcl_Interp *interp, NsfObject *object, int withCheckalways, int withInner_namespace, int withPer_object, NsfObject *withReg_object, Tcl_Obj *methodName, Tcl_Obj *arguments, Tcl_Obj *body, Tcl_Obj *withPrecondition, Tcl_Obj *withPostcondition); static int NsfMethodDeleteCmd(Tcl_Interp *interp, NsfObject *object, int withPer_object, Tcl_Obj *methodName); -static int NsfMethodForwardCmd(Tcl_Interp *interp, NsfObject *object, int withPer_object, Tcl_Obj *method, Tcl_Obj *withDefault, int withEarlybinding, Tcl_Obj *withMethodprefix, int withObjframe, Tcl_Obj *withOnerror, int withVerbose, Tcl_Obj *target, int nobjc, Tcl_Obj *CONST nobjv[]); +static int NsfMethodForwardCmd(Tcl_Interp *interp, NsfObject *object, int withPer_object, Tcl_Obj *method, Tcl_Obj *withDefault, int withEarlybinding, Tcl_Obj *withMethodprefix, int withObjframe, int withVerbose, Tcl_Obj *target, int nobjc, Tcl_Obj *CONST nobjv[]); static int NsfMethodPropertyCmd(Tcl_Interp *interp, NsfObject *object, int withPer_object, Tcl_Obj *methodName, int methodProperty, Tcl_Obj *value); static int NsfMethodRegisteredCmd(Tcl_Interp *interp, Tcl_Obj *handle); static int NsfMethodSetterCmd(Tcl_Interp *interp, NsfObject *object, int withPer_object, Tcl_Obj *parameter); @@ -1474,12 +1474,11 @@ int withEarlybinding = (int )PTR2INT(pc.clientData[4]); Tcl_Obj *withMethodprefix = (Tcl_Obj *)pc.clientData[5]; int withObjframe = (int )PTR2INT(pc.clientData[6]); - Tcl_Obj *withOnerror = (Tcl_Obj *)pc.clientData[7]; - int withVerbose = (int )PTR2INT(pc.clientData[8]); - Tcl_Obj *target = (Tcl_Obj *)pc.clientData[9]; + int withVerbose = (int )PTR2INT(pc.clientData[7]); + Tcl_Obj *target = (Tcl_Obj *)pc.clientData[8]; assert(pc.status == 0); - return NsfMethodForwardCmd(interp, object, withPer_object, method, withDefault, withEarlybinding, withMethodprefix, withObjframe, withOnerror, withVerbose, target, objc-pc.lastObjc, objv+pc.lastObjc); + return NsfMethodForwardCmd(interp, object, withPer_object, method, withDefault, withEarlybinding, withMethodprefix, withObjframe, withVerbose, target, objc-pc.lastObjc, objv+pc.lastObjc); } else { return TCL_ERROR; @@ -2907,15 +2906,14 @@ {"-per-object", 0, 0, Nsf_ConvertTo_Boolean, NULL,NULL,"switch",NULL,NULL,NULL,NULL,NULL}, {"methodName", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Tclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} }, -{"::nsf::method::forward", NsfMethodForwardCmdStub, 11, { +{"::nsf::method::forward", NsfMethodForwardCmdStub, 10, { {"object", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Object, NULL,NULL,"object",NULL,NULL,NULL,NULL,NULL}, {"-per-object", 0, 0, Nsf_ConvertTo_Boolean, NULL,NULL,"switch",NULL,NULL,NULL,NULL,NULL}, {"method", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Tclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, {"-default", 0, 1, Nsf_ConvertTo_Tclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, {"-earlybinding", 0, 0, Nsf_ConvertTo_String, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, {"-methodprefix", 0, 1, Nsf_ConvertTo_Tclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, {"-objframe", 0, 0, Nsf_ConvertTo_String, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-onerror", 0, 1, Nsf_ConvertTo_Tclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, {"-verbose", 0, 0, Nsf_ConvertTo_String, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, {"target", 0, 1, Nsf_ConvertTo_Tclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, {"args", 0, 1, ConvertToNothing, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} Index: tests/parameters.test =================================================================== diff -u -r8776580a91fa04fd52378dd37143f6c27769c8ab -r5a7f6e086d300a9d0ad9178d7ea934b697708c07 --- tests/parameters.test (.../parameters.test) (revision 8776580a91fa04fd52378dd37143f6c27769c8ab) +++ tests/parameters.test (.../parameters.test) (revision 5a7f6e086d300a9d0ad9178d7ea934b697708c07) @@ -620,7 +620,7 @@ "query instparams for scripted method 'method'" ? {nx::Object info method parameters ::nsf::method::forward} \ - "object:object -per-object:switch method -default -earlybinding:switch -methodprefix -objframe:switch -onerror -verbose:switch target:optional args" \ + "object:object -per-object:switch method -default -earlybinding:switch -methodprefix -objframe:switch -verbose:switch target:optional args" \ "query parameter for C-defined cmd 'nsf::forward'" nx::Object require method autoname