diff options
Diffstat (limited to 'generic')
| -rw-r--r-- | generic/tcl.decls | 14 | ||||
| -rw-r--r-- | generic/tclCkalloc.c | 9 | ||||
| -rw-r--r-- | generic/tclCmdMZ.c | 8 | ||||
| -rw-r--r-- | generic/tclDate.c | 12 | ||||
| -rw-r--r-- | generic/tclDecls.h | 28 | ||||
| -rw-r--r-- | generic/tclEnv.c | 1 | ||||
| -rw-r--r-- | generic/tclExecute.c | 4 | ||||
| -rw-r--r-- | generic/tclFileName.c | 4 | ||||
| -rw-r--r-- | generic/tclGetDate.y | 12 | ||||
| -rw-r--r-- | generic/tclIO.c | 2 | ||||
| -rw-r--r-- | generic/tclIOCmd.c | 2 | ||||
| -rw-r--r-- | generic/tclIOGT.c | 2 | ||||
| -rw-r--r-- | generic/tclIOSock.c | 4 | ||||
| -rw-r--r-- | generic/tclInt.decls | 105 | ||||
| -rw-r--r-- | generic/tclIntDecls.h | 38 | ||||
| -rw-r--r-- | generic/tclIntPlatDecls.h | 527 | ||||
| -rw-r--r-- | generic/tclPathObj.c | 2 | ||||
| -rw-r--r-- | generic/tclPipe.c | 2 | ||||
| -rw-r--r-- | generic/tclPlatDecls.h | 57 | ||||
| -rw-r--r-- | generic/tclPort.h | 13 | ||||
| -rw-r--r-- | generic/tclStubInit.c | 197 | ||||
| -rw-r--r-- | generic/tclTest.c | 67 | ||||
| -rw-r--r-- | generic/tclTestProcBodyObj.c | 14 | ||||
| -rw-r--r-- | generic/tclTrace.c | 4 |
24 files changed, 455 insertions, 673 deletions
diff --git a/generic/tcl.decls b/generic/tcl.decls index 903669d..256701d 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -51,7 +51,7 @@ declare 6 { char *Tcl_DbCkalloc(unsigned int size, const char *file, int line) } declare 7 { - int Tcl_DbCkfree(char *ptr, const char *file, int line) + void Tcl_DbCkfree(char *ptr, const char *file, int line) } declare 8 { char *Tcl_DbCkrealloc(char *ptr, unsigned int size, @@ -2135,12 +2135,12 @@ declare 1 win { ################################ # Mac OS X specific functions -declare 0 {unix macosx} { +declare 0 macosx { int Tcl_MacOSXOpenBundleResources(Tcl_Interp *interp, const char *bundleName, int hasResourceFile, int maxPathLen, char *libraryPath) } -declare 1 {unix macosx} { +declare 1 macosx { int Tcl_MacOSXOpenVersionedBundleResources(Tcl_Interp *interp, const char *bundleName, const char *bundleVersion, int hasResourceFile, int maxPathLen, char *libraryPath) @@ -2154,6 +2154,14 @@ export { void Tcl_Main(int argc, char **argv, Tcl_AppInitProc *appInitProc) } export { + const char *Tcl_InitStubs(Tcl_Interp *interp, const char *version, + int exact) +} +export { + const char *TclTomMathInitializeStubs(Tcl_Interp* interp, + const char* version, int epoch, int revision) +} +export { const char *Tcl_PkgInitStubsCheck(Tcl_Interp *interp, const char *version, int exact) } diff --git a/generic/tclCkalloc.c b/generic/tclCkalloc.c index c374ce5..5c0432d 100644 --- a/generic/tclCkalloc.c +++ b/generic/tclCkalloc.c @@ -583,7 +583,7 @@ Tcl_AttemptDbCkalloc( *---------------------------------------------------------------------- */ -int +void Tcl_DbCkfree( char *ptr, CONST char *file, @@ -592,7 +592,7 @@ Tcl_DbCkfree( struct mem_header *memp; if (ptr == NULL) { - return 0; + return; } /* @@ -646,8 +646,6 @@ Tcl_DbCkfree( } TclpFree((char *) memp); Tcl_MutexUnlock(ckallocMutexPtr); - - return 0; } /* @@ -1219,14 +1217,13 @@ Tcl_Free( TclpFree(ptr); } -int +void Tcl_DbCkfree( char *ptr, CONST char *file, int line) { TclpFree(ptr); - return 0; } /* diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 531e2b1..0ad77aa 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -3679,8 +3679,12 @@ Tcl_SwitchObjCmd( if (indexVarObj != NULL) { Tcl_Obj *rangeObjAry[2]; - rangeObjAry[0] = Tcl_NewLongObj(info.matches[j].start); - rangeObjAry[1] = Tcl_NewLongObj(info.matches[j].end); + if (info.matches[j].end > 0) { + rangeObjAry[0] = Tcl_NewLongObj(info.matches[j].start); + rangeObjAry[1] = Tcl_NewLongObj(info.matches[j].end-1); + } else { + rangeObjAry[0] = rangeObjAry[1] = Tcl_NewIntObj(-1); + } /* * Never fails; the object is always clean at this point. diff --git a/generic/tclDate.c b/generic/tclDate.c index b77c7fd..59da2ea 100644 --- a/generic/tclDate.c +++ b/generic/tclDate.c @@ -2299,7 +2299,7 @@ MODULE_SCOPE int yynerrs; * Month and day table. */ -static TABLE MonthDayTable[] = { +static const TABLE MonthDayTable[] = { { "january", tMONTH, 1 }, { "february", tMONTH, 2 }, { "march", tMONTH, 3 }, @@ -2331,7 +2331,7 @@ static TABLE MonthDayTable[] = { * Time units table. */ -static TABLE UnitsTable[] = { +static const TABLE UnitsTable[] = { { "year", tMONTH_UNIT, 12 }, { "month", tMONTH_UNIT, 1 }, { "fortnight", tDAY_UNIT, 14 }, @@ -2349,7 +2349,7 @@ static TABLE UnitsTable[] = { * Assorted relative-time words. */ -static TABLE OtherTable[] = { +static const TABLE OtherTable[] = { { "tomorrow", tDAY_UNIT, 1 }, { "yesterday", tDAY_UNIT, -1 }, { "today", tDAY_UNIT, 0 }, @@ -2382,7 +2382,7 @@ static TABLE OtherTable[] = { * point constants to work around an SGI compiler bug). */ -static TABLE TimezoneTable[] = { +static const TABLE TimezoneTable[] = { { "gmt", tZONE, HOUR( 0) }, /* Greenwich Mean */ { "ut", tZONE, HOUR( 0) }, /* Universal (Coordinated) */ { "utc", tZONE, HOUR( 0) }, @@ -2467,7 +2467,7 @@ static TABLE TimezoneTable[] = { * Military timezone table. */ -static TABLE MilitaryTable[] = { +static const TABLE MilitaryTable[] = { { "a", tZONE, -HOUR( 1) }, { "b", tZONE, -HOUR( 2) }, { "c", tZONE, -HOUR( 3) }, @@ -2560,7 +2560,7 @@ LookupWord( { register char *p; register char *q; - register TABLE *tp; + register const TABLE *tp; int i, abbrev; /* diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 4517d01..424024d 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -78,7 +78,7 @@ EXTERN char * Tcl_DbCkalloc(unsigned int size, CONST char *file, #ifndef Tcl_DbCkfree_TCL_DECLARED #define Tcl_DbCkfree_TCL_DECLARED /* 7 */ -EXTERN int Tcl_DbCkfree(char *ptr, CONST char *file, int line); +EXTERN void Tcl_DbCkfree(char *ptr, CONST char *file, int line); #endif #ifndef Tcl_DbCkrealloc_TCL_DECLARED #define Tcl_DbCkrealloc_TCL_DECLARED @@ -86,7 +86,7 @@ EXTERN int Tcl_DbCkfree(char *ptr, CONST char *file, int line); EXTERN char * Tcl_DbCkrealloc(char *ptr, unsigned int size, CONST char *file, int line); #endif -#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ +#if !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(MAC_OSX_TCL) /* UNIX */ #ifndef Tcl_CreateFileHandler_TCL_DECLARED #define Tcl_CreateFileHandler_TCL_DECLARED /* 9 */ @@ -102,7 +102,7 @@ EXTERN void Tcl_CreateFileHandler(int fd, int mask, Tcl_FileProc *proc, ClientData clientData); #endif #endif /* MACOSX */ -#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ +#if !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(MAC_OSX_TCL) /* UNIX */ #ifndef Tcl_DeleteFileHandler_TCL_DECLARED #define Tcl_DeleteFileHandler_TCL_DECLARED /* 10 */ @@ -1013,7 +1013,7 @@ EXTERN CONST char * Tcl_GetNameOfExecutable(void); /* 166 */ EXTERN Tcl_Obj * Tcl_GetObjResult(Tcl_Interp *interp); #endif -#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ +#if !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(MAC_OSX_TCL) /* UNIX */ #ifndef Tcl_GetOpenFile_TCL_DECLARED #define Tcl_GetOpenFile_TCL_DECLARED /* 167 */ @@ -3426,21 +3426,21 @@ typedef struct TclStubs { void (*tcl_Free) (char *ptr); /* 4 */ char * (*tcl_Realloc) (char *ptr, unsigned int size); /* 5 */ char * (*tcl_DbCkalloc) (unsigned int size, CONST char *file, int line); /* 6 */ - int (*tcl_DbCkfree) (char *ptr, CONST char *file, int line); /* 7 */ + void (*tcl_DbCkfree) (char *ptr, CONST char *file, int line); /* 7 */ char * (*tcl_DbCkrealloc) (char *ptr, unsigned int size, CONST char *file, int line); /* 8 */ -#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ +#if !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(MAC_OSX_TCL) /* UNIX */ void (*tcl_CreateFileHandler) (int fd, int mask, Tcl_FileProc *proc, ClientData clientData); /* 9 */ #endif /* UNIX */ -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ VOID *reserved9; #endif /* WIN */ #ifdef MAC_OSX_TCL /* MACOSX */ void (*tcl_CreateFileHandler) (int fd, int mask, Tcl_FileProc *proc, ClientData clientData); /* 9 */ #endif /* MACOSX */ -#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ +#if !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(MAC_OSX_TCL) /* UNIX */ void (*tcl_DeleteFileHandler) (int fd); /* 10 */ #endif /* UNIX */ -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ VOID *reserved10; #endif /* WIN */ #ifdef MAC_OSX_TCL /* MACOSX */ @@ -3602,10 +3602,10 @@ typedef struct TclStubs { Tcl_Interp * (*tcl_GetMaster) (Tcl_Interp *interp); /* 164 */ CONST char * (*tcl_GetNameOfExecutable) (void); /* 165 */ Tcl_Obj * (*tcl_GetObjResult) (Tcl_Interp *interp); /* 166 */ -#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ +#if !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(MAC_OSX_TCL) /* UNIX */ int (*tcl_GetOpenFile) (Tcl_Interp *interp, CONST char *chanID, int forWriting, int checkUsage, ClientData *filePtr); /* 167 */ #endif /* UNIX */ -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ VOID *reserved167; #endif /* WIN */ #ifdef MAC_OSX_TCL /* MACOSX */ @@ -4075,7 +4075,7 @@ extern TclStubs *tclStubsPtr; #define Tcl_DbCkrealloc \ (tclStubsPtr->tcl_DbCkrealloc) /* 8 */ #endif -#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ +#if !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(MAC_OSX_TCL) /* UNIX */ #ifndef Tcl_CreateFileHandler #define Tcl_CreateFileHandler \ (tclStubsPtr->tcl_CreateFileHandler) /* 9 */ @@ -4087,7 +4087,7 @@ extern TclStubs *tclStubsPtr; (tclStubsPtr->tcl_CreateFileHandler) /* 9 */ #endif #endif /* MACOSX */ -#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ +#if !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(MAC_OSX_TCL) /* UNIX */ #ifndef Tcl_DeleteFileHandler #define Tcl_DeleteFileHandler \ (tclStubsPtr->tcl_DeleteFileHandler) /* 10 */ @@ -4723,7 +4723,7 @@ extern TclStubs *tclStubsPtr; #define Tcl_GetObjResult \ (tclStubsPtr->tcl_GetObjResult) /* 166 */ #endif -#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ +#if !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(MAC_OSX_TCL) /* UNIX */ #ifndef Tcl_GetOpenFile #define Tcl_GetOpenFile \ (tclStubsPtr->tcl_GetOpenFile) /* 167 */ diff --git a/generic/tclEnv.c b/generic/tclEnv.c index 24fa106..bcc0ff1 100644 --- a/generic/tclEnv.c +++ b/generic/tclEnv.c @@ -696,6 +696,7 @@ TclFinalizeEnvironment(void) * fork) and the Windows environment (in case the application TCL code calls * exec, which calls the Windows CreateProcess function). */ +DLLIMPORT extern void __stdcall SetEnvironmentVariableA(const char*, const char *); static void TclCygwinPutenv( diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 8d97392..f2efa0f 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -116,7 +116,7 @@ long tclObjsShared[TCL_MAX_SHARED_OBJ_STATS] = { 0, 0, 0, 0, 0 }; */ typedef struct { - char *name; /* Name of function. */ + const char *name; /* Name of function. */ int numArgs; /* Number of arguments for function. */ } BuiltinFunc; @@ -126,7 +126,7 @@ typedef struct { * operand byte. */ -static BuiltinFunc tclBuiltinFuncTable[] = { +static const BuiltinFunc tclBuiltinFuncTable[] = { {"acos", 1}, {"asin", 1}, {"atan", 1}, diff --git a/generic/tclFileName.c b/generic/tclFileName.c index 1fca08b..4c57256 100644 --- a/generic/tclFileName.c +++ b/generic/tclFileName.c @@ -857,7 +857,7 @@ TclpNativeJoinPath( if (length > 0 && (start[length-1] != '/')) { Tcl_AppendToObj(prefix, "/", 1); - length++; + Tcl_GetStringFromObj(prefix, &length); } needsSep = 0; @@ -893,7 +893,7 @@ TclpNativeJoinPath( if ((length > 0) && (start[length-1] != '/') && (start[length-1] != ':')) { Tcl_AppendToObj(prefix, "/", 1); - length++; + Tcl_GetStringFromObj(prefix, &length); } needsSep = 0; diff --git a/generic/tclGetDate.y b/generic/tclGetDate.y index e22e40c..551b1ed 100644 --- a/generic/tclGetDate.y +++ b/generic/tclGetDate.y @@ -510,7 +510,7 @@ MODULE_SCOPE int yynerrs; * Month and day table. */ -static TABLE MonthDayTable[] = { +static const TABLE MonthDayTable[] = { { "january", tMONTH, 1 }, { "february", tMONTH, 2 }, { "march", tMONTH, 3 }, @@ -542,7 +542,7 @@ static TABLE MonthDayTable[] = { * Time units table. */ -static TABLE UnitsTable[] = { +static const TABLE UnitsTable[] = { { "year", tMONTH_UNIT, 12 }, { "month", tMONTH_UNIT, 1 }, { "fortnight", tDAY_UNIT, 14 }, @@ -560,7 +560,7 @@ static TABLE UnitsTable[] = { * Assorted relative-time words. */ -static TABLE OtherTable[] = { +static const TABLE OtherTable[] = { { "tomorrow", tDAY_UNIT, 1 }, { "yesterday", tDAY_UNIT, -1 }, { "today", tDAY_UNIT, 0 }, @@ -593,7 +593,7 @@ static TABLE OtherTable[] = { * point constants to work around an SGI compiler bug). */ -static TABLE TimezoneTable[] = { +static const TABLE TimezoneTable[] = { { "gmt", tZONE, HOUR( 0) }, /* Greenwich Mean */ { "ut", tZONE, HOUR( 0) }, /* Universal (Coordinated) */ { "utc", tZONE, HOUR( 0) }, @@ -678,7 +678,7 @@ static TABLE TimezoneTable[] = { * Military timezone table. */ -static TABLE MilitaryTable[] = { +static const TABLE MilitaryTable[] = { { "a", tZONE, -HOUR( 1) }, { "b", tZONE, -HOUR( 2) }, { "c", tZONE, -HOUR( 3) }, @@ -771,7 +771,7 @@ LookupWord( { register char *p; register char *q; - register TABLE *tp; + register const TABLE *tp; int i, abbrev; /* diff --git a/generic/tclIO.c b/generic/tclIO.c index 0f01baa..b9fa18d 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -8401,7 +8401,7 @@ Tcl_FileEventObjCmd( int modeIndex; /* Index of mode argument. */ int mask; static const char *modeOptions[] = {"readable", "writable", NULL}; - static int maskArray[] = {TCL_READABLE, TCL_WRITABLE}; + static CONST int maskArray[] = {TCL_READABLE, TCL_WRITABLE}; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 1, objv, "channelId event ?script?"); diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index 0c05cbf..21dcd71 100644 --- a/generic/tclIOCmd.c +++ b/generic/tclIOCmd.c @@ -518,7 +518,7 @@ Tcl_SeekObjCmd( static const char *originOptions[] = { "start", "current", "end", NULL }; - static int modeArray[] = {SEEK_SET, SEEK_CUR, SEEK_END}; + static CONST int modeArray[] = {SEEK_SET, SEEK_CUR, SEEK_END}; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 1, objv, "channelId offset ?origin?"); diff --git a/generic/tclIOGT.c b/generic/tclIOGT.c index 5dae459..eed21fb 100644 --- a/generic/tclIOGT.c +++ b/generic/tclIOGT.c @@ -133,7 +133,7 @@ static Tcl_ChannelType transformChannelType = { TransformNotifyProc, /* Handling of events bubbling up. */ TransformWideSeekProc, /* Wide seek proc. */ NULL, /* Thread action. */ - NULL, /* Truncate. */ + NULL /* Truncate. */ }; /* diff --git a/generic/tclIOSock.c b/generic/tclIOSock.c index e259676..df7a13a 100644 --- a/generic/tclIOSock.c +++ b/generic/tclIOSock.c @@ -82,8 +82,8 @@ TclSockGetPort( */ #undef TclSockMinimumBuffers -#ifndef _WIN32 -# define SOCKET size_t +#if !defined(_WIN32) && !defined(__CYGWIN__) +# define SOCKET int #endif int diff --git a/generic/tclInt.decls b/generic/tclInt.decls index 859f491..694d271 100644 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -126,8 +126,8 @@ declare 25 { # } # Removed in 8.5 #declare 27 { -# int TclGetDate(char *p, Tcl_WideInt now, long zone, -# Tcl_WideInt *timePtr) +# int TclGetDate(char *p, unsigned long now, long zone, +# unsigned long *timePtr) #} declare 28 { Tcl_Channel TclpGetDefaultStdChannel(int type) @@ -187,7 +187,7 @@ declare 42 { } # Removed in Tcl 8.5a2 #declare 43 { -# int TclGlobalInvoke(Tcl_Interp *interp, int argc, const char **argv, +# int TclGlobalInvoke(Tcl_Interp *interp, int argc, CONST84 char **argv, # int flags) #} declare 44 { @@ -222,7 +222,7 @@ declare 51 { } # Removed in Tcl 8.5a2 #declare 52 { -# int TclInvoke(Tcl_Interp *interp, int argc, const char **argv, +# int TclInvoke(Tcl_Interp *interp, int argc, CONST84 char **argv, # int flags) #} declare 53 { @@ -421,9 +421,6 @@ declare 103 { declare 104 { int TclSockMinimumBuffersOld(int sock, int size) } -declare 110 {unix win} { - int TclSockMinimumBuffers(void *sock, int size) -} # Replaced by Tcl_FSStat in 8.4: #declare 105 { # int TclStat(const char *path, Tcl_StatBuf *buf) @@ -440,6 +437,9 @@ declare 108 { declare 109 { int TclUpdateReturnInfo(Interp *iPtr) } +declare 110 { + int TclSockMinimumBuffers(void *sock, int size) +} # Removed in 8.1: # declare 110 { # char *TclWordEnd(char *start, char *lastChar, int nested, int *semiPtr) @@ -732,6 +732,16 @@ declare 179 { Tcl_Obj *Tcl_GetStartupScript(const char **encodingNamePtr) } +# REMOVED +# Allocate lists without copying arrays +# declare 180 { +# Tcl_Obj *TclNewListObjDirect(int objc, Tcl_Obj **objv) +# } +#declare 181 { +# Tcl_Obj *TclDbNewListObjDirect(int objc, Tcl_Obj **objv, +# const char *file, int line) +#} + # TclpGmtime and TclpLocaltime promoted to the generic interface from unix declare 182 { @@ -963,23 +973,31 @@ declare 3 win { declare 4 win { HINSTANCE TclWinGetTclInstance(void) } +# new for 8.4.20+/8.5.12+ Cygwin only +declare 5 win { + int TclUnixWaitForFile(int fd, int mask, int timeout) +} # Removed in 8.1: # declare 5 win { # HINSTANCE TclWinLoadLibrary(char *name) # } declare 6 win { - u_short TclWinNToHS(u_short ns) + unsigned short TclWinNToHS(unsigned short ns) } declare 7 win { int TclWinSetSockOpt(SOCKET s, int level, int optname, const char *optval, int optlen) } declare 8 win { - unsigned long TclpGetPid(Tcl_Pid pid) + int TclpGetPid(Tcl_Pid pid) } 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 8.3.1 (for Win32s only) #declare 10 win { # int TclWinSynchSpawn(void *args, int type, void **trans, Tcl_Pid *pidPtr) @@ -1001,9 +1019,9 @@ declare 14 win { int TclpCreatePipe(TclFile *readPipe, TclFile *writePipe) } declare 15 win { - int TclpCreateProcess(Tcl_Interp *interp, int argc, const char **argv, - TclFile inputFile, TclFile outputFile, TclFile errorFile, - Tcl_Pid *pidPtr) + int TclpCreateProcess(Tcl_Interp *interp, int argc, + const char **argv, TclFile inputFile, TclFile outputFile, + TclFile errorFile, Tcl_Pid *pidPtr) } # Signature changed in 8.1: # declare 16 win { @@ -1021,7 +1039,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 permanently for 8.4 #declare 21 win { # void TclpAsyncMark(Tcl_AsyncHandler async) @@ -1065,13 +1086,11 @@ declare 29 win { # Pipe channel functions -# On non-cygwin, this is actually a reference to TclGetAndDetachPids declare 0 unix { - void TclWinConvertError(unsigned int errCode) + void TclGetAndDetachPids(Tcl_Interp *interp, Tcl_Channel chan) } -# On non-cygwin, this is actually a reference to TclpCloseFile declare 1 unix { - void TclWinConvertWSAError(unsigned int errCode) + int TclpCloseFile(TclFile file) } declare 2 unix { Tcl_Channel TclpCreateCommandChannel(TclFile readFile, @@ -1080,23 +1099,20 @@ declare 2 unix { declare 3 unix { int TclpCreatePipe(TclFile *readPipe, TclFile *writePipe) } -# On non-cygwin, this is actually a reference to TclpCreateProcess declare 4 unix { - void *TclWinGetTclInstance(void) + int TclpCreateProcess(Tcl_Interp *interp, int argc, + const char **argv, TclFile inputFile, TclFile outputFile, + TclFile errorFile, Tcl_Pid *pidPtr) } # Signature changed in 8.1: # declare 5 unix { # TclFile TclpCreateTempFile(char *contents, Tcl_DString *namePtr) # } - -# On non-cygwin, this is actually a reference to TclpMakeFile declare 6 unix { - unsigned short TclWinNToHS(unsigned short ns) + TclFile TclpMakeFile(Tcl_Channel channel, int direction) } -# On non-cygwin, this is actually a reference to TclpOpenFile declare 7 unix { - int TclWinSetSockOpt(void *s, int level, int optname, - const char *optval, int optlen) + TclFile TclpOpenFile(const char *fname, int mode) } declare 8 unix { int TclUnixWaitForFile(int fd, int mask, int timeout) @@ -1104,9 +1120,8 @@ declare 8 unix { # Added in 8.1: -# On non-cygwin, this is actually a reference to TclpCreateTempFile declare 9 unix { - int TclWinGetPlatformId(void) + TclFile TclpCreateTempFile(const char *contents) } # Added in 8.4: @@ -1116,11 +1131,9 @@ declare 10 unix { } # Slots 11 and 12 are forwarders for functions that were promoted to # generic Stubs -# On cygwin, this is actually a reference to TclGetAndDetachPids declare 11 unix { struct tm *TclpLocaltime_unix(const time_t *clock) } -# On cygwin, this is actually a reference to TclpCloseFile declare 12 unix { struct tm *TclpGmtime_unix(const time_t *clock) } @@ -1138,8 +1151,7 @@ declare 14 unix { ################################ # Mac OS X specific functions -#On cygwin, TclpCreateProcess is here -declare 15 {unix macosx} { +declare 15 macosx { int TclMacOSXGetFileAttribute(Tcl_Interp *interp, int objIndex, Tcl_Obj *fileName, Tcl_Obj **attributePtrPtr) } @@ -1151,44 +1163,17 @@ declare 17 macosx { int TclMacOSXCopyFileAttributes(const char *src, const char *dst, const Tcl_StatBuf *statBufPtr) } -#On cygwin, TclpMakeFile is here -declare 18 {unix macosx} { +declare 18 macosx { int TclMacOSXMatchType(Tcl_Interp *interp, const char *pathName, const char *fileName, Tcl_StatBuf *statBufPtr, Tcl_GlobTypeData *types) } -#On cygwin, TclpOpenFile is here -declare 19 {unix macosx} { +declare 19 macosx { void TclMacOSXNotifierAddRunLoopMode(const void *runLoopMode) } -declare 20 unix { - void TclWinAddProcess(void *hProcess, unsigned int id) -} -declare 22 unix { - TclFile TclpCreateTempFile(const char *contents) -} -declare 24 unix { - char *TclWinNoBackslash(char *path) -} -declare 26 unix { - void TclWinSetInterfaces(int wide) -} -declare 27 unix { - void TclWinFlushDirtyChannels(void) -} -declare 28 unix { - void TclWinResetInterfaces(void) -} declare 29 unix { int TclWinCPUID(unsigned int index, unsigned int *regs) } -declare 30 unix { - void TclGetAndDetachPids(Tcl_Interp *interp, Tcl_Channel chan) -} -declare 31 unix { - int TclpCloseFile(TclFile file) -} - # Local Variables: # mode: tcl diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h index 365f529..3ccc50a 100644 --- a/generic/tclIntDecls.h +++ b/generic/tclIntDecls.h @@ -456,27 +456,11 @@ EXTERN void TclTeardownNamespace(Namespace *nsPtr); /* 109 */ EXTERN int TclUpdateReturnInfo(Interp *iPtr); #endif -#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ #ifndef TclSockMinimumBuffers_TCL_DECLARED #define TclSockMinimumBuffers_TCL_DECLARED /* 110 */ EXTERN int TclSockMinimumBuffers(VOID *sock, int size); #endif -#endif /* UNIX */ -#ifdef __WIN32__ /* WIN */ -#ifndef TclSockMinimumBuffers_TCL_DECLARED -#define TclSockMinimumBuffers_TCL_DECLARED -/* 110 */ -EXTERN int TclSockMinimumBuffers(VOID *sock, int size); -#endif -#endif /* WIN */ -#ifdef MAC_OSX_TCL /* MACOSX */ -#ifndef TclSockMinimumBuffers_TCL_DECLARED -#define TclSockMinimumBuffers_TCL_DECLARED -/* 110 */ -EXTERN int TclSockMinimumBuffers(VOID *sock, int size); -#endif -#endif /* MACOSX */ #ifndef Tcl_AddInterpResolvers_TCL_DECLARED #define Tcl_AddInterpResolvers_TCL_DECLARED /* 111 */ @@ -1184,15 +1168,7 @@ typedef struct TclIntStubs { VOID *reserved107; void (*tclTeardownNamespace) (Namespace *nsPtr); /* 108 */ int (*tclUpdateReturnInfo) (Interp *iPtr); /* 109 */ -#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ int (*tclSockMinimumBuffers) (VOID *sock, int size); /* 110 */ -#endif /* UNIX */ -#ifdef __WIN32__ /* WIN */ - int (*tclSockMinimumBuffers) (VOID *sock, int size); /* 110 */ -#endif /* WIN */ -#ifdef MAC_OSX_TCL /* MACOSX */ - int (*tclSockMinimumBuffers) (VOID *sock, int size); /* 110 */ -#endif /* MACOSX */ void (*tcl_AddInterpResolvers) (Tcl_Interp *interp, CONST char *name, Tcl_ResolveCmdProc *cmdProc, Tcl_ResolveVarProc *varProc, Tcl_ResolveCompiledVarProc *compiledVarProc); /* 111 */ int (*tcl_AppendExportList) (Tcl_Interp *interp, Tcl_Namespace *nsPtr, Tcl_Obj *objPtr); /* 112 */ Tcl_Namespace * (*tcl_CreateNamespace) (Tcl_Interp *interp, CONST char *name, ClientData clientData, Tcl_NamespaceDeleteProc *deleteProc); /* 113 */ @@ -1641,24 +1617,10 @@ extern TclIntStubs *tclIntStubsPtr; #define TclUpdateReturnInfo \ (tclIntStubsPtr->tclUpdateReturnInfo) /* 109 */ #endif -#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ -#ifndef TclSockMinimumBuffers -#define TclSockMinimumBuffers \ - (tclIntStubsPtr->tclSockMinimumBuffers) /* 110 */ -#endif -#endif /* UNIX */ -#ifdef __WIN32__ /* WIN */ -#ifndef TclSockMinimumBuffers -#define TclSockMinimumBuffers \ - (tclIntStubsPtr->tclSockMinimumBuffers) /* 110 */ -#endif -#endif /* WIN */ -#ifdef MAC_OSX_TCL /* MACOSX */ #ifndef TclSockMinimumBuffers #define TclSockMinimumBuffers \ (tclIntStubsPtr->tclSockMinimumBuffers) /* 110 */ #endif -#endif /* MACOSX */ #ifndef Tcl_AddInterpResolvers #define Tcl_AddInterpResolvers \ (tclIntStubsPtr->tcl_AddInterpResolvers) /* 111 */ diff --git a/generic/tclIntPlatDecls.h b/generic/tclIntPlatDecls.h index b3976c8..b5783f8 100644 --- a/generic/tclIntPlatDecls.h +++ b/generic/tclIntPlatDecls.h @@ -13,6 +13,11 @@ #ifndef _TCLINTPLATDECLS #define _TCLINTPLATDECLS +#ifdef __WIN32__ +# define Tcl_DirEntry void +# define DIR void +#endif + #undef TCL_STORAGE_CLASS #ifdef BUILD_tcl # define TCL_STORAGE_CLASS DLLEXPORT @@ -24,16 +29,6 @@ # endif #endif -#if !defined(__WIN32__) /* UNIX */ -EXTERN int TclpCreateProcess(Tcl_Interp *interp, - int argc, CONST char **argv, TclFile inputFile, - TclFile outputFile, TclFile errorFile, Tcl_Pid *pidPtr); -EXTERN TclFile TclpMakeFile(Tcl_Channel channel, - int direction); -EXTERN TclFile TclpOpenFile(CONST char *fname, - int mode); -#endif - /* * WARNING: This file is automatically generated by the tools/genStubs.tcl * script. Any modifications to the function declarations below should be made @@ -46,16 +41,17 @@ EXTERN TclFile TclpOpenFile(CONST char *fname, * Exported function declarations: */ -#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ -#ifndef TclWinConvertError_TCL_DECLARED -#define TclWinConvertError_TCL_DECLARED +#if !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(MAC_OSX_TCL) /* UNIX */ +#ifndef TclGetAndDetachPids_TCL_DECLARED +#define TclGetAndDetachPids_TCL_DECLARED /* 0 */ -EXTERN void TclWinConvertError(unsigned int errCode); +EXTERN void TclGetAndDetachPids(Tcl_Interp *interp, + Tcl_Channel chan); #endif -#ifndef TclWinConvertWSAError_TCL_DECLARED -#define TclWinConvertWSAError_TCL_DECLARED +#ifndef TclpCloseFile_TCL_DECLARED +#define TclpCloseFile_TCL_DECLARED /* 1 */ -EXTERN void TclWinConvertWSAError(unsigned int errCode); +EXTERN int TclpCloseFile(TclFile file); #endif #ifndef TclpCreateCommandChannel_TCL_DECLARED #define TclpCreateCommandChannel_TCL_DECLARED @@ -69,32 +65,34 @@ EXTERN Tcl_Channel TclpCreateCommandChannel(TclFile readFile, /* 3 */ EXTERN int TclpCreatePipe(TclFile *readPipe, TclFile *writePipe); #endif -#ifndef TclWinGetTclInstance_TCL_DECLARED -#define TclWinGetTclInstance_TCL_DECLARED +#ifndef TclpCreateProcess_TCL_DECLARED +#define TclpCreateProcess_TCL_DECLARED /* 4 */ -EXTERN VOID * TclWinGetTclInstance(void); +EXTERN int TclpCreateProcess(Tcl_Interp *interp, int argc, + CONST char **argv, TclFile inputFile, + TclFile outputFile, TclFile errorFile, + Tcl_Pid *pidPtr); #endif /* Slot 5 is reserved */ -#ifndef TclWinNToHS_TCL_DECLARED -#define TclWinNToHS_TCL_DECLARED +#ifndef TclpMakeFile_TCL_DECLARED +#define TclpMakeFile_TCL_DECLARED /* 6 */ -EXTERN unsigned short TclWinNToHS(unsigned short ns); +EXTERN TclFile TclpMakeFile(Tcl_Channel channel, int direction); #endif -#ifndef TclWinSetSockOpt_TCL_DECLARED -#define TclWinSetSockOpt_TCL_DECLARED +#ifndef TclpOpenFile_TCL_DECLARED +#define TclpOpenFile_TCL_DECLARED /* 7 */ -EXTERN int TclWinSetSockOpt(VOID *s, int level, int optname, - CONST char *optval, int optlen); +EXTERN TclFile TclpOpenFile(CONST char *fname, int mode); #endif #ifndef TclUnixWaitForFile_TCL_DECLARED #define TclUnixWaitForFile_TCL_DECLARED /* 8 */ EXTERN int TclUnixWaitForFile(int fd, int mask, int timeout); #endif -#ifndef TclWinGetPlatformId_TCL_DECLARED -#define TclWinGetPlatformId_TCL_DECLARED +#ifndef TclpCreateTempFile_TCL_DECLARED +#define TclpCreateTempFile_TCL_DECLARED /* 9 */ -EXTERN int TclWinGetPlatformId(void); +EXTERN TclFile TclpCreateTempFile(CONST char *contents); #endif #ifndef TclpReaddir_TCL_DECLARED #define TclpReaddir_TCL_DECLARED @@ -123,80 +121,27 @@ EXTERN int TclUnixCopyFile(CONST char *src, CONST char *dst, CONST Tcl_StatBuf *statBufPtr, int dontCopyAtts); #endif -#ifndef TclMacOSXGetFileAttribute_TCL_DECLARED -#define TclMacOSXGetFileAttribute_TCL_DECLARED -/* 15 */ -EXTERN int TclMacOSXGetFileAttribute(Tcl_Interp *interp, - int objIndex, Tcl_Obj *fileName, - Tcl_Obj **attributePtrPtr); -#endif +/* Slot 15 is reserved */ /* Slot 16 is reserved */ /* Slot 17 is reserved */ -#ifndef TclMacOSXMatchType_TCL_DECLARED -#define TclMacOSXMatchType_TCL_DECLARED -/* 18 */ -EXTERN int TclMacOSXMatchType(Tcl_Interp *interp, - CONST char *pathName, CONST char *fileName, - Tcl_StatBuf *statBufPtr, - Tcl_GlobTypeData *types); -#endif -#ifndef TclMacOSXNotifierAddRunLoopMode_TCL_DECLARED -#define TclMacOSXNotifierAddRunLoopMode_TCL_DECLARED -/* 19 */ -EXTERN void TclMacOSXNotifierAddRunLoopMode( - CONST VOID *runLoopMode); -#endif -#ifndef TclWinAddProcess_TCL_DECLARED -#define TclWinAddProcess_TCL_DECLARED -/* 20 */ -EXTERN void TclWinAddProcess(VOID *hProcess, unsigned int id); -#endif +/* Slot 18 is reserved */ +/* Slot 19 is reserved */ +/* Slot 20 is reserved */ /* Slot 21 is reserved */ -#ifndef TclpCreateTempFile_TCL_DECLARED -#define TclpCreateTempFile_TCL_DECLARED -/* 22 */ -EXTERN TclFile TclpCreateTempFile(CONST char *contents); -#endif +/* Slot 22 is reserved */ /* Slot 23 is reserved */ -#ifndef TclWinNoBackslash_TCL_DECLARED -#define TclWinNoBackslash_TCL_DECLARED -/* 24 */ -EXTERN char * TclWinNoBackslash(char *path); -#endif +/* Slot 24 is reserved */ /* Slot 25 is reserved */ -#ifndef TclWinSetInterfaces_TCL_DECLARED -#define TclWinSetInterfaces_TCL_DECLARED -/* 26 */ -EXTERN void TclWinSetInterfaces(int wide); -#endif -#ifndef TclWinFlushDirtyChannels_TCL_DECLARED -#define TclWinFlushDirtyChannels_TCL_DECLARED -/* 27 */ -EXTERN void TclWinFlushDirtyChannels(void); -#endif -#ifndef TclWinResetInterfaces_TCL_DECLARED -#define TclWinResetInterfaces_TCL_DECLARED -/* 28 */ -EXTERN void TclWinResetInterfaces(void); -#endif +/* Slot 26 is reserved */ +/* Slot 27 is reserved */ +/* Slot 28 is reserved */ #ifndef TclWinCPUID_TCL_DECLARED #define TclWinCPUID_TCL_DECLARED /* 29 */ EXTERN int TclWinCPUID(unsigned int index, unsigned int *regs); #endif -#ifndef TclGetAndDetachPids_TCL_DECLARED -#define TclGetAndDetachPids_TCL_DECLARED -/* 30 */ -EXTERN void TclGetAndDetachPids(Tcl_Interp *interp, - Tcl_Channel chan); -#endif -#ifndef TclpCloseFile_TCL_DECLARED -#define TclpCloseFile_TCL_DECLARED -/* 31 */ -EXTERN int TclpCloseFile(TclFile file); -#endif #endif /* UNIX */ -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ #ifndef TclWinConvertError_TCL_DECLARED #define TclWinConvertError_TCL_DECLARED /* 0 */ @@ -224,11 +169,15 @@ EXTERN int TclWinGetSockOpt(SOCKET s, int level, int optname, /* 4 */ EXTERN HINSTANCE TclWinGetTclInstance(void); #endif -/* Slot 5 is reserved */ +#ifndef TclUnixWaitForFile_TCL_DECLARED +#define TclUnixWaitForFile_TCL_DECLARED +/* 5 */ +EXTERN int TclUnixWaitForFile(int fd, int mask, int timeout); +#endif #ifndef TclWinNToHS_TCL_DECLARED #define TclWinNToHS_TCL_DECLARED /* 6 */ -EXTERN u_short TclWinNToHS(u_short ns); +EXTERN unsigned short TclWinNToHS(unsigned short ns); #endif #ifndef TclWinSetSockOpt_TCL_DECLARED #define TclWinSetSockOpt_TCL_DECLARED @@ -239,14 +188,18 @@ EXTERN int TclWinSetSockOpt(SOCKET s, int level, int optname, #ifndef TclpGetPid_TCL_DECLARED #define TclpGetPid_TCL_DECLARED /* 8 */ -EXTERN unsigned long TclpGetPid(Tcl_Pid pid); +EXTERN int TclpGetPid(Tcl_Pid pid); #endif #ifndef TclWinGetPlatformId_TCL_DECLARED #define TclWinGetPlatformId_TCL_DECLARED /* 9 */ EXTERN int TclWinGetPlatformId(void); #endif -/* Slot 10 is reserved */ +#ifndef TclpReaddir_TCL_DECLARED +#define TclpReaddir_TCL_DECLARED +/* 10 */ +EXTERN Tcl_DirEntry * TclpReaddir(DIR *dir); +#endif #ifndef TclGetAndDetachPids_TCL_DECLARED #define TclGetAndDetachPids_TCL_DECLARED /* 11 */ @@ -295,7 +248,11 @@ EXTERN TclFile TclpOpenFile(CONST char *fname, int mode); /* 20 */ EXTERN void TclWinAddProcess(HANDLE hProcess, DWORD id); #endif -/* Slot 21 is reserved */ +#ifndef TclpInetNtoa_TCL_DECLARED +#define TclpInetNtoa_TCL_DECLARED +/* 21 */ +EXTERN char * TclpInetNtoa(struct in_addr addr); +#endif #ifndef TclpCreateTempFile_TCL_DECLARED #define TclpCreateTempFile_TCL_DECLARED /* 22 */ @@ -334,15 +291,16 @@ EXTERN int TclWinCPUID(unsigned int index, unsigned int *regs); #endif #endif /* WIN */ #ifdef MAC_OSX_TCL /* MACOSX */ -#ifndef TclWinConvertError_TCL_DECLARED -#define TclWinConvertError_TCL_DECLARED +#ifndef TclGetAndDetachPids_TCL_DECLARED +#define TclGetAndDetachPids_TCL_DECLARED /* 0 */ -EXTERN void TclWinConvertError(unsigned int errCode); +EXTERN void TclGetAndDetachPids(Tcl_Interp *interp, + Tcl_Channel chan); #endif -#ifndef TclWinConvertWSAError_TCL_DECLARED -#define TclWinConvertWSAError_TCL_DECLARED +#ifndef TclpCloseFile_TCL_DECLARED +#define TclpCloseFile_TCL_DECLARED /* 1 */ -EXTERN void TclWinConvertWSAError(unsigned int errCode); +EXTERN int TclpCloseFile(TclFile file); #endif #ifndef TclpCreateCommandChannel_TCL_DECLARED #define TclpCreateCommandChannel_TCL_DECLARED @@ -356,32 +314,34 @@ EXTERN Tcl_Channel TclpCreateCommandChannel(TclFile readFile, /* 3 */ EXTERN int TclpCreatePipe(TclFile *readPipe, TclFile *writePipe); #endif -#ifndef TclWinGetTclInstance_TCL_DECLARED -#define TclWinGetTclInstance_TCL_DECLARED +#ifndef TclpCreateProcess_TCL_DECLARED +#define TclpCreateProcess_TCL_DECLARED /* 4 */ -EXTERN VOID * TclWinGetTclInstance(void); +EXTERN int TclpCreateProcess(Tcl_Interp *interp, int argc, + CONST char **argv, TclFile inputFile, + TclFile outputFile, TclFile errorFile, + Tcl_Pid *pidPtr); #endif /* Slot 5 is reserved */ -#ifndef TclWinNToHS_TCL_DECLARED -#define TclWinNToHS_TCL_DECLARED +#ifndef TclpMakeFile_TCL_DECLARED +#define TclpMakeFile_TCL_DECLARED /* 6 */ -EXTERN unsigned short TclWinNToHS(unsigned short ns); +EXTERN TclFile TclpMakeFile(Tcl_Channel channel, int direction); #endif -#ifndef TclWinSetSockOpt_TCL_DECLARED -#define TclWinSetSockOpt_TCL_DECLARED +#ifndef TclpOpenFile_TCL_DECLARED +#define TclpOpenFile_TCL_DECLARED /* 7 */ -EXTERN int TclWinSetSockOpt(VOID *s, int level, int optname, - CONST char *optval, int optlen); +EXTERN TclFile TclpOpenFile(CONST char *fname, int mode); #endif #ifndef TclUnixWaitForFile_TCL_DECLARED #define TclUnixWaitForFile_TCL_DECLARED /* 8 */ EXTERN int TclUnixWaitForFile(int fd, int mask, int timeout); #endif -#ifndef TclWinGetPlatformId_TCL_DECLARED -#define TclWinGetPlatformId_TCL_DECLARED +#ifndef TclpCreateTempFile_TCL_DECLARED +#define TclpCreateTempFile_TCL_DECLARED /* 9 */ -EXTERN int TclWinGetPlatformId(void); +EXTERN TclFile TclpCreateTempFile(CONST char *contents); #endif #ifndef TclpReaddir_TCL_DECLARED #define TclpReaddir_TCL_DECLARED @@ -445,107 +405,70 @@ EXTERN int TclMacOSXMatchType(Tcl_Interp *interp, EXTERN void TclMacOSXNotifierAddRunLoopMode( CONST VOID *runLoopMode); #endif -#ifndef TclWinAddProcess_TCL_DECLARED -#define TclWinAddProcess_TCL_DECLARED -/* 20 */ -EXTERN void TclWinAddProcess(VOID *hProcess, unsigned int id); -#endif +/* Slot 20 is reserved */ /* Slot 21 is reserved */ -#ifndef TclpCreateTempFile_TCL_DECLARED -#define TclpCreateTempFile_TCL_DECLARED -/* 22 */ -EXTERN TclFile TclpCreateTempFile(CONST char *contents); -#endif +/* Slot 22 is reserved */ /* Slot 23 is reserved */ -#ifndef TclWinNoBackslash_TCL_DECLARED -#define TclWinNoBackslash_TCL_DECLARED -/* 24 */ -EXTERN char * TclWinNoBackslash(char *path); -#endif +/* Slot 24 is reserved */ /* Slot 25 is reserved */ -#ifndef TclWinSetInterfaces_TCL_DECLARED -#define TclWinSetInterfaces_TCL_DECLARED -/* 26 */ -EXTERN void TclWinSetInterfaces(int wide); -#endif -#ifndef TclWinFlushDirtyChannels_TCL_DECLARED -#define TclWinFlushDirtyChannels_TCL_DECLARED -/* 27 */ -EXTERN void TclWinFlushDirtyChannels(void); -#endif -#ifndef TclWinResetInterfaces_TCL_DECLARED -#define TclWinResetInterfaces_TCL_DECLARED -/* 28 */ -EXTERN void TclWinResetInterfaces(void); -#endif +/* Slot 26 is reserved */ +/* Slot 27 is reserved */ +/* Slot 28 is reserved */ #ifndef TclWinCPUID_TCL_DECLARED #define TclWinCPUID_TCL_DECLARED /* 29 */ EXTERN int TclWinCPUID(unsigned int index, unsigned int *regs); #endif -#ifndef TclGetAndDetachPids_TCL_DECLARED -#define TclGetAndDetachPids_TCL_DECLARED -/* 30 */ -EXTERN void TclGetAndDetachPids(Tcl_Interp *interp, - Tcl_Channel chan); -#endif -#ifndef TclpCloseFile_TCL_DECLARED -#define TclpCloseFile_TCL_DECLARED -/* 31 */ -EXTERN int TclpCloseFile(TclFile file); -#endif #endif /* MACOSX */ typedef struct TclIntPlatStubs { int magic; struct TclIntPlatStubHooks *hooks; -#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ - void (*tclWinConvertError) (unsigned int errCode); /* 0 */ - void (*tclWinConvertWSAError) (unsigned int errCode); /* 1 */ +#if !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(MAC_OSX_TCL) /* UNIX */ + void (*tclGetAndDetachPids) (Tcl_Interp *interp, Tcl_Channel chan); /* 0 */ + int (*tclpCloseFile) (TclFile file); /* 1 */ Tcl_Channel (*tclpCreateCommandChannel) (TclFile readFile, TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr); /* 2 */ int (*tclpCreatePipe) (TclFile *readPipe, TclFile *writePipe); /* 3 */ - VOID * (*tclWinGetTclInstance) (void); /* 4 */ + int (*tclpCreateProcess) (Tcl_Interp *interp, int argc, CONST char **argv, TclFile inputFile, TclFile outputFile, TclFile errorFile, Tcl_Pid *pidPtr); /* 4 */ VOID *reserved5; - unsigned short (*tclWinNToHS) (unsigned short ns); /* 6 */ - int (*tclWinSetSockOpt) (VOID *s, int level, int optname, CONST char *optval, int optlen); /* 7 */ + TclFile (*tclpMakeFile) (Tcl_Channel channel, int direction); /* 6 */ + TclFile (*tclpOpenFile) (CONST char *fname, int mode); /* 7 */ int (*tclUnixWaitForFile) (int fd, int mask, int timeout); /* 8 */ - int (*tclWinGetPlatformId) (void); /* 9 */ + TclFile (*tclpCreateTempFile) (CONST char *contents); /* 9 */ Tcl_DirEntry * (*tclpReaddir) (DIR *dir); /* 10 */ struct tm * (*tclpLocaltime_unix) (CONST time_t *clock); /* 11 */ struct tm * (*tclpGmtime_unix) (CONST time_t *clock); /* 12 */ char * (*tclpInetNtoa) (struct in_addr addr); /* 13 */ 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 */ + VOID *reserved15; VOID *reserved16; VOID *reserved17; - int (*tclMacOSXMatchType) (Tcl_Interp *interp, CONST char *pathName, CONST char *fileName, Tcl_StatBuf *statBufPtr, Tcl_GlobTypeData *types); /* 18 */ - void (*tclMacOSXNotifierAddRunLoopMode) (CONST VOID *runLoopMode); /* 19 */ - void (*tclWinAddProcess) (VOID *hProcess, unsigned int id); /* 20 */ + VOID *reserved18; + VOID *reserved19; + VOID *reserved20; VOID *reserved21; - TclFile (*tclpCreateTempFile) (CONST char *contents); /* 22 */ + VOID *reserved22; VOID *reserved23; - char * (*tclWinNoBackslash) (char *path); /* 24 */ + VOID *reserved24; VOID *reserved25; - void (*tclWinSetInterfaces) (int wide); /* 26 */ - void (*tclWinFlushDirtyChannels) (void); /* 27 */ - void (*tclWinResetInterfaces) (void); /* 28 */ + VOID *reserved26; + VOID *reserved27; + VOID *reserved28; int (*tclWinCPUID) (unsigned int index, unsigned int *regs); /* 29 */ - void (*tclGetAndDetachPids) (Tcl_Interp *interp, Tcl_Channel chan); /* 30 */ - int (*tclpCloseFile) (TclFile file); /* 31 */ #endif /* UNIX */ -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ void (*tclWinConvertError) (DWORD errCode); /* 0 */ void (*tclWinConvertWSAError) (DWORD errCode); /* 1 */ struct servent * (*tclWinGetServByName) (CONST char *nm, CONST char *proto); /* 2 */ int (*tclWinGetSockOpt) (SOCKET s, int level, int optname, char *optval, int *optlen); /* 3 */ HINSTANCE (*tclWinGetTclInstance) (void); /* 4 */ - VOID *reserved5; - u_short (*tclWinNToHS) (u_short ns); /* 6 */ + int (*tclUnixWaitForFile) (int fd, int mask, int timeout); /* 5 */ + unsigned short (*tclWinNToHS) (unsigned short ns); /* 6 */ int (*tclWinSetSockOpt) (SOCKET s, int level, int optname, CONST char *optval, int optlen); /* 7 */ - unsigned long (*tclpGetPid) (Tcl_Pid pid); /* 8 */ + int (*tclpGetPid) (Tcl_Pid pid); /* 8 */ int (*tclWinGetPlatformId) (void); /* 9 */ - VOID *reserved10; + Tcl_DirEntry * (*tclpReaddir) (DIR *dir); /* 10 */ 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 */ @@ -556,7 +479,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 */ - VOID *reserved21; + char * (*tclpInetNtoa) (struct in_addr addr); /* 21 */ TclFile (*tclpCreateTempFile) (CONST char *contents); /* 22 */ char * (*tclpGetTZName) (int isdst); /* 23 */ char * (*tclWinNoBackslash) (char *path); /* 24 */ @@ -567,16 +490,16 @@ typedef struct TclIntPlatStubs { int (*tclWinCPUID) (unsigned int index, unsigned int *regs); /* 29 */ #endif /* WIN */ #ifdef MAC_OSX_TCL /* MACOSX */ - void (*tclWinConvertError) (unsigned int errCode); /* 0 */ - void (*tclWinConvertWSAError) (unsigned int errCode); /* 1 */ + void (*tclGetAndDetachPids) (Tcl_Interp *interp, Tcl_Channel chan); /* 0 */ + int (*tclpCloseFile) (TclFile file); /* 1 */ Tcl_Channel (*tclpCreateCommandChannel) (TclFile readFile, TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr); /* 2 */ int (*tclpCreatePipe) (TclFile *readPipe, TclFile *writePipe); /* 3 */ - VOID * (*tclWinGetTclInstance) (void); /* 4 */ + int (*tclpCreateProcess) (Tcl_Interp *interp, int argc, CONST char **argv, TclFile inputFile, TclFile outputFile, TclFile errorFile, Tcl_Pid *pidPtr); /* 4 */ VOID *reserved5; - unsigned short (*tclWinNToHS) (unsigned short ns); /* 6 */ - int (*tclWinSetSockOpt) (VOID *s, int level, int optname, CONST char *optval, int optlen); /* 7 */ + TclFile (*tclpMakeFile) (Tcl_Channel channel, int direction); /* 6 */ + TclFile (*tclpOpenFile) (CONST char *fname, int mode); /* 7 */ int (*tclUnixWaitForFile) (int fd, int mask, int timeout); /* 8 */ - int (*tclWinGetPlatformId) (void); /* 9 */ + TclFile (*tclpCreateTempFile) (CONST char *contents); /* 9 */ Tcl_DirEntry * (*tclpReaddir) (DIR *dir); /* 10 */ struct tm * (*tclpLocaltime_unix) (CONST time_t *clock); /* 11 */ struct tm * (*tclpGmtime_unix) (CONST time_t *clock); /* 12 */ @@ -587,18 +510,16 @@ typedef struct TclIntPlatStubs { int (*tclMacOSXCopyFileAttributes) (CONST char *src, CONST char *dst, CONST Tcl_StatBuf *statBufPtr); /* 17 */ int (*tclMacOSXMatchType) (Tcl_Interp *interp, CONST char *pathName, CONST char *fileName, Tcl_StatBuf *statBufPtr, Tcl_GlobTypeData *types); /* 18 */ void (*tclMacOSXNotifierAddRunLoopMode) (CONST VOID *runLoopMode); /* 19 */ - void (*tclWinAddProcess) (VOID *hProcess, unsigned int id); /* 20 */ + VOID *reserved20; VOID *reserved21; - TclFile (*tclpCreateTempFile) (CONST char *contents); /* 22 */ + VOID *reserved22; VOID *reserved23; - char * (*tclWinNoBackslash) (char *path); /* 24 */ + VOID *reserved24; VOID *reserved25; - void (*tclWinSetInterfaces) (int wide); /* 26 */ - void (*tclWinFlushDirtyChannels) (void); /* 27 */ - void (*tclWinResetInterfaces) (void); /* 28 */ + VOID *reserved26; + VOID *reserved27; + VOID *reserved28; int (*tclWinCPUID) (unsigned int index, unsigned int *regs); /* 29 */ - void (*tclGetAndDetachPids) (Tcl_Interp *interp, Tcl_Channel chan); /* 30 */ - int (*tclpCloseFile) (TclFile file); /* 31 */ #endif /* MACOSX */ } TclIntPlatStubs; @@ -616,14 +537,14 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; * Inline function declarations: */ -#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ -#ifndef TclWinConvertError -#define TclWinConvertError \ - (tclIntPlatStubsPtr->tclWinConvertError) /* 0 */ +#if !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(MAC_OSX_TCL) /* UNIX */ +#ifndef TclGetAndDetachPids +#define TclGetAndDetachPids \ + (tclIntPlatStubsPtr->tclGetAndDetachPids) /* 0 */ #endif -#ifndef TclWinConvertWSAError -#define TclWinConvertWSAError \ - (tclIntPlatStubsPtr->tclWinConvertWSAError) /* 1 */ +#ifndef TclpCloseFile +#define TclpCloseFile \ + (tclIntPlatStubsPtr->tclpCloseFile) /* 1 */ #endif #ifndef TclpCreateCommandChannel #define TclpCreateCommandChannel \ @@ -633,26 +554,26 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #define TclpCreatePipe \ (tclIntPlatStubsPtr->tclpCreatePipe) /* 3 */ #endif -#ifndef TclWinGetTclInstance -#define TclWinGetTclInstance \ - (tclIntPlatStubsPtr->tclWinGetTclInstance) /* 4 */ +#ifndef TclpCreateProcess +#define TclpCreateProcess \ + (tclIntPlatStubsPtr->tclpCreateProcess) /* 4 */ #endif /* Slot 5 is reserved */ -#ifndef TclWinNToHS -#define TclWinNToHS \ - (tclIntPlatStubsPtr->tclWinNToHS) /* 6 */ +#ifndef TclpMakeFile +#define TclpMakeFile \ + (tclIntPlatStubsPtr->tclpMakeFile) /* 6 */ #endif -#ifndef TclWinSetSockOpt -#define TclWinSetSockOpt \ - (tclIntPlatStubsPtr->tclWinSetSockOpt) /* 7 */ +#ifndef TclpOpenFile +#define TclpOpenFile \ + (tclIntPlatStubsPtr->tclpOpenFile) /* 7 */ #endif #ifndef TclUnixWaitForFile #define TclUnixWaitForFile \ (tclIntPlatStubsPtr->tclUnixWaitForFile) /* 8 */ #endif -#ifndef TclWinGetPlatformId -#define TclWinGetPlatformId \ - (tclIntPlatStubsPtr->tclWinGetPlatformId) /* 9 */ +#ifndef TclpCreateTempFile +#define TclpCreateTempFile \ + (tclIntPlatStubsPtr->tclpCreateTempFile) /* 9 */ #endif #ifndef TclpReaddir #define TclpReaddir \ @@ -674,61 +595,26 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #define TclUnixCopyFile \ (tclIntPlatStubsPtr->tclUnixCopyFile) /* 14 */ #endif -#ifndef TclMacOSXGetFileAttribute -#define TclMacOSXGetFileAttribute \ - (tclIntPlatStubsPtr->tclMacOSXGetFileAttribute) /* 15 */ -#endif +/* Slot 15 is reserved */ /* Slot 16 is reserved */ /* Slot 17 is reserved */ -#ifndef TclMacOSXMatchType -#define TclMacOSXMatchType \ - (tclIntPlatStubsPtr->tclMacOSXMatchType) /* 18 */ -#endif -#ifndef TclMacOSXNotifierAddRunLoopMode -#define TclMacOSXNotifierAddRunLoopMode \ - (tclIntPlatStubsPtr->tclMacOSXNotifierAddRunLoopMode) /* 19 */ -#endif -#ifndef TclWinAddProcess -#define TclWinAddProcess \ - (tclIntPlatStubsPtr->tclWinAddProcess) /* 20 */ -#endif +/* Slot 18 is reserved */ +/* Slot 19 is reserved */ +/* Slot 20 is reserved */ /* Slot 21 is reserved */ -#ifndef TclpCreateTempFile -#define TclpCreateTempFile \ - (tclIntPlatStubsPtr->tclpCreateTempFile) /* 22 */ -#endif +/* Slot 22 is reserved */ /* Slot 23 is reserved */ -#ifndef TclWinNoBackslash -#define TclWinNoBackslash \ - (tclIntPlatStubsPtr->tclWinNoBackslash) /* 24 */ -#endif +/* Slot 24 is reserved */ /* Slot 25 is reserved */ -#ifndef TclWinSetInterfaces -#define TclWinSetInterfaces \ - (tclIntPlatStubsPtr->tclWinSetInterfaces) /* 26 */ -#endif -#ifndef TclWinFlushDirtyChannels -#define TclWinFlushDirtyChannels \ - (tclIntPlatStubsPtr->tclWinFlushDirtyChannels) /* 27 */ -#endif -#ifndef TclWinResetInterfaces -#define TclWinResetInterfaces \ - (tclIntPlatStubsPtr->tclWinResetInterfaces) /* 28 */ -#endif +/* Slot 26 is reserved */ +/* Slot 27 is reserved */ +/* Slot 28 is reserved */ #ifndef TclWinCPUID #define TclWinCPUID \ (tclIntPlatStubsPtr->tclWinCPUID) /* 29 */ #endif -#ifndef TclGetAndDetachPids -#define TclGetAndDetachPids \ - (tclIntPlatStubsPtr->tclGetAndDetachPids) /* 30 */ -#endif -#ifndef TclpCloseFile -#define TclpCloseFile \ - (tclIntPlatStubsPtr->tclpCloseFile) /* 31 */ -#endif #endif /* UNIX */ -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ #ifndef TclWinConvertError #define TclWinConvertError \ (tclIntPlatStubsPtr->tclWinConvertError) /* 0 */ @@ -749,7 +635,10 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #define TclWinGetTclInstance \ (tclIntPlatStubsPtr->tclWinGetTclInstance) /* 4 */ #endif -/* Slot 5 is reserved */ +#ifndef TclUnixWaitForFile +#define TclUnixWaitForFile \ + (tclIntPlatStubsPtr->tclUnixWaitForFile) /* 5 */ +#endif #ifndef TclWinNToHS #define TclWinNToHS \ (tclIntPlatStubsPtr->tclWinNToHS) /* 6 */ @@ -766,7 +655,10 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #define TclWinGetPlatformId \ (tclIntPlatStubsPtr->tclWinGetPlatformId) /* 9 */ #endif -/* Slot 10 is reserved */ +#ifndef TclpReaddir +#define TclpReaddir \ + (tclIntPlatStubsPtr->tclpReaddir) /* 10 */ +#endif #ifndef TclGetAndDetachPids #define TclGetAndDetachPids \ (tclIntPlatStubsPtr->tclGetAndDetachPids) /* 11 */ @@ -801,7 +693,10 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #define TclWinAddProcess \ (tclIntPlatStubsPtr->tclWinAddProcess) /* 20 */ #endif -/* Slot 21 is reserved */ +#ifndef TclpInetNtoa +#define TclpInetNtoa \ + (tclIntPlatStubsPtr->tclpInetNtoa) /* 21 */ +#endif #ifndef TclpCreateTempFile #define TclpCreateTempFile \ (tclIntPlatStubsPtr->tclpCreateTempFile) /* 22 */ @@ -833,13 +728,13 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #endif #endif /* WIN */ #ifdef MAC_OSX_TCL /* MACOSX */ -#ifndef TclWinConvertError -#define TclWinConvertError \ - (tclIntPlatStubsPtr->tclWinConvertError) /* 0 */ +#ifndef TclGetAndDetachPids +#define TclGetAndDetachPids \ + (tclIntPlatStubsPtr->tclGetAndDetachPids) /* 0 */ #endif -#ifndef TclWinConvertWSAError -#define TclWinConvertWSAError \ - (tclIntPlatStubsPtr->tclWinConvertWSAError) /* 1 */ +#ifndef TclpCloseFile +#define TclpCloseFile \ + (tclIntPlatStubsPtr->tclpCloseFile) /* 1 */ #endif #ifndef TclpCreateCommandChannel #define TclpCreateCommandChannel \ @@ -849,26 +744,26 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #define TclpCreatePipe \ (tclIntPlatStubsPtr->tclpCreatePipe) /* 3 */ #endif -#ifndef TclWinGetTclInstance -#define TclWinGetTclInstance \ - (tclIntPlatStubsPtr->tclWinGetTclInstance) /* 4 */ +#ifndef TclpCreateProcess +#define TclpCreateProcess \ + (tclIntPlatStubsPtr->tclpCreateProcess) /* 4 */ #endif /* Slot 5 is reserved */ -#ifndef TclWinNToHS -#define TclWinNToHS \ - (tclIntPlatStubsPtr->tclWinNToHS) /* 6 */ +#ifndef TclpMakeFile +#define TclpMakeFile \ + (tclIntPlatStubsPtr->tclpMakeFile) /* 6 */ #endif -#ifndef TclWinSetSockOpt -#define TclWinSetSockOpt \ - (tclIntPlatStubsPtr->tclWinSetSockOpt) /* 7 */ +#ifndef TclpOpenFile +#define TclpOpenFile \ + (tclIntPlatStubsPtr->tclpOpenFile) /* 7 */ #endif #ifndef TclUnixWaitForFile #define TclUnixWaitForFile \ (tclIntPlatStubsPtr->tclUnixWaitForFile) /* 8 */ #endif -#ifndef TclWinGetPlatformId -#define TclWinGetPlatformId \ - (tclIntPlatStubsPtr->tclWinGetPlatformId) /* 9 */ +#ifndef TclpCreateTempFile +#define TclpCreateTempFile \ + (tclIntPlatStubsPtr->tclpCreateTempFile) /* 9 */ #endif #ifndef TclpReaddir #define TclpReaddir \ @@ -910,45 +805,19 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #define TclMacOSXNotifierAddRunLoopMode \ (tclIntPlatStubsPtr->tclMacOSXNotifierAddRunLoopMode) /* 19 */ #endif -#ifndef TclWinAddProcess -#define TclWinAddProcess \ - (tclIntPlatStubsPtr->tclWinAddProcess) /* 20 */ -#endif +/* Slot 20 is reserved */ /* Slot 21 is reserved */ -#ifndef TclpCreateTempFile -#define TclpCreateTempFile \ - (tclIntPlatStubsPtr->tclpCreateTempFile) /* 22 */ -#endif +/* Slot 22 is reserved */ /* Slot 23 is reserved */ -#ifndef TclWinNoBackslash -#define TclWinNoBackslash \ - (tclIntPlatStubsPtr->tclWinNoBackslash) /* 24 */ -#endif +/* Slot 24 is reserved */ /* Slot 25 is reserved */ -#ifndef TclWinSetInterfaces -#define TclWinSetInterfaces \ - (tclIntPlatStubsPtr->tclWinSetInterfaces) /* 26 */ -#endif -#ifndef TclWinFlushDirtyChannels -#define TclWinFlushDirtyChannels \ - (tclIntPlatStubsPtr->tclWinFlushDirtyChannels) /* 27 */ -#endif -#ifndef TclWinResetInterfaces -#define TclWinResetInterfaces \ - (tclIntPlatStubsPtr->tclWinResetInterfaces) /* 28 */ -#endif +/* Slot 26 is reserved */ +/* Slot 27 is reserved */ +/* Slot 28 is reserved */ #ifndef TclWinCPUID #define TclWinCPUID \ (tclIntPlatStubsPtr->tclWinCPUID) /* 29 */ #endif -#ifndef TclGetAndDetachPids -#define TclGetAndDetachPids \ - (tclIntPlatStubsPtr->tclGetAndDetachPids) /* 30 */ -#endif -#ifndef TclpCloseFile -#define TclpCloseFile \ - (tclIntPlatStubsPtr->tclpCloseFile) /* 31 */ -#endif #endif /* MACOSX */ #endif /* defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS) */ @@ -960,35 +829,9 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #undef TclpLocaltime_unix #undef TclpGmtime_unix -#if !defined(__WIN32__) && defined(USE_TCL_STUBS) -# ifdef __CYGWIN__ -# define TclpCreateProcess ((int (*) _ANSI_ARGS_((Tcl_Interp *, int, \ - CONST char **, TclFile, TclFile, TclFile, Tcl_Pid *))) \ - tclIntPlatStubsPtr->tclMacOSXGetFileAttribute) -# define TclpMakeFile ((TclFile (*) _ANSI_ARGS_((Tcl_Channel channel, \ - int direction))) tclIntPlatStubsPtr->tclMacOSXMatchType) -# define TclpOpenFile ((TclFile (*) _ANSI_ARGS_((CONST char *, int))) \ - tclIntPlatStubsPtr->tclMacOSXNotifierAddRunLoopMode) -# else -# define TclpCreateProcess ((int (*) _ANSI_ARGS_((Tcl_Interp *, int, \ - CONST char **, TclFile, TclFile, TclFile, Tcl_Pid *))) \ - tclIntPlatStubsPtr->tclWinGetTclInstance) -# define TclpMakeFile ((TclFile (*) _ANSI_ARGS_((Tcl_Channel channel, \ - int direction))) tclIntPlatStubsPtr->tclWinNToHS) -# define TclpOpenFile ((TclFile (*) _ANSI_ARGS_((CONST char *, int))) \ - tclIntPlatStubsPtr->tclWinNToHS) - -# undef TclpCreateTempFile -# undef TclGetAndDetachPids -# undef TclpCloseFile - -# define TclpCreateTempFile ((TclFile (*) _ANSI_ARGS_((CONST char *))) \ - tclIntPlatStubsPtr->tclWinGetPlatformId) -# define TclGetAndDetachPids ((void (*) _ANSI_ARGS_((Tcl_Interp *, Tcl_Channel))) \ - tclIntPlatStubsPtr->tclWinConvertError) -# define TclpCloseFile ((int (*) _ANSI_ARGS_((TclFile))) \ - tclIntPlatStubsPtr->tclWinConvertWSAError) -# endif +#if !defined(__WIN32__) && !defined(__CYGWIN__) +# undef TclpGetPid +# define TclpGetPid(pid) ((unsigned long) (pid)) #endif #endif /* _TCLINTPLATDECLS */ diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index b6f3205..cde554c 100644 --- a/generic/tclPathObj.c +++ b/generic/tclPathObj.c @@ -1091,7 +1091,7 @@ Tcl_FSJoinPath( if (length > 0 && ptr[length -1] != '/') { Tcl_AppendToObj(res, &separator, 1); - length++; + Tcl_GetStringFromObj(res, &length); } Tcl_SetObjLength(res, length + (int) strlen(strElt)); diff --git a/generic/tclPipe.c b/generic/tclPipe.c index dd70e5e..698f85d 100644 --- a/generic/tclPipe.c +++ b/generic/tclPipe.c @@ -280,7 +280,7 @@ TclCleanupChildren( for (i = 0; i < numPids; i++) { /* * We need to get the resolved pid before we wait on it as the windows - * implimentation of Tcl_WaitPid deletes the information such that any + * implementation of Tcl_WaitPid deletes the information such that any * following calls to TclpGetPid fail. */ diff --git a/generic/tclPlatDecls.h b/generic/tclPlatDecls.h index d52a736..8652e8d 100644 --- a/generic/tclPlatDecls.h +++ b/generic/tclPlatDecls.h @@ -22,19 +22,16 @@ #endif /* - * Pull in the typedef of TCHAR for windows. + * TCHAR is needed here for win32, so if it is not defined yet do it here. + * This way, we don't need to include <tchar.h> just for one define. */ -#if defined(__WIN32__) && !defined(_TCHAR_DEFINED) -# include <tchar.h> -# ifndef _TCHAR_DEFINED - /* Borland seems to forget to set this. */ - typedef _TCHAR TCHAR; -# define _TCHAR_DEFINED -# endif -# if defined(_MSC_VER) && defined(__STDC__) - /* VS2005 SP1 misses this. See [Bug #3110161] */ - typedef _TCHAR TCHAR; +#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(_TCHAR_DEFINED) +# if defined(_UNICODE) + typedef wchar_t TCHAR; +# else + typedef char TCHAR; # endif +# define _TCHAR_DEFINED #endif /* !BEGIN!: Do not edit below this line. */ @@ -43,25 +40,7 @@ * Exported function declarations: */ -#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ -#ifndef Tcl_MacOSXOpenBundleResources_TCL_DECLARED -#define Tcl_MacOSXOpenBundleResources_TCL_DECLARED -/* 0 */ -EXTERN int Tcl_MacOSXOpenBundleResources(Tcl_Interp *interp, - CONST char *bundleName, int hasResourceFile, - int maxPathLen, char *libraryPath); -#endif -#ifndef Tcl_MacOSXOpenVersionedBundleResources_TCL_DECLARED -#define Tcl_MacOSXOpenVersionedBundleResources_TCL_DECLARED -/* 1 */ -EXTERN int Tcl_MacOSXOpenVersionedBundleResources( - Tcl_Interp *interp, CONST char *bundleName, - CONST char *bundleVersion, - int hasResourceFile, int maxPathLen, - char *libraryPath); -#endif -#endif /* UNIX */ -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ #ifndef Tcl_WinUtfToTChar_TCL_DECLARED #define Tcl_WinUtfToTChar_TCL_DECLARED /* 0 */ @@ -98,11 +77,7 @@ typedef struct TclPlatStubs { int magic; struct TclPlatStubHooks *hooks; -#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ - int (*tcl_MacOSXOpenBundleResources) (Tcl_Interp *interp, CONST char *bundleName, int hasResourceFile, int maxPathLen, char *libraryPath); /* 0 */ - int (*tcl_MacOSXOpenVersionedBundleResources) (Tcl_Interp *interp, CONST char *bundleName, CONST char *bundleVersion, int hasResourceFile, int maxPathLen, char *libraryPath); /* 1 */ -#endif /* UNIX */ -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ TCHAR * (*tcl_WinUtfToTChar) (CONST char *str, int len, Tcl_DString *dsPtr); /* 0 */ char * (*tcl_WinTCharToUtf) (CONST TCHAR *str, int len, Tcl_DString *dsPtr); /* 1 */ #endif /* WIN */ @@ -126,17 +101,7 @@ extern TclPlatStubs *tclPlatStubsPtr; * Inline function declarations: */ -#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ -#ifndef Tcl_MacOSXOpenBundleResources -#define Tcl_MacOSXOpenBundleResources \ - (tclPlatStubsPtr->tcl_MacOSXOpenBundleResources) /* 0 */ -#endif -#ifndef Tcl_MacOSXOpenVersionedBundleResources -#define Tcl_MacOSXOpenVersionedBundleResources \ - (tclPlatStubsPtr->tcl_MacOSXOpenVersionedBundleResources) /* 1 */ -#endif -#endif /* UNIX */ -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ #ifndef Tcl_WinUtfToTChar #define Tcl_WinUtfToTChar \ (tclPlatStubsPtr->tcl_WinUtfToTChar) /* 0 */ diff --git a/generic/tclPort.h b/generic/tclPort.h index 79bea88..7021b8d 100644 --- a/generic/tclPort.h +++ b/generic/tclPort.h @@ -25,19 +25,6 @@ # include "tclUnixPort.h" #endif -#if defined(__CYGWIN__) -# define USE_PUTENV 1 -# define USE_PUTENV_FOR_UNSET 1 -/* On Cygwin, the environment is imported from the Cygwin DLL. */ -# define environ __cygwin_environ -# define timezone _timezone - DLLIMPORT extern char **__cygwin_environ; - DLLIMPORT extern int cygwin_conv_to_win32_path(const char *, char *); - DLLIMPORT extern int cygwin_posix_to_win32_path_list_buf_size(char *value); - DLLIMPORT extern void cygwin_posix_to_win32_path_list(char *buf, char *value); - DLLIMPORT extern void __stdcall SetEnvironmentVariableA(const char*, const char *); -#endif - #if !defined(LLONG_MIN) # ifdef TCL_WIDE_INT_IS_LONG # define LLONG_MIN LONG_MIN diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index e28a5c7..418e42f 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -31,6 +31,7 @@ #undef Tcl_ValidateAllMemory #undef Tcl_FindHashEntry #undef Tcl_CreateHashEntry +#undef TclpGetPid #undef TclSockMinimumBuffers /* @@ -74,28 +75,19 @@ MODULE_SCOPE TclPlatStubs tclPlatStubs; MODULE_SCOPE TclStubs tclStubs; MODULE_SCOPE TclTomMathStubs tclTomMathStubs; -#ifdef __CYGWIN__ - -/* Trick, so we don't have to include <windows.h> here, which - * - b.t.w. - lacks this function anyway */ -#define GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS 0x00000004 -int __stdcall GetModuleHandleExW(unsigned int, const char *, void *); - -#define TclWinGetPlatformId winGetPlatformId -#define Tcl_WinUtfToTChar winUtfToTChar -#define Tcl_WinTCharToUtf winTCharToUtf -#define TclWinGetTclInstance winGetTclInstance -#define TclWinNToHS winNToHS -#define TclWinSetSockOpt winSetSockOpt -#define TclWinNoBackslash winNoBackslash -#define TclWinSetInterfaces (void (*) (int)) doNothing -#define TclWinAddProcess (void (*) (void *, unsigned int)) doNothing -#define TclWinFlushDirtyChannels doNothing -#define TclWinResetInterfaces doNothing +#ifdef __WIN32__ +# define TclUnixWaitForFile 0 +# define TclpReaddir 0 +#elif defined(__CYGWIN__) +# define TclWinSetInterfaces (void (*) (int)) doNothing +# define TclWinAddProcess (void (*) (void *, unsigned int)) doNothing +# define TclWinFlushDirtyChannels doNothing +# define TclWinResetInterfaces doNothing +# define TclpGetTZName 0 static Tcl_Encoding winTCharEncoding; -static int +int TclWinGetPlatformId() { /* Don't bother to determine the real platform on cygwin, @@ -103,7 +95,7 @@ TclWinGetPlatformId() return 2; /* VER_PLATFORM_WIN32_NT */; } -static void *TclWinGetTclInstance() +void *TclWinGetTclInstance() { void *hInstance = NULL; GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, @@ -111,20 +103,33 @@ static void *TclWinGetTclInstance() return hInstance; } -static unsigned short +unsigned short TclWinNToHS(unsigned short ns) { return ntohs(ns); } -static int -TclWinSetSockOpt(void *s, int level, int optname, +int +TclWinSetSockOpt(SOCKET s, int level, int optname, const char *optval, int optlen) { return setsockopt((int) s, level, optname, optval, optlen); } -static char * +int +TclWinGetSockOpt(SOCKET s, int level, int optname, + char *optval, int *optlen) +{ + return getsockopt((int) s, level, optname, optval, optlen); +} + +struct servent * +TclWinGetServByName(const char *name, const char *proto) +{ + return getservbyname(name, proto); +} + +char * TclWinNoBackslash(char *path) { char *p; @@ -137,17 +142,23 @@ TclWinNoBackslash(char *path) return path; } +int +TclpGetPid(Tcl_Pid pid) +{ + return (int) (size_t) pid; +} + static void doNothing(void) { /* dummy implementation, no need to do anything */ } -static char * -Tcl_WinUtfToTChar(string, len, dsPtr) - const char *string; - int len; - Tcl_DString *dsPtr; +char * +Tcl_WinUtfToTChar( + const char *string, + int len, + Tcl_DString *dsPtr) { if (!winTCharEncoding) { winTCharEncoding = Tcl_GetEncoding(0, "unicode"); @@ -156,7 +167,7 @@ Tcl_WinUtfToTChar(string, len, dsPtr) string, len, dsPtr); } -static char * +char * Tcl_WinTCharToUtf( const char *string, int len, @@ -169,37 +180,7 @@ Tcl_WinTCharToUtf( string, len, dsPtr); } -#define Tcl_MacOSXOpenBundleResources (int (*) _ANSI_ARGS_(( \ - Tcl_Interp *, const char *, int, int, char *))) Tcl_WinUtfToTChar -#define Tcl_MacOSXOpenVersionedBundleResources (int (*) _ANSI_ARGS_(( \ - Tcl_Interp *, const char *, const char *, int, int, char *))) Tcl_WinTCharToUtf -#define TclMacOSXGetFileAttribute (int (*) _ANSI_ARGS_((Tcl_Interp *, \ - int, Tcl_Obj *, Tcl_Obj **))) TclpCreateProcess -#define TclMacOSXMatchType (int (*) _ANSI_ARGS_((Tcl_Interp *, const char *, \ - const char *, Tcl_StatBuf *, Tcl_GlobTypeData *))) TclpMakeFile -#define TclMacOSXNotifierAddRunLoopMode (void (*) _ANSI_ARGS_((const void *))) TclpOpenFile -#define TclpLocaltime_unix (struct tm *(*) _ANSI_ARGS_((const time_t *))) TclGetAndDetachPids -#define TclpGmtime_unix (struct tm *(*) _ANSI_ARGS_((const time_t *))) TclpCloseFile - -#elif !defined(__WIN32__) /* UNIX and MAC */ -# define TclWinConvertError (void (*) _ANSI_ARGS_((unsigned int))) TclGetAndDetachPids -# define TclWinConvertWSAError (void (*) _ANSI_ARGS_((unsigned int))) TclpCloseFile -# define TclWinGetPlatformId (int (*)()) TclpCreateTempFile -# define TclWinGetTclInstance (void *(*)()) TclpCreateProcess -# define TclWinNToHS (unsigned short (*) _ANSI_ARGS_((unsigned short ns))) TclpMakeFile -# define TclWinSetSockOpt (int (*) _ANSI_ARGS_((void *, int, int, const char *, int))) TclpOpenFile -# define TclWinAddProcess 0 -# define TclWinNoBackslash 0 -# define TclWinSetInterfaces 0 -# define TclWinFlushDirtyChannels 0 -# define TclWinResetInterfaces 0 -# define TclMacOSXGetFileAttribute 0 /* Only implemented in Tcl >= 8.5 */ -# define TclMacOSXMatchType 0 /* Only implemented in Tcl >= 8.5 */ -# define TclMacOSXNotifierAddRunLoopMode 0 /* Only implemented in Tcl >= 8.5 */ -# ifndef MAC_OSX_TCL -# define Tcl_MacOSXOpenBundleResources 0 -# define Tcl_MacOSXOpenVersionedBundleResources 0 -# endif +#else /* UNIX and MAC */ # define TclpLocaltime_unix TclpLocaltime # define TclpGmtime_unix TclpGmtime #endif @@ -325,15 +306,7 @@ TclIntStubs tclIntStubs = { NULL, /* 107 */ TclTeardownNamespace, /* 108 */ TclUpdateReturnInfo, /* 109 */ -#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ - TclSockMinimumBuffers, /* 110 */ -#endif /* UNIX */ -#ifdef __WIN32__ /* WIN */ - TclSockMinimumBuffers, /* 110 */ -#endif /* WIN */ -#ifdef MAC_OSX_TCL /* MACOSX */ TclSockMinimumBuffers, /* 110 */ -#endif /* MACOSX */ Tcl_AddInterpResolvers, /* 111 */ Tcl_AppendExportList, /* 112 */ Tcl_CreateNamespace, /* 113 */ @@ -478,52 +451,50 @@ TclIntStubs tclIntStubs = { TclIntPlatStubs tclIntPlatStubs = { TCL_STUB_MAGIC, NULL, -#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ - TclWinConvertError, /* 0 */ - TclWinConvertWSAError, /* 1 */ +#if !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(MAC_OSX_TCL) /* UNIX */ + TclGetAndDetachPids, /* 0 */ + TclpCloseFile, /* 1 */ TclpCreateCommandChannel, /* 2 */ TclpCreatePipe, /* 3 */ - TclWinGetTclInstance, /* 4 */ + TclpCreateProcess, /* 4 */ NULL, /* 5 */ - TclWinNToHS, /* 6 */ - TclWinSetSockOpt, /* 7 */ + TclpMakeFile, /* 6 */ + TclpOpenFile, /* 7 */ TclUnixWaitForFile, /* 8 */ - TclWinGetPlatformId, /* 9 */ + TclpCreateTempFile, /* 9 */ TclpReaddir, /* 10 */ TclpLocaltime_unix, /* 11 */ TclpGmtime_unix, /* 12 */ TclpInetNtoa, /* 13 */ TclUnixCopyFile, /* 14 */ - TclMacOSXGetFileAttribute, /* 15 */ + NULL, /* 15 */ NULL, /* 16 */ NULL, /* 17 */ - TclMacOSXMatchType, /* 18 */ - TclMacOSXNotifierAddRunLoopMode, /* 19 */ - TclWinAddProcess, /* 20 */ + NULL, /* 18 */ + NULL, /* 19 */ + NULL, /* 20 */ NULL, /* 21 */ - TclpCreateTempFile, /* 22 */ + NULL, /* 22 */ NULL, /* 23 */ - TclWinNoBackslash, /* 24 */ + NULL, /* 24 */ NULL, /* 25 */ - TclWinSetInterfaces, /* 26 */ - TclWinFlushDirtyChannels, /* 27 */ - TclWinResetInterfaces, /* 28 */ + NULL, /* 26 */ + NULL, /* 27 */ + NULL, /* 28 */ TclWinCPUID, /* 29 */ - TclGetAndDetachPids, /* 30 */ - TclpCloseFile, /* 31 */ #endif /* UNIX */ -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ TclWinConvertError, /* 0 */ TclWinConvertWSAError, /* 1 */ TclWinGetServByName, /* 2 */ TclWinGetSockOpt, /* 3 */ TclWinGetTclInstance, /* 4 */ - NULL, /* 5 */ + TclUnixWaitForFile, /* 5 */ TclWinNToHS, /* 6 */ TclWinSetSockOpt, /* 7 */ TclpGetPid, /* 8 */ TclWinGetPlatformId, /* 9 */ - NULL, /* 10 */ + TclpReaddir, /* 10 */ TclGetAndDetachPids, /* 11 */ TclpCloseFile, /* 12 */ TclpCreateCommandChannel, /* 13 */ @@ -534,7 +505,7 @@ TclIntPlatStubs tclIntPlatStubs = { TclpMakeFile, /* 18 */ TclpOpenFile, /* 19 */ TclWinAddProcess, /* 20 */ - NULL, /* 21 */ + TclpInetNtoa, /* 21 */ TclpCreateTempFile, /* 22 */ TclpGetTZName, /* 23 */ TclWinNoBackslash, /* 24 */ @@ -545,16 +516,16 @@ TclIntPlatStubs tclIntPlatStubs = { TclWinCPUID, /* 29 */ #endif /* WIN */ #ifdef MAC_OSX_TCL /* MACOSX */ - TclWinConvertError, /* 0 */ - TclWinConvertWSAError, /* 1 */ + TclGetAndDetachPids, /* 0 */ + TclpCloseFile, /* 1 */ TclpCreateCommandChannel, /* 2 */ TclpCreatePipe, /* 3 */ - TclWinGetTclInstance, /* 4 */ + TclpCreateProcess, /* 4 */ NULL, /* 5 */ - TclWinNToHS, /* 6 */ - TclWinSetSockOpt, /* 7 */ + TclpMakeFile, /* 6 */ + TclpOpenFile, /* 7 */ TclUnixWaitForFile, /* 8 */ - TclWinGetPlatformId, /* 9 */ + TclpCreateTempFile, /* 9 */ TclpReaddir, /* 10 */ TclpLocaltime_unix, /* 11 */ TclpGmtime_unix, /* 12 */ @@ -565,29 +536,23 @@ TclIntPlatStubs tclIntPlatStubs = { TclMacOSXCopyFileAttributes, /* 17 */ TclMacOSXMatchType, /* 18 */ TclMacOSXNotifierAddRunLoopMode, /* 19 */ - TclWinAddProcess, /* 20 */ + NULL, /* 20 */ NULL, /* 21 */ - TclpCreateTempFile, /* 22 */ + NULL, /* 22 */ NULL, /* 23 */ - TclWinNoBackslash, /* 24 */ + NULL, /* 24 */ NULL, /* 25 */ - TclWinSetInterfaces, /* 26 */ - TclWinFlushDirtyChannels, /* 27 */ - TclWinResetInterfaces, /* 28 */ + NULL, /* 26 */ + NULL, /* 27 */ + NULL, /* 28 */ TclWinCPUID, /* 29 */ - TclGetAndDetachPids, /* 30 */ - TclpCloseFile, /* 31 */ #endif /* MACOSX */ }; TclPlatStubs tclPlatStubs = { TCL_STUB_MAGIC, NULL, -#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ - Tcl_MacOSXOpenBundleResources, /* 0 */ - Tcl_MacOSXOpenVersionedBundleResources, /* 1 */ -#endif /* UNIX */ -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ Tcl_WinUtfToTChar, /* 0 */ Tcl_WinTCharToUtf, /* 1 */ #endif /* WIN */ @@ -684,19 +649,19 @@ TclStubs tclStubs = { Tcl_DbCkalloc, /* 6 */ Tcl_DbCkfree, /* 7 */ Tcl_DbCkrealloc, /* 8 */ -#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ +#if !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(MAC_OSX_TCL) /* UNIX */ Tcl_CreateFileHandler, /* 9 */ #endif /* UNIX */ -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ NULL, /* 9 */ #endif /* WIN */ #ifdef MAC_OSX_TCL /* MACOSX */ Tcl_CreateFileHandler, /* 9 */ #endif /* MACOSX */ -#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ +#if !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(MAC_OSX_TCL) /* UNIX */ Tcl_DeleteFileHandler, /* 10 */ #endif /* UNIX */ -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ NULL, /* 10 */ #endif /* WIN */ #ifdef MAC_OSX_TCL /* MACOSX */ @@ -858,10 +823,10 @@ TclStubs tclStubs = { Tcl_GetMaster, /* 164 */ Tcl_GetNameOfExecutable, /* 165 */ Tcl_GetObjResult, /* 166 */ -#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ +#if !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(MAC_OSX_TCL) /* UNIX */ Tcl_GetOpenFile, /* 167 */ #endif /* UNIX */ -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ NULL, /* 167 */ #endif /* WIN */ #ifdef MAC_OSX_TCL /* MACOSX */ diff --git a/generic/tclTest.c b/generic/tclTest.c index c08f281..ab0c6cb 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -444,6 +444,11 @@ static int TestNumUtfCharsCmd(ClientData clientData, static int TestHashSystemHashCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); +#if defined(HAVE_CPUID) || defined(__WIN32__) +static int TestcpuidCmd (ClientData dummy, + Tcl_Interp* interp, int objc, + Tcl_Obj *CONST objv[]); +#endif static Tcl_Filesystem testReportingFilesystem = { "reporting", @@ -707,6 +712,10 @@ Tcltest_Init( (ClientData) NULL, NULL); Tcl_CreateCommand(interp, "testexitmainloop", TestexitmainloopCmd, (ClientData) NULL, NULL); +#if defined(HAVE_CPUID) || defined(__WIN32__) + Tcl_CreateObjCommand(interp, "testcpuid", TestcpuidCmd, + (ClientData) 0, NULL); +#endif t3ArgTypes[0] = TCL_EITHER; t3ArgTypes[1] = TCL_EITHER; Tcl_CreateMathFunc(interp, "T3", 2, t3ArgTypes, TestMathFunc2, @@ -3259,7 +3268,7 @@ TestlocaleCmd( "ctype", "numeric", "time", "collate", "monetary", "all", NULL }; - static int lcTypes[] = { + static CONST int lcTypes[] = { LC_CTYPE, LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_ALL }; @@ -7103,6 +7112,62 @@ TestNumUtfCharsCmd( } return TCL_OK; } + +#if defined(HAVE_CPUID) || defined(__WIN32__) +/* + *---------------------------------------------------------------------- + * + * TestcpuidCmd -- + * + * Retrieves CPU ID information. + * + * Usage: + * testwincpuid <eax> + * + * Parameters: + * eax - The value to pass in the EAX register to a CPUID instruction. + * + * Results: + * Returns a four-element list containing the values from the EAX, EBX, + * ECX and EDX registers returned from the CPUID instruction. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static int +TestcpuidCmd( + ClientData dummy, + Tcl_Interp* interp, /* Tcl interpreter */ + int objc, /* Parameter count */ + Tcl_Obj *const * objv) /* Parameter vector */ +{ + int status, index, i; + unsigned int regs[4]; + Tcl_Obj *regsObjs[4]; + + if (objc != 2) { + Tcl_WrongNumArgs(interp, 1, objv, "eax"); + return TCL_ERROR; + } + if (Tcl_GetIntFromObj(interp, objv[1], &index) != TCL_OK) { + return TCL_ERROR; + } + status = TclWinCPUID((unsigned) index, regs); + if (status != TCL_OK) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("operation not available", -1)); + return status; + } + for (i=0 ; i<4 ; ++i) { + regsObjs[i] = Tcl_NewIntObj((int) regs[i]); + } + Tcl_SetObjResult(interp, Tcl_NewListObj(4, regsObjs)); + return TCL_OK; +} +#endif /* * Used to do basic checks of the TCL_HASH_KEY_SYSTEM_HASH flag diff --git a/generic/tclTestProcBodyObj.c b/generic/tclTestProcBodyObj.c index 88bd1c3..644179b 100644 --- a/generic/tclTestProcBodyObj.c +++ b/generic/tclTestProcBodyObj.c @@ -17,14 +17,14 @@ * name and version of this package */ -static char packageName[] = "procbodytest"; -static char packageVersion[] = "1.0"; +static const char packageName[] = "procbodytest"; +static const char packageVersion[] = "1.0"; /* * Name of the commands exported by this package */ -static char procCommand[] = "proc"; +static const char procCommand[] = "proc"; /* * this struct describes an entry in the table of command names and command @@ -33,7 +33,7 @@ static char procCommand[] = "proc"; typedef struct CmdTable { - char *cmdName; /* command name */ + const char *cmdName; /* command name */ Tcl_ObjCmdProc *proc; /* command proc */ int exportIt; /* if 1, export the command */ } CmdTable; @@ -46,7 +46,7 @@ static int ProcBodyTestProcObjCmd(ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]); static int ProcBodyTestInitInternal(Tcl_Interp *interp, int isSafe); static int RegisterCommand(Tcl_Interp* interp, - char *namespace, CONST CmdTable *cmdTablePtr); + const char *namespace, const CmdTable *cmdTablePtr); int Procbodytest_Init(Tcl_Interp * interp); int Procbodytest_SafeInit(Tcl_Interp * interp); @@ -132,9 +132,9 @@ Procbodytest_SafeInit( static int RegisterCommand(interp, namespace, cmdTablePtr) Tcl_Interp* interp; /* the Tcl interpreter for which the operation * is performed */ - char *namespace; /* the namespace in which the command is + const char *namespace; /* the namespace in which the command is * registered */ - CONST CmdTable *cmdTablePtr;/* the command to register */ + const CmdTable *cmdTablePtr;/* the command to register */ { char buf[128]; diff --git a/generic/tclTrace.c b/generic/tclTrace.c index 3ea182f..fa29160 100644 --- a/generic/tclTrace.c +++ b/generic/tclTrace.c @@ -110,10 +110,10 @@ static Tcl_TraceTypeObjCmd TraceExecutionObjCmd; static const char *traceTypeOptions[] = { "execution", "command", "variable", NULL }; -static Tcl_TraceTypeObjCmd *traceSubCmds[] = { +static Tcl_TraceTypeObjCmd *const traceSubCmds[] = { TraceExecutionObjCmd, TraceCommandObjCmd, - TraceVariableObjCmd, + TraceVariableObjCmd }; /* |
