Tcl Source Code

Check-in [dcc7f6a5b4]
Login

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

Overview
Comment:implement TclpGetPid for Cygwin
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | bug-3508771
Files: files | file ages | folders
SHA1: dcc7f6a5b49b24bd0ea6f4f73111f660ed19b483
User & Date: jan.nijtmans 2012-04-04 14:50:05
Context
2012-04-04
15:08
merge core-8-4-branch check-in: 62b7ba34b2 user: jan.nijtmans tags: bug-3508771
14:50
implement TclpGetPid for Cygwin check-in: dcc7f6a5b4 user: jan.nijtmans tags: bug-3508771
08:36
[Bug 510001]: TclSockMinimumBuffers needs plat imp check-in: cbf7dc0a31 user: jan.nijtmans tags: core-8-4-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tclInt.decls.

974
975
976
977
978
979
980

981
982

983
984
985
986
987
988
989
    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:

# On non-cygwin, this is actually a reference to TclpCreateTempFile
declare 9 unix {
    int TclWinGetPlatformId(void)







>

<
>







974
975
976
977
978
979
980
981
982

983
984
985
986
987
988
989
990
    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)
}
# On non-cygwin, this is actually a reference to TclUnixWaitForFile
declare 8 unix {

    unsigned long TclpGetPid(Tcl_Pid pid)
}

# Added in 8.1:

# On non-cygwin, this is actually a reference to TclpCreateTempFile
declare 9 unix {
    int TclWinGetPlatformId(void)
1045
1046
1047
1048
1049
1050
1051











1052












1053
1054
1055
1056
}
declare 30 unix {
    void TclGetAndDetachPids(Tcl_Interp *interp, Tcl_Channel chan)
}
declare 31 unix {
    int TclpCloseFile(TclFile file)
}

























# Local Variables:
# mode: tcl
# End:







>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>




1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
}
declare 30 unix {
    void TclGetAndDetachPids(Tcl_Interp *interp, Tcl_Channel chan)
}
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
# End:

Changes to generic/tclIntPlatDecls.h.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
 * Copyright (c) 1998-1999 by Scriptics Corporation.
 * All rights reserved.
 */

#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
 * in the generic/tclInt.decls script.
 */

/* !BEGIN!: Do not edit below this line. */







<
<
<
<
<
<
<
<
<
<







9
10
11
12
13
14
15










16
17
18
19
20
21
22
 * Copyright (c) 1998-1999 by Scriptics Corporation.
 * All rights reserved.
 */

#ifndef _TCLINTPLATDECLS
#define _TCLINTPLATDECLS











/*
 * WARNING: This file is automatically generated by the tools/genStubs.tcl
 * script.  Any modifications to the function declarations below should be made
 * in the generic/tclInt.decls script.
 */

/* !BEGIN!: Do not edit below this line. */
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/* 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 */
EXTERN Tcl_DirEntry *	TclpReaddir _ANSI_ARGS_((DIR *dir));
/* 11 */
EXTERN struct tm *	TclpLocaltime_unix _ANSI_ARGS_((
				TclpTime_t_CONST clock));







|
<







44
45
46
47
48
49
50
51

52
53
54
55
56
57
58
/* 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 unsigned long	TclpGetPid _ANSI_ARGS_((Tcl_Pid pid));

/* 9 */
EXTERN int		TclWinGetPlatformId _ANSI_ARGS_((void));
/* 10 */
EXTERN Tcl_DirEntry *	TclpReaddir _ANSI_ARGS_((DIR *dir));
/* 11 */
EXTERN struct tm *	TclpLocaltime_unix _ANSI_ARGS_((
				TclpTime_t_CONST clock));
106
107
108
109
110
111
112

















113
114
115
116
117
118
119
EXTERN int		TclWinCPUID _ANSI_ARGS_((unsigned int index,
				unsigned int *regs));
/* 30 */
EXTERN void		TclGetAndDetachPids _ANSI_ARGS_((Tcl_Interp *interp,
				Tcl_Channel chan));
/* 31 */
EXTERN int		TclpCloseFile _ANSI_ARGS_((TclFile file));

















#endif /* UNIX */
#ifdef __WIN32__
/* 0 */
EXTERN void		TclWinConvertError _ANSI_ARGS_((DWORD errCode));
/* 1 */
EXTERN void		TclWinConvertWSAError _ANSI_ARGS_((DWORD errCode));
/* 2 */







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







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
EXTERN int		TclWinCPUID _ANSI_ARGS_((unsigned int index,
				unsigned int *regs));
