update.
[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
24  * UNIX code base adding stuff that is MS-Windows specific. This works
25  * quite well, and is in keeping with my perception of the cygwin
26  * philosophy.  Note that if you make changes to this file you do NOT
27  * want to define WIN32_NATIVE (formerly "WINDOWSNT"), I repeat - do
28  * not define this, it will break everything horribly. What does get
29  * defined is HAVE_MS_WINDOWS, but this is done by configure and only
30  * applies to the window system.
31  *
32  * When building make sure your HOME path is unix style - i.e. without
33  * a drive letter.
34  *
35  * once you have done this, configure and make.
36  *
37  * windows '95 - I haven't tested this under '95, it will probably
38  * build but I konw there are some limitations with cygwin under 95 so
39  * YMMV. I build with NT4 SP3.
40  *
41  * Andy Piper <andy@xemacs.org> 8/1/98 
42  * http://www.xemacs.freeserve.co.uk/ */
43
44 /* Identify ourselves */
45 #define CYGWIN
46
47 /* cheesy way to determine cygwin version */
48 #ifndef NOT_C_CODE
49 # include <signal.h>
50 # ifdef HAVE_CYGWIN_VERSION_H
51 #  include <cygwin/version.h>
52 # else
53 #  ifdef SIGIO
54 #   define CYGWIN_VERSION_DLL_MAJOR 19
55 #   define CYGWIN_VERSION_DLL_MINOR 0
56 #   define CYGWIN_B19
57 #  else
58 #   define CYGWIN_VERSION_DLL_MAJOR 18
59 #   define CYGWIN_VERSION_DLL_MINOR 0
60 #   define BROKEN_CYGWIN
61 #  endif
62 # endif
63
64 # if CYGWIN_VERSION_DLL_MAJOR < 20
65
66 void cygwin32_win32_to_posix_path_list (const char*, char*);
67 int cygwin32_win32_to_posix_path_list_buf_size (const char*);
68 void cygwin32_posix_to_win32_path_list (const char*, char*);
69 int cygwin32_posix_to_win32_path_list_buf_size (const char*);
70
71 #define cygwin_win32_to_posix_path_list cygwin32_win32_to_posix_path_list
72 #define cygwin_win32_to_posix_path_list_buf_size \
73   cygwin32_win32_to_posix_path_list_buf_size
74 #define cygwin_posix_to_win32_path_list cygwin32_posix_to_win32_path_list
75 #define cygwin_posix_to_win32_path_list_buf_size \
76   cygwin32_posix_to_win32_path_list_buf_size
77
78 struct timeval;
79 struct timezone;
80 struct itimerval;
81 struct stat;
82 int gettimeofday (struct timeval *tp, struct timezone *tzp);
83 int gethostname (char* name, int namelen);
84 char*   mktemp (char *);
85 double  logb (double);
86 void    sync (void);
87 int     ioctl (int, int, ...);
88                         /* sys/stat.h */
89 int lstat (const char *path, struct stat *buf);
90                         /* unistd.h */
91 int readlink (const char *path, void *buf, unsigned int bufsiz);
92 int symlink (const char *name1, const char *name2);
93                         /* sys/time.h */
94 int setitimer (int which, const struct itimerval *value,
95               struct itimerval *ovalue);
96 int utimes (char *file, struct timeval *tvp);
97
98 int srandom (unsigned seed);
99 long random (void);
100
101 # else /* not CYGWIN_VERSION_DLL_MAJOR < 20 */
102
103 void cygwin_win32_to_posix_path_list (const char*, char*);
104 int cygwin_win32_to_posix_path_list_buf_size (const char*);
105 void cygwin_posix_to_win32_path_list (const char*, char*);
106 int cygwin_posix_to_win32_path_list_buf_size (const char*);
107
108 # endif /* CYGWIN_VERSION_DLL_MAJOR < 20 */
109
110 # if CYGWIN_VERSION_DLL_MAJOR <= 20
111 char *getpass (const char *prompt);
112 double logb (double);
113 # endif /* CYGWIN_VERSION_DLL_MAJOR <= 20 */
114
115 /* Still left out of 1.1! */
116 double logb (double);
117 int killpg (int pgrp, int sig);
118
119 #endif
120
121 #ifndef ORDINARY_LINK
122 #define ORDINARY_LINK
123 #endif
124
125 #define C_SWITCH_SYSTEM -Wno-sign-compare -fno-caller-saves
126 #define LIBS_SYSTEM -lwinmm
127 #define WIN32_LEAN_AND_MEAN
128
129 #define TEXT_START -1
130 #define TEXT_END -1
131 #define DATA_END -1
132 #define HEAP_IN_DATA
133 #define NO_LIM_DATA
134 #define UNEXEC "unexcw.o"
135
136 #ifdef CYGWIN_VERSION_DLL_MAJOR
137 #if 0
138 /* #### FIXME: although defining BROKEN_SIGIO is correct for proper ^G
139    behavior, bugs in cygwin mean that xemacs locks up frequently if
140    this is defined.  */
141 #define BROKEN_SIGIO
142 #endif
143 #else
144 #define PROCESS_IO_BLOCKING
145 #endif
146 #define strnicmp strncasecmp
147 #ifndef HAVE_SOCKETS
148 #define HAVE_SOCKETS
149 #endif
150 #define OBJECTS_SYSTEM  ntplay.o
151
152 #undef MAIL_USE_SYSTEM_LOCK
153
154 /* Do not define LOAD_AVE_TYPE or LOAD_AVE_CVT
155    since there is no load average available. */
156
157 /* Define VIRT_ADDR_VARIES if the virtual addresses of
158    pure and impure space as loaded can vary, and even their
159    relative order cannot be relied on.
160
161    Otherwise Emacs assumes that text space precedes data space,
162    numerically.  */
163
164 /* Text does precede data space, but this is never a safe assumption.  */
165 #define VIRT_ADDR_VARIES
166
167 /* If you are compiling with a non-C calling convention but need to
168    declare vararg routines differently, put it here */
169 #define _VARARGS_ __cdecl
170
171 /* If you are providing a function to something that will call the
172    function back (like a signal handler and signal, or main) its calling
173    convention must be whatever standard the libraries expect */
174 #define _CALLBACK_ __cdecl
175
176 /* SYSTEM_TYPE should indicate the kind of system you are using.
177  It sets the Lisp variable system-type.  */
178
179 #define SYSTEM_TYPE "cygwin32"
180
181 #define NO_MATHERR
182
183 /*
184  *      Define HAVE_PTYS if the system supports pty devices.
185  */
186
187 #define HAVE_PTYS
188
189 /* define MAIL_USE_FLOCK if the mailer uses flock
190    to interlock access to /usr/spool/mail/$USER.
191    The alternative is that a lock file named
192    /usr/spool/mail/$USER.lock.  */
193
194 /* If the character used to separate elements of the executable path
195    is not ':', #define this to be the appropriate character constant.  */
196 #define SEPCHAR ':'
197
198 /* ============================================================ */
199
200 /* Here, add any special hacks needed
201    to make Emacs work on this system.  For example,
202    you might define certain system call names that don't
203    exist on your system, or that do different things on
204    your system and must be used only through an encapsulation
205    (Which you should place, by convention, in sysdep.c).  */
206
207 /* Define this to be the separator between path elements */
208 /* #define DIRECTORY_SEP XINT (Vdirectory_sep_char) */
209
210 /* Define this to be the separator between devices and paths */
211 #define DEVICE_SEP ':'
212
213 /* We'll support either convention on NT.  */
214 #define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\')
215 #define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_))
216 #define EXEC_SUFFIXES   ".exe:.com:.bat:.cmd:"
217
218 /* We need a little extra space, see ../../lisp/loadup.el */
219 #define SYSTEM_PURESIZE_EXTRA 15000
220
221 #define CYGWIN_CONV_PATH(src, dst) \
222 dst = alloca (cygwin_win32_to_posix_path_list_buf_size(src)); \
223 cygwin_win32_to_posix_path_list(src, dst)
224 #define CYGWIN_WIN32_PATH(src, dst) \
225 dst = alloca (cygwin_posix_to_win32_path_list_buf_size(src)); \
226 cygwin_posix_to_win32_path_list(src, dst)