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; }