/* 30 */
EXTERN void		TclGetAndDetachPids _ANSI_ARGS_((Tcl_Interp *interp,
				Tcl_Channel chan));
/* 31 */
EXTERN int		TclpCloseFile _ANSI_ARGS_((TclFile file));
/* Slot 32 is reserved */
/* Slot 33 is reserved */
/* 34 */
EXTERN int		TclpCreateProcess _ANSI_ARGS_((Tcl_Interp *interp,
				int argc, CONST char **argv,
				TclFile inputFile, TclFile outputFile,
				TclFile errorFile, Tcl_Pid *pidPtr));
/* Slot 35 is reserved */
/* 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 */
EXTERN void		TclWinConvertError _ANSI_ARGS_((DWORD errCode));
/* 1 */
EXTERN void		TclWinConvertWSAError _ANSI_ARGS_((DWORD errCode));
/* 2 */
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
    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 */







|







269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
    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 */
    unsigned long (*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 *reserved14;
    int (*tclMacOSXGetFileAttribute) _ANSI_ARGS_((Tcl_Interp *interp, int objIndex, Tcl_Obj *fileName, Tcl_Obj **attributePtrPtr)); /* 15 */
287
288
289
290
291
292
293







294
295
296
297
298
299
300
    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 */







>
>
>
>
>
>
>







293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
    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 */
    VOID *reserved32;
    VOID *reserved33;
    int (*tclpCreateProcess) _ANSI_ARGS_((Tcl_Interp *interp, int argc, CONST char **argv, TclFile inputFile, TclFile outputFile, TclFile errorFile, Tcl_Pid *pidPtr)); /* 34 */
    VOID *reserved35;
    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 */
    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 */
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
#define TclWinNToHS \
	(tclIntPlatStubsPtr->tclWinNToHS) /* 6 */
#endif
#ifndef TclWinSetSockOpt
#define TclWinSetSockOpt \
	(tclIntPlatStubsPtr->tclWinSetSockOpt) /* 7 */
#endif
#ifndef TclUnixWaitForFile
#define TclUnixWaitForFile \
	(tclIntPlatStubsPtr->tclUnixWaitForFile) /* 8 */
#endif
#ifndef TclWinGetPlatformId
#define TclWinGetPlatformId \
	(tclIntPlatStubsPtr->tclWinGetPlatformId) /* 9 */
#endif
#ifndef TclpReaddir
#define TclpReaddir \







|
|
|







408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
#define TclWinNToHS \
	(tclIntPlatStubsPtr->tclWinNToHS) /* 6 */
#endif
#ifndef TclWinSetSockOpt
#define TclWinSetSockOpt \
	(tclIntPlatStubsPtr->tclWinSetSockOpt) /* 7 */
#endif
#ifndef TclpGetPid
#define TclpGetPid \
	(tclIntPlatStubsPtr->tclpGetPid) /* 8 */
#endif
#ifndef TclWinGetPlatformId
#define TclWinGetPlatformId \
	(tclIntPlatStubsPtr->tclWinGetPlatformId) /* 9 */
#endif
#ifndef TclpReaddir
#define TclpReaddir \
473
474
475
476
477
478
479



















480
481
482
483
484
485
486
#define TclGetAndDetachPids \
	(tclIntPlatStubsPtr->tclGetAndDetachPids) /* 30 */
#endif
#ifndef TclpCloseFile
#define TclpCloseFile \
	(tclIntPlatStubsPtr->tclpCloseFile) /* 31 */
#endif



















#endif /* UNIX */
#ifdef __WIN32__
#ifndef TclWinConvertError
#define TclWinConvertError \
	(tclIntPlatStubsPtr->tclWinConvertError) /* 0 */
#endif
#ifndef TclWinConvertWSAError







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
#define TclGetAndDetachPids \
	(tclIntPlatStubsPtr->tclGetAndDetachPids) /* 30 */
#endif
#ifndef TclpCloseFile
#define TclpCloseFile \
	(tclIntPlatStubsPtr->tclpCloseFile) /* 31 */
#endif
/* Slot 32 is reserved */
/* Slot 33 is reserved */
#ifndef TclpCreateProcess
#define TclpCreateProcess \
	(tclIntPlatStubsPtr->tclpCreateProcess) /* 34 */
#endif
/* Slot 35 is reserved */
#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
#define TclWinConvertError \
	(tclIntPlatStubsPtr->tclWinConvertError) /* 0 */
#endif
#ifndef TclWinConvertWSAError
699
700
701
702
703
704
705
706







707
708
709
710
711
712
713
#endif /* defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS) */

/* !END!: Do not edit above this line. */

#undef TclpLocaltime_unix
#undef TclpGmtime_unix

#if !defined(__WIN32__) && !defined(MAC_TCL) && 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))) \







|
>
>
>
>
>
>
>







731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
#endif /* defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS) */

/* !END!: Do not edit above this line. */

#undef TclpLocaltime_unix
#undef TclpGmtime_unix

#if !defined(__WIN32__) && !defined(MAC_TCL)
# undef TclpGetPid
# define TclpGetPid(pid) ((unsigned long) (pid))

# if defined(USE_TCL_STUBS)
#   undef TclpCreateProcess
#   undef TclpMakeFile
#   undef TclpOpenFile
#   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))) \
728
729
730
731
732
733
734

735
736
737
#	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

#endif

#endif /* _TCLINTPLATDECLS */







>



767
768
769
770
771
772
773
774
775
776
777
#	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
# endif
#endif

#endif /* _TCLINTPLATDECLS */

Changes to generic/tclStubInit.c.

27
28
29
30
31
32
33

34
35
36
37
38
39
40
#undef Tcl_NewLongObj
#undef Tcl_NewObj
#undef Tcl_NewStringObj
#undef Tcl_DumpActiveMemory
#undef Tcl_ValidateAllMemory
#undef Tcl_FindHashEntry
#undef Tcl_CreateHashEntry


/*
 * Keep a record of the original Notifier procedures, created in the
 * same compilation unit as the stub tables so we can later do reliable,
 * portable comparisons to see whether a Tcl_SetNotifier() call swapped
 * new routines into the stub table.
 */







>







27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#undef Tcl_NewLongObj
#undef Tcl_NewObj
#undef Tcl_NewStringObj
#undef Tcl_DumpActiveMemory
#undef Tcl_ValidateAllMemory
#undef Tcl_FindHashEntry
#undef Tcl_CreateHashEntry
#undef TclpGetPid

/*
 * Keep a record of the original Notifier procedures, created in the
 * same compilation unit as the stub tables so we can later do reliable,
 * portable comparisons to see whether a Tcl_SetNotifier() call swapped
 * new routines into the stub table.
 */
81
82
83
84
85
86
87

88
89
90
91
92
93
94
#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


static Tcl_Encoding winTCharEncoding;

static int
TclWinGetPlatformId()
{
    /* Don't bother to determine the real platform on cygwin,







>







82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#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
#define TclpGetPid getPid

static Tcl_Encoding winTCharEncoding;

static int
TclWinGetPlatformId()
{
    /* Don't bother to determine the real platform on cygwin,
125
126
127
128
129
130
131






132
133
134
135
136
137
138
    for (p = path; *p != '\0'; p++) {
	if (*p == '\\') {
	    *p = '/';
	}
    }
    return path;
}







static void
doNothing(void)
{
    /* dummy implementation, no need to do anything */
}








>
>
>
>
>
>







127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
    for (p = path; *p != '\0'; p++) {
	if (*p == '\\') {
	    *p = '/';
	}
    }
    return path;
}

