XEmacs 21.2.20 "Yoko".
[chise/xemacs-chise.git.1] / src / s / cygwin32.h
1 /* system description file for cygwin32.
2    Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
3
4 This file is part of GNU Emacs.
5
6 GNU Emacs is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 GNU Emacs is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with XEmacs; see the file COPYING.  If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA.  */
20
21 /* Building under cygwin
22  *
23  * The approach I have taken with this port is to use primarily the UNIX 
24  * code base adding stuff that is MS-Windows specific. This works quite 
25  * well, and is in keeping with my perception of the cygwin philosophy.
26  * Note that if you make changes to this file you do NOT want to define 
27  * WINDOWSNT, I repeat - do not define this, it will break everything 
28  * horribly. What does get defined is HAVE_MS_WINDOWS, but this is 
29  * done by configure and only applies to the window system.
30  *
31  * When building make sure your HOME path is unix style - i.e. without
32  * a drive letter.
33  *
34  * once you have done this, configure and make.
35  *
36  * windows '95 - I haven't tested this under '95, it will probably
37  * build but I konw there are some limitations with cygwin under 95 so
38  * YMMV. I build with NT4 SP3.
39  *
40  * Andy Piper <andy@xemacs.org> 8/1/98 
41  * http://www.xemacs.freeserve.co.uk/ */
42
43 /* cheesy way to determine cygwin version */
44 #ifndef NOT_C_CODE
45 #include <signal.h>
46 #ifdef HAVE_CYGWIN_VERSION_H
47 #include <cygwin/version.h>
48 #else
49 #ifdef SIGIO
50 #define CYGWIN_B19
51 #else
52 #define BROKEN_CYGWIN
53 #endif
54 #endif
55
56 extern void cygwin32_win32_to_posix_path_list(const char*, char*);
57 extern int cygwin32_win32_to_posix_path_list_buf_size(const char*);
58 extern void cygwin32_posix_to_win32_path_list(const char*, char*);
59 extern int cygwin32_posix_to_win32_path_list_buf_size(const char*);
60 #ifndef CYGWIN_VERSION_DLL_MAJOR
61 struct timeval;
62 struct timezone;
63 struct itimerval;
64 struct stat;
65 extern int gettimeofday(struct timeval *tp, struct timezone *tzp);
66 extern int gethostname (char* name, int namelen);
67 extern char*    mktemp(char *);
68 extern double   logb(double);
69 extern void     sync();
70 extern int      ioctl(int, int, ...);
71                                 /* sys/stat.h */
72 extern int lstat(const char *path, struct stat *buf);
73                                 /* unistd.h */
74 extern int readlink(const char *path, void *buf, unsigned int bufsiz);
75 extern int symlink(const char *name1, const char *name2);
76                                 /* sys/time.h */
77 extern int setitimer(int which, const struct itimerval *value,
78                      struct itimerval *ovalue);
79 extern int utimes(char *file, struct timeval *tvp);
80
81 extern int srandom( unsigned seed);
82 extern long random();
83
84 #define SND_ASYNC               1
85 #define SND_NODEFAULT           2
86 #define SND_MEMORY              4
87 #define SND_FILENAME            0x2000L
88 #define VK_APPS                 0x5D
89 #define SIF_TRACKPOS    0x0010
90 #define ICC_BAR_CLASSES 4
91 #define FW_BLACK        FW_HEAVY
92 #define FW_ULTRABOLD    FW_EXTRABOLD
93 #define FW_DEMIBOLD     FW_SEMIBOLD
94 #define FW_ULTRALIGHT   FW_EXTRALIGHT
95 #define APPCMD_FILTERINITS      0x20L
96 #define CBF_FAIL_SELFCONNECTIONS 0x1000
97 #define CBF_SKIP_ALLNOTIFICATIONS       0x3C0000
98 #define CBF_FAIL_ADVISES        0x4000
99 #define CBF_FAIL_POKES          0x10000
100 #define CBF_FAIL_REQUESTS       0x20000
101 #define SZDDESYS_TOPIC          "System"
102 #define JOHAB_CHARSET           130
103 #define MAC_CHARSET             77
104
105 #endif
106 #endif
107
108 #ifndef SPI_GETWHEELSCROLLLINES
109 #define SPI_GETWHEELSCROLLLINES 104
110 #endif
111 #ifndef WHEEL_PAGESCROLL
112 #define WHEEL_PAGESCROLL (UINT_MAX)
113 #endif
114 #ifndef WHEEL_DELTA
115 #define WHEEL_DELTA 120
116 #endif
117 #ifndef WM_MOUSEWHEEL
118 #define WM_MOUSEWHEEL 0x20A
119 #endif
120
121 #define PBS_SMOOTH              0x01
122
123 #ifdef HAVE_MS_WINDOWS
124 #define HAVE_NTGUI
125 #define HAVE_FACES
126 #endif
127
128 #ifndef ORDINARY_LINK
129 #define ORDINARY_LINK
130 #endif
131
132 #define C_SWITCH_SYSTEM -Wno-sign-compare -fno-caller-saves
133 #define LIBS_SYSTEM -lwinmm
134
135
136 #define TEXT_START -1
137 #define TEXT_END -1
138 #define DATA_END -1
139 #define HEAP_IN_DATA
140 #define UNEXEC "unexcw.o"
141
142 #ifdef CYGWIN_VERSION_DLL_MAJOR
143 #if 0
144 /* ### FIXME: although defining BROKEN_SIGIO is correct for proper ^G
145    behavior, bugs in cygwin mean that xemacs locks up frequently if
146    this is defined.  */
147 #define BROKEN_SIGIO
148 #endif
149 #else
150 #define PROCESS_IO_BLOCKING
151 #endif
152 #define strnicmp strncasecmp
153 #ifndef HAVE_SOCKETS
154 #define HAVE_SOCKETS
155 #endif
156 #define OBJECTS_SYSTEM  ntplay.o
157 #define HAVE_NATIVE_SOUND
158
159 #undef MAIL_USE_SYSTEM_LOCK
160 #define MAIL_USE_POP
161
162 /* Define NO_ARG_ARRAY if you cannot take the address of the first of a
163  * group of arguments and treat it as an array of the arguments.  */
164
165 #define NO_ARG_ARRAY
166
167 /* Define WORD_MACHINE if addresses and such have
168  * to be corrected before they can be used as byte counts.  */
169
170 #define WORD_MACHINE
171
172 /* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend
173    the 24-bit bit field into an int.  In other words, if bit fields
174    are always unsigned.
175
176    If you use NO_UNION_TYPE, this flag does not matter.  */
177
178 #define EXPLICIT_SIGN_EXTEND
179
180 /* Data type of load average, as read out of kmem.  */
181
182 #define LOAD_AVE_TYPE long
183
184 /* Convert that into an integer that is 100 for a load average of 1.0  */
185
186 #define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
187
188 /* Define VIRT_ADDR_VARIES if the virtual addresses of
189    pure and impure space as loaded can vary, and even their
190    relative order cannot be relied on.
191
192    Otherwise Emacs assumes that text space precedes data space,
193    numerically.  */
194
195 /* Text does precede data space, but this is never a safe assumption.  */
196 #define VIRT_ADDR_VARIES
197
198 /* set this if you have a new version of cygwin
199 #define DATA_SEG_BITS 0x10000000
200 */
201
202 /* If you are compiling with a non-C calling convention but need to
203    declare vararg routines differently, put it here */
204 #define _VARARGS_ __cdecl
205
206 /* If you are providing a function to something that will call the
207    function back (like a signal handler and signal, or main) its calling
208    convention must be whatever standard the libraries expect */
209 #define _CALLBACK_ __cdecl
210
211 /* SYSTEM_TYPE should indicate the kind of system you are using.
212  It sets the Lisp variable system-type.  */
213
214 #define SYSTEM_TYPE "cygwin32"
215
216 #define NO_MATHERR
217
218 /* define MAIL_USE_FLOCK if the mailer uses flock
219    to interlock access to /usr/spool/mail/$USER.
220    The alternative is that a lock file named
221    /usr/spool/mail/$USER.lock.  */
222
223 /* If the character used to separate elements of the executable path
224    is not ':', #define this to be the appropriate character constant.  */
225 #define SEPCHAR ':'
226
227 /* ============================================================ */
228
229 /* Here, add any special hacks needed
230    to make Emacs work on this system.  For example,
231    you might define certain system call names that don't
232    exist on your system, or that do different things on
233    your system and must be used only through an encapsulation
234    (Which you should place, by convention, in sysdep.c).  */
235
236 /* Define this to be the separator between path elements */
237 /* #define DIRECTORY_SEP XINT (Vdirectory_sep_char) */
238
239 /* Define this to be the separator between devices and paths */
240 #define DEVICE_SEP ':'
241
242 /* We'll support either convention on NT.  */
243 #define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\')
244 #define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_))
245 #define EXEC_SUFFIXES   ".exe:.com:.bat:.cmd:"
246
247 /* We need a little extra space, see ../../lisp/loadup.el */
248 #define SYSTEM_PURESIZE_EXTRA 15000
249
250 #define CYGWIN_CONV_PATH(src, dst) \
251 dst = alloca (cygwin32_win32_to_posix_path_list_buf_size(src)); \
252 cygwin32_win32_to_posix_path_list(src, dst)
253 #define CYGWIN_WIN32_PATH(src, dst) \
254 dst = alloca (cygwin32_posix_to_win32_path_list_buf_size(src)); \
255 cygwin32_posix_to_win32_path_list(src, dst)
256
257 /*
258  * stolen from usg.
259  */
260 #define HAVE_PTYS
261 #define FIRST_PTY_LETTER 'z'
262
263 /* Pseudo-terminal support under SVR4 only loops to deal with errors. */
264
265 #define PTY_ITERATION for (i = 0, c = 0; i < 1; i++)
266
267 /* This sets the name of the master side of the PTY. */
268
269 #define PTY_NAME_SPRINTF strcpy (pty_name, "/dev/ptmx");
270
271 /* This sets the name of the slave side of the PTY.  On SysVr4,
272    grantpt(3) forks a subprocess, so keep sigchld_handler() from
273    intercepting that death.  If any child but grantpt's should die
274    within, it should be caught after EMACS_UNBLOCK_SIGNAL. */
275
276 #define PTY_OPEN \
277    fd = open (pty_name, O_RDWR | O_NONBLOCK | OPEN_BINARY, 0)
278
279 #define PTY_TTY_NAME_SPRINTF                            \
280   {                                                     \
281     extern char* ptsname(int);                          \
282     char *ptyname;                                      \
283                                                         \
284     if (!(ptyname = ptsname (fd)))                      \
285       { close (fd); return -1; }                        \
286     strncpy (pty_name, ptyname, sizeof (pty_name));     \
287     pty_name[sizeof (pty_name) - 1] = 0;                \
288   }
289
290 /* ============================================================ */
291