Index: TODO =================================================================== diff -u -r2d609d0c01e236da96542cefab42d8c8f6a3d1e9 -r183cd0a9a3d2a37133ac51bb86952e1b522dbf6f --- TODO (.../TODO) (revision 2d609d0c01e236da96542cefab42d8c8f6a3d1e9) +++ TODO (.../TODO) (revision 183cd0a9a3d2a37133ac51bb86952e1b522dbf6f) @@ -5543,19 +5543,19 @@ nx.tcl: - simplify the info ensembles on nx::Object or nx::Class significantly, - by making use if ensemble-next. + by making use if ensemble-next. - delete "info unknown", since this is not called. nsf.c: - make types for bit operations unsigned (mostly flags) build system: -- don't call genstubs from configure, since Debian does not seem +- don't call genstubs from configure, since Debian does not seem to have genstubs.tcl installed. Now, we pre-generate the stub files for tcl8.5 and tcl8.6 and copy the "right" version depending on the configured version. - -- Make dtplite configurable in Makefile, e.g. + +- Make dtplite configurable in Makefile, e.g. make "DTPLITE=/usr/local/ns/bin/tclsh8.5 /usr/local/ns/bin/dtplite" man - regenerate documentation @@ -5585,15 +5585,15 @@ - removed NsfParamDefs.slotObj (and single occurrence for memory-management) since it is not used for the time being -- fix potential bug on tcl-triggered cmd-delete operations, where - destroy returns non-TCL_OK and name of the object could not be +- fix potential bug on tcl-triggered cmd-delete operations, where + destroy returns non-TCL_OK and name of the object could not be retrieved anymore in error message. - move dereferencing of members after assertions -- improve robustness of destroy: in case an error happened in a +- improve robustness of destroy: in case an error happened in a destroy method in implicit delete operations, a crash was possible, since the state of the object to be delete was somewhat unclear - (it might or might not have been deleted). Now, the object + (it might or might not have been deleted). Now, the object is explicitly kept longer around to allow proper handling). - update licenses @@ -5670,11 +5670,11 @@ - added nsf::method::property /obj/ /method/ debug ?0|1? - when debug is activated, a debug line written to the log file when + when debug is activated, a debug line written to the log file when the function is called and exited - added nsf::method::property /obj/ /method/ deprecated ?0|1? - when deprecated is activated, a warning written to the log file when + when deprecated is activated, a warning written to the log file when the function is called - added flags to nsf::proc: -debug and -deprecated @@ -5683,39 +5683,62 @@ - bumped version number to 2.0.1 -- handling "-deprecated" and "-debug" properties for nsf::proc +- handling flags "-deprecated" and "-debug" properties for nsf::proc (in "nsf::cmd::info definition /proc/" and serializer) - extended regression test for introspecting nsf::cmd::info definition - + "-deprecated" and "-debug" + and flags "-deprecated" and "-debug" - nx: added new introspection options /cls/ info method debug /cls/ info method deprecated /obj/ info object method debug /obj/ info object method deprecated -- nx: added options "-debug" and "-deprecated" to methods "method" - and "obejct method", such one can use e.g. - C public method -deprecated bar {} {return 1} + +- nx: added flag "-debug" and "-deprecated" to methods + "method" + "object method" + "alias" + "object alias" + "forward" + "object forward" + such one can use e.g. + /cls/ public alias -deprecated|-debug /method/ ... + /cls/ public forward -deprecated|-debug /method/ ... + /cls/ public method -deprecated|-debug /method/ ... + /obj/ public object alias -deprecated|-debug /method/ ... + /obj/ public object forward -deprecated|-debug /method/ ... + /obj/ public object method -deprecated|-debug /method/ ... + +- added new cmd: + nsf::method::property /obj/ ?-per-object? /method/ exists + to check, whether a method is defined for an object. + +- output triggered via "-debug" is now generated via the + tcl functions "nsf::debug::call" and "nsf::debug::exit", + that can be redefined (similar to e.g. nsf::deprecated) + +- cleanup of nsfProfile.c commands + +- defined macros ObjectName_() and ClassName_() that behave + like the versions without "_", but do not check the passed + arg against NULL. This avoids warnings in newest versions + of gcc6 and cppcheck. + - extended regression test -======================================================================== -TODO: -- handling "deprecated" and "debug" properties in serializer (for methods and introspection) - * addressing scripted methods is not sufficient (e.g. "-debug" on c-implemented methods) - * handling for XOTcl methods - * probably, the most uniform way is to implement this via separate nsf::method::property - cmds, but also there it should be probably integrated with "info methods" as an additional - filter ... like e.g. - ... info methods .. -flags none|debug|deprecated ... - or - ... info methods .. -deprecated ... - ... info methods .. -debug ... - we need as well +serializer: +- added handling of "-debug" and "-deprecated" in serializer +- allow export of nsfprocs via "exportMethods declaration" + in order to keep otherwise excluded cmds in the result. + this allows us to keep nsf::debug::* or nsf::deprecated + definitions in the blueprint in OpenACS. +- hardened serializer (use e.g. "::namespace" instead + of "namespace" when there is a potential conflict with + a method named "namespace", prefer nsf::directdispatch, etc.) - ... info method deprecated ... - ... info method debug ... - which speaks rather for the 2nd approach for "info methods" +======================================================================== +TODO: - add regression tests for debug and deprecated in methods (behavior) - add regression tests for nsf::proc flags -debug and -deprecated (behavior) @@ -5727,11 +5750,45 @@ /obj/ info object method callprotection /obj/ info object method debug /obj/ info object method deprecated - nsf::proc flags -debug and -deprecated + /cls/ public alias -deprecated|-debug /method/ ... + /cls/ public forward -deprecated|-debug /method/ ... + /cls/ public method -deprecated|-debug /method/ ... + /obj/ public object alias -deprecated|-debug /method/ ... + /obj/ public object forward -deprecated|-debug /method/ ... + /obj/ public object method -deprecated|-debug /method/ ... + # in case, when similar cmds are commented, add: + # + nsf::proc -debug /name/ ... + nsf::proc -deprecated /name/ ... + nsf::method::property /obj/ ?-per-object? /method/ exists + nsf::method::property /obj/ ?-per-object? /method/ debug ?0|1? + nsf::method::property /obj/ ?-per-object? /method/ deprecated ?0|1? + + +- CHECK: + [nx::Class info methods -path "info lookup *"] returns "{info lookup parameters} {info lookup mixins} ..." + however, + nx::Class info method type {info lookup parameters} + returns "", while e.g. + nx::Class info method type {info method handle} + returns "scripted". The problem is not the case that the method is + an ensemble method, but probably the case that it is defined as an alias + pointing to nx:Object::...:info (same with "info has") + nx::Class alias "info lookup" ::nx::Object::slot::__info::lookup + nx::Class alias "info has" ::nx::Object::slot::__info::has + However, when this two lines are commented out, everything looks fine, + the regression test and OpenACS work without problems. + + -> check, whether the definitions can be eliminated, or whether the regression + test has to be extended. The result of + nx::Class info lookup methods -path + looks fine to me. + + + - gcc6: * ISOBJ(methodObj); will raise a warning, when methodObj is declared as nonnull - * Same with ObjectName() and ClassName() * gcc6 seems to have a bug: when e.g. a variable "foo" is declared as nonnull, then the construct @@ -6114,11 +6171,11 @@ -observation: +observation: - [current isnextcall] does not work for ensemble next: - ... but should probably not, since this is an implicit + ... but should probably not, since this is an implicit next call just for resolving an ensemble call. - + Object create o { :public object method foo {} {return [current isnextcall]} :public object method "x y" {} {return [current isnextcall]} Index: generic/nsf.c =================================================================== diff -u -r63fb7c118c69ff1a2753b65d222f59151b6a6906 -r183cd0a9a3d2a37133ac51bb86952e1b522dbf6f --- generic/nsf.c (.../nsf.c) (revision 63fb7c118c69ff1a2753b65d222f59151b6a6906) +++ generic/nsf.c (.../nsf.c) (revision 183cd0a9a3d2a37133ac51bb86952e1b522dbf6f) @@ -509,16 +509,36 @@ * *---------------------------------------------------------------------- */ -static int NsfDStringEval(Tcl_Interp *interp, Tcl_DString *dsPtr, const char *context) nonnull(1) nonnull(2) nonnull(3); +int +NsfDStringEval(Tcl_Interp *interp, Tcl_DString *dsPtr, const char *context, int safe, int noProfile) { + int result, prevProfileSetting; + Tcl_Obj *savedResultObj; -static int -NsfDStringEval(Tcl_Interp *interp, Tcl_DString *dsPtr, const char *context) { - int result = Tcl_EvalEx(interp, Tcl_DStringValue(dsPtr), Tcl_DStringLength(dsPtr), 0); - nonnull_assert(interp != NULL); nonnull_assert(dsPtr != NULL); nonnull_assert(context != NULL); + if (noProfile) { + prevProfileSetting = RUNTIME_STATE(interp)->doProfile; + RUNTIME_STATE(interp)->doProfile = 0; + } + + if (safe) { + savedResultObj = Tcl_GetObjResult(interp); + INCR_REF_COUNT(savedResultObj); + } + result = Tcl_EvalEx(interp, Tcl_DStringValue(dsPtr), Tcl_DStringLength(dsPtr), 0); + + if (safe) { + if (result == TCL_OK) { + Tcl_SetObjResult(interp, savedResultObj); + } + DECR_REF_COUNT(savedResultObj); + } + if (noProfile) { + RUNTIME_STATE(interp)->doProfile = prevProfileSetting; + } + if (unlikely(result == TCL_ERROR)) { NsfErrorContext(interp, context); } @@ -568,7 +588,7 @@ Tcl_DStringAppendElement(&cmdString, "::nsf::log"); Tcl_DStringAppendElement(&cmdString, level); Tcl_DStringAppendElement(&cmdString, Tcl_DStringValue(&ds)); - NsfDStringEval(interp, &cmdString, "log command"); + NsfDStringEval(interp, &cmdString, "log command", 0, 0); Tcl_DStringFree(&cmdString); Tcl_DStringFree(&ds); } @@ -596,9 +616,7 @@ */ void NsfDeprecatedCmd(Tcl_Interp *interp, const char *what, const char *oldCmd, const char *newCmd) { - NsfRuntimeState *rst = RUNTIME_STATE(interp); Tcl_DString ds, *dsPtr = &ds; - int prevProfileSetting; nonnull_assert(interp != NULL); nonnull_assert(newCmd != NULL); @@ -611,10 +629,7 @@ Tcl_DStringAppendElement(dsPtr, oldCmd); Tcl_DStringAppendElement(dsPtr, newCmd); - prevProfileSetting = rst->doProfile; - rst->doProfile = 0; - NsfDStringEval(interp, dsPtr, "log command"); - rst->doProfile = prevProfileSetting; + NsfDStringEval(interp, dsPtr, "log command", 0, 1); Tcl_DStringFree(dsPtr); } @@ -1284,7 +1299,7 @@ int rc = NSDeleteCmd(interp, object->nsPtr, methodName); if (rc < 0) { return NsfPrintError(interp, "%s: cannot delete object specific method '%s'", - ObjectName(object), methodName); + ObjectName_(object), methodName); } } return TCL_OK; @@ -1317,7 +1332,7 @@ rc = NSDeleteCmd(interp, cl->nsPtr, methodName); if (rc < 0) { - return NsfPrintError(interp, "%s: cannot delete method '%s'", ClassName(cl), methodName); + return NsfPrintError(interp, "%s: cannot delete method '%s'", ClassName_(cl), methodName); } return TCL_OK; } @@ -2381,10 +2396,11 @@ for (; classMixins; classMixins = classMixins->nextPtr) { NsfClass *sc = NsfGetClassFromCmdPtr(classMixins->cmdPtr); - if (unlikely(sc->color == WHITE && !TopoSort(sc, baseClass, direction, withMixinOfs))) { + if (likely(sc != NULL) + && unlikely(sc->color == WHITE && !TopoSort(sc, baseClass, direction, withMixinOfs))) { NsfLog(sc->object.teardown, NSF_LOG_WARN, "cycle in the mixin graph list detected for class %s", - ClassName(sc)); + ClassName_(sc)); } } } @@ -3841,9 +3857,12 @@ if ((object->flags & NSF_MIXIN_ORDER_DEFINED_AND_VALID) != 0u) { NsfCmdList *mixinList; + for (mixinList = object->mixinOrder; mixinList; mixinList = mixinList->nextPtr) { NsfClass *mixin = NsfGetClassFromCmdPtr(mixinList->cmdPtr); - if (mixin && (*pcl = (*lookupFunction)(interp, mixin, methodObj, &cmd))) { + + if ((mixin != NULL) + && (*pcl = (*lookupFunction)(interp, mixin, methodObj, &cmd))) { if ((Tcl_Command_flags(cmd) & NSF_CMD_CLASS_ONLY_METHOD) != 0 && !NsfObjectIsClass(object)) { cmd = NULL; continue; @@ -5524,7 +5543,7 @@ if (object->teardown != NULL) { NsfLog(interp, NSF_LOG_NOTICE, "Destroy failed for object %s %p %.6x, perform low level deletion", - (object->flags & NSF_DURING_DELETE) == NSF_DURING_DELETE ? "deleted-object" : ObjectName(object), + (object->flags & NSF_DURING_DELETE) == NSF_DURING_DELETE ? "deleted-object" : ObjectName_(object), (void*)object, object->flags); CallStackDestroyObject(interp, object); } @@ -7525,14 +7544,15 @@ static int AssertionSetCheckOptions(Tcl_Interp *interp, NsfObject *object, Tcl_Obj *arg) { - NsfObjectOpt *opt = NsfRequireObjectOpt(object); + NsfObjectOpt *opt; int ocArgs; Tcl_Obj **ovArgs; nonnull_assert(interp != NULL); nonnull_assert(object != NULL); nonnull_assert(arg != NULL); + opt = NsfRequireObjectOpt(object); opt->checkoptions = CHECK_NONE; if (Tcl_ListObjGetElements(interp, arg, &ocArgs, &ovArgs) == TCL_OK @@ -7571,7 +7591,7 @@ if (opt->checkoptions == CHECK_NONE && ocArgs > 0) { return NsfPrintError(interp, "unknown check option in command '%s' check %s, ", "valid: all pre post object-invar class-invar", - ObjectName(object), ObjStr(arg)); + ObjectName_(object), ObjStr(arg)); } return TCL_OK; } @@ -8949,7 +8969,9 @@ for (ml = object->mixinOrder; ml; ml = ml->nextPtr) { NsfClass *mixin = NsfGetClassFromCmdPtr(ml->cmdPtr); - if (pattern && !Tcl_StringMatch(ClassName(mixin), pattern)) { + if ((pattern != NULL) + && (mixin != NULL) + && !Tcl_StringMatch(ClassName(mixin), pattern)) { continue; } npl = NsfClassListAdd(npl, mixin, NULL); @@ -9276,7 +9298,7 @@ for (; likely(mixinList != NULL); mixinList = mixinList->nextPtr) { NsfClass *foundCl = NsfGetClassFromCmdPtr(mixinList->cmdPtr); - if (foundCl && SearchCMethod(foundCl, name, &cmd)) { + if ((foundCl != NULL) && SearchCMethod(foundCl, name, &cmd)) { *clPtr = foundCl; return cmd; } @@ -10591,7 +10613,7 @@ for (i = 0; i < oc; i++) { if (osPtr != GetObjectSystem(&scl[i]->object)) { NsfPrintError(interp, "class \"%s\" has a different object system as class \"%s\"", - ClassName(cl), ClassName(scl[i])); + ClassName_(cl), ClassName(scl[i])); NsfClassListFree(subClasses); FREE(NsfClass**, scl); return TCL_ERROR; @@ -13346,27 +13368,31 @@ NSF_INLINE static int ObjectDispatch(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], unsigned int flags) - nonnull(2) nonnull(4); + nonnull(1) nonnull(2) nonnull(4); NSF_INLINE static int ObjectDispatch(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], unsigned int flags) { - register NsfObject *object = (NsfObject *)clientData; - int result = TCL_OK, objflags, shift, - frameType = NSF_CSC_TYPE_PLAIN; - const char *methodName; - NsfObject *calledObject; - NsfClass *cl = NULL; - Tcl_Command cmd = NULL; - Tcl_Obj *cmdName = object->cmdName, *methodObj; + register NsfObject *object; + int result = TCL_OK, objflags, shift, frameType = NSF_CSC_TYPE_PLAIN; + const char *methodName; + NsfObject *calledObject; + NsfClass *cl = NULL; + Tcl_Command cmd = NULL; + Tcl_Obj *cmdName, *methodObj; NsfCallStackContent csc, *cscPtr = NULL; - int isValidCsc = 1; - NsfRuntimeState *rst = RUNTIME_STATE(interp); + int isValidCsc = 1; + NsfRuntimeState *rst; + nonnull_assert(clientData != NULL); nonnull_assert(interp != NULL); nonnull_assert(objv != NULL); + object = (NsfObject *)clientData; + cmdName = object->cmdName; + rst = RUNTIME_STATE(interp); + /* none of the higher copy-flags must be passed */ assert((flags & (NSF_CSC_COPY_FLAGS & 0x000FFF000U)) == 0u); @@ -13381,7 +13407,7 @@ methodName = ObjStr(methodObj); if (unlikely(FOR_COLON_RESOLVER(methodName))) { return NsfPrintError(interp, "%s: method name '%s' must not start with a colon", - ObjectName(object), methodName); + ObjectName_(object), methodName); } } assert(object->teardown != NULL); @@ -19832,7 +19858,7 @@ if (unlikely(otherPtr == NULL)) { return NsfPrintError(interp, "can't import variable %s into method scope: " "can't find variable on %s", - ObjStr(varName), ObjectName(object)); + ObjStr(varName), ObjectName_(object)); } /* @@ -19847,7 +19873,7 @@ if (arrayPtr != NULL) { return NsfPrintError(interp, "can't make instance variable %s on %s: " "Variable cannot be an element in an array; use e.g. an alias.", - ObjStr(varName), ObjectName(object)); + ObjStr(varName), ObjectName_(object)); } newName = varName; @@ -25460,7 +25486,7 @@ {-argName "object" -required 1 -type object} {-argName "-per-object"} {-argName "methodName" -required 1 -type tclobj} - {-argName "methodproperty" -required 1 -type "class-only|call-private|call-protected|deprecated|redefine-protected|returns|slotobj"} + {-argName "methodProperty" -required 1 -type "class-only|call-private|call-protected|debug|deprecated|exists|redefine-protected|returns"} {-argName "value" -type tclobj} } */ @@ -25485,12 +25511,20 @@ if (unlikely(cmd == NULL)) { - return NsfPrintError(interp, "cannot lookup %s method '%s' for %s", - cl == NULL ? "object " : "", - methodName, ObjectName(object)); + if (methodproperty == MethodpropertyExistsIdx) { + Tcl_SetObjResult(interp, Tcl_NewIntObj(0)); + return TCL_OK; + } else { + return NsfPrintError(interp, "cannot lookup %s method '%s' for %s", + cl == NULL ? "object " : "", + methodName, ObjectName(object)); + } } switch (methodproperty) { + case MethodpropertyExistsIdx: + Tcl_SetObjResult(interp, Tcl_NewIntObj(1)); + break; case MethodpropertyClass_onlyIdx: /* fall through */ case MethodpropertyCall_privateIdx: /* fall through */ case MethodpropertyCall_protectedIdx: /* fall through */ @@ -28454,7 +28488,7 @@ if (unlikely(Tcl_Interp_varFramePtr(interp) == NULL)) { CallStackRestoreSavedFrames(interp, &ctx); return NsfPrintError(interp, "instvar used on %s, but call-stack is not in procedure scope", - ObjectName(object)); + ObjectName_(object)); } result = NsfVarImport(interp, object, ObjStr(objv[0]), objc-1, objv+1); @@ -28482,10 +28516,13 @@ opt = object->opt; if (opt != NULL && opt->objMixins) { Tcl_Command mixinCmd = Tcl_GetCommandFromObj(interp, mixin); + if (mixinCmd != NULL) { NsfClass *mixinCl = NsfGetClassFromCmdPtr(mixinCmd); + if (mixinCl != NULL) { NsfCmdList *h = CmdListFindCmdInList(mixinCmd, opt->objMixins); + if (h != NULL) { if (h->clientData != NULL) { GuardDel((NsfCmdList *) h); @@ -30784,7 +30821,7 @@ if (unlikely(object->refCount != 1)) { if (object->refCount > 1) { NsfLog(interp, NSF_LOG_WARN, "RefCount for obj %p %d (name %s) > 1", - (void *)object, object->refCount, ObjectName(object)); + (void *)object, object->refCount, ObjectName_(object)); } else { NsfLog(interp, NSF_LOG_WARN, "Refcount for obj %p %d > 1", (void *)object, object->refCount); Index: generic/nsf.h =================================================================== diff -u -r8854eeff1e1b2d5fde52ee4f71b1e2b7844b2dea -r183cd0a9a3d2a37133ac51bb86952e1b522dbf6f --- generic/nsf.h (.../nsf.h) (revision 8854eeff1e1b2d5fde52ee4f71b1e2b7844b2dea) +++ generic/nsf.h (.../nsf.h) (revision 183cd0a9a3d2a37133ac51bb86952e1b522dbf6f) @@ -143,6 +143,7 @@ #define NSF_LINEARIZER_TRACE 1 #define NSF_STACKCHECK 1 #define NSF_CLASSLIST_PRINT 1 +#define NSF_PRINT_OBJV 1 */ #define PER_OBJECT_PARAMETER_CACHING 1 Index: generic/nsf.tcl =================================================================== diff -u -r8854eeff1e1b2d5fde52ee4f71b1e2b7844b2dea -r183cd0a9a3d2a37133ac51bb86952e1b522dbf6f --- generic/nsf.tcl (.../nsf.tcl) (revision 8854eeff1e1b2d5fde52ee4f71b1e2b7844b2dea) +++ generic/nsf.tcl (.../nsf.tcl) (revision 183cd0a9a3d2a37133ac51bb86952e1b522dbf6f) @@ -1,5 +1,5 @@ # -*- Tcl -*- -# +# # Define a basic set of predefined Tcl commands and definitions for # the Next Scripting Framework. This file will be transformed by # mk_predefined.tcl into "predefined.h", which in included in nsf.c. @@ -13,10 +13,10 @@ # get frequenly used primitiva into the ::nsf namespace # # Symbols reused in the next scripting language - + namespace export \ next current self configure finalize interp is my relation dispatch - + namespace eval ::nsf::method::create {namespace export alias} # @@ -68,7 +68,7 @@ } # - # ::nsf::mixin + # ::nsf::mixin # # Provide a similar interface as for ::nsf::method::create, ::nsf::method::alias, # etc.. Semantically, ::nsf::mixin behaves like a "mixin add", but @@ -136,7 +136,7 @@ } # initialize exit handler ::nsf::exithandler unset - + # # logger # @@ -157,6 +157,17 @@ } # + # debug::call and debug::exit command + # + namespace eval ::nsf::debug {} + proc ::nsf::debug::call {level objectInfo methodInfo arglist} { + nsf::log Warning "DB call($level) - $objectInfo $methodInfo $arglist" + } + proc ::nsf::debug::exit {level objectInfo methodInfo usec} { + nsf::log Warning "DB exit($level) - $objectInfo $methodInfo $usec usec" + } + + # # deprecated command # proc ::nsf::deprecated {what oldCmd newCmd} { @@ -168,7 +179,7 @@ # # determine platform aware temp directory - # + # proc tmpdir {} { foreach e [list TMPDIR TEMP TMP] { if {[info exists ::env($e)] \ @@ -186,7 +197,7 @@ } return /tmp } - namespace export tmpdir + namespace export tmpdir # if HOME is not set, and ~ is resolved, Tcl chokes on that if {![info exists ::env(HOME)]} {set ::env(HOME) /root} @@ -210,3 +221,10 @@ set ::nsf::parameter::syntax(::nsf::exithandler) "?get?|?set /cmds/?|?unset?" } + +# +# Local variables: +# mode: tcl +# tcl-indent-level: 2 +# indent-tabs-mode: nil +# End: Index: generic/nsfAPI.decls =================================================================== diff -u -r8854eeff1e1b2d5fde52ee4f71b1e2b7844b2dea -r183cd0a9a3d2a37133ac51bb86952e1b522dbf6f --- generic/nsfAPI.decls (.../nsfAPI.decls) (revision 8854eeff1e1b2d5fde52ee4f71b1e2b7844b2dea) +++ generic/nsfAPI.decls (.../nsfAPI.decls) (revision 183cd0a9a3d2a37133ac51bb86952e1b522dbf6f) @@ -214,7 +214,7 @@ {-argName "object" -required 1 -type object} {-argName "-per-object" -required 0 -nrargs 0 -type switch} {-argName "methodName" -required 1 -type tclobj} - {-argName "methodProperty" -required 1 -type "class-only|call-private|call-protected|debug|deprecated|redefine-protected|returns"} + {-argName "methodProperty" -required 1 -type "class-only|call-private|call-protected|debug|deprecated|exists|redefine-protected|returns"} {-argName "value" -type tclobj} } {-nxdoc 1} Index: generic/nsfAPI.h =================================================================== diff -u -r8854eeff1e1b2d5fde52ee4f71b1e2b7844b2dea -r183cd0a9a3d2a37133ac51bb86952e1b522dbf6f --- generic/nsfAPI.h (.../nsfAPI.h) (revision 8854eeff1e1b2d5fde52ee4f71b1e2b7844b2dea) +++ generic/nsfAPI.h (.../nsfAPI.h) (revision 183cd0a9a3d2a37133ac51bb86952e1b522dbf6f) @@ -207,12 +207,12 @@ return result; } -enum MethodpropertyIdx {MethodpropertyNULL, MethodpropertyClass_onlyIdx, MethodpropertyCall_privateIdx, MethodpropertyCall_protectedIdx, MethodpropertyDebugIdx, MethodpropertyDeprecatedIdx, MethodpropertyRedefine_protectedIdx, MethodpropertyReturnsIdx}; +enum MethodpropertyIdx {MethodpropertyNULL, MethodpropertyClass_onlyIdx, MethodpropertyCall_privateIdx, MethodpropertyCall_protectedIdx, MethodpropertyDebugIdx, MethodpropertyDeprecatedIdx, MethodpropertyExistsIdx, MethodpropertyRedefine_protectedIdx, MethodpropertyReturnsIdx}; static int ConvertToMethodproperty(Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr) { int index, result; - static const char *opts[] = {"class-only", "call-private", "call-protected", "debug", "deprecated", "redefine-protected", "returns", NULL}; + static const char *opts[] = {"class-only", "call-private", "call-protected", "debug", "deprecated", "exists", "redefine-protected", "returns", NULL}; (void)pPtr; result = Tcl_GetIndexFromObj(interp, objPtr, opts, "methodProperty", 0, &index); *clientData = (ClientData) INT2PTR(index + 1); @@ -281,7 +281,7 @@ {ConvertToMethodtype, "all|scripted|builtin|alias|forwarder|object|setter|nsfproc"}, {ConvertToFrame, "method|object|default"}, {ConvertToCurrentoption, "proc|method|methodpath|object|class|activelevel|args|activemixin|calledproc|calledmethod|calledclass|callingproc|callingmethod|callingclass|callinglevel|callingobject|filterreg|isnextcall|nextmethod"}, - {ConvertToMethodproperty, "class-only|call-private|call-protected|debug|deprecated|redefine-protected|returns"}, + {ConvertToMethodproperty, "class-only|call-private|call-protected|debug|deprecated|exists|redefine-protected|returns"}, {ConvertToRelationtype, "object-mixin|class-mixin|object-filter|class-filter|class|superclass|rootclass"}, {ConvertToSource, "all|application|system"}, {ConvertToForwardproperty, "prefix|target|verbose"}, Index: generic/nsfCmdPtr.c =================================================================== diff -u -r16a02881bff0a0d626d0045dfd96660338d0c314 -r183cd0a9a3d2a37133ac51bb86952e1b522dbf6f --- generic/nsfCmdPtr.c (.../nsfCmdPtr.c) (revision 16a02881bff0a0d626d0045dfd96660338d0c314) +++ generic/nsfCmdPtr.c (.../nsfCmdPtr.c) (revision 183cd0a9a3d2a37133ac51bb86952e1b522dbf6f) @@ -36,8 +36,8 @@ */ -static NSF_INLINE NsfObject*NsfGetObjectFromCmdPtr(Tcl_Command cmd) nonnull(1); -static NSF_INLINE NsfClass*NsfGetClassFromCmdPtr(Tcl_Command cmd) nonnull(1); +static NSF_INLINE NsfObject* NsfGetObjectFromCmdPtr(Tcl_Command cmd) nonnull(1); +static NSF_INLINE NsfClass* NsfGetClassFromCmdPtr(Tcl_Command cmd) nonnull(1); static NSF_INLINE ClientData NsfGetClientDataFromCmdPtr(Tcl_Command cmd) nonnull(1); static NSF_INLINE ClientData Index: generic/nsfDebug.c =================================================================== diff -u -r16a02881bff0a0d626d0045dfd96660338d0c314 -r183cd0a9a3d2a37133ac51bb86952e1b522dbf6f --- generic/nsfDebug.c (.../nsfDebug.c) (revision 16a02881bff0a0d626d0045dfd96660338d0c314) +++ generic/nsfDebug.c (.../nsfDebug.c) (revision 183cd0a9a3d2a37133ac51bb86952e1b522dbf6f) @@ -99,7 +99,7 @@ * NsfStackDump -- * * Write the current callstack with various debugging infos to stderr. This - * function is primarily for debugging proposes of the C implmenentation of + * function is primarily for debugging proposes of the C implementation of * nsf. * * Results: @@ -162,12 +162,13 @@ DECR_REF_COUNT(varCmdObj); } +#ifdef NSF_PRINT_OBJV /* *---------------------------------------------------------------------- * NsfPrintObjv -- * * Print the provided argument vector to stderr. This function is primarily - * for debugging proposes of the C implmenentation of nsf. + * for debugging proposes of the C implementation of nsf. * * Results: * None. @@ -178,7 +179,7 @@ *---------------------------------------------------------------------- */ -void NsfPrintObjv(char *string, int objc, Tcl_Obj *CONST objv[]) nonnull(1) nonnull(3); +void NsfPrintObjv(char *string, int objc, Tcl_Obj *CONST objv[]) nonnull(1) nonnull(3); void NsfPrintObjv(char *string, int objc, Tcl_Obj *CONST objv[]) { @@ -194,6 +195,7 @@ } fprintf(stderr, "\n"); } +#endif #ifdef NSF_MEM_COUNT /* Index: generic/nsfInt.h =================================================================== diff -u -r8854eeff1e1b2d5fde52ee4f71b1e2b7844b2dea -r183cd0a9a3d2a37133ac51bb86952e1b522dbf6f --- generic/nsfInt.h (.../nsfInt.h) (revision 8854eeff1e1b2d5fde52ee4f71b1e2b7844b2dea) +++ generic/nsfInt.h (.../nsfInt.h) (revision 183cd0a9a3d2a37133ac51bb86952e1b522dbf6f) @@ -316,7 +316,9 @@ #define ObjStr(obj) ((obj)->bytes) ? ((obj)->bytes) : Tcl_GetString(obj) #define ClassName(cl) (((cl) != NULL) ? ObjStr((cl)->object.cmdName) : "NULL") +#define ClassName_(cl) (ObjStr((cl)->object.cmdName)) #define ObjectName(obj) (((obj) != NULL) ? ObjStr((obj)->cmdName) : "NULL") +#define ObjectName_(obj) (ObjStr((obj)->cmdName)) #ifdef OBJDELETION_TRACE # define PRINTOBJ(ctx,obj) \ @@ -1123,6 +1125,8 @@ const char *methodName) nonnull(1) nonnull(3) returns_nonnull; +EXTERN int NsfDStringEval(Tcl_Interp *interp, Tcl_DString *dsPtr, const char *context, int safe, int noProfile) + nonnull(1) nonnull(2) nonnull(3); /* Index: generic/nsfProfile.c =================================================================== diff -u -r8854eeff1e1b2d5fde52ee4f71b1e2b7844b2dea -r183cd0a9a3d2a37133ac51bb86952e1b522dbf6f --- generic/nsfProfile.c (.../nsfProfile.c) (revision 8854eeff1e1b2d5fde52ee4f71b1e2b7844b2dea) +++ generic/nsfProfile.c (.../nsfProfile.c) (revision 183cd0a9a3d2a37133ac51bb86952e1b522dbf6f) @@ -60,82 +60,38 @@ * *---------------------------------------------------------------------- */ -#if defined(NSF_PROFILE) -static void NsfProfileObjectLabel(Tcl_DString *dsPtr, NsfObject *object, NsfClass *cl, const char *methodName) - nonnull(1) nonnull(2) nonnull(4); +static void NsfProfileObjectLabel(Tcl_DString *dsPtr, NsfObject *object) + nonnull(1) nonnull(2); static void -NsfProfileObjectLabel(Tcl_DString *dsPtr, NsfObject *object, NsfClass *cl, const char *methodName) { +NsfProfileObjectLabel(Tcl_DString *dsPtr, NsfObject *object) { nonnull_assert(dsPtr != NULL); nonnull_assert(object != NULL); - nonnull_assert(methodName != NULL); Tcl_DStringAppend(dsPtr, ObjectName(object), -1); Tcl_DStringAppend(dsPtr, " ", 1); Tcl_DStringAppend(dsPtr, ClassName(object->cl), -1); } -#endif +static void NsfProfileMethodLabel(Tcl_DString *dsPtr, NsfClass *cl, const char *methodName) + nonnull(1) nonnull(3); -static void NsfProfileMethodLabel(Tcl_DString *dsPtr, NsfObject *object, NsfClass *cl, const char *methodName) - nonnull(1) nonnull(4); - static void -NsfProfileMethodLabel(Tcl_DString *dsPtr, NsfObject *object, NsfClass *cl, const char *methodName) { +NsfProfileMethodLabel(Tcl_DString *dsPtr, NsfClass *cl, const char *methodName) { nonnull_assert(dsPtr != NULL); nonnull_assert(methodName != NULL); - if (cl != NULL && object != NULL) { - Tcl_DStringAppend(dsPtr, ObjStr(cl->object.cmdName), -1); + Tcl_DStringAppendElement(dsPtr, methodName); + if (cl != NULL) { Tcl_DStringAppend(dsPtr, " ", 1); + Tcl_DStringAppend(dsPtr, ObjStr(cl->object.cmdName), -1); } - Tcl_DStringAppendElement(dsPtr, methodName); -} -/* - *---------------------------------------------------------------------- - * ReportLine -- - * - * Report a profile line via NsfLog(). Since NsfLog() uses a Tcl function, - * ReportLine has to turn off profiling to avoid recursive profile - * invocation. It is as well necessary to save the interp result. - * - * Results: - * None - * - * Side effects: - * logging - * - *---------------------------------------------------------------------- - */ -static void ReportLine(Tcl_Interp *interp, int level, NsfRuntimeState *rst, const char *line) - nonnull(1) nonnull(3) nonnull(4); - -static void -ReportLine(Tcl_Interp *interp, int level, NsfRuntimeState *rst, const char *line) { - Tcl_Obj *savedResultObj; - int prevProfileSetting; - - nonnull_assert(interp != NULL); - nonnull_assert(rst != NULL); - nonnull_assert(line != NULL); - - prevProfileSetting = rst->doProfile; - rst->doProfile = 0; - - savedResultObj = Tcl_GetObjResult(interp); - INCR_REF_COUNT(savedResultObj); - - NsfLog(interp, level, "%s", line); - - Tcl_SetObjResult(interp, savedResultObj); - DECR_REF_COUNT(savedResultObj); - - rst->doProfile = prevProfileSetting; } + /* *---------------------------------------------------------------------- * NsfProfileDeprecatedCall -- @@ -163,7 +119,7 @@ Tcl_DStringInit(&ds); Tcl_DStringAppend(&ds, "{", 1); - NsfProfileMethodLabel(&ds, object, cl, methodName); + NsfProfileMethodLabel(&ds, cl, methodName); Tcl_DStringAppend(&ds, "}", 1); NsfDeprecatedCmd(interp,"method", ds.string, altMethod); @@ -200,16 +156,20 @@ rst->debugCallingDepth++; Tcl_DStringInit(&ds); - Nsf_DStringPrintf(&ds, "call(%d) - {", rst->debugCallingDepth); - NsfProfileMethodLabel(&ds, object, cl, methodName); + Nsf_DStringPrintf(&ds, "::nsf::debug::call %d {", rst->debugCallingDepth); + if (object != NULL) { + NsfProfileObjectLabel(&ds, object); + } + Tcl_DStringAppend(&ds, "} {", 3); + NsfProfileMethodLabel(&ds, cl, methodName); Tcl_DStringAppend(&ds, "}", 1); listObj = Tcl_NewListObj(objc, objv); INCR_REF_COUNT(listObj); - Nsf_DStringPrintf(&ds, " %s", ObjStr(listObj)); + Nsf_DStringPrintf(&ds, " {%s}", ObjStr(listObj)); DECR_REF_COUNT(listObj); - ReportLine(interp, NSF_LOG_DEBUG, rst, ds.string); + NsfDStringEval(interp, &ds, "debug call", 1, 1); Tcl_DStringFree(&ds); @@ -226,28 +186,73 @@ rst = RUNTIME_STATE(interp); Tcl_DStringInit(dsPtr); - Nsf_DStringPrintf(dsPtr, "exit(%d) - {", rst->debugCallingDepth); + Nsf_DStringPrintf(dsPtr, "::nsf::debug::exit %d {", rst->debugCallingDepth); + if (object != NULL) { + NsfProfileObjectLabel(dsPtr, object); + } + Tcl_DStringAppend(dsPtr, "} {", 3); + NsfProfileMethodLabel(dsPtr, cl, methodName); + if (startSec != 0 || startUsec != 0) { struct timeval trt; gettimeofday(&trt, NULL); - NsfProfileMethodLabel(dsPtr, object, cl, methodName); - Nsf_DStringPrintf(dsPtr, "} %ld usec", (trt.tv_sec - startSec) * 1000000 + (trt.tv_usec - startUsec)); + Nsf_DStringPrintf(dsPtr, "} %ld ", (trt.tv_sec - startSec) * 1000000 + (trt.tv_usec - startUsec)); } else { - NsfProfileMethodLabel(dsPtr, object, cl, methodName); - Tcl_DStringAppend(dsPtr, "}", 1); + Tcl_DStringAppend(dsPtr, "} {}", 4); } - ReportLine(interp, NSF_LOG_DEBUG, rst, ds.string); - Tcl_DStringFree(dsPtr); + NsfDStringEval(interp, &ds, "debug exit", 1, 1); + Tcl_DStringFree(dsPtr); rst->debugCallingDepth--; } #if defined(NSF_PROFILE) +/* + *---------------------------------------------------------------------- + * ReportLine -- + * + * Report a profile line via NsfLog(). Since NsfLog() uses a Tcl function, + * ReportLine has to turn off profiling to avoid recursive profile + * invocation. It is as well necessary to save the interp result. + * + * Results: + * None + * + * Side effects: + * logging + * + *---------------------------------------------------------------------- + */ +static void ReportLine(Tcl_Interp *interp, int level, NsfRuntimeState *rst, const char *line) + nonnull(1) nonnull(3) nonnull(4); +static void +ReportLine(Tcl_Interp *interp, int level, NsfRuntimeState *rst, const char *line) { + Tcl_Obj *savedResultObj; + int prevProfileSetting; + + nonnull_assert(interp != NULL); + nonnull_assert(rst != NULL); + nonnull_assert(line != NULL); + + prevProfileSetting = rst->doProfile; + rst->doProfile = 0; + + savedResultObj = Tcl_GetObjResult(interp); + INCR_REF_COUNT(savedResultObj); + + NsfLog(interp, level, "%s", line); + + Tcl_SetObjResult(interp, savedResultObj); + DECR_REF_COUNT(savedResultObj); + + rst->doProfile = prevProfileSetting; +} + /* *---------------------------------------------------------------------- * NsfProfileFillTable -- @@ -586,14 +591,14 @@ Tcl_DString ds, traceLabel; Tcl_DStringInit(&ds); - NsfProfileObjectLabel(&ds, object, cl, methodName); + NsfProfileObjectLabel(&ds, object); Tcl_DStringInit(&traceLabel); Tcl_DStringAppendElement(&traceLabel, Tcl_DStringValue(&ds)); Tcl_DStringAppend(&traceLabel, " ", 1); Tcl_DStringTrunc(&ds, 0); - NsfProfileMethodLabel(&ds, object, cl, methodName); + NsfProfileMethodLabel(&ds, cl, methodName); Tcl_DStringAppendElement(&traceLabel, Tcl_DStringValue(&ds)); NsfProfileTraceCallAppend(interp, Tcl_DStringValue(&traceLabel)); @@ -617,14 +622,14 @@ totalMicroSec = (trt.tv_sec - callTime->tv_sec) * 1000000 + (trt.tv_usec - callTime->tv_usec); Tcl_DStringInit(&ds); - NsfProfileObjectLabel(&ds, object, cl, methodName); + NsfProfileObjectLabel(&ds, object); Tcl_DStringInit(&traceLabel); Tcl_DStringAppendElement(&traceLabel, Tcl_DStringValue(&ds)); Tcl_DStringAppend(&traceLabel, " ", 1); Tcl_DStringTrunc(&ds, 0); - NsfProfileMethodLabel(&ds, object, cl, methodName); + NsfProfileMethodLabel(&ds, cl, methodName); Tcl_DStringAppendElement(&traceLabel, Tcl_DStringValue(&ds)); NsfProfileTraceExitAppend(interp, Tcl_DStringValue(&traceLabel), totalMicroSec); @@ -674,11 +679,11 @@ } Tcl_DStringInit(&objectKey); - NsfProfileObjectLabel(&objectKey, obj, NULL, cscPtr->methodName); + NsfProfileObjectLabel(&objectKey, obj); Tcl_DStringInit(&methodInfo); Tcl_DStringInit(&methodKey); - NsfProfileMethodLabel(&methodInfo, obj, cl, cscPtr->methodName); + NsfProfileMethodLabel(&methodInfo, cl, cscPtr->methodName); if (rst->doTrace) { Tcl_DString traceKey; @@ -708,7 +713,7 @@ NsfCallStackContent *cscPtrTop = NsfCallStackGetTopFrame(interp, NULL); if (cscPtrTop != NULL) { Tcl_DStringAppend(&methodKey, " {", 2); - NsfProfileMethodLabel(&methodKey, cscPtrTop->self, cscPtrTop->cl, cscPtrTop->methodName); + NsfProfileMethodLabel(&methodKey, cscPtrTop->cl, cscPtrTop->methodName); Tcl_DStringAppend(&methodKey, "}", 1); } else { Tcl_DStringAppend(&methodKey, " {}", 3); Index: generic/predefined.h =================================================================== diff -u -r8854eeff1e1b2d5fde52ee4f71b1e2b7844b2dea -r183cd0a9a3d2a37133ac51bb86952e1b522dbf6f --- generic/predefined.h (.../predefined.h) (revision 8854eeff1e1b2d5fde52ee4f71b1e2b7844b2dea) +++ generic/predefined.h (.../predefined.h) (revision 183cd0a9a3d2a37133ac51bb86952e1b522dbf6f) @@ -61,6 +61,11 @@ "puts stderr \"$level: $msg\"}}} else {\n" "proc ::nsf::log {level msg} {\n" "puts stderr \"$level: $msg\"}}\n" +"namespace eval ::nsf::debug {}\n" +"proc ::nsf::debug::call {level objectInfo methodInfo arglist} {\n" +"nsf::log Warning \"DB call($level) - $objectInfo $methodInfo $arglist\"}\n" +"proc ::nsf::debug::exit {level objectInfo methodInfo usec} {\n" +"nsf::log Warning \"DB exit($level) - $objectInfo $methodInfo $usec usec\"}\n" "proc ::nsf::deprecated {what oldCmd newCmd} {\n" "set msg \"*** $what $oldCmd is deprecated.\"\n" "if {$newCmd ne \"\"} {append msg \" use $newCmd instead.\"}\n" Index: library/nx/nx.tcl =================================================================== diff -u -r2d609d0c01e236da96542cefab42d8c8f6a3d1e9 -r183cd0a9a3d2a37133ac51bb86952e1b522dbf6f --- library/nx/nx.tcl (.../nx.tcl) (revision 2d609d0c01e236da96542cefab42d8c8f6a3d1e9) +++ library/nx/nx.tcl (.../nx.tcl) (revision 183cd0a9a3d2a37133ac51bb86952e1b522dbf6f) @@ -12,7 +12,7 @@ # Institute of Information Systems and New Media # A-1020, Welthandelsplatz 1 # Vienna, Austria -# +# # This work is licensed under the MIT License http://www.opensource.org/licenses/MIT # # Copyright: @@ -176,7 +176,7 @@ return -code error "refuse to overwrite object method $w; delete/rename object method first." } set ensembleName ${object}::$w - } + } #puts stderr "NX check $scope $object info methods $path @ <$w> cmd=[info command $w] obj?[nsf::object::exists $ensembleName] " if {![nsf::object::exists $ensembleName]} { # @@ -283,7 +283,7 @@ # Well, class is not a method defining method either, but a modifier array set ::nsf::methodDefiningMethod { - method 1 alias 1 forward 1 object 1 + method 1 alias 1 forward 1 object 1 ::nsf::classes::nx::Class::method 1 ::nsf::classes::nx::Object::method 1 ::nsf::classes::nx::Class::alias 1 ::nsf::classes::nx::Object::alias 1 ::nsf::classes::nx::Class::forward 1 ::nsf::classes::nx::Object::forward 1 @@ -351,6 +351,7 @@ # Class public method forward { + -debug:switch -deprecated:switch methodName -default -prefix -frame -onerror -returns -verbose:switch target:optional args @@ -363,7 +364,7 @@ error "target '$target' must not start with a dash" } if {[info exists frame] && $frame ni {object default}} { - error "value of parameter -frame must be 'object' or 'default'" + error "value of parameter -frame must be 'object' or 'default'" } if {[info exists returns]} { set nrPreArgs [expr {[llength $arguments]-[llength $args]}] @@ -376,6 +377,8 @@ ::nsf::method::property $object $r call-protected \ [::nsf::dispatch $object __default_method_call_protection] if {[info exists returns]} {::nsf::method::property $object $r returns $returns} + if {$debug} {::nsf::method::property $object $r debug true} + if {$deprecated} {::nsf::method::property $object $r deprecated true} return $r } @@ -385,7 +388,10 @@ # -frame object|method make only sense for c-defined cmds, ###################################################################### - Class public method alias {methodName -returns {-frame default} cmd} { + Class public method alias { + -debug:switch -deprecated:switch + methodName -returns {-frame default} cmd + } { set pathData [:__resolve_method_path $methodName] set object [dict get $pathData object] @@ -394,6 +400,8 @@ ::nsf::method::property $object $r call-protected \ [::nsf::dispatch $object __default_method_call_protection] if {[info exists returns]} {::nsf::method::property $object $r returns $returns} + if {$debug} {::nsf::method::property $object $r debug true} + if {$deprecated} {::nsf::method::property $object $r deprecated true} return $r } @@ -513,7 +521,7 @@ # Now we are able to use ensemble methods in the definition of NX ###################################################################### - + Object eval { # # Define method defining methods for Object. @@ -548,7 +556,10 @@ return $r } - :public method "object alias" {methodName -returns {-frame default} cmd} { + :public method "object alias" { + -debug:switch -deprecated:switch + methodName -returns {-frame default} cmd + } { set pathData [:__resolve_method_path -per-object $methodName] set object [dict get $pathData object] @@ -558,10 +569,13 @@ ::nsf::method::property $object -per-object $r call-protected \ [::nsf::dispatch $object __default_method_call_protection] if {[info exists returns]} {::nsf::method::property $object $r returns $returns} + if {$debug} {::nsf::method::property $object $r debug true} + if {$deprecated} {::nsf::method::property $object $r deprecated true} return $r } :public method "object forward" { + -debug:switch -deprecated:switch methodName -default -prefix -frame -onerror -returns -verbose:switch target:optional args @@ -574,7 +588,7 @@ error "target '$target' must not start with a dash" } if {[info exists frame] && $frame ni {object default}} { - error "value of parameter '-frame' must be 'object' or 'default'" + error "value of parameter '-frame' must be 'object' or 'default'" } if {[info exists returns]} { set nrPreArgs [expr {[llength $arguments]-[llength $args]}] @@ -588,6 +602,8 @@ ::nsf::method::property $object -per-object $r call-protected \ [::nsf::dispatch $object __default_method_call_protection] if {[info exists returns]} {::nsf::method::property $object $r returns $returns} + if {$debug} {::nsf::method::property $object $r debug true} + if {$deprecated} {::nsf::method::property $object $r deprecated true} return $r } } @@ -623,7 +639,7 @@ } # call explicitly the per-object variant of "info::slotobejcts" set slot [: ::nsf::methods::object::info::slotobjects -type ::nx::Slot $name] - + if {$slot ne ""} { # it is not a slot-less variable $slot destroy @@ -658,7 +674,7 @@ :method "require namespace" {} { ::nsf::directdispatch [::nsf::self] ::nsf::methods::object::requirenamespace } - + # # method require, base cases # @@ -780,7 +796,7 @@ # :method "info parameter name" {p:parameter} {::nsf::parameter::info name $p} # :method "info parameter syntax" {p:parameter} {::nsf::parameter::info syntax $p} # :method "info parameter type" {p:parameter} {::nsf::parameter::info type $p} - + :alias "info parent" ::nsf::methods::object::info::parent :alias "info precedence" ::nsf::methods::object::info::precedence :alias "info vars" ::nsf::methods::object::info::vars @@ -819,9 +835,9 @@ # Class eval { - :alias "info lookup" ::nx::Object::slot::__info::lookup + # :alias "info lookup" ::nx::Object::slot::__info::lookup :alias "info filters" ::nsf::methods::class::info::filters - :alias "info has" ::nx::Object::slot::__info::has + # :alias "info has" ::nx::Object::slot::__info::has :alias "info heritage" ::nsf::methods::class::info::heritage :alias "info instances" ::nsf::methods::class::info::instances :alias "info methods" ::nsf::methods::class::info::methods @@ -840,7 +856,7 @@ :method "info variables" {pattern:optional} { set cmd {info slots -type ::nx::VariableSlot} if {[info exists pattern]} {lappend cmd $pattern} - return [: {*}$cmd] + return [: {*}$cmd] } } @@ -855,7 +871,7 @@ if {$name in $methods || $name eq "unknown"} continue lappend methods $name } - + if {$asList} { return $methods } else { @@ -945,7 +961,7 @@ Object eval { :public alias cget ::nsf::methods::object::cget - :public alias configure ::nsf::methods::object::configure + :public alias configure ::nsf::methods::object::configure #:public method "info configure" {} {: ::nsf::methods::object::info::objectparameter syntax} } #nsf::method::create ::nx::Class::slot::__info::configure defaultmethod {} { @@ -1088,7 +1104,7 @@ } if {$private} { - regsub -all : __$target _ prefix + regsub -all : __$target _ prefix lappend opts -settername $name -name __private($target,$name) set slotname ${prefix}.$name } else { @@ -1100,7 +1116,7 @@ } else { #puts stderr "*** Class for '$target $name' is $class // [$class info heritage]" } - + set slotObj [::nx::slotObj -container $container $target $slotname] #puts stderr "[self] *** [list $class create $slotObj] {*}$opts <$initblock>" set r [$class create $slotObj {*}$opts $initblock] @@ -1153,7 +1169,7 @@ # #regexp {^([^:]+):} $att . att #::nsf::method::property $class $att call-protected true - + # # set for every bootstrap property slot the position 0 # @@ -1301,7 +1317,7 @@ # delete the accessors # #puts stderr "*** slot destroy of [self], domain ${:domain} per-object ${:per-object}" - + if {${:per-object}} { ::nsf::parameter::cache::objectinvalidate ${:domain} if {[${:domain} ::nsf::methods::object::info::method exists ${:name}]} { @@ -1464,7 +1480,7 @@ } ObjectParameterSlot public method getPropertyDefinitionOptions {parameterSpec} { - #puts "accessor <${:accessor}> configurable ${:configurable} per-object ${:per-object}" + #puts "accessor <${:accessor}> configurable ${:configurable} per-object ${:per-object}" set mod [expr {${:per-object} ? "object" : ""}] set opts "" @@ -1630,9 +1646,9 @@ ###################################################################### # - # Create relation slots + # Create relation slots # - # on nx::Object for + # on nx::Object for # # object-mixin # object-filter @@ -1671,7 +1687,7 @@ -disposition slotset \ -forwardername class-filter \ -elementtype filterreg - + # # Define "class" as a ObjectParameterSlot defined as alias # @@ -1818,7 +1834,7 @@ if {[llength $options]} { ::nsf::is -configure -complain -name ${:name}: [join $options ,] $value } - + set restore [:removeTraces $object *] ::nsf::var::set $object ${:name} ${:default} if {[info exists restore]} { {*}$restore } @@ -1857,7 +1873,7 @@ "alnum" "alpha" "ascii" "control" "digit" "double" \ "false" "graph" "lower" "print" "punct" "space" "true" \ "wideinteger" "wordchar" "xdigit" ]} { - lappend options slot=[::nsf::self] + lappend options slot=[::nsf::self] } } } @@ -1903,7 +1919,7 @@ } ::nx::VariableSlot protected method makeAccessor {} { - + if {${:accessor} eq "none"} { #puts stderr "*** Do not register forwarder ${:domain} ${:name}" return 0 @@ -1973,7 +1989,7 @@ #puts "[self] VariableSlot [self] ${:incremental} && ${:accessor} && ${:multiplicity} incremental ${:incremental}" if {${:incremental}} { if {${:accessor} eq "none"} { set :accessor "public" } - if {![:isMultivalued]} { + if {![:isMultivalued]} { set :multiplicity [string range ${:multiplicity} 0 0]..n } } @@ -2032,7 +2048,7 @@ #puts stderr "====removeTraces ${:name} $matchOps" set restore "" set traces [::nsf::directdispatch $object -frame object ::trace info variable ${:name}] - foreach trace $traces { + foreach trace $traces { lassign $trace ops cmdPrefix if {![string match $matchOps $ops]} continue #puts stderr "====remove trace variable ${:name} $ops $cmdPrefix" @@ -2120,7 +2136,7 @@ ::nsf::method::alias ::nx::VariableSlot value=get ::nsf::var::get ::nsf::method::alias ::nx::VariableSlot value=set ::nsf::var::set - + ::nx::VariableSlot public method value=unset {obj prop -nocomplain:switch} { ::nsf::var::unset -nocomplain=$nocomplain $obj $prop } @@ -2180,7 +2196,7 @@ set configurable $opts(-configurable) } - #if {$initblock eq "" && $accessor eq "none" && !$incremental} + #if {$initblock eq "" && $accessor eq "none" && !$incremental} if {$initblock eq "" && !$configurable && $accessor eq "none" && !$incremental} { # # we can build a slot-less variable @@ -2449,7 +2465,7 @@ :method makeTargetList {t} { if {[::nsf::is object,type=::nx::EnsembleObject $t]} { - # + # # we do not copy ensemble objects, since method # introspection/recreation will care about these # Index: tests/info-method.test =================================================================== diff -u -r0b1ac7f47948c36c4e03fc3d6dbce0a04d9418d4 -r183cd0a9a3d2a37133ac51bb86952e1b522dbf6f --- tests/info-method.test (.../info-method.test) (revision 0b1ac7f47948c36c4e03fc3d6dbce0a04d9418d4) +++ tests/info-method.test (.../info-method.test) (revision 183cd0a9a3d2a37133ac51bb86952e1b522dbf6f) @@ -109,9 +109,9 @@ # } ? {C info method parameters m} {x} ? {nx::Class info method parameters method} \ - {name arguments:parameter,0..* -checkalways:switch -returns body} + {-debug:switch -deprecated:switch name arguments:parameter,0..* -checkalways:switch -returns body} ? {nx::Class info method parameters alias} \ - {methodName -returns {-frame default} cmd} + {-debug:switch -deprecated:switch methodName -returns {-frame default} cmd} # raises currently an error ? {catch {C info method parameters a}} 1 @@ -806,7 +806,7 @@ nx::test case parametersyntax { # a true method ? {::nx::Class info method syntax method} \ - "/cls/ method /name/ /arguments/ ?-checkalways? ?-returns /value/? /body/" + "/cls/ method ?-debug? ?-deprecated? /name/ /arguments/ ?-checkalways? ?-returns /value/? /body/" # a forwarder to ::nsf::relation; definition comes via array ::nsf::parametersyntax ? {::nx::Class info method syntax mixins} "/cls/ mixins add /class/|classes ?/pattern/?|clear|delete /class/|get|guard /class/ /?expr?/|set /class .../" Index: tests/parameters.test =================================================================== diff -u -r3946480dcc906b5004bf18ee49b49054fa400e0d -r183cd0a9a3d2a37133ac51bb86952e1b522dbf6f --- tests/parameters.test (.../parameters.test) (revision 3946480dcc906b5004bf18ee49b49054fa400e0d) +++ tests/parameters.test (.../parameters.test) (revision 183cd0a9a3d2a37133ac51bb86952e1b522dbf6f) @@ -614,7 +614,7 @@ "query instparams with default, no paramdefs needed" ? {nx::Class info method parameters method} \ - "name arguments:parameter,0..* -checkalways:switch -returns body" \ + "-debug:switch -deprecated:switch name arguments:parameter,0..* -checkalways:switch -returns body" \ "query instparams for scripted method 'method'" ? {nx::Object info method parameters ::nsf::method::forward} \