Tcl Source Code

Check-in [cef38b1e7b]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:[Bug 3508771] load tclreg.dll in cygwin tclsh Implement TclWinGetTclInstance, TclpGetTZName, and various others for Cygwin
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core-8-4-branch
Files: files | file ages | folders
SHA1: cef38b1e7b5ab0ca83d616e9a70d4632a4f725b2
User & Date: jan.nijtmans 2012-03-30 14:44:03
Context
2012-04-03
11:55
cleanup tclInt.decls to have the same form as Tcl 8.5/8.6, so a diff can show us the real signature ... check-in: 3695c2dd85 user: jan.nijtmans tags: core-8-4-branch
2012-03-30
14:57
[Bug 3508771] load tclreg.dll in cygwin tclsh Implement TclWinGetTclInstance, TclpGetTZName, and var... check-in: 27ca86ce9b user: jan.nijtmans tags: core-8-5-branch
14:44
[Bug 3508771] load tclreg.dll in cygwin tclsh Implement TclWinGetTclInstance, TclpGetTZName, and var... check-in: cef38b1e7b user: jan.nijtmans tags: core-8-4-branch
2012-03-29
22:36
Only check for cygwin with $GCC check-in: e6a4468f48 user: jan.nijtmans tags: core-8-4-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.








1
2
3
4
5
6
7







2012-03-29  Jan Nijtmans  <[email protected]>

	* unix/tcl.m4:               [Bug 3511806] Compiler checks too early
	* unix/configure.in:         This change allows to build the cygwin
	* unix/configure:            and mingw32 ports of Tcl/Tk to build
	* win/tcl.m4:                out-of-the-box using a native or cross-
	* win/configure.in:          compiler.
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
2012-03-30  Jan Nijtmans  <[email protected]>

	* generic/tclInt.decls:      [Bug 3508771] load tclreg.dll in cygwin tclsh
	* generic/tclIntPlatDecls.h: Implement TclWinGetTclInstance, TclpGetTZName,
	* generic/tclStubInit.c:     and various more win32-specific internal functions for
	Cygwin, so win32 extensions using those can be loaded in the cygwin version of tclsh.

2012-03-29  Jan Nijtmans  <[email protected]>

	* unix/tcl.m4:               [Bug 3511806] Compiler checks too early
	* unix/configure.in:         This change allows to build the cygwin
	* unix/configure:            and mingw32 ports of Tcl/Tk to build
	* win/tcl.m4:                out-of-the-box using a native or cross-
	* win/configure.in:          compiler.

Changes to generic/tclInt.decls.

831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
}
declare 2 win {
    struct servent *TclWinGetServByName(CONST char *nm,
	    CONST char *proto)
}
declare 3 win {
    int TclWinGetSockOpt(SOCKET s, int level, int optname,
	    char FAR *optval, int FAR *optlen)
}
declare 4 win {
    HINSTANCE TclWinGetTclInstance(void)
}
# Removed in 8.1:
#  declare 5 win {
#      HINSTANCE TclWinLoadLibrary(char *name)
#  }
declare 6 win {
    u_short TclWinNToHS(u_short ns)
}
declare 7 win {
    int TclWinSetSockOpt(SOCKET s, int level, int optname,
	    CONST char FAR *optval, int optlen)
}
declare 8 win {
    unsigned long TclpGetPid(Tcl_Pid pid)
}
declare 9 win {
    int TclWinGetPlatformId(void)
}







|













|







831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
}
declare 2 win {
    struct servent *TclWinGetServByName(CONST char *nm,
	    CONST char *proto)
}
declare 3 win {
    int TclWinGetSockOpt(SOCKET s, int level, int optname,
	    char *optval, int *optlen)
}
declare 4 win {
    HINSTANCE TclWinGetTclInstance(void)
}
# Removed in 8.1:
#  declare 5 win {
#      HINSTANCE TclWinLoadLibrary(char *name)
#  }
declare 6 win {
    u_short TclWinNToHS(u_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)
}
declare 9 win {
    int TclWinGetPlatformId(void)
}
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
	    TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr)
}
declare 3 unix {
    int TclpCreatePipe(TclFile *readPipe, TclFile *writePipe)
}
# On non-cygwin, this is actually a reference to TclpCreateProcess
declare 4 unix {
    int TclWinGetTclInstance(void)
}
# 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)
}
# On non-cygwin, this is actually a reference to TclpOpenFile
declare 7 unix {
    int TclWinSetSockOpt(int s, int level, int optname,
	    CONST char *optval, int optlen)
}
declare 8 unix {
    int TclUnixWaitForFile(int fd, int mask, int timeout)
}