static unsigned long
TclpGetPid(Tcl_Pid pid)
{
    return (unsigned long) (size_t) pid;
}

static void
doNothing(void)
{
    /* dummy implementation, no need to do anything */
}

182
183
184
185
186
187
188

189
190
191
192
193
194
195
#   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







>







190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
#   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 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 */
#   ifndef MAC_OSX_TCL
#	define Tcl_MacOSXOpenBundleResources 0
#	define Tcl_MacOSXOpenVersionedBundleResources 0
#   endif
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
    TclWinConvertWSAError, /* 1 */
    TclpCreateCommandChannel, /* 2 */
    TclpCreatePipe, /* 3 */
    TclWinGetTclInstance, /* 4 */
    NULL, /* 5 */
    TclWinNToHS, /* 6 */
    TclWinSetSockOpt, /* 7 */
    TclUnixWaitForFile, /* 8 */
    TclWinGetPlatformId, /* 9 */
    TclpReaddir, /* 10 */
    TclpLocaltime_unix, /* 11 */
    TclpGmtime_unix, /* 12 */
    TclpInetNtoa, /* 13 */
    NULL, /* 14 */
    TclMacOSXGetFileAttribute, /* 15 */







|







459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
    TclWinConvertWSAError, /* 1 */
    TclpCreateCommandChannel, /* 2 */
    TclpCreatePipe, /* 3 */
    TclWinGetTclInstance, /* 4 */
    NULL, /* 5 */
    TclWinNToHS, /* 6 */
    TclWinSetSockOpt, /* 7 */
    TclpGetPid, /* 8 */
    TclWinGetPlatformId, /* 9 */
    TclpReaddir, /* 10 */
    TclpLocaltime_unix, /* 11 */
    TclpGmtime_unix, /* 12 */
    TclpInetNtoa, /* 13 */
    NULL, /* 14 */
    TclMacOSXGetFileAttribute, /* 15 */
