diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-04-24 20:21:16 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-04-24 20:21:16 (GMT) |
commit | 8a61ab56e17a17d97a2b3bda903b4276853a2c52 (patch) | |
tree | f7587ec802d28b8abaedf99e98dd2ba9084c5e6f | |
parent | 71acdfe5290b0ced36fe5ff4233c1f441387038b (diff) | |
parent | f7ffb38ba6d308a94ce5e44d88027430ee1c1711 (diff) | |
download | tcl-8a61ab56e17a17d97a2b3bda903b4276853a2c52.zip tcl-8a61ab56e17a17d97a2b3bda903b4276853a2c52.tar.gz tcl-8a61ab56e17a17d97a2b3bda903b4276853a2c52.tar.bz2 |
[Bug 3508771] load tclreg.dll in cygwin tclsh
Implement TclWinGetSockOpt, TclWinGetServByName
and TclWinCPUID for Cygwin
-rw-r--r-- | ChangeLog | 120 | ||||
-rw-r--r-- | generic/tclInt.decls | 42 | ||||
-rw-r--r-- | generic/tclIntPlatDecls.h | 147 | ||||
-rw-r--r-- | generic/tclPipe.c | 2 | ||||
-rw-r--r-- | generic/tclStubInit.c | 43 | ||||
-rw-r--r-- | library/dde/pkgIndex.tcl | 4 | ||||
-rwxr-xr-x | library/reg/pkgIndex.tcl | 4 | ||||
-rw-r--r-- | mac/tclMacPort.h | 1 | ||||
-rwxr-xr-x | unix/configure | 44 | ||||
-rw-r--r-- | unix/configure.in | 14 | ||||
-rw-r--r-- | unix/tclUnixCompat.c | 7 | ||||
-rw-r--r-- | unix/tclUnixFile.c | 38 | ||||
-rw-r--r-- | unix/tclUnixPort.h | 2 | ||||
-rw-r--r-- | win/tclWinPipe.c | 2 |
14 files changed, 348 insertions, 122 deletions
@@ -1,3 +1,13 @@ +2012-04-24 Jan Nijtmans <nijtmans@users.sf.net> + + * generic/tclInt.decls: [Bug 3508771] load tclreg.dll in cygwin tclsh + * generic/tclIntPlatDecls.h: Implement TclWinGetSockOpt, TclWinGetServByName + * generic/tclStubInit.c: and TclWinCPUID for Cygwin + * generic/tclUnixCompat.c: + * unix/configure.in: + * unix/configure: + * unix/tclUnixCompat.c: + 2012-04-16 Donal K. Fellows <dkf@users.sf.net> * doc/FileSystem.3 (Tcl_FSOpenFileChannelProc): [Bug 3518244]: Fixed @@ -60,7 +70,7 @@ * generic/tclInt.decls: [Bug 3508771] load tclreg.dll in cygwin tclsh * generic/tclIntPlatDecls.h: Implement TclWinConvertError, TclWinConvertWSAError, - * generic/tclStubInit.c: and various more win32-specific internal functions for + * generic/tclStubInit.c: and various more win32-specific internal functions for * unix/Makefile.in: Cygwin, so win32 extensions using those can be * unix/tcl.m4: loaded in the cygwin version of tclsh. * unix/configure: @@ -76,7 +86,7 @@ * generic/tcl.decls: [Bug 3508771] load tclreg.dll in cygwin tclsh * generic/tclInt.decls: Implement TclWinGetPlatformId, Tcl_WinUtfToTChar, - * generic/tclIntPlatDecls.h: Tcl_WinTCharToUtf (and a dummy TclWinCPUID) for + * generic/tclIntPlatDecls.h: Tcl_WinTCharToUtf (and a dummy TclWinCPUID) for * generic/tclPlatDecls.h: Cygwin, so win32 extensions using those can be * generic/tclStubInit.c: loaded in the cygwin version of tclsh. * unix/tclUnixCompat.c: @@ -117,7 +127,7 @@ * generic/tclStringObj.c: [Bug 3484402] Correct Off-By-One error appending unicode. Thanks to Poor Yorick. Also corrected test - for when growth is needed. + for when growth is needed. 2012-02-06 Don Porter <dgp@users.sourceforge.net> @@ -141,7 +151,7 @@ 2012-01-22 Jan Nijtmans <nijtmans@users.sf.net> - * tools/uniClass.tcl: [Frq 3473670]: Various Unicode-related + * tools/uniClass.tcl: [Frq 3473670]: Various Unicode-related * tools/uniParse.tcl: speedups/robustness. Enhanced tools to * generic/tclUniData.c: be able to handle characters > 0xffff * generic/tclUtf.c: Done in all branches in order to simplify @@ -589,7 +599,7 @@ * generic/tclEncoding.c: (Backport) Fix [Bug 2891556] and improve * tests/econding.test: test to detect similar manifestations in the future. - + 2009-11-12 Andreas Kupries <andreask@activestate.com> * generic/tclIO.c (CopyData): [Bug 2895565]. Dropped bogosity @@ -713,7 +723,7 @@ (TclArgumentBCRelease, TclArgumentGet): * generic/tclCompile.c (EnterCmdWordIndex, TclCleanupByteCode, (TclInitCompileEnv, TclCompileScript): - * generic/tclCompile.h (ExtCmdLoc): + * generic/tclCompile.h (ExtCmdLoc): * generic/tclExecute.c (TclExecuteByteCode): * generic/tclInt.h (ExtIndex, CFWordBC): * tests/info.test (info-39.0): @@ -722,7 +732,7 @@ sharing better. The code here is much simpler (trimmed down) compared to the head as the 8.4 branch is not bytecode compiling whole files, and doesn't compile eval'd code either. - + Reworked the handling of literal command arguments in bytecode to be saved (compiler) and used (execution) per command (See the TCL_INVOKE_STK* instructions), and not per the whole bytecode. @@ -777,7 +787,7 @@ 2009-04-08 Don Porter <dgp@users.sourceforge.net> * library/tcltest/tcltest.tcl: Fixed unsafe [eval]s in the tcltest - * library/tcltest/pkgIndex.tcl: package. [Bug 2570363] + * library/tcltest/pkgIndex.tcl: package. [Bug 2570363] 2009-04-07 Don Porter <dgp@users.sourceforge.net> @@ -857,7 +867,7 @@ 2008-12-03 Don Porter <dgp@users.sourceforge.net> - * generic/tclFileName.c (TclDoGlob): One of the + * generic/tclFileName.c (TclDoGlob): One of the Tcl_FSMatchInDirectory() calls did not have its return code checked. Some VFS drivers can return TCL_ERROR, and when that's not checked, the error message gets converted into a list of @@ -1078,7 +1088,7 @@ * generic/tclAsync.c: Tcl_AsyncDelete(): panic if attempt to locate handler token fails. Happens when some other - thread attempts to delete somebody else's token. + thread attempts to delete somebody else's token. Also, panic early if we find out the wrong thread attempting to delete the async handler (common trap). As, only the one @@ -1107,7 +1117,7 @@ * unix/tclUnixTime.c (TclpGetClicks, Tcl_GetTime): Removed obsolete use of 'struct timezone' in the call to 'gettimeofday'. [Bug 1942197]. - + 2008-04-14 Don Porter <dgp@users.sourceforge.net> * generic/tclExecute.c: Plug memory leak introduced in the @@ -1158,7 +1168,7 @@ * tests/io.test (io-53.8,53.9,53.10): Backported das' fix of typo and quoting for spaces in builddir path. - + 2008-04-07 Andreas Kupries <andreask@activestate.com> * tests/io.test (io-53.10): Testcase for bi-directionaly fcopy. @@ -1450,7 +1460,7 @@ the %c format code to avoid a buffer overrun when formatting (for example) a Friday in February in the Portuguese locale. [Bug 1751117] - + 2007-08-24 Miguel Sofer <msofer@users.sf.net> * generic/tclCompile.c: replaced copy loop that tripped some @@ -1530,7 +1540,7 @@ * unix/Makefile.in (Darwin): Tcl and tclsh plists into their * macosx/Tclsh-Info.plist.in (new): binaries in all cases. - * unix/tcl.m4 (Darwin): fix CF checks in fat 32&64bit builds. + * unix/tcl.m4 (Darwin): fix CF checks in fat 32&64bit builds. * unix/configure: autoconf-2.13 2007-06-05 Don Porter <dgp@users.sourceforge.net> @@ -1568,7 +1578,7 @@ 2007-05-15 Don Porter <dgp@users.sourceforge.net> - * generic/tclNamesp.c: Plugged memory leak related to + * generic/tclNamesp.c: Plugged memory leak related to [namespace delete ::]. [Bug 1716782] * changes: updates for 8.4.15 release. @@ -1633,16 +1643,16 @@ * unix/tclUnixPort.h: for TclpLocaltime and TclpGmtime. * unix/tclUnixTime.c: CONST TclpTime_t is a 'time_t *CONST' * win/tclWinTime.c: and not a 'CONST time_t*' [Bug 1677275] - * generic/tclIntDecls.h: + * generic/tclIntDecls.h: * generic/tclIntPlatDecls.h: Regenerated. - + 2007-03-24 Zoran Vasiljevic <vasiljevic@users.sourceforge.net> - * win/tclWinThrd.c: Thread exit handler marks the current + * win/tclWinThrd.c: Thread exit handler marks the current thread as un-initialized. This allows exit handlers that - are registered later to re-initialize this subsystem in + are registered later to re-initialize this subsystem in case they need to use some sync primitives (cond variables) - from this file again. + from this file again. 2007-03-19 Don Porter <dgp@users.sourceforge.net> @@ -1652,7 +1662,7 @@ * win/tclAppInit.c (setargv): supports memory debugging. 2007-03-17 Kevin Kenny <kennykb@acm.org> - + * win/tclWinReg.c (GetKeyNames): Size the buffer for enumerating key names correctly, so that Unicode names exceeding 127 chars can be retrieved without crashing. [Bug 1682211] @@ -1753,7 +1763,7 @@ * macosx/tclMacOSXNotify.c: accommodate changes to prototypes of OSSpinLock(Un)Lock API. - + * tests/env.test: add extra system env vars that need to be preserved on some Mac OS X versions for testsuite to work. @@ -1822,7 +1832,7 @@ TclUnixWaitForFile would present select() with the wrong mask on an LP64 machine if a fd number exceeds 32. Thanks to Jean-Luc Fontaine for reporting and diagnosing [Bug 1602208] - + 2006-11-26 Daniel Steffen <das@users.sourceforge.net> * unix/tcl.m4 (Linux): --enable-64bit support. [Patch 1597389] @@ -1842,7 +1852,7 @@ * generic/tclBasic.c (TEOVI): * tests/trace.test (trace-21.11): fix for [Bug 1590232], execution traces may cause a second command resolution in the wrong - namespace. + namespace. 2006-11-01 Daniel Steffen <das@users.sourceforge.net> @@ -1878,7 +1888,7 @@ * generic/tclInt.h: `make checkexports` test. * win/tclWin32Dll.c: * win/tclWinFile.c: - + 2006-10-16 Daniel Steffen <das@users.sourceforge.net> * changes: updates for 8.4.14 release. @@ -1910,7 +1920,7 @@ [Bug 1560506] * generic/tcl.h: note limitation on changing Tcl_UniChar size - * generic/tclEncoding.c (UtfToUnicodeProc, UnicodeToUtfProc): + * generic/tclEncoding.c (UtfToUnicodeProc, UnicodeToUtfProc): * tests/encoding.test (encoding-16.1): fix alignment issues in unicode <> utf conversion procs. [Bug 1122671] @@ -1928,7 +1938,7 @@ 2006-10-01 Pat Thoyts <patthoyts@users.sourceforge.net> * win/tclWinFile.c: Handle possible missing define. - * win/tclWinFile.c: Backported fix for [Bug 1420432] (cannot set + * win/tclWinFile.c: Backported fix for [Bug 1420432] (cannot set * tests/cmdAH.test: mtime for directories on windows). 2006-09-30 Miguel Sofer <msofer@users.sf.net> @@ -1966,12 +1976,12 @@ 2006-09-24 Miguel Sofer <msofer@users.sf.net> - * generic/tclParse.c (Tcl_ParseCommand): also return an error if + * generic/tclParse.c (Tcl_ParseCommand): also return an error if start==NULL and numBytes<0. This is coverity's bug #20 * generic/tclStringObj.c (STRING_SIZE): fix allocation for 0-length strings. This is coverity's bugs #54-5 - + 2006-09-22 Andreas Kupries <andreask@activestate.com> * generic/tclInt.h: Moved TIP#268's field 'packagePrefer' to the end @@ -1996,7 +2006,7 @@ * generic/tclBasic.c: Define TCL_TIP268 to activate the new * generic/tclDecls.h: features. * generic/tclInt.h: - * generic/tclPkg.c: + * generic/tclPkg.c: * generic/tclStubInit.c: * generic/tclTest.c: * library/init.tcl @@ -2026,7 +2036,7 @@ 2006-09-11 Andreas Kupries <andreask@activestate.com> * tests/msgcat.test: Bumped version in auxiliary files as well. - * doc/msgcat.n: + * doc/msgcat.n: 2006-09-11 Daniel Steffen <das@users.sourceforge.net> @@ -2085,7 +2095,7 @@ * unix/tclUnixCompat.c return ptrs to TSD storage * unix/tclUnixFCmd.c making them all look like their * unix/tclUnixPort.h MT-unsafe pendants API-wise. - * unix/tclUnixSock.c + * unix/tclUnixSock.c 2006-09-06 Zoran Vasiljevic <vasiljevic@users.sourceforge.net> @@ -2127,7 +2137,7 @@ * generic/tclBasic.c (Tcl_CreateInterp): init iPtr->threadId - * generic/tclIOGT.c (ExecuteCallback): + * generic/tclIOGT.c (ExecuteCallback): * generic/tclPkg.c (Tcl_PkgRequireEx): replace Tcl_GlobalEval(Obj) with more efficient Tcl_Eval(Obj)Ex @@ -2174,7 +2184,7 @@ * unix/tclUnixPort.h: on Darwin x86_64, disable use of vfork as it causes execve to fail intermittently. (rdar://4685553) - + * macosx/README: updates for x86_64 support and Xcode 2.4. * unix/tclUnixChan.c (TclUnixWaitForFile): with timeout < 0, if @@ -2198,7 +2208,7 @@ * tests/clock.test: Allowed UTC as a synonym for GMT in two tests that indirectly invoke 'strftime' with the result of 'gmtime' to fix a bogus test failure on FreeBSD systems. [Bug 1513489] - + 2006-07-30 Joe English <jenglish@users.sourceforge.net> * doc/AppInit.3: Fix typo [Bug 1496886] @@ -2274,7 +2284,7 @@ * tests/env.test: most of the standard C library and now * win/makefile.vc: generate manifest files to be linked into the * win/nmakehlp.c: binaries. [Bug 1424909] - * win/rules.vc: + * win/rules.vc: * win/tclWinTime.c: 2006-06-13 Donal K. Fellows <donal.k.fellows@man.ac.uk> @@ -2453,7 +2463,7 @@ 2006-03-27 Pat Thoyts <patthoyts@users.sourceforge.net> - * win/tclWinTest.c: Fixes for [Bug 1456373] (mingw-gcc issue) + * win/tclWinTest.c: Fixes for [Bug 1456373] (mingw-gcc issue) 2006-03-23 Don Porter <dgp@users.sourceforge.net> @@ -2476,7 +2486,7 @@ 2006-03-16 Andreas Kupries <andreask@activestate.com> * doc/open.n: Documented the changed behaviour of 'a'ppend mode. - + * tests/io.test (io-43.1 io-44.[1234]): Rewritten to be self-contained with regard to setup and cleanup. [Bug 681793] @@ -2537,7 +2547,7 @@ TclFinalizeIOSubsystem(). * unix/tclUnixSock: Added no-op TclpFinalizeSockets(). - + * mac/tclMacSock.c: * win/tclWinPipe.c * win/tclWinSock.c: Finalization of the sockets/pipes is now solely @@ -2548,8 +2558,8 @@ 2006-03-10 Vince Darley <vincentdarley@sourceforge.net> - * win/tclWin32Dll.c: - * win/tclWinInt.h: + * win/tclWin32Dll.c: + * win/tclWinInt.h: * win/tclWinFile.c: backported some fixes from HEAD relating to 'file readable' and 'file writable', but main 'file writable' bug still outstanding. @@ -2614,7 +2624,7 @@ 2006-01-23 Miguel Sofer <msofer@users.sf.net> - * generic/tclStringObj.c (Tcl_GetRange): + * generic/tclStringObj.c (Tcl_GetRange): * tests/stringTest (string-12.21):fixed incorrect handling of internal rep in Tcl_GetRange. Thanks to twylite and Peter Spjuth. [Bug 1410553] @@ -2623,7 +2633,7 @@ * generic/tclPipe.c (FileForRedirect): Prevent nameString from being freed without having been initialized. * tests/exec.test: Added a test for the above. - + 2006-01-12 Zoran Vasiljevic <vasiljevic@users.sourceforge.net> * generic/tclIOUtil.c (Tcl_FSGetInternalRep): fixed potential @@ -2642,7 +2652,7 @@ * unix/tcl.m4: quoting, sync relevant tclconfig/tcl.m4 and HEAD changes and gratuitous formatting differences, fix SC_CONFIG_MANPAGES with default argument, Darwin improvements to SC_LOAD_*CONFIG. - + 2006-01-09 Don Porter <dgp@users.sourceforge.net> * generic/tclNamesp.c (NamespaceInscopeCmd): [namespace inscope] @@ -3843,7 +3853,7 @@ * unix/tcl.m4 (Darwin): fixed bug with static build linking to dynamic library in /usr/lib etc instead of linking to static library earlier - in search path. [Bug 956908] + in search path. [Bug 956908] Removed obsolete references to Rhapsody. * unix/configure: autoconf-2.13 @@ -4171,7 +4181,7 @@ * win/tclWinTime.c (TclpGmtime, TclpLocaltime): Changed type signatures of TclpGmtime and TclpLocaltime to accept CONST TclpTime_t throughout, to avoid any possible confusion in pedantic compilers. - [Bug 1001319] + [Bug 1001319] * generic/tclIntDecls.h: * generic/tclIntPlatDecls.h: Regenerated. @@ -5522,7 +5532,7 @@ * doc/GetIndex.3: Also dropped references to ASCII that are no * doc/Hash.3: longer true, and standardized on the * doc/LinkVar.3: hyphenated spelling of "null-terminated". - * doc/Macintosh.3: + * doc/Macintosh.3: * doc/OpenFileChnl.3: * doc/SetVar.3: * doc/StringObj.3: @@ -7569,7 +7579,7 @@ * generic/tclCmdMZ.c: * tests/trace.test: applied patch from Hemang Levana to fix [Bug - 615043] in execution traces with idle tasks firing. + 615043] in execution traces with idle tasks firing. 2002-10-14 Jeff Hobbs <jeffh@ActiveState.com> @@ -9543,7 +9553,7 @@ * unix/dltest/Makefile.in: Remove hard coded CFLAGS=-g and add CFLAGS_DEBUG, CFLAGS_OPTIMIZE, and CFLAGS_DEFAULT varaibles. [Bug - 565488] + 565488] 2002-06-06 Don Porter <dgp@users.sourceforge.net> @@ -9856,7 +9866,7 @@ * tests/safe.test: * tests/tcltest.test: Corrected some list-quoting issues and other matters that cause tests to fail when the patch includes special - characters. Report from Vince Darley. [Bug 554068]. + characters. Report from Vince Darley. [Bug 554068]. 2002-05-08 David Gravereaux <davygrvy@pobox.com> @@ -10090,7 +10100,7 @@ * tests/iogt.test: Revised to run tests in a namespace, rather than use the useless and buggy [saveState] and [restoreState] commands of - tcltest. Updated to use tcltest 2 as well. [Patch 544911] + tcltest. Updated to use tcltest 2 as well. [Patch 544911] 2002-04-16 Don Porter <dgp@users.sourceforge.net> @@ -10236,7 +10246,7 @@ * win/makefile.vc: winhelp target now copies all needed files from tools/ to a workarea under $(OUT_DIR) and builds it from there. No build cruft is left in tools/ anymore. All paths used in man2help.tcl - are now relative to where the script is. [Bug 527941] + are now relative to where the script is. [Bug 527941] 2002-03-27 David Gravereaux <davygrvy@pobox.com> @@ -10358,7 +10368,7 @@ * generic/tclBasic.c (Tcl_EvalObjEx): * generic/tclExecute.c (TclCompEvalObj): fixed the errorInfo for return codes other than (TCL_OK, TCL_ERROR) to runLevel 0 [Bug - 533758]. Removed the static RecordTracebackInfo(), as its + 533758]. Removed the static RecordTracebackInfo(), as its functionality is easily replicated by Tcl_LogCommandInfo. Bug and redundancy noted by Don Porter. @@ -10385,7 +10395,7 @@ (Tcl_GetVar2, Tcl_SetVar2, Tcl_TraceVar2, Tcl_UnsetVar2) (Tcl_UntraceVar2, Tcl_UpVar2, Tcl_VarTraceInfo2, Tcl_GetVar2Ex) (TclSetVar2Ex): Updated interfaces of generic/tclVar.c according to - TIP 27. In particular, the "part2" arguments were CONSTified. + TIP 27. In particular, the "part2" arguments were CONSTified. [Patch 532642] * generic/tclDecls.h: * generic/tclIntDecls.h: make genstubs @@ -11595,7 +11605,7 @@ * unix/tclUnixChan.c (TclpOpenFileChannel): * win/tclWinChan.c (TclpOpenFileChannel): Updated APIs in generic/tclIOUtil.c and generic/tclPosixStr.c according to the - guidelines of TIP 27. Updated callers. [Patch 499196] + guidelines of TIP 27. Updated callers. [Patch 499196] * generic/tclDecls.h: * generic/tclIntDecls.h: make genstubs diff --git a/generic/tclInt.decls b/generic/tclInt.decls index d380270..ef2f6df 100644 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -856,7 +856,7 @@ declare 7 win { 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) @@ -953,12 +953,14 @@ declare 0 unix { declare 1 unix { void TclWinConvertWSAError(unsigned int errCode) } +# On non-cygwin, this is actually a reference to TclpCreateCommandChannel declare 2 unix { - Tcl_Channel TclpCreateCommandChannel(TclFile readFile, - TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr) + struct servent *TclWinGetServByName(const char *nm, const char *proto) } +# On non-cygwin, this is actually a reference to TclpCreatePipe declare 3 unix { - int TclpCreatePipe(TclFile *readPipe, TclFile *writePipe) + int TclWinGetSockOpt(void *s, int level, int optname, + char *optval, int *optlen) } # On non-cygwin, this is actually a reference to TclpCreateProcess declare 4 unix { @@ -978,8 +980,9 @@ declare 7 unix { int TclWinSetSockOpt(void *s, int level, int optname, const char *optval, int optlen) } +# On non-cygwin, this is actually a reference to TclUnixWaitForFile declare 8 unix { - int TclUnixWaitForFile(int fd, int mask, int timeout) + int TclpGetPid(Tcl_Pid pid) } # Added in 8.1: @@ -1004,8 +1007,10 @@ declare 11 unix { declare 12 unix { struct tm *TclpGmtime_unix(TclpTime_t_CONST clock) } +# On cygwin, this is a reference to TclpCreateCommandChannel +# Otherwise, this is a reference to TclpInetNtoa declare 13 unix { - char *TclpInetNtoa(struct in_addr addr) + void TclIntPlatReserved13(void) } #On cygwin, TclpCreateProcess is here declare 15 unix { @@ -1049,7 +1054,30 @@ declare 30 unix { declare 31 unix { int TclpCloseFile(TclFile file) } - +declare 32 unix { + Tcl_Channel TclpCreateCommandChannel(TclFile readFile, + TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr) +} +declare 33 unix { + int TclpCreatePipe(TclFile *readPipe, TclFile *writePipe) +} +declare 34 unix { + int TclpCreateProcess(Tcl_Interp *interp, + int argc, const char **argv, TclFile inputFile, + TclFile outputFile, TclFile errorFile, Tcl_Pid *pidPtr) +} +declare 35 unix { + char *TclpInetNtoa(struct in_addr addr) +} +declare 36 unix { + TclFile TclpMakeFile(Tcl_Channel channel, int direction) +} +declare 37 unix { + TclFile TclpOpenFile(const char *fname, int mode) +} +declare 38 unix { + int TclUnixWaitForFile(int fd, int mask, int timeout) +} # Local Variables: # mode: tcl diff --git a/generic/tclIntPlatDecls.h b/generic/tclIntPlatDecls.h index 7ce711d..63f9fe6 100644 --- a/generic/tclIntPlatDecls.h +++ b/generic/tclIntPlatDecls.h @@ -13,16 +13,6 @@ #ifndef _TCLINTPLATDECLS #define _TCLINTPLATDECLS -#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ -EXTERN int TclpCreateProcess _ANSI_ARGS_((Tcl_Interp *interp, - int argc, CONST char **argv, TclFile inputFile, - TclFile outputFile, TclFile errorFile, Tcl_Pid *pidPtr)); -EXTERN TclFile TclpMakeFile _ANSI_ARGS_((Tcl_Channel channel, - int direction)); -EXTERN TclFile TclpOpenFile _ANSI_ARGS_((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 @@ -42,13 +32,11 @@ EXTERN void TclWinConvertError _ANSI_ARGS_((unsigned int errCode)); EXTERN void TclWinConvertWSAError _ANSI_ARGS_(( unsigned int errCode)); /* 2 */ -EXTERN Tcl_Channel TclpCreateCommandChannel _ANSI_ARGS_(( - TclFile readFile, TclFile writeFile, - TclFile errorFile, int numPids, - Tcl_Pid *pidPtr)); +EXTERN struct servent * TclWinGetServByName _ANSI_ARGS_((CONST char *nm, + CONST char *proto)); /* 3 */ -EXTERN int TclpCreatePipe _ANSI_ARGS_((TclFile *readPipe, - TclFile *writePipe)); +EXTERN int TclWinGetSockOpt _ANSI_ARGS_((VOID *s, int level, + int optname, char *optval, int *optlen)); /* 4 */ EXTERN VOID * TclWinGetTclInstance _ANSI_ARGS_((void)); /* Slot 5 is reserved */ @@ -58,8 +46,7 @@ EXTERN unsigned short TclWinNToHS _ANSI_ARGS_((unsigned short ns)); 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)); +EXTERN int TclpGetPid _ANSI_ARGS_((Tcl_Pid pid)); /* 9 */ EXTERN int TclWinGetPlatformId _ANSI_ARGS_((void)); /* 10 */ @@ -70,7 +57,7 @@ EXTERN struct tm * TclpLocaltime_unix _ANSI_ARGS_(( /* 12 */ EXTERN struct tm * TclpGmtime_unix _ANSI_ARGS_((TclpTime_t_CONST clock)); /* 13 */ -EXTERN char * TclpInetNtoa _ANSI_ARGS_((struct in_addr addr)); +EXTERN void TclIntPlatReserved13 _ANSI_ARGS_((void)); /* Slot 14 is reserved */ /* 15 */ EXTERN int TclMacOSXGetFileAttribute _ANSI_ARGS_(( @@ -110,6 +97,30 @@ EXTERN void TclGetAndDetachPids _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Channel chan)); /* 31 */ EXTERN int TclpCloseFile _ANSI_ARGS_((TclFile file)); +/* 32 */ +EXTERN Tcl_Channel TclpCreateCommandChannel _ANSI_ARGS_(( + TclFile readFile, TclFile writeFile, + TclFile errorFile, int numPids, + Tcl_Pid *pidPtr)); +/* 33 */ +EXTERN int TclpCreatePipe _ANSI_ARGS_((TclFile *readPipe, + TclFile *writePipe)); +/* 34 */ +EXTERN int TclpCreateProcess _ANSI_ARGS_((Tcl_Interp *interp, + int argc, CONST char **argv, + TclFile inputFile, TclFile outputFile, + TclFile errorFile, Tcl_Pid *pidPtr)); +/* 35 */ +EXTERN char * TclpInetNtoa _ANSI_ARGS_((struct in_addr addr)); +/* 36 */ +EXTERN TclFile TclpMakeFile _ANSI_ARGS_((Tcl_Channel channel, + int direction)); +/* 37 */ +EXTERN TclFile TclpOpenFile _ANSI_ARGS_((CONST char *fname, + int mode)); +/* 38 */ +EXTERN int TclUnixWaitForFile _ANSI_ARGS_((int fd, int mask, + int timeout)); #endif /* UNIX */ #ifdef __WIN32__ /* 0 */ @@ -131,7 +142,7 @@ EXTERN u_short TclWinNToHS _ANSI_ARGS_((u_short ns)); 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)); +EXTERN int TclpGetPid _ANSI_ARGS_((Tcl_Pid pid)); /* 9 */ EXTERN int TclWinGetPlatformId _ANSI_ARGS_((void)); /* Slot 10 is reserved */ @@ -261,18 +272,18 @@ typedef struct TclIntPlatStubs { #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 */ + struct servent * (*tclWinGetServByName) _ANSI_ARGS_((CONST char *nm, CONST char *proto)); /* 2 */ + int (*tclWinGetSockOpt) _ANSI_ARGS_((VOID *s, int level, int optname, char *optval, int *optlen)); /* 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 (*tclpGetPid) _ANSI_ARGS_((Tcl_Pid pid)); /* 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 (*tclIntPlatReserved13) _ANSI_ARGS_((void)); /* 13 */ VOID *reserved14; int (*tclMacOSXGetFileAttribute) _ANSI_ARGS_((Tcl_Interp *interp, int objIndex, Tcl_Obj *fileName, Tcl_Obj **attributePtrPtr)); /* 15 */ VOID *reserved16; @@ -291,6 +302,13 @@ typedef struct TclIntPlatStubs { 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 */ + Tcl_Channel (*tclpCreateCommandChannel) _ANSI_ARGS_((TclFile readFile, TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr)); /* 32 */ + int (*tclpCreatePipe) _ANSI_ARGS_((TclFile *readPipe, TclFile *writePipe)); /* 33 */ + int (*tclpCreateProcess) _ANSI_ARGS_((Tcl_Interp *interp, int argc, CONST char **argv, TclFile inputFile, TclFile outputFile, TclFile errorFile, Tcl_Pid *pidPtr)); /* 34 */ + char * (*tclpInetNtoa) _ANSI_ARGS_((struct in_addr addr)); /* 35 */ + TclFile (*tclpMakeFile) _ANSI_ARGS_((Tcl_Channel channel, int direction)); /* 36 */ + TclFile (*tclpOpenFile) _ANSI_ARGS_((CONST char *fname, int mode)); /* 37 */ + int (*tclUnixWaitForFile) _ANSI_ARGS_((int fd, int mask, int timeout)); /* 38 */ #endif /* UNIX */ #ifdef __WIN32__ void (*tclWinConvertError) _ANSI_ARGS_((DWORD errCode)); /* 0 */ @@ -301,7 +319,7 @@ typedef struct TclIntPlatStubs { 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 (*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 */ @@ -378,13 +396,13 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #define TclWinConvertWSAError \ (tclIntPlatStubsPtr->tclWinConvertWSAError) /* 1 */ #endif -#ifndef TclpCreateCommandChannel -#define TclpCreateCommandChannel \ - (tclIntPlatStubsPtr->tclpCreateCommandChannel) /* 2 */ +#ifndef TclWinGetServByName +#define TclWinGetServByName \ + (tclIntPlatStubsPtr->tclWinGetServByName) /* 2 */ #endif -#ifndef TclpCreatePipe -#define TclpCreatePipe \ - (tclIntPlatStubsPtr->tclpCreatePipe) /* 3 */ +#ifndef TclWinGetSockOpt +#define TclWinGetSockOpt \ + (tclIntPlatStubsPtr->tclWinGetSockOpt) /* 3 */ #endif #ifndef TclWinGetTclInstance #define TclWinGetTclInstance \ @@ -399,9 +417,9 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #define TclWinSetSockOpt \ (tclIntPlatStubsPtr->tclWinSetSockOpt) /* 7 */ #endif -#ifndef TclUnixWaitForFile -#define TclUnixWaitForFile \ - (tclIntPlatStubsPtr->tclUnixWaitForFile) /* 8 */ +#ifndef TclpGetPid +#define TclpGetPid \ + (tclIntPlatStubsPtr->tclpGetPid) /* 8 */ #endif #ifndef TclWinGetPlatformId #define TclWinGetPlatformId \ @@ -419,9 +437,9 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #define TclpGmtime_unix \ (tclIntPlatStubsPtr->tclpGmtime_unix) /* 12 */ #endif -#ifndef TclpInetNtoa -#define TclpInetNtoa \ - (tclIntPlatStubsPtr->tclpInetNtoa) /* 13 */ +#ifndef TclIntPlatReserved13 +#define TclIntPlatReserved13 \ + (tclIntPlatStubsPtr->tclIntPlatReserved13) /* 13 */ #endif /* Slot 14 is reserved */ #ifndef TclMacOSXGetFileAttribute @@ -477,6 +495,34 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #define TclpCloseFile \ (tclIntPlatStubsPtr->tclpCloseFile) /* 31 */ #endif +#ifndef TclpCreateCommandChannel +#define TclpCreateCommandChannel \ + (tclIntPlatStubsPtr->tclpCreateCommandChannel) /* 32 */ +#endif +#ifndef TclpCreatePipe +#define TclpCreatePipe \ + (tclIntPlatStubsPtr->tclpCreatePipe) /* 33 */ +#endif +#ifndef TclpCreateProcess +#define TclpCreateProcess \ + (tclIntPlatStubsPtr->tclpCreateProcess) /* 34 */ +#endif +#ifndef TclpInetNtoa +#define TclpInetNtoa \ + (tclIntPlatStubsPtr->tclpInetNtoa) /* 35 */ +#endif +#ifndef TclpMakeFile +#define TclpMakeFile \ + (tclIntPlatStubsPtr->tclpMakeFile) /* 36 */ +#endif +#ifndef TclpOpenFile +#define TclpOpenFile \ + (tclIntPlatStubsPtr->tclpOpenFile) /* 37 */ +#endif +#ifndef TclUnixWaitForFile +#define TclUnixWaitForFile \ + (tclIntPlatStubsPtr->tclUnixWaitForFile) /* 38 */ +#endif #endif /* UNIX */ #ifdef __WIN32__ #ifndef TclWinConvertError @@ -702,8 +748,17 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #undef TclpLocaltime_unix #undef TclpGmtime_unix +#undef TclIntPlatReserved13 + +#if !defined(__WIN32__) && !defined(MAC_TCL) +# undef TclpGetPid +# define TclpGetPid(pid) ((unsigned long) (pid)) -#if !defined(__WIN32__) && !defined(MAC_TCL) && defined(USE_TCL_STUBS) +# if defined(USE_TCL_STUBS) +# undef TclpCreateProcess +# undef TclpMakeFile +# undef TclpOpenFile +# undef TclpCreateCommandChannel # ifdef __CYGWIN__ # define TclpCreateProcess ((int (*) _ANSI_ARGS_((Tcl_Interp *, int, \ CONST char **, TclFile, TclFile, TclFile, Tcl_Pid *))) \ @@ -712,6 +767,8 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; int direction))) tclIntPlatStubsPtr->tclMacOSXMatchType) # define TclpOpenFile ((TclFile (*) _ANSI_ARGS_((CONST char *, int))) \ tclIntPlatStubsPtr->tclMacOSXNotifierAddRunLoopMode) +# define TclpCreateCommandChannel ((Tcl_Channel (*) _ANSI_ARGS_((TclFile, TclFile, \ + TclFile, int, Tcl_Pid *))) tclIntPlatStubsPtr->tclIntPlatReserved13) # else # define TclpCreateProcess ((int (*) _ANSI_ARGS_((Tcl_Interp *, int, \ CONST char **, TclFile, TclFile, TclFile, Tcl_Pid *))) \ @@ -719,11 +776,16 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; # define TclpMakeFile ((TclFile (*) _ANSI_ARGS_((Tcl_Channel channel, \ int direction))) tclIntPlatStubsPtr->tclWinNToHS) # define TclpOpenFile ((TclFile (*) _ANSI_ARGS_((CONST char *, int))) \ - tclIntPlatStubsPtr->tclWinNToHS) + tclIntPlatStubsPtr->tclWinSetSockOpt) +# define TclpCreateCommandChannel ((Tcl_Channel (*) _ANSI_ARGS_((TclFile, TclFile, \ + TclFile, int, Tcl_Pid *))) tclIntPlatStubsPtr->tclWinGetServByName) # undef TclpCreateTempFile # undef TclGetAndDetachPids # undef TclpCloseFile +# undef TclpCreatePipe +# undef TclpInetNtoa +# undef TclUnixWaitForFile # define TclpCreateTempFile ((TclFile (*) _ANSI_ARGS_((CONST char *))) \ tclIntPlatStubsPtr->tclWinGetPlatformId) @@ -731,7 +793,14 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; tclIntPlatStubsPtr->tclWinConvertError) # define TclpCloseFile ((int (*) _ANSI_ARGS_((TclFile))) \ tclIntPlatStubsPtr->tclWinConvertWSAError) +# define TclpCreatePipe ((int (*)_ANSI_ARGS_((TclFile *, TclFile *))) \ + tclIntPlatStubsPtr->tclWinGetSockOpt) +# define TclpInetNtoa ((char *(*) _ANSI_ARGS_((struct in_addr addr))) \ + tclIntPlatStubsPtr->tclIntPlatReserved13) +# define TclUnixWaitForFile (int (*) _ANSI_ARGS_((int, int, int))) \ + tclIntPlatStubsPtr->tclpGetPid) # endif +# endif #endif #endif /* _TCLINTPLATDECLS */ diff --git a/generic/tclPipe.c b/generic/tclPipe.c index 1042e09..6e7029e 100644 --- a/generic/tclPipe.c +++ b/generic/tclPipe.c @@ -283,7 +283,7 @@ TclCleanupChildren(interp, numPids, pidPtr, errorChan) 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 + * the windows implementation of Tcl_WaitPid deletes the * information such that any following calls to TclpGetPid * fail. */ diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 7fa070b..8b6e22b 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 /* @@ -81,11 +82,15 @@ int __stdcall GetModuleHandleExW(unsigned int, const char *, void *); #define TclWinGetTclInstance winGetTclInstance #define TclWinNToHS winNToHS #define TclWinSetSockOpt winSetSockOpt +#define TclWinGetSockOpt winGetSockOpt +#define TclWinGetServByName winGetServByName #define TclWinNoBackslash winNoBackslash #define TclWinSetInterfaces (void (*) (int)) doNothing #define TclWinAddProcess (void (*) (void *, unsigned int)) doNothing +#define TclIntPlatReserved13 (void (*) ()) TclpCreateCommandChannel #define TclWinFlushDirtyChannels doNothing #define TclWinResetInterfaces doNothing +#define TclpGetPid getPid static Tcl_Encoding winTCharEncoding; @@ -118,6 +123,19 @@ TclWinSetSockOpt(void *s, int level, int optname, return setsockopt((int) s, level, optname, optval, optlen); } +static int +TclWinGetSockOpt(void *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); +} + static char * TclWinNoBackslash(char *path) { @@ -131,6 +149,12 @@ TclWinNoBackslash(char *path) return path; } +static int +TclpGetPid(Tcl_Pid pid) +{ + return (int) (size_t) pid; +} + static void doNothing(void) { @@ -182,11 +206,15 @@ Tcl_WinTCharToUtf( # 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 TclWinGetSockOpt (int (*) _ANSI_ARGS_((void *, int, int, char *, int))) TclpCreatePipe +# define TclWinGetServByName (struct servent *(*) _ANSI_ARGS_((const char *nm, const char *proto))) TclpCreateCommandChannel +# define TclIntPlatReserved13 (void (*) ()) TclpInetNtoa # define TclWinAddProcess 0 # define TclWinNoBackslash 0 # define TclWinSetInterfaces 0 # define TclWinFlushDirtyChannels 0 # define TclWinResetInterfaces 0 +# define TclpGetPid 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 */ @@ -449,18 +477,18 @@ TclIntPlatStubs tclIntPlatStubs = { #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ TclWinConvertError, /* 0 */ TclWinConvertWSAError, /* 1 */ - TclpCreateCommandChannel, /* 2 */ - TclpCreatePipe, /* 3 */ + TclWinGetServByName, /* 2 */ + TclWinGetSockOpt, /* 3 */ TclWinGetTclInstance, /* 4 */ NULL, /* 5 */ TclWinNToHS, /* 6 */ TclWinSetSockOpt, /* 7 */ - TclUnixWaitForFile, /* 8 */ + TclpGetPid, /* 8 */ TclWinGetPlatformId, /* 9 */ TclpReaddir, /* 10 */ TclpLocaltime_unix, /* 11 */ TclpGmtime_unix, /* 12 */ - TclpInetNtoa, /* 13 */ + TclIntPlatReserved13, /* 13 */ NULL, /* 14 */ TclMacOSXGetFileAttribute, /* 15 */ NULL, /* 16 */ @@ -479,6 +507,13 @@ TclIntPlatStubs tclIntPlatStubs = { TclWinCPUID, /* 29 */ TclGetAndDetachPids, /* 30 */ TclpCloseFile, /* 31 */ + TclpCreateCommandChannel, /* 32 */ + TclpCreatePipe, /* 33 */ + TclpCreateProcess, /* 34 */ + TclpInetNtoa, /* 35 */ + TclpMakeFile, /* 36 */ + TclpOpenFile, /* 37 */ + TclUnixWaitForFile, /* 38 */ #endif /* UNIX */ #ifdef __WIN32__ TclWinConvertError, /* 0 */ diff --git a/library/dde/pkgIndex.tcl b/library/dde/pkgIndex.tcl index f993012..e414051 100644 --- a/library/dde/pkgIndex.tcl +++ b/library/dde/pkgIndex.tcl @@ -1,5 +1,5 @@ -if {![package vsatisfies [package provide Tcl] 8]} {return} -if {[string compare $::tcl_platform(platform) windows]} {return} +if {![package vsatisfies [package provide Tcl] 8]} return +if {[string compare [info sharedlibextension] .dll]} return if {[info exists ::tcl_platform(debug)]} { package ifneeded dde 1.2.4 [list load [file join $dir tcldde12g.dll] dde] } else { diff --git a/library/reg/pkgIndex.tcl b/library/reg/pkgIndex.tcl index 3aed06f..35b1143 100755 --- a/library/reg/pkgIndex.tcl +++ b/library/reg/pkgIndex.tcl @@ -1,5 +1,5 @@ -if {![package vsatisfies [package provide Tcl] 8]} {return} -if {[string compare $::tcl_platform(platform) windows]} {return} +if {![package vsatisfies [package provide Tcl] 8]} return +if {[string compare [info sharedlibextension] .dll]} return if {[info exists ::tcl_platform(debug)]} { package ifneeded registry 1.1.5 \ [list load [file join $dir tclreg11g.dll] registry] diff --git a/mac/tclMacPort.h b/mac/tclMacPort.h index f427899..c5c1743 100644 --- a/mac/tclMacPort.h +++ b/mac/tclMacPort.h @@ -215,7 +215,6 @@ extern char **environ; * address platform-specific issues. */ -#define TclpGetPid(pid) ((unsigned long) (pid)) #define TclSetSystemEnv(a,b) #define tzset() diff --git a/unix/configure b/unix/configure index b933912..1a0d882 100755 --- a/unix/configure +++ b/unix/configure @@ -9324,6 +9324,48 @@ fi echo "$ac_t""$tcl_ok" 1>&6 #-------------------------------------------------------------------- +# The check below checks whether the cpuid instruction is usable. +#-------------------------------------------------------------------- + +echo $ac_n "checking whether the cpuid instruction is usable""... $ac_c" 1>&6 +echo "configure:9332: checking whether the cpuid instruction is usable" >&5 +if eval "test \"`echo '$''{'tcl_cv_cpuid'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + cat > conftest.$ac_ext <<EOF +#line 9338 "configure" +#include "confdefs.h" + +int main() { + + int index,ax,bx,cx,dx; + __asm__ __volatile__ ("cpuid":\ + "=a" (ax), "=b" (bx), "=c" (cx), "=d" (dx) : "a" (index)); + +; return 0; } +EOF +if { (eval echo configure:9349: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + tcl_cv_cpuid=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + tcl_cv_cpuid=no +fi +rm -f conftest* +fi + +echo "$ac_t""$tcl_cv_cpuid" 1>&6 +if test $tcl_cv_cpuid = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_CPUID 1 +EOF + +fi + +#-------------------------------------------------------------------- # The statements below define a collection of symbols related to # building libtcl as a shared library instead of a static library. #-------------------------------------------------------------------- @@ -9352,7 +9394,7 @@ if test "`uname -s`" = "Darwin" ; then if test "`uname -s`" = "Darwin" ; then echo $ac_n "checking how to package libraries""... $ac_c" 1>&6 -echo "configure:9356: checking how to package libraries" >&5 +echo "configure:9398: checking how to package libraries" >&5 # Check whether --enable-framework or --disable-framework was given. if test "${enable_framework+set}" = set; then enableval="$enable_framework" diff --git a/unix/configure.in b/unix/configure.in index fbf9f41..c04c735 100644 --- a/unix/configure.in +++ b/unix/configure.in @@ -566,6 +566,20 @@ fi AC_MSG_RESULT([$tcl_ok]) #-------------------------------------------------------------------- +# The check below checks whether the cpuid instruction is usable. +#-------------------------------------------------------------------- + +AC_CACHE_CHECK([whether the cpuid instruction is usable], tcl_cv_cpuid, [ + AC_TRY_LINK(, [ + int index,ax,bx,cx,dx; + __asm__ __volatile__ ("cpuid":\ + "=a" (ax), "=b" (bx), "=c" (cx), "=d" (dx) : "a" (index)); + ], tcl_cv_cpuid=yes, tcl_cv_cpuid=no)]) +if test $tcl_cv_cpuid = yes; then + AC_DEFINE(HAVE_CPUID) +fi + +#-------------------------------------------------------------------- # The statements below define a collection of symbols related to # building libtcl as a shared library instead of a static library. #-------------------------------------------------------------------- diff --git a/unix/tclUnixCompat.c b/unix/tclUnixCompat.c index 16e7a61..aad3d76 100644 --- a/unix/tclUnixCompat.c +++ b/unix/tclUnixCompat.c @@ -692,8 +692,11 @@ TclWinCPUID( { int status = TCL_ERROR; - /* There is no reason this couldn't be implemented on UNIX as well */ - return status; +#ifdef HAVE_CPUID + __asm__ __volatile__ ("cpuid":\ + "=a" (regsPtr[0]), "=b" (regsPtr[1]), "=c" (regsPtr[2]), "=d" (regsPtr[3]) : "a" (index)); + status = TCL_OK; +#endif return status; } /* diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c index 5eac978..4ba2e47 100644 --- a/unix/tclUnixFile.c +++ b/unix/tclUnixFile.c @@ -22,7 +22,8 @@ static int NativeMatchType(CONST char* nativeName, Tcl_GlobTypeData *types); * TclpFindExecutable -- * * This procedure computes the absolute path name of the current - * application, given its argv[0] value. + * application, given its argv[0] value. For Cygwin, argv[0] is + * ignored and the path is determined the same as under win32. * * Results: * A dirty UTF string that is the path to the executable. At this @@ -45,18 +46,44 @@ TclpFindExecutable(argv0) CONST char *argv0; /* The value of the application's argv[0] * (native). */ { + int length; +#ifdef __CYGWIN__ + char buf[PATH_MAX * TCL_UTF_MAX + 1]; + char name[PATH_MAX * TCL_UTF_MAX + 1]; +#else CONST char *name, *p; Tcl_StatBuf statBuf; - int length; Tcl_DString buffer, nameString; +#endif - if (argv0 == NULL) { - return NULL; - } if (tclNativeExecutableName != NULL) { return tclNativeExecutableName; } +#ifdef __CYGWIN__ + + /* Make some symbols available without including <windows.h> */ +# define CP_UTF8 65001 + extern int cygwin_conv_to_full_posix_path(const char *, char *); + extern __stdcall int GetModuleFileNameW(void *, const char *, int); + extern __stdcall int WideCharToMultiByte(int, int, const char *, int, + const char *, int, const char *, const char *); + + GetModuleFileNameW(NULL, name, PATH_MAX); + WideCharToMultiByte(CP_UTF8, 0, name, -1, buf, PATH_MAX, NULL, NULL); + cygwin_conv_to_full_posix_path(buf, name); + length = strlen(name); + if ((length > 4) && !strcasecmp(name + length - 4, ".exe")) { + /* Strip '.exe' part. */ + length -= 4; + } + tclNativeExecutableName = (char *) ckalloc(length + 1); + memcpy(tclNativeExecutableName, name, length); + buf[length] = '\0'; +#else + if (argv0 == NULL) { + return NULL; + } Tcl_DStringInit(&buffer); name = argv0; @@ -174,6 +201,7 @@ gotName: done: Tcl_DStringFree(&buffer); +#endif return tclNativeExecutableName; } diff --git a/unix/tclUnixPort.h b/unix/tclUnixPort.h index c0bf77d8..9426697 100644 --- a/unix/tclUnixPort.h +++ b/unix/tclUnixPort.h @@ -658,7 +658,6 @@ extern int copyfile(const char *from, const char *to, void *state, * address platform-specific issues. */ -#define TclpGetPid(pid) ((unsigned long) (pid)) #define TclpReleaseFile(file) /* Nothing. */ /* @@ -699,7 +698,6 @@ EXTERN struct tm * TclpLocaltime(TclpTime_t_CONST); #ifndef TclpGmtime EXTERN struct tm * TclpGmtime(TclpTime_t_CONST); #endif -EXTERN char * TclpInetNtoa(struct in_addr); #define inet_ntoa(x) TclpInetNtoa(x) #else typedef int TclpMutex; diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index d31380e..4c530e3 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -871,7 +871,7 @@ TclpCloseFile( *-------------------------------------------------------------------------- */ -unsigned long +int TclpGetPid( Tcl_Pid pid) /* The HANDLE of the child process. */ { |