# Added in 8.1:







|












|







954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
	    TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr)
}
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)
}
# 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)
}
# 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)
}
declare 8 unix {
    int TclUnixWaitForFile(int fd, int mask, int timeout)
}

# Added in 8.1:
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
	    Tcl_GlobTypeData *types)
}
#On cygwin, TclpOpenFile is here
declare 19 unix {
    void TclMacOSXNotifierAddRunLoopMode(CONST void *runLoopMode)
}
declare 20 unix {
    void TclWinAddProcess(void *hProcess, unsigned long id)
}
declare 22 unix {
    TclFile TclpCreateTempFile(CONST char *contents)
}
declare 23 unix {
    char *TclpGetTZName(int isdst)
}







|







1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
	    Tcl_GlobTypeData *types)
}
#On cygwin, TclpOpenFile is here
declare 19 unix {
    void TclMacOSXNotifierAddRunLoopMode(CONST void *runLoopMode)
}
declare 20 unix {
    void TclWinAddProcess(void *hProcess, unsigned int id)
}
declare 22 unix {
    TclFile TclpCreateTempFile(CONST char *contents)
}
declare 23 unix {
    char *TclpGetTZName(int isdst)
}

Changes to generic/tclIntPlatDecls.h.

46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
				TclFile readFile, TclFile writeFile,
				TclFile errorFile, int numPids,
				Tcl_Pid *pidPtr));
/* 3 */
EXTERN int		TclpCreatePipe _ANSI_ARGS_((TclFile *readPipe,
				TclFile *writePipe));
/* 4 */
EXTERN int		TclWinGetTclInstance _ANSI_ARGS_((void));
/* Slot 5 is reserved */
/* 6 */
EXTERN unsigned short	TclWinNToHS _ANSI_ARGS_((unsigned short ns));
/* 7 */
EXTERN int		TclWinSetSockOpt _ANSI_ARGS_((int s, int level,
				int optname, CONST char *optval, int optlen));
/* 8 */
EXTERN int		TclUnixWaitForFile _ANSI_ARGS_((int fd, int mask,
				int timeout));
/* 9 */
EXTERN int		TclWinGetPlatformId _ANSI_ARGS_((void));
/* 10 */







|




|







46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
				TclFile readFile, TclFile writeFile,
				TclFile errorFile, int numPids,
				Tcl_Pid *pidPtr));
/* 3 */
EXTERN int		TclpCreatePipe _ANSI_ARGS_((TclFile *readPipe,
				TclFile *writePipe));
/* 4 */
EXTERN void *		TclWinGetTclInstance _ANSI_ARGS_((void));
/* Slot 5 is reserved */
/* 6 */
EXTERN unsigned short	TclWinNToHS _ANSI_ARGS_((unsigned short ns));
/* 7 */
EXTERN int		TclWinSetSockOpt _ANSI_ARGS_((void *s, int level,
				int optname, CONST char *optval, int optlen));
/* 8 */
EXTERN int		TclUnixWaitForFile _ANSI_ARGS_((int fd, int mask,
				int timeout));
/* 9 */
EXTERN int		TclWinGetPlatformId _ANSI_ARGS_((void));
/* 10 */
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
				Tcl_StatBuf *statBufPtr,
				Tcl_GlobTypeData *types));
/* 19 */
EXTERN void		TclMacOSXNotifierAddRunLoopMode _ANSI_ARGS_((
				CONST void *runLoopMode));
/* 20 */
EXTERN void		TclWinAddProcess _ANSI_ARGS_((void *hProcess,
				unsigned long id));
/* Slot 21 is reserved */
/* 22 */
EXTERN TclFile		TclpCreateTempFile _ANSI_ARGS_((CONST char *contents));
/* 23 */
EXTERN char *		TclpGetTZName _ANSI_ARGS_((int isdst));
/* 24 */
EXTERN char *		TclWinNoBackslash _ANSI_ARGS_((char *path));







