Overview
| Artifact ID: | 15d2b67bd6acfb6917f7c2117ab7c3ed0156b274 |
|---|---|
| Ticket: | 540378ffffffffffffffffffffffffffffffffff
init stubs from PkgRequire, not interp |
| User & Date: | dgp on 2002-04-06 23:45:57 |
Changes
- assignee changed to: "dgp"
- cmimetype changed to: "text/plain"
- comment changed to:
>From "Paul Duffin" <[email protected]> One thing that you can do in the meantime is make a slight modification to the Tcl_InitStubs function in tclStubLib.c which will allow you a lot of flexibility in how you do this. As you know Tcl_InitStubs initialises the global pointer tclStubPtr so that it points to Tcl's stub table. At the moment it uses the stub table pointer which is stored in the Interp structure, this should be changed to use the stub table pointer which is returned from Tcl_PkgRequireEx instead. This minor and totally compatible change needs to be done immediately as the Tcl_InitStubs function is embedded inside extensions so extensions will need to be rebuilt for the change to take effect. The benefit of doing this is that it would be possible to have multiple versions of the Tcl stub table in use at the same time, you could have an 8.1 version (because 8.0 does not have a stub table, :-( ), a 9.0 version and a 10.0 version all at the same time. The only restriction on the table structure is that those functions which are used by Tcl_InitStubs (Tcl_PkgRequireEx) need to be in the same place in all the structures. You can totally restructure the rest of the table(s) to suit your needs. The backward compatible stub tables can be provided by dynamically loadable extensions. To enable this would obviously need some modifications to the package mechanism as it stands to allow multiple versions of a package to be loaded at one time, or at least allow compatability versions of a package to be loaded as well as the current version. These issues can be resolved at your leisure but the change to Tcl_InitStubs (and all the other _InitStubs functions) needs to be done now, otherwise you will not have the choice. Instead of char * Tcl_InitStubs (interp, version, exact) Tcl_Interp *interp; char *version; int exact; { char *actualVersion; TclStubs *tmp; if (!tclStubsPtr) { tclStubsPtr = HasStubSupport(interp); if (!tclStubsPtr) { return NULL; } } actualVersion = Tcl_PkgRequireEx(interp, "Tcl", version, exact, (ClientData *) &tmp); if (actualVersion == NULL) { tclStubsPtr = NULL; return NULL; } if (tclStubsPtr->hooks) { tclPlatStubsPtr = tclStubsPtr->hooks->tclPlatStubs; tclIntStubsPtr = tclStubsPtr->hooks->tclIntStubs; tclIntPlatStubsPtr = tclStubsPtr->hooks->tclIntPlatStubs; } else { tclPlatStubsPtr = NULL; tclIntStubsPtr = NULL; tclIntPlatStubsPtr = NULL; } return actualVersion; } you need char * Tcl_InitStubs (interp, version, exact) Tcl_Interp *interp; char *version; int exact; { char *actualVersion; if (!tclStubsPtr) { tclStubsPtr = HasStubSupport(interp); if (!tclStubsPtr) { return NULL; } } actualVersion = Tcl_PkgRequireEx(interp, "Tcl", version, exact, (ClientData *) &tclStubsPtr); if (actualVersion == NULL) { tclStubsPtr = NULL; return NULL; } if (tclStubsPtr->hooks) { tclPlatStubsPtr = tclStubsPtr->hooks->tclPlatStubs; tclIntStubsPtr = tclStubsPtr->hooks->tclIntStubs; tclIntPlatStubsPtr = tclStubsPtr->hooks->tclIntPlatStubs; } else { tclPlatStubsPtr = NULL; tclIntStubsPtr = NULL; tclIntPlatStubsPtr = NULL; } return actualVersion; }
- foundin changed to: "None"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "dgp"
- subsystem changed to: "39. Package Manager"
- title changed to: "init stubs from PkgRequire, not interp"
- type changed to: "RFE"