summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/tclCompile.c15
-rw-r--r--generic/tclInt.decls28
-rw-r--r--generic/tclIntPlatDecls.h53
-rw-r--r--generic/tclOptimize.c3
-rw-r--r--generic/tclStubInit.c13
-rw-r--r--generic/tclStubLib.c28
-rw-r--r--generic/tclStubLibTbl.c12
7 files changed, 69 insertions, 83 deletions
diff --git a/generic/tclCompile.c b/generic/tclCompile.c
index be5bedf..8cb53f5 100644
--- a/generic/tclCompile.c
+++ b/generic/tclCompile.c
@@ -1762,7 +1762,7 @@ TclCompileScript(
/* TIP #280 */
ExtCmdLoc *eclPtr = envPtr->extCmdMapPtr;
int *wlines, wlineat, cmdLine, *clNext;
- Tcl_Parse *parsePtr = TclStackAlloc(interp, sizeof(Tcl_Parse));
+ Tcl_Parse parse, *parsePtr = &parse;
if (envPtr->iPtr == NULL) {
Tcl_Panic("TclCompileScript() called on uninitialized CompileEnv");
@@ -2190,11 +2190,8 @@ TclCompileScript(
*/
if (envPtr->codeNext == entryCodeNext) {
- TclEmitPush(TclRegisterNewLiteral(envPtr, "", 0), envPtr);
+ PushStringLiteral(envPtr, "");
}
-
- envPtr->numSrcBytes = p - script;
- TclStackFree(interp, parsePtr);
}
/*
@@ -2258,7 +2255,7 @@ TclCompileVarSubst(
localVar = TclFindCompiledLocal(name, nameBytes, localVarName, envPtr);
}
if (localVar < 0) {
- TclEmitPush(TclRegisterNewLiteral(envPtr, name, nameBytes), envPtr);
+ PushLiteral(envPtr, name, nameBytes);
}
/*
@@ -2466,7 +2463,7 @@ TclCompileTokens(
*/
if (envPtr->codeNext == entryCodeNext) {
- TclEmitPush(TclRegisterNewLiteral(envPtr, "", 0), envPtr);
+ PushStringLiteral(envPtr, "");
}
Tcl_DStringFree(&textBuffer);
@@ -2583,7 +2580,7 @@ TclCompileExprWords(
for (i = 0; i < numWords; i++) {
TclCompileTokens(interp, wordPtr+1, wordPtr->numComponents, envPtr);
if (i < (numWords - 1)) {
- TclEmitPush(TclRegisterNewLiteral(envPtr, " ", 1), envPtr);
+ PushStringLiteral(envPtr, " ");
}
wordPtr += wordPtr->numComponents + 1;
}
@@ -2638,7 +2635,7 @@ TclCompileNoOp(
TclEmitOpcode(INST_POP, envPtr);
}
}
- TclEmitPush(TclRegisterNewLiteral(envPtr, "", 0), envPtr);
+ PushStringLiteral(envPtr, "");
return TCL_OK;
}
diff --git a/generic/tclInt.decls b/generic/tclInt.decls
index 356a265..244a7b2 100644
--- a/generic/tclInt.decls
+++ b/generic/tclInt.decls
@@ -1072,10 +1072,10 @@ declare 8 win {
declare 9 win {
int TclWinGetPlatformId(void)
}
-# new for 8.4.20+/8.5.12+ Cygwin only
-declare 10 win {
- Tcl_DirEntry *TclpReaddir(DIR *dir)
-}
+# Removed in Tcl 9.0
+#declare 10 win {
+# Tcl_DirEntry *TclpReaddir(DIR *dir)
+#}
# Removed in 8.3.1 (for Win32s only)
#declare 10 win {
# int TclWinSynchSpawn(void *args, int type, void **trans, Tcl_Pid *pidPtr)
@@ -1126,10 +1126,10 @@ declare 19 win {
declare 20 win {
void TclWinAddProcess(HANDLE hProcess, DWORD id)
}
-# new for 8.4.20+/8.5.12+
-declare 21 win {
- char *TclpInetNtoa(struct in_addr addr)
-}
+# Removed in Tcl 9.0
+#declare 21 win {
+# char *TclpInetNtoa(struct in_addr addr)
+#}
# removed permanently for 8.4
#declare 21 win {
# void TclpAsyncMark(Tcl_AsyncHandler async)
@@ -1211,19 +1211,19 @@ declare 9 unix {
# Added in 8.4:
-declare 10 unix {
- Tcl_DirEntry *TclpReaddir(DIR *dir)
-}
# Removed in Tcl 9.0
+#declare 10 unix {
+# Tcl_DirEntry *TclpReaddir(DIR *dir)
+#}
#declare 11 unix {
# struct tm *TclpLocaltime_unix(const time_t *clock)
#}
#declare 12 unix {
# struct tm *TclpGmtime_unix(const time_t *clock)
#}
-declare 13 unix {
- char *TclpInetNtoa(struct in_addr addr)
-}
+#declare 13 unix {
+# char *TclpInetNtoa(struct in_addr addr)
+#}
# Added in 8.5:
diff --git a/generic/tclIntPlatDecls.h b/generic/tclIntPlatDecls.h
index 010fe88..4424c7c 100644
--- a/generic/tclIntPlatDecls.h
+++ b/generic/tclIntPlatDecls.h
@@ -13,11 +13,6 @@
#ifndef _TCLINTPLATDECLS
#define _TCLINTPLATDECLS
-#ifdef __WIN32__
-# define Tcl_DirEntry void
-# define DIR void
-#endif
-
/*
* WARNING: This file is automatically generated by the tools/genStubs.tcl
* script. Any modifications to the function declarations below should be made
@@ -56,12 +51,10 @@ TCLAPI TclFile TclpOpenFile(const char *fname, int mode);
TCLAPI int TclUnixWaitForFile(int fd, int mask, int timeout);
/* 9 */
TCLAPI TclFile TclpCreateTempFile(const char *contents);
-/* 10 */
-TCLAPI Tcl_DirEntry * TclpReaddir(DIR *dir);
+/* Slot 10 is reserved */
/* Slot 11 is reserved */
/* Slot 12 is reserved */
-/* 13 */
-TCLAPI char * TclpInetNtoa(struct in_addr addr);
+/* Slot 13 is reserved */
/* 14 */
TCLAPI int TclUnixCopyFile(const char *src, const char *dst,
const Tcl_StatBuf *statBufPtr,
@@ -109,8 +102,7 @@ TCLAPI int TclWinSetSockOpt(SOCKET s, int level, int optname,
TCLAPI int TclpGetPid(Tcl_Pid pid);
/* 9 */
TCLAPI int TclWinGetPlatformId(void);
-/* 10 */
-TCLAPI Tcl_DirEntry * TclpReaddir(DIR *dir);
+/* Slot 10 is reserved */
/* 11 */
TCLAPI void TclGetAndDetachPids(Tcl_Interp *interp,
Tcl_Channel chan);
@@ -139,8 +131,7 @@ TCLAPI TclFile TclpMakeFile(Tcl_Channel channel, int direction);
TCLAPI TclFile TclpOpenFile(const char *fname, int mode);
/* 20 */
TCLAPI void TclWinAddProcess(HANDLE hProcess, DWORD id);
-/* 21 */
-TCLAPI char * TclpInetNtoa(struct in_addr addr);
+/* Slot 21 is reserved */
/* 22 */
TCLAPI TclFile TclpCreateTempFile(const char *contents);
/* Slot 23 is reserved */
@@ -186,12 +177,10 @@ TCLAPI TclFile TclpOpenFile(const char *fname, int mode);
TCLAPI int TclUnixWaitForFile(int fd, int mask, int timeout);
/* 9 */
TCLAPI TclFile TclpCreateTempFile(const char *contents);
-/* 10 */
-TCLAPI Tcl_DirEntry * TclpReaddir(DIR *dir);
+/* Slot 10 is reserved */
/* Slot 11 is reserved */
/* Slot 12 is reserved */
-/* 13 */
-TCLAPI char * TclpInetNtoa(struct in_addr addr);
+/* Slot 13 is reserved */
/* 14 */
TCLAPI int TclUnixCopyFile(const char *src, const char *dst,
const Tcl_StatBuf *statBufPtr,
@@ -248,10 +237,10 @@ typedef struct TclIntPlatStubs {
TclFile (*tclpOpenFile) (const char *fname, int mode); /* 7 */
int (*tclUnixWaitForFile) (int fd, int mask, int timeout); /* 8 */
TclFile (*tclpCreateTempFile) (const char *contents); /* 9 */
- Tcl_DirEntry * (*tclpReaddir) (DIR *dir); /* 10 */
+ void (*reserved10)(void);
void (*reserved11)(void);
void (*reserved12)(void);
- char * (*tclpInetNtoa) (struct in_addr addr); /* 13 */
+ void (*reserved13)(void);
int (*tclUnixCopyFile) (const char *src, const char *dst, const Tcl_StatBuf *statBufPtr, int dontCopyAtts); /* 14 */
void (*reserved15)(void);
void (*reserved16)(void);
@@ -281,7 +270,7 @@ typedef struct TclIntPlatStubs {
int (*tclWinSetSockOpt) (SOCKET s, int level, int optname, const char *optval, int optlen); /* 7 */
int (*tclpGetPid) (Tcl_Pid pid); /* 8 */
int (*tclWinGetPlatformId) (void); /* 9 */
- Tcl_DirEntry * (*tclpReaddir) (DIR *dir); /* 10 */
+ void (*reserved10)(void);
void (*tclGetAndDetachPids) (Tcl_Interp *interp, Tcl_Channel chan); /* 11 */
int (*tclpCloseFile) (TclFile file); /* 12 */
Tcl_Channel (*tclpCreateCommandChannel) (TclFile readFile, TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr); /* 13 */
@@ -292,7 +281,7 @@ typedef struct TclIntPlatStubs {
TclFile (*tclpMakeFile) (Tcl_Channel channel, int direction); /* 18 */
TclFile (*tclpOpenFile) (const char *fname, int mode); /* 19 */
void (*tclWinAddProcess) (HANDLE hProcess, DWORD id); /* 20 */
- char * (*tclpInetNtoa) (struct in_addr addr); /* 21 */
+ void (*reserved21)(void);
TclFile (*tclpCreateTempFile) (const char *contents); /* 22 */
void (*reserved23)(void);
char * (*tclWinNoBackslash) (char *path); /* 24 */
@@ -314,10 +303,10 @@ typedef struct TclIntPlatStubs {
TclFile (*tclpOpenFile) (const char *fname, int mode); /* 7 */
int (*tclUnixWaitForFile) (int fd, int mask, int timeout); /* 8 */
TclFile (*tclpCreateTempFile) (const char *contents); /* 9 */
- Tcl_DirEntry * (*tclpReaddir) (DIR *dir); /* 10 */
+ void (*reserved10)(void);
void (*reserved11)(void);
void (*reserved12)(void);
- char * (*tclpInetNtoa) (struct in_addr addr); /* 13 */
+ void (*reserved13)(void);
int (*tclUnixCopyFile) (const char *src, const char *dst, const Tcl_StatBuf *statBufPtr, int dontCopyAtts); /* 14 */
int (*tclMacOSXGetFileAttribute) (Tcl_Interp *interp, int objIndex, Tcl_Obj *fileName, Tcl_Obj **attributePtrPtr); /* 15 */
int (*tclMacOSXSetFileAttribute) (Tcl_Interp *interp, int objIndex, Tcl_Obj *fileName, Tcl_Obj *attributePtr); /* 16 */
@@ -372,12 +361,10 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr;
(tclIntPlatStubsPtr->tclUnixWaitForFile) /* 8 */
#define TclpCreateTempFile \
(tclIntPlatStubsPtr->tclpCreateTempFile) /* 9 */
-#define TclpReaddir \
- (tclIntPlatStubsPtr->tclpReaddir) /* 10 */
+/* Slot 10 is reserved */
/* Slot 11 is reserved */
/* Slot 12 is reserved */
-#define TclpInetNtoa \
- (tclIntPlatStubsPtr->tclpInetNtoa) /* 13 */
+/* Slot 13 is reserved */
#define TclUnixCopyFile \
(tclIntPlatStubsPtr->tclUnixCopyFile) /* 14 */
/* Slot 15 is reserved */
@@ -418,8 +405,7 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr;
(tclIntPlatStubsPtr->tclpGetPid) /* 8 */
#define TclWinGetPlatformId \
(tclIntPlatStubsPtr->tclWinGetPlatformId) /* 9 */
-#define TclpReaddir \
- (tclIntPlatStubsPtr->tclpReaddir) /* 10 */
+/* Slot 10 is reserved */
#define TclGetAndDetachPids \
(tclIntPlatStubsPtr->tclGetAndDetachPids) /* 11 */
#define TclpCloseFile \
@@ -440,8 +426,7 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr;
(tclIntPlatStubsPtr->tclpOpenFile) /* 19 */
#define TclWinAddProcess \
(tclIntPlatStubsPtr->tclWinAddProcess) /* 20 */
-#define TclpInetNtoa \
- (tclIntPlatStubsPtr->tclpInetNtoa) /* 21 */
+/* Slot 21 is reserved */
#define TclpCreateTempFile \
(tclIntPlatStubsPtr->tclpCreateTempFile) /* 22 */
/* Slot 23 is reserved */
@@ -479,12 +464,10 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr;
(tclIntPlatStubsPtr->tclUnixWaitForFile) /* 8 */
#define TclpCreateTempFile \
(tclIntPlatStubsPtr->tclpCreateTempFile) /* 9 */
-#define TclpReaddir \
- (tclIntPlatStubsPtr->tclpReaddir) /* 10 */
+/* Slot 10 is reserved */
/* Slot 11 is reserved */
/* Slot 12 is reserved */
-#define TclpInetNtoa \
- (tclIntPlatStubsPtr->tclpInetNtoa) /* 13 */
+/* Slot 13 is reserved */
#define TclUnixCopyFile \
(tclIntPlatStubsPtr->tclUnixCopyFile) /* 14 */
#define TclMacOSXGetFileAttribute \
diff --git a/generic/tclOptimize.c b/generic/tclOptimize.c
index 7d4226e..cd37a6a 100644
--- a/generic/tclOptimize.c
+++ b/generic/tclOptimize.c
@@ -86,6 +86,7 @@ LocateTargetAddresses(
case INST_JUMP4:
case INST_JUMP_TRUE4:
case INST_JUMP_FALSE4:
+ case INST_START_CMD:
targetInstPtr = currentInstPtr+TclGetInt4AtPtr(currentInstPtr+1);
goto storeTarget;
case INST_BEGIN_CATCH4:
@@ -109,8 +110,6 @@ LocateTargetAddresses(
DefineTargetAddress(tablePtr, currentInstPtr + 2*i - 1);
}
break;
- case INST_START_CMD:
- assert (envPtr->atCmdStart < 2);
}
}
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index 163436d..53f14c4 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -66,7 +66,6 @@ static int TclPkgProvide(
# define TclUnixWaitForFile 0
# define TclUnixCopyFile 0
# define TclUnixOpenTemporaryFile 0
-# define TclpReaddir 0
# define TclpIsAtty 0
#elif defined(__CYGWIN__)
# define TclpIsAtty TclPlatIsAtty
@@ -520,10 +519,10 @@ static const TclIntPlatStubs tclIntPlatStubs = {
TclpOpenFile, /* 7 */
TclUnixWaitForFile, /* 8 */
TclpCreateTempFile, /* 9 */
- TclpReaddir, /* 10 */
+ 0, /* 10 */
0, /* 11 */
0, /* 12 */
- TclpInetNtoa, /* 13 */
+ 0, /* 13 */
TclUnixCopyFile, /* 14 */
0, /* 15 */
0, /* 16 */
@@ -553,7 +552,7 @@ static const TclIntPlatStubs tclIntPlatStubs = {
TclWinSetSockOpt, /* 7 */
TclpGetPid, /* 8 */
TclWinGetPlatformId, /* 9 */
- TclpReaddir, /* 10 */
+ 0, /* 10 */
TclGetAndDetachPids, /* 11 */
TclpCloseFile, /* 12 */
TclpCreateCommandChannel, /* 13 */
@@ -564,7 +563,7 @@ static const TclIntPlatStubs tclIntPlatStubs = {
TclpMakeFile, /* 18 */
TclpOpenFile, /* 19 */
TclWinAddProcess, /* 20 */
- TclpInetNtoa, /* 21 */
+ 0, /* 21 */
TclpCreateTempFile, /* 22 */
0, /* 23 */
TclWinNoBackslash, /* 24 */
@@ -586,10 +585,10 @@ static const TclIntPlatStubs tclIntPlatStubs = {
TclpOpenFile, /* 7 */
TclUnixWaitForFile, /* 8 */
TclpCreateTempFile, /* 9 */
- TclpReaddir, /* 10 */
+ 0, /* 10 */
0, /* 11 */
0, /* 12 */
- TclpInetNtoa, /* 13 */
+ 0, /* 13 */
TclUnixCopyFile, /* 14 */
TclMacOSXGetFileAttribute, /* 15 */
TclMacOSXSetFileAttribute, /* 16 */
diff --git a/generic/tclStubLib.c b/generic/tclStubLib.c
index 79e1a02..3e4a5ae 100644
--- a/generic/tclStubLib.c
+++ b/generic/tclStubLib.c
@@ -13,6 +13,16 @@
#include "tclInt.h"
+MODULE_SCOPE const TclStubs *tclStubsPtr;
+MODULE_SCOPE const TclPlatStubs *tclPlatStubsPtr;
+MODULE_SCOPE const TclIntStubs *tclIntStubsPtr;
+MODULE_SCOPE const TclIntPlatStubs *tclIntPlatStubsPtr;
+
+const TclStubs *tclStubsPtr = NULL;
+const TclPlatStubs *tclPlatStubsPtr = NULL;
+const TclIntStubs *tclIntStubsPtr = NULL;
+const TclIntPlatStubs *tclIntPlatStubsPtr = NULL;
+
/*
* Use our own ISDIGIT to avoid linking to libc on windows
*/
@@ -47,8 +57,8 @@ Tcl_InitStubs(
{
Interp *iPtr = (Interp *) interp;
const char *actualVersion = NULL;
- const TclStubs *stubsPtr = iPtr->stubTable;
ClientData pkgData = NULL;
+ const TclStubs *stubsPtr = iPtr->stubTable;
/*
* We can't optimize this check by caching tclStubsPtr because that
@@ -94,11 +104,19 @@ Tcl_InitStubs(
}
if (stubsPtr->reserved77) {
- /* We are running Tcl 8. */
- TclInitStubTable(((char *)&pkgData)-TclOffset(TclStubInfoType, stubs));
+ /* We are running Tcl 8.x */
+ stubsPtr = (TclStubs *)pkgData;
+ }
+ tclStubsPtr = stubsPtr;
+
+ if (stubsPtr->hooks) {
+ tclPlatStubsPtr = stubsPtr->hooks->tclPlatStubs;
+ tclIntStubsPtr = stubsPtr->hooks->tclIntStubs;
+ tclIntPlatStubsPtr = stubsPtr->hooks->tclIntPlatStubs;
} else {
- /* We are running Tcl 9. */
- TclInitStubTable(((char *)&stubsPtr)-TclOffset(TclStubInfoType, stubs));
+ tclPlatStubsPtr = NULL;
+ tclIntStubsPtr = NULL;
+ tclIntPlatStubsPtr = NULL;
}
return actualVersion;
diff --git a/generic/tclStubLibTbl.c b/generic/tclStubLibTbl.c
index 8c516b7..0391502 100644
--- a/generic/tclStubLibTbl.c
+++ b/generic/tclStubLibTbl.c
@@ -13,17 +13,6 @@
#include "tclInt.h"
-MODULE_SCOPE const TclStubs *tclStubsPtr;
-MODULE_SCOPE const TclPlatStubs *tclPlatStubsPtr;
-MODULE_SCOPE const TclIntStubs *tclIntStubsPtr;
-MODULE_SCOPE const TclIntPlatStubs *tclIntPlatStubsPtr;
-
-const TclStubs *tclStubsPtr = NULL;
-const TclPlatStubs *tclPlatStubsPtr = NULL;
-const TclIntStubs *tclIntStubsPtr = NULL;
-const TclIntPlatStubs *tclIntPlatStubsPtr = NULL;
-
-
/*
*----------------------------------------------------------------------
*
@@ -56,6 +45,7 @@ TclInitStubTable(
tclIntStubsPtr = NULL;
tclIntPlatStubsPtr = NULL;
}
+
return version;
}