|







84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
				Tcl_StatBuf *statBufPtr,
				Tcl_GlobTypeData *types));
/* 19 */
EXTERN void		TclMacOSXNotifierAddRunLoopMode _ANSI_ARGS_((
				CONST void *runLoopMode));
/* 20 */
EXTERN void		TclWinAddProcess _ANSI_ARGS_((void *hProcess,
				unsigned int id));
/* Slot 21 is reserved */
/* 22 */
EXTERN TclFile		TclpCreateTempFile _ANSI_ARGS_((CONST char *contents));
/* 23 */
EXTERN char *		TclpGetTZName _ANSI_ARGS_((int isdst));
/* 24 */
EXTERN char *		TclWinNoBackslash _ANSI_ARGS_((char *path));
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
/* 1 */
EXTERN void		TclWinConvertWSAError _ANSI_ARGS_((DWORD errCode));
/* 2 */
EXTERN struct servent *	 TclWinGetServByName _ANSI_ARGS_((CONST char *nm,
				CONST char *proto));
/* 3 */
EXTERN int		TclWinGetSockOpt _ANSI_ARGS_((SOCKET s, int level,
				int optname, char FAR *optval,
				int FAR *optlen));
/* 4 */
EXTERN HINSTANCE	TclWinGetTclInstance _ANSI_ARGS_((void));
/* Slot 5 is reserved */
/* 6 */
EXTERN u_short		TclWinNToHS _ANSI_ARGS_((u_short ns));
/* 7 */
EXTERN int		TclWinSetSockOpt _ANSI_ARGS_((SOCKET s, int level,
				int optname, CONST char FAR *optval,
				int optlen));
