comparison src/s/cygwin32.h @ 442:abe6d1db359e r21-2-36

Import from CVS: tag r21-2-36
author cvs
date Mon, 13 Aug 2007 11:35:02 +0200
parents 8de8e3f6228a
children 1ccc32a20af4
comparison
equal deleted inserted replaced
441:72a7cfa4a488 442:abe6d1db359e
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */ 19 Boston, MA 02111-1307, USA. */
20 20
21 /* Building under cygwin 21 /* Building under cygwin
22 * 22 *
23 * The approach I have taken with this port is to use primarily the UNIX 23 * The approach I have taken with this port is to use primarily the
24 * code base adding stuff that is MS-Windows specific. This works quite 24 * UNIX code base adding stuff that is MS-Windows specific. This works
25 * well, and is in keeping with my perception of the cygwin philosophy. 25 * quite well, and is in keeping with my perception of the cygwin
26 * Note that if you make changes to this file you do NOT want to define 26 * philosophy. Note that if you make changes to this file you do NOT
27 * WINDOWSNT, I repeat - do not define this, it will break everything 27 * want to define WIN32_NATIVE (formerly "WINDOWSNT"), I repeat - do
28 * horribly. What does get defined is HAVE_MS_WINDOWS, but this is 28 * not define this, it will break everything horribly. What does get
29 * done by configure and only applies to the window system. 29 * defined is HAVE_MS_WINDOWS, but this is done by configure and only
30 * applies to the window system.
30 * 31 *
31 * When building make sure your HOME path is unix style - i.e. without 32 * When building make sure your HOME path is unix style - i.e. without
32 * a drive letter. 33 * a drive letter.
33 * 34 *
34 * once you have done this, configure and make. 35 * once you have done this, configure and make.
38 * YMMV. I build with NT4 SP3. 39 * YMMV. I build with NT4 SP3.
39 * 40 *
40 * Andy Piper <andy@xemacs.org> 8/1/98 41 * Andy Piper <andy@xemacs.org> 8/1/98
41 * http://www.xemacs.freeserve.co.uk/ */ 42 * http://www.xemacs.freeserve.co.uk/ */
42 43
44 /* Identify ourselves */
45 #define CYGWIN
46
43 /* cheesy way to determine cygwin version */ 47 /* cheesy way to determine cygwin version */
44 #ifndef NOT_C_CODE 48 #ifndef NOT_C_CODE
45 #include <signal.h> 49 # include <signal.h>
46 #ifdef HAVE_CYGWIN_VERSION_H 50 # ifdef HAVE_CYGWIN_VERSION_H
47 #include <cygwin/version.h> 51 # include <cygwin/version.h>
48 #else 52 # else
49 #ifdef SIGIO 53 # ifdef SIGIO
50 #define CYGWIN_VERSION_DLL_MAJOR 19 54 # define CYGWIN_VERSION_DLL_MAJOR 19
51 #define CYGWIN_VERSION_DLL_MINOR 0 55 # define CYGWIN_VERSION_DLL_MINOR 0
52 #define CYGWIN_B19 56 # define CYGWIN_B19
53 #else 57 # else
54 #define CYGWIN_VERSION_DLL_MAJOR 18 58 # define CYGWIN_VERSION_DLL_MAJOR 18
55 #define CYGWIN_VERSION_DLL_MINOR 0 59 # define CYGWIN_VERSION_DLL_MINOR 0
56 #define BROKEN_CYGWIN 60 # define BROKEN_CYGWIN
57 #endif 61 # endif
58 #endif 62 # endif
59 63
60 extern void cygwin32_win32_to_posix_path_list(const char*, char*); 64 # if CYGWIN_VERSION_DLL_MAJOR < 20
61 extern int cygwin32_win32_to_posix_path_list_buf_size(const char*); 65
62 extern void cygwin32_posix_to_win32_path_list(const char*, char*); 66 void cygwin32_win32_to_posix_path_list (const char*, char*);
63 extern int cygwin32_posix_to_win32_path_list_buf_size(const char*); 67 int cygwin32_win32_to_posix_path_list_buf_size (const char*);
64 #if CYGWIN_VERSION_DLL_MAJOR < 20 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
65 struct timeval; 78 struct timeval;
66 struct timezone; 79 struct timezone;
67 struct itimerval; 80 struct itimerval;
68 struct stat; 81 struct stat;
69 extern int gettimeofday(struct timeval *tp, struct timezone *tzp); 82 int gettimeofday (struct timeval *tp, struct timezone *tzp);
70 extern int gethostname (char* name, int namelen); 83 int gethostname (char* name, int namelen);
71 extern char* mktemp(char *); 84 char* mktemp (char *);
72 extern double logb(double); 85 double logb (double);
73 extern void sync(); 86 void sync (void);
74 extern int ioctl(int, int, ...); 87 int ioctl (int, int, ...);
75 /* sys/stat.h */ 88 /* sys/stat.h */
76 extern int lstat(const char *path, struct stat *buf); 89 int lstat (const char *path, struct stat *buf);
77 /* unistd.h */ 90 /* unistd.h */
78 extern int readlink(const char *path, void *buf, unsigned int bufsiz); 91 int readlink (const char *path, void *buf, unsigned int bufsiz);
79 extern int symlink(const char *name1, const char *name2); 92 int symlink (const char *name1, const char *name2);
80 /* sys/time.h */ 93 /* sys/time.h */
81 extern int setitimer(int which, const struct itimerval *value, 94 int setitimer (int which, const struct itimerval *value,
82 struct itimerval *ovalue); 95 struct itimerval *ovalue);
83 extern int utimes(char *file, struct timeval *tvp); 96 int utimes (char *file, struct timeval *tvp);
84 97
85 extern int srandom( unsigned seed); 98 int srandom (unsigned seed);
86 extern long random(); 99 long random (void);
87 100
88 #define SND_ASYNC 1 101 # else /* not CYGWIN_VERSION_DLL_MAJOR < 20 */
89 #define SND_NODEFAULT 2 102
90 #define SND_MEMORY 4 103 void cygwin_win32_to_posix_path_list (const char*, char*);
91 #define SND_FILENAME 0x2000L 104 int cygwin_win32_to_posix_path_list_buf_size (const char*);
92 #define VK_APPS 0x5D 105 void cygwin_posix_to_win32_path_list (const char*, char*);
93 #define SIF_TRACKPOS 0x0010 106 int cygwin_posix_to_win32_path_list_buf_size (const char*);
94 #define ICC_BAR_CLASSES 4 107
95 #define FW_BLACK FW_HEAVY 108 # endif /* CYGWIN_VERSION_DLL_MAJOR < 20 */
96 #define FW_ULTRABOLD FW_EXTRABOLD 109
97 #define FW_DEMIBOLD FW_SEMIBOLD 110 # if CYGWIN_VERSION_DLL_MAJOR <= 20
98 #define FW_ULTRALIGHT FW_EXTRALIGHT 111 char *getpass (const char *prompt);
99 #define APPCMD_FILTERINITS 0x20L 112 double logb (double);
100 #define CBF_FAIL_SELFCONNECTIONS 0x1000 113 # endif /* CYGWIN_VERSION_DLL_MAJOR <= 20 */
101 #define CBF_SKIP_ALLNOTIFICATIONS 0x3C0000 114
102 #define CBF_FAIL_ADVISES 0x4000 115 /* Still left out of 1.1! */
103 #define CBF_FAIL_POKES 0x10000 116 double logb (double);
104 #define CBF_FAIL_REQUESTS 0x20000 117
105 #define SZDDESYS_TOPIC "System"
106 #define JOHAB_CHARSET 130
107 #define MAC_CHARSET 77
108
109 #endif
110 #endif
111
112 #ifndef SPI_GETWHEELSCROLLLINES
113 #define SPI_GETWHEELSCROLLLINES 104
114 #endif
115 #ifndef WHEEL_PAGESCROLL
116 #define WHEEL_PAGESCROLL (UINT_MAX)
117 #endif
118 #ifndef WHEEL_DELTA
119 #define WHEEL_DELTA 120
120 #endif
121 #ifndef WM_MOUSEWHEEL
122 #define WM_MOUSEWHEEL 0x20A
123 #endif
124 #ifndef TCS_BOTTOM
125 #define TCS_BOTTOM 0x0002
126 #endif
127 #ifndef TCS_VERTICAL
128 #define TCS_VERTICAL 0x0080
129 #endif
130 #ifndef PHYSICALWIDTH
131 #define PHYSICALWIDTH 110
132 #endif
133 #ifndef PHYSICALHEIGHT
134 #define PHYSICALHEIGHT 111
135 #endif
136 #ifndef PHYSICALOFFSETX
137 #define PHYSICALOFFSETX 112
138 #endif
139 #ifndef PHYSICALOFFSETY
140 #define PHYSICALOFFSETY 113
141 #endif
142
143
144 #define PBS_SMOOTH 0x01
145
146 #ifdef HAVE_MS_WINDOWS
147 #define HAVE_NTGUI
148 #define HAVE_FACES
149 #endif 118 #endif
150 119
151 #ifndef ORDINARY_LINK 120 #ifndef ORDINARY_LINK
152 #define ORDINARY_LINK 121 #define ORDINARY_LINK
153 #endif 122 #endif
154 123
155 #define C_SWITCH_SYSTEM -Wno-sign-compare -fno-caller-saves 124 #define C_SWITCH_SYSTEM -Wno-sign-compare -fno-caller-saves
156 #define LIBS_SYSTEM -lwinmm 125 #define LIBS_SYSTEM -lwinmm
157 126 #define WIN32_LEAN_AND_MEAN
158 127
159 #define TEXT_START -1 128 #define TEXT_START -1
160 #define TEXT_END -1 129 #define TEXT_END -1
161 #define DATA_END -1 130 #define DATA_END -1
162 #define HEAP_IN_DATA 131 #define HEAP_IN_DATA
132 #define NO_LIM_DATA
163 #define UNEXEC "unexcw.o" 133 #define UNEXEC "unexcw.o"
164 134
165 #ifdef CYGWIN_VERSION_DLL_MAJOR 135 #ifdef CYGWIN_VERSION_DLL_MAJOR
166 #if 0 136 #if 0
167 /* #### FIXME: although defining BROKEN_SIGIO is correct for proper ^G 137 /* #### FIXME: although defining BROKEN_SIGIO is correct for proper ^G
175 #define strnicmp strncasecmp 145 #define strnicmp strncasecmp
176 #ifndef HAVE_SOCKETS 146 #ifndef HAVE_SOCKETS
177 #define HAVE_SOCKETS 147 #define HAVE_SOCKETS
178 #endif 148 #endif
179 #define OBJECTS_SYSTEM ntplay.o 149 #define OBJECTS_SYSTEM ntplay.o
180 #define HAVE_NATIVE_SOUND
181 150
182 #undef MAIL_USE_SYSTEM_LOCK 151 #undef MAIL_USE_SYSTEM_LOCK
183 #define MAIL_USE_POP 152
184 153 /* Do not define LOAD_AVE_TYPE or LOAD_AVE_CVT
185 /* Define NO_ARG_ARRAY if you cannot take the address of the first of a 154 since there is no load average available. */
186 * group of arguments and treat it as an array of the arguments. */
187
188 #define NO_ARG_ARRAY
189
190 /* Define WORD_MACHINE if addresses and such have
191 * to be corrected before they can be used as byte counts. */
192
193 #define WORD_MACHINE
194
195 /* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend
196 the 24-bit bit field into an int. In other words, if bit fields
197 are always unsigned.
198
199 If you use NO_UNION_TYPE, this flag does not matter. */
200
201 #define EXPLICIT_SIGN_EXTEND
202
203 /* Data type of load average, as read out of kmem. */
204
205 #define LOAD_AVE_TYPE long
206
207 /* Convert that into an integer that is 100 for a load average of 1.0 */
208
209 #define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
210 155
211 /* Define VIRT_ADDR_VARIES if the virtual addresses of 156 /* Define VIRT_ADDR_VARIES if the virtual addresses of
212 pure and impure space as loaded can vary, and even their 157 pure and impure space as loaded can vary, and even their
213 relative order cannot be relied on. 158 relative order cannot be relied on.
214 159
215 Otherwise Emacs assumes that text space precedes data space, 160 Otherwise Emacs assumes that text space precedes data space,
216 numerically. */ 161 numerically. */
217 162
218 /* Text does precede data space, but this is never a safe assumption. */ 163 /* Text does precede data space, but this is never a safe assumption. */
219 #define VIRT_ADDR_VARIES 164 #define VIRT_ADDR_VARIES
220
221 /* set this if you have a new version of cygwin
222 #define DATA_SEG_BITS 0x10000000
223 */
224 165
225 /* If you are compiling with a non-C calling convention but need to 166 /* If you are compiling with a non-C calling convention but need to
226 declare vararg routines differently, put it here */ 167 declare vararg routines differently, put it here */
227 #define _VARARGS_ __cdecl 168 #define _VARARGS_ __cdecl
228 169
269 210
270 /* We need a little extra space, see ../../lisp/loadup.el */ 211 /* We need a little extra space, see ../../lisp/loadup.el */
271 #define SYSTEM_PURESIZE_EXTRA 15000 212 #define SYSTEM_PURESIZE_EXTRA 15000
272 213
273 #define CYGWIN_CONV_PATH(src, dst) \ 214 #define CYGWIN_CONV_PATH(src, dst) \
274 dst = alloca (cygwin32_win32_to_posix_path_list_buf_size(src)); \ 215 dst = alloca (cygwin_win32_to_posix_path_list_buf_size(src)); \
275 cygwin32_win32_to_posix_path_list(src, dst) 216 cygwin_win32_to_posix_path_list(src, dst)
276 #define CYGWIN_WIN32_PATH(src, dst) \ 217 #define CYGWIN_WIN32_PATH(src, dst) \
277 dst = alloca (cygwin32_posix_to_win32_path_list_buf_size(src)); \ 218 dst = alloca (cygwin_posix_to_win32_path_list_buf_size(src)); \
278 cygwin32_posix_to_win32_path_list(src, dst) 219 cygwin_posix_to_win32_path_list(src, dst)
279
280 /*
281 * stolen from usg.
282 */
283 #define HAVE_PTYS
284 #define FIRST_PTY_LETTER 'z'
285
286 /* Pseudo-terminal support under SVR4 only loops to deal with errors. */
287
288 #define PTY_ITERATION for (i = 0, c = 0; i < 1; i++)
289
290 /* This sets the name of the master side of the PTY. */
291
292 #define PTY_NAME_SPRINTF strcpy (pty_name, "/dev/ptmx");
293
294 /* This sets the name of the slave side of the PTY. On SysVr4,
295 grantpt(3) forks a subprocess, so keep sigchld_handler() from
296 intercepting that death. If any child but grantpt's should die
297 within, it should be caught after EMACS_UNBLOCK_SIGNAL. */
298
299 #define PTY_OPEN \
300 fd = open (pty_name, O_RDWR | O_NONBLOCK | OPEN_BINARY, 0)
301
302 #define PTY_TTY_NAME_SPRINTF \
303 { \
304 extern char* ptsname(int); \
305 char *ptyname; \
306 \
307 if (!(ptyname = ptsname (fd))) \
308 { close (fd); return -1; } \
309 strncpy (pty_name, ptyname, sizeof (pty_name)); \
310 pty_name[sizeof (pty_name) - 1] = 0; \
311 }
312
313 /* ============================================================ */
314