XEmacs 21.2-b1
[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  * The important thing about building is that it is done on a binary
32  * mounted filesystem. i.e. something mounted like: mount -b c:
33  * /binary. If you do not do this then compilation of el files may
34  * produce garbage.  As of b24 there are fixes in xemacs to make
35  * building on text mounts but I don't generally do this. Make sure
36  * you have installed cygwin32 b18 + patched dll (which can be found
37  * at http://www.lexa.ru/sos or on my home page
38  * http://www.parallax.co.uk/~andyp. Alternatively when b19 comes out
39  * the patched dll will be unnecessary. Also make sure your HOME path
40  * is unix style - i.e. without a drive letter.
41  *
42  * Note that some people have reported problems with the patched
43  * cygwin.dll on Sergey's home page so you may want to use the one on
44  * mine which I *know* works.
45  *
46  * once you have done this, configure and make. If you want unexec
47  * support you need to download a.out.h from my web page or use cygwin
48  * b19. You probably want to build with mule support since this
49  * addresses crlf issues in a sensible way.
50  *
51  * windows '95 - I haven't tested this under '95, it will probably
52  * build but I konw there are some limitations with cygwin under 95 so
53  * YMMV. I build with NT4 SP3.
54  *
55  * What I want to do:
56  *
57  * the fileio stuff merely uses the unix system calls this means that
58  * the mount type of your fs will determine how files are edited. This
59  * is fine except in the instance that you want to convert one to the
60  * other. In this instance I would like to bring the buffer_file_type
61  * code into the picture without all the other windows-nt
62  * cruft. Apparently the best way to do this is use the mule coding
63  * stuff.
64  *
65  * process support needs fixing although basic support works (a la
66  * make-docfile)
67  *
68  * Andy Piper <andyp@parallax.co.uk> 8/1/98 
69  * http://www.parallax.co.uk/~andyp */
70
71 /* cheesy way to determine cygwin version */
72 #ifndef NOT_C_CODE
73 #include <signal.h>
74 #ifdef SIGIO
75 #define CYGWIN_B19
76 #else
77 #define BROKEN_CYGWIN
78 #endif
79 extern void cygwin32_win32_to_posix_path_list(const char*, char*);
80 extern int cygwin32_win32_to_posix_path_list_buf_size(const char*);
81 extern void cygwin32_posix_to_win32_path_list(const char*, char*);
82 extern int cygwin32_posix_to_win32_path_list_buf_size(const char*);
83 struct timeval;
84 struct timezone;
85 struct itimerval;
86 struct stat;
87 extern int gettimeofday(struct timeval *tp, struct timezone *tzp);
88 extern int gethostname (char* name, int namelen);
89 extern char*    mktemp(char *);
90 extern double   logb(double);
91 extern void     sync();
92 extern int      ioctl(int, int, ...);
93                                 /* sys/stat.h */
94 extern int lstat(const char *path, struct stat *buf);
95                                 /* unistd.h */
96 extern int readlink(const char *path, void *buf, unsigned int bufsiz);
97 extern int symlink(const char *name1, const char *name2);
98                                 /* sys/time.h */
99 extern int setitimer(int which, const struct itimerval *value,
100                      struct itimerval *ovalue);
101 extern int utimes(char *file, struct timeval *tvp);
102
103 extern int srandom( unsigned seed);
104 extern long random();
105 #endif
106
107 #ifdef HAVE_MS_WINDOWS
108 #define HAVE_NTGUI
109 #define HAVE_FACES
110 #endif
111
112 #ifndef ORDINARY_LINK
113 #define ORDINARY_LINK
114 #endif
115
116 #define C_SWITCH_SYSTEM -Wno-sign-compare -fno-caller-saves
117 #define LIBS_SYSTEM -lwinmm
118
119 #define ICC_BAR_CLASSES 4
120 #define SIF_TRACKPOS    0x0010
121 #define FW_BLACK        FW_HEAVY
122 #define FW_ULTRABOLD    FW_EXTRABOLD
123 #define FW_DEMIBOLD     FW_SEMIBOLD
124 #define FW_ULTRALIGHT   FW_EXTRALIGHT
125 #define VK_APPS                 0x5D
126 #define APPCMD_FILTERINITS      0x20L
127 #define CBF_FAIL_SELFCONNECTIONS 0x1000
128 #define CBF_SKIP_ALLNOTIFICATIONS       0x3C0000
129 #define CBF_FAIL_ADVISES        0x4000
130 #define CBF_FAIL_POKES          0x10000
131 #define CBF_FAIL_REQUESTS       0x20000
132 #define SZDDESYS_TOPIC          "System"
133 #define SND_ASYNC               1
134 #define SND_NODEFAULT           2
135 #define SND_MEMORY              4
136 #define SND_FILENAME            0x2000L
137 #define JOHAB_CHARSET           130
138 #define MAC_CHARSET             77
139
140 #define TEXT_START -1
141 #define TEXT_END -1
142 #define DATA_END -1
143 #define HEAP_IN_DATA
144 #define UNEXEC "unexcw.o"
145 /* #define BROKEN_SIGIO */
146 #define PROCESS_IO_BLOCKING
147 #define strnicmp strncasecmp
148 #ifndef HAVE_SOCKETS
149 #define HAVE_SOCKETS
150 #endif
151 #define OBJECTS_SYSTEM  ntplay.o
152 #define HAVE_NATIVE_SOUND
153
154 #undef MAIL_USE_SYSTEM_LOCK
155 #define MAIL_USE_POP
156
157 /* Define NO_ARG_ARRAY if you cannot take the address of the first of a
158  * group of arguments and treat it as an array of the arguments.  */
159
160 #define NO_ARG_ARRAY
161
162 /* Define WORD_MACHINE if addresses and such have
163  * to be corrected before they can be used as byte counts.  */
164
165 #define WORD_MACHINE
166
167 /* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend
168    the 24-bit bit field into an int.  In other words, if bit fields
169    are always unsigned.
170
171    If you use NO_UNION_TYPE, this flag does not matter.  */
172
173 #define EXPLICIT_SIGN_EXTEND
174
175 /* Data type of load average, as read out of kmem.  */
176
177 #define LOAD_AVE_TYPE long
178
179 /* Convert that into an integer that is 100 for a load average of 1.0  */
180
181 #define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
182
183 /* Define VIRT_ADDR_VARIES if the virtual addresses of
184    pure and impure space as loaded can vary, and even their
185    relative order cannot be relied on.
186
187    Otherwise Emacs assumes that text space precedes data space,
188    numerically.  */
189
190 /* Text does precede data space, but this is never a safe assumption.  */
191 #define VIRT_ADDR_VARIES
192
193 /* set this if you have a new version of cygwin
194 #define DATA_SEG_BITS 0x10000000
195 */
196
197 /* If you are compiling with a non-C calling convention but need to
198    declare vararg routines differently, put it here */
199 #define _VARARGS_ __cdecl
200
201 /* If you are providing a function to something that will call the
202    function back (like a signal handler and signal, or main) its calling
203    convention must be whatever standard the libraries expect */
204 #define _CALLBACK_ __cdecl
205
206 /* SYSTEM_TYPE should indicate the kind of system you are using.
207  It sets the Lisp variable system-type.  */
208
209 #define SYSTEM_TYPE "cygwin32"
210
211 #define NO_MATHERR
212
213 /* define MAIL_USE_FLOCK if the mailer uses flock
214    to interlock access to /usr/spool/mail/$USER.
215    The alternative is that a lock file named
216    /usr/spool/mail/$USER.lock.  */
217
218 /* If the character used to separate elements of the executable path
219    is not ':', #define this to be the appropriate character constant.  */
220 #define SEPCHAR ':'
221
222 /* ============================================================ */
223
224 /* Here, add any special hacks needed
225    to make Emacs work on this system.  For example,
226    you might define certain system call names that don't
227    exist on your system, or that do different things on
228    your system and must be used only through an encapsulation
229    (Which you should place, by convention, in sysdep.c).  */
230
231 /* Define this to be the separator between path elements */
232 /* #define DIRECTORY_SEP XINT (Vdirectory_sep_char) */
233
234 /* Define this to be the separator between devices and paths */
235 #define DEVICE_SEP ':'
236
237 /* We'll support either convention on NT.  */
238 #define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\')
239 #define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_))
240 #define EXEC_SUFFIXES   ".exe:.com:.bat:.cmd:"
241
242 /* We need a little extra space, see ../../lisp/loadup.el */
243 #define SYSTEM_PURESIZE_EXTRA 15000
244
245 #define CYGWIN_CONV_PATH(src, dst) \
246 dst = alloca (cygwin32_win32_to_posix_path_list_buf_size(src)); \
247 cygwin32_win32_to_posix_path_list(src, dst)
248 #define CYGWIN_WIN32_PATH(src, dst) \
249 dst = alloca (cygwin32_posix_to_win32_path_list_buf_size(src)); \
250 cygwin32_posix_to_win32_path_list(src, dst)
251
252 /*
253  * stolen from usg.
254  */
255 #define HAVE_PTYS
256 #define FIRST_PTY_LETTER 'z'
257
258 /* Pseudo-terminal support under SVR4 only loops to deal with errors. */
259
260 #define PTY_ITERATION for (i = 0; i < 1; i++)
261
262 /* This sets the name of the master side of the PTY. */
263
264 #define PTY_NAME_SPRINTF strcpy (pty_name, "/dev/ptmx");
265
266 /* This sets the name of the slave side of the PTY.  On SysVr4,
267    grantpt(3) forks a subprocess, so keep sigchld_handler() from
268    intercepting that death.  If any child but grantpt's should die
269    within, it should be caught after EMACS_UNBLOCK_SIGNAL. */
270
271 #define PTY_OPEN \
272    fd = open (pty_name, O_RDWR | O_NONBLOCK | OPEN_BINARY, 0)
273
274 #define PTY_TTY_NAME_SPRINTF                            \
275   {                                                     \
276     extern char* ptsname(int);                          \
277     char *ptyname;                                      \
278                                                         \
279     if (!(ptyname = ptsname (fd)))                      \
280       { close (fd); return -1; }                        \
281     strncpy (pty_name, ptyname, sizeof (pty_name));     \
282     pty_name[sizeof (pty_name) - 1] = 0;                \
283   }
284
285 /* ============================================================ */
286