/* 8 */
EXTERN unsigned long	TclpGetPid _ANSI_ARGS_((Tcl_Pid pid));
/* 9 */
EXTERN int		TclWinGetPlatformId _ANSI_ARGS_((void));
/* Slot 10 is reserved */
/* 11 */
EXTERN void		TclGetAndDetachPids _ANSI_ARGS_((Tcl_Interp *interp,







|
<







|
<







118
119
120
121
122
123
124
125

126
127
128
129
130
131
132
133

134
135
136
137
138
139
140
/* 1 */
EXTERN void		TclWinConvertWSAError _ANSI_ARGS_((DWORD errCode));
/* 2 */
EXTERN struct servent *	 TclWinGetServByName _ANSI_ARGS_((CONST char *nm,
				CONST char *proto));
/* 3 */
EXTERN int		TclWinGetSockOpt _ANSI_ARGS_((SOCKET s, int level,
				int optname, char *optval, int *optlen));

/* 4 */
EXTERN HINSTANCE	TclWinGetTclInstance _ANSI_ARGS_((void));
/* Slot 5 is reserved */
/* 6 */
EXTERN u_short		TclWinNToHS _ANSI_ARGS_((u_short ns));
/* 7 */
EXTERN int		TclWinSetSockOpt _ANSI_ARGS_((SOCKET s, int level,
				int optname, CONST char *optval, int optlen));

/* 8 */
EXTERN unsigned long	TclpGetPid _ANSI_ARGS_((Tcl_Pid pid));
/* 9 */
EXTERN int		TclWinGetPlatformId _ANSI_ARGS_((void));
/* Slot 10 is reserved */
/* 11 */
EXTERN void		TclGetAndDetachPids _ANSI_ARGS_((Tcl_Interp *interp,
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
    struct TclIntPlatStubHooks *hooks;

#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
    void (*tclWinConvertError) _ANSI_ARGS_((unsigned int errCode)); /* 0 */
    void (*tclWinConvertWSAError) _ANSI_ARGS_((unsigned int errCode)); /* 1 */
    Tcl_Channel (*tclpCreateCommandChannel) _ANSI_ARGS_((TclFile readFile, TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr)); /* 2 */
    int (*tclpCreatePipe) _ANSI_ARGS_((TclFile *readPipe, TclFile *writePipe)); /* 3 */
    int (*tclWinGetTclInstance) _ANSI_ARGS_((void)); /* 4 */
    void *reserved5;
    unsigned short (*tclWinNToHS) _ANSI_ARGS_((unsigned short ns)); /* 6 */
    int (*tclWinSetSockOpt) _ANSI_ARGS_((int s, int level, int optname, CONST char *optval, int optlen)); /* 7 */
    int (*tclUnixWaitForFile) _ANSI_ARGS_((int fd, int mask, int timeout)); /* 8 */
    int (*tclWinGetPlatformId) _ANSI_ARGS_((void)); /* 9 */
    Tcl_DirEntry * (*tclpReaddir) _ANSI_ARGS_((DIR *dir)); /* 10 */
    struct tm * (*tclpLocaltime_unix) _ANSI_ARGS_((TclpTime_t_CONST clock)); /* 11 */
    struct tm * (*tclpGmtime_unix) _ANSI_ARGS_((TclpTime_t_CONST clock)); /* 12 */
    char * (*tclpInetNtoa) _ANSI_ARGS_((struct in_addr addr)); /* 13 */
    void *reserved14;
    int (*tclMacOSXGetFileAttribute) _ANSI_ARGS_((Tcl_Interp *interp, int objIndex, Tcl_Obj *fileName, Tcl_Obj **attributePtrPtr)); /* 15 */
    void *reserved16;
    void *reserved17;
    int (*tclMacOSXMatchType) _ANSI_ARGS_((Tcl_Interp *interp, CONST char *pathName, CONST char *fileName, Tcl_StatBuf *statBufPtr, Tcl_GlobTypeData *types)); /* 18 */
    void (*tclMacOSXNotifierAddRunLoopMode) _ANSI_ARGS_((CONST void *runLoopMode)); /* 19 */
    void (*tclWinAddProcess) _ANSI_ARGS_((void *hProcess, unsigned long id)); /* 20 */
    void *reserved21;
    TclFile (*tclpCreateTempFile) _ANSI_ARGS_((CONST char *contents)); /* 22 */
    char * (*tclpGetTZName) _ANSI_ARGS_((int isdst)); /* 23 */
    char * (*tclWinNoBackslash) _ANSI_ARGS_((char *path)); /* 24 */
    void *reserved25;
    void (*tclWinSetInterfaces) _ANSI_ARGS_((int wide)); /* 26 */
    void (*tclWinFlushDirtyChannels) _ANSI_ARGS_((void)); /* 27 */
    void (*tclWinResetInterfaces) _ANSI_ARGS_((void)); /* 28 */
    int (*tclWinCPUID) _ANSI_ARGS_((unsigned int index, unsigned int *regs)); /* 29 */
    void (*tclGetAndDetachPids) _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Channel chan)); /* 30 */
    int (*tclpCloseFile) _ANSI_ARGS_((TclFile file)); /* 31 */
#endif /* UNIX */
#ifdef __WIN32__
    void (*tclWinConvertError) _ANSI_ARGS_((DWORD errCode)); /* 0 */
    void (*tclWinConvertWSAError) _ANSI_ARGS_((DWORD errCode)); /* 1 */
    struct servent * (*tclWinGetServByName) _ANSI_ARGS_((CONST char *nm, CONST char *proto)); /* 2 */
    int (*tclWinGetSockOpt) _ANSI_ARGS_((SOCKET s, int level, int optname, char FAR *optval, int FAR *optlen)); /* 3 */
    HINSTANCE (*tclWinGetTclInstance) _ANSI_ARGS_((void)); /* 4 */
    void *reserved5;
    u_short (*tclWinNToHS) _ANSI_ARGS_((u_short ns)); /* 6 */
    int (*tclWinSetSockOpt) _ANSI_ARGS_((SOCKET s, int level, int optname, CONST char FAR *optval, int optlen)); /* 7 */
    unsigned long (*tclpGetPid) _ANSI_ARGS_((Tcl_Pid pid)); /* 8 */
    int (*tclWinGetPlatformId) _ANSI_ARGS_((void)); /* 9 */
    void *reserved10;
    void (*tclGetAndDetachPids) _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Channel chan)); /* 11 */
    int (*tclpCloseFile) _ANSI_ARGS_((TclFile file)); /* 12 */
    Tcl_Channel (*tclpCreateCommandChannel) _ANSI_ARGS_((TclFile readFile, TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr)); /* 13 */
    int (*tclpCreatePipe) _ANSI_ARGS_((TclFile *readPipe, TclFile *writePipe)); /* 14 */







|