474
475
476
477
478
479
480







481
482
483
484
485
486
487
    NULL, /* 25 */
    TclWinSetInterfaces, /* 26 */
    TclWinFlushDirtyChannels, /* 27 */
    TclWinResetInterfaces, /* 28 */
    TclWinCPUID, /* 29 */
    TclGetAndDetachPids, /* 30 */
    TclpCloseFile, /* 31 */







#endif /* UNIX */
#ifdef __WIN32__
    TclWinConvertError, /* 0 */
    TclWinConvertWSAError, /* 1 */
    TclWinGetServByName, /* 2 */
    TclWinGetSockOpt, /* 3 */
    TclWinGetTclInstance, /* 4 */







>
>
>
>
>
>
>







483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
    NULL, /* 25 */
    TclWinSetInterfaces, /* 26 */
    TclWinFlushDirtyChannels, /* 27 */
    TclWinResetInterfaces, /* 28 */
    TclWinCPUID, /* 29 */
    TclGetAndDetachPids, /* 30 */
    TclpCloseFile, /* 31 */
    NULL, /* 32 */
    NULL, /* 33 */
    TclpCreateProcess, /* 34 */
    NULL, /* 35 */
    TclpMakeFile, /* 36 */
    TclpOpenFile, /* 37 */
    TclUnixWaitForFile, /* 38 */
#endif /* UNIX */
#ifdef __WIN32__
    TclWinConvertError, /* 0 */
    TclWinConvertWSAError, /* 1 */
    TclWinGetServByName, /* 2 */
    TclWinGetSockOpt, /* 3 */
    TclWinGetTclInstance, /* 4 */

Changes to mac/tclMacPort.h.

211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
#endif
 
/*
 * The following macros have trivial definitions, allowing generic code to 
 * address platform-specific issues.
 */
 
#define TclpGetPid(pid)	    	((unsigned long) (pid))
#define TclSetSystemEnv(a,b)
#define tzset()

char *TclpFindExecutable(const char *argv0);
int TclpFindVariable(CONST char *name, int *lengthPtr);

#define fopen(path, mode) TclMacFOpenHack(path, mode)







<







211
212
213
214
215
216
217

218
219
220
221
222
223
224
#endif
 
/*
 * The following macros have trivial definitions, allowing generic code to 
 * address platform-specific issues.
 */
 

#define TclSetSystemEnv(a,b)
#define tzset()

char *TclpFindExecutable(const char *argv0);
int TclpFindVariable(CONST char *name, int *lengthPtr);

#define fopen(path, mode) TclMacFOpenHack(path, mode)

Changes to unix/tclUnixFile.c.

18
19
20
21
22
23
24
25

26
27
28
29
30
31
32

