4 * This file is included by all of the curses wish C files.
5 * It contains information that may be configuration-dependent,
6 * such as #includes for system include files and a few other things.
8 * Copyright (c) 1991-1993 The Regents of the University of California.
9 * Copyright (c) 1994 Sun Microsystems, Inc.
10 * Copyright (c) 1995 Christian Werner
12 * See the file "license.terms" for information on usage and redistribution
13 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
20 #if defined(_WIN32) || defined(WIN32)
25 * Macro to use instead of "void" for arguments that must have
26 * type "void *" in ANSI C; maps them to type "char *" in
27 * non-ANSI systems. This macro may be used in some of the include
28 * files below, which is why it is defined here.
44 #if defined(_WIN32) || defined(WIN32)
50 # include "compat/limits.h"
54 #if !defined(_WIN32) && !defined(WIN32)
58 # include "compat/stdlib.h"
63 #include <sys/types.h>
64 #if !defined(_WIN32) && !defined(WIN32)
65 # include <sys/file.h>
67 #ifdef HAVE_SYS_SELECT_H
68 # include <sys/select.h>
71 #if !defined(_WIN32) && !defined(WIN32)
72 # include <sys/time.h>
77 #if !defined(_WIN32) && !defined(WIN32)
81 # include "compat/unistd.h"
85 #if (TCL_MAJOR_VERSION < 7)
86 #error Tcl major version must be 7 or greater
90 * Not all systems declare the errno variable in errno.h. so this
91 * file does it explicitly.
94 #if !defined(_WIN32) && !defined(WIN32)
98 #if (TCL_MAJOR_VERSION == 7) && (TCL_MINOR_VERSION <= 4)
101 * The following macro defines the type of the mask arguments to
106 # define SELECT_MASK fd_set
109 typedef long fd_mask;
112 # define SELECT_MASK void
114 # define SELECT_MASK int
119 * Define "NBBY" (number of bits per byte) if it's not already defined.
127 * The following macro defines the number of fd_masks in an fd_set:
132 # define FD_SETSIZE OPEN_MAX
134 # define FD_SETSIZE 256
137 #if !defined(howmany)
138 # define howmany(x, y) (((x)+((y)-1))/(y))
141 # define NFDBITS NBBY*sizeof(fd_mask)
143 #define MASK_SIZE howmany(FD_SETSIZE, NFDBITS)
146 * The following macro checks to see whether there is buffered
147 * input data available for a stdio FILE. This has to be done
148 * in different ways on different systems. TK_FILE_GPTR and
149 * TK_FILE_COUNT are #defined by autoconf.
153 # define TK_READ_DATA_PENDING(f) ((f)->TK_FILE_COUNT > 0)
156 # define TK_READ_DATA_PENDING(f) ((f)->_gptr < (f)->_egptr)
158 # ifdef TK_FILE_READ_PTR
159 # define TK_READ_DATA_PENDING(f) ((f)->_IO_read_ptr != (f)->_IO_read_end)
162 * Don't know what to do for this system; whoever installs
163 * Tk will have to write a function TkReadDataPending to do
166 EXTERN int TkReadDataPending _ANSI_ARGS_((FILE *f));
167 # define TK_READ_DATA_PENDING(f) TkReadDataPending(f)
173 * Substitute Tcl's own versions for several system calls. The
174 * Tcl versions retry automatically if interrupted by signals.
177 #define open(a,b,c) TclOpen(a,b,c)
178 #define read(a,b,c) TclRead(a,b,c)
179 #define waitpid(a,b,c) TclWaitpid(a,b,c)
180 #define write(a,b,c) TclWrite(a,b,c)
181 EXTERN int TclOpen _ANSI_ARGS_((char *path, int oflag, mode_t mode));
182 EXTERN int TclRead _ANSI_ARGS_((int fd, VOID *buf,
183 unsigned int numBytes));
184 EXTERN int TclWaitpid _ANSI_ARGS_((pid_t pid, int *statPtr, int options));
185 EXTERN int TclWrite _ANSI_ARGS_((int fd, VOID *buf,
186 unsigned int numBytes));
189 * If this system has a BSDgettimeofday function (e.g. IRIX) use it
190 * instead of gettimeofday; the gettimeofday function has a different
191 * interface than the BSD one that this code expects.
194 #ifdef HAVE_BSDGETTIMEOFDAY
195 # define gettimeofday BSDgettimeofday
197 #ifdef GETTOD_NOT_DECLARED
198 EXTERN int gettimeofday _ANSI_ARGS_((struct timeval *tp,
199 struct timezone *tzp));
205 * Provide some defines to get some Tk functionality which was in
206 * tkEvent.c prior to Tcl version 7.5.
209 #define Tk_BackgroundError Tcl_BackgroundError
210 #define Tk_DoWhenIdle Tcl_DoWhenIdle
211 #define Tk_DoWhenIdle2 Tcl_DoWhenIdle
212 #define Tk_CancelIdleCall Tcl_CancelIdleCall
213 #define Tk_CreateTimerHandler Tcl_CreateTimerHandler
214 #define Tk_DeleteTimerHandler Tcl_DeleteTimerHandler
215 #define Tk_AfterCmd Tcl_AfterCmd
216 #define Tk_FileeventCmd Tcl_FileEventCmd
217 #define Tk_DoOneEvent Tcl_DoOneEvent
222 * Declarations for various library procedures that may not be declared
223 * in any other header file.
230 /* Return type for signal(), this taken from TclX.
234 # define RETSIGTYPE void
237 typedef RETSIGTYPE (*Ck_SignalProc) _ANSI_ARGS_((int));