|












|
















|



|







260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
    struct TclIntPlatStubHooks *hooks;

#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
    void (*tclWinConvertError) _ANSI_ARGS_((unsigned int errCode)); /* 0 */
    void (*tclWinConvertWSAError) _ANSI_ARGS_((unsigned int errCode)); /* 1 */
    Tcl_Channel (*tclpCreateCommandChannel) _ANSI_ARGS_((TclFile readFile, TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr)); /* 2 */
    int (*tclpCreatePipe) _ANSI_ARGS_((TclFile *readPipe, TclFile *writePipe)); /* 3 */
    void * (*tclWinGetTclInstance) _ANSI_ARGS_((void)); /* 4 */
    void *reserved5;
    unsigned short (*tclWinNToHS) _ANSI_ARGS_((unsigned short ns)); /* 6 */
    int (*tclWinSetSockOpt) _ANSI_ARGS_((void *s, int level, int optname, CONST char *optval, int optlen)); /* 7 */
    int (*tclUnixWaitForFile) _ANSI_ARGS_((int fd, int mask, int timeout)); /* 8 */
    int (*tclWinGetPlatformId) _ANSI_ARGS_((void)); /* 9 */
    Tcl_DirEntry * (*tclpReaddir) _ANSI_ARGS_((DIR *dir)); /* 10 */
    struct tm * (*tclpLocaltime_unix) _ANSI_ARGS_((TclpTime_t_CONST clock)); /* 11 */
    struct tm * (*tclpGmtime_unix) _ANSI_ARGS_((TclpTime_t_CONST clock)); /* 12 */
    char * (*tclpInetNtoa) _ANSI_ARGS_((struct in_addr addr)); /* 13 */
    void *reserved14;
    int (*tclMacOSXGetFileAttribute) _ANSI_ARGS_((Tcl_Interp *interp, int objIndex, Tcl_Obj *fileName, Tcl_Obj **attributePtrPtr)); /* 15 */
    void *reserved16;
    void *reserved17;
    int (*tclMacOSXMatchType) _ANSI_ARGS_((Tcl_Interp *interp, CONST char *pathName, CONST char *fileName, Tcl_StatBuf *statBufPtr, Tcl_GlobTypeData *types)); /* 18 */
    void (*tclMacOSXNotifierAddRunLoopMode) _ANSI_ARGS_((CONST void *runLoopMode)); /* 19 */
    void (*tclWinAddProcess) _ANSI_ARGS_((void *hProcess, unsigned int id)); /* 20 */
    void *reserved21;
    TclFile (*tclpCreateTempFile) _ANSI_ARGS_((CONST char *contents)); /* 22 */
    char * (*tclpGetTZName) _ANSI_ARGS_((int isdst)); /* 23 */
    char * (*tclWinNoBackslash) _ANSI_ARGS_((char *path)); /* 24 */
    void *reserved25;
    void (*tclWinSetInterfaces) _ANSI_ARGS_((int wide)); /* 26 */
    void (*tclWinFlushDirtyChannels) _ANSI_ARGS_((void)); /* 27 */
    void (*tclWinResetInterfaces) _ANSI_ARGS_((void)); /* 28 */
    int (*tclWinCPUID) _ANSI_ARGS_((unsigned int index, unsigned int *regs)); /* 29 */
    void (*tclGetAndDetachPids) _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Channel chan)); /* 30 */
    int (*tclpCloseFile) _ANSI_ARGS_((TclFile file)); /* 31 */
