Index: generic/xotcl.c =================================================================== diff -u -r9be808f7267163cc1f3911b5f9ad750cac0dc397 -r54346e996575a3c1295e4a36c07fd490e63bc5a6 --- generic/xotcl.c (.../xotcl.c) (revision 9be808f7267163cc1f3911b5f9ad750cac0dc397) +++ generic/xotcl.c (.../xotcl.c) (revision 54346e996575a3c1295e4a36c07fd490e63bc5a6) @@ -65,32 +65,32 @@ #ifdef USE_TCL_STUBS # define XOTcl_ExprObjCmd(cd,in,objc,objv) \ - XOTclCallCommand(in, XOTE_EXPR, objc, objv) + XOTclCallCommand(interp, XOTE_EXPR, objc, objv) # define XOTcl_SubstObjCmd(cd,in,objc,objv) \ - XOTclCallCommand(in, XOTE_SUBST, objc, objv) + XOTclCallCommand(interp, XOTE_SUBST, objc, objv) #else # define XOTcl_ExprObjCmd(cd,in,objc,objv) \ - Tcl_ExprObjCmd(cd, in, objc, objv) + Tcl_ExprObjCmd(cd, interp, objc, objv) # define XOTcl_SubstObjCmd(cd,in,objc,objv) \ - Tcl_SubstObjCmd(cd, in, objc, objv) + Tcl_SubstObjCmd(cd, interp, objc, objv) #endif -static int SetXOTclObjectFromAny(Tcl_Interp *in, Tcl_Obj *objPtr); +static int SetXOTclObjectFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); static void UpdateStringOfXOTclObject(Tcl_Obj *objPtr); static void FreeXOTclObjectInternalRep(Tcl_Obj *objPtr); static void DupXOTclObjectInternalRep(Tcl_Obj *src, Tcl_Obj *cpy); -static Tcl_Obj*NameInNamespaceObj(Tcl_Interp *in, char *name, Tcl_Namespace *ns); +static Tcl_Obj*NameInNamespaceObj(Tcl_Interp *interp, char *name, Tcl_Namespace *ns); static Tcl_Namespace *callingNameSpace(Tcl_Interp *in); -XOTCLINLINE static Tcl_Command NSFindCommand(Tcl_Interp *in, char *name, Tcl_Namespace *ns); +XOTCLINLINE static Tcl_Command NSFindCommand(Tcl_Interp *interp, char *name, Tcl_Namespace *ns); -XOTCLINLINE static void GuardAdd(Tcl_Interp *in, XOTclCmdList* filterCL, Tcl_Obj *guard); -static int GuardCheck(Tcl_Interp *in, ClientData guards); -static int GuardCall(XOTclObject *obj, XOTclClass* cl, Tcl_Command cmd, Tcl_Interp *in, ClientData clientData, int push); +XOTCLINLINE static void GuardAdd(Tcl_Interp *interp, XOTclCmdList* filterCL, Tcl_Obj *guard); +static int GuardCheck(Tcl_Interp *interp, ClientData guards); +static int GuardCall(XOTclObject *obj, XOTclClass* cl, Tcl_Command cmd, Tcl_Interp *interp, ClientData clientData, int push); static void GuardDel(XOTclCmdList* filterCL); -static int IsMetaClass(Tcl_Interp *in, XOTclClass *cl); -static int hasMixin(Tcl_Interp *in, XOTclObject *obj, XOTclClass *cl); +static int IsMetaClass(Tcl_Interp *interp, XOTclClass *cl); +static int hasMixin(Tcl_Interp *interp, XOTclObject *obj, XOTclClass *cl); static int isSubType(XOTclClass *subcl, XOTclClass *cl); static Tcl_ObjType XOTclObjectType = { @@ -134,29 +134,29 @@ ClientData cd; } aliasCmdClientData; -static int ObjDispatch(ClientData cd, Tcl_Interp *in, int objc, +static int ObjDispatch(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], int flags); -XOTCLINLINE static int DoDispatch(ClientData cd, Tcl_Interp *in, int objc, +XOTCLINLINE static int DoDispatch(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], int flags); -static int XOTclNextMethod(XOTclObject *obj, Tcl_Interp *in, XOTclClass *givenCl, +static int XOTclNextMethod(XOTclObject *obj, Tcl_Interp *interp, XOTclClass *givenCl, char *givenMethod, int objc, Tcl_Obj *CONST objv[], int useCSObjs); -static int XOTclForwardMethod(ClientData cd, Tcl_Interp *in, int objc, +static int XOTclForwardMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]); -static int XOTclObjscopedMethod(ClientData cd, Tcl_Interp *in, int objc, +static int XOTclObjscopedMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]); -static int XOTclSetterMethod(ClientData cd, Tcl_Interp *in, int objc, +static int XOTclSetterMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]); -static int callDestroyMethod(ClientData cd, Tcl_Interp *in, XOTclObject *obj, int flags); +static int callDestroyMethod(ClientData cd, Tcl_Interp *interp, XOTclObject *obj, int flags); -static int XOTclObjConvertObject(Tcl_Interp *in, register Tcl_Obj *objPtr, XOTclObject **obj); -static XOTclObject *XOTclpGetObject(Tcl_Interp *in, char *name); -static XOTclClass *XOTclpGetClass(Tcl_Interp *in, char *name); +static int XOTclObjConvertObject(Tcl_Interp *interp, register Tcl_Obj *objPtr, XOTclObject **obj); +static XOTclObject *XOTclpGetObject(Tcl_Interp *interp, char *name); +static XOTclClass *XOTclpGetClass(Tcl_Interp *interp, char *name); static XOTclCallStackContent* CallStackGetFrame(Tcl_Interp *in); #if !defined(NDEBUG) -static void checkAllInstances(Tcl_Interp *in, XOTclClass *startCl, int lvl); +static void checkAllInstances(Tcl_Interp *interp, XOTclClass *startCl, int lvl); #endif @@ -168,7 +168,7 @@ /* for backward compatibility only */ static int -Tcl_EvalObjv(Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[], int flags) { +Tcl_EvalObjv(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], int flags) { int i, result; Tcl_DString ds, *dsp = &ds; @@ -177,23 +177,23 @@ for (i = 0; i < objc; i++) { Tcl_DStringAppendElement(dsp, ObjStr(objv[i])); } - result = Tcl_Eval(in, Tcl_DStringValue(dsp)); + result = Tcl_Eval(interp, Tcl_DStringValue(dsp)); DSTRING_FREE(dsp); return result; } static int -Tcl_EvalEx(Tcl_Interp *in, char *cmd, int len, int flags) { - return Tcl_Eval(in, cmd); +Tcl_EvalEx(Tcl_Interp *interp, char *cmd, int len, int flags) { + return Tcl_Eval(interp, cmd); } static int -Tcl_SubstObjCmd(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +Tcl_SubstObjCmd(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { char *ov[20]; int i; assert(objc<19); for (i=0; i3) memcpy(tov+3, objv, sizeof(Tcl_Obj *)*(objc-3)); - result = DoDispatch(cd, in, objc, tov, flags); + result = DoDispatch(cd, interp, objc, tov, flags); FREE_ON_STACK(tov); return result; @@ -651,33 +651,33 @@ */ XOTCLINLINE static CONST84 char * -GetSelfProc(Tcl_Interp *in) { - /*return Tcl_GetCommandName(in, RUNTIME_STATE(in)->cs.top->cmdPtr);*/ - return Tcl_GetCommandName(in, CallStackGetFrame(in)->cmdPtr); +GetSelfProc(Tcl_Interp *interp) { + /*return Tcl_GetCommandName(interp, RUNTIME_STATE(interp)->cs.top->cmdPtr);*/ + return Tcl_GetCommandName(interp, CallStackGetFrame(interp)->cmdPtr); } XOTCLINLINE static XOTclClass* -GetSelfClass(Tcl_Interp *in) { - /*return RUNTIME_STATE(in)->cs.top->cl;*/ - return CallStackGetFrame(in)->cl; +GetSelfClass(Tcl_Interp *interp) { + /*return RUNTIME_STATE(interp)->cs.top->cl;*/ + return CallStackGetFrame(interp)->cl; } XOTCLINLINE static XOTclObject* -GetSelfObj(Tcl_Interp *in) { - return CallStackGetFrame(in)->self; +GetSelfObj(Tcl_Interp *interp) { + return CallStackGetFrame(interp)->self; } /* extern callable GetSelfObj */ XOTcl_Object* -XOTclGetSelfObj(Tcl_Interp *in) { - return (XOTcl_Object*)GetSelfObj(in); +XOTclGetSelfObj(Tcl_Interp *interp) { + return (XOTcl_Object*)GetSelfObj(interp); } XOTCLINLINE static Tcl_Command -GetSelfProcCmdPtr(Tcl_Interp *in) { - /*return RUNTIME_STATE(in)->cs.top->cmdPtr;*/ - return CallStackGetFrame(in)->cmdPtr; +GetSelfProcCmdPtr(Tcl_Interp *interp) { + /*return RUNTIME_STATE(interp)->cs.top->cmdPtr;*/ + return CallStackGetFrame(interp)->cmdPtr; } /* @@ -693,14 +693,14 @@ } static int -XOTcl_DeprecatedCmd(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTcl_DeprecatedCmd(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { char *new; if (objc == 2) new = 0; else if (objc == 3) new = ObjStr(objv[2]); else - return XOTclObjErrArgCnt(in, NULL, "deprecated oldcmd ?newcmd?"); + return XOTclObjErrArgCnt(interp, NULL, "deprecated oldcmd ?newcmd?"); XOTclDeprecatedMsg(ObjStr(objv[1]), new); return TCL_OK; } @@ -713,14 +713,14 @@ fprintf(stderr," (objc=%d)",objc); } -static void printCall(Tcl_Interp *in, char *string, int objc, Tcl_Obj *CONST objv[]) { - fprintf(stderr, " (%d) >%s: ", Tcl_Interp_numLevels(in), string); +static void printCall(Tcl_Interp *interp, char *string, int objc, Tcl_Obj *CONST objv[]) { + fprintf(stderr, " (%d) >%s: ", Tcl_Interp_numLevels(interp), string); printObjv(objc, objv); fprintf(stderr, "\n"); } -static void printExit(Tcl_Interp *in, char *string, +static void printExit(Tcl_Interp *interp, char *string, int objc, Tcl_Obj *CONST objv[], int result) { - fprintf(stderr, " (%d) <%s: ", Tcl_Interp_numLevels(in), string); + fprintf(stderr, " (%d) <%s: ", Tcl_Interp_numLevels(interp), string); /*printObjv(objc, objv);*/ fprintf(stderr, " result=%d\n", result); } @@ -863,9 +863,9 @@ #endif if (obj->flags & XOTCL_REFCOUNTED && !(obj->flags & XOTCL_DESTROY_CALLED)) { - Tcl_Interp *in = obj->teardown; + Tcl_Interp *interp = obj->teardown; INCR_REF_COUNT(obj->cmdName); - callDestroyMethod((ClientData)obj, in, obj, 0); + callDestroyMethod((ClientData)obj, interp, obj, 0); /* the call to cleanup is the counterpart of the INCR_REF_COUNT(obj->cmdName) above */ XOTclCleanupObject(obj); @@ -892,7 +892,7 @@ } static int -SetXOTclObjectFromAny(Tcl_Interp *in, register Tcl_Obj *objPtr) { +SetXOTclObjectFromAny(Tcl_Interp *interp, register Tcl_Obj *objPtr) { Tcl_ObjType *oldTypePtr = objPtr->typePtr; char *string = ObjStr(objPtr); XOTclObject *obj; @@ -908,26 +908,26 @@ if (!isAbsolutePath(string)) { char *nsString; - tmpName = NameInNamespaceObj(in,string,callingNameSpace(in)); + tmpName = NameInNamespaceObj(interp,string,callingNameSpace(interp)); nsString = ObjStr(tmpName); INCR_REF_COUNT(tmpName); - obj = XOTclpGetObject(in, nsString); + obj = XOTclpGetObject(interp, nsString); DECR_REF_COUNT(tmpName); if (!obj) { /* retry with global namespace */ tmpName = Tcl_NewStringObj("::",2); Tcl_AppendToObj(tmpName,string,-1); INCR_REF_COUNT(tmpName); - obj = XOTclpGetObject(in, ObjStr(tmpName)); + obj = XOTclpGetObject(interp, ObjStr(tmpName)); DECR_REF_COUNT(tmpName); } } else { - obj = XOTclpGetObject(in, string); + obj = XOTclpGetObject(interp, string); } #if 0 - obj = XOTclpGetObject(in, string); + obj = XOTclpGetObject(interp, string); #endif if (obj) { @@ -964,7 +964,7 @@ #endif /* Here we use GetCommandName, because it doesnt need - Interp*, but Tcl_GetCommandFullName(in,obj->id,ObjName); does*/ + Interp*, but Tcl_GetCommandFullName(interp,obj->id,ObjName); does*/ if (obj && !(obj->flags & XOTCL_DESTROY_CALLED)) { Tcl_DString ds, *dsp = &ds; unsigned l; @@ -1061,7 +1061,7 @@ #if NOTUSED static int -XOTclObjGetObject(Tcl_Interp *in, register Tcl_Obj *objPtr, XOTclObject **obj) { +XOTclObjGetObject(Tcl_Interp *interp, register Tcl_Obj *objPtr, XOTclObject **obj) { int result; register Tcl_ObjType *cmdType = objPtr->typePtr; XOTclObject *o; @@ -1075,7 +1075,7 @@ } if (cmdType == GetCmdNameType(cmdType)) { - Tcl_Command cmd = Tcl_GetCommandFromObj(in, objPtr); + Tcl_Command cmd = Tcl_GetCommandFromObj(interp, objPtr); /*fprintf(stderr,"obj is of type tclCmd\n");*/ if (cmd) { o = XOTclGetObjectFromCmdPtr(cmd); @@ -1086,7 +1086,7 @@ } } - o = XOTclpGetObject(in, ObjStr(objPtr)); + o = XOTclpGetObject(interp, ObjStr(objPtr)); if (o) { *obj = o; return TCL_OK; @@ -1096,7 +1096,7 @@ #endif static int -XOTclObjConvertObject(Tcl_Interp *in, Tcl_Obj *objPtr, XOTclObject **obj) { +XOTclObjConvertObject(Tcl_Interp *interp, Tcl_Obj *objPtr, XOTclObject **obj) { int result; register Tcl_ObjType *cmdType = objPtr->typePtr; @@ -1114,7 +1114,7 @@ /* fprintf(stderr,"????? calling free by hand\n"); */ FreeXOTclObjectInternalRep(objPtr); refetch = 1; - result = SetXOTclObjectFromAny(in, objPtr); + result = SetXOTclObjectFromAny(interp, objPtr); if (result == TCL_OK) { o = (XOTclObject*) objPtr->internalRep.otherValuePtr; assert(o && !(o->flags & XOTCL_DESTROYED)); @@ -1138,7 +1138,7 @@ } #ifdef KEEP_TCL_CMD_TYPE } else if (cmdType == GetCmdNameType(cmdType)) { - Tcl_Command cmd = Tcl_GetCommandFromObj(in, objPtr); + Tcl_Command cmd = Tcl_GetCommandFromObj(interp, objPtr); /*fprintf(stderr,"obj %s is of type tclCmd, cmd=%p\n",ObjStr(objPtr),cmd);*/ if (cmd) { XOTclObject *o = XOTclGetObjectFromCmdPtr(cmd); @@ -1160,7 +1160,7 @@ #ifdef KEEP_TCL_CMD_TYPE convert_to_xotcl_object: #endif - result = SetXOTclObjectFromAny(in, objPtr); + result = SetXOTclObjectFromAny(interp, objPtr); if (result == TCL_OK && obj) { *obj = (XOTclObject*) objPtr->internalRep.otherValuePtr; } @@ -1170,7 +1170,7 @@ #ifndef NAMESPACEINSTPROCS static Tcl_Namespace * -GetCallerVarFrame(Tcl_Interp *in, Tcl_CallFrame *varFramePtr) { +GetCallerVarFrame(Tcl_Interp *interp, Tcl_CallFrame *varFramePtr) { Tcl_Namespace *nsPtr = NULL; if (varFramePtr) { Tcl_CallFrame *callerVarPtr = Tcl_CallFrame_callerVarPtr(varFramePtr); @@ -1179,21 +1179,21 @@ } } if (nsPtr == NULL) - nsPtr = Tcl_Interp_globalNsPtr(in); + nsPtr = Tcl_Interp_globalNsPtr(interp); return nsPtr; } #endif static Tcl_Obj* -NameInNamespaceObj(Tcl_Interp *in, char *name, Tcl_Namespace *ns) { +NameInNamespaceObj(Tcl_Interp *interp, char *name, Tcl_Namespace *ns) { Tcl_Obj *objName; int len; char *p; /*fprintf(stderr,"NameInNamespaceObj %s (%p) ",name,ns);*/ if (!ns) - ns = Tcl_GetCurrentNamespace(in); + ns = Tcl_GetCurrentNamespace(interp); objName = Tcl_NewStringObj(ns->fullName,-1); len = Tcl_GetCharLength(objName); p = ObjStr(objName); @@ -1210,7 +1210,7 @@ static int -GetXOTclClassFromObj(Tcl_Interp *in, register Tcl_Obj *objPtr, +GetXOTclClassFromObj(Tcl_Interp *interp, register Tcl_Obj *objPtr, XOTclClass **cl, int retry) { XOTclObject *obj; XOTclClass *cls = NULL; @@ -1222,7 +1222,7 @@ if (retry) { /* we refer to an existing object; use command resolver */ if (!isAbsolutePath(objName)) { - Tcl_Command cmd = NSFindCommand(in, objName, callingNameSpace(in)); + Tcl_Command cmd = NSFindCommand(interp, objName, callingNameSpace(interp)); /*fprintf(stderr, "GetXOTclClassFromObj %s cmd = %p cl=%p retry=%d\n", objName, cmd, cmd ? XOTclGetClassFromCmdPtr(cmd) : NULL, retry);*/ @@ -1234,7 +1234,7 @@ } if (!cls) { - result = XOTclObjConvertObject(in, objPtr, &obj); + result = XOTclObjConvertObject(interp, objPtr, &obj); if (result == TCL_OK) { cls = XOTclObjectToClass(obj); if (cls) { @@ -1248,20 +1248,20 @@ if (!cls && retry) { Tcl_Obj *ov[3]; - ov[0] = RUNTIME_STATE(in)->theClass->object.cmdName; + ov[0] = RUNTIME_STATE(interp)->theClass->object.cmdName; ov[1] = XOTclGlobalObjects[XOTE___UNKNOWN]; if (isAbsolutePath(objName)) { ov[2] = objPtr; } else { - ov[2] = NameInNamespaceObj(in,objName,callingNameSpace(in)); + ov[2] = NameInNamespaceObj(interp,objName,callingNameSpace(interp)); } INCR_REF_COUNT(ov[2]); /*fprintf(stderr,"+++ calling %s __unknown for %s, objPtr=%s\n", ObjStr(ov[0]), ObjStr(ov[2]), ObjStr(objPtr)); */ - result = Tcl_EvalObjv(in, 3, ov, 0); + result = Tcl_EvalObjv(interp, 3, ov, 0); if (result == TCL_OK) { - result = GetXOTclClassFromObj(in, objPtr, cl, 0); + result = GetXOTclClassFromObj(interp, objPtr, cl, 0); } DECR_REF_COUNT(ov[2]); } @@ -1472,7 +1472,7 @@ */ extern XOTcl_Class* -XOTclIsClass(Tcl_Interp *in, ClientData cd) { +XOTclIsClass(Tcl_Interp *interp, ClientData cd) { if (cd && XOTclObjectIsClass((XOTclObject *)cd)) return (XOTcl_Class*) cd; return 0; @@ -1529,20 +1529,20 @@ } static int -callDestroyMethod(ClientData cd, Tcl_Interp *in, XOTclObject *obj, int flags) { +callDestroyMethod(ClientData cd, Tcl_Interp *interp, XOTclObject *obj, int flags) { int result; /* don't call destroy after exit handler started physical destruction */ - if (RUNTIME_STATE(in)->exitHandlerDestroyRound == + if (RUNTIME_STATE(interp)->exitHandlerDestroyRound == XOTCL_EXITHANDLER_ON_PHYSICAL_DESTROY) return TCL_OK; /* fprintf(stderr," obj %p flags %.4x %d\n",obj, obj->flags, - RUNTIME_STATE(in)->callDestroy);*/ + RUNTIME_STATE(interp)->callDestroy);*/ /* we don't call destroy, if we're in the exit handler during destruction of Object and Class */ - if (!RUNTIME_STATE(in)->callDestroy) { + if (!RUNTIME_STATE(interp)->callDestroy) { obj->flags |= XOTCL_DESTROY_CALLED; /* return TCL_ERROR so that clients know we haven't deleted the associated command yet */ @@ -1556,8 +1556,8 @@ {char *cmdName = ObjStr(obj->cmdName); assert(cmdName != NULL); /*fprintf(stderr,"findCommand %s -> %p obj->id %p\n",cmdName, - Tcl_FindCommand(in, cmdName, NULL, 0),obj->id);*/ - /*assert(Tcl_FindCommand(in, cmdName, NULL, 0) != NULL);*/ + Tcl_FindCommand(interp, cmdName, NULL, 0),obj->id);*/ + /*assert(Tcl_FindCommand(interp, cmdName, NULL, 0) != NULL);*/ /*fprintf(stderr,"callDestroyMethod: %p command to be destroyed '%s' does not exist\n", obj, cmdName);*/ } @@ -1568,17 +1568,17 @@ fprintf(stderr, " command found\n"); PRINTOBJ("callDestroy", obj); #endif - result = callMethod(cd, in, XOTclGlobalObjects[XOTE_DESTROY], 2, 0, flags); + result = callMethod(cd, interp, XOTclGlobalObjects[XOTE_DESTROY], 2, 0, flags); if (result != TCL_OK) { static char cmd[] = "puts stderr \"[self]: Error in instproc destroy\n\ $::errorCode $::errorInfo\""; - Tcl_EvalEx(in, cmd, -1, 0); - if (++RUNTIME_STATE(in)->errorCount > 20) + Tcl_EvalEx(interp, cmd, -1, 0); + if (++RUNTIME_STATE(interp)->errorCount > 20) panic("too many destroy errors occured. Endless loop?", NULL); } else { - if (RUNTIME_STATE(in)->errorCount > 0) - RUNTIME_STATE(in)->errorCount--; + if (RUNTIME_STATE(interp)->errorCount > 0) + RUNTIME_STATE(interp)->errorCount--; } #ifdef OBJDELETION_TRACE @@ -1614,17 +1614,17 @@ static Tcl_Namespace* -NSGetFreshNamespace(Tcl_Interp *in, ClientData cd, char *name); +NSGetFreshNamespace(Tcl_Interp *interp, ClientData cd, char *name); static void -makeObjNamespace(Tcl_Interp *in, XOTclObject *obj) { +makeObjNamespace(Tcl_Interp *interp, XOTclObject *obj) { #ifdef NAMESPACE_TRACE fprintf(stderr, "+++ Make Namespace for %s\n", ObjStr(obj->cmdName)); #endif if (!obj->nsPtr) { Tcl_Namespace* nsPtr; char *cmdName = ObjStr(obj->cmdName); - obj->nsPtr = NSGetFreshNamespace(in, (ClientData)obj, cmdName); + obj->nsPtr = NSGetFreshNamespace(interp, (ClientData)obj, cmdName); if (!obj->nsPtr) panic("makeObjNamespace: Unable to make namespace",0); nsPtr = obj->nsPtr; @@ -1669,29 +1669,29 @@ } /* typedef int (Tcl_ResolveVarProc) _ANSI_ARGS_(( - * Tcl_Interp* in, CONST char * name, Tcl_Namespace *context, + * Tcl_Interp* interp, CONST char * name, Tcl_Namespace *context, * int flags, Tcl_Var *rPtr)); */ int -varResolver(Tcl_Interp *in, CONST char *name, Tcl_Namespace *ns, int flags, Tcl_Var *varPtr) { +varResolver(Tcl_Interp *interp, CONST char *name, Tcl_Namespace *ns, int flags, Tcl_Var *varPtr) { *varPtr = (Tcl_Var)LookupVarFromTable(Tcl_Namespace_varTable(ns), name,NULL); /*fprintf(stderr,"lookup '%s' successful %d\n",name, *varPtr != NULL);*/ return *varPtr ? TCL_OK : TCL_ERROR; } static void -requireObjNamespace(Tcl_Interp *in, XOTclObject *obj) { - if (!obj->nsPtr) makeObjNamespace(in,obj); +requireObjNamespace(Tcl_Interp *interp, XOTclObject *obj) { + if (!obj->nsPtr) makeObjNamespace(interp,obj); /* Tcl_SetNamespaceResolvers(obj->nsPtr, (Tcl_ResolveCmdProc*)NULL, varResolver, (Tcl_ResolveCompiledVarProc*)NULL); */ } extern void -XOTclRequireObjNamespace(Tcl_Interp *in, XOTcl_Object *obj) { - requireObjNamespace(in,(XOTclObject*) obj); +XOTclRequireObjNamespace(Tcl_Interp *interp, XOTcl_Object *obj) { + requireObjNamespace(interp,(XOTclObject*) obj); } @@ -1700,27 +1700,27 @@ */ static int -NSDeleteCmd(Tcl_Interp *in, Tcl_Namespace* ns, char *name) { +NSDeleteCmd(Tcl_Interp *interp, Tcl_Namespace* ns, char *name) { /* a simple deletion would delete a global command with the same name, if the command is not existing, so we use the CmdToken */ Tcl_Command token; assert(ns); if ((token = FindMethod(name, ns))) { - return Tcl_DeleteCommandFromToken(in, token); + return Tcl_DeleteCommandFromToken(interp, token); } return -1; } static void -CallStackDestroyObject(Tcl_Interp *in, XOTclObject *obj); +CallStackDestroyObject(Tcl_Interp *interp, XOTclObject *obj); static void PrimitiveCDestroy(ClientData cd); static void PrimitiveODestroy(ClientData cd); static void -NSDeleteChildren(Tcl_Interp *in, Tcl_Namespace* ns) { +NSDeleteChildren(Tcl_Interp *interp, Tcl_Namespace* ns) { Tcl_HashTable *cmdTable = Tcl_Namespace_cmdTable(ns); Tcl_HashSearch hSrch; Tcl_HashEntry* hPtr; @@ -1729,7 +1729,7 @@ fprintf(stderr, "NSDeleteChildren %s\n", ns->fullName); #endif - Tcl_ForgetImport(in, ns, "*"); /* don't destroy namespace imported objects */ + Tcl_ForgetImport(interp, ns, "*"); /* don't destroy namespace imported objects */ for (hPtr = Tcl_FirstHashEntry(cmdTable, &hSrch); hPtr != 0; hPtr = Tcl_NextHashEntry(&hSrch)) { @@ -1741,13 +1741,13 @@ /* fprintf(stderr, " ... child %s\n", oname); */ ALLOC_NAME_NS(&name, ns->fullName, oname); - obj = XOTclpGetObject(in, Tcl_DStringValue(&name)); + obj = XOTclpGetObject(interp, Tcl_DStringValue(&name)); if (obj) { /* fprintf(stderr, " ... obj= %s\n", ObjStr(obj->cmdName));*/ /* in the exit handler physical destroy --> directly call destroy */ - if (RUNTIME_STATE(in)->exitHandlerDestroyRound + if (RUNTIME_STATE(interp)->exitHandlerDestroyRound == XOTCL_EXITHANDLER_ON_PHYSICAL_DESTROY) { if (XOTclObjectIsClass(obj)) PrimitiveCDestroy((ClientData) obj); @@ -1756,15 +1756,15 @@ } else { if (obj->teardown != 0 && obj->id && !(obj->flags & XOTCL_DESTROY_CALLED)) { - if (callDestroyMethod((ClientData)obj, in, obj, 0) != TCL_OK) { + if (callDestroyMethod((ClientData)obj, interp, obj, 0) != TCL_OK) { /* destroy method failed, but we have to remove the command anyway. */ obj->flags |= XOTCL_DESTROY_CALLED; if (obj->teardown) { - CallStackDestroyObject(in, obj); + CallStackDestroyObject(interp, obj); } - /*(void*) Tcl_DeleteCommandFromToken(in, oid);*/ + /*(void*) Tcl_DeleteCommandFromToken(interp, oid);*/ } } } @@ -1779,30 +1779,30 @@ * if necessary create it. Return Var * if successful, otherwise 0 */ static Var * -NSRequireVariableOnObj(Tcl_Interp *in, XOTclObject *obj, char *name, int flgs) { +NSRequireVariableOnObj(Tcl_Interp *interp, XOTclObject *obj, char *name, int flgs) { XOTcl_FrameDecls; Var *varPtr, *arrayPtr; - XOTcl_PushFrame(in, obj); - varPtr = TclLookupVar(in, name, 0, flgs, "obj vwait", + XOTcl_PushFrame(interp, obj); + varPtr = TclLookupVar(interp, name, 0, flgs, "obj vwait", /*createPart1*/ 1, /*createPart2*/ 0, &arrayPtr); - XOTcl_PopFrame(in, obj); + XOTcl_PopFrame(interp, obj); return varPtr; } /* delete a namespace recursively, but check whether the namespace is an object or not */ static void -NSDeleteNamespace(Tcl_Interp *in, Tcl_Namespace* ns) { +NSDeleteNamespace(Tcl_Interp *interp, Tcl_Namespace* ns) { Tcl_HashTable *childTable = Tcl_Namespace_childTable(ns); Tcl_HashSearch hSrch; Tcl_HashEntry* hPtr; - NSDeleteChildren(in, ns); + NSDeleteChildren(interp, ns); for (hPtr = Tcl_FirstHashEntry(childTable, &hSrch); hPtr != 0; hPtr = Tcl_NextHashEntry(&hSrch)) { Tcl_Namespace *child = ((Tcl_Namespace*)Tcl_GetHashValue(hPtr)); - NSDeleteNamespace(in, child); + NSDeleteNamespace(interp, child); } /* fprintf(stderr, "NSDeleteNamespace deleting %s\n", ns->fullName); @@ -1812,23 +1812,23 @@ } static int -XOTcl_DeleteCommandFromToken(Tcl_Interp *in, Tcl_Command cmd) { - XOTclCallStack *cs = &RUNTIME_STATE(in)->cs; +XOTcl_DeleteCommandFromToken(Tcl_Interp *interp, Tcl_Command cmd) { + XOTclCallStack *cs = &RUNTIME_STATE(interp)->cs; XOTclCallStackContent *csc = cs->top; for (; csc > cs->content; csc--) { if (csc->cmdPtr == cmd) { csc->cmdPtr = NULL; } } - return Tcl_DeleteCommandFromToken(in, cmd); + return Tcl_DeleteCommandFromToken(interp, cmd); } /* * delete all vars & procs in a namespace */ static void -NSCleanupNamespace(Tcl_Interp *in, Tcl_Namespace* ns) { +NSCleanupNamespace(Tcl_Interp *interp, Tcl_Namespace* ns) { TclVarHashTable *varTable = Tcl_Namespace_varTable(ns); Tcl_HashTable *cmdTable = Tcl_Namespace_cmdTable(ns); Tcl_HashSearch hSrch; @@ -1838,7 +1838,7 @@ * Delete all variables and initialize var table again * (deleteVars frees the vartable) */ - TclDeleteVars((Interp *)in, varTable); + TclDeleteVars((Interp *)interp, varTable); InitVarHashTable(varTable, (Namespace *)ns); /* @@ -1851,7 +1851,7 @@ if (!XOTclGetObjectFromCmdPtr(cmd)) { /*fprintf(stderr,"NSCleanupNamespace deleting %s %p\n", Tcl_Command_nsPtr(cmd)->fullName, cmd);*/ - XOTcl_DeleteCommandFromToken(in, cmd); + XOTcl_DeleteCommandFromToken(interp, cmd); } } } @@ -1869,9 +1869,9 @@ } void -XOTcl_DeleteNamespace(Tcl_Interp *in, Tcl_Namespace *nsPtr) { +XOTcl_DeleteNamespace(Tcl_Interp *interp, Tcl_Namespace *nsPtr) { int activationCount = 0; - Tcl_CallFrame *f = (Tcl_CallFrame *)Tcl_Interp_framePtr(in); + Tcl_CallFrame *f = (Tcl_CallFrame *)Tcl_Interp_framePtr(interp); /* fprintf(stderr, " ... correcting ActivationCount for %s was %d ", @@ -1896,8 +1896,8 @@ } static Tcl_Namespace* -NSGetFreshNamespace(Tcl_Interp *in, ClientData cd, char *name) { - Tcl_Namespace *ns = Tcl_FindNamespace(in, name, NULL, 0); +NSGetFreshNamespace(Tcl_Interp *interp, ClientData cd, char *name) { + Tcl_Namespace *ns = Tcl_FindNamespace(interp, name, NULL, 0); if (ns) { if (ns->deleteProc != NULL || ns->clientData != NULL) { @@ -1907,7 +1907,7 @@ ns->clientData = cd; ns->deleteProc = (Tcl_NamespaceDeleteProc*) NSNamespaceDeleteProc; } else { - ns = Tcl_CreateNamespace(in, name, cd, + ns = Tcl_CreateNamespace(interp, name, cd, (Tcl_NamespaceDeleteProc*) NSNamespaceDeleteProc); } MEM_COUNT_ALLOC("TclNamespace",ns); @@ -1937,7 +1937,7 @@ */ XOTCLINLINE static int -NSCheckForParent(Tcl_Interp *in, char *name, unsigned l) { +NSCheckForParent(Tcl_Interp *interp, char *name, unsigned l) { register char *n = name+l; int result = 1; @@ -1953,37 +1953,37 @@ Tcl_DStringAppend(dsp, name, (n-name)); parentName = Tcl_DStringValue(dsp); - if (Tcl_FindNamespace(in, parentName, (Tcl_Namespace *) NULL, TCL_GLOBAL_ONLY) == 0) { - XOTclObject *parentObj = (XOTclObject*) XOTclpGetObject(in, parentName); + if (Tcl_FindNamespace(interp, parentName, (Tcl_Namespace *) NULL, TCL_GLOBAL_ONLY) == 0) { + XOTclObject *parentObj = (XOTclObject*) XOTclpGetObject(interp, parentName); if (parentObj) { /* this is for classes */ - requireObjNamespace(in, parentObj); + requireObjNamespace(interp, parentObj); } else { /* call unknown and try again */ Tcl_Obj *ov[3]; int rc; - ov[0] = RUNTIME_STATE(in)->theClass->object.cmdName; + ov[0] = RUNTIME_STATE(interp)->theClass->object.cmdName; ov[1] = XOTclGlobalObjects[XOTE___UNKNOWN]; ov[2] = Tcl_NewStringObj(parentName,-1); INCR_REF_COUNT(ov[2]); /*fprintf(stderr,"+++ parent... calling __unknown for %s\n", ObjStr(ov[2]));*/ - rc = Tcl_EvalObjv(in, 3, ov, 0); + rc = Tcl_EvalObjv(interp, 3, ov, 0); if (rc == TCL_OK) { - XOTclObject *parentObj = (XOTclObject*) XOTclpGetObject(in, parentName); + XOTclObject *parentObj = (XOTclObject*) XOTclpGetObject(interp, parentName); if (parentObj) { - requireObjNamespace(in, parentObj); + requireObjNamespace(interp, parentObj); } - result = (Tcl_FindNamespace(in, parentName, + result = (Tcl_FindNamespace(interp, parentName, (Tcl_Namespace *) NULL, TCL_GLOBAL_ONLY) != 0); } else { result = 0; } DECR_REF_COUNT(ov[2]); } } else { - XOTclObject *parentObj = (XOTclObject*) XOTclpGetObject(in, parentName); + XOTclObject *parentObj = (XOTclObject*) XOTclpGetObject(interp, parentName); if (parentObj) { - requireObjNamespace(in, parentObj); + requireObjNamespace(interp, parentObj); } } DSTRING_FREE(dsp); @@ -1997,9 +1997,9 @@ * to which they point. */ XOTCLINLINE static Tcl_Command -NSFindCommand(Tcl_Interp *in, char *name, Tcl_Namespace *ns) { +NSFindCommand(Tcl_Interp *interp, char *name, Tcl_Namespace *ns) { Tcl_Command cmd; - if ((cmd = Tcl_FindCommand(in, name, ns, 0))) { + if ((cmd = Tcl_FindCommand(interp, name, ns, 0))) { Tcl_Command importedCmd; if ((importedCmd = TclGetOriginalCommand(cmd))) cmd = importedCmd; @@ -2015,18 +2015,18 @@ extern XOTcl_Object* -XOTclGetObject(Tcl_Interp *in, char *name) { - return (XOTcl_Object*) XOTclpGetObject(in, name); +XOTclGetObject(Tcl_Interp *interp, char *name) { + return (XOTcl_Object*) XOTclpGetObject(interp, name); } /* * Find an object using a char *name */ static XOTclObject* -XOTclpGetObject(Tcl_Interp *in, char *name) { +XOTclpGetObject(Tcl_Interp *interp, char *name) { register Tcl_Command cmd; assert(name); - cmd = NSFindCommand(in, name, NULL); + cmd = NSFindCommand(interp, name, NULL); /*if (cmd) { fprintf(stderr,"+++ XOTclGetObject from %s -> objProc=%p, dispatch=%p\n", @@ -2044,34 +2044,34 @@ */ extern XOTcl_Class* -XOTclGetClass(Tcl_Interp *in, char *name) { - return (XOTcl_Class*)XOTclpGetClass(in, name); +XOTclGetClass(Tcl_Interp *interp, char *name) { + return (XOTcl_Class*)XOTclpGetClass(interp, name); } static XOTclClass* -XOTclpGetClass(Tcl_Interp *in, char *name) { - XOTclObject *obj = XOTclpGetObject(in, name); +XOTclpGetClass(Tcl_Interp *interp, char *name) { + XOTclObject *obj = XOTclpGetObject(interp, name); return (obj && XOTclObjectIsClass(obj)) ? (XOTclClass*)obj : NULL; } void -XOTclAddPMethod(Tcl_Interp *in, XOTcl_Object *obji, char *nm, Tcl_ObjCmdProc* proc, +XOTclAddPMethod(Tcl_Interp *interp, XOTcl_Object *obji, char *nm, Tcl_ObjCmdProc* proc, ClientData cd, Tcl_CmdDeleteProc* dp) { XOTclObject *obj = (XOTclObject*) obji; Tcl_DString newCmd, *cptr = &newCmd; - requireObjNamespace(in, obj); + requireObjNamespace(interp, obj); ALLOC_NAME_NS(cptr, obj->nsPtr->fullName, nm); - Tcl_CreateObjCommand(in, Tcl_DStringValue(cptr), proc, cd, dp); + Tcl_CreateObjCommand(interp, Tcl_DStringValue(cptr), proc, cd, dp); DSTRING_FREE(cptr); } void -XOTclAddIMethod(Tcl_Interp *in, XOTcl_Class *cli, char *nm, +XOTclAddIMethod(Tcl_Interp *interp, XOTcl_Class *cli, char *nm, Tcl_ObjCmdProc* proc, ClientData cd, Tcl_CmdDeleteProc* dp) { XOTclClass *cl = (XOTclClass*) cli; Tcl_DString newCmd, *cptr = &newCmd; ALLOC_NAME_NS(cptr, cl->nsPtr->fullName, nm); - Tcl_CreateObjCommand(in, Tcl_DStringValue(cptr), proc, cd, dp); + Tcl_CreateObjCommand(interp, Tcl_DStringValue(cptr), proc, cd, dp); DSTRING_FREE(cptr); } @@ -2106,7 +2106,7 @@ */ static Tcl_Obj* -AutonameIncr(Tcl_Interp *in, Tcl_Obj *name, XOTclObject *obj, +AutonameIncr(Tcl_Interp *interp, Tcl_Obj *name, XOTclObject *obj, int instanceOpt, int resetOpt) { int valueLength, mustCopy = 1, format = 0; char *valueString, *c; @@ -2118,33 +2118,33 @@ #endif XOTcl_FrameDecls; - XOTcl_PushFrame(in, obj); + XOTcl_PushFrame(interp, obj); if (obj->nsPtr) flgs |= TCL_NAMESPACE_ONLY; - valueObject = Tcl_ObjGetVar2(in, XOTclGlobalObjects[XOTE_AUTONAMES],name, flgs); + valueObject = Tcl_ObjGetVar2(interp, XOTclGlobalObjects[XOTE_AUTONAMES],name, flgs); if (valueObject != NULL ) { long autoname_counter; /* should probably do an overflow check here */ - Tcl_GetLongFromObj(in, valueObject,&autoname_counter); + Tcl_GetLongFromObj(interp, valueObject,&autoname_counter); autoname_counter++; if (Tcl_IsShared(valueObject)) { valueObject = Tcl_DuplicateObj(valueObject); } Tcl_SetLongObj(valueObject,autoname_counter); } - Tcl_ObjSetVar2(in, XOTclGlobalObjects[XOTE_AUTONAMES], name, + Tcl_ObjSetVar2(interp, XOTclGlobalObjects[XOTE_AUTONAMES], name, valueObject, flgs); if (resetOpt) { if (valueObject != NULL) { /* we have an entry */ - Tcl_UnsetVar2(in, XOTclGlobalStrings[XOTE_AUTONAMES], ObjStr(name), flgs); + Tcl_UnsetVar2(interp, XOTclGlobalStrings[XOTE_AUTONAMES], ObjStr(name), flgs); } result = XOTclGlobalObjects[XOTE_EMPTY]; INCR_REF_COUNT(result); } else { if (valueObject == NULL) { - valueObject = Tcl_ObjSetVar2(in, XOTclGlobalObjects[XOTE_AUTONAMES], + valueObject = Tcl_ObjSetVar2(interp, XOTclGlobalObjects[XOTE_AUTONAMES], name, XOTclGlobalObjects[XOTE_ONE], flgs); } if (instanceOpt) { @@ -2185,21 +2185,21 @@ } if (format) { ALLOC_ON_STACK(Tcl_Obj*,3, ov); - savedResult = Tcl_GetObjResult(in); + savedResult = Tcl_GetObjResult(interp); INCR_REF_COUNT(savedResult); ov[0] = XOTclGlobalObjects[XOTE_FORMAT]; ov[1] = result; ov[2] = valueObject; - if (Tcl_EvalObjv(in, 3, ov, 0) != TCL_OK) { - XOTcl_PopFrame(in, obj); + if (Tcl_EvalObjv(interp, 3, ov, 0) != TCL_OK) { + XOTcl_PopFrame(interp, obj); DECR_REF_COUNT(savedResult); FREE_ON_STACK(ov); return 0; } DECR_REF_COUNT(result); - result = Tcl_DuplicateObj(Tcl_GetObjResult(in)); + result = Tcl_DuplicateObj(Tcl_GetObjResult(interp)); INCR_REF_COUNT(result); - Tcl_SetObjResult(in, savedResult); + Tcl_SetObjResult(interp, savedResult); DECR_REF_COUNT(savedResult); FREE_ON_STACK(ov); } else { @@ -2209,7 +2209,7 @@ } } - XOTcl_PopFrame(in, obj); + XOTcl_PopFrame(interp, obj); assert((resetOpt && result->refCount>=1) || (result->refCount == 1)); return result; } @@ -2219,8 +2219,8 @@ */ XOTclCallStackContent * -XOTclCallStackFindLastInvocation(Tcl_Interp *in, int offset) { - XOTclCallStack *cs = &RUNTIME_STATE(in)->cs; +XOTclCallStackFindLastInvocation(Tcl_Interp *interp, int offset) { + XOTclCallStack *cs = &RUNTIME_STATE(interp)->cs; register XOTclCallStackContent *csc = cs->top; int topLevel = csc->currentFramePtr ? Tcl_CallFrame_level(csc->currentFramePtr) :0; int deeper = offset; @@ -2246,8 +2246,8 @@ } static XOTclCallStackContent * -CallStackFindActiveFilter(Tcl_Interp *in) { - XOTclCallStack *cs = &RUNTIME_STATE(in)->cs; +CallStackFindActiveFilter(Tcl_Interp *interp) { + XOTclCallStack *cs = &RUNTIME_STATE(interp)->cs; register XOTclCallStackContent *csc; /* search for first active frame and set tcl frame pointers */ @@ -2259,8 +2259,8 @@ } XOTclCallStackContent * -XOTclCallStackFindActiveFrame(Tcl_Interp *in, int offset) { - XOTclCallStack *cs = &RUNTIME_STATE(in)->cs; +XOTclCallStackFindActiveFrame(Tcl_Interp *interp, int offset) { + XOTclCallStack *cs = &RUNTIME_STATE(interp)->cs; register XOTclCallStackContent *csc; /* search for first active frame and set tcl frame pointers */ @@ -2275,12 +2275,12 @@ } static void -CallStackUseActiveFrames(Tcl_Interp *in, callFrameContext *ctx) { - XOTclCallStackContent *active, *top = RUNTIME_STATE(in)->cs.top; - Tcl_CallFrame *inFramePtr = (Tcl_CallFrame *) Tcl_Interp_varFramePtr(in); +CallStackUseActiveFrames(Tcl_Interp *interp, callFrameContext *ctx) { + XOTclCallStackContent *active, *top = RUNTIME_STATE(interp)->cs.top; + Tcl_CallFrame *inFramePtr = (Tcl_CallFrame *) Tcl_Interp_varFramePtr(interp); - active = XOTclCallStackFindActiveFrame(in, 0); - /*fprintf(stderr,"active %p, varFrame(in) %p, topVarFrame %p, active->curr %p\n", + active = XOTclCallStackFindActiveFrame(interp, 0); + /*fprintf(stderr,"active %p, varFrame(interp) %p, topVarFrame %p, active->curr %p\n", active, inFramePtr, top->currentFramePtr, active? active->currentFramePtr : NULL);*/ @@ -2292,13 +2292,13 @@ Tcl_CallFrame *cf = inFramePtr; /*fprintf(stderr,"active == NULL\n"); */ /* find a proc frame, which is not equal the top level cmd */ - /* XOTclStackDump(in);*/ + /* XOTclStackDump(interp);*/ for (; cf && Tcl_CallFrame_level(cf); cf = Tcl_CallFrame_callerPtr(cf)) { if (Tcl_CallFrame_isProcCallFrame(cf) && cf != top->currentFramePtr) break; } ctx->varFramePtr = inFramePtr; - Tcl_Interp_varFramePtr(in) = (CallFrame *) cf; + Tcl_Interp_varFramePtr(interp) = (CallFrame *) cf; ctx->framesSaved = 1; } else { Tcl_CallFrame *framePtr; @@ -2314,30 +2314,30 @@ else framePtr = active->currentFramePtr; ctx->varFramePtr = inFramePtr; - Tcl_Interp_varFramePtr(in) = (CallFrame *) framePtr; + Tcl_Interp_varFramePtr(interp) = (CallFrame *) framePtr; ctx->framesSaved = 1; } } static void -CallStackRestoreSavedFrames(Tcl_Interp *in, callFrameContext *ctx) { +CallStackRestoreSavedFrames(Tcl_Interp *interp, callFrameContext *ctx) { if (ctx->framesSaved) { - Tcl_Interp_varFramePtr(in) = (CallFrame *)ctx->varFramePtr; - /*RUNTIME_STATE(in)->varFramePtr = ctx->varFramePtr;*/ + Tcl_Interp_varFramePtr(interp) = (CallFrame *)ctx->varFramePtr; + /*RUNTIME_STATE(interp)->varFramePtr = ctx->varFramePtr;*/ } } XOTCLINLINE static int -CallStackPush(Tcl_Interp *in, XOTclObject *obj, XOTclClass *cl, +CallStackPush(Tcl_Interp *interp, XOTclObject *obj, XOTclClass *cl, Tcl_Command cmd, int objc, Tcl_Obj *CONST objv[], int frameType) { XOTclCallStack *cs; register XOTclCallStackContent *csc; - cs = &RUNTIME_STATE(in)->cs; + cs = &RUNTIME_STATE(interp)->cs; if (cs->top >= &cs->content[MAX_NESTING_DEPTH-1]) { - Tcl_SetResult(in, "too many nested calls to Tcl_EvalObj (infinite loop?)", + Tcl_SetResult(interp, "too many nested calls to Tcl_EvalObj (infinite loop?)", TCL_STATIC); return TCL_ERROR; } @@ -2358,29 +2358,29 @@ /*fprintf(stderr, "PUSH obj %s, self=%p cmd=%p (%s) id=%p (%s) frame=%p\n", ObjStr(obj->cmdName), obj, - cmd, (char *) Tcl_GetCommandName(in, cmd), - obj->id, Tcl_GetCommandName(in, obj->id), csc);*/ + cmd, (char *) Tcl_GetCommandName(interp, cmd), + obj->id, Tcl_GetCommandName(interp, obj->id), csc);*/ MEM_COUNT_ALLOC("CallStack",NULL); return TCL_OK; } XOTCLINLINE static void -CallStackDoDestroy(Tcl_Interp *in, XOTclObject *obj) { +CallStackDoDestroy(Tcl_Interp *interp, XOTclObject *obj) { Tcl_Command oid; PRINTOBJ("CallStackDoDestroy", obj); oid = obj->id; obj->id = 0; if (obj->teardown && oid) { - Tcl_DeleteCommandFromToken(in, oid); + Tcl_DeleteCommandFromToken(interp, oid); } } static void -CallStackDestroyObject(Tcl_Interp *in, XOTclObject *obj) { - XOTclCallStack *cs = &RUNTIME_STATE(in)->cs; +CallStackDestroyObject(Tcl_Interp *interp, XOTclObject *obj) { + XOTclCallStack *cs = &RUNTIME_STATE(interp)->cs; XOTclCallStackContent *csc; int countSelfs = 0; Tcl_Command oid = obj->id; @@ -2402,26 +2402,26 @@ find the object destroy */ if (countSelfs == 0) { /*fprintf(stderr,"directdestroy %p\n",obj);*/ - CallStackDoDestroy(in, obj); + CallStackDoDestroy(interp, obj); } else { /*fprintf(stderr,"selfcount for %p = %d\n",obj,countSelfs);*/ /* to prevail the deletion order call delete children now -> children destructors are called before parent's destructor */ if (obj->teardown && obj->nsPtr) { - NSDeleteChildren(in, obj->nsPtr); + NSDeleteChildren(interp, obj->nsPtr); } } } XOTCLINLINE static int -CallStackIsDestroyed(Tcl_Interp *in) { - return (RUNTIME_STATE(in)->cs.top->destroyedCmd == NULL) ? 0 : 1; +CallStackIsDestroyed(Tcl_Interp *interp) { + return (RUNTIME_STATE(interp)->cs.top->destroyedCmd == NULL) ? 0 : 1; } XOTCLINLINE static void -CallStackPop(Tcl_Interp *in) { - XOTclCallStack *cs = &RUNTIME_STATE(in)->cs; +CallStackPop(Tcl_Interp *interp) { + XOTclCallStack *cs = &RUNTIME_STATE(interp)->cs; XOTclCallStackContent *csc; XOTclCallStackContent *h = cs->top; @@ -2443,7 +2443,7 @@ } } if (destroy) { - CallStackDoDestroy(in, csc->self); + CallStackDoDestroy(interp, csc->self); } } @@ -2454,20 +2454,20 @@ XOTCLINLINE static XOTclCallStackContent* -CallStackGetTopFrame(Tcl_Interp *in) { - XOTclCallStack *cs = &RUNTIME_STATE(in)->cs; +CallStackGetTopFrame(Tcl_Interp *interp) { + XOTclCallStack *cs = &RUNTIME_STATE(interp)->cs; return cs->top; } static XOTclCallStackContent* -CallStackGetFrame(Tcl_Interp *in) { - XOTclCallStack *cs = &RUNTIME_STATE(in)->cs; +CallStackGetFrame(Tcl_Interp *interp) { + XOTclCallStack *cs = &RUNTIME_STATE(interp)->cs; register XOTclCallStackContent *top = cs->top; - Tcl_CallFrame *varFramePtr = (Tcl_CallFrame *)Tcl_Interp_varFramePtr(in); + Tcl_CallFrame *varFramePtr = (Tcl_CallFrame *)Tcl_Interp_varFramePtr(interp); - /* fprintf(stderr, "Tcl_Interp_framePtr(in) %p != varFramePtr %p && top->currentFramePtr %p\n", Tcl_Interp_framePtr(in), varFramePtr, top->currentFramePtr);*/ + /* fprintf(stderr, "Tcl_Interp_framePtr(interp) %p != varFramePtr %p && top->currentFramePtr %p\n", Tcl_Interp_framePtr(interp), varFramePtr, top->currentFramePtr);*/ - if (Tcl_Interp_framePtr(in) != varFramePtr && top->currentFramePtr) { + if (Tcl_Interp_framePtr(interp) != varFramePtr && top->currentFramePtr) { XOTclCallStackContent *bot = cs->content + 1; /*fprintf(stderr, "uplevel\n");*/ /* we are in a uplevel */ @@ -2542,14 +2542,14 @@ #if 0 /** for debug purposes only */ static void -CmdListPrint(Tcl_Interp *in, char *title, XOTclCmdList *cmdList) { +CmdListPrint(Tcl_Interp *interp, char *title, XOTclCmdList *cmdList) { if (cmdList) fprintf(stderr,title); while (cmdList) { fprintf(stderr, " CL=%p, cmdPtr=%p %s, clorobj %p, clientData=%p\n", cmdList, cmdList->cmdPtr, - in ? Tcl_GetCommandName(in, cmdList->cmdPtr) : "", + in ? Tcl_GetCommandName(interp, cmdList->cmdPtr) : "", cmdList->clorobj, cmdList->clientData); cmdList = cmdList->next; @@ -2675,10 +2675,10 @@ * for a simple Name */ static XOTclCmdList* -CmdListFindNameInList(Tcl_Interp *in, char *name, XOTclCmdList* l) { +CmdListFindNameInList(Tcl_Interp *interp, char *name, XOTclCmdList* l) { register XOTclCmdList* h = l; while (h != 0) { - CONST84 char *cmdName = Tcl_GetCommandName(in, h->cmdPtr); + CONST84 char *cmdName = Tcl_GetCommandName(interp, h->cmdPtr); if (cmdName[0] == name[0] && !strcmp(cmdName, name)) return h; h = h->next; @@ -2690,11 +2690,11 @@ * Assertions */ static XOTclTclObjList* -AssertionNewList(Tcl_Interp *in, Tcl_Obj *aObj) { +AssertionNewList(Tcl_Interp *interp, Tcl_Obj *aObj) { Tcl_Obj **ov; int oc; XOTclTclObjList *last = NULL; - if (Tcl_ListObjGetElements(in, aObj, &oc, &ov) == TCL_OK) { + if (Tcl_ListObjGetElements(interp, aObj, &oc, &ov) == TCL_OK) { if (oc > 0) { int i; for (i=oc-1; i>=0; i--) { @@ -2706,7 +2706,7 @@ } static Tcl_Obj* -AssertionList(Tcl_Interp *in, XOTclTclObjList* alist) { +AssertionList(Tcl_Interp *interp, XOTclTclObjList* alist) { Tcl_Obj *newAssStr = Tcl_NewStringObj("",0); for (; alist!=NULL; alist = alist->next) { Tcl_AppendStringsToObj(newAssStr, "{", ObjStr(alist->content), @@ -2720,10 +2720,10 @@ /* append a string of pre and post assertions to a proc or instproc body */ static void -AssertionAppendPrePost(Tcl_Interp *in, Tcl_DString *dsPtr, XOTclProcAssertion *procs) { +AssertionAppendPrePost(Tcl_Interp *interp, Tcl_DString *dsPtr, XOTclProcAssertion *procs) { if (procs) { - Tcl_Obj *preAss = AssertionList(in, procs->pre); - Tcl_Obj *postAss = AssertionList(in, procs->post); + Tcl_Obj *preAss = AssertionList(interp, procs->pre); + Tcl_Obj *postAss = AssertionList(interp, procs->post); INCR_REF_COUNT(preAss); INCR_REF_COUNT(postAss); Tcl_DStringAppendElement(dsPtr, ObjStr(preAss)); Tcl_DStringAppendElement(dsPtr, ObjStr(postAss)); @@ -2732,18 +2732,18 @@ } static int -AssertionListCheckOption(Tcl_Interp *in, XOTclObject *obj) { +AssertionListCheckOption(Tcl_Interp *interp, XOTclObject *obj) { XOTclObjectOpt *opt = obj->opt; if (!opt) return TCL_OK; if (opt->checkoptions & CHECK_OBJINVAR) - Tcl_AppendElement(in, "invar"); + Tcl_AppendElement(interp, "invar"); if (opt->checkoptions & CHECK_CLINVAR) - Tcl_AppendElement(in, "instinvar"); + Tcl_AppendElement(interp, "instinvar"); if (opt->checkoptions & CHECK_PRE) - Tcl_AppendElement(in, "pre"); + Tcl_AppendElement(interp, "pre"); if (opt->checkoptions & CHECK_POST) - Tcl_AppendElement(in, "post"); + Tcl_AppendElement(interp, "post"); return TCL_OK; } @@ -2773,15 +2773,15 @@ } static void -AssertionAddProc(Tcl_Interp *in, char *name, XOTclAssertionStore* aStore, +AssertionAddProc(Tcl_Interp *interp, char *name, XOTclAssertionStore* aStore, Tcl_Obj *pre, Tcl_Obj *post) { int nw = 0; Tcl_HashEntry* hPtr = NULL; XOTclProcAssertion *procs = NEW(XOTclProcAssertion); AssertionRemoveProc(aStore, name); - procs->pre = AssertionNewList(in, pre); - procs->post = AssertionNewList(in, post); + procs->pre = AssertionNewList(interp, pre); + procs->post = AssertionNewList(interp, post); hPtr = Tcl_CreateHashEntry(&aStore->procs, name, &nw); if (nw) Tcl_SetHashValue(hPtr, (ClientData)procs); } @@ -2822,23 +2822,23 @@ * it's the responsiblity of the caller to push the intended callframe */ static int -checkConditionInScope(Tcl_Interp *in, Tcl_Obj *condition) { +checkConditionInScope(Tcl_Interp *interp, Tcl_Obj *condition) { int result, success; Tcl_Obj *ov[2]; ov [1] = condition; INCR_REF_COUNT(condition); /* fprintf(stderr, "----- evaluating condition '%s'\n", ObjStr(condition)); */ - result = XOTcl_ExprObjCmd(NULL, in, 2, ov); + result = XOTcl_ExprObjCmd(NULL, interp, 2, ov); DECR_REF_COUNT(condition); /* fprintf(stderr, "----- running condition '%s', result=%d '%s'\n", ObjStr(condition), result, - ObjStr(Tcl_GetObjResult(in))); + ObjStr(Tcl_GetObjResult(interp))); */ if (result == TCL_OK) { - result = Tcl_GetIntFromObj(in,Tcl_GetObjResult(in),&success); + result = Tcl_GetIntFromObj(interp,Tcl_GetObjResult(interp),&success); /* fprintf(stderr, " success=%d\n", success); */ @@ -2849,10 +2849,10 @@ } static int -AssertionCheckList(Tcl_Interp *in, XOTclObject *obj, +AssertionCheckList(Tcl_Interp *interp, XOTclObject *obj, XOTclTclObjList* alist, char *methodName) { XOTclTclObjList* checkFailed = NULL; - Tcl_Obj *savedObjResult = Tcl_GetObjResult(in); + Tcl_Obj *savedObjResult = Tcl_GetObjResult(interp); int savedCheckoptions, acResult = TCL_OK; /* @@ -2870,7 +2870,7 @@ INCR_REF_COUNT(savedObjResult); - Tcl_ResetResult(in); + Tcl_ResetResult(interp); while (alist != NULL) { /* Eval instead of IfObjCmd => the substitutions in the @@ -2886,8 +2886,8 @@ } if (!comment) { XOTcl_FrameDecls; - XOTcl_PushFrame(in, obj); - CallStackPush(in, obj, 0, 0, 0, 0, XOTCL_CSC_TYPE_PLAIN); + XOTcl_PushFrame(interp, obj); + CallStackPush(interp, obj, 0, 0, 0, 0, XOTCL_CSC_TYPE_PLAIN); /* don't check assertion during assertion check */ savedCheckoptions = obj->opt->checkoptions; @@ -2898,16 +2898,16 @@ /* * now check the assertion in the pushed callframe's scope */ - acResult = checkConditionInScope(in, alist->content); + acResult = checkConditionInScope(interp, alist->content); if (acResult != TCL_OK) checkFailed = alist; obj->opt->checkoptions = savedCheckoptions; /*fprintf(stderr, "...%s\n", checkFailed ? "failed" : "ok");*/ - CallStackPop(in); - XOTcl_PopFrame(in,obj); + CallStackPop(interp); + XOTcl_PopFrame(interp,obj); } if (checkFailed) break; @@ -2917,31 +2917,31 @@ if (checkFailed != NULL) { DECR_REF_COUNT(savedObjResult); if (acResult == TCL_ERROR) { - Tcl_Obj *sr = Tcl_GetObjResult(in); + Tcl_Obj *sr = Tcl_GetObjResult(interp); INCR_REF_COUNT(sr); - XOTclVarErrMsg(in, "Error in Assertion: {", + XOTclVarErrMsg(interp, "Error in Assertion: {", ObjStr(checkFailed->content), "} in proc '", - GetSelfProc(in), "'\n\n", ObjStr(sr), (char *) NULL); + GetSelfProc(interp), "'\n\n", ObjStr(sr), (char *) NULL); DECR_REF_COUNT(sr); return TCL_ERROR; } - return XOTclVarErrMsg(in, "Assertion failed check: {", + return XOTclVarErrMsg(interp, "Assertion failed check: {", ObjStr(checkFailed->content), "} in proc '", - GetSelfProc(in), "'", (char *) NULL); + GetSelfProc(interp), "'", (char *) NULL); } - Tcl_SetObjResult(in, savedObjResult); + Tcl_SetObjResult(interp, savedObjResult); DECR_REF_COUNT(savedObjResult); return TCL_OK; } static int -AssertionCheckInvars(Tcl_Interp *in, XOTclObject *obj, char *method, +AssertionCheckInvars(Tcl_Interp *interp, XOTclObject *obj, char *method, CheckOptions checkoptions) { int result = TCL_OK; if (checkoptions & CHECK_OBJINVAR && obj->opt->assertions) { - result = AssertionCheckList(in, obj, obj->opt->assertions->invariants, + result = AssertionCheckList(interp, obj, obj->opt->assertions->invariants, method); } @@ -2951,7 +2951,7 @@ while (clPtr != 0 && result != TCL_ERROR) { XOTclAssertionStore* aStore = (clPtr->cl->opt) ? clPtr->cl->opt->assertions : 0; if (aStore) { - result = AssertionCheckList(in, obj, aStore->invariants, method); + result = AssertionCheckList(interp, obj, aStore->invariants, method); } clPtr = clPtr->next; } @@ -2960,7 +2960,7 @@ } static int -AssertionCheck(Tcl_Interp *in, XOTclObject *obj, XOTclClass *cl, +AssertionCheck(Tcl_Interp *interp, XOTclObject *obj, XOTclClass *cl, char *method, int checkOption) { XOTclProcAssertion* procs; int result = TCL_OK; @@ -2978,15 +2978,15 @@ if (procs) { switch (checkOption) { case CHECK_PRE: - result = AssertionCheckList(in, obj, procs->pre, method); + result = AssertionCheckList(interp, obj, procs->pre, method); break; case CHECK_POST: - result = AssertionCheckList(in, obj, procs->post, method); + result = AssertionCheckList(interp, obj, procs->post, method); break; } } if (result != TCL_ERROR) - result = AssertionCheckInvars(in, obj, method, obj->opt->checkoptions); + result = AssertionCheckInvars(interp, obj, method, obj->opt->checkoptions); } return result; } @@ -3025,7 +3025,7 @@ * superclasses to 'mixinClasses' list from a given mixinList */ static void -MixinComputeOrderFullList(Tcl_Interp *in, XOTclCmdList **mixinList, +MixinComputeOrderFullList(Tcl_Interp *interp, XOTclCmdList **mixinList, XOTclClasses **mixinClasses, XOTclClasses **checkList, int level) { XOTclCmdList *m; @@ -3039,7 +3039,7 @@ if (mCl) { for (pl = ComputeOrder(mCl, mCl->order, Super); pl; pl = pl->next) { /*fprintf(stderr, " %s, ", ObjStr(pl->cl->object.cmdName));*/ - if (!(pl->cl == RUNTIME_STATE(in)->theObject)) { + if (!(pl->cl == RUNTIME_STATE(interp)->theObject)) { XOTclClassOpt* opt = pl->cl->opt; if (opt && opt->instmixins != 0) { /* compute transitively the instmixin classes of this added @@ -3059,7 +3059,7 @@ /*fprintf(stderr, "+++ transitive %s\n", ObjStr(pl->cl->object.cmdName));*/ - MixinComputeOrderFullList(in, &opt->instmixins, mixinClasses, + MixinComputeOrderFullList(interp, &opt->instmixins, mixinClasses, checkList, level+1); } } @@ -3092,7 +3092,7 @@ * final list. */ static void -MixinComputeOrder(Tcl_Interp *in, XOTclObject *obj) { +MixinComputeOrder(Tcl_Interp *interp, XOTclObject *obj) { XOTclClasses *fullList, *checkList=0, *mixinClasses = 0, *nextCl, *pl, *checker, *guardChecker; @@ -3101,15 +3101,15 @@ /* append per-obj mixins */ if (obj->opt) { - MixinComputeOrderFullList(in, &obj->opt->mixins, &mixinClasses, + MixinComputeOrderFullList(interp, &obj->opt->mixins, &mixinClasses, &checkList, 0); } /* append per-class mixins */ for (pl = ComputeOrder(obj->cl, obj->cl->order, Super); pl; pl = pl->next) { XOTclClassOpt* opt = pl->cl->opt; if (opt && opt->instmixins) { - MixinComputeOrderFullList(in, &opt->instmixins, &mixinClasses, + MixinComputeOrderFullList(interp, &opt->instmixins, &mixinClasses, &checkList, 0); } } @@ -3160,37 +3160,37 @@ /* ... and free the memory of the full list */ XOTclFreeClasses(fullList); - /*CmdListPrint(in,"mixin order\n", obj->mixinOrder);*/ + /*CmdListPrint(interp,"mixin order\n", obj->mixinOrder);*/ } /* * add a mixin class to 'mixinList' by appending it */ static int -MixinAdd(Tcl_Interp *in, XOTclCmdList **mixinList, Tcl_Obj *name) { +MixinAdd(Tcl_Interp *interp, XOTclCmdList **mixinList, Tcl_Obj *name) { XOTclClass *mixin; Tcl_Obj *guard = NULL; int ocName; Tcl_Obj **ovName; XOTclCmdList* new; - if (Tcl_ListObjGetElements(in, name, &ocName, &ovName) == TCL_OK && ocName > 1) { + if (Tcl_ListObjGetElements(interp, name, &ocName, &ovName) == TCL_OK && ocName > 1) { if (ocName == 3 && !strcmp(ObjStr(ovName[1]), XOTclGlobalStrings[XOTE_GUARD_OPTION])) { name = ovName[0]; guard = ovName[2]; /*fprintf(stderr,"mixinadd name = '%s', guard = '%s'\n", ObjStr(name), ObjStr(guard));*/ - } /*else return XOTclVarErrMsg(in, "mixin registration '", ObjStr(name), + } /*else return XOTclVarErrMsg(interp, "mixin registration '", ObjStr(name), "' has too many elements.", (char *) NULL);*/ } - if (GetXOTclClassFromObj(in, name, &mixin, 1) != TCL_OK) - return XOTclErrBadVal(in, "mixin", "a class as mixin", ObjStr(name)); + if (GetXOTclClassFromObj(interp, name, &mixin, 1) != TCL_OK) + return XOTclErrBadVal(interp, "mixin", "a class as mixin", ObjStr(name)); new = CmdListAdd(mixinList, mixin->object.id, NULL, /*noDuplicates*/ 1); if (guard) { - GuardAdd(in, new, guard); + GuardAdd(interp, new, guard); } else { if (new->clientData) GuardDel(new); @@ -3230,19 +3230,19 @@ */ static void -getAllMixinofs(Tcl_Interp *in, Tcl_HashTable *destTable, XOTclClass *startCl) { +getAllMixinofs(Tcl_Interp *interp, Tcl_HashTable *destTable, XOTclClass *startCl) { if (startCl->opt) { XOTclClass *cl; XOTclCmdList *m; int new; for (m = startCl->opt->mixinofs; m; m = m->next) { - Tcl_CreateHashEntry(destTable, Tcl_GetCommandName(in,m->cmdPtr), &new); - /*if (new) fprintf (stderr, " -- %s (%s)\n", Tcl_GetCommandName(in,m->cmdPtr), ObjStr(startCl->object.cmdName));*/ + Tcl_CreateHashEntry(destTable, Tcl_GetCommandName(interp,m->cmdPtr), &new); + /*if (new) fprintf (stderr, " -- %s (%s)\n", Tcl_GetCommandName(interp,m->cmdPtr), ObjStr(startCl->object.cmdName));*/ cl = XOTclGetClassFromCmdPtr(m->cmdPtr); if (cl) { - getAllMixinofs(in, destTable, cl); + getAllMixinofs(interp, destTable, cl); } } } @@ -3323,7 +3323,7 @@ * invalidate mixin entries in all dependent instances */ static void -MixinInvalidateObjOrders(Tcl_Interp *in, XOTclClass *cl) { +MixinInvalidateObjOrders(Tcl_Interp *interp, XOTclClass *cl) { XOTclClasses *saved = cl->order, *clPtr; Tcl_HashSearch hSrch; Tcl_HashEntry *hPtr; @@ -3360,12 +3360,12 @@ */ Tcl_InitHashTable(commandTable, TCL_STRING_KEYS); MEM_COUNT_ALLOC("Tcl_InitHashTable",commandTable); - /*getAllInstances(commandTable, RUNTIME_STATE(in)->theClass);*/ - getAllMixinofs(in, commandTable, cl); + /*getAllInstances(commandTable, RUNTIME_STATE(interp)->theClass);*/ + getAllMixinofs(interp, commandTable, cl); hPtr = Tcl_FirstHashEntry(commandTable, &hSrch); while (hPtr) { char *key = Tcl_GetHashKey(commandTable, hPtr); - obj = XOTclpGetObject(in, key); + obj = XOTclpGetObject(interp, key); if (obj && !XOTclObjectIsClass(obj) && !(obj->flags & XOTCL_DESTROY_CALLED) @@ -3386,7 +3386,7 @@ Tcl_DeleteHashTable(commandTable); #endif } -static int MixinInfo(Tcl_Interp *in, XOTclCmdList* m, char *pattern, int withGuards); +static int MixinInfo(Tcl_Interp *interp, XOTclCmdList* m, char *pattern, int withGuards); /* * the mixin order is either * DEFINED (there are mixins on the instance), @@ -3397,8 +3397,8 @@ * and set the instance to DEFINE or NONE */ static void -MixinComputeDefined(Tcl_Interp *in, XOTclObject *obj) { - MixinComputeOrder(in, obj); +MixinComputeDefined(Tcl_Interp *interp, XOTclObject *obj) { + MixinComputeOrder(interp, obj); obj->flags |= XOTCL_MIXIN_ORDER_VALID; if (obj->mixinOrder) obj->flags |= XOTCL_MIXIN_ORDER_DEFINED; @@ -3413,17 +3413,17 @@ * precondition: obj->mixinStack is not NULL */ static void -MixinSeekCurrent(Tcl_Interp *in, XOTclObject *obj, XOTclCmdList **cmdList) { +MixinSeekCurrent(Tcl_Interp *interp, XOTclObject *obj, XOTclCmdList **cmdList) { Tcl_Command currentCmdPtr; /* ensure that the mixin order is not invalid, otherwise compute order */ assert(obj->flags & XOTCL_MIXIN_ORDER_VALID); - /*MixinComputeDefined(in, obj);*/ + /*MixinComputeDefined(interp, obj);*/ currentCmdPtr = obj->mixinStack->currentCmdPtr; /* { - XOTclCallStack *cs = &RUNTIME_STATE(in)->cs; + XOTclCallStack *cs = &RUNTIME_STATE(interp)->cs; XOTclCallStackContent *csc = cs->top; fprintf(stderr, "%p == %p ==> %d \n", csc->cl, currentCmdPtr, csc->cmdPtr == currentCmdPtr); @@ -3433,8 +3433,8 @@ /*** { Tcl_Obj *sr; - MixinInfo(in, obj->mixinOrder, NULL,0); - sr = Tcl_GetObjResult(in); + MixinInfo(interp, obj->mixinOrder, NULL,0); + sr = Tcl_GetObjResult(interp); fprintf(stderr,"INFO->%s order %p next %p\n",ObjStr(sr), obj->mixinOrder, obj->mixinOrder->next); } ***/ @@ -3444,12 +3444,12 @@ fprintf(stderr, "->1 mixin seek current = %p next = %p %s\n", currentCmdPtr, (*cmdList)->next, - (*cmdList)->next ? Tcl_GetCommandName(in, (*cmdList)->next->cmdPtr) : ""); + (*cmdList)->next ? Tcl_GetCommandName(interp, (*cmdList)->next->cmdPtr) : ""); */ #if defined(ACTIVEMIXIN) - /*RUNTIME_STATE(in)->cmdPtr = (*cmdList)->next ? (*cmdList)->next->cmdPtr : NULL;*/ - RUNTIME_STATE(in)->cmdPtr = (*cmdList)->cmdPtr; + /*RUNTIME_STATE(interp)->cmdPtr = (*cmdList)->next ? (*cmdList)->next->cmdPtr : NULL;*/ + RUNTIME_STATE(interp)->cmdPtr = (*cmdList)->cmdPtr; #endif /* go forward to current class */ @@ -3460,8 +3460,8 @@ *cmdList = (*cmdList)->next; #if defined(ACTIVEMIXIN) - /*RUNTIME_STATE(in)->cmdPtr = (*cmdList)->next ? (*cmdList)->next->cmdPtr : NULL;*/ - RUNTIME_STATE(in)->cmdPtr = (*cmdList)->cmdPtr; + /*RUNTIME_STATE(interp)->cmdPtr = (*cmdList)->next ? (*cmdList)->next->cmdPtr : NULL;*/ + RUNTIME_STATE(interp)->cmdPtr = (*cmdList)->cmdPtr; #endif } } @@ -3471,7 +3471,7 @@ * current mixin and the relevant calling information */ static Tcl_Command -MixinSearchProc(Tcl_Interp *in, XOTclObject *obj, char *methodName, +MixinSearchProc(Tcl_Interp *interp, XOTclObject *obj, char *methodName, XOTclClass **cl, Tcl_ObjCmdProc **proc, ClientData* cp, Tcl_Command* currentCmdPtr) { Tcl_Command cmd = NULL; @@ -3481,12 +3481,12 @@ assert(obj); assert(obj->mixinStack); - MixinSeekCurrent(in, obj, &cmdList); + MixinSeekCurrent(interp, obj, &cmdList); /* fprintf(stderr, "MixinSearch searching for '%s' %p\n", methodName,cmdList); */ - /*CmdListPrint(in,"MixinSearch CL = \n", cmdList);*/ + /*CmdListPrint(interp,"MixinSearch CL = \n", cmdList);*/ while (cmdList) { @@ -3503,8 +3503,8 @@ int guardOk = TCL_OK; cmd = FindMethod(methodName, cls->nsPtr); if (cmd && cmdList->clientData) { - if (!RUNTIME_STATE(in)->cs.guardCount) { - guardOk = GuardCall(obj, cls, (Tcl_Command) cmd, in, cmdList->clientData, 1); + if (!RUNTIME_STATE(interp)->cs.guardCount) { + guardOk = GuardCall(obj, cls, (Tcl_Command) cmd, interp, cmdList->clientData, 1); } } if (cmd && guardOk == TCL_OK) { @@ -3531,7 +3531,7 @@ * info option for mixins and instmixins */ static int -MixinInfo(Tcl_Interp *in, XOTclCmdList* m, char *pattern, int withGuards) { +MixinInfo(Tcl_Interp *interp, XOTclCmdList* m, char *pattern, int withGuards) { Tcl_Obj *list = Tcl_NewListObj(0, NULL); XOTclClass *mixinClass; while (m) { @@ -3543,16 +3543,16 @@ if (withGuards && m->clientData) { Tcl_Obj *l = Tcl_NewListObj(0, NULL); Tcl_Obj *g = (Tcl_Obj*) m->clientData; - Tcl_ListObjAppendElement(in, l, mixinClass->object.cmdName); - Tcl_ListObjAppendElement(in, l, XOTclGlobalObjects[XOTE_GUARD_OPTION]); - Tcl_ListObjAppendElement(in, l, g); - Tcl_ListObjAppendElement(in, list, l); + Tcl_ListObjAppendElement(interp, l, mixinClass->object.cmdName); + Tcl_ListObjAppendElement(interp, l, XOTclGlobalObjects[XOTE_GUARD_OPTION]); + Tcl_ListObjAppendElement(interp, l, g); + Tcl_ListObjAppendElement(interp, list, l); } else - Tcl_ListObjAppendElement(in, list, mixinClass->object.cmdName); + Tcl_ListObjAppendElement(interp, list, mixinClass->object.cmdName); } m = m->next; } - Tcl_SetObjResult(in, list); + Tcl_SetObjResult(interp, list); return TCL_OK; } @@ -3561,7 +3561,7 @@ */ static int -MixinOfInfo(Tcl_Interp *in, XOTclCmdList* m, char *pattern) { +MixinOfInfo(Tcl_Interp *interp, XOTclCmdList* m, char *pattern) { Tcl_Obj *list = Tcl_NewListObj(0, NULL); XOTclObject *mixinObject; while (m) { @@ -3570,20 +3570,20 @@ if (mixinObject && (!pattern || Tcl_StringMatch(ObjStr(mixinObject->cmdName), pattern))) { - Tcl_ListObjAppendElement(in, list, mixinObject->cmdName); + Tcl_ListObjAppendElement(interp, list, mixinObject->cmdName); } m = m->next; } - Tcl_SetObjResult(in, list); + Tcl_SetObjResult(interp, list); return TCL_OK; } static Tcl_Command -MixinSearchMethodByName(Tcl_Interp *in, XOTclCmdList* mixinList, char *name, XOTclClass **cl) { +MixinSearchMethodByName(Tcl_Interp *interp, XOTclCmdList* mixinList, char *name, XOTclClass **cl) { Tcl_Command cmd; while (mixinList) { XOTclClass *mcl = - XOTclpGetClass(in, (char *) Tcl_GetCommandName(in, mixinList->cmdPtr)); + XOTclpGetClass(interp, (char *) Tcl_GetCommandName(interp, mixinList->cmdPtr)); if (mcl && SearchCMethod(mcl, name, &cmd)) { if (cl) *cl = mcl; return cmd; @@ -3609,7 +3609,7 @@ */ static Tcl_Command -FilterSearch(Tcl_Interp *in, char *name, XOTclObject *startingObj, +FilterSearch(Tcl_Interp *interp, char *name, XOTclObject *startingObj, XOTclClass *startingCl, XOTclClass **cl) { Tcl_Command cmd = NULL; @@ -3626,7 +3626,7 @@ * search for filters on object mixins */ if (opt && opt->mixins) { - if ((cmd = MixinSearchMethodByName(in, opt->mixins, name, cl))) { + if ((cmd = MixinSearchMethodByName(interp, opt->mixins, name, cl))) { return cmd; } } @@ -3638,7 +3638,7 @@ if (startingCl) { XOTclClassOpt* opt = startingCl->opt; if (opt && opt->instmixins) { - if ((cmd = MixinSearchMethodByName(in, opt->instmixins, name, cl))) { + if ((cmd = MixinSearchMethodByName(interp, opt->instmixins, name, cl))) { return cmd; } } @@ -3675,10 +3675,10 @@ /* check a filter guard, return 1 if ok */ static int -GuardCheck(Tcl_Interp *in, ClientData clientData) { +GuardCheck(Tcl_Interp *interp, ClientData clientData) { Tcl_Obj *guard = (Tcl_Obj*) clientData; int rc; - XOTclCallStack *cs = &RUNTIME_STATE(in)->cs; + XOTclCallStack *cs = &RUNTIME_STATE(interp)->cs; if (guard) { /* @@ -3690,7 +3690,7 @@ /*fprintf(stderr, "checking guard **%s**\n", ObjStr(guard));*/ cs->guardCount++; - rc = checkConditionInScope(in, guard); + rc = checkConditionInScope(interp, guard); cs->guardCount--; /*fprintf(stderr, "checking guard **%s** returned rc=%d\n", @@ -3700,12 +3700,12 @@ /* fprintf(stderr, " +++ OK\n"); */ return TCL_OK; } else if (rc == TCL_ERROR) { - Tcl_Obj *sr = Tcl_GetObjResult(in); + Tcl_Obj *sr = Tcl_GetObjResult(interp); INCR_REF_COUNT(sr); /* fprintf(stderr, " +++ ERROR\n");*/ - XOTclVarErrMsg(in, "Guard Error: '", ObjStr(guard), "'\n\n", + XOTclVarErrMsg(interp, "Guard Error: '", ObjStr(guard), "'\n\n", ObjStr(sr), (char *) NULL); DECR_REF_COUNT(sr); return TCL_ERROR; @@ -3719,7 +3719,7 @@ /* static void - GuardPrint(Tcl_Interp *in, ClientData clientData) { + GuardPrint(Tcl_Interp *interp, ClientData clientData) { Tcl_Obj *guard = (TclObj*) clientData; fprintf(stderr, " +++ \n"); if (guard) { @@ -3740,7 +3740,7 @@ } XOTCLINLINE static void -GuardAdd(Tcl_Interp *in, XOTclCmdList* CL, Tcl_Obj *guard) { +GuardAdd(Tcl_Interp *interp, XOTclCmdList* CL, Tcl_Obj *guard) { if (guard) { GuardDel(CL); if (strlen(ObjStr(guard)) != 0) { @@ -3754,53 +3754,53 @@ } /* static void - GuardAddList(Tcl_Interp *in, XOTclCmdList* dest, ClientData source) { + GuardAddList(Tcl_Interp *interp, XOTclCmdList* dest, ClientData source) { XOTclTclObjList* s = (XOTclTclObjList*) source; while (s) { - GuardAdd(in, dest, (Tcl_Obj*) s->content); + GuardAdd(interp, dest, (Tcl_Obj*) s->content); s = s->next; } } */ static int GuardCall(XOTclObject *obj, XOTclClass *cl, Tcl_Command cmd, - Tcl_Interp *in, ClientData clientData, int push) { + Tcl_Interp *interp, ClientData clientData, int push) { int rc = TCL_OK; if (clientData) { - Tcl_Obj *res = Tcl_GetObjResult(in); /* save the result */ + Tcl_Obj *res = Tcl_GetObjResult(interp); /* save the result */ INCR_REF_COUNT(res); - /* GuardPrint(in, cmdList->clientData); */ + /* GuardPrint(interp, cmdList->clientData); */ /* * ok, there is a guard ... we have to push a * fake callframe on the tcl stack so that uplevel * is in sync with the XOTcl callstack, and we can uplevel * into the above pushed CallStack entry */ if (push) { - CallStackPush(in, obj, cl, cmd, 0, 0, XOTCL_CSC_TYPE_GUARD); - rc = GuardCheck(in, clientData); - CallStackPop(in); + CallStackPush(interp, obj, cl, cmd, 0, 0, XOTCL_CSC_TYPE_GUARD); + rc = GuardCheck(interp, clientData); + CallStackPop(interp); } else { - rc = GuardCheck(in, clientData); + rc = GuardCheck(interp, clientData); } - Tcl_SetObjResult(in, res); /* restore the result */ + Tcl_SetObjResult(interp, res); /* restore the result */ DECR_REF_COUNT(res); } return rc; } static int -GuardAddFromDefinitionList(Tcl_Interp *in, XOTclCmdList* dest, +GuardAddFromDefinitionList(Tcl_Interp *interp, XOTclCmdList* dest, XOTclObject *obj, Tcl_Command interceptorCmd, XOTclCmdList* interceptorDefList) { XOTclCmdList* h; if (interceptorDefList != 0) { h = CmdListFindCmdInList(interceptorCmd, interceptorDefList); if (h) { - GuardAdd(in, dest, (Tcl_Obj*) h->clientData); + GuardAdd(interp, dest, (Tcl_Obj*) h->clientData); /* * 1 means we have added a guard successfully "interceptorCmd" */ @@ -3814,22 +3814,22 @@ } static void -GuardAddInheritedGuards(Tcl_Interp *in, XOTclCmdList* dest, +GuardAddInheritedGuards(Tcl_Interp *interp, XOTclCmdList* dest, XOTclObject *obj, Tcl_Command filterCmd) { XOTclClasses* pl; int guardAdded = 0; XOTclObjectOpt *opt; /* search guards for instfilters registered on mixins */ if (!(obj->flags & XOTCL_MIXIN_ORDER_VALID)) - MixinComputeDefined(in, obj); + MixinComputeDefined(interp, obj); if (obj->flags & XOTCL_MIXIN_ORDER_DEFINED_AND_VALID) { XOTclCmdList *ml = obj->mixinOrder; XOTclClass *mixin; while (ml && ! guardAdded) { mixin = XOTclGetClassFromCmdPtr(ml->cmdPtr); if (mixin && mixin->opt) { - guardAdded = GuardAddFromDefinitionList(in, dest, obj, filterCmd, + guardAdded = GuardAddFromDefinitionList(interp, dest, obj, filterCmd, mixin->opt->instfilters); } ml = ml->next; @@ -3839,15 +3839,15 @@ /* search per-object filters */ opt = obj->opt; if (!guardAdded && opt && opt->filters) { - guardAdded = GuardAddFromDefinitionList(in, dest, obj, filterCmd, opt->filters); + guardAdded = GuardAddFromDefinitionList(interp, dest, obj, filterCmd, opt->filters); } if (!guardAdded) { /* search per-class filters */ for (pl = ComputeOrder(obj->cl, obj->cl->order, Super); !guardAdded && pl; pl = pl->next) { XOTclClassOpt* opt = pl->cl->opt; if (opt) { - guardAdded = GuardAddFromDefinitionList(in, dest, obj, filterCmd, + guardAdded = GuardAddFromDefinitionList(interp, dest, obj, filterCmd, opt->instfilters); } } @@ -3864,67 +3864,67 @@ */ if (!guardAdded) { XOTclCmdList* registeredFilter = - CmdListFindNameInList(in,(char *) Tcl_GetCommandName(in, filterCmd), + CmdListFindNameInList(interp,(char *) Tcl_GetCommandName(interp, filterCmd), obj->filterOrder); if (registeredFilter) { - GuardAdd(in, dest, (Tcl_Obj*) registeredFilter->clientData); + GuardAdd(interp, dest, (Tcl_Obj*) registeredFilter->clientData); } } } } static int -GuardList(Tcl_Interp *in, XOTclCmdList* frl, char *interceptorName) { +GuardList(Tcl_Interp *interp, XOTclCmdList* frl, char *interceptorName) { XOTclCmdList* h; if (frl) { /* try to find simple name first */ - h = CmdListFindNameInList(in, interceptorName, frl); + h = CmdListFindNameInList(interp, interceptorName, frl); if (!h) { /* maybe it is a qualified name */ - Tcl_Command cmd = NSFindCommand(in, interceptorName, NULL); + Tcl_Command cmd = NSFindCommand(interp, interceptorName, NULL); if (cmd) { h = CmdListFindCmdInList(cmd, frl); } } if (h) { - Tcl_ResetResult(in); + Tcl_ResetResult(interp); if (h->clientData) { Tcl_Obj *g = (Tcl_Obj*) h->clientData; - Tcl_SetObjResult(in, g); + Tcl_SetObjResult(interp, g); } return TCL_OK; } } - return XOTclVarErrMsg(in, "info (*)guard: can't find filter/mixin ", + return XOTclVarErrMsg(interp, "info (*)guard: can't find filter/mixin ", interceptorName, (char *) NULL); } /* * append a filter command to the 'filterList' of an obj/class */ static int -FilterAdd(Tcl_Interp *in, XOTclCmdList **filterList, Tcl_Obj *name, +FilterAdd(Tcl_Interp *interp, XOTclCmdList **filterList, Tcl_Obj *name, XOTclObject *startingObj, XOTclClass *startingCl) { Tcl_Command cmd; int ocName; Tcl_Obj **ovName; Tcl_Obj *guard = NULL; XOTclCmdList *new; XOTclClass *cl; - if (Tcl_ListObjGetElements(in, name, &ocName, &ovName) == TCL_OK && ocName > 1) { + if (Tcl_ListObjGetElements(interp, name, &ocName, &ovName) == TCL_OK && ocName > 1) { if (ocName == 3 && !strcmp(ObjStr(ovName[1]), XOTclGlobalStrings[XOTE_GUARD_OPTION])) { name = ovName[0]; guard = ovName[2]; } } - if (!(cmd = FilterSearch(in, ObjStr(name), startingObj, startingCl, &cl))) { + if (!(cmd = FilterSearch(interp, ObjStr(name), startingObj, startingCl, &cl))) { if (startingObj) - return XOTclVarErrMsg(in, "filter: can't find filterproc on: ", + return XOTclVarErrMsg(interp, "filter: can't find filterproc on: ", ObjStr(startingObj->cmdName), " - proc: ", ObjStr(name), (char *) NULL); else - return XOTclVarErrMsg(in, "instfilter: can't find filterproc on: ", + return XOTclVarErrMsg(interp, "instfilter: can't find filterproc on: ", ObjStr(startingCl->object.cmdName), " - proc: ", ObjStr(name), (char *) NULL); } @@ -3934,7 +3934,7 @@ new = CmdListAdd(filterList, cmd, cl, /*noDuplicates*/ 1); if (guard) { - GuardAdd(in, new, guard); + GuardAdd(interp, new, guard); } else { if (new->clientData) GuardDel(new); @@ -3958,7 +3958,7 @@ * command, so that we can be sure it is still reachable. */ static void -FilterSearchAgain(Tcl_Interp *in, XOTclCmdList **filters, +FilterSearchAgain(Tcl_Interp *interp, XOTclCmdList **filters, XOTclObject *startingObj, XOTclClass *startingCl) { char *simpleName; Tcl_Command cmd; @@ -3968,8 +3968,8 @@ CmdListRemoveEpoched(filters, GuardDel); cmdList = *filters; while (cmdList) { - simpleName = (char *) Tcl_GetCommandName(in, cmdList->cmdPtr); - cmd = FilterSearch(in, simpleName, startingObj, startingCl, &cl); + simpleName = (char *) Tcl_GetCommandName(interp, cmdList->cmdPtr); + cmd = FilterSearch(interp, simpleName, startingObj, startingCl, &cl); if (cmd == NULL) { del = cmdList; cmdList = cmdList->next; @@ -3994,7 +3994,7 @@ * */ static void -FilterInvalidateObjOrders(Tcl_Interp *in, XOTclClass *cl) { +FilterInvalidateObjOrders(Tcl_Interp *interp, XOTclClass *cl) { XOTclClasses *saved = cl->order, *clPtr, *savePtr; cl->order = 0; @@ -4008,7 +4008,7 @@ /* recalculate the commands of all instfilter registrations */ if (clPtr->cl->opt) { - FilterSearchAgain(in, &clPtr->cl->opt->instfilters, 0, clPtr->cl); + FilterSearchAgain(interp, &clPtr->cl->opt->instfilters, 0, clPtr->cl); } for (; hPtr != 0; hPtr = Tcl_NextHashEntry(&hSrch)) { XOTclObject *obj = (XOTclObject*) Tcl_GetHashKey(&clPtr->cl->instances, hPtr); @@ -4017,7 +4017,7 @@ /* recalculate the commands of all object filter registrations */ if (obj->opt) { - FilterSearchAgain(in, &obj->opt->filters, obj, 0); + FilterSearchAgain(interp, &obj->opt->filters, obj, 0); } } clPtr = clPtr->next; @@ -4066,40 +4066,40 @@ * with obj */ static Tcl_Obj* -getFullProcQualifier(Tcl_Interp *in, CONST84 char *cmdName, +getFullProcQualifier(Tcl_Interp *interp, CONST84 char *cmdName, XOTclObject *obj, XOTclClass *cl, Tcl_Command cmd) { Tcl_Obj *list = Tcl_NewListObj(0, NULL); Tcl_Obj *procObj = Tcl_NewStringObj(cmdName, -1); Tcl_ObjCmdProc *objProc = Tcl_Command_objProc(cmd); int isTcl = (TclIsProc((Command *)cmd) != NULL); if (cl) { - Tcl_ListObjAppendElement(in, list, cl->object.cmdName); + Tcl_ListObjAppendElement(interp, list, cl->object.cmdName); /*fprintf(stderr,"current %p, dispatch %p, forward %p, parametermcd %p, is tcl %p\n", objProc, XOTclObjDispatch, XOTclForwardMethod, XOTclSetterMethod, TclIsProc((Command *)cmd)); */ if (isTcl) { - Tcl_ListObjAppendElement(in, list, XOTclGlobalObjects[XOTE_INSTPROC]); + Tcl_ListObjAppendElement(interp, list, XOTclGlobalObjects[XOTE_INSTPROC]); } else if (objProc == XOTclForwardMethod) { - Tcl_ListObjAppendElement(in, list, XOTclGlobalObjects[XOTE_INSTFORWARD]); + Tcl_ListObjAppendElement(interp, list, XOTclGlobalObjects[XOTE_INSTFORWARD]); } else if (objProc == XOTclSetterMethod) { - Tcl_ListObjAppendElement(in, list, XOTclGlobalObjects[XOTE_INSTPARAMETERCMD]); + Tcl_ListObjAppendElement(interp, list, XOTclGlobalObjects[XOTE_INSTPARAMETERCMD]); } else { - Tcl_ListObjAppendElement(in, list, XOTclGlobalObjects[XOTE_INSTCMD]); + Tcl_ListObjAppendElement(interp, list, XOTclGlobalObjects[XOTE_INSTCMD]); } } else { - Tcl_ListObjAppendElement(in, list, obj->cmdName); + Tcl_ListObjAppendElement(interp, list, obj->cmdName); if (isTcl) { - Tcl_ListObjAppendElement(in, list, XOTclGlobalObjects[XOTE_PROC]); + Tcl_ListObjAppendElement(interp, list, XOTclGlobalObjects[XOTE_PROC]); } else if (objProc == XOTclForwardMethod) { - Tcl_ListObjAppendElement(in, list, XOTclGlobalObjects[XOTE_FORWARD]); + Tcl_ListObjAppendElement(interp, list, XOTclGlobalObjects[XOTE_FORWARD]); } else if (objProc == XOTclSetterMethod) { - Tcl_ListObjAppendElement(in, list, XOTclGlobalObjects[XOTE_PARAMETERCMD]); + Tcl_ListObjAppendElement(interp, list, XOTclGlobalObjects[XOTE_PARAMETERCMD]); } else { - Tcl_ListObjAppendElement(in, list, XOTclGlobalObjects[XOTE_CMD]); + Tcl_ListObjAppendElement(interp, list, XOTclGlobalObjects[XOTE_CMD]); } } - Tcl_ListObjAppendElement(in, list, procObj); + Tcl_ListObjAppendElement(interp, list, procObj); return list; } @@ -4109,7 +4109,7 @@ * fullProcQualifiers -> if not 0 => full names with obj/class proc/instproc */ static int -FilterInfo(Tcl_Interp *in, XOTclCmdList* f, char *pattern, +FilterInfo(Tcl_Interp *interp, XOTclCmdList* f, char *pattern, int withGuards, int fullProcQualifiers) { CONST84 char *simpleName; Tcl_Obj *list = Tcl_NewListObj(0, NULL); @@ -4122,16 +4122,16 @@ } while (f) { - simpleName = Tcl_GetCommandName(in, f->cmdPtr); + simpleName = Tcl_GetCommandName(interp, f->cmdPtr); if (!pattern || Tcl_StringMatch(simpleName, pattern)) { if (withGuards && f->clientData) { Tcl_Obj *innerList = Tcl_NewListObj(0, NULL); Tcl_Obj *g = (Tcl_Obj*) f->clientData; - Tcl_ListObjAppendElement(in, innerList, + Tcl_ListObjAppendElement(interp, innerList, Tcl_NewStringObj(simpleName, -1)); - Tcl_ListObjAppendElement(in, innerList, XOTclGlobalObjects[XOTE_GUARD_OPTION]); - Tcl_ListObjAppendElement(in, innerList, g); - Tcl_ListObjAppendElement(in, list, innerList); + Tcl_ListObjAppendElement(interp, innerList, XOTclGlobalObjects[XOTE_GUARD_OPTION]); + Tcl_ListObjAppendElement(interp, innerList, g); + Tcl_ListObjAppendElement(interp, list, innerList); } else { if (fullProcQualifiers) { XOTclClass *fcl; @@ -4143,17 +4143,17 @@ fobj = NULL; fcl = f->clorobj; } - Tcl_ListObjAppendElement(in, list, - getFullProcQualifier(in, simpleName, + Tcl_ListObjAppendElement(interp, list, + getFullProcQualifier(interp, simpleName, fobj, fcl, f->cmdPtr)); } else { - Tcl_ListObjAppendElement(in, list, Tcl_NewStringObj(simpleName, -1)); + Tcl_ListObjAppendElement(interp, list, Tcl_NewStringObj(simpleName, -1)); } } } f = f->next; } - Tcl_SetObjResult(in, list); + Tcl_SetObjResult(interp, list); return TCL_OK; } @@ -4162,7 +4162,7 @@ * superclass specializations to 'filterList' */ static void -FilterComputeOrderFullList(Tcl_Interp *in, XOTclCmdList **filters, +FilterComputeOrderFullList(Tcl_Interp *interp, XOTclCmdList **filters, XOTclCmdList **filterList) { XOTclCmdList *f ; char *simpleName; @@ -4175,7 +4175,7 @@ CmdListRemoveEpoched(filters, GuardDel); for (f = *filters; f; f = f->next) { - simpleName = (char *) Tcl_GetCommandName(in, f->cmdPtr); + simpleName = (char *) Tcl_GetCommandName(interp, f->cmdPtr); fcl = f->clorobj; CmdListAdd(filterList, f->cmdPtr, fcl, /*noDuplicates*/ 0); @@ -4205,7 +4205,7 @@ } } } - /*CmdListPrint(in,"FilterComputeOrderFullList....\n", *filterList);*/ + /*CmdListPrint(interp,"FilterComputeOrderFullList....\n", *filterList);*/ } /* @@ -4216,7 +4216,7 @@ * final list. */ static void -FilterComputeOrder(Tcl_Interp *in, XOTclObject *obj) { +FilterComputeOrder(Tcl_Interp *interp, XOTclObject *obj) { XOTclCmdList *filterList = 0, *next, *checker, *newlist; XOTclClasses *pl; @@ -4227,28 +4227,28 @@ /* append instfilters registered for mixins */ if (!(obj->flags & XOTCL_MIXIN_ORDER_VALID)) - MixinComputeDefined(in, obj); + MixinComputeDefined(interp, obj); if (obj->flags & XOTCL_MIXIN_ORDER_DEFINED_AND_VALID) { XOTclCmdList *ml = obj->mixinOrder; XOTclClass *mixin; while (ml) { mixin = XOTclGetClassFromCmdPtr(ml->cmdPtr); if (mixin && mixin->opt && mixin->opt->instfilters) - FilterComputeOrderFullList(in, &mixin->opt->instfilters, &filterList); + FilterComputeOrderFullList(interp, &mixin->opt->instfilters, &filterList); ml = ml->next; } } /* append per-obj filters */ if (obj->opt) - FilterComputeOrderFullList(in, &obj->opt->filters, &filterList); + FilterComputeOrderFullList(interp, &obj->opt->filters, &filterList); /* append per-class filters */ for (pl = ComputeOrder(obj->cl, obj->cl->order, Super); pl; pl=pl->next) { XOTclClassOpt* opt = pl->cl->opt; if (opt && opt->instfilters) { - FilterComputeOrderFullList(in, &opt->instfilters, &filterList); + FilterComputeOrderFullList(interp, &opt->instfilters, &filterList); } } @@ -4266,12 +4266,12 @@ if (checker == 0) { newlist = CmdListAdd(&obj->filterOrder, filterList->cmdPtr, filterList->clorobj, /*noDuplicates*/ 0); - GuardAddInheritedGuards(in, newlist, obj, filterList->cmdPtr); + GuardAddInheritedGuards(interp, newlist, obj, filterList->cmdPtr); /* - fprintf(stderr, " Adding %s::%s,\n", filterList->cmdPtr->nsPtr->fullName, Tcl_GetCommandName(in, filterList->cmdPtr)); + fprintf(stderr, " Adding %s::%s,\n", filterList->cmdPtr->nsPtr->fullName, Tcl_GetCommandName(interp, filterList->cmdPtr)); */ /* - GuardPrint(in, newlist->clientData); + GuardPrint(interp, newlist->clientData); */ } @@ -4295,8 +4295,8 @@ * and set the instance to DEFINE or NONE */ static void -FilterComputeDefined(Tcl_Interp *in, XOTclObject *obj) { - FilterComputeOrder(in, obj); +FilterComputeDefined(Tcl_Interp *interp, XOTclObject *obj) { + FilterComputeOrder(interp, obj); obj->flags |= XOTCL_FILTER_ORDER_VALID; if (obj->filterOrder) obj->flags |= XOTCL_FILTER_ORDER_DEFINED; @@ -4308,7 +4308,7 @@ * push a filter stack information on this object */ static int -FilterStackPush(Tcl_Interp *in, XOTclObject *obj, Tcl_Obj *calledProc) { +FilterStackPush(Tcl_Interp *interp, XOTclObject *obj, Tcl_Obj *calledProc) { register XOTclFilterStack* h = NEW(XOTclFilterStack); h->currentCmdPtr = 0; @@ -4339,12 +4339,12 @@ * precondition: obj->filterStack is not NULL */ static void -FilterSeekCurrent(Tcl_Interp *in, XOTclObject *obj, XOTclCmdList **cmdList) { +FilterSeekCurrent(Tcl_Interp *interp, XOTclObject *obj, XOTclCmdList **cmdList) { Tcl_Command currentCmd = obj->filterStack->currentCmdPtr; assert(obj->flags & XOTCL_FILTER_ORDER_VALID); /* ensure that the filter order is not invalid, otherwise compute order - FilterComputeDefined(in, obj); + FilterComputeDefined(interp, obj); */ *cmdList = obj->filterOrder; @@ -4362,8 +4362,8 @@ * is among them */ XOTCLINLINE static int -FilterActiveOnObj(Tcl_Interp *in, XOTclObject *obj, Tcl_Command cmd) { - XOTclCallStack *cs = &RUNTIME_STATE(in)->cs; +FilterActiveOnObj(Tcl_Interp *interp, XOTclObject *obj, Tcl_Command cmd) { + XOTclCallStack *cs = &RUNTIME_STATE(interp)->cs; XOTclCallStackContent *bot = cs->content; register XOTclCallStackContent *csc = cs->top; while (csc > bot) { @@ -4388,16 +4388,16 @@ * or an empty list, if not registered */ static Tcl_Obj* -FilterFindReg(Tcl_Interp *in, XOTclObject *obj, Tcl_Command cmd) { +FilterFindReg(Tcl_Interp *interp, XOTclObject *obj, Tcl_Command cmd) { Tcl_Obj *list = Tcl_NewListObj(0, NULL); XOTclClasses* pl; /* search per-object filters */ if (obj->opt && CmdListFindCmdInList(cmd, obj->opt->filters)) { - Tcl_ListObjAppendElement(in, list, obj->cmdName); - Tcl_ListObjAppendElement(in, list, XOTclGlobalObjects[XOTE_FILTER]); - Tcl_ListObjAppendElement(in, list, - Tcl_NewStringObj(Tcl_GetCommandName(in, cmd), -1)); + Tcl_ListObjAppendElement(interp, list, obj->cmdName); + Tcl_ListObjAppendElement(interp, list, XOTclGlobalObjects[XOTE_FILTER]); + Tcl_ListObjAppendElement(interp, list, + Tcl_NewStringObj(Tcl_GetCommandName(interp, cmd), -1)); return list; } @@ -4406,10 +4406,10 @@ XOTclClassOpt* opt = pl->cl->opt; if (opt && opt->instfilters) { if (CmdListFindCmdInList(cmd, opt->instfilters)) { - Tcl_ListObjAppendElement(in, list, pl->cl->object.cmdName); - Tcl_ListObjAppendElement(in, list, XOTclGlobalObjects[XOTE_INSTFILTER]); - Tcl_ListObjAppendElement(in, list, - Tcl_NewStringObj(Tcl_GetCommandName(in, cmd), -1)); + Tcl_ListObjAppendElement(interp, list, pl->cl->object.cmdName); + Tcl_ListObjAppendElement(interp, list, XOTclGlobalObjects[XOTE_INSTFILTER]); + Tcl_ListObjAppendElement(interp, list, + Tcl_NewStringObj(Tcl_GetCommandName(interp, cmd), -1)); return list; } } @@ -4422,7 +4422,7 @@ * current filter and the relevant calling information */ static Tcl_Command -FilterSearchProc(Tcl_Interp *in, XOTclObject *obj, Tcl_ObjCmdProc **proc, ClientData* cp, +FilterSearchProc(Tcl_Interp *interp, XOTclObject *obj, Tcl_ObjCmdProc **proc, ClientData* cp, Tcl_Command* currentCmd, XOTclClass **cl) { XOTclCmdList *cmdList; @@ -4433,16 +4433,16 @@ *proc = 0; *cp = 0; - FilterSeekCurrent(in, obj, &cmdList); + FilterSeekCurrent(interp, obj, &cmdList); while (cmdList) { if (Tcl_Command_cmdEpoch(cmdList->cmdPtr)) { cmdList = cmdList->next; - } else if (FilterActiveOnObj(in, obj, cmdList->cmdPtr)) { + } else if (FilterActiveOnObj(interp, obj, cmdList->cmdPtr)) { /* fprintf(stderr, "Filter <%s> -- Active on: %s\n", - Tcl_GetCommandName(in, (Tcl_Command)cmdList->cmdPtr), ObjStr(obj->cmdName)); + Tcl_GetCommandName(interp, (Tcl_Command)cmdList->cmdPtr), ObjStr(obj->cmdName)); */ obj->filterStack->currentCmdPtr = cmdList->cmdPtr; - FilterSeekCurrent(in, obj, &cmdList); + FilterSeekCurrent(interp, obj, &cmdList); } else { /* ok. we' ve found it */ *proc = Tcl_Command_objProc(cmdList->cmdPtr); @@ -4454,7 +4454,7 @@ } *currentCmd = cmdList->cmdPtr; /* fprintf(stderr, "FilterSearchProc - found: %s, %p\n", - Tcl_GetCommandName(in, (Tcl_Command)cmdList->cmdPtr), cmdList->cmdPtr); + Tcl_GetCommandName(interp, (Tcl_Command)cmdList->cmdPtr), cmdList->cmdPtr); */ return cmdList->cmdPtr; } @@ -4464,7 +4464,7 @@ static int -SuperclassAdd(Tcl_Interp *in, XOTclClass *cl, int oc, Tcl_Obj **ov, Tcl_Obj *arg) { +SuperclassAdd(Tcl_Interp *interp, XOTclClass *cl, int oc, Tcl_Obj **ov, Tcl_Obj *arg) { XOTclClasses *filterCheck, *osl = 0; XOTclClass **scl = 0; int reversed = 0; @@ -4487,14 +4487,14 @@ /* invalidate all interceptors orders of instances of this and of all depended classes */ - MixinInvalidateObjOrders(in, cl); - FilterInvalidateObjOrders(in, cl); + MixinInvalidateObjOrders(interp, cl); + FilterInvalidateObjOrders(interp, cl); scl = NEW_ARRAY(XOTclClass*,oc); for (i = 0; i < oc; i++) { - if (GetXOTclClassFromObj(in, ov[i], &scl[i], 1) != TCL_OK) { + if (GetXOTclClassFromObj(interp, ov[i], &scl[i], 1) != TCL_OK) { FREE(XOTclClass**, scl); - return XOTclErrBadVal(in, "superclass", "a list of classes", + return XOTclErrBadVal(interp, "superclass", "a list of classes", ObjStr(arg)); } } @@ -4517,7 +4517,7 @@ } if (reversed != 0) { - return XOTclErrBadVal(in, "superclass", "classes in dependence order", + return XOTclErrBadVal(interp, "superclass", "classes in dependence order", ObjStr(arg)); } @@ -4549,23 +4549,23 @@ while (cl->super != 0) (void)RemoveSuper(cl, cl->super->cl); for (l = osl; l != 0; l = l->next) AddSuper(cl, l->cl); XOTclFreeClasses(osl); - return XOTclErrBadVal(in, "superclass", "a cycle-free graph", ObjStr(arg)); + return XOTclErrBadVal(interp, "superclass", "a cycle-free graph", ObjStr(arg)); } XOTclFreeClasses(osl); /* if there are no more super classes add the Object class as superclasses */ if (cl->super == 0) - AddSuper(cl, RUNTIME_STATE(in)->theObject); + AddSuper(cl, RUNTIME_STATE(interp)->theObject); - Tcl_ResetResult(in); + Tcl_ResetResult(interp); return TCL_OK; } static int -varExists(Tcl_Interp *in, XOTclObject *obj, char *varName, char *index, +varExists(Tcl_Interp *interp, XOTclObject *obj, char *varName, char *index, int triggerTrace, int requireDefined) { XOTcl_FrameDecls; Var *varPtr, *arrayPtr; @@ -4579,22 +4579,22 @@ varResolver, (Tcl_ResolveCompiledVarProc*)NULL); } - XOTcl_PushFrame(in, obj); + XOTcl_PushFrame(interp, obj); #if defined(PRE83) - varPtr = TclLookupVar(in, varName, index, flags, "access", + varPtr = TclLookupVar(interp, varName, index, flags, "access", /*createPart1*/ 0, /*createPart2*/ 0, &arrayPtr); #else if (triggerTrace) - varPtr = TclVarTraceExists(in, varName); + varPtr = TclVarTraceExists(interp, varName); else - varPtr = TclLookupVar(in, varName, index, flags, "access", + varPtr = TclLookupVar(interp, varName, index, flags, "access", /*createPart1*/ 0, /*createPart2*/ 0, &arrayPtr); #endif result = ((varPtr != NULL) && (!requireDefined || !TclIsVarUndefined(varPtr))); - XOTcl_PopFrame(in, obj); + XOTcl_PopFrame(interp, obj); if (obj->nsPtr) { Tcl_SetNamespaceResolvers(obj->nsPtr, (Tcl_ResolveCmdProc*)NULL, @@ -4626,7 +4626,7 @@ * Search default values specified through 'parameter' on one class */ static int -SearchDefaultValuesOnClass(Tcl_Interp *in, XOTclObject *obj, +SearchDefaultValuesOnClass(Tcl_Interp *interp, XOTclObject *obj, XOTclClass *cmdCl, XOTclClass *targetClass) { int result = TCL_OK; Var *defaults, *initcmds; @@ -4654,7 +4654,7 @@ if (TclIsVarScalar(val)) { Tcl_Obj *oldValue = XOTclOGetInstVar2((XOTcl_Object*) obj, - in, varNameObj, NULL, + interp, varNameObj, NULL, TCL_LEAVE_ERR_MSG|TCL_PARSE_PART1); /** we check whether the variable is already set. if so, we do not set it again */ @@ -4672,18 +4672,18 @@ } if (doSubst == 2) { /* we have to subst */ Tcl_Obj *ov[2]; - int rc = CallStackPush(in, obj, cmdCl, 0, 1, + int rc = CallStackPush(interp, obj, cmdCl, 0, 1, &varNameObj, XOTCL_CSC_TYPE_PLAIN); if (rc != TCL_OK) { DECR_REF_COUNT(varNameObj); return rc; } ov[1] = valueObj; - Tcl_ResetResult(in); - rc = XOTcl_SubstObjCmd(NULL, in, 2, ov); - CallStackPop(in); + Tcl_ResetResult(interp); + rc = XOTcl_SubstObjCmd(NULL, interp, 2, ov); + CallStackPop(interp); if (rc == TCL_OK) { - valueObj = Tcl_GetObjResult(in); + valueObj = Tcl_GetObjResult(interp); } else { DECR_REF_COUNT(varNameObj); return rc; @@ -4692,7 +4692,7 @@ /*fprintf(stderr,"calling %s value='%s'\n", ObjStr(varNameObj),ObjStr(valueObj));*/ INCR_REF_COUNT(valueObj); - result = XOTclCallMethodWithArgs((ClientData)obj, in, + result = XOTclCallMethodWithArgs((ClientData)obj, interp, varNameObj, valueObj, 1, 0, 0); DECR_REF_COUNT(valueObj); @@ -4722,34 +4722,34 @@ INCR_REF_COUNT(varNameObj); /*fprintf(stderr,"varexists(%s->%s) = %d\n", ObjStr(obj->cmdName), - ObjStr(varNameObj), varExists(in, obj, ObjStr(varNameObj), NULL, 0, 0));*/ + ObjStr(varNameObj), varExists(interp, obj, ObjStr(varNameObj), NULL, 0, 0));*/ if (TclIsVarScalar(val) && - (!varExists(in, obj, ObjStr(varNameObj), NULL, 0, 0) || - varExists(in, &targetClass->object, "__defaults", ObjStr(varNameObj), 0,0) + (!varExists(interp, obj, ObjStr(varNameObj), NULL, 0, 0) || + varExists(interp, &targetClass->object, "__defaults", ObjStr(varNameObj), 0,0) )) { Tcl_Obj *valueObj = valueOfVar(Tcl_Obj,val,objPtr); char *string = ObjStr(valueObj); int rc; XOTcl_FrameDecls; if (*string) { - XOTcl_PushFrame(in, obj); /* make instvars accessible */ - CallStackPush(in, obj, cmdCl, 0, 1, + XOTcl_PushFrame(interp, obj); /* make instvars accessible */ + CallStackPush(interp, obj, cmdCl, 0, 1, &varNameObj, XOTCL_CSC_TYPE_PLAIN); /*allow to call self*/ /*fprintf(stderr,"evaluating '%s' obj=%s\n\n",ObjStr(valueObj),ObjStr(obj->cmdName)); - XOTclCallStackDump(in);*/ + XOTclCallStackDump(interp);*/ - rc = Tcl_EvalObjEx(in, valueObj, TCL_EVAL_DIRECT); - CallStackPop(in); - XOTcl_PopFrame(in, obj); + rc = Tcl_EvalObjEx(interp, valueObj, TCL_EVAL_DIRECT); + CallStackPop(interp); + XOTcl_PopFrame(interp, obj); if (rc != TCL_OK) { DECR_REF_COUNT(varNameObj); return rc; } /* fprintf(stderr,"... varexists(%s->%s) = %d\n", ObjStr(obj->cmdName), - varName, varExists(in, obj, varName, NULL, 0, 0)); */ + varName, varExists(interp, obj, varName, NULL, 0, 0)); */ } } DECR_REF_COUNT(varNameObj); @@ -4763,60 +4763,60 @@ * mixin and class hierarchy */ static int -SearchDefaultValues(Tcl_Interp *in, XOTclObject *obj, XOTclClass *cmdCl) { +SearchDefaultValues(Tcl_Interp *interp, XOTclObject *obj, XOTclClass *cmdCl) { XOTcl_FrameDecls; XOTclClass *cl = obj->cl, *mixin; XOTclClasses *pl = 0; XOTclCmdList *ml = 0; int result = TCL_OK; if (!(obj->flags & XOTCL_MIXIN_ORDER_VALID)) - MixinComputeDefined(in, obj); + MixinComputeDefined(interp, obj); if (obj->flags & XOTCL_MIXIN_ORDER_DEFINED_AND_VALID) ml = obj->mixinOrder; assert(cl); - XOTcl_PushFrame(in, obj); + XOTcl_PushFrame(interp, obj); while (ml) { mixin = XOTclGetClassFromCmdPtr(ml->cmdPtr); - result = SearchDefaultValuesOnClass(in, obj, cmdCl, mixin); + result = SearchDefaultValuesOnClass(interp, obj, cmdCl, mixin); if (result != TCL_OK) break; ml = ml->next; } for (pl = ComputeOrder(cl, cl->order, Super); pl; pl = pl->next) { - result = SearchDefaultValuesOnClass(in, obj, cmdCl, pl->cl); + result = SearchDefaultValuesOnClass(interp, obj, cmdCl, pl->cl); if (result != TCL_OK) break; } - XOTcl_PopFrame(in,obj); + XOTcl_PopFrame(interp,obj); return result; } static int -ParameterSearchDefaultsMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *objv[]) { +ParameterSearchDefaultsMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *objv[]) { XOTclClass *cl = XOTclObjectToClass(cd); XOTclObject *defaultObj; - if (!cl) return XOTclObjErrType(in, objv[0], "Class"); + if (!cl) return XOTclObjErrType(interp, objv[0], "Class"); if (objc != 2) - return XOTclObjErrArgCnt(in, cl->object.cmdName, "searchDefaults obj"); - if (XOTclObjConvertObject(in, objv[1], &defaultObj) != TCL_OK) - return XOTclVarErrMsg(in, "Can't find default object ", + return XOTclObjErrArgCnt(interp, cl->object.cmdName, "searchDefaults obj"); + if (XOTclObjConvertObject(interp, objv[1], &defaultObj) != TCL_OK) + return XOTclVarErrMsg(interp, "Can't find default object ", ObjStr(objv[1]), (char *) NULL); /* * Search for default values for vars on superclasses */ - return SearchDefaultValues(in, defaultObj, defaultObj->cl); + return SearchDefaultValues(interp, defaultObj, defaultObj->cl); } static int -callParameterMethodWithArg(XOTclObject *obj, Tcl_Interp *in, Tcl_Obj *method, +callParameterMethodWithArg(XOTclObject *obj, Tcl_Interp *interp, Tcl_Obj *method, Tcl_Obj *arg, int objc, Tcl_Obj *CONST objv[], int flags) { XOTclClassOpt* opt = obj->cl->opt; Tcl_Obj *pcl = XOTclGlobalObjects[XOTE_PARAM_CL]; @@ -4825,12 +4825,12 @@ if (opt && opt->parameterClass) pcl = opt->parameterClass; - if (GetXOTclClassFromObj(in,pcl,¶mCl, 1) == TCL_OK) { - result = XOTclCallMethodWithArgs((ClientData)paramCl, in, + if (GetXOTclClassFromObj(interp,pcl,¶mCl, 1) == TCL_OK) { + result = XOTclCallMethodWithArgs((ClientData)paramCl, interp, method, arg, objc-2, objv, flags); } else - result = XOTclVarErrMsg(in, "create: can't find parameter class", + result = XOTclVarErrMsg(interp, "create: can't find parameter class", (char *) NULL); return result; } @@ -4842,11 +4842,11 @@ /* actually call a method (with assertion checking) */ static int -callProcCheck(ClientData cp, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[], +callProcCheck(ClientData cp, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Command cmd, XOTclObject *obj, XOTclClass *cl, char *methodName, int frameType, int isTclProc) { int result = TCL_OK; - XOTclRuntimeState *rst = RUNTIME_STATE(in); + XOTclRuntimeState *rst = RUNTIME_STATE(interp); CheckOptions co; #if defined(PROFILE) @@ -4869,7 +4869,7 @@ "cp=%p, isTclProc=%d %p %s, dispatch=%d %p, forward=%d %p, scoped %p, ov[0]=%p oc=%d\n", cp, isTclProc, cmd, - Tcl_GetCommandName(in, cmd), + Tcl_GetCommandName(interp, cmd), Tcl_Command_objProc(cmd) == XOTclObjDispatch, XOTclObjDispatch, Tcl_Command_objProc(cmd) == XOTclForwardMethod, XOTclForwardMethod, XOTclObjscopedMethod, @@ -4878,27 +4878,27 @@ #ifdef CALLSTACK_TRACE - XOTclCallStackDump(in); + XOTclCallStackDump(interp); #endif if (!isTclProc && obj->teardown) { co = 0; if (obj->opt) co = obj->opt->checkoptions; if ((co & CHECK_INVAR) && - ((result = AssertionCheckInvars(in, obj, methodName, co)) == TCL_ERROR)) { + ((result = AssertionCheckInvars(interp, obj, methodName, co)) == TCL_ERROR)) { goto finish; } #ifdef DISPATCH_TRACE - printCall(in,"callProcCheck cmd", objc,objv); - /*fprintf(stderr,"\tproc=%s\n",Tcl_GetCommandName(in,cmd));*/ + printCall(interp,"callProcCheck cmd", objc,objv); + /*fprintf(stderr,"\tproc=%s\n",Tcl_GetCommandName(interp,cmd));*/ #endif - result = (*Tcl_Command_objProc(cmd))(cp, in, objc, objv); + result = (*Tcl_Command_objProc(cmd))(cp, interp, objc, objv); #ifdef DISPATCH_TRACE - printExit(in,"callProcCheck cmd", objc,objv, result); + printExit(interp,"callProcCheck cmd", objc,objv, result); /*fprintf(stderr, " returnCode %d xotcl rc %d\n", - Tcl_Interp_returnCode(in), rst->returnCode);*/ + Tcl_Interp_returnCode(interp), rst->returnCode);*/ #endif /* @@ -4911,7 +4911,7 @@ co = 0; if (!rst->callIsDestroy && obj->opt) co = obj->opt->checkoptions; if ((co & CHECK_INVAR) && - ((result = AssertionCheckInvars(in, obj, methodName,co)) == TCL_ERROR)) { + ((result = AssertionCheckInvars(interp, obj, methodName,co)) == TCL_ERROR)) { goto finish; } } else { @@ -4925,7 +4925,7 @@ * seek cmd in obj's filterOrder */ assert(obj->flags & XOTCL_FILTER_ORDER_VALID); - /* otherwise: FilterComputeDefined(in, obj);*/ + /* otherwise: FilterComputeDefined(interp, obj);*/ cmdList = obj->filterOrder; while (cmdList && cmdList->cmdPtr != cmd) @@ -4935,7 +4935,7 @@ * when it is found, check whether it has a filter guard */ if (cmdList) { - int rc = GuardCall(obj, cl, (Tcl_Command) cmdList->cmdPtr, in, + int rc = GuardCall(obj, cl, (Tcl_Command) cmdList->cmdPtr, interp, cmdList->clientData, 0); if (rc != TCL_OK) { if (rc != TCL_ERROR) { @@ -4944,12 +4944,12 @@ * we may not be in a method, thus there may be wrong or * no callstackobjs */ - /*fprintf(stderr, "... calling nextmethod\n"); XOTclCallStackDump(in);*/ + /*fprintf(stderr, "... calling nextmethod\n"); XOTclCallStackDump(interp);*/ - rc = XOTclNextMethod(obj, in, cl, methodName, + rc = XOTclNextMethod(obj, interp, cl, methodName, objc, objv, /*useCallStackObjs*/ 0); /*fprintf(stderr, "... after nextmethod\n"); - XOTclCallStackDump(in);*/ + XOTclCallStackDump(interp);*/ } @@ -4962,26 +4962,26 @@ && !(obj->flags & XOTCL_DESTROY_CALLED)) { if (obj->opt && (obj->opt->checkoptions & CHECK_PRE) && - (result = AssertionCheck(in, obj, cl, methodName, CHECK_PRE)) == TCL_ERROR) { + (result = AssertionCheck(interp, obj, cl, methodName, CHECK_PRE)) == TCL_ERROR) { goto finish; } } - if (Tcl_Interp_numLevels(in) <= 2) + if (Tcl_Interp_numLevels(interp) <= 2) rst->returnCode = TCL_OK; #ifdef DISPATCH_TRACE - printCall(in,"callProcCheck tclCmd", objc,objv); - fprintf(stderr,"\tproc=%s\n",Tcl_GetCommandName(in,cmd)); + printCall(interp,"callProcCheck tclCmd", objc,objv); + fprintf(stderr,"\tproc=%s\n",Tcl_GetCommandName(interp,cmd)); #endif - result = (*Tcl_Command_objProc(cmd))(cp, in, objc, objv); + result = (*Tcl_Command_objProc(cmd))(cp, interp, objc, objv); #ifdef DISPATCH_TRACE - printExit(in,"callProcCheck tclCmd", objc,objv, result); + printExit(interp,"callProcCheck tclCmd", objc,objv, result); /* fprintf(stderr, " returnCode %d xotcl rc %d\n", - Tcl_Interp_returnCode(in), rst->returnCode);*/ + Tcl_Interp_returnCode(interp), rst->returnCode);*/ #endif - /*if (Tcl_Interp_numLevels(in) <= 2 && rst->returnCode == TCL_BREAK) + /*if (Tcl_Interp_numLevels(interp) <= 2 && rst->returnCode == TCL_BREAK) result = TCL_BREAK; else*/ if (result == TCL_BREAK && rst->returnCode == TCL_OK) rst->returnCode = result; @@ -4998,7 +4998,7 @@ if (obj->opt && !rst->callIsDestroy && obj->teardown && (obj->opt->checkoptions & CHECK_POST) && - (result = AssertionCheck(in, obj, cl, methodName, CHECK_POST) == TCL_ERROR)) { + (result = AssertionCheck(interp, obj, cl, methodName, CHECK_POST) == TCL_ERROR)) { goto finish; } } @@ -5007,15 +5007,15 @@ #if defined(PROFILE) if (rst->callIsDestroy == 0) { - XOTclProfileEvaluateData(in, startSec, startUsec, obj, cl, methodName); + XOTclProfileEvaluateData(interp, startSec, startUsec, obj, cl, methodName); } #endif return result; } static int -DoCallProcCheck(ClientData cp, ClientData cd, Tcl_Interp *in, +DoCallProcCheck(ClientData cp, ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Command cmd, XOTclObject *obj, XOTclClass *cl, char *methodName, @@ -5051,21 +5051,21 @@ if (push) { /* push the xotcl info */ - if ((CallStackPush(in, obj, cl, cmd, objc, objv, frameType)) != TCL_OK) + if ((CallStackPush(interp, obj, cl, cmd, objc, objv, frameType)) != TCL_OK) return TCL_ERROR; } - rc = callProcCheck(cp, in, objc, objv, cmd, obj, cl, + rc = callProcCheck(cp, interp, objc, objv, cmd, obj, cl, methodName, frameType, isTclProc); if (push) { - CallStackPop(in); + CallStackPop(interp); } return rc; } XOTCLINLINE static int -DoDispatch(ClientData cd, Tcl_Interp *in, int objc, +DoDispatch(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], int flags) { register XOTclObject *obj = (XOTclObject*)cd; int result = TCL_OK, mixinStackPushed = 0, @@ -5079,7 +5079,7 @@ ClientData cp = 0; Tcl_ObjCmdProc *proc = 0; Tcl_Command cmd = 0; - XOTclRuntimeState *rst = RUNTIME_STATE(in); + XOTclRuntimeState *rst = RUNTIME_STATE(interp); Tcl_Obj *cmdName = obj->cmdName; XOTclCallStack *cs = &rst->cs; /*int isdestroy = (objv[1] == XOTclGlobalObjects[XOTE_DESTROY]); */ @@ -5094,7 +5094,7 @@ isNext = isNextString(methodName); #endif #ifdef DISPATCH_TRACE - printCall(in,"DISPATCH", objc,objv); + printCall(interp,"DISPATCH", objc,objv); #endif #ifdef OBJDELETION_TRACE @@ -5111,10 +5111,10 @@ INCR_REF_COUNT(cmdName); if (!(objflags & XOTCL_FILTER_ORDER_VALID)) - FilterComputeDefined(in, obj); + FilterComputeDefined(interp, obj); if (!(objflags & XOTCL_MIXIN_ORDER_VALID)) - MixinComputeDefined(in, obj); + MixinComputeDefined(interp, obj); callMethod = methodName; #ifdef AUTOVARS @@ -5124,20 +5124,20 @@ (a) filters are defined and (b) the toplevel csc entry is not an filter on self */ - if (RUNTIME_STATE(in)->doFilters && + if (RUNTIME_STATE(interp)->doFilters && !(flags & XOTCL_CM_NO_FILTERS) && !cs->guardCount && ((obj->flags & XOTCL_FILTER_ORDER_DEFINED_AND_VALID) == XOTCL_FILTER_ORDER_DEFINED_AND_VALID)) { - XOTclObject *self = GetSelfObj(in); + XOTclObject *self = GetSelfObj(interp); if (obj != self || cs->top->frameType != XOTCL_CSC_TYPE_ACTIVE_FILTER) { - filterStackPushed = FilterStackPush(in, obj, objv[1]); - cmd = FilterSearchProc(in, obj, &proc, &cp, + filterStackPushed = FilterStackPush(interp, obj, objv[1]); + cmd = FilterSearchProc(interp, obj, &proc, &cp, &obj->filterStack->currentCmdPtr,&cl); if (cmd) { /* 'proc' and the other output vars are set as well */ frameType = XOTCL_CSC_TYPE_ACTIVE_FILTER; - callMethod = (char *)Tcl_GetCommandName(in, cmd); + callMethod = (char *)Tcl_GetCommandName(interp, cmd); } else { FilterStackPop(obj); filterStackPushed = 0; @@ -5158,7 +5158,7 @@ mixinStackPushed = MixinStackPush(obj); if (frameType != XOTCL_CSC_TYPE_ACTIVE_FILTER) { - cmd = MixinSearchProc(in, obj, methodName, &cl, &proc, &cp, + cmd = MixinSearchProc(interp, obj, methodName, &cl, &proc, &cp, &obj->mixinStack->currentCmdPtr); if (cmd) { /* 'proc' and the other output vars are set as well */ frameType = XOTCL_CSC_TYPE_ACTIVE_MIXIN; @@ -5195,11 +5195,11 @@ if (proc) { result = TCL_OK; - if ((result = DoCallProcCheck(cp, cd, in, objc, objv, cmd, obj, cl, + if ((result = DoCallProcCheck(cp, cd, interp, objc, objv, cmd, obj, cl, callMethod, frameType, 0 /* fromNext */)) == TCL_ERROR) { - result = XOTclErrInProc(in, cmdName, cl ? cl->object.cmdName : NULL, callMethod); + result = XOTclErrInProc(interp, cmdName, cl ? cl->object.cmdName : NULL, callMethod); } - unknown = RUNTIME_STATE(in)->unknown; + unknown = RUNTIME_STATE(interp)->unknown; } else { unknown = 1; } @@ -5209,7 +5209,7 @@ if (unknown) { if (XOTclObjectIsClass(obj) && (flags & XOTCL_CM_NO_UNKNOWN)) { - return XOTclVarErrMsg(in, ObjStr(objv[0]), + return XOTclVarErrMsg(interp, ObjStr(objv[0]), ": unable to dispatch method '", callMethod, "'", (char *) NULL); } else if (objv[1] != XOTclGlobalObjects[XOTE_UNKNOWN]) { @@ -5230,11 +5230,11 @@ /* fprintf(stderr,"?? %s unknown %s\n",ObjStr(obj->cmdName), ObjStr(tov[2])); */ - result = DoDispatch(cd, in, objc+1, tov, flags | XOTCL_CM_NO_UNKNOWN); + result = DoDispatch(cd, interp, objc+1, tov, flags | XOTCL_CM_NO_UNKNOWN); FREE_ON_STACK(tov); } else { /* unknown failed */ - return XOTclVarErrMsg(in, ObjStr(objv[0]), + return XOTclVarErrMsg(interp, ObjStr(objv[0]), ": unable to dispatch method '", ObjStr(objv[2]), "'", (char *) NULL); } @@ -5243,10 +5243,10 @@ } /* be sure to reset unknown flag */ if (unknown) - RUNTIME_STATE(in)->unknown = 0; + RUNTIME_STATE(interp)->unknown = 0; #ifdef DISPATCH_TRACE - printExit(in,"DISPATCH", objc,objv, result); + printExit(interp,"DISPATCH", objc,objv, result); fprintf(stderr,"obj %p mixinStackPushed %d mixinStack %p\n", obj, mixinStackPushed, obj->mixinStack); #endif @@ -5275,50 +5275,50 @@ } static int -ObjDispatch(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[], +ObjDispatch(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], int flags) { int result; #ifdef STACK_TRACE - XOTclStackDump(in); + XOTclStackDump(interp); #endif #ifdef CALLSTACK_TRACE - XOTclCallStackDump(in); + XOTclCallStackDump(interp); #endif if (objc == 1) { Tcl_Obj *tov[2]; tov[0] = objv[0]; tov[1] = XOTclGlobalObjects[XOTE_DEFAULTMETHOD]; - result = DoDispatch(cd, in, 2, tov, flags); + result = DoDispatch(cd, interp, 2, tov, flags); } else { /* normal dispatch */ - result = DoDispatch(cd, in, objc, objv, flags); + result = DoDispatch(cd, interp, objc, objv, flags); } return result; } #ifdef XOTCL_BYTECODE int -XOTclDirectSelfDispatch(ClientData cd, Tcl_Interp *in, +XOTclDirectSelfDispatch(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { int result; #ifdef XOTCLOBJ_TRACE XOTclObject *obj; #endif objTrace("BEFORE SELF DISPATCH", obj); - result = ObjDispatch((ClientData)GetSelfObj(in), in, objc, objv, 0); + result = ObjDispatch((ClientData)GetSelfObj(interp), interp, objc, objv, 0); objTrace("AFTER SELF DISPATCH", obj); return result; } #endif int -XOTclObjDispatch(ClientData cd, Tcl_Interp *in, +XOTclObjDispatch(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { - return ObjDispatch(cd, in, objc, objv, 0); + return ObjDispatch(cd, interp, objc, objv, 0); } /* @@ -5368,25 +5368,25 @@ } static Tcl_Obj* -NonposArgsFormat(Tcl_Interp *in, Tcl_Obj* nonposArgsData) { +NonposArgsFormat(Tcl_Interp *interp, Tcl_Obj* nonposArgsData) { int r1, npalistc, npac, checkc, i, j, first; Tcl_Obj **npalistv, **npav, **checkv, *list = Tcl_NewListObj(0, NULL), *innerlist, *nameStringObj; /*fprintf(stderr, "nonposargsformat '%s'\n", ObjStr(nonposArgsData));*/ - r1 = Tcl_ListObjGetElements(in, nonposArgsData, &npalistc, &npalistv); + r1 = Tcl_ListObjGetElements(interp, nonposArgsData, &npalistc, &npalistv); if (r1 == TCL_OK) { for (i=0; i < npalistc; i++) { - r1 = Tcl_ListObjGetElements(in, npalistv[i], &npac, &npav); + r1 = Tcl_ListObjGetElements(interp, npalistv[i], &npac, &npav); if (r1 == TCL_OK) { nameStringObj = Tcl_NewStringObj("-", 1); Tcl_AppendStringsToObj(nameStringObj, ObjStr(npav[0]), (char *) NULL); if (npac > 1 && *(ObjStr(npav[1])) != '\0') { first = 1; - r1 = Tcl_ListObjGetElements(in, npav[1], &checkc, &checkv); + r1 = Tcl_ListObjGetElements(interp, npav[1], &checkc, &checkv); if (r1 == TCL_OK) { for (j=0; j < checkc; j++) { if (first) { @@ -5404,9 +5404,9 @@ #if 1 innerlist = Tcl_NewListObj(0, NULL); - Tcl_ListObjAppendElement(in, innerlist, nameStringObj); + Tcl_ListObjAppendElement(interp, innerlist, nameStringObj); if (npac > 2) { - Tcl_ListObjAppendElement(in, innerlist, npav[2]); + Tcl_ListObjAppendElement(interp, innerlist, npav[2]); } #else { @@ -5421,7 +5421,7 @@ DSTRING_FREE(dsPtr); } #endif - Tcl_ListObjAppendElement(in, list, innerlist); + Tcl_ListObjAppendElement(interp, list, innerlist); } } } @@ -5447,16 +5447,16 @@ } static int -parseNonposArgs(Tcl_Interp *in, +parseNonposArgs(Tcl_Interp *interp, char *procName, Tcl_Obj *npArgs, Tcl_Obj *ordinaryArgs, Tcl_HashTable **nonposArgsTable, int *haveNonposArgs) { int rc, nonposArgsDefc, npac; Tcl_Obj **nonposArgsDefv; - rc = Tcl_ListObjGetElements(in, npArgs, &nonposArgsDefc, &nonposArgsDefv); + rc = Tcl_ListObjGetElements(interp, npArgs, &nonposArgsDefc, &nonposArgsDefv); if (rc != TCL_OK) { - return XOTclVarErrMsg(in, "cannot break down non-positional args: ", + return XOTclVarErrMsg(interp, "cannot break down non-positional args: ", ObjStr(npArgs), (char *) NULL); } if (nonposArgsDefc > 0) { @@ -5467,10 +5467,10 @@ INCR_REF_COUNT(nonposArgsObj); for (i=0; i < nonposArgsDefc; i++) { - rc = Tcl_ListObjGetElements(in, nonposArgsDefv[i], &npac, &npav); + rc = Tcl_ListObjGetElements(interp, nonposArgsDefv[i], &npac, &npav); if (rc == TCL_ERROR || npac < 1 || npac > 2) { DECR_REF_COUNT(nonposArgsObj); - return XOTclVarErrMsg(in, "wrong # of elements in non-positional args ", + return XOTclVarErrMsg(interp, "wrong # of elements in non-positional args ", "(should be 1 or 2 list elements): ", ObjStr(npArgs), (char *) NULL); } @@ -5479,7 +5479,7 @@ if (arg[0] != '-') { DECR_REF_COUNT(npaObj); DECR_REF_COUNT(nonposArgsObj); - return XOTclVarErrMsg(in, "non-positional args does not start with '-': ", + return XOTclVarErrMsg(interp, "non-positional args does not start with '-': ", arg, " in: ", ObjStr(npArgs), (char *) NULL); } @@ -5491,13 +5491,13 @@ int l; Tcl_Obj *list = Tcl_NewListObj(0, NULL); - Tcl_ListObjAppendElement(in, npaObj, Tcl_NewStringObj(arg+1, j-1)); + Tcl_ListObjAppendElement(interp, npaObj, Tcl_NewStringObj(arg+1, j-1)); start = j+1; while(start0 && isspace((int)arg[end-1]); end--); - Tcl_ListObjAppendElement(in, list, + Tcl_ListObjAppendElement(interp, list, Tcl_NewStringObj(arg+start, end-start)); l++; start = l; @@ -5506,19 +5506,19 @@ } /* append last arg */ for (end = l;end>0 && isspace((int)arg[end-1]); end--); - Tcl_ListObjAppendElement(in, list, + Tcl_ListObjAppendElement(interp, list, Tcl_NewStringObj(arg+start, end-start)); /* append the whole thing to the list */ - Tcl_ListObjAppendElement(in, npaObj, list); + Tcl_ListObjAppendElement(interp, npaObj, list); } else { - Tcl_ListObjAppendElement(in, npaObj, Tcl_NewStringObj(arg+1, length)); - Tcl_ListObjAppendElement(in, npaObj, Tcl_NewStringObj("", 0)); + Tcl_ListObjAppendElement(interp, npaObj, Tcl_NewStringObj(arg+1, length)); + Tcl_ListObjAppendElement(interp, npaObj, Tcl_NewStringObj("", 0)); } if (npac == 2) { - Tcl_ListObjAppendElement(in, npaObj, npav[1]); + Tcl_ListObjAppendElement(interp, npaObj, npav[1]); } - Tcl_ListObjAppendElement(in, nonposArgsObj, npaObj); + Tcl_ListObjAppendElement(interp, nonposArgsObj, npaObj); *haveNonposArgs = 1; } @@ -5551,7 +5551,7 @@ static int MakeProc(Tcl_Namespace *ns, XOTclAssertionStore *aStore, Tcl_HashTable **nonposArgsTable, - Tcl_Interp *in, int objc, Tcl_Obj *objv[], XOTclObject *obj) { + Tcl_Interp *interp, int objc, Tcl_Obj *objv[], XOTclObject *obj) { int result, incr, haveNonposArgs=0; TclCallFrame frame, *framePtr = &frame; Tcl_Obj *ov[4]; @@ -5566,7 +5566,7 @@ ov[1] = objv[1]; if (objc == 5 || objc == 7) { - if ((result = parseNonposArgs(in, procName, objv[2], objv[3], + if ((result = parseNonposArgs(interp, procName, objv[2], objv[3], nonposArgsTable, &haveNonposArgs)) != TCL_OK) return result; @@ -5583,9 +5583,9 @@ Tcl_Obj **argsv; /* see, if we have nonposArgs in the ordinary argument list */ - result = Tcl_ListObjGetElements(in, objv[2], &argsc, &argsv); + result = Tcl_ListObjGetElements(interp, objv[2], &argsc, &argsv); if (result != TCL_OK) { - return XOTclVarErrMsg(in, "cannot break args into list: ", + return XOTclVarErrMsg(interp, "cannot break args into list: ", ObjStr(objv[2]), (char *) NULL); } for (i=0; i 0) { arg = ObjStr(npav[0]); /* fprintf(stderr, "*** argparse1 arg='%s' rc=%d\n",arg,rc);*/ @@ -5614,7 +5614,7 @@ INCR_REF_COUNT(nonposArgs); /* fprintf(stderr, "nonpos <%s> ordinary <%s>\n", ObjStr(nonposArgs),ObjStr(ordinaryArgs));*/ - result = parseNonposArgs(in, procName, nonposArgs, ordinaryArgs, + result = parseNonposArgs(interp, procName, nonposArgs, ordinaryArgs, nonposArgsTable, &haveNonposArgs); DECR_REF_COUNT(ordinaryArgs); DECR_REF_COUNT(nonposArgs); @@ -5644,12 +5644,12 @@ } #endif - Tcl_PushCallFrame(in,(Tcl_CallFrame *)framePtr,ns,0); + Tcl_PushCallFrame(interp,(Tcl_CallFrame *)framePtr,ns,0); - result = Tcl_ProcObjCmd(0, in, 4, ov) != TCL_OK; + result = Tcl_ProcObjCmd(0, interp, 4, ov) != TCL_OK; #if defined(NAMESPACEINSTPROCS) { - Proc *procPtr = TclFindProc((Interp *)in, procName); + Proc *procPtr = TclFindProc((Interp *)interp, procName); /*fprintf(stderr,"proc=%p cmd=%p ns='%s' objns=%s\n",procPtr,procPtr->cmdPtr, procPtr->cmdPtr->nsPtr->fullName,cmd->nsPtr->fullName);*/ /*** patch the command ****/ @@ -5660,11 +5660,11 @@ } #endif - Tcl_PopCallFrame(in); + Tcl_PopCallFrame(interp); if (objc == 6 || objc == 7) { incr = (objc == 6) ? 0:1; - AssertionAddProc(in, ObjStr(objv[1]), aStore, objv[4+incr], objv[5+incr]); + AssertionAddProc(interp, ObjStr(objv[1]), aStore, objv[4+incr], objv[5+incr]); } DECR_REF_COUNT(ov[3]); @@ -5676,33 +5676,33 @@ * List-Functions for Info */ static int -ListInfo(Tcl_Interp *in, int isclass) { - Tcl_ResetResult(in); - Tcl_AppendElement(in, "vars"); Tcl_AppendElement(in, "body"); - Tcl_AppendElement(in, "default"); Tcl_AppendElement(in, "args"); - Tcl_AppendElement(in, "procs"); Tcl_AppendElement(in, "commands"); - Tcl_AppendElement(in, "class"); Tcl_AppendElement(in, "children"); - Tcl_AppendElement(in, "filter"); Tcl_AppendElement(in, "filterguard"); - Tcl_AppendElement(in, "forward"); - Tcl_AppendElement(in, "info"); - Tcl_AppendElement(in, "invar"); Tcl_AppendElement(in, "mixin"); - Tcl_AppendElement(in, "methods"); - Tcl_AppendElement(in, "parent"); - Tcl_AppendElement(in, "pre"); Tcl_AppendElement(in, "post"); - Tcl_AppendElement(in, "precedence"); +ListInfo(Tcl_Interp *interp, int isclass) { + Tcl_ResetResult(interp); + Tcl_AppendElement(interp, "vars"); Tcl_AppendElement(interp, "body"); + Tcl_AppendElement(interp, "default"); Tcl_AppendElement(interp, "args"); + Tcl_AppendElement(interp, "procs"); Tcl_AppendElement(interp, "commands"); + Tcl_AppendElement(interp, "class"); Tcl_AppendElement(interp, "children"); + Tcl_AppendElement(interp, "filter"); Tcl_AppendElement(interp, "filterguard"); + Tcl_AppendElement(interp, "forward"); + Tcl_AppendElement(interp, "info"); + Tcl_AppendElement(interp, "invar"); Tcl_AppendElement(interp, "mixin"); + Tcl_AppendElement(interp, "methods"); + Tcl_AppendElement(interp, "parent"); + Tcl_AppendElement(interp, "pre"); Tcl_AppendElement(interp, "post"); + Tcl_AppendElement(interp, "precedence"); if (isclass) { - Tcl_AppendElement(in, "superclass"); Tcl_AppendElement(in, "subclass"); - Tcl_AppendElement(in, "heritage"); Tcl_AppendElement(in, "instances"); - Tcl_AppendElement(in, "instcommands"); Tcl_AppendElement(in, "instprocs"); - Tcl_AppendElement(in, "instdefault"); Tcl_AppendElement(in, "instbody"); - Tcl_AppendElement(in, "instmixin"); - Tcl_AppendElement(in, "instforward"); - Tcl_AppendElement(in, "instmixinof"); Tcl_AppendElement(in, "mixinof"); - Tcl_AppendElement(in, "classchildren"); Tcl_AppendElement(in, "classparent"); - Tcl_AppendElement(in, "instfilter"); Tcl_AppendElement(in, "instfilterguard"); - Tcl_AppendElement(in, "instinvar"); - Tcl_AppendElement(in, "instpre"); Tcl_AppendElement(in, "instpost"); - Tcl_AppendElement(in, "parameter"); + Tcl_AppendElement(interp, "superclass"); Tcl_AppendElement(interp, "subclass"); + Tcl_AppendElement(interp, "heritage"); Tcl_AppendElement(interp, "instances"); + Tcl_AppendElement(interp, "instcommands"); Tcl_AppendElement(interp, "instprocs"); + Tcl_AppendElement(interp, "instdefault"); Tcl_AppendElement(interp, "instbody"); + Tcl_AppendElement(interp, "instmixin"); + Tcl_AppendElement(interp, "instforward"); + Tcl_AppendElement(interp, "instmixinof"); Tcl_AppendElement(interp, "mixinof"); + Tcl_AppendElement(interp, "classchildren"); Tcl_AppendElement(interp, "classparent"); + Tcl_AppendElement(interp, "instfilter"); Tcl_AppendElement(interp, "instfilterguard"); + Tcl_AppendElement(interp, "instinvar"); + Tcl_AppendElement(interp, "instpre"); Tcl_AppendElement(interp, "instpost"); + Tcl_AppendElement(interp, "parameter"); } return TCL_OK; } @@ -5720,17 +5720,17 @@ } static int -ListKeys(Tcl_Interp *in, Tcl_HashTable *table, char *pattern) { +ListKeys(Tcl_Interp *interp, Tcl_HashTable *table, char *pattern) { Tcl_HashEntry* hPtr; char *key; if (pattern && noMetaChars(pattern)) { hPtr = table ? Tcl_FindHashEntry(table, pattern) : 0; if (hPtr) { key = Tcl_GetHashKey(table, hPtr); - Tcl_SetResult(in, key, TCL_VOLATILE); + Tcl_SetResult(interp, key, TCL_VOLATILE); } else { - Tcl_SetObjResult(in, XOTclGlobalObjects[XOTE_EMPTY]); + Tcl_SetObjResult(interp, XOTclGlobalObjects[XOTE_EMPTY]); } } else { Tcl_Obj *list = Tcl_NewListObj(0, NULL); @@ -5739,17 +5739,17 @@ for (; hPtr; hPtr = Tcl_NextHashEntry(&hSrch)) { key = Tcl_GetHashKey(table, hPtr); if (!pattern || Tcl_StringMatch(key, pattern)) { - Tcl_ListObjAppendElement(in, list, Tcl_NewStringObj(key,-1)); + Tcl_ListObjAppendElement(interp, list, Tcl_NewStringObj(key,-1)); } } - Tcl_SetObjResult(in, list); + Tcl_SetObjResult(interp, list); } return TCL_OK; } #if !defined(PRE85) || FORWARD_COMPATIBLE static int -ListVarKeys(Tcl_Interp *in, Tcl_HashTable *tablePtr, char *pattern) { +ListVarKeys(Tcl_Interp *interp, Tcl_HashTable *tablePtr, char *pattern) { Tcl_HashEntry* hPtr; if (pattern && noMetaChars(pattern)) { @@ -5759,9 +5759,9 @@ hPtr = tablePtr ? Tcl_CreateHashEntry(tablePtr, (char *)patternObj, NULL) : 0; if (hPtr) { Var *val = VarHashGetValue(hPtr); - Tcl_SetObjResult(in, VarHashGetKey(val)); + Tcl_SetObjResult(interp, VarHashGetKey(val)); } else { - Tcl_SetObjResult(in, XOTclGlobalObjects[XOTE_EMPTY]); + Tcl_SetObjResult(interp, XOTclGlobalObjects[XOTE_EMPTY]); } DECR_REF_COUNT(patternObj); } else { @@ -5772,62 +5772,62 @@ Var *val = VarHashGetValue(hPtr); Tcl_Obj *key = VarHashGetKey(val); if (!pattern || Tcl_StringMatch(ObjStr(key), pattern)) { - Tcl_ListObjAppendElement(in, list, key); + Tcl_ListObjAppendElement(interp, list, key); } } - Tcl_SetObjResult(in, list); + Tcl_SetObjResult(interp, list); } return TCL_OK; } #endif static int -ListVars(Tcl_Interp *in, XOTclObject *obj, char *pattern) { +ListVars(Tcl_Interp *interp, XOTclObject *obj, char *pattern) { Tcl_Obj *varlist, *okList, *element; int i, length; TclVarHashTable *varTable = obj->nsPtr ? Tcl_Namespace_varTable(obj->nsPtr) : obj->varTable; #if defined(PRE85) # if FORWARD_COMPATIBLE if (forwardCompatibleMode) { - ListVarKeys(in, VarHashTable(varTable), pattern); + ListVarKeys(interp, VarHashTable(varTable), pattern); } else { - ListKeys(in, varTable, pattern); + ListKeys(interp, varTable, pattern); } # else - ListKeys(in, varTable, pattern); + ListKeys(interp, varTable, pattern); # endif #else - ListVarKeys(in, VarHashTable(varTable), pattern); + ListVarKeys(interp, VarHashTable(varTable), pattern); #endif - varlist = Tcl_GetObjResult(in); + varlist = Tcl_GetObjResult(interp); - Tcl_ListObjLength(in, varlist, &length); + Tcl_ListObjLength(interp, varlist, &length); okList = Tcl_NewListObj(0, NULL); for (i=0; icmdName); + Tcl_SetObjResult(interp, childobj->cmdName); } else { - Tcl_SetObjResult(in, XOTclGlobalObjects[XOTE_EMPTY]); + Tcl_SetObjResult(interp, XOTclGlobalObjects[XOTE_EMPTY]); } } else { Tcl_Obj *list = Tcl_NewListObj(0, NULL); @@ -5836,16 +5836,16 @@ for (; hPtr; hPtr = Tcl_NextHashEntry(&hSrch)) { XOTclObject *obj = (XOTclObject*)Tcl_GetHashKey(table, hPtr); if (!pattern || Tcl_StringMatch(ObjStr(obj->cmdName), pattern)) { - Tcl_ListObjAppendElement(in, list, obj->cmdName); + Tcl_ListObjAppendElement(interp, list, obj->cmdName); } } - Tcl_SetObjResult(in, list); + Tcl_SetObjResult(interp, list); } return TCL_OK; } static int -ListMethodKeys(Tcl_Interp *in, Tcl_HashTable *table, char *pattern, +ListMethodKeys(Tcl_Interp *interp, Tcl_HashTable *table, char *pattern, int noProcs, int noCmds, int noDups, int onlyForwarder) { Tcl_HashSearch hSrch; Tcl_HashEntry* hPtr = table ? Tcl_FirstHashEntry(table, &hSrch) : 0; @@ -5855,14 +5855,14 @@ Tcl_ObjCmdProc* proc = Tcl_Command_objProc(cmd); if (pattern && !Tcl_StringMatch(key, pattern)) continue; - if (noCmds && proc != RUNTIME_STATE(in)->objInterpProc) continue; - if (noProcs && proc == RUNTIME_STATE(in)->objInterpProc) continue; + if (noCmds && proc != RUNTIME_STATE(interp)->objInterpProc) continue; + if (noProcs && proc == RUNTIME_STATE(interp)->objInterpProc) continue; if (onlyForwarder && proc != XOTclForwardMethod) continue; /* XOTclObjscopedMethod ??? */ if (noDups) { int listc, i; Tcl_Obj **listv; - int result = Tcl_ListObjGetElements(in, Tcl_GetObjResult(in), &listc, &listv); + int result = Tcl_ListObjGetElements(interp, Tcl_GetObjResult(interp), &listc, &listv); size_t keylen = strlen(key); if (result == TCL_OK) { int found = 0; @@ -5878,13 +5878,13 @@ if (found) continue; } } - Tcl_AppendElement(in, key); + Tcl_AppendElement(interp, key); } return TCL_OK; } static int -forwardList(Tcl_Interp *in, Tcl_HashTable *table, char *pattern, +forwardList(Tcl_Interp *interp, Tcl_HashTable *table, char *pattern, int definition) { int rc; if (definition) { @@ -5896,26 +5896,26 @@ if (tcd) { Tcl_Obj *list = Tcl_NewListObj(0, NULL); if (tcd->prefix) { - Tcl_ListObjAppendElement(in, list, Tcl_NewStringObj("-methodprefix",-1)); - Tcl_ListObjAppendElement(in, list, tcd->prefix); + Tcl_ListObjAppendElement(interp, list, Tcl_NewStringObj("-methodprefix",-1)); + Tcl_ListObjAppendElement(interp, list, tcd->prefix); } if (tcd->subcommands) { - Tcl_ListObjAppendElement(in, list, Tcl_NewStringObj("-default",-1)); - Tcl_ListObjAppendElement(in, list, tcd->subcommands); + Tcl_ListObjAppendElement(interp, list, Tcl_NewStringObj("-default",-1)); + Tcl_ListObjAppendElement(interp, list, tcd->subcommands); } if (tcd->objscope) { - Tcl_ListObjAppendElement(in, list, Tcl_NewStringObj("-objscope",-1)); + Tcl_ListObjAppendElement(interp, list, Tcl_NewStringObj("-objscope",-1)); } - Tcl_ListObjAppendElement(in, list, tcd->cmdName); + Tcl_ListObjAppendElement(interp, list, tcd->cmdName); if (tcd->args) { Tcl_Obj **args; int nrArgs, i; - Tcl_ListObjGetElements(in, tcd->args, &nrArgs, &args); + Tcl_ListObjGetElements(interp, tcd->args, &nrArgs, &args); for (i=0; insPtr) { Tcl_HashTable *cmdTable = Tcl_Namespace_cmdTable(obj->nsPtr); - ListMethodKeys(in, cmdTable, pattern, noProcs, noCmds, 0, 0); + ListMethodKeys(interp, cmdTable, pattern, noProcs, noCmds, 0, 0); } if (!noMixins) { if (!(obj->flags & XOTCL_MIXIN_ORDER_VALID)) - MixinComputeDefined(in, obj); + MixinComputeDefined(interp, obj); if (obj->flags & XOTCL_MIXIN_ORDER_DEFINED_AND_VALID) { XOTclCmdList *ml = obj->mixinOrder; XOTclClass *mixin; while (ml) { int guardOk = TCL_OK; mixin = XOTclGetClassFromCmdPtr(ml->cmdPtr); if (inContext) { - XOTclCallStack *cs = &RUNTIME_STATE(in)->cs; + XOTclCallStack *cs = &RUNTIME_STATE(interp)->cs; if (!cs->guardCount) { - guardOk = GuardCall(obj, 0, 0, in, ml->clientData, 1); + guardOk = GuardCall(obj, 0, 0, interp, ml->clientData, 1); } } if (mixin && guardOk == TCL_OK) { Tcl_HashTable *cmdTable = Tcl_Namespace_cmdTable(mixin->nsPtr); - ListMethodKeys(in, cmdTable, pattern, noProcs, noCmds, 1, 0); + ListMethodKeys(interp, cmdTable, pattern, noProcs, noCmds, 1, 0); } ml = ml->next; } @@ -5965,18 +5965,18 @@ /* append per-class filters */ for (pl = ComputeOrder(obj->cl, obj->cl->order, Super); pl; pl = pl->next) { Tcl_HashTable *cmdTable = Tcl_Namespace_cmdTable(pl->cl->nsPtr); - ListMethodKeys(in, cmdTable, pattern, noProcs, noCmds, 1, 0); + ListMethodKeys(interp, cmdTable, pattern, noProcs, noCmds, 1, 0); } return TCL_OK; } static int XOTclCInfoMethod(ClientData, Tcl_Interp *, int, Tcl_Obj *CONST v[]); static int -ListClass(Tcl_Interp *in, XOTclObject *obj, char *pattern, +ListClass(Tcl_Interp *interp, XOTclObject *obj, char *pattern, int objc, Tcl_Obj *CONST objv[]) { if (pattern == NULL) { - Tcl_SetObjResult(in, obj->cl->object.cmdName); + Tcl_SetObjResult(interp, obj->cl->object.cmdName); return TCL_OK; } else { int result; @@ -5985,15 +5985,15 @@ memcpy(ov, objv, sizeof(Tcl_Obj *)*objc); ov[1] = Tcl_NewStringObj("superclass", 10); INCR_REF_COUNT(ov[1]); - result = XOTclCInfoMethod((ClientData)obj->cl, in, objc, ov); + result = XOTclCInfoMethod((ClientData)obj->cl, interp, objc, ov); DECR_REF_COUNT(ov[1]); FREE_ON_STACK(ov); return result; } } static int -ListSuperclasses(Tcl_Interp *in, XOTclClass *cl, char *pattern) { +ListSuperclasses(Tcl_Interp *interp, XOTclClass *cl, char *pattern) { if (pattern == NULL) { XOTclClasses* sl = cl->super; XOTclClasses* sc = 0; @@ -6002,56 +6002,56 @@ * reverse the list to obtain presentation order */ - Tcl_ResetResult(in); + Tcl_ResetResult(interp); while (sc != sl) { XOTclClasses* nl = sl; while (nl->next != sc) nl = nl->next; - Tcl_AppendElement(in, className(nl->cl)); + Tcl_AppendElement(interp, className(nl->cl)); sc = nl; } } else { - XOTclClass *isc = XOTclpGetClass(in, pattern); + XOTclClass *isc = XOTclpGetClass(interp, pattern); XOTclClasses* pl; if (isc == 0) { - /* return XOTclErrBadVal(in, "info superclass", "a class", pattern);*/ - Tcl_SetIntObj(Tcl_GetObjResult(in), 0); + /* return XOTclErrBadVal(interp, "info superclass", "a class", pattern);*/ + Tcl_SetIntObj(Tcl_GetObjResult(interp), 0); } else { /* * search precedence to see if we're related or not */ for (pl = ComputeOrder(cl, cl->order, Super); pl; pl = pl->next) { if (pl->cl == isc) { - Tcl_SetIntObj(Tcl_GetObjResult(in), 1); + Tcl_SetIntObj(Tcl_GetObjResult(interp), 1); break; } } if (pl == 0) - Tcl_SetIntObj(Tcl_GetObjResult(in), 0); + Tcl_SetIntObj(Tcl_GetObjResult(interp), 0); } } return TCL_OK; } static int -ListSubclasses(Tcl_Interp *in, XOTclClass *cl, char *pattern) { +ListSubclasses(Tcl_Interp *interp, XOTclClass *cl, char *pattern) { if (pattern == NULL) { XOTclClasses* sl = cl->sub; XOTclClasses* sc = 0; /* * order unimportant */ - Tcl_ResetResult(in); + Tcl_ResetResult(interp); for (sc = sl; sc != 0; sc = sc->next) - Tcl_AppendElement(in, className(sc->cl)); + Tcl_AppendElement(interp, className(sc->cl)); } else { - XOTclClass *isc = XOTclpGetClass(in, pattern); + XOTclClass *isc = XOTclpGetClass(interp, pattern); XOTclClasses* pl; XOTclClasses* saved; if (isc == 0) - return XOTclErrBadVal(in, "info subclass", "a class", pattern); + return XOTclErrBadVal(interp, "info subclass", "a class", pattern); saved = cl->order; cl->order = 0; @@ -6060,12 +6060,12 @@ */ for (pl = ComputeOrder(cl, cl->order, Sub); pl; pl = pl->next) { if (pl->cl == isc) { - Tcl_SetIntObj(Tcl_GetObjResult(in), 1); + Tcl_SetIntObj(Tcl_GetObjResult(interp), 1); break; } } if (pl == 0) - Tcl_SetIntObj(Tcl_GetObjResult(in), 0); + Tcl_SetIntObj(Tcl_GetObjResult(interp), 0); XOTclFreeClasses(cl->order); cl->order = saved; @@ -6076,24 +6076,24 @@ static int -ListHeritage(Tcl_Interp *in, XOTclClass *cl, char *pattern) { +ListHeritage(Tcl_Interp *interp, XOTclClass *cl, char *pattern) { XOTclClasses* pl = ComputeOrder(cl, cl->order, Super); - Tcl_ResetResult(in); + Tcl_ResetResult(interp); if (pl) pl=pl->next; for (; pl != 0; pl = pl->next) { char *name = className(pl->cl); if (pattern && !Tcl_StringMatch(name, pattern)) continue; - Tcl_AppendElement(in, name); + Tcl_AppendElement(interp, name); } return TCL_OK; } static int -ListPrecedence(Tcl_Interp *in, XOTclObject *obj, char *pattern) { +ListPrecedence(Tcl_Interp *interp, XOTclObject *obj, char *pattern) { XOTclClasses* pl; - Tcl_ResetResult(in); + Tcl_ResetResult(interp); if (!(obj->flags & XOTCL_MIXIN_ORDER_VALID)) - MixinComputeDefined(in, obj); + MixinComputeDefined(interp, obj); if (obj->flags & XOTCL_MIXIN_ORDER_DEFINED_AND_VALID) { XOTclCmdList *ml = obj->mixinOrder; @@ -6102,79 +6102,79 @@ XOTclClass *mixin = XOTclGetClassFromCmdPtr(ml->cmdPtr); char *name = className(mixin); if (pattern && !Tcl_StringMatch(name, pattern)) continue; - Tcl_AppendElement(in, name); + Tcl_AppendElement(interp, name); ml = ml->next; } } pl = ComputeOrder(obj->cl, obj->cl->order, Super); for (; pl != 0; pl = pl->next) { char *name = className(pl->cl); if (pattern && !Tcl_StringMatch(name, pattern)) continue; - Tcl_AppendElement(in, name); + Tcl_AppendElement(interp, name); } return TCL_OK; } static Proc* -FindProc(Tcl_Interp *in, Tcl_HashTable *table, char *name) { +FindProc(Tcl_Interp *interp, Tcl_HashTable *table, char *name) { Tcl_HashEntry* hPtr = table ? Tcl_FindHashEntry(table, name) : 0; if (hPtr) { Tcl_Command cmd = (Tcl_Command)Tcl_GetHashValue(hPtr); Tcl_ObjCmdProc *proc = Tcl_Command_objProc(cmd); - if (proc == RUNTIME_STATE(in)->objInterpProc) + if (proc == RUNTIME_STATE(interp)->objInterpProc) return (Proc*) Tcl_Command_objClientData(cmd); #if USE_INTERP_PROC - else if ((Tcl_CmdProc*)proc == RUNTIME_STATE(in)->interpProc) + else if ((Tcl_CmdProc*)proc == RUNTIME_STATE(interp)->interpProc) return (Proc*) Tcl_Command_clientData(cmd); #endif } return 0; } static int -ListProcArgs(Tcl_Interp *in, Tcl_HashTable *table, char *name) { - Proc* proc = FindProc(in, table, name); +ListProcArgs(Tcl_Interp *interp, Tcl_HashTable *table, char *name) { + Proc* proc = FindProc(interp, table, name); if (proc) { CompiledLocal *args = proc->firstLocalPtr; - Tcl_ResetResult(in); + Tcl_ResetResult(interp); for (;args != NULL; args = args->nextPtr) { if (TclIsCompiledLocalArgument(args)) - Tcl_AppendElement(in, args->name); + Tcl_AppendElement(interp, args->name); } return TCL_OK; } - return XOTclErrBadVal(in, "info args", "a tcl method name", name); + return XOTclErrBadVal(interp, "info args", "a tcl method name", name); } static int -ListArgsFromOrdinaryArgs(Tcl_Interp *in, XOTclNonposArgs* nonposArgs) { +ListArgsFromOrdinaryArgs(Tcl_Interp *interp, XOTclNonposArgs* nonposArgs) { int i, rc, ordinaryArgsDefc, defaultValueObjc; Tcl_Obj **ordinaryArgsDefv, **defaultValueObjv, *ordinaryArg, *argList = Tcl_NewListObj(0, NULL); - rc = Tcl_ListObjGetElements(in, nonposArgs->ordinaryArgs, + rc = Tcl_ListObjGetElements(interp, nonposArgs->ordinaryArgs, &ordinaryArgsDefc, &ordinaryArgsDefv); if (rc != TCL_OK) return TCL_ERROR; for (i=0; i < ordinaryArgsDefc; i++) { ordinaryArg = ordinaryArgsDefv[i]; - rc = Tcl_ListObjGetElements(in, ordinaryArg, + rc = Tcl_ListObjGetElements(interp, ordinaryArg, &defaultValueObjc, &defaultValueObjv); if (rc == TCL_OK && defaultValueObjc == 2) { ordinaryArg = defaultValueObjv[0]; } - Tcl_ListObjAppendElement(in, argList, ordinaryArg); + Tcl_ListObjAppendElement(interp, argList, ordinaryArg); } - Tcl_SetObjResult(in, argList); + Tcl_SetObjResult(interp, argList); return TCL_OK; } static int -GetProcDefault(Tcl_Interp *in, Tcl_HashTable *table, +GetProcDefault(Tcl_Interp *interp, Tcl_HashTable *table, char *name, char *arg, Tcl_Obj **resultObj) { - Proc* proc = FindProc(in, table, name); + Proc* proc = FindProc(interp, table, name); *resultObj = 0; if (proc) { CompiledLocal *ap; @@ -6193,43 +6193,43 @@ } static int -SetProcDefault(Tcl_Interp *in, Tcl_Obj *var, Tcl_Obj* defVal) { +SetProcDefault(Tcl_Interp *interp, Tcl_Obj *var, Tcl_Obj* defVal) { int result = TCL_OK; callFrameContext ctx = {0}; - CallStackUseActiveFrames(in,&ctx); + CallStackUseActiveFrames(interp,&ctx); if (defVal != 0) { - if (Tcl_ObjSetVar2(in, var, NULL, defVal, 0) != NULL) { - Tcl_SetIntObj(Tcl_GetObjResult(in), 1); + if (Tcl_ObjSetVar2(interp, var, NULL, defVal, 0) != NULL) { + Tcl_SetIntObj(Tcl_GetObjResult(interp), 1); } else { result = TCL_ERROR; } } else { - if (Tcl_ObjSetVar2(in, var, NULL, + if (Tcl_ObjSetVar2(interp, var, NULL, XOTclGlobalObjects[XOTE_EMPTY], 0) != NULL) { - Tcl_SetIntObj(Tcl_GetObjResult(in), 0); + Tcl_SetIntObj(Tcl_GetObjResult(interp), 0); } else { result = TCL_ERROR; } } - CallStackRestoreSavedFrames(in, &ctx); + CallStackRestoreSavedFrames(interp, &ctx); if (result == TCL_ERROR) { - XOTclVarErrMsg(in, "couldn't store default value in variable '", + XOTclVarErrMsg(interp, "couldn't store default value in variable '", var, "'", (char *) NULL); } return result; } static int -ListProcDefault(Tcl_Interp *in, Tcl_HashTable *table, +ListProcDefault(Tcl_Interp *interp, Tcl_HashTable *table, char *name, char *arg, Tcl_Obj *var) { Tcl_Obj *defVal; int result; - if (GetProcDefault(in, table, name, arg, &defVal) == TCL_OK) { - result = SetProcDefault(in, var, defVal); + if (GetProcDefault(interp, table, name, arg, &defVal) == TCL_OK) { + result = SetProcDefault(interp, var, defVal); } else { - XOTclVarErrMsg(in, "method '", name, + XOTclVarErrMsg(interp, "method '", name, "' doesn't exist or doesn't have an argument '", arg, "'", (char *) NULL); result = TCL_ERROR; @@ -6238,26 +6238,26 @@ } static int -ListDefaultFromOrdinaryArgs(Tcl_Interp *in, char *procName, +ListDefaultFromOrdinaryArgs(Tcl_Interp *interp, char *procName, XOTclNonposArgs* nonposArgs, char *arg, Tcl_Obj *var) { int i, rc, ordinaryArgsDefc, defaultValueObjc; Tcl_Obj **ordinaryArgsDefv, **defaultValueObjv, *ordinaryArg; - rc = Tcl_ListObjGetElements(in, nonposArgs->ordinaryArgs, + rc = Tcl_ListObjGetElements(interp, nonposArgs->ordinaryArgs, &ordinaryArgsDefc, &ordinaryArgsDefv); if (rc != TCL_OK) return TCL_ERROR; for (i=0; i < ordinaryArgsDefc; i++) { ordinaryArg = ordinaryArgsDefv[i]; - rc = Tcl_ListObjGetElements(in, ordinaryArg, + rc = Tcl_ListObjGetElements(interp, ordinaryArg, &defaultValueObjc, &defaultValueObjv); if (rc == TCL_OK && !strcmp(arg, ObjStr(defaultValueObjv[0]))) { - return SetProcDefault(in, var, defaultValueObjc == 2 ? + return SetProcDefault(interp, var, defaultValueObjc == 2 ? defaultValueObjv[1] : NULL); } } - XOTclVarErrMsg(in, "method '", procName, "' doesn't have an argument '", + XOTclVarErrMsg(interp, "method '", procName, "' doesn't have an argument '", arg, "'", (char *) NULL); return TCL_ERROR; } @@ -6272,18 +6272,18 @@ } static int -ListProcBody(Tcl_Interp *in, Tcl_HashTable *table, char *name) { - Proc* proc = FindProc(in, table, name); +ListProcBody(Tcl_Interp *interp, Tcl_HashTable *table, char *name) { + Proc* proc = FindProc(interp, table, name); if (proc) { char *body = ObjStr(proc->bodyPtr); - Tcl_SetObjResult(in, Tcl_NewStringObj(StripBodyPrefix(body), -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(StripBodyPrefix(body), -1)); return TCL_OK; } - return XOTclErrBadVal(in, "info body", "a tcl method name", name); + return XOTclErrBadVal(interp, "info body", "a tcl method name", name); } static int -ListChildren(Tcl_Interp *in, XOTclObject *obj, char *pattern, int classesOnly) { +ListChildren(Tcl_Interp *interp, XOTclObject *obj, char *pattern, int classesOnly) { XOTclObject *childobj; Tcl_HashTable *cmdTable; XOTcl_FrameDecls; @@ -6292,61 +6292,61 @@ cmdTable = Tcl_Namespace_cmdTable(obj->nsPtr); if (pattern && noMetaChars(pattern)) { - XOTcl_PushFrame(in, obj); - if ((childobj = XOTclpGetObject(in, pattern)) && + XOTcl_PushFrame(interp, obj); + if ((childobj = XOTclpGetObject(interp, pattern)) && (!classesOnly || XOTclObjectIsClass(childobj)) && (childobj->id && Tcl_Command_nsPtr(childobj->id) == obj->nsPtr) /* true children */ ) { - Tcl_SetObjResult(in, childobj->cmdName); + Tcl_SetObjResult(interp, childobj->cmdName); } else { - Tcl_SetObjResult(in, XOTclGlobalObjects[XOTE_EMPTY]); + Tcl_SetObjResult(interp, XOTclGlobalObjects[XOTE_EMPTY]); } - XOTcl_PopFrame(in,obj); + XOTcl_PopFrame(interp,obj); } else { Tcl_Obj *list = Tcl_NewListObj(0, NULL); Tcl_HashSearch hSrch; Tcl_HashEntry* hPtr = Tcl_FirstHashEntry(cmdTable, &hSrch); char *key; - XOTcl_PushFrame(in, obj); + XOTcl_PushFrame(interp, obj); for (; hPtr != 0; hPtr = Tcl_NextHashEntry(&hSrch)) { key = Tcl_GetHashKey(cmdTable, hPtr); if (!pattern || Tcl_StringMatch(key, pattern)) { - if ((childobj = XOTclpGetObject(in, key)) && + if ((childobj = XOTclpGetObject(interp, key)) && (!classesOnly || XOTclObjectIsClass(childobj)) && (childobj->id && Tcl_Command_nsPtr(childobj->id) == obj->nsPtr) /* true children */ ) { - Tcl_ListObjAppendElement(in, list, childobj->cmdName); + Tcl_ListObjAppendElement(interp, list, childobj->cmdName); } } } - XOTcl_PopFrame(in,obj); - Tcl_SetObjResult(in, list); + XOTcl_PopFrame(interp,obj); + Tcl_SetObjResult(interp, list); } return TCL_OK; } static int -ListParent(Tcl_Interp *in, XOTclObject *obj) { +ListParent(Tcl_Interp *interp, XOTclObject *obj) { if (obj->id) { - Tcl_SetResult(in, NSCmdFullName(obj->id), TCL_VOLATILE); + Tcl_SetResult(interp, NSCmdFullName(obj->id), TCL_VOLATILE); } return TCL_OK; } static XOTclClass* -FindCalledClass(Tcl_Interp *in, XOTclObject *obj) { +FindCalledClass(Tcl_Interp *interp, XOTclObject *obj) { char *methodName = 0; XOTclClass *cl; Tcl_Command cmd = NULL; - XOTclCallStackContent *csc = CallStackGetTopFrame(in); + XOTclCallStackContent *csc = CallStackGetTopFrame(interp); if (csc->frameType == XOTCL_CSC_TYPE_PLAIN) - return GetSelfClass(in); + return GetSelfClass(interp); if (csc->frameType == XOTCL_CSC_TYPE_ACTIVE_FILTER) methodName = ObjStr(csc->filterStackEntry->calledProc); else if (csc->frameType == XOTCL_CSC_TYPE_ACTIVE_MIXIN && obj->mixinStack) - methodName = (char *) GetSelfProc(in); + methodName = (char *) GetSelfProc(interp); if (!methodName) methodName = ""; @@ -6365,7 +6365,7 @@ * Next Primitive Handling */ XOTCLINLINE static void -NextSearchMethod(XOTclObject *obj, Tcl_Interp *in, XOTclCallStackContent *csc, +NextSearchMethod(XOTclObject *obj, Tcl_Interp *interp, XOTclCallStackContent *csc, XOTclClass **cl, char **method, Tcl_ObjCmdProc **proc, Tcl_Command *cmd, ClientData *cp, int* isMixinEntry, int* isFilterEntry, int* endOfFilterChain, Tcl_Command* currentCmd) { @@ -6378,14 +6378,14 @@ */ /*assert(obj->flags & XOTCL_FILTER_ORDER_VALID); *** strange, worked before ****/ - FilterComputeDefined(in, obj); + FilterComputeDefined(interp, obj); if ((obj->flags & XOTCL_FILTER_ORDER_VALID) && obj->filterStack && obj->filterStack->currentCmdPtr) { - *cmd = FilterSearchProc(in, obj, proc, cp, currentCmd,cl); + *cmd = FilterSearchProc(interp, obj, proc, cp, currentCmd,cl); /*fprintf(stderr,"EndOfChain? proc=%p, cmd=%p\n",*proc,*cmd);*/ - /* XOTclCallStackDump(in); XOTclStackDump(in);*/ + /* XOTclCallStackDump(interp); XOTclStackDump(interp);*/ if (*proc == 0) { if (csc->frameType == XOTCL_CSC_TYPE_ACTIVE_FILTER) { @@ -6398,7 +6398,7 @@ /*fprintf(stderr,"EndOfChain resetting cl\n");*/ } } else { - *method = (char *) Tcl_GetCommandName(in, *cmd); + *method = (char *) Tcl_GetCommandName(interp, *cmd); *isFilterEntry = 1; return; } @@ -6408,14 +6408,14 @@ * Next in Mixins */ assert(obj->flags & XOTCL_MIXIN_ORDER_VALID); - /* otherwise: MixinComputeDefined(in, obj); */ + /* otherwise: MixinComputeDefined(interp, obj); */ /*fprintf(stderr,"nextsearch: mixinorder valid %d stack=%p\n", obj->flags & XOTCL_MIXIN_ORDER_VALID, obj->mixinStack);*/ if ((obj->flags & XOTCL_MIXIN_ORDER_VALID) && obj->mixinStack) { - *cmd = MixinSearchProc(in, obj, *method, cl, proc, cp, currentCmd); + *cmd = MixinSearchProc(interp, obj, *method, cl, proc, cp, currentCmd); /*fprintf(stderr,"nextsearch: mixinsearch cmd %p, proc=%p\n",*cmd,*proc);*/ if (*proc == 0) { if (csc->frameType == XOTCL_CSC_TYPE_ACTIVE_MIXIN) { @@ -6469,10 +6469,10 @@ } static int -XOTclNextMethod(XOTclObject *obj, Tcl_Interp *in, XOTclClass *givenCl, +XOTclNextMethod(XOTclObject *obj, Tcl_Interp *interp, XOTclClass *givenCl, char *givenMethod, int objc, Tcl_Obj *CONST objv[], int useCallstackObjs) { - XOTclCallStackContent *csc = CallStackGetTopFrame(in); + XOTclCallStackContent *csc = CallStackGetTopFrame(interp); Tcl_ObjCmdProc *proc = 0; Tcl_Command cmd, currentCmd = NULL; ClientData cp = 0; @@ -6486,12 +6486,12 @@ #if !defined(NDEBUG) if (useCallstackObjs) { - Tcl_CallFrame *cf = (Tcl_CallFrame *)Tcl_Interp_varFramePtr(in); + Tcl_CallFrame *cf = (Tcl_CallFrame *)Tcl_Interp_varFramePtr(interp); int found = 0; while (cf) { /* fprintf(stderr, " ... compare fp = %p and cfp %p procFrame %p oc=%d\n", cf, csc->currentFramePtr, - Tcl_Interp_framePtr(in), Tcl_CallFrame_objc(Tcl_Interp_framePtr(in)) + Tcl_Interp_framePtr(interp), Tcl_CallFrame_objc(Tcl_Interp_framePtr(interp)) );*/ if (cf == csc->currentFramePtr) { found = 1; @@ -6501,10 +6501,10 @@ } /* if (!found) { - if (Tcl_Interp_varFramePtr(in)) { + if (Tcl_Interp_varFramePtr(interp)) { fprintf(stderr,"found (csc->currentFramePtr %p)= %d cur level=%d\n", csc->currentFramePtr,found, - Tcl_CallFrame_level(Tcl_Interp_varFramePtr(in))); + Tcl_CallFrame_level(Tcl_Interp_varFramePtr(interp))); } else { fprintf(stderr,"no varFramePtr\n"); } @@ -6530,7 +6530,7 @@ /* * Search the next method & compute its method data */ - NextSearchMethod(obj, in, csc, cl, method, &proc, &cmd, &cp, + NextSearchMethod(obj, interp, csc, cl, method, &proc, &cmd, &cp, &isMixinEntry, &isFilterEntry, &endOfFilterChain, ¤tCmd); /* @@ -6544,7 +6544,7 @@ isMixinEntry, isFilterEntry, proc); */ - Tcl_ResetResult(in); /* needed for bytecode support */ + Tcl_ResetResult(interp); /* needed for bytecode support */ if (proc != 0) { /* @@ -6585,10 +6585,10 @@ nobjc = 1; } csc->callType |= XOTCL_CSC_CALL_IS_NEXT; - RUNTIME_STATE(in)->unknown = 0; + RUNTIME_STATE(interp)->unknown = 0; - result = DoCallProcCheck(cp, (ClientData)obj, in, nobjc, nobjv, cmd, + result = DoCallProcCheck(cp, (ClientData)obj, interp, nobjc, nobjv, cmd, obj, *cl, *method, frameType, 1/*fromNext*/); csc->callType &= ~XOTCL_CSC_CALL_IS_NEXT; @@ -6599,74 +6599,74 @@ csc->frameType = XOTCL_CSC_TYPE_ACTIVE_MIXIN; } else if (result == TCL_OK && endOfFilterChain) { /*fprintf(stderr,"setting unknown to 1\n");*/ - RUNTIME_STATE(in)->unknown = 1; + RUNTIME_STATE(interp)->unknown = 1; } return result; } int -XOTclNextObjCmd(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { - XOTclCallStackContent *csc = CallStackGetTopFrame(in); +XOTclNextObjCmd(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { + XOTclCallStackContent *csc = CallStackGetTopFrame(interp); if (!csc->self) - return XOTclVarErrMsg(in, "next: can't find self", (char *) NULL); + return XOTclVarErrMsg(interp, "next: can't find self", (char *) NULL); if (!csc->cmdPtr) - return XOTclErrMsg(in, "next: no executing proc", TCL_STATIC); + return XOTclErrMsg(interp, "next: no executing proc", TCL_STATIC); - return XOTclNextMethod(csc->self, in, csc->cl, - (char *)Tcl_GetCommandName(in, csc->cmdPtr), + return XOTclNextMethod(csc->self, interp, csc->cl, + (char *)Tcl_GetCommandName(interp, csc->cmdPtr), objc, objv, 1); } int -XOTclQualifyObjCmd(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTclQualifyObjCmd(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { char *string; if (objc != 2) - return XOTclVarErrMsg(in, "wrong # of args for __qualify", (char *) NULL); + return XOTclVarErrMsg(interp, "wrong # of args for __qualify", (char *) NULL); string = ObjStr(objv[1]); if (!isAbsolutePath(string)) { - Tcl_SetObjResult(in, NameInNamespaceObj(in,string,callingNameSpace(in))); + Tcl_SetObjResult(interp, NameInNamespaceObj(interp,string,callingNameSpace(interp))); } else { - Tcl_SetObjResult(in, objv[1]); + Tcl_SetObjResult(interp, objv[1]); } return TCL_OK; } /* method for calling e.g. $obj __next */ static int -XOTclONextMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTclONextMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { XOTclObject *obj = (XOTclObject*)cd; - XOTclCallStack *cs = &RUNTIME_STATE(in)->cs; - XOTclCallStackContent *csc = CallStackGetTopFrame(in); + XOTclCallStack *cs = &RUNTIME_STATE(interp)->cs; + XOTclCallStackContent *csc = CallStackGetTopFrame(interp); char *methodName; for (; csc >= cs->content; csc--) { if (csc->self == obj) break; } if (csccontent) - return XOTclVarErrMsg(in, "__next: can't find object", + return XOTclVarErrMsg(interp, "__next: can't find object", ObjStr(obj->cmdName), (char *) NULL); - methodName = (char *)Tcl_GetCommandName(in, csc->cmdPtr); + methodName = (char *)Tcl_GetCommandName(interp, csc->cmdPtr); /*fprintf(stderr,"******* next for proc %s\n", methodName);*/ - return XOTclNextMethod(obj, in, csc->cl, methodName, objc-1, &objv[1], 0); + return XOTclNextMethod(obj, interp, csc->cl, methodName, objc-1, &objv[1], 0); } #if 0 /* method next for calling e.g. $obj next */ static int -XOTclONextMethod2(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTclONextMethod2(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { XOTclObject *obj = (XOTclObject*)cd; int result, nobjc; - /*XOTclCallStack *cs = &RUNTIME_STATE(in)->cs;*/ - XOTclCallStackContent *csc = CallStackGetTopFrame(in); + /*XOTclCallStack *cs = &RUNTIME_STATE(interp)->cs;*/ + XOTclCallStackContent *csc = CallStackGetTopFrame(interp); Tcl_Obj **nobjv; - if (!obj) return XOTclObjErrType(in, objv[0], "Object"); + if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); /* if no args are given => use args from stack */ if (objc < 2) { @@ -6680,11 +6680,11 @@ ALLOC_ON_STACK(Tcl_Obj*,nobjc + 1, ov); memcpy(ov+1, nobjv, sizeof(Tcl_Obj *)*nobjc); ov[0] = obj->cmdName; - result = ObjDispatch(cd, in, nobjc+1, ov, 0); + result = ObjDispatch(cd, interp, nobjc+1, ov, 0); FREE_ON_STACK(ov); } /*fprintf(stderr,"******* next for proc %s\n", methodName);*/ - /*result = Tcl_EvalObjv(in, objc, ov, 0);*/ + /*result = Tcl_EvalObjv(interp, objc, ov, 0);*/ return result; } #endif @@ -6694,8 +6694,8 @@ */ static int -FindSelfNext(Tcl_Interp *in, XOTclObject *obj) { - XOTclCallStackContent *csc = CallStackGetTopFrame(in); +FindSelfNext(Tcl_Interp *interp, XOTclObject *obj) { + XOTclCallStackContent *csc = CallStackGetTopFrame(interp); Tcl_ObjCmdProc *proc = 0; Tcl_Command cmd, currentCmd = 0; ClientData cp = 0; @@ -6706,35 +6706,35 @@ XOTclObject *o = csc->self; char *methodName; - Tcl_ResetResult(in); + Tcl_ResetResult(interp); - methodName = (char *) GetSelfProc(in); + methodName = (char *) GetSelfProc(interp); if (!methodName) return TCL_OK; - NextSearchMethod(o, in, csc, &cl, &methodName, &proc, &cmd, &cp, + NextSearchMethod(o, interp, csc, &cl, &methodName, &proc, &cmd, &cp, &isMixinEntry, &isFilterEntry, &endOfFilterChain, ¤tCmd); if (cmd) { - Tcl_SetObjResult(in, getFullProcQualifier(in, Tcl_GetCommandName(in, cmd), + Tcl_SetObjResult(interp, getFullProcQualifier(interp, Tcl_GetCommandName(interp, cmd), o, cl, cmd)); } return TCL_OK; } static Tcl_Obj * -computeLevelObj(Tcl_Interp *in, CallStackLevel level) { - XOTclCallStack *cs = &RUNTIME_STATE(in)->cs; +computeLevelObj(Tcl_Interp *interp, CallStackLevel level) { + XOTclCallStack *cs = &RUNTIME_STATE(interp)->cs; XOTclCallStackContent *csc; Tcl_Obj *resultObj; switch (level) { - case CALLING_LEVEL: csc = XOTclCallStackFindLastInvocation(in, 1); break; - case ACTIVE_LEVEL: csc = XOTclCallStackFindActiveFrame(in, 1); break; + case CALLING_LEVEL: csc = XOTclCallStackFindLastInvocation(interp, 1); break; + case ACTIVE_LEVEL: csc = XOTclCallStackFindActiveFrame(interp, 1); break; default: csc = NULL; } - if (cs->top->currentFramePtr == ((Tcl_CallFrame *)Tcl_Interp_varFramePtr(in)) + if (cs->top->currentFramePtr == ((Tcl_CallFrame *)Tcl_Interp_varFramePtr(interp)) && csc && csc < cs->top && csc->currentFramePtr) { /* this was from an xotcl frame, return absolute frame number */ char buffer[LONG_AS_STRING]; @@ -6747,111 +6747,111 @@ /* If not called from an xotcl frame, return 1 as default */ resultObj = Tcl_NewIntObj(1); } - /*XOTclStackDump(in);XOTclCallStackDump(in);*/ + /*XOTclStackDump(interp);XOTclCallStackDump(interp);*/ return resultObj; } static int -XOTclSelfSubCommand(Tcl_Interp *in, XOTclObject *obj, char *option) { +XOTclSelfSubCommand(Tcl_Interp *interp, XOTclObject *obj, char *option) { assert(option); if (isProcString(option)) { /* proc subcommand */ - char *procName = (char *) GetSelfProc(in); + char *procName = (char *) GetSelfProc(interp); if (procName) { - Tcl_SetResult(in, procName, TCL_VOLATILE); + Tcl_SetResult(interp, procName, TCL_VOLATILE); return TCL_OK; } else { - return XOTclVarErrMsg(in, "Can't find proc", (char *) NULL); + return XOTclVarErrMsg(interp, "Can't find proc", (char *) NULL); } } else if (isClassString(option)) { /* class subcommand */ - XOTclClass *cl = GetSelfClass(in); - Tcl_SetObjResult(in, cl ? cl->object.cmdName : XOTclGlobalObjects[XOTE_EMPTY]); + XOTclClass *cl = GetSelfClass(interp); + Tcl_SetObjResult(interp, cl ? cl->object.cmdName : XOTclGlobalObjects[XOTE_EMPTY]); return TCL_OK; } else { XOTclCallStackContent *csc = NULL; switch (*option) { /* other callstack information */ case 'a': if (!strcmp(option, "activelevel")) { - Tcl_SetObjResult(in, computeLevelObj(in, ACTIVE_LEVEL)); + Tcl_SetObjResult(interp, computeLevelObj(interp, ACTIVE_LEVEL)); return TCL_OK; } else if (!strcmp(option,"args")) { int nobjc; Tcl_Obj **nobjv; - csc = CallStackGetTopFrame(in); + csc = CallStackGetTopFrame(interp); nobjc = Tcl_CallFrame_objc(csc->currentFramePtr); nobjv = (Tcl_Obj **)Tcl_CallFrame_objv(csc->currentFramePtr); - Tcl_SetObjResult(in, Tcl_NewListObj(nobjc-1,nobjv+1)); + Tcl_SetObjResult(interp, Tcl_NewListObj(nobjc-1,nobjv+1)); return TCL_OK; } #if defined(ACTIVEMIXIN) else if (!strcmp(option, "activemixin")) { XOTclObject *o = NULL; - csc = CallStackGetTopFrame(in); - /*CmdListPrint(in,"self a....\n", obj->mixinOrder); + csc = CallStackGetTopFrame(interp); + /*CmdListPrint(interp,"self a....\n", obj->mixinOrder); fprintf(stderr,"current cmdPtr = %p cl = %p, mo=%p %p\n", csc->cmdPtr, csc->cl, - obj->mixinOrder, RUNTIME_STATE(in)->cmdPtr);*/ - if (RUNTIME_STATE(in)->cmdPtr) { - o = XOTclGetObjectFromCmdPtr(RUNTIME_STATE(in)->cmdPtr); + obj->mixinOrder, RUNTIME_STATE(interp)->cmdPtr);*/ + if (RUNTIME_STATE(interp)->cmdPtr) { + o = XOTclGetObjectFromCmdPtr(RUNTIME_STATE(interp)->cmdPtr); } - Tcl_SetObjResult(in, o ? o->cmdName : XOTclGlobalObjects[XOTE_EMPTY]); + Tcl_SetObjResult(interp, o ? o->cmdName : XOTclGlobalObjects[XOTE_EMPTY]); return TCL_OK; } #endif break; case 'c': if (!strcmp(option, "calledproc")) { - if (!(csc = CallStackFindActiveFilter(in))) - return XOTclVarErrMsg(in, + if (!(csc = CallStackFindActiveFilter(interp))) + return XOTclVarErrMsg(interp, "self calledproc called from outside of a filter", (char *) NULL); - Tcl_SetObjResult(in, csc->filterStackEntry->calledProc); + Tcl_SetObjResult(interp, csc->filterStackEntry->calledProc); return TCL_OK; } else if (!strcmp(option, "calledclass")) { - Tcl_SetResult(in, className(FindCalledClass(in, obj)), TCL_VOLATILE); + Tcl_SetResult(interp, className(FindCalledClass(interp, obj)), TCL_VOLATILE); return TCL_OK; } else if (!strcmp(option, "callingproc")) { - csc = XOTclCallStackFindLastInvocation(in, 1); - Tcl_SetResult(in, csc ? (char *)Tcl_GetCommandName(in, csc->cmdPtr) : "", + csc = XOTclCallStackFindLastInvocation(interp, 1); + Tcl_SetResult(interp, csc ? (char *)Tcl_GetCommandName(interp, csc->cmdPtr) : "", TCL_VOLATILE); return TCL_OK; } else if (!strcmp(option, "callingclass")) { - csc = XOTclCallStackFindLastInvocation(in, 1); - Tcl_SetObjResult(in, csc && csc->cl ? csc->cl->object.cmdName : + csc = XOTclCallStackFindLastInvocation(interp, 1); + Tcl_SetObjResult(interp, csc && csc->cl ? csc->cl->object.cmdName : XOTclGlobalObjects[XOTE_EMPTY]); return TCL_OK; } else if (!strcmp(option, "callinglevel")) { - Tcl_SetObjResult(in, computeLevelObj(in, CALLING_LEVEL)); + Tcl_SetObjResult(interp, computeLevelObj(interp, CALLING_LEVEL)); return TCL_OK; } else if (!strcmp(option, "callingobject")) { - /*XOTclStackDump(in); XOTclCallStackDump(in);*/ + /*XOTclStackDump(interp); XOTclCallStackDump(interp);*/ - csc = XOTclCallStackFindLastInvocation(in, 1); - Tcl_SetObjResult(in, csc ? csc->self->cmdName : XOTclGlobalObjects[XOTE_EMPTY]); + csc = XOTclCallStackFindLastInvocation(interp, 1); + Tcl_SetObjResult(interp, csc ? csc->self->cmdName : XOTclGlobalObjects[XOTE_EMPTY]); return TCL_OK; } break; case 'f': if (!strcmp(option, "filterreg")) { - if (!(csc = CallStackFindActiveFilter(in))) { - return XOTclVarErrMsg(in, + if (!(csc = CallStackFindActiveFilter(interp))) { + return XOTclVarErrMsg(interp, "self filterreg called from outside of a filter", (char *) NULL); } - Tcl_SetObjResult(in, FilterFindReg(in, obj, GetSelfProcCmdPtr(in))); + Tcl_SetObjResult(interp, FilterFindReg(interp, obj, GetSelfProcCmdPtr(interp))); return TCL_OK; } break; case 'i': if (!strcmp(option, "isnextcall")) { - XOTclCallStack *cs = &RUNTIME_STATE(in)->cs; + XOTclCallStack *cs = &RUNTIME_STATE(interp)->cs; csc = cs->top; csc--; - Tcl_SetBooleanObj(Tcl_GetObjResult(in), + Tcl_SetBooleanObj(Tcl_GetObjResult(interp), (csc > cs->content && (csc->callType & XOTCL_CSC_CALL_IS_NEXT))); return TCL_OK; @@ -6860,50 +6860,50 @@ case 'n': if (!strcmp(option, "next")) - return FindSelfNext(in, obj); + return FindSelfNext(interp, obj); break; } } - return XOTclVarErrMsg(in, "unknown option '", option, + return XOTclVarErrMsg(interp, "unknown option '", option, "' for self", (char *) NULL); } /* int - XOTclKObjCmd(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { + XOTclKObjCmd(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { if (objc < 2) - return XOTclVarErrMsg(in, "wrong # of args for K", (char *) NULL); + return XOTclVarErrMsg(interp, "wrong # of args for K", (char *) NULL); - Tcl_SetObjResult(in, objv[1]); + Tcl_SetObjResult(interp, objv[1]); return TCL_OK; } */ int -XOTclGetSelfObjCmd(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTclGetSelfObjCmd(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { XOTclObject *obj; if (objc > 2) - return XOTclVarErrMsg(in, "wrong # of args for self", (char *) NULL); + return XOTclVarErrMsg(interp, "wrong # of args for self", (char *) NULL); - obj = GetSelfObj(in); + obj = GetSelfObj(interp); - /*fprintf(stderr,"getSelfObj returns %p\n",obj);XOTclCallStackDump(in);*/ + /*fprintf(stderr,"getSelfObj returns %p\n",obj);XOTclCallStackDump(interp);*/ if (!obj) { if (objc == 2 && !strcmp(ObjStr(objv[1]),"callinglevel")) { - Tcl_SetIntObj(Tcl_GetObjResult(in), 1); + Tcl_SetIntObj(Tcl_GetObjResult(interp), 1); return TCL_OK; } else { - return XOTclVarErrMsg(in, "self: no current object", (char *) NULL); + return XOTclVarErrMsg(interp, "self: no current object", (char *) NULL); } } if (objc == 1) { - Tcl_SetObjResult(in, obj->cmdName); + Tcl_SetObjResult(interp, obj->cmdName); return TCL_OK; } else { - return XOTclSelfSubCommand(in, obj, ObjStr(objv[1])); + return XOTclSelfSubCommand(interp, obj, ObjStr(objv[1])); } } @@ -6913,7 +6913,7 @@ */ static int -unsetInAllNamespaces(Tcl_Interp *in, Namespace *nsPtr, char *name) { +unsetInAllNamespaces(Tcl_Interp *interp, Namespace *nsPtr, char *name) { int rc = 0; fprintf(stderr, "### unsetInAllNamespaces %s\n",name); if (nsPtr != NULL) { @@ -6922,7 +6922,7 @@ Tcl_Var *varPtr; int rc = 0; - varPtr = (Tcl_Var *) Tcl_FindNamespaceVar(in, name, (Tcl_Namespace *) nsPtr, 0); + varPtr = (Tcl_Var *) Tcl_FindNamespaceVar(interp, name, (Tcl_Namespace *) nsPtr, 0); /*fprintf(stderr, "found %s in %s -> %p\n",name, nsPtr->fullName, varPtr);*/ if (varPtr) { Tcl_DString dFullname, *dsPtr = &dFullname; @@ -6931,13 +6931,13 @@ Tcl_DStringAppend(dsPtr, nsPtr->fullName, -1); Tcl_DStringAppend(dsPtr, "::", 2); Tcl_DStringAppend(dsPtr, name, -1); - /*rc = Tcl_UnsetVar2(in, Tcl_DStringValue(dsPtr), NULL, TCL_LEAVE_ERR_MSG);*/ - rc = Tcl_Eval(in, Tcl_DStringValue(dsPtr)); + /*rc = Tcl_UnsetVar2(interp, Tcl_DStringValue(dsPtr), NULL, TCL_LEAVE_ERR_MSG);*/ + rc = Tcl_Eval(interp, Tcl_DStringValue(dsPtr)); /* fprintf(stderr, "fqName = '%s' unset => %d %d\n",Tcl_DStringValue(dsPtr), rc, TCL_OK);*/ if (rc == TCL_OK) { rc = 1; } else { - Tcl_Obj *resultObj = Tcl_GetObjResult(in); + Tcl_Obj *resultObj = Tcl_GetObjResult(interp); fprintf(stderr, " err = '%s'\n", ObjStr(resultObj)); } Tcl_DStringFree(dsPtr); @@ -6947,14 +6947,14 @@ Namespace *childNsPtr = (Namespace *) Tcl_GetHashValue(entryPtr); /*fprintf(stderr, "child = %s\n", childNsPtr->fullName);*/ entryPtr = Tcl_NextHashEntry(&search); - rc |= unsetInAllNamespaces(in, childNsPtr, name); + rc |= unsetInAllNamespaces(interp, childNsPtr, name); } } return rc; } static int -freeUnsetTraceVariable(Tcl_Interp *in, XOTclObject *obj) { +freeUnsetTraceVariable(Tcl_Interp *interp, XOTclObject *obj) { int rc = TCL_OK; if (obj->opt && obj->opt->volatileVarName) { /* @@ -6967,12 +6967,12 @@ */ /*fprintf(stderr,"### freeUnsetTraceVariable %s\n", obj->opt->volatileVarName);*/ - rc = Tcl_UnsetVar2(in, obj->opt->volatileVarName, NULL, 0); + rc = Tcl_UnsetVar2(interp, obj->opt->volatileVarName, NULL, 0); if (rc != TCL_OK) { - int rc = Tcl_UnsetVar2(in, obj->opt->volatileVarName, NULL, TCL_GLOBAL_ONLY); + int rc = Tcl_UnsetVar2(interp, obj->opt->volatileVarName, NULL, TCL_GLOBAL_ONLY); if (rc != TCL_OK) { - Namespace *nsPtr = (Namespace *) Tcl_GetCurrentNamespace(in); - if (unsetInAllNamespaces(in, nsPtr, obj->opt->volatileVarName) == 0) { + Namespace *nsPtr = (Namespace *) Tcl_GetCurrentNamespace(interp); + if (unsetInAllNamespaces(interp, nsPtr, obj->opt->volatileVarName) == 0) { fprintf(stderr, "### don't know how to delete variable '%s' of volatile object\n", obj->opt->volatileVarName); } @@ -6986,7 +6986,7 @@ } static char * -XOTclUnsetTrace(ClientData cd, Tcl_Interp *in, CONST84 char *name, CONST84 char *name2, int flags) +XOTclUnsetTrace(ClientData cd, Tcl_Interp *interp, CONST84 char *name, CONST84 char *name2, int flags) { Tcl_Obj *obj = (Tcl_Obj *)cd; XOTclObject *o; @@ -6996,21 +6996,21 @@ flags & TCL_INTERP_DESTROYED); */ if ((flags & TCL_INTERP_DESTROYED) == 0) { - if (XOTclObjConvertObject(in, obj, &o) == TCL_OK) { - Tcl_Obj *res = Tcl_GetObjResult(in); /* save the result */ + if (XOTclObjConvertObject(interp, obj, &o) == TCL_OK) { + Tcl_Obj *res = Tcl_GetObjResult(interp); /* save the result */ INCR_REF_COUNT(res); /* clear variable, destroy is called from trace */ if (o->opt && o->opt->volatileVarName) { o->opt->volatileVarName = NULL; } - if (callMethod((ClientData)o, in, XOTclGlobalObjects[XOTE_DESTROY],2,0,0) != TCL_OK) { + if (callMethod((ClientData)o, interp, XOTclGlobalObjects[XOTE_DESTROY],2,0,0) != TCL_OK) { result = "Destroy for volatile object failed"; } else result = "No XOTcl Object passed"; - Tcl_SetObjResult(in, res); /* restore the result */ + Tcl_SetObjResult(interp, res); /* restore the result */ DECR_REF_COUNT(res); } DECR_REF_COUNT(obj); @@ -7024,8 +7024,8 @@ * mark an obj on the existing callstack, as not destroyed */ static void -UndestroyObj(Tcl_Interp *in, XOTclObject *obj) { - XOTclCallStack *cs = &RUNTIME_STATE(in)->cs; +UndestroyObj(Tcl_Interp *interp, XOTclObject *obj) { + XOTclCallStack *cs = &RUNTIME_STATE(interp)->cs; XOTclCallStackContent *csc; /* @@ -7055,11 +7055,11 @@ * bring an object into a state, as after initialization */ static void -CleanupDestroyObject(Tcl_Interp *in, XOTclObject *obj, int softrecreate) { +CleanupDestroyObject(Tcl_Interp *interp, XOTclObject *obj, int softrecreate) { XOTclClass *thecls, *theobj; - thecls = RUNTIME_STATE(in)->theClass; - theobj = RUNTIME_STATE(in)->theObject; + thecls = RUNTIME_STATE(interp)->theClass; + theobj = RUNTIME_STATE(interp)->theObject; /* remove the instance, but not for ::Class/::Object */ if (obj != &(thecls->object) && obj != &(theobj->object)) { @@ -7069,12 +7069,12 @@ } if (obj->nsPtr) { - NSCleanupNamespace(in, obj->nsPtr); - NSDeleteChildren(in, obj->nsPtr); + NSCleanupNamespace(interp, obj->nsPtr); + NSDeleteChildren(interp, obj->nsPtr); } if (obj->varTable) { - TclDeleteVars(((Interp *)in), obj->varTable); + TclDeleteVars(((Interp *)interp), obj->varTable); ckfree((char *)obj->varTable); /* FREE(obj->varTable, obj->varTable);*/ @@ -7122,12 +7122,12 @@ * do obj initialization & namespace creation */ static void -CleanupInitObject(Tcl_Interp *in, XOTclObject *obj, +CleanupInitObject(Tcl_Interp *interp, XOTclObject *obj, XOTclClass *cl, Tcl_Namespace *namespacePtr, int softrecreate) { #ifdef OBJDELETION_TRACE fprintf(stderr,"+++ CleanupInitObject\n"); #endif - obj->teardown = in; + obj->teardown = interp; obj->nsPtr = namespacePtr; if (!softrecreate) { AddInstance(obj, cl); @@ -7148,7 +7148,7 @@ static void PrimitiveODestroy(ClientData cd) { XOTclObject *obj = (XOTclObject*)cd; - Tcl_Interp *in; + Tcl_Interp *interp; /*fprintf(stderr, "****** PrimitiveODestroy %p\n",obj);*/ assert(obj && !(obj->flags & XOTCL_DESTROYED)); @@ -7159,19 +7159,19 @@ PRINTOBJ("PrimitiveODestroy", obj); if (!obj || !obj->teardown) return; - in = obj->teardown; + interp = obj->teardown; obj->teardown = 0; /* * Don't destroy, if the interpreter is destroyed already * e.g. TK calls Tcl_DeleteInterp directly, if the window is killed */ - if (Tcl_InterpDeleted(in)) return; + if (Tcl_InterpDeleted(interp)) return; /* * call and latch user destroy with obj->id if we haven't */ if (!(obj->flags & XOTCL_DESTROY_CALLED)) { - callDestroyMethod(cd, in, obj, 0); + callDestroyMethod(cd, interp, obj, 0); obj->id = 0; } @@ -7180,7 +7180,7 @@ obj, obj->id, (obj->flags & XOTCL_DESTROY_CALLED), ObjStr(obj->cmdName)); #endif - CleanupDestroyObject(in, obj, 0); + CleanupDestroyObject(interp, obj, 0); while (obj->mixinStack != NULL) MixinStackPop(obj); @@ -7195,7 +7195,7 @@ again in the future, don't use Tcl_GetCommandFromObj() in Tcl 8.4.* versions. */ - Tcl_Command cmd = Tcl_FindCommand(in, ObjStr(obj->cmdName), 0, 0); + Tcl_Command cmd = Tcl_FindCommand(interp, ObjStr(obj->cmdName), 0, 0); if (cmd != NULL) Tcl_Command_deleteProc(cmd) = 0; @@ -7204,7 +7204,7 @@ if (obj->nsPtr) { /*fprintf(stderr,"primitive odestroy calls deletenamespace for obj %p\n",obj);*/ - XOTcl_DeleteNamespace(in, obj->nsPtr); + XOTcl_DeleteNamespace(interp, obj->nsPtr); obj->nsPtr = 0; } @@ -7231,13 +7231,13 @@ XOTclCleanupObject(obj); #if !defined(NDEBUG) - if (obj != (XOTclObject*)RUNTIME_STATE(in)->theClass) - checkAllInstances(in, RUNTIME_STATE(in)->theClass,0); + if (obj != (XOTclObject*)RUNTIME_STATE(interp)->theClass) + checkAllInstances(interp, RUNTIME_STATE(interp)->theClass,0); #endif } static void -PrimitiveOInit(void* mem, Tcl_Interp *in, char *name, XOTclClass *cl) { +PrimitiveOInit(void* mem, Tcl_Interp *interp, char *name, XOTclClass *cl) { XOTclObject *obj = (XOTclObject*)mem; #ifdef OBJDELETION_TRACE @@ -7252,13 +7252,13 @@ /* if the command of the obj was used before, we have to clean * up the callstack from set "destroyedCmd" flags */ - UndestroyObj(in, obj); + UndestroyObj(interp, obj); - if (Tcl_FindNamespace(in, name, NULL, 0)) { - CleanupInitObject(in, obj, cl, - NSGetFreshNamespace(in, (ClientData)obj, name), 0); + if (Tcl_FindNamespace(interp, name, NULL, 0)) { + CleanupInitObject(interp, obj, cl, + NSGetFreshNamespace(interp, (ClientData)obj, name), 0); } else { - CleanupInitObject(in, obj, cl, NULL, 0); + CleanupInitObject(interp, obj, cl, NULL, 0); } /*obj->flags = XOTCL_MIXIN_ORDER_VALID | XOTCL_FILTER_ORDER_VALID;*/ obj->mixinStack = 0; @@ -7269,7 +7269,7 @@ * Object creation: create object name (full name) and Tcl command */ static XOTclObject* -PrimitiveOCreate(Tcl_Interp *in, char *name, XOTclClass *cl) { +PrimitiveOCreate(Tcl_Interp *interp, char *name, XOTclClass *cl) { XOTclObject *obj = (XOTclObject*)ckalloc(sizeof(XOTclObject)); unsigned length; @@ -7287,19 +7287,19 @@ assert(isAbsolutePath(name)); length = strlen(name); - if (!NSCheckForParent(in, name, length)) { + if (!NSCheckForParent(interp, name, length)) { ckfree((char *) obj); return 0; } - obj->id = Tcl_CreateObjCommand(in, name, XOTclObjDispatch, + obj->id = Tcl_CreateObjCommand(interp, name, XOTclObjDispatch, (ClientData)obj, PrimitiveODestroy); - PrimitiveOInit(obj, in, name, cl); + PrimitiveOInit(obj, interp, name, cl); #if 0 /*defined(KEEP_TCL_CMD_TYPE)*/ /*TclNewObj(obj->cmdName);*/ obj->cmdName = Tcl_NewStringObj(name,length); - TclSetCmdNameObj(in, obj->cmdName, (Command*)obj->id); + TclSetCmdNameObj(interp, obj->cmdName, (Command*)obj->id); /*fprintf(stderr, "new command has name '%s'\n", ObjStr(obj->cmdName));*/ #else obj->cmdName = NewXOTclObjectObjName(obj, name, length); @@ -7316,10 +7316,10 @@ * and remove class from class hierarchy */ static void -CleanupDestroyClass(Tcl_Interp *in, XOTclClass *cl, int softrecreate) { +CleanupDestroyClass(Tcl_Interp *interp, XOTclClass *cl, int softrecreate) { Tcl_HashSearch hSrch; Tcl_HashEntry *hPtr; - XOTclClass *theobj = RUNTIME_STATE(in)->theObject; + XOTclClass *theobj = RUNTIME_STATE(interp)->theObject; XOTclClassOpt *clopt = cl->opt; if (clopt) { @@ -7330,10 +7330,10 @@ RemoveFromInstmixinsofs(cl->object.id, clopt->instmixins); CmdListRemoveList(&clopt->instmixins, GuardDel); - MixinInvalidateObjOrders(in, cl); + MixinInvalidateObjOrders(interp, cl); CmdListRemoveList(&clopt->instfilters, GuardDel); - FilterInvalidateObjOrders(in, cl); + FilterInvalidateObjOrders(interp, cl); /* * Remove this class from all mixin lists and clear the mixinofs list @@ -7357,9 +7357,9 @@ #endif } - Tcl_ForgetImport(in, cl->nsPtr, "*"); /* don't destroy namespace imported objects */ - NSCleanupNamespace(in, cl->nsPtr); - NSDeleteChildren(in, cl->nsPtr); + Tcl_ForgetImport(interp, cl->nsPtr, "*"); /* don't destroy namespace imported objects */ + NSCleanupNamespace(interp, cl->nsPtr); + NSDeleteChildren(interp, cl->nsPtr); if (!softrecreate) { /* reset all instances to the class ::xotcl::Object, that makes no sense @@ -7425,7 +7425,7 @@ * do class initialization & namespace creation */ static void -CleanupInitClass(Tcl_Interp *in, XOTclClass *cl, Tcl_Namespace *namespacePtr, +CleanupInitClass(Tcl_Interp *interp, XOTclClass *cl, Tcl_Namespace *namespacePtr, int softrecreate) { XOTclObject *obj = (XOTclObject*)cl; @@ -7437,17 +7437,17 @@ * during init of Object and Class the theClass value is not set */ /* - if (RUNTIME_STATE(in)->theClass != 0) - obj->type = RUNTIME_STATE(in)->theClass; + if (RUNTIME_STATE(interp)->theClass != 0) + obj->type = RUNTIME_STATE(interp)->theClass; */ XOTclObjectSetClass(obj); cl->nsPtr = namespacePtr; cl->super = 0; cl->sub = 0; - AddSuper(cl, RUNTIME_STATE(in)->theObject); - cl->parent = RUNTIME_STATE(in)->theObject; + AddSuper(cl, RUNTIME_STATE(interp)->theObject); + cl->parent = RUNTIME_STATE(interp)->theObject; cl->color = WHITE; cl->order = 0; cl->parameters = 0; @@ -7468,39 +7468,39 @@ PrimitiveCDestroy(ClientData cd) { XOTclClass *cl = (XOTclClass*)cd; XOTclObject *obj = (XOTclObject*)cd; - Tcl_Interp *in; + Tcl_Interp *interp; Tcl_Namespace* saved; /* * check and latch against recurrent calls with obj->teardown */ if (!obj || !obj->teardown) return; - in = obj->teardown; + interp = obj->teardown; /* * Don't destroy, if the interpreted is destroyed already * e.g. TK calls Tcl_DeleteInterp directly, if Window is killed */ - if (Tcl_InterpDeleted(in)) return; + if (Tcl_InterpDeleted(interp)) return; /* * call and latch user destroy with obj->id if we haven't */ /*fprintf(stderr,"PrimitiveCDestroy %s flags %x\n",ObjStr(obj->cmdName),obj->flags);*/ if (!(obj->flags & XOTCL_DESTROY_CALLED)) /*fprintf(stderr,"PrimitiveCDestroy call destroy\n");*/ - callDestroyMethod(cd, in, obj, 0); + callDestroyMethod(cd, interp, obj, 0); obj->teardown = 0; - CleanupDestroyClass(in, cl, 0); + CleanupDestroyClass(interp, cl, 0); /* * handoff the primitive teardown */ saved = cl->nsPtr; - obj->teardown = in; + obj->teardown = interp; /* * class object destroy + physical destroy @@ -7510,7 +7510,7 @@ /*fprintf(stderr,"primitive cdestroy calls deletenamespace for obj %p\n",cl);*/ saved->clientData = 0; - XOTcl_DeleteNamespace(in, saved); + XOTcl_DeleteNamespace(interp, saved); return; } @@ -7519,21 +7519,21 @@ * class init */ static void -PrimitiveCInit(XOTclClass *cl, Tcl_Interp *in, char *name) { +PrimitiveCInit(XOTclClass *cl, Tcl_Interp *interp, char *name) { TclCallFrame frame, *framePtr = &frame; Tcl_Namespace* ns; /* * ensure that namespace is newly created during CleanupInitClass * ie. kill it, if it exists already */ - if (Tcl_PushCallFrame(in, (Tcl_CallFrame *)framePtr, - RUNTIME_STATE(in)->XOTclClassesNS, 0) != TCL_OK) + if (Tcl_PushCallFrame(interp, (Tcl_CallFrame *)framePtr, + RUNTIME_STATE(interp)->XOTclClassesNS, 0) != TCL_OK) return; - ns = NSGetFreshNamespace(in, (ClientData)cl, name); - Tcl_PopCallFrame(in); + ns = NSGetFreshNamespace(interp, (ClientData)cl, name); + Tcl_PopCallFrame(interp); - CleanupInitClass(in, cl, ns, 0); + CleanupInitClass(interp, cl, ns, 0); return; } @@ -7542,7 +7542,7 @@ * calls class object creation */ static XOTclClass* -PrimitiveCCreate(Tcl_Interp *in, char *name, XOTclClass *class) { +PrimitiveCCreate(Tcl_Interp *interp, char *name, XOTclClass *class) { XOTclClass *cl = (XOTclClass*)ckalloc(sizeof(XOTclClass)); unsigned length; XOTclObject *obj = (XOTclObject*)cl; @@ -7561,18 +7561,18 @@ */ /* check whether Object parent NS already exists, otherwise: error */ - if (!NSCheckForParent(in, name, length)) { + if (!NSCheckForParent(interp, name, length)) { ckfree((char *) cl); return 0; } - obj->id = Tcl_CreateObjCommand(in, name, XOTclObjDispatch, + obj->id = Tcl_CreateObjCommand(interp, name, XOTclObjDispatch, (ClientData)cl, PrimitiveCDestroy); - PrimitiveOInit(obj, in, name, class); + PrimitiveOInit(obj, interp, name, class); obj->cmdName = NewXOTclObjectObjName(obj,name,length); INCR_REF_COUNT(obj->cmdName); - PrimitiveCInit(cl, in, name+2); + PrimitiveCInit(cl, interp, name+2); objTrace("PrimitiveCCreate", obj); return cl; @@ -7581,21 +7581,21 @@ /* change XOTcl class conditionally; obj must not be NULL */ XOTCLINLINE static int -changeClass(Tcl_Interp *in, XOTclObject *obj, XOTclClass *cl) { +changeClass(Tcl_Interp *interp, XOTclObject *obj, XOTclClass *cl) { assert(obj); if (cl != obj->cl) { - if (IsMetaClass(in, cl) && !IsMetaClass(in, obj->cl)) { - return XOTclVarErrMsg(in, "cannot change class of object ", + if (IsMetaClass(interp, cl) && !IsMetaClass(interp, obj->cl)) { + return XOTclVarErrMsg(interp, "cannot change class of object ", ObjStr(obj->cmdName), " to metaclass ", ObjStr(cl->object.cmdName),(char *) NULL); } (void)RemoveInstance(obj, obj->cl); AddInstance(obj, cl); - MixinComputeDefined(in, obj); - FilterComputeDefined(in, obj); + MixinComputeDefined(interp, obj); + FilterComputeDefined(interp, obj); } return TCL_OK; } @@ -7605,10 +7605,10 @@ * Undestroy the object, reclass it, and call "cleanup" afterwards */ static int -doCleanup(Tcl_Interp *in, XOTclObject *newobj, XOTclObject *classobj, +doCleanup(Tcl_Interp *interp, XOTclObject *newobj, XOTclObject *classobj, int objc, Tcl_Obj *CONST objv[]) { int destroyed = 0, result; - XOTclCallStack *cs = &RUNTIME_STATE(in)->cs; + XOTclCallStack *cs = &RUNTIME_STATE(interp)->cs; XOTclCallStackContent *csc; /* * we check whether the object to be re-created is destroyed or not @@ -7620,19 +7620,19 @@ } if (destroyed) - UndestroyObj(in, newobj); + UndestroyObj(interp, newobj); /* * re-create, first ensure correct class for newobj */ - result = changeClass(in, newobj, (XOTclClass*) classobj); + result = changeClass(interp, newobj, (XOTclClass*) classobj); if (result == TCL_OK) { /* * dispatch "cleanup" */ - result = callMethod((ClientData) newobj, in, XOTclGlobalObjects[XOTE_CLEANUP], 2, 0, 0); + result = callMethod((ClientData) newobj, interp, XOTclGlobalObjects[XOTE_CLEANUP], 2, 0, 0); } return result; } @@ -7644,16 +7644,16 @@ * call constructor "init", if it was not called before */ static int -doObjInitialization(Tcl_Interp *in, XOTclObject *obj, int objc, Tcl_Obj *CONST objv[]) { +doObjInitialization(Tcl_Interp *interp, XOTclObject *obj, int objc, Tcl_Obj *CONST objv[]) { int result, initArgsC = objc; - Tcl_Obj *savedObjResult = Tcl_GetObjResult(in); /* save the result */ + Tcl_Obj *savedObjResult = Tcl_GetObjResult(interp); /* save the result */ INCR_REF_COUNT(savedObjResult); /* * Search for default values of parameter on superclasses */ if (!(obj->flags & XOTCL_INIT_CALLED)) { - result = callParameterMethodWithArg(obj, in, XOTclGlobalObjects[XOTE_SEARCH_DEFAULTS], + result = callParameterMethodWithArg(obj, interp, XOTclGlobalObjects[XOTE_SEARCH_DEFAULTS], obj->cmdName, 3, 0, 0); if (result != TCL_OK) return result; @@ -7666,7 +7666,7 @@ * call configure methods (starting with '-') */ - result = callMethod((ClientData) obj, in, + result = callMethod((ClientData) obj, interp, XOTclGlobalObjects[XOTE_CONFIGURE], objc, objv+2, 0); if (result != TCL_OK) return result; @@ -7677,23 +7677,23 @@ if (!(obj->flags & XOTCL_INIT_CALLED)) { int newargs; - Tcl_Obj *resultObj = Tcl_GetObjResult(in); + Tcl_Obj *resultObj = Tcl_GetObjResult(interp); /* * Call the user-defined constructor 'init' */ INCR_REF_COUNT(resultObj); - result = Tcl_GetIntFromObj(in,resultObj,&newargs); + result = Tcl_GetIntFromObj(interp,resultObj,&newargs); DECR_REF_COUNT(resultObj); if (result == TCL_OK && newargs+2 < objc) initArgsC = newargs+2; - result = callMethod((ClientData) obj, in, XOTclGlobalObjects[XOTE_INIT], + result = callMethod((ClientData) obj, interp, XOTclGlobalObjects[XOTE_INIT], initArgsC, objv+2, 0); obj->flags |= XOTCL_INIT_CALLED; } if (result == TCL_OK) { - Tcl_SetObjResult(in, savedObjResult); + Tcl_SetObjResult(interp, savedObjResult); } DECR_REF_COUNT(savedObjResult); @@ -7706,7 +7706,7 @@ */ #ifdef NOT_USED static int -XOTclResolveCmd(Tcl_Interp *in, char *name, Tcl_Namespace *contextNsPtr, +XOTclResolveCmd(Tcl_Interp *interp, char *name, Tcl_Namespace *contextNsPtr, int flags, Tcl_Command *rPtr) { Tcl_Namespace *nsPtr[2], *cxtNsPtr; @@ -7721,16 +7721,16 @@ * Find the namespace(s) that contain the command. */ if ((flags & TCL_GLOBAL_ONLY) != 0) { - cxtNsPtr = Tcl_GetGlobalNamespace(in); + cxtNsPtr = Tcl_GetGlobalNamespace(interp); } else if (contextNsPtr != NULL) { cxtNsPtr = contextNsPtr; } else { - cxtNsPtr = Tcl_GetCurrentNamespace(in); + cxtNsPtr = Tcl_GetCurrentNamespace(interp); } - TclGetNamespaceForQualName(in, name, (Namespace *) contextNsPtr, + TclGetNamespaceForQualName(interp, name, (Namespace *) contextNsPtr, flags, &nsPtr[0], &nsPtr[1], &cxtNsPtr, &simpleName); /*fprintf(stderr, " ***Found %s, %s\n", nsPtr[0]->fullName, nsPtr[0]->fullName);*/ @@ -7764,7 +7764,7 @@ * global namespace */ cmd = 0; - nsPtr[0] = Tcl_GetGlobalNamespace(in); + nsPtr[0] = Tcl_GetGlobalNamespace(interp); if ((nsPtr[0] != NULL) && (simpleName != NULL)) { cmdTable = Tcl_Namespace_cmdTable(nsPtr[0]); if ((entryPtr = Tcl_FindHashEntry(cmdTable, simpleName))) { @@ -7773,8 +7773,8 @@ } /* - XOTclStackDump(in); - XOTclCallStackDump(in); + XOTclStackDump(interp); + XOTclCallStackDump(interp); */ } *rPtr = cmd; @@ -7784,7 +7784,7 @@ return TCL_CONTINUE; } static int -XOTclResolveVar(Tcl_Interp *in, char *name, Tcl_Namespace *context, +XOTclResolveVar(Tcl_Interp *interp, char *name, Tcl_Namespace *context, Tcl_ResolvedVarInfo *rPtr) { /*fprintf(stderr, "Resolving %s in %s\n", name, context->fullName);*/ @@ -7797,23 +7797,23 @@ */ static int -XOTclODestroyMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTclODestroyMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { XOTclObject *obj = (XOTclObject*)cd; - if (!obj) return XOTclObjErrType(in, objv[0], "Object"); - if (objc < 1) return XOTclObjErrArgCnt(in, obj->cmdName, "destroy"); + if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); + if (objc < 1) return XOTclObjErrArgCnt(interp, obj->cmdName, "destroy"); PRINTOBJ("XOTclODestroyMethod", obj); /* * call instdestroy for [self] */ - return XOTclCallMethodWithArgs((ClientData)obj->cl, in, + return XOTclCallMethodWithArgs((ClientData)obj->cl, interp, XOTclGlobalObjects[XOTE_INSTDESTROY], obj->cmdName, objc, objv+1, 0); } static int -XOTclOCleanupMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTclOCleanupMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { XOTclObject *obj = (XOTclObject*)cd; XOTclClass *cl = XOTclObjectToClass(obj); char *fn; @@ -7824,23 +7824,23 @@ fprintf(stderr,"+++ XOTclOCleanupMethod\n"); #endif - if (!obj) return XOTclObjErrType(in, objv[0], "Object"); - if (objc < 1) return XOTclObjErrArgCnt(in, obj->cmdName, "cleanup"); + if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); + if (objc < 1) return XOTclObjErrArgCnt(interp, obj->cmdName, "cleanup"); PRINTOBJ("XOTclOCleanupMethod", obj); fn = ObjStr(obj->cmdName); savedNameObj = obj->cmdName; INCR_REF_COUNT(savedNameObj); /* save and pass around softrecreate*/ - softrecreate = obj->flags & XOTCL_RECREATE&& RUNTIME_STATE(in)->doSoftrecreate; + softrecreate = obj->flags & XOTCL_RECREATE&& RUNTIME_STATE(interp)->doSoftrecreate; - CleanupDestroyObject(in, obj, softrecreate); - CleanupInitObject(in, obj, obj->cl, obj->nsPtr, softrecreate); + CleanupDestroyObject(interp, obj, softrecreate); + CleanupInitObject(interp, obj, obj->cl, obj->nsPtr, softrecreate); if (cl) { - CleanupDestroyClass(in, cl, softrecreate); - CleanupInitClass(in, cl, cl->nsPtr, softrecreate); + CleanupDestroyClass(interp, cl, softrecreate); + CleanupInitClass(interp, cl, cl->nsPtr, softrecreate); } DECR_REF_COUNT(savedNameObj); @@ -7849,53 +7849,53 @@ } static int -XOTclOIsClassMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTclOIsClassMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { Tcl_Obj *className; XOTclObject *obj = (XOTclObject*)cd, *o; - if (!obj) return XOTclObjErrType(in, objv[0], "Object"); - if (objc < 1 || objc > 2) return XOTclObjErrArgCnt(in, obj->cmdName, + if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); + if (objc < 1 || objc > 2) return XOTclObjErrArgCnt(interp, obj->cmdName, "isclass ?className?"); className = (objc == 2) ? objv[1] : obj->cmdName; - Tcl_SetIntObj(Tcl_GetObjResult(in), - (XOTclObjConvertObject(in, className, &o) == TCL_OK + Tcl_SetIntObj(Tcl_GetObjResult(interp), + (XOTclObjConvertObject(interp, className, &o) == TCL_OK && XOTclObjectIsClass(o) )); return TCL_OK; } static int -XOTclOIsObjectMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTclOIsObjectMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { XOTclObject *obj = (XOTclObject*)cd, *o; - if (!obj) return XOTclObjErrType(in, objv[0], "Object"); - if (objc != 2) return XOTclObjErrArgCnt(in, obj->cmdName, "isobject "); + if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); + if (objc != 2) return XOTclObjErrArgCnt(interp, obj->cmdName, "isobject "); - if (XOTclObjConvertObject(in, objv[1], &o) == TCL_OK) { - Tcl_SetIntObj(Tcl_GetObjResult(in), 1); + if (XOTclObjConvertObject(interp, objv[1], &o) == TCL_OK) { + Tcl_SetIntObj(Tcl_GetObjResult(interp), 1); } else { - Tcl_SetIntObj(Tcl_GetObjResult(in), 0); + Tcl_SetIntObj(Tcl_GetObjResult(interp), 0); } return TCL_OK; } static int -IsMetaClass(Tcl_Interp *in, XOTclClass *cl) { +IsMetaClass(Tcl_Interp *interp, XOTclClass *cl) { /* check if cl is a meta-class by checking is Class is a superclass of cl*/ XOTclClasses *pl, *checkList=0, *mixinClasses = 0, *mc; int hasMCM = 0; - if (cl == RUNTIME_STATE(in)->theClass) + if (cl == RUNTIME_STATE(interp)->theClass) return 1; for (pl = ComputeOrder(cl, cl->order, Super); pl; pl = pl->next) { - if (pl->cl == RUNTIME_STATE(in)->theClass) + if (pl->cl == RUNTIME_STATE(interp)->theClass) return 1; } for (pl = ComputeOrder(cl, cl->order, Super); pl; pl = pl->next) { XOTclClassOpt* clopt = pl->cl->opt; if (clopt && clopt->instmixins) { - MixinComputeOrderFullList(in, + MixinComputeOrderFullList(interp, &clopt->instmixins, &mixinClasses, &checkList, 0); @@ -7904,7 +7904,7 @@ for (mc=mixinClasses; mc; mc = mc->next) { /*fprintf(stderr,"- got %s\n",ObjStr(mc->cl->object.cmdName));*/ - if (isSubType(mc->cl, RUNTIME_STATE(in)->theClass)) { + if (isSubType(mc->cl, RUNTIME_STATE(interp)->theClass)) { hasMCM = 1; break; } @@ -7918,21 +7918,21 @@ } static int -XOTclOIsMetaClassMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTclOIsMetaClassMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { XOTclObject *obj = (XOTclObject*)cd, *o; Tcl_Obj *className; - if (!obj) return XOTclObjErrType(in, objv[0], "Object"); - if (objc < 1 || objc > 2) return XOTclObjErrArgCnt(in, obj->cmdName, + if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); + if (objc < 1 || objc > 2) return XOTclObjErrArgCnt(interp, obj->cmdName, "ismetaclass ?metaClassName?"); className = (objc == 2) ? objv[1] : obj->cmdName; - if (XOTclObjConvertObject(in, className, &o) == TCL_OK + if (XOTclObjConvertObject(interp, className, &o) == TCL_OK && XOTclObjectIsClass(o) - && IsMetaClass(in, (XOTclClass*)o)) { - Tcl_SetIntObj(Tcl_GetObjResult(in), 1); + && IsMetaClass(interp, (XOTclClass*)o)) { + Tcl_SetIntObj(Tcl_GetObjResult(interp), 1); } else { - Tcl_SetIntObj(Tcl_GetObjResult(in), 0); + Tcl_SetIntObj(Tcl_GetObjResult(interp), 0); } return TCL_OK; } @@ -7959,26 +7959,26 @@ static int -XOTclOIsTypeMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTclOIsTypeMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { XOTclObject *obj = (XOTclObject*)cd; XOTclClass *cl; int success = 0; - if (!obj) return XOTclObjErrType(in, objv[0], "Object"); - if (objc != 2) return XOTclObjErrArgCnt(in, obj->cmdName, "istype "); - if (obj->cl && GetXOTclClassFromObj(in,objv[1],&cl, 1) == TCL_OK) { + if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); + if (objc != 2) return XOTclObjErrArgCnt(interp, obj->cmdName, "istype "); + if (obj->cl && GetXOTclClassFromObj(interp,objv[1],&cl, 1) == TCL_OK) { success = isSubType(obj->cl,cl); } - Tcl_ResetResult(in); - Tcl_SetIntObj(Tcl_GetObjResult(in), success); + Tcl_ResetResult(interp); + Tcl_SetIntObj(Tcl_GetObjResult(interp), success); return TCL_OK; } static int -hasMixin(Tcl_Interp *in, XOTclObject *obj, XOTclClass *cl) { +hasMixin(Tcl_Interp *interp, XOTclObject *obj, XOTclClass *cl) { if (!(obj->flags & XOTCL_MIXIN_ORDER_VALID)) - MixinComputeDefined(in, obj); + MixinComputeDefined(interp, obj); if ((obj->flags & XOTCL_MIXIN_ORDER_DEFINED_AND_VALID)) { XOTclCmdList *ml; @@ -7993,31 +7993,31 @@ } static int -XOTclOIsMixinMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTclOIsMixinMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { XOTclObject *obj = (XOTclObject*)cd; XOTclClass *cl; int success = 0; - if (!obj) return XOTclObjErrType(in, objv[0], "Object"); - if (objc != 2) return XOTclObjErrArgCnt(in, obj->cmdName, "ismixin "); + if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); + if (objc != 2) return XOTclObjErrArgCnt(interp, obj->cmdName, "ismixin "); - if (GetXOTclClassFromObj(in,objv[1],&cl, 1) == TCL_OK) { - success = hasMixin(in, obj, cl); + if (GetXOTclClassFromObj(interp,objv[1],&cl, 1) == TCL_OK) { + success = hasMixin(interp, obj, cl); } - Tcl_ResetResult(in); - Tcl_SetIntObj(Tcl_GetObjResult(in), success); + Tcl_ResetResult(interp); + Tcl_SetIntObj(Tcl_GetObjResult(interp), success); return TCL_OK; } static int -XOTclOExistsMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTclOExistsMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { XOTclObject *obj = (XOTclObject*)cd; - if (!obj) return XOTclObjErrType(in, objv[0], "Object"); - if (objc != 2) return XOTclObjErrArgCnt(in, obj->cmdName, "exists var"); + if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); + if (objc != 2) return XOTclObjErrArgCnt(interp, obj->cmdName, "exists var"); - Tcl_SetIntObj(Tcl_GetObjResult(in), - varExists(in, obj, ObjStr(objv[1]),NULL, 1,1)); + Tcl_SetIntObj(Tcl_GetObjResult(interp), + varExists(interp, obj, ObjStr(objv[1]),NULL, 1,1)); return TCL_OK; } @@ -8050,16 +8050,16 @@ } static int -XOTclOInfoMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTclOInfoMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { XOTclObject *obj = (XOTclObject*)cd; Tcl_Namespace *nsp = obj->nsPtr; char *cmd, *pattern; int modifiers = 0; XOTclObjectOpt *opt; - if (!obj) return XOTclObjErrType(in, objv[0], "Object"); + if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); if (objc < 2) - return XOTclObjErrArgCnt(in, obj->cmdName, "info ?args?"); + return XOTclObjErrArgCnt(interp, obj->cmdName, "info ?args?"); opt = obj->opt; cmd = ObjStr(objv[1]); @@ -8079,16 +8079,16 @@ case 'a': if (isArgsString(cmd)) { if (objc != 3 || modifiers > 0) - return XOTclObjErrArgCnt(in, obj->cmdName, "info args "); + return XOTclObjErrArgCnt(interp, obj->cmdName, "info args "); if (obj->nonposArgsTable) { XOTclNonposArgs* nonposArgs = NonposArgsGet(obj->nonposArgsTable, pattern); if (nonposArgs) { - return ListArgsFromOrdinaryArgs(in, nonposArgs); + return ListArgsFromOrdinaryArgs(interp, nonposArgs); } } if (nsp) - return ListProcArgs(in, Tcl_Namespace_cmdTable(nsp), pattern); + return ListProcArgs(interp, Tcl_Namespace_cmdTable(nsp), pattern); else return TCL_OK; } @@ -8097,9 +8097,9 @@ case 'b': if (!strcmp(cmd, "body")) { if (objc != 3 || modifiers > 0) - return XOTclObjErrArgCnt(in, obj->cmdName, "info body "); + return XOTclObjErrArgCnt(interp, obj->cmdName, "info body "); if (nsp) - return ListProcBody(in, Tcl_Namespace_cmdTable(nsp), pattern); + return ListProcBody(interp, Tcl_Namespace_cmdTable(nsp), pattern); else return TCL_OK; } @@ -8108,41 +8108,41 @@ case 'c': if (isClassString(cmd)) { if (objc > 3 || modifiers > 0) - return XOTclObjErrArgCnt(in, obj->cmdName, "info class ?class?"); - return ListClass(in, obj, pattern, objc, objv); + return XOTclObjErrArgCnt(interp, obj->cmdName, "info class ?class?"); + return ListClass(interp, obj, pattern, objc, objv); } else if (!strcmp(cmd, "commands")) { if (objc > 3 || modifiers > 0) - return XOTclObjErrArgCnt(in, obj->cmdName, "info commands ?pat?"); + return XOTclObjErrArgCnt(interp, obj->cmdName, "info commands ?pat?"); if (nsp) - return ListKeys(in, Tcl_Namespace_cmdTable(nsp), pattern); + return ListKeys(interp, Tcl_Namespace_cmdTable(nsp), pattern); else return TCL_OK; } else if (!strcmp(cmd, "children")) { if (objc > 3 || modifiers > 0) - return XOTclObjErrArgCnt(in, obj->cmdName, "info children ?pat?"); - return ListChildren(in, obj, pattern, 0); + return XOTclObjErrArgCnt(interp, obj->cmdName, "info children ?pat?"); + return ListChildren(interp, obj, pattern, 0); } else if (!strcmp(cmd, "check")) { if (objc != 2 || modifiers > 0) - return XOTclObjErrArgCnt(in, obj->cmdName, "info check"); - return AssertionListCheckOption(in, obj); + return XOTclObjErrArgCnt(interp, obj->cmdName, "info check"); + return AssertionListCheckOption(interp, obj); } break; case 'd': if (!strcmp(cmd, "default")) { if (objc != 5 || modifiers > 0) - return XOTclObjErrArgCnt(in, obj->cmdName, "info default "); + return XOTclObjErrArgCnt(interp, obj->cmdName, "info default "); if (obj->nonposArgsTable) { XOTclNonposArgs* nonposArgs = NonposArgsGet(obj->nonposArgsTable, pattern); if (nonposArgs) { - return ListDefaultFromOrdinaryArgs(in, pattern, nonposArgs, + return ListDefaultFromOrdinaryArgs(interp, pattern, nonposArgs, ObjStr(objv[3]), objv[4]); } } if (nsp) - return ListProcDefault(in, Tcl_Namespace_cmdTable(nsp), pattern, + return ListProcDefault(interp, Tcl_Namespace_cmdTable(nsp), pattern, ObjStr(objv[3]), objv[4]); else return TCL_OK; @@ -8153,43 +8153,43 @@ if (!strcmp(cmd, "filter")) { int withGuards = 0, withOrder = 0; if (objc-modifiers > 3) - return XOTclObjErrArgCnt(in, obj->cmdName, + return XOTclObjErrArgCnt(interp, obj->cmdName, "info filter ?-guards? ?-order? ?pat?"); if (modifiers > 0) { withGuards = checkForModifier(objv, modifiers, "-guards"); withOrder = checkForModifier(objv, modifiers, "-order"); if (withGuards == 0 && withOrder == 0) - return XOTclVarErrMsg(in, "info filter: unknown modifier ", + return XOTclVarErrMsg(interp, "info filter: unknown modifier ", ObjStr(objv[2]), (char *) NULL); /* if (withGuards && withOrder) - return XOTclVarErrMsg(in, "info filter: cannot use -guards and -order together", + return XOTclVarErrMsg(interp, "info filter: cannot use -guards and -order together", ObjStr(objv[2]), (char *) NULL); */ } if (withOrder) { if (!(obj->flags & XOTCL_FILTER_ORDER_VALID)) - FilterComputeDefined(in, obj); - return FilterInfo(in, obj->filterOrder, pattern, withGuards, 1); + FilterComputeDefined(interp, obj); + return FilterInfo(interp, obj->filterOrder, pattern, withGuards, 1); } - return opt ? FilterInfo(in, opt->filters, pattern, withGuards, 0) : TCL_OK; + return opt ? FilterInfo(interp, opt->filters, pattern, withGuards, 0) : TCL_OK; } else if (!strcmp(cmd, "filterguard")) { if (objc != 3 || modifiers > 0) - return XOTclObjErrArgCnt(in, obj->cmdName, "info filterguard filter"); - return opt ? GuardList(in, opt->filters, pattern) : TCL_OK; + return XOTclObjErrArgCnt(interp, obj->cmdName, "info filterguard filter"); + return opt ? GuardList(interp, opt->filters, pattern) : TCL_OK; } else if (!strcmp(cmd, "forward")) { int argc = objc-modifiers; int definition; if (argc < 2 || argc > 3) - return XOTclObjErrArgCnt(in, obj->cmdName, + return XOTclObjErrArgCnt(interp, obj->cmdName, "info forward ?-definition? ?name?"); definition = checkForModifier(objv, modifiers, "-definition"); if (nsp) - return forwardList(in, Tcl_Namespace_cmdTable(nsp), pattern, definition); + return forwardList(interp, Tcl_Namespace_cmdTable(nsp), pattern, definition); else return TCL_OK; } @@ -8198,84 +8198,84 @@ case 'h': if (!strcmp(cmd, "hasNamespace")) { - Tcl_SetBooleanObj(Tcl_GetObjResult(in), nsp != NULL); + Tcl_SetBooleanObj(Tcl_GetObjResult(interp), nsp != NULL); return TCL_OK; } break; case 'i': if (!strcmp(cmd, "invar")) { if (objc != 2 || modifiers > 0) - return XOTclObjErrArgCnt(in, obj->cmdName, "info invar"); + return XOTclObjErrArgCnt(interp, obj->cmdName, "info invar"); if (opt && opt->assertions) - Tcl_SetObjResult(in, AssertionList(in, opt->assertions->invariants)); + Tcl_SetObjResult(interp, AssertionList(interp, opt->assertions->invariants)); return TCL_OK; } else if (!strcmp(cmd, "info")) { if (objc > 2 || modifiers > 0) - return XOTclObjErrArgCnt(in, obj->cmdName, "info info"); - return ListInfo(in, GetXOTclClassFromObj(in,obj->cmdName,NULL,0) == TCL_OK); + return XOTclObjErrArgCnt(interp, obj->cmdName, "info info"); + return ListInfo(interp, GetXOTclClassFromObj(interp,obj->cmdName,NULL,0) == TCL_OK); } break; case 'm': if (!strcmp(cmd, "mixin")) { int withOrder = 0, withGuards = 0; if (objc-modifiers > 3) - return XOTclObjErrArgCnt(in, obj->cmdName, + return XOTclObjErrArgCnt(interp, obj->cmdName, "info mixin ?-guards? ?-order? ?class?"); if (modifiers > 0) { withOrder = checkForModifier(objv, modifiers, "-order"); withGuards = checkForModifier(objv, modifiers, "-guards"); if (withOrder == 0 && withGuards == 0) - return XOTclVarErrMsg(in, "info mixin: unknown modifier . ", + return XOTclVarErrMsg(interp, "info mixin: unknown modifier . ", ObjStr(objv[2]), (char *) NULL); } if (withOrder) { if (!(obj->flags & XOTCL_MIXIN_ORDER_VALID)) - MixinComputeDefined(in, obj); - return MixinInfo(in, obj->mixinOrder, pattern, withGuards); + MixinComputeDefined(interp, obj); + return MixinInfo(interp, obj->mixinOrder, pattern, withGuards); } - return opt ? MixinInfo(in, opt->mixins, pattern, withGuards) : TCL_OK; + return opt ? MixinInfo(interp, opt->mixins, pattern, withGuards) : TCL_OK; } else if (!strcmp(cmd, "mixinguard")) { if (objc != 3 || modifiers > 0) - return XOTclObjErrArgCnt(in, obj->cmdName, "info mixinguard mixin"); + return XOTclObjErrArgCnt(interp, obj->cmdName, "info mixinguard mixin"); - return opt ? GuardList(in, opt->mixins, pattern) : TCL_OK; + return opt ? GuardList(interp, opt->mixins, pattern) : TCL_OK; } else if (!strcmp(cmd, "methods")) { int noprocs = 0, nocmds = 0, nomixins = 0, inContext = 0; if (objc-modifiers > 3) - return XOTclObjErrArgCnt(in, obj->cmdName, + return XOTclObjErrArgCnt(interp, obj->cmdName, "info methods ?-noprocs? ?-nocmds? ?-nomixins? ?-incontext? ?pat?"); if (modifiers > 0) { noprocs = checkForModifier(objv, modifiers, "-noprocs"); nocmds = checkForModifier(objv, modifiers, "-nocmds"); nomixins = checkForModifier(objv, modifiers, "-nomixins"); inContext = checkForModifier(objv, modifiers, "-incontext"); } - return ListMethods(in, obj, pattern, noprocs, nocmds, nomixins, inContext); + return ListMethods(interp, obj, pattern, noprocs, nocmds, nomixins, inContext); } #ifdef XOTCL_METADATA else if (!strcmp(cmd, "metadata")) { if (objc > 3 || modifiers > 0) - return XOTclObjErrArgCnt(in, obj->cmdName, "info metadata ?pat?"); - return ListKeys(in, &obj->metaData, pattern); + return XOTclObjErrArgCnt(interp, obj->cmdName, "info metadata ?pat?"); + return ListKeys(interp, &obj->metaData, pattern); } #endif break; case 'n': if (!strcmp(cmd, "nonposargs")) { if (objc != 3 || modifiers > 0) - return XOTclObjErrArgCnt(in, obj->cmdName, "info nonposargs "); + return XOTclObjErrArgCnt(interp, obj->cmdName, "info nonposargs "); if (obj->nonposArgsTable) { XOTclNonposArgs* nonposArgs = NonposArgsGet(obj->nonposArgsTable, pattern); if (nonposArgs) { - Tcl_SetObjResult(in, NonposArgsFormat(in, nonposArgs->nonposArgs)); + Tcl_SetObjResult(interp, NonposArgsFormat(interp, nonposArgs->nonposArgs)); } } return TCL_OK; @@ -8285,61 +8285,61 @@ case 'p': if (!strcmp(cmd, "procs")) { if (objc > 3 || modifiers > 0) - return XOTclObjErrArgCnt(in, obj->cmdName, "info procs ?pat?"); + return XOTclObjErrArgCnt(interp, obj->cmdName, "info procs ?pat?"); if (nsp) - return ListMethodKeys(in, Tcl_Namespace_cmdTable(nsp), pattern, + return ListMethodKeys(interp, Tcl_Namespace_cmdTable(nsp), pattern, /*noProcs*/ 0, /*noCmds*/ 1, /* noDups */ 0, 0 ); else return TCL_OK; } else if (!strcmp(cmd, "parent")) { if (objc > 2 || modifiers > 0) - return XOTclObjErrArgCnt(in, obj->cmdName, "info parent"); - return ListParent(in, obj); + return XOTclObjErrArgCnt(interp, obj->cmdName, "info parent"); + return ListParent(interp, obj); } else if (!strcmp(cmd, "pre")) { XOTclProcAssertion* procs; if (objc != 3 || modifiers > 0) - return XOTclObjErrArgCnt(in, obj->cmdName, "info pre "); + return XOTclObjErrArgCnt(interp, obj->cmdName, "info pre "); if (opt) { procs = AssertionFindProcs(opt->assertions, ObjStr(objv[2])); - if (procs) Tcl_SetObjResult(in, AssertionList(in, procs->pre)); + if (procs) Tcl_SetObjResult(interp, AssertionList(interp, procs->pre)); } return TCL_OK; } else if (!strcmp(cmd, "post")) { XOTclProcAssertion* procs; if (objc != 3 || modifiers > 0) - return XOTclObjErrArgCnt(in, obj->cmdName, "info post "); + return XOTclObjErrArgCnt(interp, obj->cmdName, "info post "); if (opt) { procs = AssertionFindProcs(opt->assertions, ObjStr(objv[2])); - if (procs) Tcl_SetObjResult(in, AssertionList(in, procs->post)); + if (procs) Tcl_SetObjResult(interp, AssertionList(interp, procs->post)); } return TCL_OK; } else if (!strcmp(cmd, "precedence")) { - return ListPrecedence(in, obj, pattern); + return ListPrecedence(interp, obj, pattern); } break; case 'v': if (!strcmp(cmd, "vars")) { if (objc > 3 || modifiers > 0) - return XOTclObjErrArgCnt(in, obj->cmdName, "info vars ?pat?"); - return ListVars(in, obj, pattern); + return XOTclObjErrArgCnt(interp, obj->cmdName, "info vars ?pat?"); + return ListVars(interp, obj, pattern); } break; } - return XOTclErrBadVal(in, "info", + return XOTclErrBadVal(interp, "info", "an info option (use 'info info' to list all info options)", cmd); } static int -XOTclOProcMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj * CONST objv[]) { +XOTclOProcMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]) { XOTclObject *obj = (XOTclObject*)cd; char *argStr, *bdyStr, *name; XOTclObjectOpt *opt; int incr = 0, result = TCL_OK; - if (!obj) return XOTclObjErrType(in, objv[0], "Object"); + if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); if (objc < 4 || objc > 7) - return XOTclObjErrArgCnt(in, obj->cmdName, + return XOTclObjErrArgCnt(interp, obj->cmdName, "proc name ?non-positional-args? args body ?preAssertion postAssertion?"); if (objc == 5 || objc == 7) { @@ -8355,7 +8355,7 @@ if (opt) AssertionRemoveProc(opt->assertions, name); if (obj->nsPtr) - NSDeleteCmd(in, obj->nsPtr, name); + NSDeleteCmd(interp, obj->nsPtr, name); } else { XOTclAssertionStore* aStore = NULL; if (objc > 5) { @@ -8364,113 +8364,113 @@ opt->assertions = AssertionCreateStore(); aStore = opt->assertions; } - requireObjNamespace(in, obj); + requireObjNamespace(interp, obj); result = MakeProc(obj->nsPtr, aStore, &(obj->nonposArgsTable), - in, objc, (Tcl_Obj **) objv, obj); + interp, objc, (Tcl_Obj **) objv, obj); } /* could be a filter => recompute filter order */ - FilterComputeDefined(in, obj); + FilterComputeDefined(interp, obj); return result; } static int -XOTclONoinitMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj * CONST objv[]) { +XOTclONoinitMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]) { XOTclObject *obj = (XOTclObject*)cd; - if (!obj) return XOTclObjErrType(in, objv[0], "Object"); - if (objc != 1) return XOTclObjErrArgCnt(in, obj->cmdName, "noninit"); + if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); + if (objc != 1) return XOTclObjErrArgCnt(interp, obj->cmdName, "noninit"); obj->flags |= XOTCL_INIT_CALLED; return TCL_OK; } Tcl_Obj* -XOTclOSetInstVar(XOTcl_Object *obj, Tcl_Interp *in, +XOTclOSetInstVar(XOTcl_Object *obj, Tcl_Interp *interp, Tcl_Obj *name, Tcl_Obj *value, int flgs) { - return XOTclOSetInstVar2(obj, in, name, (Tcl_Obj *)NULL, value, (flgs|TCL_PARSE_PART1)); + return XOTclOSetInstVar2(obj, interp, name, (Tcl_Obj *)NULL, value, (flgs|TCL_PARSE_PART1)); } Tcl_Obj* -XOTclOGetInstVar(XOTcl_Object *obj, Tcl_Interp *in, Tcl_Obj *name, int flgs) { - return XOTclOGetInstVar2(obj, in, name, (Tcl_Obj *)NULL, (flgs|TCL_PARSE_PART1)); +XOTclOGetInstVar(XOTcl_Object *obj, Tcl_Interp *interp, Tcl_Obj *name, int flgs) { + return XOTclOGetInstVar2(obj, interp, name, (Tcl_Obj *)NULL, (flgs|TCL_PARSE_PART1)); } int -XOTclUnsetInstVar(XOTcl_Object *obj, Tcl_Interp *in, char *name, int flgs) { - return XOTclUnsetInstVar2 (obj, in, name,(char *)NULL, flgs); +XOTclUnsetInstVar(XOTcl_Object *obj, Tcl_Interp *interp, char *name, int flgs) { + return XOTclUnsetInstVar2 (obj, interp, name,(char *)NULL, flgs); } extern int -XOTclCreateObject(Tcl_Interp *in, Tcl_Obj *name, XOTcl_Class *cli) { +XOTclCreateObject(Tcl_Interp *interp, Tcl_Obj *name, XOTcl_Class *cli) { XOTclClass *cl = (XOTclClass*) cli; int result; INCR_REF_COUNT(name); - result = XOTclCallMethodWithArgs((ClientData)cl, in, + result = XOTclCallMethodWithArgs((ClientData)cl, interp, XOTclGlobalObjects[XOTE_CREATE], name, 1, 0, 0); DECR_REF_COUNT(name); return result; } extern int -XOTclCreateClass(Tcl_Interp *in, Tcl_Obj *name, XOTcl_Class *cli) { +XOTclCreateClass(Tcl_Interp *interp, Tcl_Obj *name, XOTcl_Class *cli) { XOTclClass *cl = (XOTclClass*) cli; int result; INCR_REF_COUNT(name); - result = XOTclCallMethodWithArgs((ClientData)cl, in, + result = XOTclCallMethodWithArgs((ClientData)cl, interp, XOTclGlobalObjects[XOTE_CREATE], name, 1, 0, 0); DECR_REF_COUNT(name); return result; } int -XOTclDeleteObject(Tcl_Interp *in, XOTcl_Object *obji) { +XOTclDeleteObject(Tcl_Interp *interp, XOTcl_Object *obji) { XOTclObject *obj = (XOTclObject*) obji; - return callMethod((ClientData)obj, in, XOTclGlobalObjects[XOTE_DESTROY],2,0,0); + return callMethod((ClientData)obj, interp, XOTclGlobalObjects[XOTE_DESTROY],2,0,0); } int -XOTclDeleteClass(Tcl_Interp *in, XOTcl_Class *cli) { +XOTclDeleteClass(Tcl_Interp *interp, XOTcl_Class *cli) { XOTclClass *cl = (XOTclClass*) cli; - return callMethod((ClientData)cl, in, XOTclGlobalObjects[XOTE_DESTROY],2,0,0); + return callMethod((ClientData)cl, interp, XOTclGlobalObjects[XOTE_DESTROY],2,0,0); } extern Tcl_Obj* -XOTclOSetInstVar2(XOTcl_Object *obji, Tcl_Interp *in, Tcl_Obj *name1, Tcl_Obj *name2, +XOTclOSetInstVar2(XOTcl_Object *obji, Tcl_Interp *interp, Tcl_Obj *name1, Tcl_Obj *name2, Tcl_Obj *value, int flgs) { XOTclObject *obj = (XOTclObject*) obji; Tcl_Obj *result; XOTcl_FrameDecls; - XOTcl_PushFrame(in, obj); + XOTcl_PushFrame(interp, obj); if (obj->nsPtr) flgs |= TCL_NAMESPACE_ONLY; - result = Tcl_ObjSetVar2(in, name1, name2, value, flgs); - XOTcl_PopFrame(in, obj); + result = Tcl_ObjSetVar2(interp, name1, name2, value, flgs); + XOTcl_PopFrame(interp, obj); return result; } extern int -XOTclUnsetInstVar2(XOTcl_Object *obji, Tcl_Interp *in, char *name1, char *name2, +XOTclUnsetInstVar2(XOTcl_Object *obji, Tcl_Interp *interp, char *name1, char *name2, int flgs) { XOTclObject *obj = (XOTclObject*) obji; int result; XOTcl_FrameDecls; - XOTcl_PushFrame(in, obj); + XOTcl_PushFrame(interp, obj); if (obj->nsPtr) flgs |= TCL_NAMESPACE_ONLY; - result = Tcl_UnsetVar2(in, name1, name2, flgs); - XOTcl_PopFrame(in, obj); + result = Tcl_UnsetVar2(interp, name1, name2, flgs); + XOTcl_PopFrame(interp, obj); return result; } static int -GetInstVarIntoCurrentScope(Tcl_Interp *in, XOTclObject *obj, +GetInstVarIntoCurrentScope(Tcl_Interp *interp, XOTclObject *obj, Tcl_Obj *varName, Tcl_Obj *newName) { Var *varPtr = NULL, *otherPtr = NULL, *arrayPtr; int new; @@ -8481,17 +8481,17 @@ int flgs = TCL_LEAVE_ERR_MSG | /* PARSE_PART1 needed for 8.0.5 */ TCL_PARSE_PART1; - XOTcl_PushFrame(in, obj); + XOTcl_PushFrame(interp, obj); if (obj->nsPtr) { flgs = flgs|TCL_NAMESPACE_ONLY; } - otherPtr = XOTclObjLookupVar(in, varName, (char *) NULL, flgs, "define", + otherPtr = XOTclObjLookupVar(interp, varName, (char *) NULL, flgs, "define", /*createPart1*/ 1, /*createPart2*/ 1, &arrayPtr); - XOTcl_PopFrame(in, obj); + XOTcl_PopFrame(interp, obj); if (otherPtr == NULL) { - return XOTclVarErrMsg(in, "can't make instvar ", ObjStr(varName), + return XOTclVarErrMsg(interp, "can't make instvar ", ObjStr(varName), ": can't find variable on ", ObjStr(obj->cmdName), (char *) NULL); } @@ -8506,7 +8506,7 @@ * see Tcl_VariableObjCmd ... */ if (arrayPtr) { - return XOTclVarErrMsg(in, "can't make instvar ", ObjStr(varName), + return XOTclVarErrMsg(interp, "can't make instvar ", ObjStr(varName), " on ", ObjStr(obj->cmdName), ": variable cannot be an element in an array;", " use an alias or objeval.", (char *) NULL); @@ -8515,7 +8515,7 @@ newName = varName; } - varFramePtr = (Tcl_CallFrame *)Tcl_Interp_varFramePtr(in); + varFramePtr = (Tcl_CallFrame *)Tcl_Interp_varFramePtr(interp); /* * If we are executing inside a Tcl procedure, create a local @@ -8563,7 +8563,7 @@ */ if (!new) { if (varPtr == otherPtr) - return XOTclVarErrMsg(in, "can't instvar to variable itself", + return XOTclVarErrMsg(interp, "can't instvar to variable itself", (char *) NULL); if (TclIsVarLink(varPtr)) { @@ -8585,10 +8585,10 @@ } } else if (!TclIsVarUndefined(varPtr)) { - return XOTclVarErrMsg(in, "variable '", ObjStr(newName), + return XOTclVarErrMsg(interp, "variable '", ObjStr(newName), "' exists already", (char *) NULL); } else if (TclIsVarTraced(varPtr)) { - return XOTclVarErrMsg(in, "variable '", ObjStr(newName), + return XOTclVarErrMsg(interp, "variable '", ObjStr(newName), "' has traces: can't use for instvar", (char *) NULL); } } @@ -8621,10 +8621,10 @@ } static int -XOTclOInstVarMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]); +XOTclOInstVarMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]); extern int -XOTclInstVar(XOTcl_Object *obji, Tcl_Interp *in, char *name, char *destName) { +XOTclInstVar(XOTcl_Object *obji, Tcl_Interp *interp, char *name, char *destName) { XOTclObject *obj = (XOTclObject*) obji; int result; Tcl_Obj *alias = 0; @@ -8637,10 +8637,10 @@ if (destName != 0) { alias = Tcl_NewStringObj(destName, -1); INCR_REF_COUNT(alias); - Tcl_ListObjAppendElement(in, objv[1], alias); + Tcl_ListObjAppendElement(interp, objv[1], alias); } - result = XOTclOInstVarMethod((ClientData) obj, in, 2, objv); + result = XOTclOInstVarMethod((ClientData) obj, interp, 2, objv); if (destName != 0) { DECR_REF_COUNT(alias); @@ -8651,16 +8651,16 @@ } extern void -XOTclRemovePMethod(Tcl_Interp *in, XOTcl_Object *obji, char *nm) { +XOTclRemovePMethod(Tcl_Interp *interp, XOTcl_Object *obji, char *nm) { XOTclObject *obj = (XOTclObject*) obji; if (obj->nsPtr) - NSDeleteCmd(in, obj->nsPtr, nm); + NSDeleteCmd(interp, obj->nsPtr, nm); } extern void -XOTclRemoveIMethod(Tcl_Interp *in, XOTcl_Class *cli, char *nm) { +XOTclRemoveIMethod(Tcl_Interp *interp, XOTcl_Class *cli, char *nm) { XOTclClass *cl = (XOTclClass*) cli; - NSDeleteCmd(in, cl->nsPtr, nm); + NSDeleteCmd(interp, cl->nsPtr, nm); } /* @@ -8690,73 +8690,73 @@ } static int -setInstVar(Tcl_Interp *in, XOTclObject *obj, Tcl_Obj *name, Tcl_Obj* value) { +setInstVar(Tcl_Interp *interp, XOTclObject *obj, Tcl_Obj *name, Tcl_Obj* value) { Tcl_Obj *result; int flags = (obj->nsPtr) ? TCL_LEAVE_ERR_MSG|TCL_NAMESPACE_ONLY : TCL_LEAVE_ERR_MSG; XOTcl_FrameDecls; - XOTcl_PushFrame(in, obj); + XOTcl_PushFrame(interp, obj); if (value == NULL) { - result = Tcl_ObjGetVar2(in, name, NULL, flags); + result = Tcl_ObjGetVar2(interp, name, NULL, flags); } else { - result = Tcl_ObjSetVar2(in, name, NULL, value, flags); + result = Tcl_ObjSetVar2(interp, name, NULL, value, flags); } - XOTcl_PopFrame(in, obj); + XOTcl_PopFrame(interp, obj); if (result) { - Tcl_SetObjResult(in, result); + Tcl_SetObjResult(interp, result); return TCL_OK; } return TCL_ERROR; } static int -XOTclOSetMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTclOSetMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { XOTclObject *obj = (XOTclObject*)cd; - if (!obj) return XOTclObjErrType(in, objv[0], "Object"); - if (objc > 3) XOTclObjErrArgCnt(in, obj->cmdName, "set var ?value?"); - return setInstVar(in, obj, objv[1], objc == 3 ? objv[2] : NULL); + if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); + if (objc > 3) XOTclObjErrArgCnt(interp, obj->cmdName, "set var ?value?"); + return setInstVar(interp, obj, objv[1], objc == 3 ? objv[2] : NULL); } static int -XOTclSetterMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTclSetterMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { XOTclObject *obj = (XOTclObject*)cd; - if (!obj) return XOTclObjErrType(in, objv[0], "Object"); - if (objc > 2) return XOTclObjErrArgCnt(in, obj->cmdName, "parameter ?value?"); - return setInstVar(in, obj, objv[0], objc == 2 ? objv[1] : NULL); + if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); + if (objc > 2) return XOTclObjErrArgCnt(interp, obj->cmdName, "parameter ?value?"); + return setInstVar(interp, obj, objv[0], objc == 2 ? objv[1] : NULL); } static int -XOTclOUpvarMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj * CONST objv[]) { +XOTclOUpvarMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]) { XOTclObject *obj = (XOTclObject*)cd; Tcl_Obj *frameInfoObj = NULL; int i, result = TCL_ERROR; char *frameInfo; callFrameContext ctx = {0}; - if (!obj) return XOTclObjErrType(in, objv[0], "Object"); - if (objc < 2) return XOTclObjErrArgCnt(in, obj->cmdName, + if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); + if (objc < 2) return XOTclObjErrArgCnt(interp, obj->cmdName, "?level? otherVar localVar ?otherVar localVar ...?"); if (objc % 2 == 0) { frameInfo = ObjStr(objv[1]); i = 2; } else { - frameInfoObj = computeLevelObj(in, CALLING_LEVEL); + frameInfoObj = computeLevelObj(interp, CALLING_LEVEL); INCR_REF_COUNT(frameInfoObj); frameInfo = ObjStr(frameInfoObj); i = 1; } if (obj && (obj->filterStack || obj->mixinStack)) { - CallStackUseActiveFrames(in, &ctx); + CallStackUseActiveFrames(interp, &ctx); } for ( ; i < objc; i += 2) { - result = Tcl_UpVar2(in, frameInfo, ObjStr(objv[i]), NULL, + result = Tcl_UpVar2(interp, frameInfo, ObjStr(objv[i]), NULL, ObjStr(objv[i+1]), 0 /*flags*/); if (result != TCL_OK) break; @@ -8765,29 +8765,29 @@ if (frameInfoObj) { DECR_REF_COUNT(frameInfoObj); } - CallStackRestoreSavedFrames(in, &ctx); + CallStackRestoreSavedFrames(interp, &ctx); return result; } static int -XOTclOUplevelMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj * CONST objv[]) { +XOTclOUplevelMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]) { XOTclObject *obj = (XOTclObject *)cd; int i, result = TCL_ERROR; char *frameInfo = NULL; Tcl_CallFrame *framePtr = NULL, *savedVarFramePtr; - if (!obj) return XOTclObjErrType(in, objv[0], "Object"); + if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); if (objc < 2) { uplevelSyntax: - return XOTclObjErrArgCnt(in, obj->cmdName, "?level? command ?arg ...?"); + return XOTclObjErrArgCnt(interp, obj->cmdName, "?level? command ?arg ...?"); } /* * Find the level to use for executing the command. */ if (objc>2) { CallFrame *cf; frameInfo = ObjStr(objv[1]); - result = TclGetFrame(in, frameInfo, &cf); + result = TclGetFrame(interp, frameInfo, &cf); if (result == -1) { return TCL_ERROR; } @@ -8804,45 +8804,45 @@ } if (!framePtr) { - XOTclCallStackContent *csc = XOTclCallStackFindLastInvocation(in, 1); + XOTclCallStackContent *csc = XOTclCallStackFindLastInvocation(interp, 1); if (csc) framePtr = csc->currentFramePtr; } - savedVarFramePtr = (Tcl_CallFrame *)Tcl_Interp_varFramePtr(in); - Tcl_Interp_varFramePtr(in) = (CallFrame *)framePtr; + savedVarFramePtr = (Tcl_CallFrame *)Tcl_Interp_varFramePtr(interp); + Tcl_Interp_varFramePtr(interp) = (CallFrame *)framePtr; /* * Execute the residual arguments as a command. */ if (objc == 1) { - result = Tcl_EvalObjEx(in, objv[0], TCL_EVAL_DIRECT); + result = Tcl_EvalObjEx(interp, objv[0], TCL_EVAL_DIRECT); } else { /* * More than one argument: concatenate them together with spaces * between, then evaluate the result. Tcl_EvalObjEx will delete * the object when it decrements its refcount after eval'ing it. */ Tcl_Obj *objPtr = Tcl_ConcatObj(objc, objv); - result = Tcl_EvalObjEx(in, objPtr, TCL_EVAL_DIRECT); + result = Tcl_EvalObjEx(interp, objPtr, TCL_EVAL_DIRECT); } if (result == TCL_ERROR) { char msg[32 + TCL_INTEGER_SPACE]; - sprintf(msg, "\n (\"uplevel\" body line %d)", in->errorLine); - Tcl_AddObjErrorInfo(in, msg, -1); + sprintf(msg, "\n (\"uplevel\" body line %d)", interp->errorLine); + Tcl_AddObjErrorInfo(interp, msg, -1); } /* * Restore the variable frame, and return. */ - Tcl_Interp_varFramePtr(in) = (CallFrame *)savedVarFramePtr; + Tcl_Interp_varFramePtr(interp) = (CallFrame *)savedVarFramePtr; return result; } static int -forwardArg(Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[], +forwardArg(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *o, forwardCmdClientData *tcd, Tcl_Obj **out, Tcl_Obj **freeList, int *inputarg, int *mapvalue) { char *element = ObjStr(o), *p; @@ -8862,10 +8862,10 @@ remainder += 3; } if (element == remainder || abs(pos) > totalargs) { - return XOTclVarErrMsg(in, "forward: invalid index specified in argument ", + return XOTclVarErrMsg(interp, "forward: invalid index specified in argument ", ObjStr(o), (char *) NULL); } if (!remainder || *remainder != ' ') { - return XOTclVarErrMsg(in, "forward: invaild syntax in '", ObjStr(o), + return XOTclVarErrMsg(interp, "forward: invaild syntax in '", ObjStr(o), "' use: %@ ",(char *) NULL); } @@ -8891,40 +8891,40 @@ /*fprintf(stderr, " nrargs=%d, subcommands=%d inputarg=%d, objc=%d\n", nrargs, tcd->nr_subcommands, inputarg, objc);*/ if (c1 != '\0') { - if (Tcl_ListObjIndex(in, o, 1, &list) != TCL_OK) { - return XOTclVarErrMsg(in, "forward: %1 must by a valid list, given: '", + if (Tcl_ListObjIndex(interp, o, 1, &list) != TCL_OK) { + return XOTclVarErrMsg(interp, "forward: %1 must by a valid list, given: '", ObjStr(o), "'", (char *) NULL); } - if (Tcl_ListObjGetElements(in, list, &nrElements, &listElements) != TCL_OK) { - return XOTclVarErrMsg(in, "forward: %1 contains invalid list '", + if (Tcl_ListObjGetElements(interp, list, &nrElements, &listElements) != TCL_OK) { + return XOTclVarErrMsg(interp, "forward: %1 contains invalid list '", ObjStr(list),"'", (char *) NULL); } } else if (tcd->subcommands) { /* deprecated part */ - if (Tcl_ListObjGetElements(in, tcd->subcommands,&nrElements,&listElements) != TCL_OK) { - return XOTclVarErrMsg(in, "forward: %1 contains invalid list '", + if (Tcl_ListObjGetElements(interp, tcd->subcommands,&nrElements,&listElements) != TCL_OK) { + return XOTclVarErrMsg(interp, "forward: %1 contains invalid list '", ObjStr(list),"'", (char *) NULL); } } if (nrElements > nrargs) { /* insert default subcommand depending on number of arguments */ *out = listElements[nrargs]; } else if (objc<=1) { - return XOTclObjErrArgCnt(in, objv[0], "no argument given"); + return XOTclObjErrArgCnt(interp, objv[0], "no argument given"); } else { *out = objv[1]; *inputarg = 2; } } else if (c == 'a' && !strncmp(element,"argcl", 4)) { - if (Tcl_ListObjIndex(in, o, 1, &list) != TCL_OK) { - return XOTclVarErrMsg(in, "forward: %argclindex must by a valid list, given: '", + if (Tcl_ListObjIndex(interp, o, 1, &list) != TCL_OK) { + return XOTclVarErrMsg(interp, "forward: %argclindex must by a valid list, given: '", ObjStr(o), "'", (char *) NULL); } - if (Tcl_ListObjGetElements(in, list, &nrElements, &listElements) != TCL_OK) { - return XOTclVarErrMsg(in, "forward: %argclindex contains invalid list '", + if (Tcl_ListObjGetElements(interp, list, &nrElements, &listElements) != TCL_OK) { + return XOTclVarErrMsg(interp, "forward: %argclindex contains invalid list '", ObjStr(list),"'", (char *) NULL); } if (nrargs >= nrElements) { - return XOTclVarErrMsg(in, "forward: not enough elements in specified list of ARGC argument ", + return XOTclVarErrMsg(interp, "forward: not enough elements in specified list of ARGC argument ", ObjStr(o), (char *) NULL); } *out = listElements[nrargs]; @@ -8936,9 +8936,9 @@ /* evaluating given command */ int result; /*fprintf(stderr,"evaluating '%s'\n",element);*/ - if ((result = Tcl_EvalEx(in, element, -1, 0)) != TCL_OK) + if ((result = Tcl_EvalEx(interp, element, -1, 0)) != TCL_OK) return result; - *out = Tcl_DuplicateObj(Tcl_GetObjResult(in)); + *out = Tcl_DuplicateObj(Tcl_GetObjResult(interp)); /*fprintf(stderr,"result = '%s'\n",ObjStr(*out));*/ goto add_to_freelist; } @@ -8958,13 +8958,13 @@ *freeList = Tcl_NewListObj(1, out); INCR_REF_COUNT(*freeList); } else - Tcl_ListObjAppendElement(in, *freeList, *out); + Tcl_ListObjAppendElement(interp, *freeList, *out); return TCL_OK; } static int -callForwarder(forwardCmdClientData *tcd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +callForwarder(forwardCmdClientData *tcd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { ClientData cd; int result; XOTcl_FrameDecls; @@ -8975,49 +8975,49 @@ DECR_REF_COUNT(cmd); } if (tcd->objscope) { - XOTcl_PushFrame(in, tcd->obj); + XOTcl_PushFrame(interp, tcd->obj); } if (tcd->objProc) { - result = (tcd->objProc)(tcd->cd, in, objc, objv); + result = (tcd->objProc)(tcd->cd, interp, objc, objv); } else if (tcd->cmdName->typePtr == &XOTclObjectType - && XOTclObjConvertObject(in, tcd->cmdName, (void*)&cd) == TCL_OK) { + && XOTclObjConvertObject(interp, tcd->cmdName, (void*)&cd) == TCL_OK) { /*fprintf(stderr, "XOTcl object %s, objc=%d\n", ObjStr(tcd->cmdName),objc);*/ - result = ObjDispatch(cd, in, objc, objv, 0); + result = ObjDispatch(cd, interp, objc, objv, 0); } else { /*fprintf(stderr, "no XOTcl object %s\n", ObjStr(tcd->cmdName));*/ - result = Tcl_EvalObjv(in, objc, objv, 0); + result = Tcl_EvalObjv(interp, objc, objv, 0); } if (tcd->objscope) { - XOTcl_PopFrame(in, tcd->obj); + XOTcl_PopFrame(interp, tcd->obj); } return result; } static int -XOTclForwardMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTclForwardMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { forwardCmdClientData *tcd = (forwardCmdClientData *)cd; int result, j, inputarg=1, outputarg=0; - if (!tcd || !tcd->obj) return XOTclObjErrType(in, objv[0], "Object"); + if (!tcd || !tcd->obj) return XOTclObjErrType(interp, objv[0], "Object"); /* it is a c-method; establish a value for the currentFramePtr */ - RUNTIME_STATE(in)->cs.top->currentFramePtr = - (Tcl_CallFrame *) Tcl_Interp_varFramePtr(in); + RUNTIME_STATE(interp)->cs.top->currentFramePtr = + (Tcl_CallFrame *) Tcl_Interp_varFramePtr(interp); /* fprintf(stderr,"...setting currentFramePtr %p to %p (ForwardMethod)\n", - RUNTIME_STATE(in)->cs.top->currentFramePtr, - (Tcl_CallFrame *) Tcl_Interp_varFramePtr(in)); */ + RUNTIME_STATE(interp)->cs.top->currentFramePtr, + (Tcl_CallFrame *) Tcl_Interp_varFramePtr(interp)); */ if (tcd->passthrough) { /* two short cuts for simple cases */ /* early binding, cmd* resolved, we have to care only for objscope */ - return callForwarder(tcd, in, objc, objv); + return callForwarder(tcd, interp, objc, objv); } else if (!tcd->args && *(ObjStr(tcd->cmdName)) != '%') { /* we have ony to replace the method name with the given cmd name */ ALLOC_ON_STACK(Tcl_Obj*,objc, ov); memcpy(ov,objv, sizeof(Tcl_Obj *)*objc); ov[0] = tcd->cmdName; - result = callForwarder(tcd, in, objc, ov); + result = callForwarder(tcd, interp, objc, ov); FREE_ON_STACK(ov); return result; } else { @@ -9041,7 +9041,7 @@ /* the first argument is always the command, to which we forward */ - if ((result = forwardArg(in, objc, objv, tcd->cmdName, tcd, + if ((result = forwardArg(interp, objc, objv, tcd->cmdName, tcd, &ov[outputarg], &freeList, &inputarg, &objvmap[outputarg])) != TCL_OK) { goto exitforwardmethod; @@ -9052,10 +9052,10 @@ /* copy argument list from definition */ Tcl_Obj **listElements; int nrElements; - Tcl_ListObjGetElements(in, tcd->args, &nrElements, &listElements); + Tcl_ListObjGetElements(interp, tcd->args, &nrElements, &listElements); for (j=0; jcmdName; - result = callForwarder(tcd, in, objc, ov); + result = callForwarder(tcd, interp, objc, ov); if (tcd->prefix) {DECR_REF_COUNT(ov[1]);} exitforwardmethod: @@ -9138,38 +9138,38 @@ static int -XOTclOInstVarMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTclOInstVarMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { XOTclObject *obj = (XOTclObject*)cd; Tcl_Obj **ov; int i, oc, result = TCL_OK; callFrameContext ctx = {0}; - if (!obj) return XOTclObjErrType(in, objv[0], "Object"); - if (objc < 2) return XOTclObjErrArgCnt(in, obj->cmdName, "instvar ?vars?"); + if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); + if (objc < 2) return XOTclObjErrArgCnt(interp, obj->cmdName, "instvar ?vars?"); if (obj && (obj->filterStack || obj->mixinStack) ) { - CallStackUseActiveFrames(in, &ctx); + CallStackUseActiveFrames(interp, &ctx); } - if (!Tcl_Interp_varFramePtr(in)) { - CallStackRestoreSavedFrames(in, &ctx); - return XOTclVarErrMsg(in, "instvar used on ", ObjStr(obj->cmdName), + if (!Tcl_Interp_varFramePtr(interp)) { + CallStackRestoreSavedFrames(interp, &ctx); + return XOTclVarErrMsg(interp, "instvar used on ", ObjStr(obj->cmdName), ", but callstack is not in procedure scope", (char *) NULL); } for (i=1; icmdName, "vwait varname"); + return XOTclObjErrArgCnt(interp, obj->cmdName, "vwait varname"); nameString = ObjStr(objv[1]); /* * Make sure the var table exists and the varname is in there */ - if (NSRequireVariableOnObj(in, obj, nameString, flgs) == 0) - return XOTclVarErrMsg(in, "Can't lookup (and create) variable ", + if (NSRequireVariableOnObj(interp, obj, nameString, flgs) == 0) + return XOTclVarErrMsg(interp, "Can't lookup (and create) variable ", nameString, " on ", ObjStr(obj->cmdName), (char *) NULL); - XOTcl_PushFrame(in, obj); + XOTcl_PushFrame(interp, obj); /* * much of this is copied from Tcl, since we must avoid * access with flag TCL_GLOBAL_ONLY ... doesn't work on * obj->varTable vars */ - if (Tcl_TraceVar(in, nameString, flgs, (Tcl_VarTraceProc *)VwaitVarProc, + if (Tcl_TraceVar(interp, nameString, flgs, (Tcl_VarTraceProc *)VwaitVarProc, (ClientData) &done) != TCL_OK) { return TCL_ERROR; } @@ -9236,30 +9236,30 @@ while (!done && foundEvent) { foundEvent = Tcl_DoOneEvent(TCL_ALL_EVENTS); } - Tcl_UntraceVar(in, nameString, flgs, (Tcl_VarTraceProc *)VwaitVarProc, + Tcl_UntraceVar(interp, nameString, flgs, (Tcl_VarTraceProc *)VwaitVarProc, (ClientData) &done); - XOTcl_PopFrame(in, obj); + XOTcl_PopFrame(interp, obj); /* * Clear out the interpreter's result, since it may have been set * by event handlers. */ - Tcl_ResetResult(in); + Tcl_ResetResult(interp); if (!foundEvent) { - return XOTclVarErrMsg(in, "can't wait for variable '", nameString, + return XOTclVarErrMsg(interp, "can't wait for variable '", nameString, "': would wait forever", (char *) NULL); } return TCL_OK; } static int -XOTclOInvariantsMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTclOInvariantsMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { XOTclObject *obj = (XOTclObject*)cd; XOTclObjectOpt *opt; - if (!obj) return XOTclObjErrType(in, objv[0], "Object"); + if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); if (objc != 2) - return XOTclObjErrArgCnt(in, obj->cmdName, "invar "); + return XOTclObjErrArgCnt(interp, obj->cmdName, "invar "); opt = XOTclRequireObjectOpt(obj); @@ -9268,54 +9268,54 @@ else opt->assertions = AssertionCreateStore(); - opt->assertions->invariants = AssertionNewList(in, objv[1]); + opt->assertions->invariants = AssertionNewList(interp, objv[1]); return TCL_OK; } static int -XOTclOAutonameMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTclOAutonameMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { XOTclObject *obj = (XOTclObject*)cd; int instanceOpt = 0, resetOpt = 0; Tcl_Obj *autoname; - if (!obj) return XOTclObjErrType(in, objv[0], "Object"); + if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); if (objc == 3) { instanceOpt = (strcmp(ObjStr(objv[1]), "-instance") == 0); resetOpt = (strcmp(ObjStr(objv[1]), "-reset") == 0); } if ((objc < 2 || objc > 3) || (objc == 3 && !instanceOpt && !resetOpt)) - return XOTclObjErrArgCnt(in, obj->cmdName, "autoname [-instance | -reset] name"); + return XOTclObjErrArgCnt(interp, obj->cmdName, "autoname [-instance | -reset] name"); - autoname = AutonameIncr(in, objv[objc-1], obj, instanceOpt, resetOpt); + autoname = AutonameIncr(interp, objv[objc-1], obj, instanceOpt, resetOpt); if (autoname) { - Tcl_SetObjResult(in, autoname); + Tcl_SetObjResult(interp, autoname); DECR_REF_COUNT(autoname); } else - return XOTclVarErrMsg(in, + return XOTclVarErrMsg(interp, "Autoname failed. Probably format string (with %) was not well-formed", (char *) NULL); return TCL_OK; } static int -XOTclOCheckMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTclOCheckMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { XOTclObject *obj = (XOTclObject*)cd; int ocArgs; Tcl_Obj **ovArgs; int i; XOTclObjectOpt *opt; /*fprintf(stderr,"checkmethod\n");*/ - if (!obj) return XOTclObjErrType(in, objv[0], "Object"); + if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); if (objc != 2) - return XOTclObjErrArgCnt(in, obj->cmdName, + return XOTclObjErrArgCnt(interp, obj->cmdName, "check (?all? ?pre? ?post? ?invar? ?instinvar?)"); opt = XOTclRequireObjectOpt(obj); opt->checkoptions = CHECK_NONE; - if (Tcl_ListObjGetElements(in, objv[1], &ocArgs, &ovArgs) == TCL_OK + if (Tcl_ListObjGetElements(interp, objv[1], &ocArgs, &ovArgs) == TCL_OK && ocArgs > 0) { for (i = 0; i < ocArgs; i++) { char *option = ObjStr(ovArgs[i]); @@ -9345,19 +9345,19 @@ } } if (opt->checkoptions == CHECK_NONE && ocArgs>0) { - return XOTclVarErrMsg(in, "Unknown check option in command '", + return XOTclVarErrMsg(interp, "Unknown check option in command '", ObjStr(obj->cmdName), " ", ObjStr(objv[0]), " ", ObjStr(objv[1]), "', valid: all pre post invar instinvar", (char *) NULL); } - Tcl_ResetResult(in); + Tcl_ResetResult(interp); return TCL_OK; } static int -XOTclConfigureCommand(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTclConfigureCommand(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { int bool, opt, result = TCL_OK; static CONST char *opts[] = { "filter", "softrecreate", @@ -9368,46 +9368,46 @@ }; if (objc < 2 || objc>3) - return XOTclObjErrArgCnt(in, objv[0], + return XOTclObjErrArgCnt(interp, objv[0], "::xotcl::configure filter|softrecreate ?on|off?"); - if (Tcl_GetIndexFromObj(in, objv[1], opts, "option", 0, &opt) != TCL_OK) { + if (Tcl_GetIndexFromObj(interp, objv[1], opts, "option", 0, &opt) != TCL_OK) { return TCL_ERROR; } if (objc == 3) { - result = Tcl_GetBooleanFromObj(in, objv[2], &bool); + result = Tcl_GetBooleanFromObj(interp, objv[2], &bool); } if (result == TCL_OK) { switch (opt) { case filterIdx: - Tcl_SetBooleanObj(Tcl_GetObjResult(in), - (RUNTIME_STATE(in)->doFilters)); + Tcl_SetBooleanObj(Tcl_GetObjResult(interp), + (RUNTIME_STATE(interp)->doFilters)); if (objc == 3) - RUNTIME_STATE(in)->doFilters = bool; + RUNTIME_STATE(interp)->doFilters = bool; break; case softrecreateIdx: - Tcl_SetBooleanObj(Tcl_GetObjResult(in), - (RUNTIME_STATE(in)->doSoftrecreate)); + Tcl_SetBooleanObj(Tcl_GetObjResult(interp), + (RUNTIME_STATE(interp)->doSoftrecreate)); if (objc == 3) - RUNTIME_STATE(in)->doSoftrecreate = bool; + RUNTIME_STATE(interp)->doSoftrecreate = bool; break; } } return result; } static int -XOTclObjscopedMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTclObjscopedMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { aliasCmdClientData *tcd = (aliasCmdClientData *)cd; XOTclObject *obj = tcd->obj; int rc; XOTcl_FrameDecls; /*fprintf(stderr,"objscopedMethod obj=%p, ptr=%p\n",obj,tcd->objProc);*/ - XOTcl_PushFrame(in, obj); - rc = (tcd->objProc)(tcd->cd, in, objc, objv); - XOTcl_PopFrame(in, obj); + XOTcl_PushFrame(interp, obj); + rc = (tcd->objProc)(tcd->cd, interp, objc, objv); + XOTcl_PopFrame(interp, obj); return rc; } @@ -9419,7 +9419,7 @@ } static int -XOTclAliasCommand(ClientData cd, Tcl_Interp *in, +XOTclAliasCommand(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { XOTclObject *obj = NULL; XOTclClass *cl = NULL; @@ -9431,15 +9431,15 @@ int objscope = 0, i; if (objc < 4 || objc > 6) { - return XOTclObjErrArgCnt(in, objv[0], + return XOTclObjErrArgCnt(interp, objv[0], "| ?-objscope? ?-per-object? "); } - GetXOTclClassFromObj(in, objv[1], &cl, 1); + GetXOTclClassFromObj(interp, objv[1], &cl, 1); if (!cl) { - XOTclObjConvertObject(in, objv[1], &obj); + XOTclObjConvertObject(interp, objv[1], &obj); if (!obj) - return XOTclObjErrType(in, objv[1], "Class|Object"); + return XOTclObjErrType(interp, objv[1], "Class|Object"); allocation = 'o'; } else { allocation = 'c'; @@ -9455,19 +9455,19 @@ } else if (!strcmp("-per-object",optionName)) { allocation = 'o'; } else { - return XOTclErrBadVal(in, "::xotcl::alias", + return XOTclErrBadVal(interp, "::xotcl::alias", "option -objscope or -per-object", optionName); } } - cmd = Tcl_GetCommandFromObj(in, objv[i]); + cmd = Tcl_GetCommandFromObj(interp, objv[i]); if (cmd == NULL) - return XOTclVarErrMsg(in, "cannot lookup command '", + return XOTclVarErrMsg(interp, "cannot lookup command '", ObjStr(objv[i]), "'", (char *) NULL); objProc = Tcl_Command_objProc(cmd); if (objc>i+1) { - return XOTclVarErrMsg(in, "invalid argument '", + return XOTclVarErrMsg(interp, "invalid argument '", ObjStr(objv[i+1]), "'", (char *) NULL); } @@ -9482,30 +9482,30 @@ } if (allocation == 'c') { - XOTclAddIMethod(in, (XOTcl_Class*)cl, methodName, objProc, tcd, dp); + XOTclAddIMethod(interp, (XOTcl_Class*)cl, methodName, objProc, tcd, dp); } else { - XOTclAddPMethod(in, (XOTcl_Object*)obj, methodName, objProc, tcd, dp); + XOTclAddPMethod(interp, (XOTcl_Object*)obj, methodName, objProc, tcd, dp); } return TCL_OK; } static int -XOTclSetInstvarCommand(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTclSetInstvarCommand(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { XOTclObject *obj; if (objc < 3 || objc > 4) - return XOTclObjErrArgCnt(in, objv[0], "::xotcl::instvarset obj var ?value?"); + return XOTclObjErrArgCnt(interp, objv[0], "::xotcl::instvarset obj var ?value?"); - XOTclObjConvertObject(in, objv[1], &obj); - if (!obj) return XOTclObjErrType(in, objv[0], "Object"); + XOTclObjConvertObject(interp, objv[1], &obj); + if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); - return setInstVar(in, obj ,objv[2], objc == 4 ? objv[3] : NULL); + return setInstVar(interp, obj ,objv[2], objc == 4 ? objv[3] : NULL); } static int -XOTclSetRelationCommand(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTclSetRelationCommand(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { int oc; Tcl_Obj **ov; XOTclObject *obj = NULL; XOTclClass *cl = NULL; @@ -9527,46 +9527,46 @@ }; if (objc < 3) - return XOTclObjErrArgCnt(in, objv[0], "::xotcl::setrelation obj reltype classes"); + return XOTclObjErrArgCnt(interp, objv[0], "::xotcl::setrelation obj reltype classes"); - if (Tcl_GetIndexFromObj(in, objv[2], opts, "relation type", 0, &opt) != TCL_OK) { + if (Tcl_GetIndexFromObj(interp, objv[2], opts, "relation type", 0, &opt) != TCL_OK) { return TCL_ERROR; } switch (opt) { case mixinIdx: case filterIdx: { - XOTclObjConvertObject(in, objv[1], &obj); - if (!obj) return XOTclObjErrType(in, objv[1], "Object"); - if (Tcl_ListObjGetElements(in, objv[3], &oc, &ov) != TCL_OK) + XOTclObjConvertObject(interp, objv[1], &obj); + if (!obj) return XOTclObjErrType(interp, objv[1], "Object"); + if (Tcl_ListObjGetElements(interp, objv[3], &oc, &ov) != TCL_OK) return TCL_ERROR; objopt = XOTclRequireObjectOpt(obj); break; } case instmixinIdx: case instfilterIdx: { - GetXOTclClassFromObj(in, objv[1], &cl, 1); - if (!cl) return XOTclObjErrType(in, objv[1], "Class"); - if (Tcl_ListObjGetElements(in, objv[3], &oc, &ov) != TCL_OK) + GetXOTclClassFromObj(interp, objv[1], &cl, 1); + if (!cl) return XOTclObjErrType(interp, objv[1], "Class"); + if (Tcl_ListObjGetElements(interp, objv[3], &oc, &ov) != TCL_OK) return TCL_ERROR; clopt = XOTclRequireClassOpt(cl); break; } case superclassIdx: { - GetXOTclClassFromObj(in, objv[1], &cl, 1); - if (!cl) return XOTclObjErrType(in, objv[1], "Class"); - if (Tcl_ListObjGetElements(in, objv[3], &oc, &ov) != TCL_OK) + GetXOTclClassFromObj(interp, objv[1], &cl, 1); + if (!cl) return XOTclObjErrType(interp, objv[1], "Class"); + if (Tcl_ListObjGetElements(interp, objv[3], &oc, &ov) != TCL_OK) return TCL_ERROR; - return SuperclassAdd(in, cl, oc, ov, objv[3]); + return SuperclassAdd(interp, cl, oc, ov, objv[3]); } case classIdx: { - XOTclObjConvertObject(in, objv[1], &obj); - if (!obj) return XOTclObjErrType(in, objv[1], "Object"); - GetXOTclClassFromObj(in, objv[3], &cl, 1); - if (!cl) return XOTclErrBadVal(in, "class", "a class", ObjStr(objv[1])); - return changeClass(in, obj, cl); + XOTclObjConvertObject(interp, objv[1], &obj); + if (!obj) return XOTclObjErrType(interp, objv[1], "Object"); + GetXOTclClassFromObj(interp, objv[3], &cl, 1); + if (!cl) return XOTclErrBadVal(interp, "class", "a class", ObjStr(objv[1])); + return changeClass(interp, obj, cl); } } @@ -9602,12 +9602,12 @@ */ for (i = 0; i < oc; i++) { Tcl_Obj* ocl = NULL; - if (MixinAdd(in, &objopt->mixins, ov[i]) != TCL_OK) { + if (MixinAdd(interp, &objopt->mixins, ov[i]) != TCL_OK) { return TCL_ERROR; } /* fprintf(stderr,"Added to mixins of %s: %s\n", ObjStr(obj->cmdName), ObjStr(ov[i])); */ - Tcl_ListObjIndex(in, ov[i], 0, &ocl); - XOTclObjConvertObject(in, ocl, &nobj); + Tcl_ListObjIndex(interp, ov[i], 0, &ocl); + XOTclObjConvertObject(interp, ocl, &nobj); if (nobj) { /* fprintf(stderr,"Registering object %s to mixinofs of class %s\n", ObjStr(obj->cmdName),ObjStr(nobj->cmdName)); */ @@ -9617,8 +9617,8 @@ ObjStr(ov[i]),ObjStr(cl->object.cmdName)); */ } - MixinComputeDefined(in, obj); - FilterComputeDefined(in, obj); + MixinComputeDefined(interp, obj); + FilterComputeDefined(interp, obj); break; } case filterIdx: @@ -9627,10 +9627,10 @@ obj->flags &= ~XOTCL_FILTER_ORDER_VALID; for (i = 0; i < oc; i ++) { - if (FilterAdd(in, &objopt->filters, ov[i], obj, 0) != TCL_OK) + if (FilterAdd(interp, &objopt->filters, ov[i], obj, 0) != TCL_OK) return TCL_ERROR; } - /*FilterComputeDefined(in, obj);*/ + /*FilterComputeDefined(interp, obj);*/ break; } @@ -9641,22 +9641,22 @@ CmdListRemoveList(&clopt->instmixins, GuardDel); } - MixinInvalidateObjOrders(in, cl); + MixinInvalidateObjOrders(interp, cl); /* * since mixin procs may be used as filters -> we have to invalidate */ - FilterInvalidateObjOrders(in, cl); + FilterInvalidateObjOrders(interp, cl); for (i = 0; i < oc; i++) { Tcl_Obj* ocl = NULL; - if (MixinAdd(in, &clopt->instmixins, ov[i]) != TCL_OK) { + if (MixinAdd(interp, &clopt->instmixins, ov[i]) != TCL_OK) { return TCL_ERROR; } /* fprintf(stderr,"Added to instmixins of %s: %s\n", ObjStr(cl->object.cmdName), ObjStr(ov[i])); */ - Tcl_ListObjIndex(in, ov[i], 0, &ocl); - XOTclObjConvertObject(in, ocl, &nobj); + Tcl_ListObjIndex(interp, ov[i], 0, &ocl); + XOTclObjConvertObject(interp, ocl, &nobj); if (nobj) { /* fprintf(stderr,"Registering class %s to instmixinofs of class %s\n", ObjStr(cl->object.cmdName),ObjStr(nobj->cmdName)); */ @@ -9671,10 +9671,10 @@ { if (clopt->instfilters) CmdListRemoveList(&clopt->instfilters, GuardDel); - FilterInvalidateObjOrders(in, cl); + FilterInvalidateObjOrders(interp, cl); for (i = 0; i < oc; i ++) { - if (FilterAdd(in, &clopt->instfilters, ov[i], 0, cl) != TCL_OK) + if (FilterAdd(interp, &clopt->instfilters, ov[i], 0, cl) != TCL_OK) return TCL_ERROR; } break; @@ -9685,63 +9685,63 @@ static int -XOTclOMixinGuardMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTclOMixinGuardMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { XOTclObject *obj = (XOTclObject*)cd; XOTclCmdList* h; XOTclObjectOpt *opt; - if (!obj) return XOTclObjErrType(in, objv[0], "Object"); + if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); if (objc != 3) - return XOTclObjErrArgCnt(in, obj->cmdName, "mixinguard mixin guards"); + return XOTclObjErrArgCnt(interp, obj->cmdName, "mixinguard mixin guards"); opt = obj->opt; if (opt && opt->mixins) { - XOTclClass *mixinCl = XOTclpGetClass(in, ObjStr(objv[1])); + XOTclClass *mixinCl = XOTclpGetClass(interp, ObjStr(objv[1])); Tcl_Command mixinCmd = NULL; if (mixinCl) { - mixinCmd = Tcl_GetCommandFromObj(in, mixinCl->object.cmdName); + mixinCmd = Tcl_GetCommandFromObj(interp, mixinCl->object.cmdName); } if (mixinCmd) { h = CmdListFindCmdInList(mixinCmd, opt->mixins); if (h) { if (h->clientData) GuardDel((XOTclCmdList*) h); - GuardAdd(in, h, objv[2]); + GuardAdd(interp, h, objv[2]); obj->flags &= ~XOTCL_MIXIN_ORDER_VALID; return TCL_OK; } } } - return XOTclVarErrMsg(in, "Mixinguard: can't find mixin ", + return XOTclVarErrMsg(interp, "Mixinguard: can't find mixin ", ObjStr(objv[1]), " on ", ObjStr(obj->cmdName), (char *) NULL); } static int -XOTclOFilterGuardMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTclOFilterGuardMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { XOTclObject *obj = (XOTclObject*)cd; XOTclCmdList* h; XOTclObjectOpt *opt; - if (!obj) return XOTclObjErrType(in, objv[0], "Object"); + if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); if (objc != 3) - return XOTclObjErrArgCnt(in, obj->cmdName, "filterguard filtername filterGuards"); + return XOTclObjErrArgCnt(interp, obj->cmdName, "filterguard filtername filterGuards"); opt = obj->opt; if (opt && opt->filters) { - h = CmdListFindNameInList(in, ObjStr(objv[1]), opt->filters); + h = CmdListFindNameInList(interp, ObjStr(objv[1]), opt->filters); if (h) { if (h->clientData) GuardDel((XOTclCmdList*) h); - GuardAdd(in, h, objv[2]); + GuardAdd(interp, h, objv[2]); obj->flags &= ~XOTCL_FILTER_ORDER_VALID; return TCL_OK; } } - return XOTclVarErrMsg(in, "Filterguard: can't find filter ", + return XOTclVarErrMsg(interp, "Filterguard: can't find filter ", ObjStr(objv[1]), " on ", ObjStr(obj->cmdName), (char *) NULL); } @@ -9751,27 +9751,27 @@ * if it is not found it returns an empty string */ static int -XOTclOFilterSearchMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTclOFilterSearchMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { XOTclObject *obj = (XOTclObject*)cd; char *methodName; XOTclCmdList *cmdList; XOTclClass *fcl; XOTclObject *fobj; - if (!obj) return XOTclObjErrType(in, objv[0], "Object"); - if (objc < 2) return XOTclObjErrArgCnt(in, obj->cmdName, "filtersearch name"); - Tcl_ResetResult(in); + if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); + if (objc < 2) return XOTclObjErrArgCnt(interp, obj->cmdName, "filtersearch name"); + Tcl_ResetResult(interp); if (!(obj->flags & XOTCL_FILTER_ORDER_VALID)) - FilterComputeDefined(in, obj); + FilterComputeDefined(interp, obj); if (!(obj->flags & XOTCL_FILTER_ORDER_DEFINED)) return TCL_OK; methodName = ObjStr(objv[1]); cmdList = obj->filterOrder; while (cmdList) { - CONST84 char *filterName = Tcl_GetCommandName(in, cmdList->cmdPtr); + CONST84 char *filterName = Tcl_GetCommandName(interp, cmdList->cmdPtr); if (filterName[0] == methodName[0] && !strcmp(filterName, methodName)) break; cmdList = cmdList->next; @@ -9788,33 +9788,33 @@ fcl = 0; } - Tcl_SetObjResult(in, - getFullProcQualifier(in, methodName, fobj, fcl, + Tcl_SetObjResult(interp, + getFullProcQualifier(interp, methodName, fobj, fcl, cmdList->cmdPtr)); return TCL_OK; } static int -XOTclOProcSearchMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTclOProcSearchMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { XOTclObject *obj = (XOTclObject*)cd; XOTclClass *pcl = NULL; Tcl_Command cmd = NULL; char *simpleName, *methodName; - if (!obj) return XOTclObjErrType(in, objv[0], "Object"); - if (objc < 2) return XOTclObjErrArgCnt(in, obj->cmdName, "procsearch name"); + if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); + if (objc < 2) return XOTclObjErrArgCnt(interp, obj->cmdName, "procsearch name"); - Tcl_ResetResult(in); + Tcl_ResetResult(interp); methodName = ObjStr(objv[1]); if (!(obj->flags & XOTCL_MIXIN_ORDER_VALID)) - MixinComputeDefined(in, obj); + MixinComputeDefined(interp, obj); if (obj->flags & XOTCL_MIXIN_ORDER_DEFINED_AND_VALID) { XOTclCmdList* mixinList = obj->mixinOrder; while (mixinList) { - XOTclClass *mcl = XOTclpGetClass(in, (char *)Tcl_GetCommandName(in, mixinList->cmdPtr)); + XOTclClass *mcl = XOTclpGetClass(interp, (char *)Tcl_GetCommandName(interp, mixinList->cmdPtr)); if (mcl && (pcl = SearchCMethod(mcl, methodName, &cmd))) { break; } @@ -9831,27 +9831,27 @@ if (cmd) { XOTclObject *pobj = pcl ? NULL : obj; - simpleName = (char *)Tcl_GetCommandName(in, cmd); - Tcl_SetObjResult(in, getFullProcQualifier(in, simpleName, pobj, pcl, cmd)); + simpleName = (char *)Tcl_GetCommandName(interp, cmd); + Tcl_SetObjResult(interp, getFullProcQualifier(interp, simpleName, pobj, pcl, cmd)); } return TCL_OK; } static int -XOTclORequireNamespaceMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTclORequireNamespaceMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { XOTclObject *obj = (XOTclObject*)cd; - if (!obj) return XOTclObjErrType(in, objv[0], "Object"); - if (objc != 1) return XOTclObjErrArgCnt(in, obj->cmdName, "requireNamespace"); + if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); + if (objc != 1) return XOTclObjErrArgCnt(interp, obj->cmdName, "requireNamespace"); - requireObjNamespace(in, obj); + requireObjNamespace(interp, obj); return TCL_OK; } typedef enum {NO_DASH, SKALAR_DASH, LIST_DASH} dashArgType; static dashArgType -isDashArg(Tcl_Interp *in, Tcl_Obj *obj, char **methodName, int *objc, Tcl_Obj **objv[]) { +isDashArg(Tcl_Interp *interp, Tcl_Obj *obj, char **methodName, int *objc, Tcl_Obj **objv[]) { char *flag; static Tcl_ObjType *listType = NULL; @@ -9877,7 +9877,7 @@ } if (obj->typePtr == listType) { - if (Tcl_ListObjGetElements(in, obj, objc, objv) == TCL_OK && *objc>1) { + if (Tcl_ListObjGetElements(interp, obj, objc, objv) == TCL_OK && *objc>1) { flag = ObjStr(*objv[0]); /*fprintf(stderr, "we have a list starting with '%s'\n", flag);*/ if (*flag == '-') { @@ -9897,7 +9897,7 @@ } static int -callConfigureMethod(Tcl_Interp *in, XOTclObject *obj, +callConfigureMethod(Tcl_Interp *interp, XOTclObject *obj, char *methodName, int argc, Tcl_Obj *CONST argv[]) { int result; Tcl_Obj *method = Tcl_NewStringObj(methodName,-1); @@ -9909,16 +9909,16 @@ obj->flags |= XOTCL_INIT_CALLED; INCR_REF_COUNT(method); - result = callMethod((ClientData)obj, in, method, argc, argv, XOTCL_CM_NO_UNKNOWN); + result = callMethod((ClientData)obj, interp, method, argc, argv, XOTCL_CM_NO_UNKNOWN); DECR_REF_COUNT(method); /*fprintf(stderr, "method '%s' called args: %d o=%p, result=%d\n", methodName, argc+1, obj, result); */ if (result != TCL_OK) { - Tcl_Obj *res = Tcl_DuplicateObj(Tcl_GetObjResult(in)); /* save the result */ + Tcl_Obj *res = Tcl_DuplicateObj(Tcl_GetObjResult(interp)); /* save the result */ INCR_REF_COUNT(res); - XOTclVarErrMsg(in, ObjStr(res), " during '", ObjStr(obj->cmdName), " ", + XOTclVarErrMsg(interp, ObjStr(res), " during '", ObjStr(obj->cmdName), " ", methodName, "'", (char *) NULL); DECR_REF_COUNT(res); } @@ -9927,32 +9927,32 @@ static int -XOTclOConfigureMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTclOConfigureMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { XOTclObject *obj = (XOTclObject*)cd; Tcl_Obj **argv, **nextArgv; int i, argc, nextArgc, normalArgs, result = TCL_OK, isdasharg = NO_DASH; char *methodName, *nextMethodName; - if (!obj) return XOTclObjErrType(in, objv[0], "Object"); - if (objc < 1) return XOTclObjErrArgCnt(in, obj->cmdName, + if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); + if (objc < 1) return XOTclObjErrArgCnt(interp, obj->cmdName, "configure ?args?"); /* find arguments without leading dash */ for (i=1; i < objc; i++) { - if ((isdasharg = isDashArg(in, objv[i], &methodName, &argc, &argv))) + if ((isdasharg = isDashArg(interp, objv[i], &methodName, &argc, &argv))) break; } normalArgs = i-1; for( ; i < objc; argc=nextArgc, argv=nextArgv, methodName=nextMethodName) { - Tcl_ResetResult(in); + Tcl_ResetResult(interp); switch (isdasharg) { case SKALAR_DASH: /* argument is a skalar with a leading dash */ { int j; for (j = i+1; j < objc; j++, argc++) { - if ((isdasharg = isDashArg(in, objv[j], &nextMethodName, &nextArgc, &nextArgv))) + if ((isdasharg = isDashArg(interp, objv[j], &nextMethodName, &nextArgc, &nextArgv))) break; } - result = callConfigureMethod(in, obj, methodName, argc+1, objv+i+1); + result = callConfigureMethod(interp, obj, methodName, argc+1, objv+i+1); if (result != TCL_OK) return result; i += argc; @@ -9961,23 +9961,23 @@ case LIST_DASH: /* argument is a list with a leading dash, grouping determined by list */ { i++; if (icmdName), + return XOTclVarErrMsg(interp, ObjStr(obj->cmdName), " configure: unexpected argument '", ObjStr(objv[i]), "' between parameters", (char *) NULL); } } } - Tcl_ResetResult(in); - Tcl_SetIntObj(Tcl_GetObjResult(in), normalArgs); + Tcl_ResetResult(interp); + Tcl_SetIntObj(Tcl_GetObjResult(interp), normalArgs); return result; } @@ -9988,23 +9988,23 @@ */ static int -XOTclCInstDestroyMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTclCInstDestroyMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { XOTclClass *cl = XOTclObjectToClass(cd); XOTclObject *delobj; int rc; - if (!cl) return XOTclObjErrType(in, objv[0], "Class"); + if (!cl) return XOTclObjErrType(interp, objv[0], "Class"); if (objc < 2) - return XOTclObjErrArgCnt(in, cl->object.cmdName, "instdestroy "); + return XOTclObjErrArgCnt(interp, cl->object.cmdName, "instdestroy "); - if (XOTclObjConvertObject(in, objv[1], &delobj) != TCL_OK) - return XOTclVarErrMsg(in, "Can't destroy object ", + if (XOTclObjConvertObject(interp, objv[1], &delobj) != TCL_OK) + return XOTclVarErrMsg(interp, "Can't destroy object ", ObjStr(objv[1]), " that does not exist.", (char *) NULL); /* fprintf(stderr,"instdestroy obj=%s, opt=%p\n",ObjStr(delobj->cmdName),delobj->opt);*/ - rc = freeUnsetTraceVariable(in, delobj); + rc = freeUnsetTraceVariable(interp, delobj); if (rc != TCL_OK) { return rc; } @@ -10013,23 +10013,23 @@ * latch, and call delete command if not already in progress */ delobj->flags |= XOTCL_DESTROY_CALLED; - RUNTIME_STATE(in)->callIsDestroy = 1; + RUNTIME_STATE(interp)->callIsDestroy = 1; /*fprintf(stderr,"instDestroy: setting callIsDestroy = 1\n");*/ - if (RUNTIME_STATE(in)->exitHandlerDestroyRound != + if (RUNTIME_STATE(interp)->exitHandlerDestroyRound != XOTCL_EXITHANDLER_ON_SOFT_DESTROY) { - CallStackDestroyObject(in, delobj); + CallStackDestroyObject(interp, delobj); } return TCL_OK; } static Tcl_Namespace * -callingNameSpace(Tcl_Interp *in) { +callingNameSpace(Tcl_Interp *interp) { Tcl_Namespace *ns = NULL; - XOTclCallStack *cs = &RUNTIME_STATE(in)->cs; + XOTclCallStack *cs = &RUNTIME_STATE(interp)->cs; XOTclCallStackContent *top = cs->top; - XOTclCallStackContent *csc = XOTclCallStackFindLastInvocation(in, 0); + XOTclCallStackContent *csc = XOTclCallStackFindLastInvocation(interp, 0); /*fprintf(stderr," **** use last invocation csc = %p\n", csc);*/ if (csc && csc->currentFramePtr) { @@ -10042,14 +10042,14 @@ ns = f->nsPtr; } else { Tcl_CallFrame *f = Tcl_CallFrame_callerPtr(csc->currentFramePtr); - ns = Tcl_GetCurrentNamespace(in); + ns = Tcl_GetCurrentNamespace(interp); /* find last incovation outside ::xotcl (for things like relmgr) */ - while (ns == RUNTIME_STATE(in)->XOTclNS) { + while (ns == RUNTIME_STATE(interp)->XOTclNS) { if (f) { ns = f->nsPtr; f = Tcl_CallFrame_callerPtr(f); } else { - ns = Tcl_GetGlobalNamespace(in); + ns = Tcl_GetGlobalNamespace(interp); } } /*fprintf(stderr, "found ns %p '%s'\n",ns, ns?ns->fullName:"NULL");*/ @@ -10070,44 +10070,44 @@ ns, ns?ns->fullName : "" );*/ } else { /* fprintf(stderr, "nothing found, use ::\n"); */ - ns = Tcl_GetGlobalNamespace(in); + ns = Tcl_GetGlobalNamespace(interp); } } } - /*XOTclCallStackDump(in);*/ - /*XOTclStackDump(in);*/ + /*XOTclCallStackDump(interp);*/ + /*XOTclStackDump(interp);*/ /*fprintf(stderr,"callingNameSpace returns %p %s\n",ns,ns?ns->fullName:"");*/ return ns; } static int -XOTclCAllocMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTclCAllocMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { XOTclClass *cl = XOTclObjectToClass(cd); XOTclClass *newcl; XOTclObject *newobj; int result; - if (!cl) return XOTclObjErrType(in, objv[0], "Class"); + if (!cl) return XOTclObjErrType(interp, objv[0], "Class"); if (objc < 2) - return XOTclObjErrArgCnt(in, cl->object.cmdName, "alloc ?args?"); + return XOTclObjErrArgCnt(interp, cl->object.cmdName, "alloc ?args?"); #if 0 fprintf(stderr, "type(%s)=%p %s %d\n", ObjStr(objv[1]), objv[1]->typePtr, objv[1]->typePtr? objv[1]->typePtr->name:"NULL", - XOTclObjConvertObject(in, objv[1], &newobj) + XOTclObjConvertObject(interp, objv[1], &newobj) ); /* * if the lookup via GetObject for the object succeeds, * the object exists already, * and we do not overwrite it, but re-create it */ - if (XOTclObjConvertObject(in, objv[1], &newobj) == TCL_OK) { + if (XOTclObjConvertObject(interp, objv[1], &newobj) == TCL_OK) { fprintf(stderr, "lookup successful\n"); - result = doCleanup(in, newobj, &cl->object, objc, objv); + result = doCleanup(interp, newobj, &cl->object, objc, objv); } else #endif { @@ -10119,7 +10119,7 @@ if (!isAbsolutePath(objName)) { /*fprintf(stderr, "CallocMethod\n");*/ - tmpName = NameInNamespaceObj(in,objName,callingNameSpace(in)); + tmpName = NameInNamespaceObj(interp,objName,callingNameSpace(interp)); /*fprintf(stderr, "NoAbsoluteName for '%s' -> determined = '%s'\n", objName, ObjStr(tmpName));*/ objName = ObjStr(tmpName); @@ -10128,31 +10128,31 @@ INCR_REF_COUNT(tmpName); } - if (IsMetaClass(in, cl)) { + if (IsMetaClass(interp, cl)) { /* * if the base class is a meta-class, we create a class */ - newcl = PrimitiveCCreate(in, objName, cl); + newcl = PrimitiveCCreate(interp, objName, cl); if (newcl == 0) - result = XOTclVarErrMsg(in, "Class alloc failed for '",objName, + result = XOTclVarErrMsg(interp, "Class alloc failed for '",objName, "' (possibly parent namespace does not exist)", (char *) NULL); else { - Tcl_SetObjResult(in, newcl->object.cmdName); + Tcl_SetObjResult(interp, newcl->object.cmdName); result = TCL_OK; } } else { /* * if the base class is an ordinary class, we create an object */ - newobj = PrimitiveOCreate(in, objName, cl); + newobj = PrimitiveOCreate(interp, objName, cl); if (newobj == 0) - result = XOTclVarErrMsg(in, "Object alloc failed for '",objName, + result = XOTclVarErrMsg(interp, "Object alloc failed for '",objName, "' (possibly parent namespace does not exist)", (char *) NULL); else { result = TCL_OK; - Tcl_SetObjResult(in, newobj->cmdName); + Tcl_SetObjResult(interp, newobj->cmdName); } } @@ -10167,7 +10167,7 @@ static int -createMethod(Tcl_Interp *in, XOTclClass *cl, XOTclObject *obj, +createMethod(Tcl_Interp *interp, XOTclClass *cl, XOTclObject *obj, int objc, Tcl_Obj *CONST objv[]) { XOTclObject *newobj = NULL; Tcl_Obj *nameObj, *tmpObj = NULL; @@ -10182,7 +10182,7 @@ * complete the name if it is not absolute */ if (!isAbsolutePath(objName)) { - tmpObj = NameInNamespaceObj(in,objName,callingNameSpace(in)); + tmpObj = NameInNamespaceObj(interp,objName,callingNameSpace(interp)); objName = ObjStr(tmpObj); /*fprintf(stderr," **** name is '%s'\n", objName);*/ @@ -10194,42 +10194,42 @@ * Check whether we have to call recreate (i.e. when the * object exists already) */ - newobj = XOTclpGetObject(in, objName); + newobj = XOTclpGetObject(interp, objName); /*fprintf(stderr,"+++ create objv[1] '%s', specifiedName '%s', newObj=%p\n", specifiedName, objName, newobj);*/ /* don't allow an object to be recreated as a class */ - if (newobj && (!IsMetaClass(in, cl) || IsMetaClass(in, newobj->cl))) { + if (newobj && (!IsMetaClass(interp, cl) || IsMetaClass(interp, newobj->cl))) { /*fprintf(stderr, "%%%% recreate, call recreate method ... %s, objc=%d\n", ObjStr(tov[1]),objc+1);*/ /* call recreate --> initialization */ - result = callMethod((ClientData) obj, in, + result = callMethod((ClientData) obj, interp, XOTclGlobalObjects[XOTE_RECREATE], objc+1, tov+1, 0); if (result != TCL_OK) goto create_method_exit; - Tcl_SetObjResult(in, newobj->cmdName); + Tcl_SetObjResult(interp, newobj->cmdName); nameObj = newobj->cmdName; objTrace("RECREATE", newobj); } else { if (!NSCheckColons(specifiedName, 0)) { - result = XOTclVarErrMsg(in, "Cannot create object -- illegal name '", + result = XOTclVarErrMsg(interp, "Cannot create object -- illegal name '", specifiedName, "'", (char *) NULL); goto create_method_exit; } /* fprintf(stderr, "alloc ... %s\n", ObjStr(tov[1]));*/ - result = callMethod((ClientData) obj, in, + result = callMethod((ClientData) obj, interp, XOTclGlobalObjects[XOTE_ALLOC], objc+1, tov+1, 0); if (result != TCL_OK) goto create_method_exit; - nameObj = Tcl_GetObjResult(in); - if (XOTclObjConvertObject(in, nameObj, &newobj) != TCL_OK) { - result = XOTclErrMsg(in, "couldn't find result of alloc", TCL_STATIC); + nameObj = Tcl_GetObjResult(interp); + if (XOTclObjConvertObject(interp, nameObj, &newobj) != TCL_OK) { + result = XOTclErrMsg(interp, "couldn't find result of alloc", TCL_STATIC); goto create_method_exit; } @@ -10239,7 +10239,7 @@ /* in case, the object is destroyed during initialization, we incr refcount */ INCR_REF_COUNT(nameObj); - result = doObjInitialization(in, newobj, objc, objv); + result = doObjInitialization(interp, newobj, objc, objv); DECR_REF_COUNT(nameObj); } create_method_exit: @@ -10252,25 +10252,25 @@ static int -XOTclCCreateMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTclCCreateMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { XOTclClass *cl = XOTclObjectToClass(cd); - if (!cl) return XOTclObjErrType(in, objv[0], "Class"); + if (!cl) return XOTclObjErrType(interp, objv[0], "Class"); if (objc < 2) - return XOTclObjErrArgCnt(in, cl->object.cmdName, "create ?args?"); + return XOTclObjErrArgCnt(interp, cl->object.cmdName, "create ?args?"); - if (RUNTIME_STATE(in)->exitHandlerDestroyRound != XOTCL_EXITHANDLER_OFF) { + if (RUNTIME_STATE(interp)->exitHandlerDestroyRound != XOTCL_EXITHANDLER_OFF) { fprintf(stderr,"### Can't create object %s during shutdown\n",ObjStr(objv[1])); return TCL_ERROR; return TCL_OK; /* don't fail, if this happens during destroy, it might be canceled */ } - return createMethod(in, cl, &cl->object, objc, objv); + return createMethod(interp, cl, &cl->object, objc, objv); } static int -XOTclCNewMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTclCNewMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { XOTclClass *cl = XOTclObjectToClass(cd); XOTclObject *child = NULL; Tcl_Obj *fullname; @@ -10280,19 +10280,19 @@ #endif i, prefixLength; Tcl_DString dFullname, *dsPtr = &dFullname; - XOTclStringIncrStruct *iss = &RUNTIME_STATE(in)->iss; + XOTclStringIncrStruct *iss = &RUNTIME_STATE(interp)->iss; - if (!cl) return XOTclObjErrType(in, objv[0], "Class"); + if (!cl) return XOTclObjErrType(interp, objv[0], "Class"); if (objc < 1) - return XOTclObjErrArgCnt(in, cl->object.cmdName, "new [-childof obj] ?args?"); + return XOTclObjErrArgCnt(interp, cl->object.cmdName, "new [-childof obj] ?args?"); for (i=1; istart, iss->length); - if (!Tcl_FindCommand(in, Tcl_DStringValue(dsPtr), NULL, 0)) { + if (!Tcl_FindCommand(interp, Tcl_DStringValue(dsPtr), NULL, 0)) { break; } /* in case the value existed already, reset prefix to the @@ -10337,14 +10337,14 @@ if (objc >= 1) memcpy(ov+3, objv+offset, sizeof(Tcl_Obj *)*objc); - result = DoDispatch(cd, in, objc+3, ov, 0); + result = DoDispatch(cd, interp, objc+3, ov, 0); FREE_ON_STACK(ov); } #if REFCOUNTED if (result == TCL_OK) { if (isrefcount) { - Tcl_Obj *obj = Tcl_GetObjResult(in); + Tcl_Obj *obj = Tcl_GetObjResult(interp); XOTclObject *o = (XOTclObject*) obj->internalRep.otherValuePtr; o->flags |= XOTCL_REFCOUNTED; o->teardown = in; @@ -10361,42 +10361,42 @@ static int -XOTclCRecreateMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTclCRecreateMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { XOTclClass *cl = XOTclObjectToClass(cd); XOTclObject *newobj; int result; - if (!cl) return XOTclObjErrType(in, objv[0], "Class"); + if (!cl) return XOTclObjErrType(interp, objv[0], "Class"); if (objc < 2) - return XOTclObjErrArgCnt(in, cl->object.cmdName, "recreate ?args?"); + return XOTclObjErrArgCnt(interp, cl->object.cmdName, "recreate ?args?"); - if (XOTclObjConvertObject(in, objv[1], &newobj) != TCL_OK) - return XOTclVarErrMsg(in, "can't recreate not existing obj ", + if (XOTclObjConvertObject(interp, objv[1], &newobj) != TCL_OK) + return XOTclVarErrMsg(interp, "can't recreate not existing obj ", ObjStr(objv[1]), (char *) NULL); INCR_REF_COUNT(objv[1]); newobj->flags |= XOTCL_RECREATE; - result = doCleanup(in, newobj, &cl->object, objc, objv); + result = doCleanup(interp, newobj, &cl->object, objc, objv); if (result == TCL_OK) { - result = doObjInitialization(in, newobj, objc, objv); + result = doObjInitialization(interp, newobj, objc, objv); if (result == TCL_OK) - Tcl_SetObjResult(in, objv[1]); + Tcl_SetObjResult(interp, objv[1]); } DECR_REF_COUNT(objv[1]); return result; } static int -XOTclCInfoMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj * CONST objv[]) { +XOTclCInfoMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]) { XOTclClass *cl = XOTclObjectToClass(cd); Tcl_Namespace *nsp; XOTclClassOpt *opt; char *pattern, *cmd; int modifiers = 0; if (objc < 2) - return XOTclObjErrArgCnt(in, cl->object.cmdName, "info ?args?"); + return XOTclObjErrArgCnt(interp, cl->object.cmdName, "info ?args?"); if (cl) { nsp = cl->nsPtr; @@ -10417,20 +10417,20 @@ case 'c': if (!strcmp(cmd, "classchildren")) { if (objc > 3 || modifiers > 0) - return XOTclObjErrArgCnt(in, cl->object.cmdName, "info classchildren ?pat?"); - return ListChildren(in, (XOTclObject*) cl, pattern, 1); + return XOTclObjErrArgCnt(interp, cl->object.cmdName, "info classchildren ?pat?"); + return ListChildren(interp, (XOTclObject*) cl, pattern, 1); } else if (!strcmp(cmd, "classparent")) { if (objc > 2 || modifiers > 0) - return XOTclObjErrArgCnt(in, cl->object.cmdName, "info classparent"); - return ListParent(in, &cl->object); + return XOTclObjErrArgCnt(interp, cl->object.cmdName, "info classparent"); + return ListParent(interp, &cl->object); } break; case 'h': if (!strcmp(cmd, "heritage")) { if (objc > 3 || modifiers > 0) - return XOTclObjErrArgCnt(in, cl->object.cmdName, "info heritage ?pat?"); - return ListHeritage(in, cl, pattern); + return XOTclObjErrArgCnt(interp, cl->object.cmdName, "info heritage ?pat?"); + return ListHeritage(interp, cl, pattern); } break; @@ -10441,56 +10441,56 @@ case 'a': if (!strcmp(cmdTail, "ances")) { if (objc > 3 || modifiers > 0) - return XOTclObjErrArgCnt(in, cl->object.cmdName, "info instances ?pat?"); - return ListObjPtrHashTable(in, &cl->instances, pattern); + return XOTclObjErrArgCnt(interp, cl->object.cmdName, "info instances ?pat?"); + return ListObjPtrHashTable(interp, &cl->instances, pattern); } else if (!strcmp(cmdTail, "args")) { if (objc != 3 || modifiers > 0) - return XOTclObjErrArgCnt(in, cl->object.cmdName, + return XOTclObjErrArgCnt(interp, cl->object.cmdName, "info instargs "); if (cl->nonposArgsTable) { XOTclNonposArgs* nonposArgs = NonposArgsGet(cl->nonposArgsTable, pattern); if (nonposArgs) { - return ListArgsFromOrdinaryArgs(in, nonposArgs); + return ListArgsFromOrdinaryArgs(interp, nonposArgs); } } - return ListProcArgs(in, Tcl_Namespace_cmdTable(nsp), pattern); + return ListProcArgs(interp, Tcl_Namespace_cmdTable(nsp), pattern); } break; case 'b': if (!strcmp(cmdTail, "body")) { if (objc != 3 || modifiers > 0) - return XOTclObjErrArgCnt(in, cl->object.cmdName, + return XOTclObjErrArgCnt(interp, cl->object.cmdName, "info instbody "); - return ListProcBody(in, Tcl_Namespace_cmdTable(nsp), pattern); + return ListProcBody(interp, Tcl_Namespace_cmdTable(nsp), pattern); } break; case 'c': if (!strcmp(cmdTail, "commands")) { if (objc > 3 || modifiers > 0) - return XOTclObjErrArgCnt(in, cl->object.cmdName, + return XOTclObjErrArgCnt(interp, cl->object.cmdName, "info instcommands ?pat?"); - return ListKeys(in, Tcl_Namespace_cmdTable(nsp), pattern); + return ListKeys(interp, Tcl_Namespace_cmdTable(nsp), pattern); } break; case 'd': if (!strcmp(cmdTail, "default")) { if (objc != 5 || modifiers > 0) - return XOTclObjErrArgCnt(in, cl->object.cmdName, + return XOTclObjErrArgCnt(interp, cl->object.cmdName, "info instdefault "); if (cl->nonposArgsTable) { XOTclNonposArgs* nonposArgs = NonposArgsGet(cl->nonposArgsTable, pattern); if (nonposArgs) { - return ListDefaultFromOrdinaryArgs(in, pattern, nonposArgs, + return ListDefaultFromOrdinaryArgs(interp, pattern, nonposArgs, ObjStr(objv[3]), objv[4]); } } - return ListProcDefault(in, Tcl_Namespace_cmdTable(nsp), pattern, + return ListProcDefault(interp, Tcl_Namespace_cmdTable(nsp), pattern, ObjStr(objv[3]), objv[4]); } break; @@ -10499,30 +10499,30 @@ if (!strcmp(cmdTail, "filter")) { int withGuards = 0; if (objc-modifiers > 3) - return XOTclObjErrArgCnt(in, cl->object.cmdName, + return XOTclObjErrArgCnt(interp, cl->object.cmdName, "info instfilter ?-guards? ?pat?"); if (modifiers > 0) { withGuards = checkForModifier(objv, modifiers, "-guards"); if (withGuards == 0) - return XOTclVarErrMsg(in, "info instfilter: unknown modifier ", + return XOTclVarErrMsg(interp, "info instfilter: unknown modifier ", ObjStr(objv[2]), (char *) NULL); } - return opt ? FilterInfo(in, opt->instfilters, pattern, withGuards, 0) : TCL_OK; + return opt ? FilterInfo(interp, opt->instfilters, pattern, withGuards, 0) : TCL_OK; } else if (!strcmp(cmdTail, "filterguard")) { if (objc != 3 || modifiers > 0) - return XOTclObjErrArgCnt(in, cl->object.cmdName, + return XOTclObjErrArgCnt(interp, cl->object.cmdName, "info instfilterguard filter"); - return opt ? GuardList(in, opt->instfilters, pattern) : TCL_OK; + return opt ? GuardList(interp, opt->instfilters, pattern) : TCL_OK; } else if (!strcmp(cmdTail, "forward")) { int argc = objc-modifiers; int definition; if (argc < 2 || argc > 3) - return XOTclObjErrArgCnt(in, cl->object.cmdName, + return XOTclObjErrArgCnt(interp, cl->object.cmdName, "info instforward ?-definition? ?name?"); definition = checkForModifier(objv, modifiers, "-definition"); if (nsp) - return forwardList(in, Tcl_Namespace_cmdTable(nsp), pattern, definition); + return forwardList(interp, Tcl_Namespace_cmdTable(nsp), pattern, definition); else return TCL_OK; } @@ -10532,11 +10532,11 @@ if (!strcmp(cmdTail, "invar")) { XOTclAssertionStore *assertions = opt ? opt->assertions : 0; if (objc != 2 || modifiers > 0) - return XOTclObjErrArgCnt(in, cl->object.cmdName, + return XOTclObjErrArgCnt(interp, cl->object.cmdName, "info instinvar"); if (assertions && assertions->invariants) - Tcl_SetObjResult(in, AssertionList(in, assertions->invariants)); + Tcl_SetObjResult(interp, AssertionList(interp, assertions->invariants)); return TCL_OK; } break; @@ -10546,39 +10546,39 @@ int withGuards = 0; if (objc-modifiers > 3 || modifiers > 1) - return XOTclObjErrArgCnt(in, cl->object.cmdName, + return XOTclObjErrArgCnt(interp, cl->object.cmdName, "info instmixin ?-guards? ?class?"); if (modifiers > 0) { withGuards = checkForModifier(objv, modifiers, "-guards"); if (withGuards == 0) - return XOTclVarErrMsg(in, "info instfilter: unknown modifier ", + return XOTclVarErrMsg(interp, "info instfilter: unknown modifier ", ObjStr(objv[2]), (char *) NULL); } - return opt ? MixinInfo(in, opt->instmixins, pattern, withGuards) : TCL_OK; + return opt ? MixinInfo(interp, opt->instmixins, pattern, withGuards) : TCL_OK; } else if (!strcmp(cmdTail, "mixinof")) { if (objc-modifiers > 3 || modifiers > 0) - return XOTclObjErrArgCnt(in, cl->object.cmdName, + return XOTclObjErrArgCnt(interp, cl->object.cmdName, "info instmixinof ?class?"); - return opt ? MixinOfInfo(in, opt->instmixinofs, pattern) : TCL_OK; + return opt ? MixinOfInfo(interp, opt->instmixinofs, pattern) : TCL_OK; } else if (!strcmp(cmdTail, "mixinguard")) { if (objc != 3 || modifiers > 0) - return XOTclObjErrArgCnt(in, cl->object.cmdName, + return XOTclObjErrArgCnt(interp, cl->object.cmdName, "info instmixinguard mixin"); - return opt ? GuardList(in, opt->instmixins, pattern) : TCL_OK; + return opt ? GuardList(interp, opt->instmixins, pattern) : TCL_OK; } break; case 'n': if (!strcmp(cmdTail, "nonposargs")) { if (objc != 3 || modifiers > 0) - return XOTclObjErrArgCnt(in, cl->object.cmdName, + return XOTclObjErrArgCnt(interp, cl->object.cmdName, "info instnonposargs "); if (cl->nonposArgsTable) { XOTclNonposArgs* nonposArgs = NonposArgsGet(cl->nonposArgsTable, pattern); if (nonposArgs) { - Tcl_SetObjResult(in, NonposArgsFormat(in, + Tcl_SetObjResult(interp, NonposArgsFormat(interp, nonposArgs->nonposArgs)); } } @@ -10589,27 +10589,27 @@ case 'p': if (!strcmp(cmdTail, "procs")) { if (objc > 3 || modifiers > 0) - return XOTclObjErrArgCnt(in, cl->object.cmdName, "info instprocs ?pat?"); - return ListMethodKeys(in, Tcl_Namespace_cmdTable(nsp), pattern, + return XOTclObjErrArgCnt(interp, cl->object.cmdName, "info instprocs ?pat?"); + return ListMethodKeys(interp, Tcl_Namespace_cmdTable(nsp), pattern, /*noProcs*/ 0, /*noCmds*/ 1, /* noDups */ 0, 0); } else if (!strcmp(cmdTail, "pre")) { XOTclProcAssertion* procs; if (objc != 3 || modifiers > 0) - return XOTclObjErrArgCnt(in, cl->object.cmdName, + return XOTclObjErrArgCnt(interp, cl->object.cmdName, "info instpre "); if (opt && opt->assertions) { procs = AssertionFindProcs(opt->assertions, ObjStr(objv[2])); - if (procs) Tcl_SetObjResult(in, AssertionList(in, procs->pre)); + if (procs) Tcl_SetObjResult(interp, AssertionList(interp, procs->pre)); } return TCL_OK; } else if (!strcmp(cmdTail, "post")) { XOTclProcAssertion* procs; if (objc != 3 || modifiers > 0) - return XOTclObjErrArgCnt(in, cl->object.cmdName, + return XOTclObjErrArgCnt(interp, cl->object.cmdName, "info instpost "); if (opt && opt->assertions) { procs = AssertionFindProcs(opt->assertions, ObjStr(objv[2])); - if (procs) Tcl_SetObjResult(in, AssertionList(in, procs->post)); + if (procs) Tcl_SetObjResult(interp, AssertionList(interp, procs->post)); } return TCL_OK; } @@ -10621,18 +10621,18 @@ case 'm': if (!strcmp(cmd, "mixinof")) { if (objc-modifiers > 3 || modifiers > 0) - return XOTclObjErrArgCnt(in, cl->object.cmdName, + return XOTclObjErrArgCnt(interp, cl->object.cmdName, "info mixinof ?object?"); - return opt ? MixinOfInfo(in, opt->mixinofs, pattern) : TCL_OK; + return opt ? MixinOfInfo(interp, opt->mixinofs, pattern) : TCL_OK; } break; case 'p': if (!strcmp(cmd, "parameterclass")) { if (opt && opt->parameterClass) { - Tcl_SetObjResult(in, opt->parameterClass); + Tcl_SetObjResult(interp, opt->parameterClass); } else { - Tcl_SetObjResult(in, XOTclGlobalObjects[XOTE_PARAM_CL]); + Tcl_SetObjResult(interp, XOTclGlobalObjects[XOTE_PARAM_CL]); } return TCL_OK; } else if (!strcmp(cmd, "parameter")) { @@ -10642,29 +10642,29 @@ DSTRING_INIT(dsPtr); Tcl_DStringAppend(dsPtr, className(cl), -1); Tcl_DStringAppend(dsPtr, "::slot", 6); - o = XOTclpGetObject(in, Tcl_DStringValue(dsPtr)); + o = XOTclpGetObject(interp, Tcl_DStringValue(dsPtr)); if (o) { Tcl_Obj *varNameObj = Tcl_NewStringObj("__parameter",-1); Tcl_Obj *parameters = XOTclOGetInstVar2((XOTcl_Object*)o, - in, varNameObj, NULL, + interp, varNameObj, NULL, TCL_LEAVE_ERR_MSG); if (parameters) { - Tcl_SetObjResult(in, parameters); + Tcl_SetObjResult(interp, parameters); } else { fprintf(stderr, "info parameters: No value for %s\n", Tcl_DStringValue(dsPtr)); - Tcl_SetObjResult(in, XOTclGlobalObjects[XOTE_EMPTY]); + Tcl_SetObjResult(interp, XOTclGlobalObjects[XOTE_EMPTY]); } DECR_REF_COUNT(varNameObj); } else { - Tcl_SetObjResult(in, XOTclGlobalObjects[XOTE_EMPTY]); + Tcl_SetObjResult(interp, XOTclGlobalObjects[XOTE_EMPTY]); } DSTRING_FREE(dsPtr); #if 0 if (cl->parameters) { - Tcl_SetObjResult(in, cl->parameters); + Tcl_SetObjResult(interp, cl->parameters); } else { - Tcl_SetObjResult(in, XOTclGlobalObjects[XOTE_EMPTY]); + Tcl_SetObjResult(interp, XOTclGlobalObjects[XOTE_EMPTY]); } #endif return TCL_OK; @@ -10674,24 +10674,24 @@ case 's': if (!strcmp(cmd, "superclass")) { if (objc > 3 || modifiers > 0) - return XOTclObjErrArgCnt(in, cl->object.cmdName, + return XOTclObjErrArgCnt(interp, cl->object.cmdName, "info superclass ?class?"); - return ListSuperclasses(in, cl, pattern); + return ListSuperclasses(interp, cl, pattern); } else if (!strcmp(cmd, "subclass")) { if (objc > 3 || modifiers > 0) - return XOTclObjErrArgCnt(in, cl->object.cmdName, + return XOTclObjErrArgCnt(interp, cl->object.cmdName, "info subclass ?class?"); - return ListSubclasses(in, cl, pattern); + return ListSubclasses(interp, cl, pattern); } else if (!strcmp(cmd, "slots")) { Tcl_DString ds, *dsPtr = &ds; XOTclObject *o; int rc; DSTRING_INIT(dsPtr); Tcl_DStringAppend(dsPtr, className(cl), -1); Tcl_DStringAppend(dsPtr, "::slot", 6); - o = XOTclpGetObject(in, Tcl_DStringValue(dsPtr)); + o = XOTclpGetObject(interp, Tcl_DStringValue(dsPtr)); if (o) { - rc = ListChildren(in, o, NULL, 0); + rc = ListChildren(interp, o, NULL, 0); } else { rc = TCL_OK; } @@ -10702,18 +10702,18 @@ } } - return XOTclOInfoMethod(cd, in, objc, (Tcl_Obj **)objv); + return XOTclOInfoMethod(cd, interp, objc, (Tcl_Obj **)objv); } static int -XOTclCParameterMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTclCParameterMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { XOTclClass *cl = XOTclObjectToClass(cd); Tcl_Obj **pv = 0; int elts, pc, result; char * params; - if (!cl) return XOTclObjErrType(in, objv[0], "Class"); + if (!cl) return XOTclObjErrType(interp, objv[0], "Class"); if (objc != 2) - return XOTclObjErrArgCnt(in, cl->object.cmdName, "parameter ?params?"); + return XOTclObjErrArgCnt(interp, cl->object.cmdName, "parameter ?params?"); if (cl->parameters) { DECR_REF_COUNT(cl->parameters); } @@ -10730,10 +10730,10 @@ INCR_REF_COUNT(cl->parameters); /* call getter/setter methods in params */ - result = Tcl_ListObjGetElements(in, objv[1], &pc, &pv); + result = Tcl_ListObjGetElements(interp, objv[1], &pc, &pv); if (result == TCL_OK) { for (elts = 0; elts < pc; elts++) { - result = callParameterMethodWithArg(&cl->object, in, + result = callParameterMethodWithArg(&cl->object, interp, XOTclGlobalObjects[XOTE_MKGETTERSETTER], cl->object.cmdName, 3+1, &pv[elts],0); if (result != TCL_OK) @@ -10744,14 +10744,14 @@ } static int -XOTclCParameterClassMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTclCParameterClassMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { XOTclClass *cl = XOTclObjectToClass(cd); char *paramClStr; XOTclClassOpt *opt; - if (!cl) return XOTclObjErrType(in, objv[0], "Class"); + if (!cl) return XOTclObjErrType(interp, objv[0], "Class"); if (objc != 2) - return XOTclObjErrArgCnt(in, cl->object.cmdName, "parameterclass cl"); + return XOTclObjErrArgCnt(interp, cl->object.cmdName, "parameterclass cl"); paramClStr = ObjStr(objv[1]); opt = cl->opt; @@ -10770,24 +10770,24 @@ } static int -XOTclCInstParameterCmdMethod(ClientData cd, Tcl_Interp *in, +XOTclCInstParameterCmdMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]) { XOTclClass *cl = XOTclObjectToClass(cd); - if (!cl) return XOTclObjErrType(in, objv[0], "Class"); - if (objc < 2) return XOTclObjErrArgCnt(in, cl->object.cmdName, "instparametercmd name"); - XOTclAddIMethod(in, (XOTcl_Class*) cl, ObjStr(objv[1]), + if (!cl) return XOTclObjErrType(interp, objv[0], "Class"); + if (objc < 2) return XOTclObjErrArgCnt(interp, cl->object.cmdName, "instparametercmd name"); + XOTclAddIMethod(interp, (XOTcl_Class*) cl, ObjStr(objv[1]), (Tcl_ObjCmdProc*)XOTclSetterMethod, 0, 0); return TCL_OK; } static int -XOTclCParameterCmdMethod(ClientData cd, Tcl_Interp *in, +XOTclCParameterCmdMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]) { XOTclObject *obj = (XOTclObject*) cd; - if (objc < 2) return XOTclObjErrArgCnt(in, obj->cmdName, "parametercmd name"); - XOTclAddPMethod(in, (XOTcl_Object*) obj, ObjStr(objv[1]), + if (objc < 2) return XOTclObjErrArgCnt(interp, obj->cmdName, "parametercmd name"); + XOTclAddPMethod(interp, (XOTcl_Object*) obj, ObjStr(objv[1]), (Tcl_ObjCmdProc*)XOTclSetterMethod, 0, 0); return TCL_OK; } @@ -10802,7 +10802,7 @@ } static int -forwardProcessOptions(Tcl_Interp *in, int objc, Tcl_Obj * CONST objv[], +forwardProcessOptions(Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[], forwardCmdClientData **tcdp) { forwardCmdClientData *tcd; int i, rc = 0, earlybinding = 0; @@ -10815,7 +10815,7 @@ if (!strcmp(ObjStr(objv[i]),"-default")) { if (objc <= i+1) {rc = TCL_ERROR; break;} tcd->subcommands = objv[i+1]; - rc = Tcl_ListObjLength(in,objv[i+1],&tcd->nr_subcommands); + rc = Tcl_ListObjLength(interp,objv[i+1],&tcd->nr_subcommands); if (rc != TCL_OK) break; INCR_REF_COUNT(tcd->subcommands); i++; @@ -10847,7 +10847,7 @@ tcd->nr_args++; INCR_REF_COUNT(tcd->args); } else { - Tcl_ListObjAppendElement(in, tcd->args, objv[i]); + Tcl_ListObjAppendElement(interp, tcd->args, objv[i]); tcd->nr_args++; } } @@ -10865,17 +10865,17 @@ */ char *name = ObjStr(tcd->cmdName); if (!isAbsolutePath(name)) { - tcd->cmdName = NameInNamespaceObj(in, name, callingNameSpace(in)); + tcd->cmdName = NameInNamespaceObj(interp, name, callingNameSpace(interp)); /*fprintf(stderr,"name %s not absolute, therefore qualifying %s\n", name, ObjStr(tcd->cmdName));*/ } } INCR_REF_COUNT(tcd->cmdName); if (earlybinding) { - Tcl_Command cmd = Tcl_GetCommandFromObj(in, tcd->cmdName); + Tcl_Command cmd = Tcl_GetCommandFromObj(interp, tcd->cmdName); if (cmd == NULL) - return XOTclVarErrMsg(in, "cannot lookup command '",ObjStr(tcd->cmdName), "'", (char *) NULL); + return XOTclVarErrMsg(interp, "cannot lookup command '",ObjStr(tcd->cmdName), "'", (char *) NULL); tcd->objProc = Tcl_Command_objProc(cmd); if (tcd->objProc == XOTclObjDispatch /* don't do direct invoke on xotcl objects */ @@ -10901,57 +10901,57 @@ static int -XOTclCInstForwardMethod(ClientData cd, Tcl_Interp *in, +XOTclCInstForwardMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]) { XOTclClass *cl = XOTclObjectToClass(cd); forwardCmdClientData *tcd; int rc; - if (!cl) return XOTclObjErrType(in, objv[0], "Class"); + if (!cl) return XOTclObjErrType(interp, objv[0], "Class"); if (objc < 2) goto forward_argc_error; - rc = forwardProcessOptions(in, objc, objv, &tcd); + rc = forwardProcessOptions(interp, objc, objv, &tcd); if (rc == TCL_OK) { tcd->obj = &cl->object; - XOTclAddIMethod(in, (XOTcl_Class*) cl, NSTail(ObjStr(objv[1])), + XOTclAddIMethod(interp, (XOTcl_Class*) cl, NSTail(ObjStr(objv[1])), (Tcl_ObjCmdProc*)XOTclForwardMethod, (ClientData)tcd, forwardCmdDeleteProc); return TCL_OK; } else { forward_argc_error: - return XOTclObjErrArgCnt(in, cl->object.cmdName, + return XOTclObjErrArgCnt(interp, cl->object.cmdName, "instforward method ?target? ?-default name? ?-objscope? ?-methodprefix string? ?args?"); } } static int -XOTclOForwardMethod(ClientData cd, Tcl_Interp *in, +XOTclOForwardMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]) { XOTcl_Object *obj = (XOTcl_Object*) cd; forwardCmdClientData *tcd; int rc; - if (!obj) return XOTclObjErrType(in, objv[0], "Object"); + if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); if (objc < 2) goto forward_argc_error; - rc = forwardProcessOptions(in, objc, objv, &tcd); + rc = forwardProcessOptions(interp, objc, objv, &tcd); if (rc == TCL_OK) { tcd->obj = (XOTclObject*)obj; - XOTclAddPMethod(in, obj, NSTail(ObjStr(objv[1])), + XOTclAddPMethod(interp, obj, NSTail(ObjStr(objv[1])), (Tcl_ObjCmdProc*)XOTclForwardMethod, (ClientData)tcd, forwardCmdDeleteProc); return TCL_OK; } else { forward_argc_error: - return XOTclObjErrArgCnt(in, obj->cmdName, + return XOTclObjErrArgCnt(interp, obj->cmdName, "forward method ?target? ?-default name? ?-objscope? ?-methodprefix string? ?args?"); } } static int -XOTclOVolatileMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj * CONST objv[]) { +XOTclOVolatileMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]) { XOTclObject *obj = (XOTclObject*) cd; Tcl_Obj *o = obj->cmdName; int result = TCL_ERROR; @@ -10960,25 +10960,25 @@ callFrameContext ctx = {0}; if (objc != 1) - return XOTclObjErrArgCnt(in, obj->cmdName, "volatile"); + return XOTclObjErrArgCnt(interp, obj->cmdName, "volatile"); - if (RUNTIME_STATE(in)->exitHandlerDestroyRound != XOTCL_EXITHANDLER_OFF) { + if (RUNTIME_STATE(interp)->exitHandlerDestroyRound != XOTCL_EXITHANDLER_OFF) { fprintf(stderr,"### Can't make objects volatile during shutdown\n"); - return XOTclVarErrMsg(in, "Can't make objects volatile during shutdown\n",NULL); + return XOTclVarErrMsg(interp, "Can't make objects volatile during shutdown\n",NULL); } - CallStackUseActiveFrames(in, &ctx); + CallStackUseActiveFrames(interp, &ctx); vn = NSTail(fullName); - if (Tcl_SetVar2(in, vn, NULL, fullName, 0) != NULL) { + if (Tcl_SetVar2(interp, vn, NULL, fullName, 0) != NULL) { XOTclObjectOpt *opt = XOTclRequireObjectOpt(obj); /*fprintf(stderr,"### setting trace for %s\n", fullName);*/ - result = Tcl_TraceVar(in, vn, TCL_TRACE_UNSETS, (Tcl_VarTraceProc*)XOTclUnsetTrace, + result = Tcl_TraceVar(interp, vn, TCL_TRACE_UNSETS, (Tcl_VarTraceProc*)XOTclUnsetTrace, (ClientData)o); opt->volatileVarName = vn; } - CallStackRestoreSavedFrames(in, &ctx); + CallStackRestoreSavedFrames(interp, &ctx); if (result == TCL_OK) { INCR_REF_COUNT(o); @@ -10987,15 +10987,15 @@ } static int -XOTclCInstProcMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTclCInstProcMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { XOTclClass *cl = XOTclObjectToClass(cd); char *argStr, *bdyStr, *name; XOTclClassOpt* opt; int incr = 0, result = TCL_OK; - if (!cl) return XOTclObjErrType(in, objv[0], "Class"); + if (!cl) return XOTclObjErrType(interp, objv[0], "Class"); if (objc < 4 || objc > 7) - return XOTclObjErrArgCnt(in, cl->object.cmdName, + return XOTclObjErrArgCnt(interp, cl->object.cmdName, "instproc name ?non-positional-args? args body ?preAssertion postAssertion?"); if (objc == 5 || objc == 7) { @@ -11006,11 +11006,11 @@ bdyStr = ObjStr(objv[3 + incr]); name = ObjStr(objv[1 + incr]); - if ((cl == RUNTIME_STATE(in)->theObject && isDestroyString(name)) || - (cl == RUNTIME_STATE(in)->theClass && isInstDestroyString(name)) || - (cl == RUNTIME_STATE(in)->theClass && isAllocString(name)) || - (cl == RUNTIME_STATE(in)->theClass && isCreateString(name))) - return XOTclVarErrMsg(in, className(cl), " instproc: '", name, "' of ", + if ((cl == RUNTIME_STATE(interp)->theObject && isDestroyString(name)) || + (cl == RUNTIME_STATE(interp)->theClass && isInstDestroyString(name)) || + (cl == RUNTIME_STATE(interp)->theClass && isAllocString(name)) || + (cl == RUNTIME_STATE(interp)->theClass && isCreateString(name))) + return XOTclVarErrMsg(interp, className(cl), " instproc: '", name, "' of ", className(cl), " can not be overwritten. Derive a ", "sub-class", (char *) NULL); @@ -11019,9 +11019,9 @@ opt = cl->opt; if (opt && opt->assertions) AssertionRemoveProc(opt->assertions, name); - rc = NSDeleteCmd(in, cl->nsPtr, name); + rc = NSDeleteCmd(interp, cl->nsPtr, name); if (rc < 0) - return XOTclVarErrMsg(in, className(cl), " cannot delete instproc: '", name, + return XOTclVarErrMsg(interp, className(cl), " cannot delete instproc: '", name, "' of class ", className(cl), (char *) NULL); } else { XOTclAssertionStore* aStore = NULL; @@ -11032,84 +11032,84 @@ aStore = opt->assertions; } result = MakeProc(cl->nsPtr, aStore, &(cl->nonposArgsTable), - in, objc, (Tcl_Obj **) objv, &cl->object); + interp, objc, (Tcl_Obj **) objv, &cl->object); } /* could be a filter or filter inheritance ... update filter orders */ - FilterInvalidateObjOrders(in, cl); + FilterInvalidateObjOrders(interp, cl); return result; } static int -XOTclCInstFilterGuardMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTclCInstFilterGuardMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { XOTclClass *cl = XOTclObjectToClass(cd); XOTclCmdList* h; XOTclClassOpt* opt; - if (!cl) return XOTclObjErrType(in, objv[0], "Class"); - if (objc != 3) return XOTclObjErrArgCnt(in, cl->object.cmdName, + if (!cl) return XOTclObjErrType(interp, objv[0], "Class"); + if (objc != 3) return XOTclObjErrArgCnt(interp, cl->object.cmdName, "instfilterguard filtername filterGuard"); opt = cl->opt; if (opt && opt->instfilters) { - h = CmdListFindNameInList(in, ObjStr(objv[1]), opt->instfilters); + h = CmdListFindNameInList(interp, ObjStr(objv[1]), opt->instfilters); if (h) { if (h->clientData) GuardDel(h); - GuardAdd(in, h, objv[2]); - FilterInvalidateObjOrders(in, cl); + GuardAdd(interp, h, objv[2]); + FilterInvalidateObjOrders(interp, cl); return TCL_OK; } } - return XOTclVarErrMsg(in, "Instfilterguard: can't find filter ", + return XOTclVarErrMsg(interp, "Instfilterguard: can't find filter ", ObjStr(objv[1]), " on ", ObjStr(cl->object.cmdName), (char *) NULL); } static int -XOTclCInstMixinGuardMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTclCInstMixinGuardMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { XOTclClass *cl = XOTclObjectToClass(cd); XOTclCmdList* h; - if (!cl) return XOTclObjErrType(in, objv[0], "Class"); - if (objc != 3) return XOTclObjErrArgCnt(in, cl->object.cmdName, + if (!cl) return XOTclObjErrType(interp, objv[0], "Class"); + if (objc != 3) return XOTclObjErrArgCnt(interp, cl->object.cmdName, "instmixinguard mixin guard"); if (cl->opt && cl->opt->instmixins) { - XOTclClass *mixinCl = XOTclpGetClass(in, ObjStr(objv[1])); + XOTclClass *mixinCl = XOTclpGetClass(interp, ObjStr(objv[1])); Tcl_Command mixinCmd = NULL; if (mixinCl) { - mixinCmd = Tcl_GetCommandFromObj(in, mixinCl->object.cmdName); + mixinCmd = Tcl_GetCommandFromObj(interp, mixinCl->object.cmdName); } if (mixinCmd) { h = CmdListFindCmdInList(mixinCmd, cl->opt->instmixins); if (h) { if (h->clientData) GuardDel((XOTclCmdList*) h); - GuardAdd(in, h, objv[2]); - MixinInvalidateObjOrders(in, cl); + GuardAdd(interp, h, objv[2]); + MixinInvalidateObjOrders(interp, cl); return TCL_OK; } } } - return XOTclVarErrMsg(in, "Instmixinguard: can't find mixin ", + return XOTclVarErrMsg(interp, "Instmixinguard: can't find mixin ", ObjStr(objv[1]), " on ", ObjStr(cl->object.cmdName), (char *) NULL); } static int -XOTclCInvariantsMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTclCInvariantsMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { XOTclClass *cl = XOTclObjectToClass(cd); XOTclClassOpt* opt; - if (!cl) return XOTclObjErrType(in, objv[0], "Class"); + if (!cl) return XOTclObjErrType(interp, objv[0], "Class"); if (objc != 2) - return XOTclObjErrArgCnt(in, cl->object.cmdName, + return XOTclObjErrArgCnt(interp, cl->object.cmdName, "instinvar "); opt = XOTclRequireClassOpt(cl); @@ -11118,30 +11118,30 @@ else opt->assertions = AssertionCreateStore(); - opt->assertions->invariants = AssertionNewList(in, objv[1]); + opt->assertions->invariants = AssertionNewList(interp, objv[1]); return TCL_OK; } static int -XOTclCUnknownMethod(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTclCUnknownMethod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { XOTclObject *obj = (XOTclObject*) cd; char *self = ObjStr(obj->cmdName); int rc; - if (objc < 2) return XOTclObjErrArgCnt(in, objv[0], "message ?args .. args?"); + if (objc < 2) return XOTclObjErrArgCnt(interp, objv[0], "message ?args .. args?"); if (isCreateString(self)) - return XOTclVarErrMsg(in, "error ", self, ": unable to dispatch '", + return XOTclVarErrMsg(interp, "error ", self, ": unable to dispatch '", ObjStr(objv[1]), "'", (char *) NULL); - rc = callMethod(cd, in, XOTclGlobalObjects[XOTE_CREATE], objc+1, objv+1, 0); + rc = callMethod(cd, interp, XOTclGlobalObjects[XOTE_CREATE], objc+1, objv+1, 0); return rc; } /* * New Tcl Commands */ static int -XOTcl_NSCopyCmds(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTcl_NSCopyCmds(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { Tcl_Command cmd; Tcl_Obj *newFullCmdName, *oldFullCmdName; char *newName, *oldName, *name; @@ -11151,15 +11151,15 @@ Tcl_HashEntry* hPtr; if (objc != 3) - return XOTclObjErrArgCnt(in, NULL, "namespace_copycmds fromNs toNs"); + return XOTclObjErrArgCnt(interp, NULL, "namespace_copycmds fromNs toNs"); - ns = ObjFindNamespace(in, objv[1]); + ns = ObjFindNamespace(interp, objv[1]); if (!ns) return TCL_OK; - newNs = ObjFindNamespace(in, objv[2]); + newNs = ObjFindNamespace(interp, objv[2]); if (!newNs) - return XOTclVarErrMsg(in, "CopyCmds: Destination namespace ", + return XOTclVarErrMsg(interp, "CopyCmds: Destination namespace ", ObjStr(objv[2]), " does not exist", (char *) NULL); /* * copy all procs & commands in the ns @@ -11185,13 +11185,13 @@ * Make sure that the destination command does not already exist. * Otherwise: do not copy */ - cmd = Tcl_FindCommand(in, newName, 0, 0); + cmd = Tcl_FindCommand(interp, newName, 0, 0); if (cmd != NULL) { /*fprintf(stderr, "%s already exists\n", newName);*/ - if (!XOTclpGetObject(in, newName)) { + if (!XOTclpGetObject(interp, newName)) { /* command or instproc will be deleted & then copied */ - Tcl_DeleteCommandFromToken(in, cmd); + Tcl_DeleteCommandFromToken(interp, cmd); } else { /* don't overwrite objects -> will be recreated */ hPtr = Tcl_NextHashEntry(&hSrch); @@ -11205,10 +11205,10 @@ * Find the existing command. An error is returned if simpleName can't * be found */ - cmd = Tcl_FindCommand(in, oldName, 0, 0); + cmd = Tcl_FindCommand(interp, oldName, 0, 0); if (cmd == NULL) { - Tcl_AppendStringsToObj(Tcl_GetObjResult(in), "can't copy ", " \"", + Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "can't copy ", " \"", oldName, "\": command doesn't exist", (char *) NULL); DECR_REF_COUNT(newFullCmdName); @@ -11218,9 +11218,9 @@ /* * Do not copy Objects or Classes */ - if (!XOTclpGetObject(in, oldName)) { + if (!XOTclpGetObject(interp, oldName)) { if (TclIsProc((Command*)cmd)) { - Proc *procPtr = TclFindProc((Interp *)in, oldName); + Proc *procPtr = TclFindProc((Interp *)interp, oldName); Tcl_Obj *arglistObj; CompiledLocal *localPtr; @@ -11238,23 +11238,23 @@ Tcl_Obj *defVal, *defStringObj = Tcl_NewStringObj(localPtr->name, -1); INCR_REF_COUNT(defStringObj); /* check for default values */ - if ((GetProcDefault(in, cmdTable, name, + if ((GetProcDefault(interp, cmdTable, name, localPtr->name, &defVal) == TCL_OK) && (defVal != 0)) { Tcl_AppendStringsToObj(defStringObj, " ", ObjStr(defVal), (char *) NULL); } - Tcl_ListObjAppendElement(in, arglistObj, defStringObj); + Tcl_ListObjAppendElement(interp, arglistObj, defStringObj); DECR_REF_COUNT(defStringObj); } } - if (Tcl_Command_objProc(cmd) == RUNTIME_STATE(in)->objInterpProc) { + if (Tcl_Command_objProc(cmd) == RUNTIME_STATE(interp)->objInterpProc) { Tcl_DString ds, *dsPtr = &ds; if (isClassName(ns->fullName)) { /* it started with ::xotcl::classes */ - XOTclClass *cl = XOTclpGetClass(in, NSCutXOTclClasses(ns->fullName)); + XOTclClass *cl = XOTclpGetClass(interp, NSCutXOTclClasses(ns->fullName)); XOTclProcAssertion* procs; if (cl) { @@ -11264,7 +11264,7 @@ DECR_REF_COUNT(newFullCmdName); DECR_REF_COUNT(oldFullCmdName); DECR_REF_COUNT(arglistObj); - return XOTclVarErrMsg(in, "No class for inst - assertions", (char *) NULL); + return XOTclVarErrMsg(interp, "No class for inst - assertions", (char *) NULL); } /* XOTcl InstProc */ @@ -11276,12 +11276,12 @@ Tcl_DStringAppendElement(dsPtr, StripBodyPrefix(ObjStr(procPtr->bodyPtr))); if (procs) { XOTclRequireClassOpt(cl); - AssertionAppendPrePost(in, dsPtr, procs); + AssertionAppendPrePost(interp, dsPtr, procs); } - Tcl_EvalEx(in, Tcl_DStringValue(dsPtr), Tcl_DStringLength(dsPtr),0); + Tcl_EvalEx(interp, Tcl_DStringValue(dsPtr), Tcl_DStringLength(dsPtr),0); DSTRING_FREE(dsPtr); } else { - XOTclObject *obj = XOTclpGetObject(in, ns->fullName); + XOTclObject *obj = XOTclpGetObject(interp, ns->fullName); XOTclProcAssertion* procs; if (obj) { procs = obj->opt ? @@ -11290,7 +11290,7 @@ DECR_REF_COUNT(newFullCmdName); DECR_REF_COUNT(oldFullCmdName); DECR_REF_COUNT(arglistObj); - return XOTclVarErrMsg(in, "No object for assertions", (char *) NULL); + return XOTclVarErrMsg(interp, "No object for assertions", (char *) NULL); } /* XOTcl Proc */ @@ -11302,15 +11302,15 @@ Tcl_DStringAppendElement(dsPtr, StripBodyPrefix(ObjStr(procPtr->bodyPtr))); if (procs) { XOTclRequireObjectOpt(obj); - AssertionAppendPrePost(in, dsPtr, procs); + AssertionAppendPrePost(interp, dsPtr, procs); } - Tcl_EvalEx(in, Tcl_DStringValue(dsPtr), Tcl_DStringLength(dsPtr),0); + Tcl_EvalEx(interp, Tcl_DStringValue(dsPtr), Tcl_DStringLength(dsPtr),0); DSTRING_FREE(dsPtr); } DECR_REF_COUNT(arglistObj); } else { /* Tcl Proc */ - Tcl_VarEval(in, "proc ", newName, " {", ObjStr(arglistObj),"} {\n", + Tcl_VarEval(interp, "proc ", newName, " {", ObjStr(arglistObj),"} {\n", ObjStr(procPtr->bodyPtr), "}", (char *) NULL); } } else { @@ -11326,13 +11326,13 @@ /* if client data not null, we would have to copy the client data; we don't know its size...., so rely on introspection for copying */ - Tcl_CreateObjCommand(in, newName, objProc, + Tcl_CreateObjCommand(interp, newName, objProc, Tcl_Command_objClientData(cmd), deleteProc); } } else { cd = Tcl_Command_clientData(cmd); if (cd == 0 || cd == XOTCL_NONLEAF_METHOD) { - Tcl_CreateCommand(in, newName, Tcl_Command_proc(cmd), + Tcl_CreateCommand(interp, newName, Tcl_Command_proc(cmd), Tcl_Command_clientData(cmd), deleteProc); } } @@ -11345,7 +11345,7 @@ } static int -XOTcl_NSCopyVars(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTcl_NSCopyVars(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { Tcl_Namespace *ns, *newNs; Var *varPtr = NULL; Tcl_HashSearch hSrch; @@ -11362,29 +11362,29 @@ Tcl_Obj *setObj; if (objc != 3) - return XOTclObjErrArgCnt(in, NULL, "namespace_copyvars fromNs toNs"); + return XOTclObjErrArgCnt(interp, NULL, "namespace_copyvars fromNs toNs"); - ns = ObjFindNamespace(in, objv[1]); + ns = ObjFindNamespace(interp, objv[1]); if (ns) { - newNs = ObjFindNamespace(in, objv[2]); + newNs = ObjFindNamespace(interp, objv[2]); if (!newNs) - return XOTclVarErrMsg(in, "CopyVars: Destination namespace ", + return XOTclVarErrMsg(interp, "CopyVars: Destination namespace ", ObjStr(objv[2]), " does not exist", (char *) NULL); - obj = XOTclpGetObject(in, ObjStr(objv[1])); + obj = XOTclpGetObject(interp, ObjStr(objv[1])); destFullName = newNs->fullName; destFullNameObj = Tcl_NewStringObj(destFullName, -1); INCR_REF_COUNT(destFullNameObj); varTable = Tcl_Namespace_varTable(ns); - Tcl_PushCallFrame(in,(Tcl_CallFrame *)framePtr,newNs,0); + Tcl_PushCallFrame(interp,(Tcl_CallFrame *)framePtr,newNs,0); } else { XOTclObject *newObj; - if (XOTclObjConvertObject(in, objv[1], &obj) != TCL_OK) { - return XOTclVarErrMsg(in, "CopyVars: Origin object/namespace ", + if (XOTclObjConvertObject(interp, objv[1], &obj) != TCL_OK) { + return XOTclVarErrMsg(interp, "CopyVars: Origin object/namespace ", ObjStr(objv[1]), " does not exist", (char *) NULL); } - if (XOTclObjConvertObject(in, objv[2], &newObj) != TCL_OK) { - return XOTclVarErrMsg(in, "CopyVars: Destination object/namespace ", + if (XOTclObjConvertObject(interp, objv[2], &newObj) != TCL_OK) { + return XOTclVarErrMsg(interp, "CopyVars: Destination object/namespace ", ObjStr(objv[2]), " does not exist", (char *) NULL); } varTable = obj->varTable; @@ -11414,9 +11414,9 @@ if (obj) { nobjv[2] = varNameObj; nobjv[3] = valueOfVar(Tcl_Obj,varPtr,objPtr); - rc = Tcl_EvalObjv(in, nobjc, nobjv, 0); + rc = Tcl_EvalObjv(interp, nobjc, nobjv, 0); } else { - Tcl_ObjSetVar2(in, varNameObj, NULL, + Tcl_ObjSetVar2(interp, varNameObj, NULL, valueOfVar(Tcl_Obj,varPtr,objPtr), TCL_NAMESPACE_ONLY); } @@ -11444,10 +11444,10 @@ nobjv[2] = fullVarNameObj; nobjv[3] = valueOfVar(Tcl_Obj,eltVar,objPtr); - rc = Tcl_EvalObjv(in, nobjc, nobjv, 0); + rc = Tcl_EvalObjv(interp, nobjc, nobjv, 0); DECR_REF_COUNT(fullVarNameObj); } else { - Tcl_ObjSetVar2(in, varNameObj, eltNameObj, + Tcl_ObjSetVar2(interp, varNameObj, eltNameObj, valueOfVar(Tcl_Obj,eltVar,objPtr), TCL_NAMESPACE_ONLY); } @@ -11462,53 +11462,53 @@ } if (ns) { DECR_REF_COUNT(destFullNameObj); - Tcl_PopCallFrame(in); + Tcl_PopCallFrame(interp); } DECR_REF_COUNT(setObj); return rc; } int -XOTclSelfDispatchCmd(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTclSelfDispatchCmd(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { XOTclObject *self; int result; - if (objc < 2) return XOTclObjErrArgCnt(in, objv[0], "::xotcl::my method ?args?"); - if ((self = GetSelfObj(in))) { - result = callMethod((ClientData)self, in, objv[1], objc, objv+2, 0); + if (objc < 2) return XOTclObjErrArgCnt(interp, objv[0], "::xotcl::my method ?args?"); + if ((self = GetSelfObj(interp))) { + result = callMethod((ClientData)self, interp, objv[1], objc, objv+2, 0); } else { - result = XOTclVarErrMsg(in, "Cannot resolve 'self', probably called outside the context of an XOTcl Object", + result = XOTclVarErrMsg(interp, "Cannot resolve 'self', probably called outside the context of an XOTcl Object", (char *) NULL); } return result; } int -XOTclInitProcNSCmd(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { - Tcl_CallFrame *varFramePtr = (Tcl_CallFrame *) Tcl_Interp_varFramePtr(in); +XOTclInitProcNSCmd(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { + Tcl_CallFrame *varFramePtr = (Tcl_CallFrame *) Tcl_Interp_varFramePtr(interp); - /*RUNTIME_STATE(in)->varFramePtr = varFramePtr;*/ + /*RUNTIME_STATE(interp)->varFramePtr = varFramePtr;*/ #if 0 - Tcl_Namespace *nsPtr = Tcl_Command_nsPtr(RUNTIME_STATE(in)->cs.top->cmdPtr); + Tcl_Namespace *nsPtr = Tcl_Command_nsPtr(RUNTIME_STATE(interp)->cs.top->cmdPtr); fprintf(stderr,"initProcNS self=%s cmd=%p, '%s'\n", - ObjStr(RUNTIME_STATE(in)->cs.top->self->cmdName), + ObjStr(RUNTIME_STATE(interp)->cs.top->self->cmdName), nsPtr, nsPtr->fullName); fprintf(stderr,"\tsetting currentFramePtr in %p to %p in initProcNS\n", - RUNTIME_STATE(in)->cs.top->currentFramePtr, varFramePtr); - XOTclCallStackDump(in); + RUNTIME_STATE(interp)->cs.top->currentFramePtr, varFramePtr); + XOTclCallStackDump(interp); #endif - if (RUNTIME_STATE(in)->cs.top->currentFramePtr == 0) { - RUNTIME_STATE(in)->cs.top->currentFramePtr = varFramePtr; + if (RUNTIME_STATE(interp)->cs.top->currentFramePtr == 0) { + RUNTIME_STATE(interp)->cs.top->currentFramePtr = varFramePtr; } /* else { fprintf(stderr,"not overwriting currentFramePtr in %p from %p to %p\n", - RUNTIME_STATE(in)->cs.top, - RUNTIME_STATE(in)->cs.top->currentFramePtr, varFramePtr); + RUNTIME_STATE(interp)->cs.top, + RUNTIME_STATE(interp)->cs.top->currentFramePtr, varFramePtr); } */ #if !defined(NAMESPACEINSTPROCS) if (varFramePtr) { - varFramePtr->nsPtr = GetCallerVarFrame(in,varFramePtr); + varFramePtr->nsPtr = GetCallerVarFrame(interp,varFramePtr); } #endif return TCL_OK; @@ -11518,15 +11518,15 @@ * Interpretation of Non-Positional Args */ int -isNonposArg(Tcl_Interp *in, char * argStr, +isNonposArg(Tcl_Interp *interp, char * argStr, int nonposArgsDefc, Tcl_Obj **nonposArgsDefv, Tcl_Obj **var, char **type) { int i, npac; Tcl_Obj **npav; char *varName; if (argStr[0] == '-') { for (i=0; i < nonposArgsDefc; i++) { - if (Tcl_ListObjGetElements(in, nonposArgsDefv[i], + if (Tcl_ListObjGetElements(interp, nonposArgsDefv[i], &npac, &npav) == TCL_OK && npac > 0) { varName = argStr+1; if (!strcmp(varName, ObjStr(npav[0]))) { @@ -11541,7 +11541,7 @@ } int -XOTclCheckBooleanArgs(ClientData cd, Tcl_Interp *in, int objc, +XOTclCheckBooleanArgs(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { int result, bool; Tcl_Obj* boolean; @@ -11551,41 +11551,41 @@ whether it is boolean or not */ return TCL_OK; } else if (objc != 3) { - return XOTclObjErrArgCnt(in, NULL, + return XOTclObjErrArgCnt(interp, NULL, "::xotcl::nonposArgs boolean name ?value?"); } boolean = Tcl_DuplicateObj(objv[2]); INCR_REF_COUNT(boolean); - result = Tcl_GetBooleanFromObj(in, boolean, &bool); + result = Tcl_GetBooleanFromObj(interp, boolean, &bool); DECR_REF_COUNT(boolean); /* result = TCL_OK; */ if (result != TCL_OK) - return XOTclVarErrMsg(in, + return XOTclVarErrMsg(interp, "non-positional argument: '", ObjStr(objv[1]), "' with value '", ObjStr(objv[2]), "' is not of type boolean", (char *) NULL); return TCL_OK; } int -XOTclCheckRequiredArgs(ClientData cd, Tcl_Interp *in, int objc, +XOTclCheckRequiredArgs(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { if (objc != 2 && objc != 3) - return XOTclObjErrArgCnt(in, NULL, + return XOTclObjErrArgCnt(interp, NULL, "::xotcl::nonposArgs required ?currentValue?"); if (objc != 3) - return XOTclVarErrMsg(in, + return XOTclVarErrMsg(interp, "required arg: '", ObjStr(objv[1]), "' missing", (char *) NULL); return TCL_OK; } int -XOTclInterpretNonpositionalArgsCmd(ClientData cd, Tcl_Interp *in, int objc, +XOTclInterpretNonpositionalArgsCmd(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { Tcl_Obj **npav, **checkv, **checkArgv, **argsv, **nonposArgsDefv, *invocation[4], **ordinaryArgsDefv, **defaultValueObjv, *list, @@ -11597,56 +11597,56 @@ int endOfNonposArgsReached = 0; Var *varPtr; - XOTclClass* selfClass = GetSelfClass(in); - char *methodName = (char *) GetSelfProc(in); + XOTclClass* selfClass = GetSelfClass(interp); + char *methodName = (char *) GetSelfProc(interp); Tcl_HashTable* nonposArgsTable; XOTclNonposArgs* nonposArgs; XOTclObject* selfObj; int r1, r2, r3, r4; if (objc != 2) - return XOTclObjErrArgCnt(in, NULL, + return XOTclObjErrArgCnt(interp, NULL, "::xotcl::interpretNonpositionalArgs "); if (selfClass) { nonposArgsTable = selfClass->nonposArgsTable; - } else if ((selfObj = GetSelfObj(in))) { + } else if ((selfObj = GetSelfObj(interp))) { nonposArgsTable = selfObj->nonposArgsTable; } else { - return XOTclVarErrMsg(in, "Non positional args: can't find self/self class", + return XOTclVarErrMsg(interp, "Non positional args: can't find self/self class", (char *) NULL); } nonposArgs = NonposArgsGet(nonposArgsTable, methodName); if (nonposArgs == 0) { - return XOTclVarErrMsg(in, + return XOTclVarErrMsg(interp, "Non positional args: can't find hash entry for: ", methodName, (char *) NULL); } - r1 = Tcl_ListObjGetElements(in, nonposArgs->nonposArgs, + r1 = Tcl_ListObjGetElements(interp, nonposArgs->nonposArgs, &nonposArgsDefc, &nonposArgsDefv); - r2 = Tcl_ListObjGetElements(in, nonposArgs->ordinaryArgs, + r2 = Tcl_ListObjGetElements(interp, nonposArgs->ordinaryArgs, &ordinaryArgsDefc, &ordinaryArgsDefv); - r3 = Tcl_ListObjGetElements(in, objv[1], &argsc, &argsv); + r3 = Tcl_ListObjGetElements(interp, objv[1], &argsc, &argsv); if (r1 != TCL_OK || r2 != TCL_OK || r3 != TCL_OK) { - return XOTclVarErrMsg(in, + return XOTclVarErrMsg(interp, "Cannot split non positional args list: ", methodName, (char *) NULL); } /* setting variables to default values */ for (i=0; i < nonposArgsDefc; i++) { - r1 = Tcl_ListObjGetElements(in, nonposArgsDefv[i], &npac, &npav); + r1 = Tcl_ListObjGetElements(interp, nonposArgsDefv[i], &npac, &npav); if (r1 == TCL_OK) { if (npac == 3) { - Tcl_SetVar2Ex(in, ObjStr(npav[0]), NULL, npav[2], 0); + Tcl_SetVar2Ex(interp, ObjStr(npav[0]), NULL, npav[2], 0); } else if (npac == 2 && !strcmp(ObjStr(npav[1]), "switch")) { - Tcl_SetVar2Ex(in, ObjStr(npav[0]), NULL, Tcl_NewBooleanObj(0), 0); + Tcl_SetVar2Ex(interp, ObjStr(npav[0]), NULL, Tcl_NewBooleanObj(0), 0); } } } @@ -11670,21 +11670,21 @@ endOfNonposArgsReached = 1; i++; } - if (isNonposArg(in, argStr, nonposArgsDefc, nonposArgsDefv, &var,&type)) { + if (isNonposArg(interp, argStr, nonposArgsDefc, nonposArgsDefv, &var,&type)) { if (*type == 's' && !strcmp(type, "switch")) { int bool; - Tcl_Obj *boolObj = Tcl_ObjGetVar2(in, var, 0, 0); - if (Tcl_GetBooleanFromObj(in, boolObj, &bool) != TCL_OK) { - return XOTclVarErrMsg(in, "Non positional arg '",argStr, + Tcl_Obj *boolObj = Tcl_ObjGetVar2(interp, var, 0, 0); + if (Tcl_GetBooleanFromObj(interp, boolObj, &bool) != TCL_OK) { + return XOTclVarErrMsg(interp, "Non positional arg '",argStr, "': no boolean value", (char *) NULL); } - Tcl_ObjSetVar2(in, var, NULL, Tcl_NewBooleanObj(!bool), 0); + Tcl_ObjSetVar2(interp, var, NULL, Tcl_NewBooleanObj(!bool), 0); } else { i++; if (i >= argsc) - return XOTclVarErrMsg(in, "Non positional arg '", + return XOTclVarErrMsg(interp, "Non positional arg '", argStr, "': value missing", (char *) NULL); - Tcl_ObjSetVar2(in, var, NULL, argsv[i], 0); + Tcl_ObjSetVar2(interp, var, NULL, argsv[i], 0); } } else { endOfNonposArgsReached = 1; @@ -11693,8 +11693,8 @@ if (endOfNonposArgsReached && i < argsc) { if (ordinaryArgsCounter >= ordinaryArgsDefc) { - Tcl_Obj *tmp = NonposArgsFormat(in, nonposArgs->nonposArgs); - XOTclVarErrMsg(in, "unknown argument '", + Tcl_Obj *tmp = NonposArgsFormat(interp, nonposArgs->nonposArgs); + XOTclVarErrMsg(interp, "unknown argument '", ObjStr(argsv[i]), "' for method '", methodName, @@ -11712,19 +11712,19 @@ list = Tcl_NewListObj(0, NULL); INCR_REF_COUNT(list); for(; i < argsc; i++) - Tcl_ListObjAppendElement(in, list, argsv[i]); - Tcl_ObjSetVar2(in, ordinaryArgsDefv[ordinaryArgsCounter], NULL, list, 0); + Tcl_ListObjAppendElement(interp, list, argsv[i]); + Tcl_ObjSetVar2(interp, ordinaryArgsDefv[ordinaryArgsCounter], NULL, list, 0); DECR_REF_COUNT(list); } else { /* break down this argument, if it has a default value, use only the first part */ ordinaryArg = ordinaryArgsDefv[ordinaryArgsCounter]; - r4 = Tcl_ListObjGetElements(in, ordinaryArg, + r4 = Tcl_ListObjGetElements(interp, ordinaryArg, &defaultValueObjc, &defaultValueObjv); if (r4 == TCL_OK && defaultValueObjc == 2) { ordinaryArg = defaultValueObjv[0]; } - Tcl_ObjSetVar2(in, ordinaryArg, NULL, argsv[i], 0); + Tcl_ObjSetVar2(interp, ordinaryArg, NULL, argsv[i], 0); } ordinaryArgsCounter++; } @@ -11742,16 +11742,16 @@ while (ordinaryArgsCounter != ordinaryArgsDefc) { if (argsDefined && ordinaryArgsCounter+1 == ordinaryArgsDefc) break; - r4 = Tcl_ListObjGetElements(in, ordinaryArgsDefv[ordinaryArgsCounter], + r4 = Tcl_ListObjGetElements(interp, ordinaryArgsDefv[ordinaryArgsCounter], &defaultValueObjc, &defaultValueObjv); /*fprintf(stderr,"... try to get default for '%s', rc %d, objc %d\n", ObjStr(ordinaryArgsDefv[ordinaryArgsCounter]), r4,defaultValueObjc);*/ if (r4 == TCL_OK && defaultValueObjc == 2) { - Tcl_ObjSetVar2(in, defaultValueObjv[0], NULL, defaultValueObjv[1], 0); + Tcl_ObjSetVar2(interp, defaultValueObjv[0], NULL, defaultValueObjv[1], 0); } else { - Tcl_Obj *tmp = NonposArgsFormat(in, nonposArgs->nonposArgs); - XOTclVarErrMsg(in, "wrong # args for method '", + Tcl_Obj *tmp = NonposArgsFormat(interp, nonposArgs->nonposArgs); + XOTclVarErrMsg(interp, "wrong # args for method '", methodName, "': valid arguments ", ObjStr(tmp), " ", ObjStr(nonposArgs->ordinaryArgs), (char *) NULL); @@ -11761,25 +11761,25 @@ ordinaryArgsCounter++; } if (argsDefined) { - Tcl_SetVar2(in, "args", NULL, "", 0); + Tcl_SetVar2(interp, "args", NULL, "", 0); } } else if (argsDefined && ordinaryArgsCounter == ordinaryArgsDefc-1) { - Tcl_SetVar2(in, "args", NULL, "", 0); + Tcl_SetVar2(interp, "args", NULL, "", 0); } if (!argsDefined) { - Tcl_UnsetVar2(in, "args", NULL, 0); + Tcl_UnsetVar2(interp, "args", NULL, 0); } /* checking vars */ for (i=0; i < nonposArgsDefc; i++) { - r1 = Tcl_ListObjGetElements(in, nonposArgsDefv[i], &npac, &npav); + r1 = Tcl_ListObjGetElements(interp, nonposArgsDefv[i], &npac, &npav); if (r1 == TCL_OK && npac > 1 && *(ObjStr(npav[1])) != '\0') { - r1 = Tcl_ListObjGetElements(in, npav[1], &checkc, &checkv); + r1 = Tcl_ListObjGetElements(interp, npav[1], &checkc, &checkv); if (r1 == TCL_OK) { checkObj = XOTclGlobalObjects[XOTE_NON_POS_ARGS_OBJ]; for (j=0; j < checkc; j++) { - r1 = Tcl_ListObjGetElements(in, checkv[j], &checkArgc, &checkArgv); + r1 = Tcl_ListObjGetElements(interp, checkv[j], &checkArgc, &checkArgv); if (r1 == TCL_OK && checkArgc > 1) { if (isCheckObjString((ObjStr(checkArgv[0]))) && checkArgc == 2) { checkObj = checkArgv[1]; @@ -11788,18 +11788,18 @@ } invocation[0] = checkObj; invocation[1] = checkv[j]; - varPtr = TclVarTraceExists(in, ObjStr(npav[0])); + varPtr = TclVarTraceExists(interp, ObjStr(npav[0])); invocation[2] = npav[0]; ic = 3; if ((varPtr != NULL) && !TclIsVarUndefined(varPtr)) { - invocation[3] = Tcl_ObjGetVar2(in, npav[0], 0, 0); + invocation[3] = Tcl_ObjGetVar2(interp, npav[0], 0, 0); ic = 4; } - result = Tcl_EvalObjv(in, ic, invocation, 0); + result = Tcl_EvalObjv(interp, ic, invocation, 0); /* objPtr = Tcl_ConcatObj(ic, invocation); fprintf(stderr,"eval on <%s>\n",ObjStr(objPtr)); - result = Tcl_EvalObjEx(in, objPtr, TCL_EVAL_DIRECT); + result = Tcl_EvalObjEx(interp, objPtr, TCL_EVAL_DIRECT); */ if (result != TCL_OK) { return result; @@ -11814,27 +11814,27 @@ /* create a slave interp that calls XOTcl Init */ static int -XOTcl_InterpObjCmd(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTcl_InterpObjCmd(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { Tcl_Interp *slave; char *subCmd; ALLOC_ON_STACK(Tcl_Obj*,objc, ov); memcpy(ov, objv, sizeof(Tcl_Obj *)*objc); if (objc < 1) { - XOTclObjErrArgCnt(in, NULL, "::xotcl::interp name ?args?"); + XOTclObjErrArgCnt(interp, NULL, "::xotcl::interp name ?args?"); goto interp_error; } ov[0] = XOTclGlobalObjects[XOTE_INTERP]; - if (Tcl_EvalObjv(in, objc, ov, TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG) != TCL_OK) { + if (Tcl_EvalObjv(interp, objc, ov, TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG) != TCL_OK) { goto interp_error; } subCmd = ObjStr(ov[1]); if (isCreateString(subCmd)) { - slave = Tcl_GetSlave(in, ObjStr(ov[2])); + slave = Tcl_GetSlave(interp, ObjStr(ov[2])); if (!slave) { - XOTclVarErrMsg(in, "Creation of slave interpreter failed", (char *) NULL); + XOTclVarErrMsg(interp, "Creation of slave interpreter failed", (char *) NULL); goto interp_error; } if (Xotcl_Init(slave) == TCL_ERROR) { @@ -11852,25 +11852,25 @@ } extern Tcl_Obj* -XOTclOGetInstVar2(XOTcl_Object *obj, Tcl_Interp *in, Tcl_Obj *name1, Tcl_Obj *name2, +XOTclOGetInstVar2(XOTcl_Object *obj, Tcl_Interp *interp, Tcl_Obj *name1, Tcl_Obj *name2, int flgs) { Tcl_Obj *result; XOTcl_FrameDecls; - XOTcl_PushFrame(in, (XOTclObject*)obj); + XOTcl_PushFrame(interp, (XOTclObject*)obj); if (((XOTclObject*)obj)->nsPtr) flgs |= TCL_NAMESPACE_ONLY; - result = Tcl_ObjGetVar2(in, name1, name2, flgs); - XOTcl_PopFrame(in, (XOTclObject*)obj); + result = Tcl_ObjGetVar2(interp, name1, name2, flgs); + XOTcl_PopFrame(interp, (XOTclObject*)obj); return result; } #if !defined(NDEBUG) static void -checkAllInstances(Tcl_Interp *in, XOTclClass *cl, int lvl) { +checkAllInstances(Tcl_Interp *interp, XOTclClass *cl, int lvl) { Tcl_HashSearch search; Tcl_HashEntry *hPtr; if (cl && cl->object.refCount>0) { @@ -11881,8 +11881,8 @@ assert(inst); assert(inst->refCount>0); assert(inst->cmdName->refCount>0); - if (XOTclObjectIsClass(inst) && (XOTclClass*)inst != RUNTIME_STATE(in)->theClass) { - checkAllInstances(in, (XOTclClass*) inst, lvl+1); + if (XOTclObjectIsClass(inst) && (XOTclClass*)inst != RUNTIME_STATE(interp)->theClass) { + checkAllInstances(interp, (XOTclClass*) inst, lvl+1); } } } @@ -11891,8 +11891,9 @@ #ifdef DO_FULL_CLEANUP /* delete global variables and procs */ -static void deleteProcsAndVars(Tcl_Interp *in) { - Tcl_Namespace *ns = Tcl_GetGlobalNamespace(in); +static void +deleteProcsAndVars(Tcl_Interp *interp) { + Tcl_Namespace *ns = Tcl_GetGlobalNamespace(interp); Tcl_HashTable *varTable = ns ? Tcl_Namespace_varTable(ns) : NULL; Tcl_HashTable *cmdTable = ns ? Tcl_Namespace_cmdTable(ns) : NULL; Tcl_HashSearch search; @@ -11907,7 +11908,7 @@ getVarAndNameFromHash(entryPtr, &varPtr, &nameObj); if (!TclIsVarUndefined(varPtr) || TclIsVarNamespaceVar(varPtr)) { /* fprintf(stderr, "unsetting var %s\n", ObjStr(nameObj));*/ - Tcl_UnsetVar2(in, ObjStr(nameObj), (char *)NULL, TCL_GLOBAL_ONLY); + Tcl_UnsetVar2(interp, ObjStr(nameObj), (char *)NULL, TCL_GLOBAL_ONLY); } entryPtr = Tcl_NextHashEntry(&search); } @@ -11916,14 +11917,14 @@ while (entryPtr) { cmd = (Tcl_Command)Tcl_GetHashValue(entryPtr); - if (Tcl_Command_objProc(cmd) == RUNTIME_STATE(in)->objInterpProc) { + if (Tcl_Command_objProc(cmd) == RUNTIME_STATE(interp)->objInterpProc) { char *key = Tcl_GetHashKey(cmdTable, entryPtr); /*fprintf(stderr, "cmdname = %s cmd %p proc %p objProc %p %d\n", key,cmd,Tcl_Command_proc(cmd),Tcl_Command_objProc(cmd), - Tcl_Command_proc(cmd)==RUNTIME_STATE(in)->objInterpProc);*/ + Tcl_Command_proc(cmd)==RUNTIME_STATE(interp)->objInterpProc);*/ - Tcl_DeleteCommandFromToken(in, cmd); + Tcl_DeleteCommandFromToken(interp, cmd); } entryPtr = Tcl_NextHashEntry(&search); } @@ -11944,7 +11945,7 @@ } static int -ObjectHasChildren(Tcl_Interp *in, XOTclObject *obj) { +ObjectHasChildren(Tcl_Interp *interp, XOTclObject *obj) { Tcl_Namespace *ns = obj->nsPtr; int result = 0; @@ -11954,44 +11955,45 @@ Tcl_HashTable *cmdTable = Tcl_Namespace_cmdTable(ns); XOTcl_FrameDecls; - XOTcl_PushFrame(in, obj); + XOTcl_PushFrame(interp, obj); for (hPtr = Tcl_FirstHashEntry(cmdTable, &hSrch); hPtr; hPtr = Tcl_NextHashEntry(&hSrch)) { char *key = Tcl_GetHashKey(cmdTable, hPtr); - if (XOTclpGetObject(in, key)) { + if (XOTclpGetObject(interp, key)) { /*fprintf(stderr,"child = %s\n",key);*/ result = 1; break; } } - XOTcl_PopFrame(in,obj); + XOTcl_PopFrame(interp,obj); } return result; } -static void freeAllXOTclObjectsAndClasses(Tcl_Interp *in, Tcl_HashTable *commandTable) { +static void +freeAllXOTclObjectsAndClasses(Tcl_Interp *interp, Tcl_HashTable *commandTable) { Tcl_HashEntry *hPtr, *hDel; Tcl_HashSearch hSrch; XOTclObject *obj; XOTclClass *thecls, *theobj, *cl; /* fprintf(stderr,"??? freeAllXOTclObjectsAndClasses in %p\n", in); */ - thecls = RUNTIME_STATE(in)->theClass; - theobj = RUNTIME_STATE(in)->theObject; + thecls = RUNTIME_STATE(interp)->theClass; + theobj = RUNTIME_STATE(interp)->theObject; /***** PHYSICAL DESTROY *****/ - RUNTIME_STATE(in)->exitHandlerDestroyRound = XOTCL_EXITHANDLER_ON_PHYSICAL_DESTROY; + RUNTIME_STATE(interp)->exitHandlerDestroyRound = XOTCL_EXITHANDLER_ON_PHYSICAL_DESTROY; while (1) { int deleted = 0; hPtr = Tcl_FirstHashEntry(commandTable, &hSrch); while (hPtr) { char *key = Tcl_GetHashKey(commandTable, hPtr); - obj = XOTclpGetObject(in, key); - if (obj && !XOTclObjectIsClass(obj) && !ObjectHasChildren(in,obj)) { + obj = XOTclpGetObject(interp, key); + if (obj && !XOTclObjectIsClass(obj) && !ObjectHasChildren(interp,obj)) { /* fprintf(stderr," ... delete object %s %p, class=%s\n",key,obj, ObjStr(obj->cl->object.cmdName));*/ - freeUnsetTraceVariable(in, obj); - Tcl_DeleteCommandFromToken(in, obj->id); + freeUnsetTraceVariable(interp, obj); + Tcl_DeleteCommandFromToken(interp, obj->id); hDel = hPtr; deleted++; } else { @@ -12009,18 +12011,18 @@ hPtr = Tcl_FirstHashEntry(commandTable, &hSrch); while (hPtr) { char *key = Tcl_GetHashKey(commandTable, hPtr); - cl = XOTclpGetClass(in, key); + cl = XOTclpGetClass(interp, key); /* fprintf(stderr,"cl key = %s %p\n", key, cl); */ if (cl - && !ObjectHasChildren(in, (XOTclObject*)cl) + && !ObjectHasChildren(interp, (XOTclObject*)cl) && !ClassHasInstances(cl) && !ClassHasSubclasses(cl) - && cl != RUNTIME_STATE(in)->theClass - && cl != RUNTIME_STATE(in)->theObject + && cl != RUNTIME_STATE(interp)->theClass + && cl != RUNTIME_STATE(interp)->theObject ) { /* fprintf(stderr," ... delete class %s %p\n",key,cl); */ - freeUnsetTraceVariable(in, &cl->object); - Tcl_DeleteCommandFromToken(in, cl->object.id); + freeUnsetTraceVariable(interp, &cl->object); + Tcl_DeleteCommandFromToken(interp, cl->object.id); hDel = hPtr; deleted++; } else { @@ -12037,23 +12039,23 @@ } #ifdef DO_FULL_CLEANUP - deleteProcsAndVars(in); + deleteProcsAndVars(interp); #endif - RUNTIME_STATE(in)->callDestroy = 0; + RUNTIME_STATE(interp)->callDestroy = 0; RemoveSuper(thecls, theobj); RemoveInstance((XOTclObject*)thecls, thecls); RemoveInstance((XOTclObject*)theobj, thecls); - Tcl_DeleteCommandFromToken(in, theobj->object.id); - RUNTIME_STATE(in)->theObject = NULL; + Tcl_DeleteCommandFromToken(interp, theobj->object.id); + RUNTIME_STATE(interp)->theObject = NULL; - Tcl_DeleteCommandFromToken(in, thecls->object.id); - RUNTIME_STATE(in)->theClass = NULL; + Tcl_DeleteCommandFromToken(interp, thecls->object.id); + RUNTIME_STATE(interp)->theClass = NULL; - XOTcl_DeleteNamespace(in, RUNTIME_STATE(in)->fakeNS); - XOTcl_DeleteNamespace(in, RUNTIME_STATE(in)->XOTclClassesNS); - XOTcl_DeleteNamespace(in, RUNTIME_STATE(in)->XOTclNS); + XOTcl_DeleteNamespace(interp, RUNTIME_STATE(interp)->fakeNS); + XOTcl_DeleteNamespace(interp, RUNTIME_STATE(interp)->XOTclClassesNS); + XOTcl_DeleteNamespace(interp, RUNTIME_STATE(interp)->XOTclNS); } #endif /* DO_CLEANUP */ @@ -12064,14 +12066,14 @@ */ static void ExitHandler(ClientData cd) { - Tcl_Interp *in = (Tcl_Interp *) cd; + Tcl_Interp *interp = (Tcl_Interp *) cd; XOTclObject *obj; XOTclClass *cl; int result, flags, i; Tcl_HashSearch hSrch; Tcl_HashEntry *hPtr; Tcl_HashTable objTable, *commandTable = &objTable; - XOTclCallStack *cs = &RUNTIME_STATE(in)->cs; + XOTclCallStack *cs = &RUNTIME_STATE(interp)->cs; /* * Don't use exit handler, if the interpreted is destroyed already @@ -12098,34 +12100,34 @@ */ /*fprintf(stderr,"+++ EXIT handler\n"); */ - flags = Tcl_Interp_flags(in); - Tcl_Interp_flags(in) &= ~DELETED; + flags = Tcl_Interp_flags(interp); + Tcl_Interp_flags(interp) &= ~DELETED; #if defined(PROFILE) - XOTclProfilePrintData(in); + XOTclProfilePrintData(interp); #endif /* * evaluate user-defined exit handler */ - result = callMethod((ClientData)RUNTIME_STATE(in)->theObject, in, + result = callMethod((ClientData)RUNTIME_STATE(interp)->theObject, interp, XOTclGlobalObjects[XOTE_EXIT_HANDLER], 2, 0, 0); if (result != TCL_OK) { fprintf(stderr,"User defined exit handler contains errors!\n" "Error in line %d: %s\nExecution interrupted.\n", - in->errorLine, ObjStr(Tcl_GetObjResult(in))); + interp->errorLine, ObjStr(Tcl_GetObjResult(interp))); } /* * Pop any callstack entry that is still alive (e.g. * if "exit" is called and we were jumping out of the * callframe */ while (cs->top > cs->content) - CallStackPop(in); + CallStackPop(interp); while (1) { - Tcl_CallFrame *f = Tcl_Interp_framePtr(in); + Tcl_CallFrame *f = Tcl_Interp_framePtr(interp); if (!f) break; if (Tcl_CallFrame_level(f) == 0) break; - Tcl_PopCallFrame(in); + Tcl_PopCallFrame(interp); } /* deleting in two rounds: @@ -12140,57 +12142,57 @@ Tcl_InitHashTable(commandTable, TCL_STRING_KEYS); MEM_COUNT_ALLOC("Tcl_InitHashTable",commandTable); - getAllInstances(commandTable, RUNTIME_STATE(in)->theClass); + getAllInstances(commandTable, RUNTIME_STATE(interp)->theClass); /***** SOFT DESTROY *****/ - RUNTIME_STATE(in)->exitHandlerDestroyRound = XOTCL_EXITHANDLER_ON_SOFT_DESTROY; + RUNTIME_STATE(interp)->exitHandlerDestroyRound = XOTCL_EXITHANDLER_ON_SOFT_DESTROY; hPtr = Tcl_FirstHashEntry(commandTable, &hSrch); while (hPtr) { char *key = Tcl_GetHashKey(commandTable, hPtr); - obj = XOTclpGetObject(in, key); + obj = XOTclpGetObject(interp, key); /* fprintf(stderr,"key = %s %p %d\n", key, obj, obj && !XOTclObjectIsClass(obj)); */ if (obj && !XOTclObjectIsClass(obj) && !(obj->flags & XOTCL_DESTROY_CALLED)) - callDestroyMethod((ClientData)obj, in, obj, 0); + callDestroyMethod((ClientData)obj, interp, obj, 0); hPtr = Tcl_NextHashEntry(&hSrch); } hPtr = Tcl_FirstHashEntry(commandTable, &hSrch); while (hPtr) { char *key = Tcl_GetHashKey(commandTable, hPtr); - cl = XOTclpGetClass(in, key); + cl = XOTclpGetClass(interp, key); if (cl && !(cl->object.flags & XOTCL_DESTROY_CALLED)) - callDestroyMethod((ClientData)cl, in, (XOTclObject*)cl, 0); + callDestroyMethod((ClientData)cl, interp, (XOTclObject*)cl, 0); hPtr = Tcl_NextHashEntry(&hSrch); } #ifdef DO_CLEANUP - freeAllXOTclObjectsAndClasses(in, commandTable); + freeAllXOTclObjectsAndClasses(interp, commandTable); #endif /* must be before freeing of XOTclGlobalObjects */ - XOTclShadowTclCommands(in, SHADOW_UNLOAD); + XOTclShadowTclCommands(interp, SHADOW_UNLOAD); /* free global objects */ for (i = 0; i < nr_elements(XOTclGlobalStrings); i++) { DECR_REF_COUNT(XOTclGlobalObjects[i]); } - XOTclStringIncrFree(&RUNTIME_STATE(in)->iss); + XOTclStringIncrFree(&RUNTIME_STATE(interp)->iss); FREE(Tcl_Obj**, XOTclGlobalObjects); - FREE(XOTclRuntimeState, RUNTIME_STATE(in)); + FREE(XOTclRuntimeState, RUNTIME_STATE(interp)); MEM_COUNT_FREE("Tcl_InitHashTable",commandTable); Tcl_DeleteHashTable(commandTable); #if defined(TCL_MEM_DEBUG) TclDumpMemoryInfo (stderr); Tcl_DumpActiveMemory ("./xotclActiveMem"); - /* Tcl_GlobalEval(in, "puts {checkmem to checkmemFile}; + /* Tcl_GlobalEval(interp, "puts {checkmem to checkmemFile}; checkmem checkmemFile"); */ #endif MEM_COUNT_DUMP(); - Tcl_Interp_flags(in) = flags; - Tcl_Release((ClientData) in); + Tcl_Interp_flags(interp) = flags; + Tcl_Release((ClientData) interp); } @@ -12241,7 +12243,7 @@ */ extern int -Xotcl_Init(Tcl_Interp *in) { +Xotcl_Init(Tcl_Interp *interp) { XOTclClass *theobj = 0; XOTclClass *thecls = 0; XOTclClass *paramCl = 0; @@ -12254,7 +12256,7 @@ #ifndef PRE81 # ifdef USE_TCL_STUBS - if (Tcl_InitStubs(in, "8.1", 0) == NULL) { + if (Tcl_InitStubs(interp, "8.1", 0) == NULL) { return TCL_ERROR; } # endif @@ -12316,59 +12318,59 @@ */ runtimeState = (ClientData) NEW(XOTclRuntimeState); #if USE_ASSOC_DATA - Tcl_SetAssocData(in, "XOTclRuntimeState", NULL, runtimeState); + Tcl_SetAssocData(interp, "XOTclRuntimeState", NULL, runtimeState); #else - Tcl_Interp_globalNsPtr(in)->clientData = runtimeState; + Tcl_Interp_globalNsPtr(interp)->clientData = runtimeState; #endif /* CallStack initialization */ - memset(RUNTIME_STATE(in), 0, sizeof(XOTclRuntimeState)); - memset(RUNTIME_STATE(in)->cs.content, 0, sizeof(XOTclCallStackContent)); + memset(RUNTIME_STATE(interp), 0, sizeof(XOTclRuntimeState)); + memset(RUNTIME_STATE(interp)->cs.content, 0, sizeof(XOTclCallStackContent)); - RUNTIME_STATE(in)->cs.top = RUNTIME_STATE(in)->cs.content; - RUNTIME_STATE(in)->doFilters = 1; - RUNTIME_STATE(in)->callDestroy = 1; + RUNTIME_STATE(interp)->cs.top = RUNTIME_STATE(interp)->cs.content; + RUNTIME_STATE(interp)->doFilters = 1; + RUNTIME_STATE(interp)->callDestroy = 1; /* create xotcl namespace */ - RUNTIME_STATE(in)->XOTclNS = - Tcl_CreateNamespace(in, "::xotcl", (ClientData)NULL, (Tcl_NamespaceDeleteProc*)NULL); + RUNTIME_STATE(interp)->XOTclNS = + Tcl_CreateNamespace(interp, "::xotcl", (ClientData)NULL, (Tcl_NamespaceDeleteProc*)NULL); - MEM_COUNT_ALLOC("TclNamespace",RUNTIME_STATE(in)->XOTclNS); + MEM_COUNT_ALLOC("TclNamespace",RUNTIME_STATE(interp)->XOTclNS); /* * init an empty, faked proc structure in the RUNTIME state */ - RUNTIME_STATE(in)->fakeProc.iPtr = (Interp *)in; - RUNTIME_STATE(in)->fakeProc.refCount = 1; - RUNTIME_STATE(in)->fakeProc.cmdPtr = NULL; - RUNTIME_STATE(in)->fakeProc.bodyPtr = NULL; - RUNTIME_STATE(in)->fakeProc.numArgs = 0; - RUNTIME_STATE(in)->fakeProc.numCompiledLocals = 0; - RUNTIME_STATE(in)->fakeProc.firstLocalPtr = NULL; - RUNTIME_STATE(in)->fakeProc.lastLocalPtr = NULL; - RUNTIME_STATE(in)->fakeNS = - Tcl_CreateNamespace(in, "::xotcl::fakeNS", (ClientData)NULL, + RUNTIME_STATE(interp)->fakeProc.iPtr = (Interp *)interp; + RUNTIME_STATE(interp)->fakeProc.refCount = 1; + RUNTIME_STATE(interp)->fakeProc.cmdPtr = NULL; + RUNTIME_STATE(interp)->fakeProc.bodyPtr = NULL; + RUNTIME_STATE(interp)->fakeProc.numArgs = 0; + RUNTIME_STATE(interp)->fakeProc.numCompiledLocals = 0; + RUNTIME_STATE(interp)->fakeProc.firstLocalPtr = NULL; + RUNTIME_STATE(interp)->fakeProc.lastLocalPtr = NULL; + RUNTIME_STATE(interp)->fakeNS = + Tcl_CreateNamespace(interp, "::xotcl::fakeNS", (ClientData)NULL, (Tcl_NamespaceDeleteProc*)NULL); - MEM_COUNT_ALLOC("TclNamespace",RUNTIME_STATE(in)->fakeNS); + MEM_COUNT_ALLOC("TclNamespace",RUNTIME_STATE(interp)->fakeNS); /* XOTclClasses in separate Namespace / Objects */ - RUNTIME_STATE(in)->XOTclClassesNS = - Tcl_CreateNamespace(in, "::xotcl::classes", (ClientData)NULL, + RUNTIME_STATE(interp)->XOTclClassesNS = + Tcl_CreateNamespace(interp, "::xotcl::classes", (ClientData)NULL, (Tcl_NamespaceDeleteProc*)NULL); - MEM_COUNT_ALLOC("TclNamespace",RUNTIME_STATE(in)->XOTclClassesNS); + MEM_COUNT_ALLOC("TclNamespace",RUNTIME_STATE(interp)->XOTclClassesNS); /* cache interpreters proc interpretation functions */ - RUNTIME_STATE(in)->objInterpProc = TclGetObjInterpProc(); + RUNTIME_STATE(interp)->objInterpProc = TclGetObjInterpProc(); #if USE_INTERP_PROC - RUNTIME_STATE(in)->interpProc = TclGetInterpProc(); + RUNTIME_STATE(interp)->interpProc = TclGetInterpProc(); #endif - RUNTIME_STATE(in)->exitHandlerDestroyRound = XOTCL_EXITHANDLER_OFF; + RUNTIME_STATE(interp)->exitHandlerDestroyRound = XOTCL_EXITHANDLER_OFF; RegisterObjTypes(); - RegisterExitHandlers((ClientData)in); + RegisterExitHandlers((ClientData)interp); - XOTclStringIncrInit(&RUNTIME_STATE(in)->iss); + XOTclStringIncrInit(&RUNTIME_STATE(interp)->iss); /* initialize global Tcl_Obj*/ XOTclGlobalObjects = NEW_ARRAY(Tcl_Obj*,nr_elements(XOTclGlobalStrings)); @@ -12379,28 +12381,28 @@ } /* create Object and Class, and store them in the RUNTIME STATE */ - theobj = PrimitiveCCreate(in, "::xotcl::Object", 0); - RUNTIME_STATE(in)->theObject = theobj; + theobj = PrimitiveCCreate(interp, "::xotcl::Object", 0); + RUNTIME_STATE(interp)->theObject = theobj; if (!theobj) panic("Cannot create ::xotcl::Object",0); - thecls = PrimitiveCCreate(in, "::xotcl::Class", 0); - RUNTIME_STATE(in)->theClass = thecls; + thecls = PrimitiveCCreate(interp, "::xotcl::Class", 0); + RUNTIME_STATE(interp)->theClass = thecls; if (!thecls) panic("Cannot create ::xotcl::Class",0); theobj->parent = 0; thecls->parent = theobj; - Tcl_Export(in, RUNTIME_STATE(in)->XOTclNS, "Object", 0); - Tcl_Export(in, RUNTIME_STATE(in)->XOTclNS, "Class", 0); - /*Tcl_AddInterpResolvers(in, "XOTcl", XOTclResolveCmd, 0, 0);*/ + Tcl_Export(interp, RUNTIME_STATE(interp)->XOTclNS, "Object", 0); + Tcl_Export(interp, RUNTIME_STATE(interp)->XOTclNS, "Class", 0); + /*Tcl_AddInterpResolvers(interp, "XOTcl", XOTclResolveCmd, 0, 0);*/ #if defined(PROFILE) - XOTclProfileInit(in); + XOTclProfileInit(interp); #endif /* test Object and Class creation */ if (!theobj || !thecls) { - RUNTIME_STATE(in)->callDestroy = 0; + RUNTIME_STATE(interp)->callDestroy = 0; if (thecls) PrimitiveCDestroy((ClientData) thecls); if (theobj) PrimitiveCDestroy((ClientData) theobj); @@ -12409,9 +12411,9 @@ DECR_REF_COUNT(XOTclGlobalObjects[i]); } FREE(Tcl_Obj**, XOTclGlobalObjects); - FREE(XOTclRuntimeState, RUNTIME_STATE(in)); + FREE(XOTclRuntimeState, RUNTIME_STATE(interp)); - return XOTclErrMsg(in, "Object/Class failed", TCL_STATIC); + return XOTclErrMsg(interp, "Object/Class failed", TCL_STATIC); } AddInstance((XOTclObject*)theobj, thecls); @@ -12481,24 +12483,24 @@ DSTRING_INIT(dsPtr); Tcl_DStringAppend(dsPtr,"::xotcl::Object::instcmd", -1); - Tcl_CreateNamespace(in, Tcl_DStringValue(dsPtr), 0, (Tcl_NamespaceDeleteProc*)NULL); + Tcl_CreateNamespace(interp, Tcl_DStringValue(dsPtr), 0, (Tcl_NamespaceDeleteProc*)NULL); Tcl_DStringAppend(dsPtr,"::", 2); namespacelength = Tcl_DStringLength(dsPtr); for (i = 0; i < nr_elements(objInstcmds); i++) { Tcl_DStringAppend(dsPtr, objInstcmds[i].methodName, -1); - Tcl_CreateObjCommand(in, Tcl_DStringValue(dsPtr), objInstcmds[i].proc, 0, 0); + Tcl_CreateObjCommand(interp, Tcl_DStringValue(dsPtr), objInstcmds[i].proc, 0, 0); Tcl_DStringSetLength(dsPtr, namespacelength); } Tcl_DStringSetLength(dsPtr, 0); Tcl_DStringAppend(dsPtr,"::xotcl::Class::instcmd", -1); - Tcl_CreateNamespace(in, Tcl_DStringValue(dsPtr), 0, (Tcl_NamespaceDeleteProc*)NULL); + Tcl_CreateNamespace(interp, Tcl_DStringValue(dsPtr), 0, (Tcl_NamespaceDeleteProc*)NULL); Tcl_DStringAppend(dsPtr,"::", 2); namespacelength = Tcl_DStringLength(dsPtr); for (i = 0; i < nr_elements(classInstcmds); i++) { Tcl_DStringAppend(dsPtr, classInstcmds[i].methodName, -1); - Tcl_CreateObjCommand(in, Tcl_DStringValue(dsPtr), classInstcmds[i].proc, 0, 0); + Tcl_CreateObjCommand(interp, Tcl_DStringValue(dsPtr), classInstcmds[i].proc, 0, 0); Tcl_DStringSetLength(dsPtr, namespacelength); } @@ -12508,7 +12510,7 @@ /* * overwritten tcl objs */ - result = XOTclShadowTclCommands(in, SHADOW_LOAD); + result = XOTclShadowTclCommands(interp, SHADOW_LOAD); if (result != TCL_OK) return result; @@ -12518,37 +12520,37 @@ #ifdef XOTCL_BYTECODE instructions[INST_SELF_DISPATCH].cmdPtr = (Command *) #endif - Tcl_CreateObjCommand(in, "::xotcl::my", XOTclSelfDispatchCmd, 0, 0); + Tcl_CreateObjCommand(interp, "::xotcl::my", XOTclSelfDispatchCmd, 0, 0); #ifdef XOTCL_BYTECODE instructions[INST_NEXT].cmdPtr = (Command *) #endif - Tcl_CreateObjCommand(in, "::xotcl::next", XOTclNextObjCmd, 0, 0); + Tcl_CreateObjCommand(interp, "::xotcl::next", XOTclNextObjCmd, 0, 0); #ifdef XOTCL_BYTECODE instructions[INST_SELF].cmdPtr = (Command *) #endif - Tcl_CreateObjCommand(in, "::xotcl::self", XOTclGetSelfObjCmd, 0, 0); - /*Tcl_CreateObjCommand(in, "::xotcl::K", XOTclKObjCmd, 0, 0);*/ + Tcl_CreateObjCommand(interp, "::xotcl::self", XOTclGetSelfObjCmd, 0, 0); + /*Tcl_CreateObjCommand(interp, "::xotcl::K", XOTclKObjCmd, 0, 0);*/ - Tcl_CreateObjCommand(in, "::xotcl::alias", XOTclAliasCommand, 0, 0); - Tcl_CreateObjCommand(in, "::xotcl::configure", XOTclConfigureCommand, 0, 0); - Tcl_CreateObjCommand(in, "::xotcl::deprecated", XOTcl_DeprecatedCmd, 0, 0); + Tcl_CreateObjCommand(interp, "::xotcl::alias", XOTclAliasCommand, 0, 0); + Tcl_CreateObjCommand(interp, "::xotcl::configure", XOTclConfigureCommand, 0, 0); + Tcl_CreateObjCommand(interp, "::xotcl::deprecated", XOTcl_DeprecatedCmd, 0, 0); #ifdef XOTCL_BYTECODE instructions[INST_INITPROC].cmdPtr = (Command *) #endif - Tcl_CreateObjCommand(in, "::xotcl::initProcNS", XOTclInitProcNSCmd, 0, 0); - Tcl_CreateObjCommand(in, "::xotcl::interpretNonpositionalArgs", + Tcl_CreateObjCommand(interp, "::xotcl::initProcNS", XOTclInitProcNSCmd, 0, 0); + Tcl_CreateObjCommand(interp, "::xotcl::interpretNonpositionalArgs", XOTclInterpretNonpositionalArgsCmd, 0, 0); - Tcl_CreateObjCommand(in, "::xotcl::interp", XOTcl_InterpObjCmd, 0, 0); - Tcl_CreateObjCommand(in, "::xotcl::namespace_copyvars", XOTcl_NSCopyVars, 0, 0); - Tcl_CreateObjCommand(in, "::xotcl::namespace_copycmds", XOTcl_NSCopyCmds, 0, 0); - Tcl_CreateObjCommand(in, "::xotcl::__qualify", XOTclQualifyObjCmd, 0,0); - Tcl_CreateObjCommand(in, "::xotcl::setinstvar", XOTclSetInstvarCommand, 0, 0); - Tcl_CreateObjCommand(in, "::xotcl::setrelation", XOTclSetRelationCommand, 0, 0); - Tcl_CreateObjCommand(in, "::xotcl::trace", XOTcl_TraceObjCmd, 0, 0); + Tcl_CreateObjCommand(interp, "::xotcl::interp", XOTcl_InterpObjCmd, 0, 0); + Tcl_CreateObjCommand(interp, "::xotcl::namespace_copyvars", XOTcl_NSCopyVars, 0, 0); + Tcl_CreateObjCommand(interp, "::xotcl::namespace_copycmds", XOTcl_NSCopyCmds, 0, 0); + Tcl_CreateObjCommand(interp, "::xotcl::__qualify", XOTclQualifyObjCmd, 0,0); + Tcl_CreateObjCommand(interp, "::xotcl::setinstvar", XOTclSetInstvarCommand, 0, 0); + Tcl_CreateObjCommand(interp, "::xotcl::setrelation", XOTclSetRelationCommand, 0, 0); + Tcl_CreateObjCommand(interp, "::xotcl::trace", XOTcl_TraceObjCmd, 0, 0); - Tcl_Export(in, RUNTIME_STATE(in)->XOTclNS, "self", 0); - Tcl_Export(in, RUNTIME_STATE(in)->XOTclNS, "next", 0); - Tcl_Export(in, RUNTIME_STATE(in)->XOTclNS, "my", 0); + Tcl_Export(interp, RUNTIME_STATE(interp)->XOTclNS, "self", 0); + Tcl_Export(interp, RUNTIME_STATE(interp)->XOTclNS, "next", 0); + Tcl_Export(interp, RUNTIME_STATE(interp)->XOTclNS, "my", 0); #ifdef XOTCL_BYTECODE XOTclBytecodeInit(); @@ -12558,38 +12560,38 @@ * Non-Positional Args Object */ - nonposArgsCl = PrimitiveCCreate(in, + nonposArgsCl = PrimitiveCCreate(interp, XOTclGlobalStrings[XOTE_NON_POS_ARGS_CL], thecls); - XOTclAddIMethod(in, (XOTcl_Class*) nonposArgsCl, + XOTclAddIMethod(interp, (XOTcl_Class*) nonposArgsCl, "required", (Tcl_ObjCmdProc*) XOTclCheckRequiredArgs, 0, 0); - XOTclAddIMethod(in, (XOTcl_Class*) nonposArgsCl, + XOTclAddIMethod(interp, (XOTcl_Class*) nonposArgsCl, "switch", (Tcl_ObjCmdProc*) XOTclCheckBooleanArgs, 0, 0); - XOTclAddIMethod(in, (XOTcl_Class*) nonposArgsCl, + XOTclAddIMethod(interp, (XOTcl_Class*) nonposArgsCl, "boolean", (Tcl_ObjCmdProc*) XOTclCheckBooleanArgs, 0, 0); - PrimitiveOCreate(in, XOTclGlobalStrings[XOTE_NON_POS_ARGS_OBJ], + PrimitiveOCreate(interp, XOTclGlobalStrings[XOTE_NON_POS_ARGS_OBJ], nonposArgsCl); /* * Parameter Class */ { XOTclObject *paramObject; - paramCl = PrimitiveCCreate(in, XOTclGlobalStrings[XOTE_PARAM_CL], thecls); + paramCl = PrimitiveCCreate(interp, XOTclGlobalStrings[XOTE_PARAM_CL], thecls); paramObject = ¶mCl->object; - XOTclAddPMethod(in, (XOTcl_Object*) paramObject, + XOTclAddPMethod(interp, (XOTcl_Object*) paramObject, XOTclGlobalStrings[XOTE_SEARCH_DEFAULTS], (Tcl_ObjCmdProc*) ParameterSearchDefaultsMethod, 0, 0); } /* * set runtime version information in Tcl variable */ - Tcl_SetVar(in, "::xotcl::version", XOTCLVERSION, TCL_GLOBAL_ONLY); - Tcl_SetVar(in, "::xotcl::patchlevel", XOTCLPATCHLEVEL, TCL_GLOBAL_ONLY); + Tcl_SetVar(interp, "::xotcl::version", XOTCLVERSION, TCL_GLOBAL_ONLY); + Tcl_SetVar(interp, "::xotcl::patchlevel", XOTCLPATCHLEVEL, TCL_GLOBAL_ONLY); /* * with some methods and library procs in tcl - they could go in a @@ -12601,28 +12603,28 @@ #include "predefined.h" /* fprintf(stderr, "predefined=<<%s>>\n",cmd);*/ - if (Tcl_GlobalEval(in, cmd) != TCL_OK) + if (Tcl_GlobalEval(interp, cmd) != TCL_OK) return TCL_ERROR; } #ifndef AOL_SERVER /* the AOL server uses a different package loading mechanism */ # ifdef COMPILE_XOTCL_STUBS - Tcl_PkgProvideEx(in, "XOTcl", PACKAGE_VERSION, (ClientData) &xotclStubs); + Tcl_PkgProvideEx(interp, "XOTcl", PACKAGE_VERSION, (ClientData) &xotclStubs); # else - Tcl_PkgProvide(in, "XOTcl", PACKAGE_VERSION); + Tcl_PkgProvide(interp, "XOTcl", PACKAGE_VERSION); # endif #endif #if !defined(TCL_THREADS) && !defined(PRE81) - if ((Tcl_GetVar2(in, "tcl_platform", "threaded", TCL_GLOBAL_ONLY) != NULL)) { + if ((Tcl_GetVar2(interp, "tcl_platform", "threaded", TCL_GLOBAL_ONLY) != NULL)) { /* a non threaded XOTcl version is loaded into a threaded environment */ fprintf(stderr, "\n A non threaded XOTCL version is loaded into threaded environment\n Please reconfigure XOTcl with --enable-threads!\n\n\n"); } #endif - Tcl_ResetResult(in); - Tcl_SetIntObj(Tcl_GetObjResult(in), 1); + Tcl_ResetResult(interp); + Tcl_SetIntObj(Tcl_GetObjResult(interp), 1); return TCL_OK; } Index: generic/xotclAccessInt.h =================================================================== diff -u -rc72f9f638677608fab1502cd696c8f2d6b2952f9 -r54346e996575a3c1295e4a36c07fd490e63bc5a6 --- generic/xotclAccessInt.h (.../xotclAccessInt.h) (revision c72f9f638677608fab1502cd696c8f2d6b2952f9) +++ generic/xotclAccessInt.h (.../xotclAccessInt.h) (revision 54346e996575a3c1295e4a36c07fd490e63bc5a6) @@ -1,28 +1,28 @@ -#define Tcl_Interp_numLevels(in) ((Interp *)in)->numLevels -#define Tcl_Interp_framePtr(in) ((Tcl_CallFrame *)((Interp *)in)->framePtr) -#define Tcl_Interp_varFramePtr(in) (((Interp *)in)->varFramePtr) -#define Tcl_Interp_globalNsPtr(in) ((Tcl_Namespace *)((Interp *)in)->globalNsPtr) -#define Tcl_Interp_flags(in) ((Interp *)in)->flags +#define Tcl_Interp_numLevels(interp) ((Interp *)interp)->numLevels +#define Tcl_Interp_framePtr(interp) ((Tcl_CallFrame *)((Interp *)interp)->framePtr) +#define Tcl_Interp_varFramePtr(interp) (((Interp *)interp)->varFramePtr) +#define Tcl_Interp_globalNsPtr(interp) ((Tcl_Namespace *)((Interp *)interp)->globalNsPtr) +#define Tcl_Interp_flags(interp) ((Interp *)interp)->flags #if DISPATCH_TRACE -#define Tcl_Interp_returnCode(in) ((Interp *)in)->returnCode +#define Tcl_Interp_returnCode(interp) ((Interp *)interp)->returnCode #endif -#define Tcl_Interp_threadId(in) ((Interp *)in)->threadId +#define Tcl_Interp_threadId(interp) ((Interp *)interp)->threadId -#define Tcl_CallFrame_callerPtr(cf) ((Tcl_CallFrame*)((CallFrame *)cf)->callerPtr) -#define Tcl_CallFrame_procPtr(cf) ((CallFrame *)cf)->procPtr -#define Tcl_CallFrame_varTablePtr(cf) ((CallFrame *)cf)->varTablePtr -#define Tcl_CallFrame_level(cf) ((CallFrame *)cf)->level +#define Tcl_CallFrame_callerPtr(cf) ((Tcl_CallFrame*)((CallFrame *)cf)->callerPtr) +#define Tcl_CallFrame_procPtr(cf) ((CallFrame *)cf)->procPtr +#define Tcl_CallFrame_varTablePtr(cf) ((CallFrame *)cf)->varTablePtr +#define Tcl_CallFrame_level(cf) ((CallFrame *)cf)->level #define Tcl_CallFrame_isProcCallFrame(cf) ((CallFrame *)cf)->isProcCallFrame #define Tcl_CallFrame_compiledLocals(cf) ((CallFrame *)cf)->compiledLocals -#define Tcl_CallFrame_callerVarPtr(cf) ((Tcl_CallFrame*)((CallFrame *)cf)->callerVarPtr) +#define Tcl_CallFrame_callerVarPtr(cf) ((Tcl_CallFrame*)((CallFrame *)cf)->callerVarPtr) #define Tcl_CallFrame_objc(cf) ((CallFrame *)cf)->objc #define Tcl_CallFrame_objv(cf) ((CallFrame *)cf)->objv -#define Tcl_Namespace_cmdTable(nsPtr) &((Namespace *)nsPtr)->cmdTable -#define Tcl_Namespace_varTable(nsPtr) &((Namespace *)nsPtr)->varTable -#define Tcl_Namespace_childTable(nsPtr) &((Namespace *)nsPtr)->childTable +#define Tcl_Namespace_cmdTable(nsPtr) &((Namespace *)nsPtr)->cmdTable +#define Tcl_Namespace_varTable(nsPtr) &((Namespace *)nsPtr)->varTable +#define Tcl_Namespace_childTable(nsPtr) &((Namespace *)nsPtr)->childTable #define Tcl_Namespace_activationCount(nsPtr) ((Namespace *)nsPtr)->activationCount -#define Tcl_Namespace_deleteProc(nsPtr) ((Namespace *)nsPtr)->deleteProc +#define Tcl_Namespace_deleteProc(nsPtr) ((Namespace *)nsPtr)->deleteProc Index: generic/xotclError.c =================================================================== diff -u -rc72f9f638677608fab1502cd696c8f2d6b2952f9 -r54346e996575a3c1295e4a36c07fd490e63bc5a6 --- generic/xotclError.c (.../xotclError.c) (revision c72f9f638677608fab1502cd696c8f2d6b2952f9) +++ generic/xotclError.c (.../xotclError.c) (revision 54346e996575a3c1295e4a36c07fd490e63bc5a6) @@ -15,8 +15,8 @@ #include "xotclInt.h" int -XOTclErrMsg(Tcl_Interp *in, char *msg, Tcl_FreeProc* type) { - Tcl_SetResult(in, msg, type); +XOTclErrMsg(Tcl_Interp *interp, char *msg, Tcl_FreeProc* type) { + Tcl_SetResult(interp, msg, type); return TCL_ERROR; } @@ -25,24 +25,24 @@ { va_list argList; char *string; - Tcl_Interp *in; + Tcl_Interp *interp; - in = TCL_VARARGS_START(Tcl_Interp *, arg1, argList); - Tcl_ResetResult(in); + interp = TCL_VARARGS_START(Tcl_Interp *, arg1, argList); + Tcl_ResetResult(interp); while (1) { string = va_arg(argList, char *); if (string == NULL) { break; } - Tcl_AppendResult(in, string, (char *) NULL); + Tcl_AppendResult(interp, string, (char *) NULL); } va_end(argList); return TCL_ERROR; } int -XOTclErrInProc (Tcl_Interp *in, Tcl_Obj *objName, +XOTclErrInProc (Tcl_Interp *interp, Tcl_Obj *objName, Tcl_Obj *clName, char *procName) { Tcl_DString errMsg; char *cName, *space; @@ -59,44 +59,44 @@ Tcl_DStringAppend(&errMsg, cName, -1); Tcl_DStringAppend(&errMsg, "->", 2); Tcl_DStringAppend(&errMsg, procName, -1); - Tcl_AddErrorInfo (in, Tcl_DStringValue(&errMsg)); + Tcl_AddErrorInfo (interp, Tcl_DStringValue(&errMsg)); DSTRING_FREE(&errMsg); return TCL_ERROR; } int -XOTclObjErrArgCnt(Tcl_Interp *in, Tcl_Obj *cmdname, char *arglist) { - Tcl_ResetResult(in); - Tcl_AppendResult(in, "wrong # args: should be {", (char *) NULL); +XOTclObjErrArgCnt(Tcl_Interp *interp, Tcl_Obj *cmdname, char *arglist) { + Tcl_ResetResult(interp); + Tcl_AppendResult(interp, "wrong # args: should be {", (char *) NULL); if (cmdname) { - Tcl_AppendResult(in, ObjStr(cmdname), " ", (char *) NULL); + Tcl_AppendResult(interp, ObjStr(cmdname), " ", (char *) NULL); } - if (arglist != 0) Tcl_AppendResult(in, arglist, (char *) NULL); - Tcl_AppendResult(in, "}", (char *) NULL); + if (arglist != 0) Tcl_AppendResult(interp, arglist, (char *) NULL); + Tcl_AppendResult(interp, "}", (char *) NULL); return TCL_ERROR; } int -XOTclErrBadVal(Tcl_Interp *in, char *context, char *expected, char *value) { - Tcl_ResetResult(in); - Tcl_AppendResult(in, context, ": expected ", expected, " but got '", +XOTclErrBadVal(Tcl_Interp *interp, char *context, char *expected, char *value) { + Tcl_ResetResult(interp); + Tcl_AppendResult(interp, context, ": expected ", expected, " but got '", value, "'", (char *) NULL); return TCL_ERROR; } int -XOTclErrBadVal_(Tcl_Interp *in, char *expected, char *value) { +XOTclErrBadVal_(Tcl_Interp *interp, char *expected, char *value) { fprintf(stderr, "Deprecated call, recompile your program with xotcl 1.5 or newer\n"); - Tcl_ResetResult(in); - Tcl_AppendResult(in, ": expected ", expected, " but got '", + Tcl_ResetResult(interp); + Tcl_AppendResult(interp, ": expected ", expected, " but got '", value, "'", (char *) NULL); return TCL_ERROR; } extern int -XOTclObjErrType(Tcl_Interp *in, Tcl_Obj *nm, char *wt) { - Tcl_ResetResult(in); - Tcl_AppendResult(in,"'",ObjStr(nm), "' method should be called on '", +XOTclObjErrType(Tcl_Interp *interp, Tcl_Obj *nm, char *wt) { + Tcl_ResetResult(interp); + Tcl_AppendResult(interp,"'",ObjStr(nm), "' method should be called on '", wt, "'", (char *) NULL); return TCL_ERROR; } Index: generic/xotclInt.h =================================================================== diff -u -rad43de1007d040a9860eac2445a8c7781dcb4d06 -r54346e996575a3c1295e4a36c07fd490e63bc5a6 --- generic/xotclInt.h (.../xotclInt.h) (revision ad43de1007d040a9860eac2445a8c7781dcb4d06) +++ generic/xotclInt.h (.../xotclInt.h) (revision 54346e996575a3c1295e4a36c07fd490e63bc5a6) @@ -57,7 +57,7 @@ Tcl_InitHashTable(&xotclMemCount, TCL_STRING_KEYS); \ xotclMemCountInterpCounter = 1; \ } -# define MEM_COUNT_DUMP() XOTclMemCountDump(in) +# define MEM_COUNT_DUMP() XOTclMemCountDump(interp) # define MEM_COUNT_OPEN_FRAME() /*if (obj->varTable) noTableBefore = 0*/ # define MEM_COUNT_CLOSE_FRAME() @@ -76,9 +76,9 @@ #define DSTRING_FREE(D) Tcl_DStringFree(D); MEM_COUNT_FREE("DString",D) #if USE_ASSOC_DATA -# define RUNTIME_STATE(in) ((XOTclRuntimeState*)Tcl_GetAssocData((in), "XOTclRuntimeState", NULL)) +# define RUNTIME_STATE(interp) ((XOTclRuntimeState*)Tcl_GetAssocData((interp), "XOTclRuntimeState", NULL)) #else -# define RUNTIME_STATE(in) ((XOTclRuntimeState*)((Interp*) in)->globalNsPtr->clientData) +# define RUNTIME_STATE(interp) ((XOTclRuntimeState*)((Interp*)interp)->globalNsPtr->clientData) #endif @@ -252,18 +252,18 @@ #endif #ifdef V81 -# define EvalObj(in,cmd) Tcl_EvalObj(in,cmd,0) +# define EvalObj(interp,cmd) Tcl_EvalObj(interp, cmd, 0) # define TclIsVarArgument(args) (args->isArg) -# define Tcl_ObjSetVar2(in,p1,p2,newval,flags) \ - Tcl_SetObjVar2(in,ObjStr(p1),p2,newval,flags) -#define Tcl_ObjGetVar2(in,name1,name2,flgs) \ - Tcl_GetObjVar2(in, ObjStr(name1), \ +# define Tcl_ObjSetVar2(interp,p1,p2,newval,flags) \ + Tcl_SetObjVar2(interp,ObjStr(p1),p2,newval,flags) +#define Tcl_ObjGetVar2(interp,name1,name2,flgs) \ + Tcl_GetObjVar2(interp, ObjStr(name1), \ ((name2==NULL) ? (char*)NULL : ObjStr(name2)), flgs) #else # if defined(PRE83) -# define EvalObj(in,cmd) Tcl_EvalObj(in,cmd) +# define EvalObj(interp, cmd) Tcl_EvalObj(interp,cmd) # else -# define EvalObj(in,cmd) Tcl_EvalObjEx(in,cmd,0) +# define EvalObj(interp, cmd) Tcl_EvalObjEx(interp,cmd,0) # endif # if defined(PRE81) && TCL_RELEASE_SERIAL<3 # define TclIsVarArgument(args) (args->isArg) @@ -272,23 +272,23 @@ #if 0 #define XOTcl_FrameDecls CallFrame *oldFramePtr = 0, frame, *newFramePtr = &frame -#define XOTcl_PushFrame(in,obj) \ +#define XOTcl_PushFrame(interp, obj) \ memset(newFramePtr, 0, sizeof(CallFrame)); \ - oldFramePtr = ((Interp *)in)->varFramePtr; \ + oldFramePtr = ((Interp *)interp)->varFramePtr; \ if ((obj)->nsPtr) { \ newFramePtr->nsPtr = (Namespace*) (obj)->nsPtr; \ } else { \ - newFramePtr->nsPtr = (Namespace*) RUNTIME_STATE(in)->fakeNS; \ + newFramePtr->nsPtr = (Namespace*) RUNTIME_STATE(interp)->fakeNS; \ newFramePtr->isProcCallFrame = 1; \ - newFramePtr->procPtr = &RUNTIME_STATE(in)->fakeProc; \ + newFramePtr->procPtr = &RUNTIME_STATE(interp)->fakeProc; \ newFramePtr->varTablePtr = (obj)->varTable; \ } \ - ((Interp *)in)->varFramePtr = newFramePtr; \ + ((Interp *)interp)->varFramePtr = newFramePtr; \ MEM_COUNT_OPEN_FRAME() -#define XOTcl_PopFrame(in,obj) \ +#define XOTcl_PopFrame(interp, obj) \ if (!(obj)->nsPtr && (obj)->varTable == 0) \ (obj)->varTable = newFramePtr->varTablePtr; \ - ((Interp *)in)->varFramePtr = oldFramePtr; \ + ((Interp *)interp)->varFramePtr = oldFramePtr; \ MEM_COUNT_CLOSE_FRAME() #else @@ -388,7 +388,7 @@ CHECK_ALL = CHECK_INVAR + CHECK_PRE + CHECK_POST } CheckOptions; -void XOTclAssertionRename(Tcl_Interp* in, Tcl_Command cmd, +void XOTclAssertionRename(Tcl_Interp* interp, Tcl_Command cmd, XOTclAssertionStore *as, char *oldSimpleCmdName, char *newName); /* @@ -565,7 +565,7 @@ }; #endif -#define XOTclGlobalObjects RUNTIME_STATE(in)->methodObjNames +#define XOTclGlobalObjects RUNTIME_STATE(interp)->methodObjNames /* XOTcl ShadowTclCommands */ typedef struct XOTclShadowTclCommandInfo { @@ -574,9 +574,9 @@ } XOTclShadowTclCommandInfo; typedef enum {SHADOW_LOAD=1, SHADOW_UNLOAD=0, SHADOW_REFETCH=2} XOTclShadowOperations; -int XOTclCallCommand(Tcl_Interp* in, XOTclGlobalNames name, +int XOTclCallCommand(Tcl_Interp* interp, XOTclGlobalNames name, int objc, Tcl_Obj *CONST objv[]); -int XOTclShadowTclCommands(Tcl_Interp* in, XOTclShadowOperations load); +int XOTclShadowTclCommands(Tcl_Interp* interp, XOTclShadowOperations load); /* @@ -690,16 +690,16 @@ XOTclProfileFillTable(Tcl_HashTable* table, Tcl_DString* key, double totalMicroSec); extern void -XOTclProfileEvaluateData(Tcl_Interp* in, long int startSec, long int startUsec, +XOTclProfileEvaluateData(Tcl_Interp* interp, long int startSec, long int startUsec, XOTclObject* obj, XOTclClass *cl, char *methodName); extern void XOTclProfilePrintTable(Tcl_HashTable* table); extern void -XOTclProfilePrintData(Tcl_Interp* in); +XOTclProfilePrintData(Tcl_Interp* interp); extern void -XOTclProfileInit(Tcl_Interp* in); +XOTclProfileInit(Tcl_Interp* interp); #endif /* @@ -719,7 +719,7 @@ extern void XOTclMetaDataInit(XOTclObject* obj); extern int -XOTclOMetaDataMethod (ClientData cd, Tcl_Interp* in, +XOTclOMetaDataMethod (ClientData cd, Tcl_Interp* interp, int objc, Tcl_Obj *objv[]); #endif /* XOTCL_METADATA */ @@ -744,19 +744,19 @@ Tcl_ObjCmdProc XOTclInitProcNSCmd, XOTclSelfDispatchCmd, XOTclNextObjCmd, XOTclGetSelfObjCmd; -int XOTclDirectSelfDispatch(ClientData cd, Tcl_Interp* in, +int XOTclDirectSelfDispatch(ClientData cd, Tcl_Interp* interp, int objc, Tcl_Obj *CONST objv[]); #endif int -XOTclObjDispatch(ClientData cd, Tcl_Interp* in, +XOTclObjDispatch(ClientData cd, Tcl_Interp* interp, int objc, Tcl_Obj *CONST objv[]); XOTclCallStackContent * -XOTclCallStackFindActiveFrame(Tcl_Interp* in, int offset); +XOTclCallStackFindActiveFrame(Tcl_Interp* interp, int offset); XOTclCallStackContent * -XOTclCallStackFindLastInvocation(Tcl_Interp* in, int offset); +XOTclCallStackFindLastInvocation(Tcl_Interp* interp, int offset); /* functions from xotclUtil.c */ char *XOTcl_ltoa(char *buf, long i, int *len); Index: generic/xotclMetaData.c =================================================================== diff -u -rc72f9f638677608fab1502cd696c8f2d6b2952f9 -r54346e996575a3c1295e4a36c07fd490e63bc5a6 --- generic/xotclMetaData.c (.../xotclMetaData.c) (revision c72f9f638677608fab1502cd696c8f2d6b2952f9) +++ generic/xotclMetaData.c (.../xotclMetaData.c) (revision 54346e996575a3c1295e4a36c07fd490e63bc5a6) @@ -20,20 +20,20 @@ */ void -XOTclMetaDataRemoveDepending(XOTclClass* cl, char* name) { +XOTclMetaDataRemoveDepending(XOTclClass *cl, char *name) { XOTclClasses *saved = cl->order, *clPtr; cl->order = 0; clPtr = XOTclComputeDependents(cl); while (clPtr != 0) { Tcl_HashSearch hSrch; - Tcl_HashEntry* hPtr = &clPtr->cl->instances ? + Tcl_HashEntry *hPtr = &clPtr->cl->instances ? Tcl_FirstHashEntry(&clPtr->cl->instances, &hSrch) : 0; for (; hPtr != 0; hPtr = Tcl_NextHashEntry(&hSrch)) { - XOTclObject* obj = (XOTclObject*) + XOTclObject *obj = (XOTclObject*) Tcl_GetHashKey(&clPtr->cl->instances, hPtr); - Tcl_HashEntry* h1Ptr = 0; + Tcl_HashEntry *h1Ptr = 0; if (obj->opt) h1Ptr = Tcl_FindHashEntry(&obj->opt->metaData, name); if (h1Ptr) { @@ -48,7 +48,7 @@ } int -XOTclMetaDataInheritance (XOTclObject* obj, char* name) { +XOTclMetaDataInheritance (XOTclObject *obj, char *name) { XOTclClasses *clPtr; assert(obj); @@ -69,28 +69,28 @@ } void -XOTclMetaDataDestroy(XOTclObject* obj) { +XOTclMetaDataDestroy(XOTclObject *obj) { if (obj->opt) Tcl_DeleteHashTable(&obj->opt->metaData); } void -XOTclMetaDataInit(XOTclObject* obj) { +XOTclMetaDataInit(XOTclObject *obj) { XOTclRequireObjectOpt(obj); Tcl_InitHashTable(&obj->opt->metaData, TCL_STRING_KEYS); } int -XOTclOMetaDataMethod (ClientData cd, Tcl_Interp* in, int objc, Tcl_Obj *CONST objv[]) { +XOTclOMetaDataMethod (ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { XOTclObject *obj = (XOTclObject*)cd; XOTclClass *cl = XOTclObjectToClass(cd); - char* option; int add = -1; + char *option; int add = -1; int result = TCL_OK; - int oc; Tcl_Obj** ov; int i; + int oc; Tcl_Obj* *ov; int i; - if (!obj) return XOTclObjErrType(in, obj->cmdName, "Object"); + if (!obj) return XOTclObjErrType(interp, obj->cmdName, "Object"); if (objc < 2) - return XOTclObjErrArgCnt(in,obj->cmdName, + return XOTclObjErrArgCnt(interp,obj->cmdName, "metadata ?(add|remove)? metaDataList"); option = ObjStr(objv[1]); @@ -103,33 +103,33 @@ if (add == -1) { if (objc == 2) { if (obj->opt) { - Tcl_HashEntry* hPtr = Tcl_FindHashEntry(&obj->opt->metaData, option); + Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&obj->opt->metaData, option); if (hPtr) { - Tcl_Obj* entry = (Tcl_Obj *) Tcl_GetHashValue(hPtr); + Tcl_Obj *entry = (Tcl_Obj *) Tcl_GetHashValue(hPtr); if (entry) { - Tcl_SetObjResult(in, (Tcl_Obj *) Tcl_GetHashValue(hPtr)); + Tcl_SetObjResult(interp, (Tcl_Obj *) Tcl_GetHashValue(hPtr)); } else { - Tcl_ResetResult(in); + Tcl_ResetResult(interp); } } return TCL_OK; } } if (objc == 3) { if (obj->opt) { - Tcl_HashEntry* hPtr = Tcl_FindHashEntry(&obj->opt->metaData, option); + Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&obj->opt->metaData, option); if (!hPtr) { int nw; if (XOTclMetaDataInheritance(obj, option)) { hPtr = Tcl_CreateHashEntry(&obj->opt->metaData, option, &nw); if (!nw) - return XOTclVarErrMsg(in, + return XOTclVarErrMsg(interp, "MetaData: Can't create MetaData Entry: ", option, (char*) NULL); } } if (hPtr) { - Tcl_Obj* entry = (Tcl_Obj *) Tcl_GetHashValue(hPtr); + Tcl_Obj *entry = (Tcl_Obj *) Tcl_GetHashValue(hPtr); if (entry) DECR_REF_COUNT(entry); INCR_REF_COUNT(objv[2]); @@ -138,29 +138,29 @@ } } } - return XOTclVarErrMsg(in,"MetaData: Unknown option; given Option: ", + return XOTclVarErrMsg(interp,"MetaData: Unknown option; given Option: ", option, (char*) NULL); } - if (Tcl_ListObjGetElements(in, objv[2], &oc, &ov) == TCL_OK) { + if (Tcl_ListObjGetElements(interp, objv[2], &oc, &ov) == TCL_OK) { for (i = 0; i < oc; i ++) { - char* value = ObjStr (ov[i]); + char *value = ObjStr (ov[i]); if (obj->opt) { if (add) { int nw; - Tcl_HashEntry* hPtr = Tcl_FindHashEntry(&obj->opt->metaData, value); + Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&obj->opt->metaData, value); if (hPtr) - return XOTclVarErrMsg(in, + return XOTclVarErrMsg(interp, "Can't add MetaData, MetaData exists: ", value, (char*) NULL); hPtr = Tcl_CreateHashEntry(&obj->opt->metaData, value, &nw); if (!nw) - return XOTclVarErrMsg(in, + return XOTclVarErrMsg(interp, "MetaData: Can't create MetaData Entry: ", value,(char*) NULL); } else { - Tcl_HashEntry* hPtr = Tcl_FindHashEntry(&obj->opt->metaData, value); + Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&obj->opt->metaData, value); if (hPtr) { Tcl_DeleteHashEntry(hPtr); if (cl) { Index: generic/xotclProfile.c =================================================================== diff -u -rc72f9f638677608fab1502cd696c8f2d6b2952f9 -r54346e996575a3c1295e4a36c07fd490e63bc5a6 --- generic/xotclProfile.c (.../xotclProfile.c) (revision c72f9f638677608fab1502cd696c8f2d6b2952f9) +++ generic/xotclProfile.c (.../xotclProfile.c) (revision 54346e996575a3c1295e4a36c07fd490e63bc5a6) @@ -47,13 +47,13 @@ } void -XOTclProfileEvaluateData(Tcl_Interp* in, long int startSec, long int startUsec, +XOTclProfileEvaluateData(Tcl_Interp* interp, long int startSec, long int startUsec, XOTclObject* obj, XOTclClass *cl, char *methodName) { double totalMicroSec; struct timeval trt; Tcl_DString objectKey, methodKey; - XOTclProfile* profile = &RUNTIME_STATE(in)->profile; + XOTclProfile* profile = &RUNTIME_STATE(interp)->profile; gettimeofday(&trt, NULL); @@ -116,8 +116,8 @@ } void -XOTclProfilePrintData(Tcl_Interp* in) { - XOTclProfile* profile = &RUNTIME_STATE(in)->profile; +XOTclProfilePrintData(Tcl_Interp *interp) { + XOTclProfile* profile = &RUNTIME_STATE(interp)->profile; fprintf(stderr, "------------------------------------------------------------------\n"); fprintf(stderr, "\nXOTcl Profile Information\n\n"); @@ -134,11 +134,11 @@ } void -XOTclProfileInit(Tcl_Interp* in) { - RUNTIME_STATE(in)->profile.overallTime = 0; - Tcl_InitHashTable(&RUNTIME_STATE(in)->profile.objectData, +XOTclProfileInit(Tcl_Interp *interp) { + RUNTIME_STATE(interp)->profile.overallTime = 0; + Tcl_InitHashTable(&RUNTIME_STATE(interp)->profile.objectData, TCL_STRING_KEYS); - Tcl_InitHashTable(&RUNTIME_STATE(in)->profile.methodData, + Tcl_InitHashTable(&RUNTIME_STATE(interp)->profile.methodData, TCL_STRING_KEYS); } Index: generic/xotclShadow.c =================================================================== diff -u -rc72f9f638677608fab1502cd696c8f2d6b2952f9 -r54346e996575a3c1295e4a36c07fd490e63bc5a6 --- generic/xotclShadow.c (.../xotclShadow.c) (revision c72f9f638677608fab1502cd696c8f2d6b2952f9) +++ generic/xotclShadow.c (.../xotclShadow.c) (revision 54346e996575a3c1295e4a36c07fd490e63bc5a6) @@ -16,13 +16,13 @@ #include "xotclAccessInt.h" static int -XOTclReplaceCommandCleanup(Tcl_Interp *in, XOTclGlobalNames name) { +XOTclReplaceCommandCleanup(Tcl_Interp *interp, XOTclGlobalNames name) { Tcl_Command cmd; int result = TCL_OK; - XOTclShadowTclCommandInfo *ti = &RUNTIME_STATE(in)->tclCommands[name-XOTE_EXPR]; + XOTclShadowTclCommandInfo *ti = &RUNTIME_STATE(interp)->tclCommands[name-XOTE_EXPR]; - /*fprintf(stderr," cleanup for %s ti=%p in %p\n", XOTclGlobalStrings[name], ti, in);*/ - cmd = Tcl_GetCommandFromObj(in, XOTclGlobalObjects[name]); + /*fprintf(stderr," cleanup for %s ti=%p in %p\n", XOTclGlobalStrings[name], ti, interp);*/ + cmd = Tcl_GetCommandFromObj(interp, XOTclGlobalObjects[name]); if (cmd != NULL) { Tcl_Command_objProc(cmd) = ti->proc; ti->proc = NULL; @@ -34,10 +34,10 @@ } static void -XOTclReplaceCommandCheck(Tcl_Interp *in, XOTclGlobalNames name, Tcl_ObjCmdProc *proc) { +XOTclReplaceCommandCheck(Tcl_Interp *interp, XOTclGlobalNames name, Tcl_ObjCmdProc *proc) { Tcl_Command cmd; - XOTclShadowTclCommandInfo *ti = &RUNTIME_STATE(in)->tclCommands[name-XOTE_EXPR]; - cmd = Tcl_GetCommandFromObj(in, XOTclGlobalObjects[name]); + XOTclShadowTclCommandInfo *ti = &RUNTIME_STATE(interp)->tclCommands[name-XOTE_EXPR]; + cmd = Tcl_GetCommandFromObj(interp, XOTclGlobalObjects[name]); if (cmd != NULL && ti->proc && Tcl_Command_objProc(cmd) != proc) { /* @@ -51,14 +51,14 @@ } static int -XOTclReplaceCommand(Tcl_Interp *in, XOTclGlobalNames name, +XOTclReplaceCommand(Tcl_Interp *interp, XOTclGlobalNames name, Tcl_ObjCmdProc *xotclReplacementProc, int pass) { Tcl_Command cmd; - XOTclShadowTclCommandInfo *ti = &RUNTIME_STATE(in)->tclCommands[name-XOTE_EXPR]; + XOTclShadowTclCommandInfo *ti = &RUNTIME_STATE(interp)->tclCommands[name-XOTE_EXPR]; int result = TCL_OK; /*fprintf(stderr,"XOTclReplaceCommand %d\n",name);*/ - cmd = Tcl_GetCommandFromObj(in, XOTclGlobalObjects[name]); + cmd = Tcl_GetCommandFromObj(interp, XOTclGlobalObjects[name]); if (cmd == NULL) { result = TCL_ERROR; @@ -75,54 +75,54 @@ } if (xotclReplacementProc) { Tcl_Command_objProc(cmd) = xotclReplacementProc; - /*Tcl_CreateObjCommand(in, XOTclGlobalStrings[name], xotclReplacementProc, 0, 0);*/ + /*Tcl_CreateObjCommand(interp, XOTclGlobalStrings[name], xotclReplacementProc, 0, 0);*/ } } } return result; } static int -XOTcl_RenameObjCmd(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTcl_RenameObjCmd(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { /* this call the Tcl_RenameObjCmd, but it ensures before that the renamed obj, functions, etc. are not part of XOTcl */ XOTclObject *obj = NULL; Tcl_Command cmd; /* wrong # args => normal Tcl ErrMsg*/ if (objc != 3) - return XOTclCallCommand(in, XOTE_RENAME, objc, objv); + return XOTclCallCommand(interp, XOTE_RENAME, objc, objv); /* if an obj/cl should be renamed => call the XOTcl move method */ - cmd = Tcl_FindCommand(in, ObjStr(objv[1]), (Tcl_Namespace *)NULL,0); + cmd = Tcl_FindCommand(interp, ObjStr(objv[1]), (Tcl_Namespace *)NULL,0); if (cmd != NULL) { obj = XOTclGetObjectFromCmdPtr(cmd); if (obj) { - return XOTclCallMethodWithArgs((ClientData)obj, in, + return XOTclCallMethodWithArgs((ClientData)obj, interp, XOTclGlobalObjects[XOTE_MOVE], objv[2], 1, 0, 0); } } /* Actually rename the cmd using Tcl's rename*/ - return XOTclCallCommand(in, XOTE_RENAME, objc, objv); + return XOTclCallCommand(interp, XOTE_RENAME, objc, objv); } static int -XOTcl_InfoObjCmd(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTcl_InfoObjCmd(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { int result, isBody = 0; if (objc > 1) { char *opt = ObjStr(objv[1]); if (isBodyString(opt) && objc > 2) isBody = 1; } - result = XOTclCallCommand(in, XOTE_INFO, objc, objv); + result = XOTclCallCommand(interp, XOTE_INFO, objc, objv); if (isBody && result == TCL_OK) { - char *body = ObjStr(Tcl_GetObjResult(in)); + char *body = ObjStr(Tcl_GetObjResult(interp)); if (strncmp(body, "::xotcl::initProcNS\n",20) == 0) body += 20; - Tcl_SetObjResult(in, Tcl_NewStringObj(body, -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(body, -1)); } return result; } @@ -133,12 +133,12 @@ * not available through the stub interface and overload some global commands */ int -XOTclShadowTclCommands(Tcl_Interp *in, XOTclShadowOperations load) { +XOTclShadowTclCommands(Tcl_Interp *interp, XOTclShadowOperations load) { int rc = TCL_OK; if (load == SHADOW_LOAD) { - int initialized = (RUNTIME_STATE(in)->tclCommands != NULL); + int initialized = (RUNTIME_STATE(interp)->tclCommands != NULL); assert(initialized == 0); - RUNTIME_STATE(in)->tclCommands = + RUNTIME_STATE(interp)->tclCommands = NEW_ARRAY(XOTclShadowTclCommandInfo, XOTE_SUBST - XOTE_EXPR + 1); /*fprintf(stderr, "+++ load tcl commands %d %d\n", load, initialized);*/ @@ -147,23 +147,23 @@ /* no commands are overloaded, these are only used for calling e.g. Tcl_ExprObjCmd(), Tcl_IncrObjCmd() and Tcl_SubstObjCmd(), which are not avalailable in through the stub table */ - rc|= XOTclReplaceCommand(in, XOTE_EXPR, 0, initialized); - rc|= XOTclReplaceCommand(in, XOTE_SUBST, 0, initialized); + rc|= XOTclReplaceCommand(interp, XOTE_EXPR, 0, initialized); + rc|= XOTclReplaceCommand(interp, XOTE_SUBST, 0, initialized); #endif /* for the following commands, we have to add our own semantics */ #if 1 - rc|= XOTclReplaceCommand(in, XOTE_INFO, XOTcl_InfoObjCmd, initialized); + rc|= XOTclReplaceCommand(interp, XOTE_INFO, XOTcl_InfoObjCmd, initialized); #endif - rc|= XOTclReplaceCommand(in, XOTE_RENAME, XOTcl_RenameObjCmd, initialized); + rc|= XOTclReplaceCommand(interp, XOTE_RENAME, XOTcl_RenameObjCmd, initialized); } else if (load == SHADOW_REFETCH) { - XOTclReplaceCommandCheck(in, XOTE_INFO, XOTcl_InfoObjCmd); - XOTclReplaceCommandCheck(in, XOTE_RENAME, XOTcl_RenameObjCmd); + XOTclReplaceCommandCheck(interp, XOTE_INFO, XOTcl_InfoObjCmd); + XOTclReplaceCommandCheck(interp, XOTE_RENAME, XOTcl_RenameObjCmd); } else { - XOTclReplaceCommandCleanup(in, XOTE_INFO); - XOTclReplaceCommandCleanup(in, XOTE_RENAME); - FREE(XOTclShadowTclCommandInfo*, RUNTIME_STATE(in)->tclCommands); - RUNTIME_STATE(in)->tclCommands = NULL; + XOTclReplaceCommandCleanup(interp, XOTE_INFO); + XOTclReplaceCommandCleanup(interp, XOTE_RENAME); + FREE(XOTclShadowTclCommandInfo*, RUNTIME_STATE(interp)->tclCommands); + RUNTIME_STATE(interp)->tclCommands = NULL; } return rc; } @@ -172,10 +172,10 @@ * call a Tcl command with given objv's ... replace objv[0] * with the given command name */ -int XOTclCallCommand(Tcl_Interp *in, XOTclGlobalNames name, +int XOTclCallCommand(Tcl_Interp *interp, XOTclGlobalNames name, int objc, Tcl_Obj *CONST objv[]) { int result; - XOTclShadowTclCommandInfo *ti = &RUNTIME_STATE(in)->tclCommands[name-XOTE_EXPR]; + XOTclShadowTclCommandInfo *ti = &RUNTIME_STATE(interp)->tclCommands[name-XOTE_EXPR]; ALLOC_ON_STACK(Tcl_Obj*,objc, ov); /* {int i; @@ -188,7 +188,7 @@ ov[0] = XOTclGlobalObjects[name]; if (objc > 1) memcpy(ov+1, objv+1, sizeof(Tcl_Obj *)*(objc-1)); - result = (*ti->proc)(ti->cd, in, objc, ov); + result = (*ti->proc)(ti->cd, interp, objc, ov); FREE_ON_STACK(ov); return result; } Index: generic/xotclTrace.c =================================================================== diff -u -rc72f9f638677608fab1502cd696c8f2d6b2952f9 -r54346e996575a3c1295e4a36c07fd490e63bc5a6 --- generic/xotclTrace.c (.../xotclTrace.c) (revision c72f9f638677608fab1502cd696c8f2d6b2952f9) +++ generic/xotclTrace.c (.../xotclTrace.c) (revision 54346e996575a3c1295e4a36c07fd490e63bc5a6) @@ -16,8 +16,8 @@ #include "xotclAccessInt.h" void -XOTclStackDump(Tcl_Interp *in) { - Interp *iPtr = (Interp *) in; +XOTclStackDump(Tcl_Interp *interp) { + Interp *iPtr = (Interp *)interp; CallFrame *f = iPtr->framePtr, *v = iPtr->varFramePtr; Tcl_Obj *varCmdObj; @@ -31,7 +31,7 @@ if (f && f->isProcCallFrame && f->procPtr && f->procPtr->cmdPtr) { fprintf(stderr,"caller %p ",Tcl_CallFrame_callerPtr(f)); fprintf(stderr,"callerV %p ",Tcl_CallFrame_callerVarPtr(f)); - Tcl_GetCommandFullName(in, (Tcl_Command) f->procPtr->cmdPtr, cmdObj); + Tcl_GetCommandFullName(interp, (Tcl_Command) f->procPtr->cmdPtr, cmdObj); fprintf(stderr, "%s (%p) lvl=%d\n", ObjStr(cmdObj), f->procPtr->cmdPtr, f->level); DECR_REF_COUNT(cmdObj); } else fprintf(stderr, "- \n"); @@ -43,7 +43,7 @@ fprintf(stderr, "\tFrame=%p", v); if (v) {fprintf(stderr, "caller %p", v->callerPtr);} if (v && v->isProcCallFrame && v->procPtr && v->procPtr->cmdPtr) { - Tcl_GetCommandFullName(in, (Tcl_Command) v->procPtr->cmdPtr, varCmdObj); + Tcl_GetCommandFullName(interp, (Tcl_Command) v->procPtr->cmdPtr, varCmdObj); if (varCmdObj) { fprintf(stderr, " %s (%d)\n", ObjStr(varCmdObj), v->level); } @@ -52,8 +52,8 @@ } void -XOTclCallStackDump(Tcl_Interp *in) { - XOTclCallStack *cs = &RUNTIME_STATE(in)->cs; +XOTclCallStackDump(Tcl_Interp *interp) { + XOTclCallStack *cs = &RUNTIME_STATE(interp)->cs; XOTclCallStackContent *csc; int i=1, entries = cs->top - cs->content; @@ -70,7 +70,7 @@ /*fprintf(stderr, " cmd %p, obj %p, ",csc->cmdPtr, csc->self);*/ if (csc->cmdPtr && !csc->destroyedCmd) - fprintf(stderr, "%s (%p), ", Tcl_GetCommandName(in, (Tcl_Command)csc->cmdPtr), + fprintf(stderr, "%s (%p), ", Tcl_GetCommandName(interp, (Tcl_Command)csc->cmdPtr), csc->cmdPtr); else fprintf(stderr, "NULL, "); @@ -90,13 +90,13 @@ /* if (entries > 0) { XOTclCallStackContent *c; - c = XOTclCallStackFindLastInvocation(in); + c = XOTclCallStackFindLastInvocation(interp); fprintf(stderr," --- findLastInvocation %p ",c); if (c) { if (c <= cs->top && c->currentFramePtr) fprintf(stderr," l=%d", Tcl_CallFrame_level(c->currentFramePtr)); } - c = XOTclCallStackFindActiveFrame(in, 1); + c = XOTclCallStackFindActiveFrame(interp, 1); fprintf(stderr," findActiveFrame %p ",c); if (c) { if (c <= cs->top && c->currentFramePtr) @@ -129,21 +129,21 @@ */ int -XOTcl_TraceObjCmd(ClientData cd, Tcl_Interp *in, int objc, Tcl_Obj *CONST objv[]) { +XOTcl_TraceObjCmd(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { char *option; if (objc != 2) - return XOTclObjErrArgCnt(in, NULL, "::xotcl::trace"); + return XOTclObjErrArgCnt(interp, NULL, "::xotcl::trace"); option = ObjStr(objv[1]); if (strcmp(option,"stack") == 0) { - XOTclStackDump(in); + XOTclStackDump(interp); return TCL_OK; } if (strcmp(option,"callstack") == 0) { - XOTclCallStackDump(in); + XOTclCallStackDump(interp); return TCL_OK; } - return XOTclVarErrMsg(in, "xotcltrace: unknown option", (char*) NULL); + return XOTclVarErrMsg(interp, "xotcltrace: unknown option", (char*) NULL); } #ifdef XOTCL_MEM_COUNT