/*
 *---------------------------------------------------------------------------
 *
 * TclpFindExecutable --
 *
 *	This procedure computes the absolute path name of the current
 *	application, given its argv[0] value.

 *
 * Results:
 *	A dirty UTF string that is the path to the executable.  At this
 *	point we may not know the system encoding.  Convert the native
 *	string value to UTF using the default encoding.  The assumption
 *	is that we will still be able to parse the path given the path
 *	name contains ASCII string and '/' chars do not conflict with







|
>







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

/*
 *---------------------------------------------------------------------------
 *
 * TclpFindExecutable --
 *
 *	This procedure computes the absolute path name of the current
 *	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
 *	point we may not know the system encoding.  Convert the native
 *	string value to UTF using the default encoding.  The assumption
 *	is that we will still be able to parse the path given the path
 *	name contains ASCII string and '/' chars do not conflict with
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
 */

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





    CONST char *name, *p;
    Tcl_StatBuf statBuf;
    int length;
    Tcl_DString buffer, nameString;

    if (argv0 == NULL) {
	return NULL;
    }
    if (tclNativeExecutableName != NULL) {
	return tclNativeExecutableName;
    }

























    Tcl_DStringInit(&buffer);

    name = argv0;
    for (p = name; *p != '\0'; p++) {
	if (*p == '/') {
	    /*
	     * The name contains a slash, so use the name directly







>
>
>
>
>


<

|
<
<
|




>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
 */

char *
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;

    Tcl_DString buffer, nameString;
#endif



    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;
    for (p = name; *p != '\0'; p++) {
	if (*p == '/') {
	    /*
	     * The name contains a slash, so use the name directly
170
171
172
173
174
175
176

177
178
179
180
181
182
183
    tclNativeExecutableName[Tcl_DStringLength(&buffer)] = '/';
    strcpy(tclNativeExecutableName + Tcl_DStringLength(&buffer) + 1,
	    Tcl_DStringValue(&nameString));
    Tcl_DStringFree(&nameString);
    
done:
    Tcl_DStringFree(&buffer);

    return tclNativeExecutableName;
}

/*
 *----------------------------------------------------------------------
 *
 * TclpMatchInDirectory --







>







197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
    tclNativeExecutableName[Tcl_DStringLength(&buffer)] = '/';
    strcpy(tclNativeExecutableName + Tcl_DStringLength(&buffer) + 1,
	    Tcl_DStringValue(&nameString));
    Tcl_DStringFree(&nameString);
    
done:
    Tcl_DStringFree(&buffer);
#endif
    return tclNativeExecutableName;
}

/*
 *----------------------------------------------------------------------
 *
 * TclpMatchInDirectory --

Changes to unix/tclUnixPort.h.

654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
#endif

/*
 * The following macros have trivial definitions, allowing generic code to 
 * address platform-specific issues.
 */

#define TclpGetPid(pid)		((unsigned long) (pid))
#define TclpReleaseFile(file)	/* Nothing. */

/*
 * The following defines wrap the system memory allocation routines for
 * use by tclAlloc.c.  By default off unused on Unix.
 */








<







654
655
656
657
658
659
660

661
662
663
664
665
666
667
#endif

/*
 * The following macros have trivial definitions, allowing generic code to 
 * address platform-specific issues.
 */


#define TclpReleaseFile(file)	/* Nothing. */

/*
 * The following defines wrap the system memory allocation routines for
 * use by tclAlloc.c.  By default off unused on Unix.
 */

Changes to win/tcl.m4.

22
23
24
25
26
27
28



29
30
31
32
33
34
35

    if test -d ../../tcl8.4$1/win;  then
	TCL_BIN_DIR_DEFAULT=../../tcl8.4$1/win
    elif test -d ../../tcl8.4/win;  then
	TCL_BIN_DIR_DEFAULT=../../tcl8.4/win
    else
	TCL_BIN_DIR_DEFAULT=../../tcl/win



    fi

    AC_ARG_WITH(tcl, [  --with-tcl=DIR          use Tcl 8.4 binaries from DIR],
	    TCL_BIN_DIR=$withval, TCL_BIN_DIR=`cd $TCL_BIN_DIR_DEFAULT; pwd`)
    if test ! -d $TCL_BIN_DIR; then
	AC_MSG_ERROR(Tcl directory $TCL_BIN_DIR does not exist)
    fi







>
>
>







22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

    if test -d ../../tcl8.4$1/win;  then
	TCL_BIN_DIR_DEFAULT=../../tcl8.4$1/win
    elif test -d ../../tcl8.4/win;  then
	TCL_BIN_DIR_DEFAULT=../../tcl8.4/win
    else
	TCL_BIN_DIR_DEFAULT=../../tcl/win
    fi
    if test ! -f $TCL_BIN_DIR_DEFAULT/tclConfig.sh; then
	TCL_BIN_DIR_DEFAULT="${TCL_BIN_DIR_DEFAULT}/../unix"
    fi

    AC_ARG_WITH(tcl, [  --with-tcl=DIR          use Tcl 8.4 binaries from DIR],
	    TCL_BIN_DIR=$withval, TCL_BIN_DIR=`cd $TCL_BIN_DIR_DEFAULT; pwd`)
    if test ! -d $TCL_BIN_DIR; then
	AC_MSG_ERROR(Tcl directory $TCL_BIN_DIR does not exist)
    fi