#endif /* UNIX */
#ifdef __WIN32__
    void (*tclWinConvertError) _ANSI_ARGS_((DWORD errCode)); /* 0 */
    void (*tclWinConvertWSAError) _ANSI_ARGS_((DWORD errCode)); /* 1 */
    struct servent * (*tclWinGetServByName) _ANSI_ARGS_((CONST char *nm, CONST char *proto)); /* 2 */
    int (*tclWinGetSockOpt) _ANSI_ARGS_((SOCKET s, int level, int optname, char *optval, int *optlen)); /* 3 */
    HINSTANCE (*tclWinGetTclInstance) _ANSI_ARGS_((void)); /* 4 */
    void *reserved5;
    u_short (*tclWinNToHS) _ANSI_ARGS_((u_short ns)); /* 6 */
    int (*tclWinSetSockOpt) _ANSI_ARGS_((SOCKET s, int level, int optname, CONST char *optval, int optlen)); /* 7 */
    unsigned long (*tclpGetPid) _ANSI_ARGS_((Tcl_Pid pid)); /* 8 */
    int (*tclWinGetPlatformId) _ANSI_ARGS_((void)); /* 9 */
    void *reserved10;
    void (*tclGetAndDetachPids) _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Channel chan)); /* 11 */
    int (*tclpCloseFile) _ANSI_ARGS_((TclFile file)); /* 12 */
    Tcl_Channel (*tclpCreateCommandChannel) _ANSI_ARGS_((TclFile readFile, TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr)); /* 13 */
    int (*tclpCreatePipe) _ANSI_ARGS_((TclFile *readPipe, TclFile *writePipe)); /* 14 */

Changes to generic/tclStubInit.c.

53
54
55
56
57
58
59





60
61
62
63
64
65
66
67
68
69

70
71
72
73





74
75
76
77
78
79
80
81
82
83
84
85


86
87
88
89
90
91
92
93
94

95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113


114
115
116
117
118
119
120
121
    NULL,
    NULL,
    NULL
};

#ifdef __CYGWIN__






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






static int
TclWinGetPlatformId()
{
    /* Don't bother to determine the real platform on cygwin,
     * because VER_PLATFORM_WIN32_NT is the only supported platform */
    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;








>
>
>
>
>






<


|
>




>
>
>
>
>









|

|
>
>
|





<
|

>

|


<
<
<
|
<
<
<
<





|
|
>
>
|







53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70

71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103

104
105
106
107
108
109
110



111




112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
    NULL,
    NULL,
    NULL
};

#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 TclpGetTZName pGetTZName
#define TclWinNoBackslash winNoBackslash
#define TclWinSetInterfaces (void (*) (int)) doNothing
#define TclWinAddProcess (void (*) (void *, unsigned int)) doNothing
#define TclWinFlushDirtyChannels doNothing
#define TclWinResetInterfaces doNothing

static Tcl_Encoding winTCharEncoding;

typedef struct ThreadSpecificData {
    char tzName[64];		/* Time zone name */
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;

static int
TclWinGetPlatformId()
{
    /* Don't bother to determine the real platform on cygwin,
     * because VER_PLATFORM_WIN32_NT is the only supported platform */
    return 2; /* VER_PLATFORM_WIN32_NT */;
}

static void *TclWinGetTclInstance()
{
    void *hInstance = NULL;
    GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
	    (const char *)&winTCharEncoding, &hInstance);
    return hInstance;
}

static unsigned short
TclWinNToHS(unsigned short ns)
{

    return ntohs(ns);
}

static int
TclWinSetSockOpt(void *s, int level, int optname,
	    const char *optval, int optlen)
{



    return setsockopt((int) s, level, optname, optval, optlen);




}

static char *
TclpGetTZName(int isdst)
{
    ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
    const char *zone = getenv("TZ");
    Tcl_ExternalToUtf(NULL, NULL, zone, strlen(zone), 0, NULL,
	    tsdPtr->tzName, sizeof(tsdPtr->tzName), NULL, NULL, NULL);
    return tsdPtr->tzName;
}

