/[dtapublic]/projs/trunk/shared_source/c_tcl_base_7_5_w_mods/tclwinport.h
ViewVC logotype

Contents of /projs/trunk/shared_source/c_tcl_base_7_5_w_mods/tclwinport.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 44 - (show annotations) (download)
Fri Oct 14 02:09:58 2016 UTC (7 years, 5 months ago) by dashley
File MIME type: text/plain
File size: 11623 byte(s)
Rename for reorganization.
1 /* $Header: /cvsroot/esrg/sfesrg/esrgpcpj/shared/tcl_base/tclwinport.h,v 1.1.1.1 2001/06/13 04:49:51 dtashley Exp $ */
2
3 /*
4 * tclWinPort.h --
5 *
6 * This header file handles porting issues that occur because of
7 * differences between Windows and Unix. It should be the only
8 * file that contains #ifdefs to handle different flavors of OS.
9 *
10 * Copyright (c) 1994-1997 Sun Microsystems, Inc.
11 *
12 * See the file "license.terms" for information on usage and redistribution
13 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
14 *
15 * RCS: @(#) $Id: tclwinport.h,v 1.1.1.1 2001/06/13 04:49:51 dtashley Exp $
16 */
17
18 #ifndef _TCLWINPORT
19 #define _TCLWINPORT
20
21 #ifndef _TCLINT
22 # include "tclInt.h"
23 #endif
24
25 #ifdef CHECK_UNICODE_CALLS
26
27 #define _UNICODE
28 #define UNICODE
29
30 #define __TCHAR_DEFINED
31 typedef float *_TCHAR;
32
33 #define _TCHAR_DEFINED
34 typedef float *TCHAR;
35
36 #endif
37
38 /*
39 *---------------------------------------------------------------------------
40 * The following sets of #includes and #ifdefs are required to get Tcl to
41 * compile under the windows compilers.
42 *---------------------------------------------------------------------------
43 */
44
45 #include <stdio.h>
46 #include <stdlib.h>
47
48 #include <direct.h>
49 #include <errno.h>
50 #include <fcntl.h>
51 #include <float.h>
52 #include <io.h>
53 #include <malloc.h>
54 #include <process.h>
55 #include <signal.h>
56 #include <string.h>
57
58 /*
59 * Need to block out these includes for building extensions with MetroWerks
60 * compiler for Win32.
61 */
62
63 #ifndef __MWERKS__
64 #include <sys/stat.h>
65 #include <sys/timeb.h>
66 #include <sys/utime.h>
67 #endif
68
69 #include <tchar.h>
70 #include <time.h>
71 #include <winsock2.h>
72
73 #define WIN32_LEAN_AND_MEAN
74 #include <windows.h>
75 #undef WIN32_LEAN_AND_MEAN
76
77 #ifdef BUILD_tcl
78 # undef TCL_STORAGE_CLASS
79 # define TCL_STORAGE_CLASS DLLEXPORT
80 #endif
81
82 /*
83 * Define EINPROGRESS in terms of WSAEINPROGRESS.
84 */
85
86 #ifndef EINPROGRESS
87 #define EINPROGRESS WSAEINPROGRESS
88 #endif
89
90 /*
91 * If ENOTSUP is not defined, define it to a value that will never occur.
92 */
93
94 #ifndef ENOTSUP
95 #define ENOTSUP -1030507
96 #endif
97
98 /*
99 * The following defines redefine the Windows Socket errors as
100 * BSD errors so Tcl_PosixError can do the right thing.
101 */
102
103 #ifndef EWOULDBLOCK
104 #define EWOULDBLOCK EAGAIN
105 #endif
106 #ifndef EALREADY
107 #define EALREADY 149 /* operation already in progress */
108 #endif
109 #ifndef ENOTSOCK
110 #define ENOTSOCK 95 /* Socket operation on non-socket */
111 #endif
112 #ifndef EDESTADDRREQ
113 #define EDESTADDRREQ 96 /* Destination address required */
114 #endif
115 #ifndef EMSGSIZE
116 #define EMSGSIZE 97 /* Message too long */
117 #endif
118 #ifndef EPROTOTYPE
119 #define EPROTOTYPE 98 /* Protocol wrong type for socket */
120 #endif
121 #ifndef ENOPROTOOPT
122 #define ENOPROTOOPT 99 /* Protocol not available */
123 #endif
124 #ifndef EPROTONOSUPPORT
125 #define EPROTONOSUPPORT 120 /* Protocol not supported */
126 #endif
127 #ifndef ESOCKTNOSUPPORT
128 #define ESOCKTNOSUPPORT 121 /* Socket type not supported */
129 #endif
130 #ifndef EOPNOTSUPP
131 #define EOPNOTSUPP 122 /* Operation not supported on socket */
132 #endif
133 #ifndef EPFNOSUPPORT
134 #define EPFNOSUPPORT 123 /* Protocol family not supported */
135 #endif
136 #ifndef EAFNOSUPPORT
137 #define EAFNOSUPPORT 124 /* Address family not supported */
138 #endif
139 #ifndef EADDRINUSE
140 #define EADDRINUSE 125 /* Address already in use */
141 #endif
142 #ifndef EADDRNOTAVAIL
143 #define EADDRNOTAVAIL 126 /* Can't assign requested address */
144 #endif
145 #ifndef ENETDOWN
146 #define ENETDOWN 127 /* Network is down */
147 #endif
148 #ifndef ENETUNREACH
149 #define ENETUNREACH 128 /* Network is unreachable */
150 #endif
151 #ifndef ENETRESET
152 #define ENETRESET 129 /* Network dropped connection on reset */
153 #endif
154 #ifndef ECONNABORTED
155 #define ECONNABORTED 130 /* Software caused connection abort */
156 #endif
157 #ifndef ECONNRESET
158 #define ECONNRESET 131 /* Connection reset by peer */
159 #endif
160 #ifndef ENOBUFS
161 #define ENOBUFS 132 /* No buffer space available */
162 #endif
163 #ifndef EISCONN
164 #define EISCONN 133 /* Socket is already connected */
165 #endif
166 #ifndef ENOTCONN
167 #define ENOTCONN 134 /* Socket is not connected */
168 #endif
169 #ifndef ESHUTDOWN
170 #define ESHUTDOWN 143 /* Can't send after socket shutdown */
171 #endif
172 #ifndef ETOOMANYREFS
173 #define ETOOMANYREFS 144 /* Too many references: can't splice */
174 #endif
175 #ifndef ETIMEDOUT
176 #define ETIMEDOUT 145 /* Connection timed out */
177 #endif
178 #ifndef ECONNREFUSED
179 #define ECONNREFUSED 146 /* Connection refused */
180 #endif
181 #ifndef ELOOP
182 #define ELOOP 90 /* Symbolic link loop */
183 #endif
184 #ifndef EHOSTDOWN
185 #define EHOSTDOWN 147 /* Host is down */
186 #endif
187 #ifndef EHOSTUNREACH
188 #define EHOSTUNREACH 148 /* No route to host */
189 #endif
190 #ifndef ENOTEMPTY
191 #define ENOTEMPTY 93 /* directory not empty */
192 #endif
193 #ifndef EUSERS
194 #define EUSERS 94 /* Too many users (for UFS) */
195 #endif
196 #ifndef EDQUOT
197 #define EDQUOT 49 /* Disc quota exceeded */
198 #endif
199 #ifndef ESTALE
200 #define ESTALE 151 /* Stale NFS file handle */
201 #endif
202 #ifndef EREMOTE
203 #define EREMOTE 66 /* The object is remote */
204 #endif
205
206 /*
207 * Supply definitions for macros to query wait status, if not already
208 * defined in header files above.
209 */
210
211 #if TCL_UNION_WAIT
212 # define WAIT_STATUS_TYPE union wait
213 #else
214 # define WAIT_STATUS_TYPE int
215 #endif
216
217 #ifndef WIFEXITED
218 # define WIFEXITED(stat) (((*((int *) &(stat))) & 0xff) == 0)
219 #endif
220
221 #ifndef WEXITSTATUS
222 # define WEXITSTATUS(stat) (((*((int *) &(stat))) >> 8) & 0xff)
223 #endif
224
225 #ifndef WIFSIGNALED
226 # define WIFSIGNALED(stat) (((*((int *) &(stat)))) && ((*((int *) &(stat))) == ((*((int *) &(stat))) & 0x00ff)))
227 #endif
228
229 #ifndef WTERMSIG
230 # define WTERMSIG(stat) ((*((int *) &(stat))) & 0x7f)
231 #endif
232
233 #ifndef WIFSTOPPED
234 # define WIFSTOPPED(stat) (((*((int *) &(stat))) & 0xff) == 0177)
235 #endif
236
237 #ifndef WSTOPSIG
238 # define WSTOPSIG(stat) (((*((int *) &(stat))) >> 8) & 0xff)
239 #endif
240
241 /*
242 * Define constants for waitpid() system call if they aren't defined
243 * by a system header file.
244 */
245
246 #ifndef WNOHANG
247 # define WNOHANG 1
248 #endif
249 #ifndef WUNTRACED
250 # define WUNTRACED 2
251 #endif
252
253 /*
254 * Define access mode constants if they aren't already defined.
255 */
256
257 #ifndef F_OK
258 # define F_OK 00
259 #endif
260 #ifndef X_OK
261 # define X_OK 01
262 #endif
263 #ifndef W_OK
264 # define W_OK 02
265 #endif
266 #ifndef R_OK
267 # define R_OK 04
268 #endif
269
270 /*
271 * Define macros to query file type bits, if they're not already
272 * defined.
273 */
274
275 #ifndef S_ISREG
276 # ifdef S_IFREG
277 # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
278 # else
279 # define S_ISREG(m) 0
280 # endif
281 # endif
282 #ifndef S_ISDIR
283 # ifdef S_IFDIR
284 # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
285 # else
286 # define S_ISDIR(m) 0
287 # endif
288 # endif
289 #ifndef S_ISCHR
290 # ifdef S_IFCHR
291 # define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
292 # else
293 # define S_ISCHR(m) 0
294 # endif
295 # endif
296 #ifndef S_ISBLK
297 # ifdef S_IFBLK
298 # define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
299 # else
300 # define S_ISBLK(m) 0
301 # endif
302 # endif
303 #ifndef S_ISFIFO
304 # ifdef S_IFIFO
305 # define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
306 # else
307 # define S_ISFIFO(m) 0
308 # endif
309 # endif
310
311 /*
312 * Define MAXPATHLEN in terms of MAXPATH if available
313 */
314
315 #ifndef MAXPATH
316 #define MAXPATH MAX_PATH
317 #endif /* MAXPATH */
318
319 #ifndef MAXPATHLEN
320 #define MAXPATHLEN MAXPATH
321 #endif /* MAXPATHLEN */
322
323 /*
324 * Define pid_t and uid_t if they're not already defined.
325 */
326
327 #if ! TCL_PID_T
328 # define pid_t int
329 #endif
330 #if ! TCL_UID_T
331 # define uid_t int
332 #endif
333
334 /*
335 * Visual C++ has some odd names for common functions, so we need to
336 * define a few macros to handle them. Also, it defines EDEADLOCK and
337 * EDEADLK as the same value, which confuses Tcl_ErrnoId().
338 */
339
340 #if defined(_MSC_VER) || defined(__MINGW32__)
341 # define environ _environ
342 # define hypot _hypot
343 # define exception _exception
344 # undef EDEADLOCK
345 # if defined(__MINGW32__) && !defined(__MSVCRT__)
346 # define timezone _timezone
347 # endif
348 #endif /* _MSC_VER || __MINGW32__ */
349
350 /*
351 *---------------------------------------------------------------------------
352 * The following macros and declarations represent the interface between
353 * generic and windows-specific parts of Tcl. Some of the macros may
354 * override functions declared in tclInt.h.
355 *---------------------------------------------------------------------------
356 */
357
358 /*
359 * The default platform eol translation on Windows is TCL_TRANSLATE_CRLF:
360 */
361
362 #define TCL_PLATFORM_TRANSLATION TCL_TRANSLATE_CRLF
363
364 /*
365 * Declare dynamic loading extension macro.
366 */
367
368 #define TCL_SHLIB_EXT ".dll"
369
370 /*
371 * The following define ensures that we use the native putenv
372 * implementation to modify the environment array. This keeps
373 * the C level environment in synch with the system level environment.
374 */
375
376 #define USE_PUTENV 1
377
378 /*
379 * The following defines wrap the system memory allocation routines for
380 * use by tclAlloc.c.
381 */
382
383 #define TclpSysAlloc(size, isBin) ((void*)HeapAlloc(GetProcessHeap(), \
384 (DWORD)0, (DWORD)size))
385 #define TclpSysFree(ptr) (HeapFree(GetProcessHeap(), \
386 (DWORD)0, (HGLOBAL)ptr))
387 #define TclpSysRealloc(ptr, size) ((void*)HeapReAlloc(GetProcessHeap(), \
388 (DWORD)0, (LPVOID)ptr, (DWORD)size))
389
390 /*
391 * The following defines map from standard socket names to our internal
392 * wrappers that redirect through the winSock function table (see the
393 * file tclWinSock.c).
394 */
395
396 #define getservbyname TclWinGetServByName
397 #define getsockopt TclWinGetSockOpt
398 #define ntohs TclWinNToHS
399 #define setsockopt TclWinSetSockOpt
400
401 /*
402 * The following macros have trivial definitions, allowing generic code to
403 * address platform-specific issues.
404 */
405
406 #define TclpReleaseFile(file) ckfree((char *) file)
407
408 /*
409 * The following macros and declarations wrap the C runtime library
410 * functions.
411 */
412
413 #define TclpExit exit
414 #define TclpLstat TclpStat
415
416 /*
417 * Declarations for Windows-only functions.
418 */
419
420 EXTERN Tcl_Channel TclWinOpenSerialChannel _ANSI_ARGS_((HANDLE handle,
421 char *channelName, int permissions));
422
423 EXTERN Tcl_Channel TclWinOpenConsoleChannel _ANSI_ARGS_((HANDLE handle,
424 char *channelName, int permissions));
425
426 EXTERN Tcl_Channel TclWinOpenFileChannel _ANSI_ARGS_((HANDLE handle,
427 char *channelName, int permissions, int appendMode));
428
429 EXTERN TclFile TclWinMakeFile _ANSI_ARGS_((HANDLE handle));
430
431 /*
432 * Platform specific mutex definition used by memory allocators.
433 * These mutexes are statically allocated and explicitly initialized.
434 * Most modules do not use this, but instead use Tcl_Mutex types and
435 * Tcl_MutexLock and Tcl_MutexUnlock that are self-initializing.
436 */
437
438 #ifdef TCL_THREADS
439 typedef CRITICAL_SECTION TclpMutex;
440 EXTERN void TclpMutexInit _ANSI_ARGS_((TclpMutex *mPtr));
441 EXTERN void TclpMutexLock _ANSI_ARGS_((TclpMutex *mPtr));
442 EXTERN void TclpMutexUnlock _ANSI_ARGS_((TclpMutex *mPtr));
443 #else
444 typedef int TclpMutex;
445 #define TclpMutexInit(a)
446 #define TclpMutexLock(a)
447 #define TclpMutexUnlock(a)
448 #endif /* TCL_THREADS */
449
450 #include "tclPlatDecls.h"
451 #include "tclIntPlatDecls.h"
452
453 # undef TCL_STORAGE_CLASS
454 # define TCL_STORAGE_CLASS DLLIMPORT
455
456 #endif /* _TCLWINPORT */
457
458 /* $History: tclwinport.h $
459 *
460 * ***************** Version 1 *****************
461 * User: Dtashley Date: 1/02/01 Time: 12:29a
462 * Created in $/IjuScripter, IjuConsole/Source/Tcl Base
463 * Initial check-in.
464 */
465
466 /* End of TCLWINPORT.H */

dashley@gmail.com
ViewVC Help
Powered by ViewVC 1.1.25