Tcl Source Code

Check-in [533c11d007]
Login

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

Overview
Comment:Move CYGWIN-specific stuff from tclPort.h to tclUnixPort.h, where it belongs
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core-8-5-branch
Files: files | file ages | folders
SHA1: 533c11d007d8e745310500281326a69c5252bdc5
User & Date: jan.nijtmans 2012-04-27 14:30:23
Context
2012-05-02
06:48
TclWinCPUID now respects -fPIC compilation on 32-bit Linux check-in: 64a0a9db46 user: jan.nijtmans tags: core-8-5-branch
2012-04-27
14:37
Move CYGWIN-specific stuff from tclPort.h to tclUnixPort.h, where it belongs check-in: add6ea1397 user: jan.nijtmans tags: trunk
14:30
Move CYGWIN-specific stuff from tclPort.h to tclUnixPort.h, where it belongs check-in: 533c11d007 user: jan.nijtmans tags: core-8-5-branch
08:49
Make 'auto_execok START' do the Right Thing check-in: cdcff6d669 user: dkf tags: core-8-5-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.








1
2
3
4
5
6
7







2012-04-27  Donal K. Fellows  <[email protected]>

	* library/init.tcl (auto_execok): Allow shell builtins to be detected
	even if they are upper-cased.

2012-04-26  Jan Nijtmans  <[email protected]>

>
>
>
>
>
>
>







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

	* generic/tclPort.h:    Move CYGWIN-specific stuff from tclPort.h to
	* generic/tclEnv.c:     tclUnixPort.h, where it belongs.
	* unix/tclUnixPort.h:
	* unix/tclUnixFile.c:

2012-04-27  Donal K. Fellows  <[email protected]>

	* library/init.tcl (auto_execok): Allow shell builtins to be detected
	even if they are upper-cased.

2012-04-26  Jan Nijtmans  <[email protected]>

Changes to generic/tclEnv.c.

692
693
694
695
696
697
698

699
700
701
702
703
704
705

/*
 * When using cygwin, when an environment variable changes, we need to synch
 * with both the cygwin environment (in case the application C code calls
 * fork) and the Windows environment (in case the application TCL code calls
 * exec, which calls the Windows CreateProcess function).
 */


static void
TclCygwinPutenv(
    char *str)
{
    char *name, *value;








>







692
693
694
695
696
697
698
699
700
701
702
703
704
705
706

/*
 * When using cygwin, when an environment variable changes, we need to synch
 * with both the cygwin environment (in case the application C code calls
 * 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(
    char *str)
{
    char *name, *value;

Changes to generic/tclPort.h.

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#   include "tclWinPort.h"
#endif
#include "tcl.h"
#if !defined(_WIN32)
#   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);
#endif

#if !defined(LLONG_MIN)
#   ifdef TCL_WIDE_INT_IS_LONG
#      define LLONG_MIN LONG_MIN
#   else
#      ifdef LLONG_BIT
#         define LLONG_MIN ((Tcl_WideInt)(Tcl_LongAsWide(1)<<(LLONG_BIT-1)))
#      else







<
<
<
<
<
<
<
<
<
<
<
<







21
22
23
24
25
26
27












28
29
30
31
32
33
34
#   include "tclWinPort.h"
#endif
#include "tcl.h"
#if !defined(_WIN32)
#   include "tclUnixPort.h"
#endif













#if !defined(LLONG_MIN)
#   ifdef TCL_WIDE_INT_IS_LONG
#      define LLONG_MIN LONG_MIN
#   else
#      ifdef LLONG_BIT
#         define LLONG_MIN ((Tcl_WideInt)(Tcl_LongAsWide(1)<<(LLONG_BIT-1)))
#      else

Changes to unix/tclUnixFile.c.

35
36
37
38
39
40
41

42

43
44
45
46
47
48
49
50
51
52
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
 */

void
TclpFindExecutable(
    CONST char *argv0)		/* The value of the application's argv[0]
				 * (native). */
{

#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;
    Tcl_DString buffer, nameString, cwd, utfName;
    Tcl_Encoding encoding;
#endif

#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;
    }
    Tcl_DStringInit(&buffer);

    name = argv0;
    for (p = name; *p != '\0'; p++) {







>

>


<
<
<
<
<
<
<
<



|
|
|










|
|
|

>
>
>
>







35
36
37
38
39
40
41
42
43
44
45
46








47
48
49
50
51
52
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
 */

void
TclpFindExecutable(
    CONST char *argv0)		/* The value of the application's argv[0]
				 * (native). */
{
    Tcl_Encoding encoding;
#ifdef __CYGWIN__
    int length;
    char buf[PATH_MAX * TCL_UTF_MAX + 1];
    char name[PATH_MAX * TCL_UTF_MAX + 1];









    /* Make some symbols available without including <windows.h> */
#   define CP_UTF8 65001
    DLLIMPORT extern int cygwin_conv_to_full_posix_path(const char *, char *);
    DLLIMPORT extern __stdcall int GetModuleFileNameW(void *, const char *, int);
    DLLIMPORT 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;
    }
	encoding = Tcl_GetEncoding(NULL, NULL);
	TclSetObjNameOfExecutable(
		Tcl_NewStringObj(name, length), encoding);
#else
    const char *name, *p;
    Tcl_StatBuf statBuf;
    Tcl_DString buffer, nameString, cwd, utfName;

    if (argv0 == NULL) {
	return;
    }
    Tcl_DStringInit(&buffer);

    name = argv0;
    for (p = name; *p != '\0'; p++) {

Changes to unix/tclUnixPort.h.

70
71
72
73
74
75
76









77
78
79
80
81
82
83
84
85
#else
typedef off_t		Tcl_SeekOffset;
#   define TclOSseek		lseek
#   define TclOSopen		open
#endif

#ifdef __CYGWIN__









MODULE_SCOPE int TclOSstat(const char *name, Tcl_StatBuf *statBuf);
MODULE_SCOPE int TclOSlstat(const char *name, Tcl_StatBuf *statBuf);
#elif defined(HAVE_STRUCT_STAT64)
#   define TclOSstat		stat64
#   define TclOSlstat		lstat64
#else
#   define TclOSstat		stat
#   define TclOSlstat		lstat
#endif







>
>
>
>
>
>
>
>
>
|
|







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
#else
typedef off_t		Tcl_SeekOffset;
#   define TclOSseek		lseek
#   define TclOSopen		open
#endif

#ifdef __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);
    MODULE_SCOPE int TclOSstat(const char *name, Tcl_StatBuf *statBuf);
    MODULE_SCOPE int TclOSlstat(const char *name, Tcl_StatBuf *statBuf);
#elif defined(HAVE_STRUCT_STAT64)
#   define TclOSstat		stat64
#   define TclOSlstat		lstat64
#else
#   define TclOSstat		stat
#   define TclOSlstat		lstat
#endif