static char *
TclWinNoBackslash(char *path)
{
    char *p;

171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
#define TclpLocaltime_unix (struct tm *(*) _ANSI_ARGS_((TclpTime_t_CONST))) TclGetAndDetachPids
#define TclpGmtime_unix (struct tm *(*) _ANSI_ARGS_((TclpTime_t_CONST))) 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 */







|

|







178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
#define TclpLocaltime_unix (struct tm *(*) _ANSI_ARGS_((TclpTime_t_CONST))) TclGetAndDetachPids
#define TclpGmtime_unix (struct tm *(*) _ANSI_ARGS_((TclpTime_t_CONST))) 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 TclpGetTZName 0
#   define TclWinNoBackslash 0
#   define TclWinSetInterfaces 0
#   define TclWinFlushDirtyChannels 0
#   define TclWinResetInterfaces 0
#   define TclMacOSXGetFileAttribute 0 /* Only implemented in Tcl >= 8.5 */

Changes to win/tclWinError.c.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 */

#include "tclInt.h"
#include "tclPort.h"

#ifndef WSAEWOULDBLOCK
#   define WSAEWOULDBLOCK 10035L
#endif

#ifndef __WIN32__
#   define DWORD unsigned int
#endif

/*
 * The following table contains the mapping from Win32 errors to errno errors.
 */

static CONST unsigned char errorTable[] = {
    0,
    EINVAL,	/* ERROR_INVALID_FUNCTION	1 */







<
<
<
<
<
<
<
<







9
10
11
12
13
14
15








16
17
18
19
20
21
22
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 */

#include "tclInt.h"
#include "tclPort.h"









/*
 * The following table contains the mapping from Win32 errors to errno errors.
 */

static CONST unsigned char errorTable[] = {
    0,
    EINVAL,	/* ERROR_INVALID_FUNCTION	1 */
337
338
339
340
341
342
343





344
345
346
347
348
349
350
    EAGAIN,		/* WSAEPROCLIM */
    EUSERS,		/* WSAEUSERS */
    EDQUOT,		/* WSAEDQUOT */
    ESTALE,		/* WSAESTALE */
    EREMOTE		/* WSAEREMOTE */
};






/*
 *----------------------------------------------------------------------
 *
 * TclWinConvertError --
 *
 *	This routine converts a Win32 error into an errno value.
 *







>
>
>
>
>







329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
    EAGAIN,		/* WSAEPROCLIM */
    EUSERS,		/* WSAEUSERS */
    EDQUOT,		/* WSAEDQUOT */
    ESTALE,		/* WSAESTALE */
    EREMOTE		/* WSAEREMOTE */
};

#ifdef __CYGWIN__
#   include <windows.h>
#   define DWORD unsigned int
#endif

/*
 *----------------------------------------------------------------------
 *
 * TclWinConvertError --
 *
 *	This routine converts a Win32 error into an errno value.
 *
358
359
360
361
362
363
364


365



366
367
368
369
370
371
372
 */

void
TclWinConvertError(
    DWORD errCode)		/* Win32 error code. */
{
    if (errCode >= sizeof(errorTable)/sizeof(errorTable[0])) {


	Tcl_SetErrno(EINVAL);



    } else {
	Tcl_SetErrno(errorTable[errCode]);
    }
}

/*
 *----------------------------------------------------------------------







>
>
|
>
>
>







355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
 */

void
TclWinConvertError(
    DWORD errCode)		/* Win32 error code. */
{
    if (errCode >= sizeof(errorTable)/sizeof(errorTable[0])) {
	errCode -= WSAEWOULDBLOCK;
	if (errCode >= sizeof(wsaErrorTable)/sizeof(wsaErrorTable[0])) {
	    Tcl_SetErrno(errorTable[1]);
	} else {
	    Tcl_SetErrno(wsaErrorTable[errCode]);
	}
    } else {
	Tcl_SetErrno(errorTable[errCode]);
    }
}

/*
 *----------------------------------------------------------------------
384
385
386
387
388
389
390

391
392
393
394
395



396
397
398
399
400
401
402
403
404
405
406
 *----------------------------------------------------------------------
 */

void
TclWinConvertWSAError(
    DWORD errCode)		/* Win32 error code. */
{

    errCode -= WSAEWOULDBLOCK;
    if (errCode >= sizeof(wsaErrorTable)/sizeof(wsaErrorTable[0])) {
	Tcl_SetErrno(EINVAL);
    } else {
	Tcl_SetErrno(wsaErrorTable[errCode]);



    }
}

/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * tab-width: 8
 * End:
 */







>
|
|
|
|
|
>
>
>











386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
 *----------------------------------------------------------------------
 */

void
TclWinConvertWSAError(
    DWORD errCode)		/* Win32 error code. */
{
    if (errCode >= sizeof(errorTable)/sizeof(errorTable[0])) {
	errCode -= WSAEWOULDBLOCK;
	if (errCode >= sizeof(wsaErrorTable)/sizeof(wsaErrorTable[0])) {
	    Tcl_SetErrno(errorTable[1]);
	} else {
	    Tcl_SetErrno(wsaErrorTable[errCode]);
	}
    } else {
	Tcl_SetErrno(errorTable[errCode]);
    }
}

/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * tab-width: 8
 * End:
 */