diff options
Diffstat (limited to 'generic/tclStubInit.c')
-rw-r--r-- | generic/tclStubInit.c | 153 |
1 files changed, 120 insertions, 33 deletions
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 245aa85..7e98a75 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -31,8 +31,6 @@ #undef Tcl_ValidateAllMemory #undef Tcl_FindHashEntry #undef Tcl_CreateHashEntry -#define TclpLocaltime_unix TclpLocaltime -#define TclpGmtime_unix TclpGmtime /* * Keep a record of the original Notifier procedures, created in the @@ -68,6 +66,15 @@ MODULE_SCOPE TclTomMathStubs tclTomMathStubs; #define TclWinGetPlatformId winGetPlatformId #define Tcl_WinUtfToTChar winUtfToTChar #define Tcl_WinTCharToUtf winTCharToUtf +#define TclWinGetTclInstance winGetTclInstance +#define TclWinNToHS winNToHS +#define TclWinSetSockOpt winSetSockOpt +#define TclWinAddProcess winAddProcess +#define TclpGetTZName pGetTZName +#define TclWinNoBackslash winNoBackslash +#define TclWinSetInterfaces (void (*) _ANSI_ARGS_((int))) doNothing +#define TclWinFlushDirtyChannels doNothing +#define TclWinResetInterfaces doNothing static Tcl_Encoding winTCharEncoding; @@ -79,6 +86,59 @@ TclWinGetPlatformId() return 2; /* VER_PLATFORM_WIN32_NT */; } +static int TclWinGetTclInstance() +{ + Tcl_Panic("TclWinGetTclInstance not yet implemented for CYGWIN"); + return 0; +} + +static unsigned short +TclWinNToHS(unsigned short ns) +{ + Tcl_Panic("TclWinNToHS not yet implemented for CYGWIN"); + return (unsigned short) -1; +} +static int +TclWinSetSockOpt(int s, int level, int optname, + const char *optval, int optlen) +{ + Tcl_Panic("TclWinSetSockOpt not yet implemented for CYGWIN"); + return -1; +} + +static void +TclWinAddProcess(void *hProcess, unsigned long id) +{ + Tcl_Panic("TclWinAddProcess not yet implemented for CYGWIN"); +} + +static char * +TclpGetTZName(int isdst) +{ + /* TODO: implementation */ + Tcl_Panic("TclpGetTZName not yet implemented for CYGWIN"); + return 0; +} + +static char * +TclWinNoBackslash(char *path) +{ + char *p; + + for (p = path; *p != '\0'; p++) { + if (*p == '\\') { + *p = '/'; + } + } + return path; +} + +static void +doNothing(void) +{ + /* dummy implementation, no need to do anything */ +} + static char * Tcl_WinUtfToTChar(string, len, dsPtr) CONST char *string; @@ -86,20 +146,20 @@ Tcl_WinUtfToTChar(string, len, dsPtr) Tcl_DString *dsPtr; { if (!winTCharEncoding) { - winTCharEncoding = Tcl_GetEncoding(NULL, "unicode"); + winTCharEncoding = Tcl_GetEncoding(0, "unicode"); } return Tcl_UtfToExternalDString(winTCharEncoding, string, len, dsPtr); } static char * -Tcl_WinTCharToUtf(string, len, dsPtr) - CONST char *string; - int len; - Tcl_DString *dsPtr; +Tcl_WinTCharToUtf( + CONST char *string, + int len, + Tcl_DString *dsPtr) { if (!winTCharEncoding) { - winTCharEncoding = Tcl_GetEncoding(NULL, "unicode"); + winTCharEncoding = Tcl_GetEncoding(0, "unicode"); } return Tcl_ExternalToUtfDString(winTCharEncoding, string, len, dsPtr); @@ -109,13 +169,36 @@ Tcl_WinTCharToUtf(string, len, dsPtr) 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 (int (*)()) TclpCreateProcess +# define TclWinNToHS (unsigned short (*) _ANSI_ARGS_((unsigned short ns))) TclpMakeFile +# define TclWinSetSockOpt (int (*) _ANSI_ARGS_((int, int, int, const char *, int))) TclpOpenFile +# define TclWinAddProcess 0 +# define TclpGetTZName 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 +# define TclpLocaltime_unix TclpLocaltime +# define TclpGmtime_unix TclpGmtime #endif /* @@ -385,14 +468,14 @@ TclIntPlatStubs tclIntPlatStubs = { TCL_STUB_MAGIC, NULL, #if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ - TclGetAndDetachPids, /* 0 */ - TclpCloseFile, /* 1 */ + TclWinConvertError, /* 0 */ + TclWinConvertWSAError, /* 1 */ TclpCreateCommandChannel, /* 2 */ TclpCreatePipe, /* 3 */ - TclpCreateProcess, /* 4 */ + TclWinGetTclInstance, /* 4 */ NULL, /* 5 */ - TclpMakeFile, /* 6 */ - TclpOpenFile, /* 7 */ + TclWinNToHS, /* 6 */ + TclWinSetSockOpt, /* 7 */ TclUnixWaitForFile, /* 8 */ TclWinGetPlatformId, /* 9 */ TclpReaddir, /* 10 */ @@ -400,21 +483,23 @@ TclIntPlatStubs tclIntPlatStubs = { TclpGmtime_unix, /* 12 */ TclpInetNtoa, /* 13 */ TclUnixCopyFile, /* 14 */ - NULL, /* 15 */ + TclMacOSXGetFileAttribute, /* 15 */ NULL, /* 16 */ NULL, /* 17 */ - NULL, /* 18 */ - NULL, /* 19 */ - NULL, /* 20 */ + TclMacOSXMatchType, /* 18 */ + TclMacOSXNotifierAddRunLoopMode, /* 19 */ + TclWinAddProcess, /* 20 */ NULL, /* 21 */ TclpCreateTempFile, /* 22 */ - NULL, /* 23 */ - NULL, /* 24 */ + TclpGetTZName, /* 23 */ + TclWinNoBackslash, /* 24 */ NULL, /* 25 */ - NULL, /* 26 */ - NULL, /* 27 */ - NULL, /* 28 */ + TclWinSetInterfaces, /* 26 */ + TclWinFlushDirtyChannels, /* 27 */ + TclWinResetInterfaces, /* 28 */ TclWinCPUID, /* 29 */ + TclGetAndDetachPids, /* 30 */ + TclpCloseFile, /* 31 */ #endif /* UNIX */ #ifdef __WIN32__ /* WIN */ TclWinConvertError, /* 0 */ @@ -449,14 +534,14 @@ TclIntPlatStubs tclIntPlatStubs = { TclWinCPUID, /* 29 */ #endif /* WIN */ #ifdef MAC_OSX_TCL /* MACOSX */ - TclGetAndDetachPids, /* 0 */ - TclpCloseFile, /* 1 */ + TclWinConvertError, /* 0 */ + TclWinConvertWSAError, /* 1 */ TclpCreateCommandChannel, /* 2 */ TclpCreatePipe, /* 3 */ - TclpCreateProcess, /* 4 */ + TclWinGetTclInstance, /* 4 */ NULL, /* 5 */ - TclpMakeFile, /* 6 */ - TclpOpenFile, /* 7 */ + TclWinNToHS, /* 6 */ + TclWinSetSockOpt, /* 7 */ TclUnixWaitForFile, /* 8 */ TclWinGetPlatformId, /* 9 */ TclpReaddir, /* 10 */ @@ -469,16 +554,18 @@ TclIntPlatStubs tclIntPlatStubs = { TclMacOSXCopyFileAttributes, /* 17 */ TclMacOSXMatchType, /* 18 */ TclMacOSXNotifierAddRunLoopMode, /* 19 */ - NULL, /* 20 */ + TclWinAddProcess, /* 20 */ NULL, /* 21 */ TclpCreateTempFile, /* 22 */ - NULL, /* 23 */ - NULL, /* 24 */ + TclpGetTZName, /* 23 */ + TclWinNoBackslash, /* 24 */ NULL, /* 25 */ - NULL, /* 26 */ - NULL, /* 27 */ - NULL, /* 28 */ + TclWinSetInterfaces, /* 26 */ + TclWinFlushDirtyChannels, /* 27 */ + TclWinResetInterfaces, /* 28 */ TclWinCPUID, /* 29 */ + TclGetAndDetachPids, /* 30 */ + TclpCloseFile, /* 31 */ #endif /* MACOSX */ }; |