Mercurial > hg > xemacs-beta
annotate src/syswindows.h @ 5001:714d854d00e9
Automatic merge
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Sun, 07 Feb 2010 05:23:07 -0600 |
parents | 4cfb6aeb989d |
children | cfe36e196dc7 |
rev | line source |
---|---|
442 | 1 /* Copyright (C) 2000 Free Software Foundation, Inc. |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
2 Copyright (C) 2000, 2001, 2002, 2004, 2010 Ben Wing. |
442 | 3 |
4 This file is part of XEmacs. | |
5 | |
6 XEmacs is free software; you can redistribute it and/or modify it | |
7 under the terms of the GNU General Public License as published by the | |
8 Free Software Foundation; either version 2, or (at your option) any | |
9 later version. | |
10 | |
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
14 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 /* Synched up with: Not in FSF. */ | |
22 | |
23 /* Authorship: | |
24 | |
771 | 25 Current primary author: Ben Wing <ben@xemacs.org> |
26 | |
442 | 27 Created May 2000 by Andy Piper. |
771 | 28 Windows-Mule stuff added by Ben Wing, 2000-2001. |
29 September 2001 Ben Wing reorganized and included nt.h and ntheap.h into | |
30 this file; comments in those files say: | |
31 * Adapted for XEmacs by David Hobley <david@spook-le0.cia.com.au> | |
32 * Sync'ed with Emacs 19.34.6 by Marc Paquette <marcpa@cam.org> | |
33 (Note: Sync messages from Marc Paquette may indicate | |
34 incomplete synching, so beware.) | |
35 (in ntheap.h only) Geoff Voelker (voelker@cs.washington.edu) 7-29-94 | |
36 | |
442 | 37 */ |
38 | |
39 #ifndef INCLUDED_syswindows_h_ | |
40 #define INCLUDED_syswindows_h_ | |
41 | |
2367 | 42 /* See win32.c for info about the different Windows files in XEmacs. */ |
442 | 43 |
771 | 44 /* ------------------------- Basic includes ------------------------- */ |
442 | 45 |
46 #ifndef WIN32_LEAN_AND_MEAN | |
47 #define WIN32_LEAN_AND_MEAN | |
48 #endif | |
49 | |
4858
e1d8b6b0c589
Define CYGWIN_HEADERS in s/cygwin32.h and s/mingw32.h instead of syswindows.h, so they're available everywhere
Ben Wing <ben@xemacs.org>
parents:
4854
diff
changeset
|
50 #ifdef CYGWIN_HEADERS |
771 | 51 # ifndef _WIN32_IE |
52 # define _WIN32_IE 0x0400 | |
53 # endif | |
665 | 54 |
1743 | 55 BEGIN_C_DECLS |
665 | 56 |
4827
11daf37dae4d
more fixes to get a clean compile
Ben Wing <ben@xemacs.org>
parents:
4824
diff
changeset
|
57 #if 0 /* breaks the build, as of GCC 3.4.4 or earlier, since the prototype |
11daf37dae4d
more fixes to get a clean compile
Ben Wing <ben@xemacs.org>
parents:
4824
diff
changeset
|
58 is now declared static */ |
665 | 59 /* Fucking GCC complains about "no previous prototype" for inline |
60 functions. DUH! See DECLARE_INLINE_HEADER. */ | |
61 extern __inline void *GetCurrentFiber (void); | |
62 extern __inline void *GetFiberData (void); | |
4824
c12b646d84ee
changes to get things to compile under latest cygwin
Ben Wing <ben@xemacs.org>
parents:
4538
diff
changeset
|
63 #endif |
665 | 64 |
1743 | 65 END_C_DECLS |
665 | 66 |
67 #endif | |
68 | |
771 | 69 /* Defines for COM so it's usable in both C and C++. XECOMCALLn() calls a |
70 method with the specified number of parameters. XECOMID() surrounds a | |
71 class or interface name when passed to CoCreateInstance, a | |
72 QueryInterface method, or the like. */ | |
73 #ifdef __cplusplus | |
74 #define XECOMCALL0(cl, meth) ((cl)->meth ()) | |
75 #define XECOMCALL1(cl, meth, a1) ((cl)->meth (a1)) | |
76 #define XECOMCALL2(cl, meth, a1, a2) ((cl)->meth (a1, a2)) | |
77 #define XECOMCALL3(cl, meth, a1, a2, a3) ((cl)->meth (a1, a2, a3)) | |
78 #define XECOMCALL4(cl, meth, a1, a2, a3, a4) ((cl)->meth (a1, a2, a3, a4)) | |
79 #define XECOMID(id) (id) | |
80 #else | |
81 #define XECOMCALL0(cl, meth) ((cl)->lpVtbl->meth (cl)) | |
82 #define XECOMCALL1(cl, meth, a1) ((cl)->lpVtbl->meth (cl, a1)) | |
83 #define XECOMCALL2(cl, meth, a1, a2) ((cl)->lpVtbl->meth (cl, a1, a2)) | |
84 #define XECOMCALL3(cl, meth, a1, a2, a3) ((cl)->lpVtbl->meth (cl, a1, a2, a3)) | |
85 #define XECOMCALL4(cl, meth, a1, a2, a3, a4) \ | |
86 ((cl)->lpVtbl->meth (cl, a1, a2, a3, a4)) | |
87 #define XECOMID(id) (&(id)) | |
88 #endif | |
89 | |
90 #define OEMRESOURCE /* Define OCR_ and friend constants */ | |
442 | 91 #include <windows.h> |
92 | |
3728 | 93 #include <aclapi.h> |
94 | |
558 | 95 #if defined (WIN32_LEAN_AND_MEAN) |
96 # ifdef HAVE_X_WINDOWS | |
442 | 97 /* Christ almighty. The problems you get when combining two large code bases, |
98 neither with any respect for namespace purity. */ | |
558 | 99 # undef Status |
100 # endif | |
101 # include <winspool.h> | |
102 # ifdef HAVE_X_WINDOWS | |
103 # define Status int | |
104 # endif | |
105 # include <mmsystem.h> | |
673 | 106 # include <shlobj.h> |
558 | 107 # include <shellapi.h> |
108 # include <ddeml.h> | |
442 | 109 #endif |
110 | |
546 | 111 #include <lmaccess.h> /* next three for NetUserEnum and friends */ |
531 | 112 #include <lmapibuf.h> |
113 #include <lmerr.h> | |
546 | 114 #include <lmcons.h> /* for UNLEN and possibly other constants */ |
531 | 115 |
771 | 116 #include <cderr.h> |
117 #include <commdlg.h> | |
118 | |
119 #ifdef NEED_MSWINDOWS_COMMCTRL | |
120 #include <commctrl.h> | |
442 | 121 #endif |
771 | 122 #ifdef NEED_MSWINDOWS_OBJBASE |
123 #include <objbase.h> | |
442 | 124 #endif |
771 | 125 #ifdef NEED_MSWINDOWS_SHLOBJ |
126 #include <shlobj.h> | |
442 | 127 #endif |
128 | |
771 | 129 #include <zmouse.h> /* WHEEL_PAGESCROLL under Cygwin */ |
130 | |
131 #include <wchar.h> | |
442 | 132 |
771 | 133 /* ------------------------- Cygwin header brokenness ---------------------- */ |
134 | |
135 #ifdef CYGWIN_HEADERS | |
136 | |
1683 | 137 #include <cygwin/stat.h> /* for struct stat */ |
1304 | 138 #include <w32api.h> /* for version info */ |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
139 #include <sys/cygwin.h> /* path conversion functions */ |
1304 | 140 |
1683 | 141 /* Test for a specific version of w32api */ |
142 #define W32API_VER(major,minor) (((major) << 16) + (minor)) | |
143 #define W32API_INSTALLED_VER \ | |
144 W32API_VER (__W32API_MAJOR_VERSION, __W32API_MINOR_VERSION) | |
1304 | 145 |
771 | 146 /* Various brokennesses in various versions of Cygwin */ |
673 | 147 |
442 | 148 /* windows.h defines. */ |
149 #ifndef SPI_GETWHEELSCROLLLINES | |
150 #define SPI_GETWHEELSCROLLLINES 104 | |
151 #endif | |
771 | 152 |
153 /* commctrl.h defines. */ | |
154 #ifndef TB_SETIMAGELIST | |
155 #define TB_SETIMAGELIST (WM_USER + 48) | |
442 | 156 #endif |
771 | 157 #ifndef TB_GETIMAGELIST |
158 #define TB_GETIMAGELIST (WM_USER + 49) | |
159 #endif | |
160 #ifndef TB_SETDISABLEDIMAGELIST | |
161 #define TB_SETDISABLEDIMAGELIST (WM_USER + 54) | |
162 #endif | |
163 #ifndef TB_GETDISABLEDIMAGELIST | |
164 #define TB_GETDISABLEDIMAGELIST (WM_USER + 55) | |
442 | 165 #endif |
771 | 166 #ifndef TB_SETPADDING |
167 #define TB_SETPADDING (WM_USER + 87) | |
168 #endif | |
169 #ifndef TB_GETBUTTONINFOA | |
170 #define TB_GETBUTTONINFOA (WM_USER + 65) | |
171 #endif | |
172 #ifndef TB_GETBUTTONINFOW | |
173 #define TB_GETBUTTONINFOW (WM_USER + 63) | |
442 | 174 #endif |
771 | 175 #ifndef TB_SETBUTTONINFOA |
176 #define TB_SETBUTTONINFOA (WM_USER + 66) | |
177 #endif | |
178 #ifndef TB_SETBUTTONINFOW | |
179 #define TB_SETBUTTONINFOW (WM_USER + 64) | |
180 #endif | |
181 #ifndef TB_INSERTBUTTONA | |
182 #define TB_INSERTBUTTONA (WM_USER + 21) | |
442 | 183 #endif |
771 | 184 #ifndef TB_INSERTBUTTONW |
185 #define TB_INSERTBUTTONW (WM_USER + 67) | |
186 #endif | |
187 #ifndef TB_ADDBUTTONSA | |
188 #define TB_ADDBUTTONSA (WM_USER + 20) | |
189 #endif | |
190 #ifndef TB_ADDBUTTONSW | |
191 #define TB_ADDBUTTONSW (WM_USER + 68) | |
442 | 192 #endif |
771 | 193 #ifndef LVM_SETBKIMAGEA |
194 #define LVM_SETBKIMAGEA (LVM_FIRST + 68) | |
195 #endif | |
196 #ifndef LVM_SETBKIMAGEW | |
197 #define LVM_SETBKIMAGEW (LVM_FIRST + 138) | |
198 #endif | |
199 #ifndef LVM_GETBKIMAGEA | |
200 #define LVM_GETBKIMAGEA (LVM_FIRST + 69) | |
442 | 201 #endif |
771 | 202 #ifndef LVM_GETBKIMAGEW |
203 #define LVM_GETBKIMAGEW (LVM_FIRST + 139) | |
204 #endif | |
205 #ifndef WC_COMBOBOXEXW | |
206 #define WC_COMBOBOXEXW L"ComboBoxEx32" | |
207 #endif | |
208 #ifndef CBEM_INSERTITEMA | |
209 #define CBEM_INSERTITEMA (WM_USER + 1) | |
442 | 210 #endif |
771 | 211 #ifndef CBEM_INSERTITEMW |
212 #define CBEM_INSERTITEMW (WM_USER + 11) | |
442 | 213 #endif |
771 | 214 #ifndef CBEM_SETITEMA |
215 #define CBEM_SETITEMA (WM_USER + 5) | |
216 #endif | |
217 #ifndef CBEM_SETITEMW | |
218 #define CBEM_SETITEMW (WM_USER + 12) | |
442 | 219 #endif |
771 | 220 #ifndef CBEM_GETITEMA |
221 #define CBEM_GETITEMA (WM_USER + 4) | |
222 #endif | |
223 #ifndef CBEM_GETITEMW | |
224 #define CBEM_GETITEMW (WM_USER + 13) | |
442 | 225 #endif |
771 | 226 #ifndef HDN_GETDISPINFOA |
227 #define HDN_GETDISPINFOA (HDN_FIRST - 9) | |
228 #endif | |
229 #ifndef HDN_GETDISPINFOW | |
230 #define HDN_GETDISPINFOW (HDN_FIRST - 29) | |
231 #endif | |
232 #ifndef TBN_GETDISPINFOA | |
233 #define TBN_GETDISPINFOA (TBN_FIRST - 16) | |
442 | 234 #endif |
771 | 235 #ifndef TBN_GETDISPINFOW |
236 #define TBN_GETDISPINFOW (TBN_FIRST - 17) | |
237 #endif | |
238 #ifndef TBN_GETINFOTIPA | |
239 #define TBN_GETINFOTIPA (TBN_FIRST - 18) | |
442 | 240 #endif |
771 | 241 #ifndef TBN_GETINFOTIPW |
242 #define TBN_GETINFOTIPW (TBN_FIRST - 19) | |
243 #endif | |
244 #ifndef TTN_GETDISPINFOA | |
245 #define TTN_GETDISPINFOA (TTN_FIRST - 0) | |
246 #endif | |
247 #ifndef TTN_GETDISPINFOW | |
248 #define TTN_GETDISPINFOW (TTN_FIRST - 10) | |
442 | 249 #endif |
771 | 250 |
251 #if (_WIN32_IE >= 0x0400) | |
252 | |
253 #ifndef LVN_GETINFOTIPA | |
254 #define LVN_GETINFOTIPA (LVN_FIRST - 57) | |
255 #endif | |
256 #ifndef LVN_GETINFOTIPW | |
257 #define LVN_GETINFOTIPW (LVN_FIRST - 58) | |
442 | 258 #endif |
771 | 259 #ifndef TVN_GETINFOTIPA |
260 #define TVN_GETINFOTIPA (TVN_FIRST - 13) | |
261 #endif | |
262 #ifndef TVN_GETINFOTIPW | |
263 #define TVN_GETINFOTIPW (TVN_FIRST - 14) | |
264 #endif | |
265 #ifndef CBEN_GETDISPINFOA | |
266 #define CBEN_GETDISPINFOA (CBEN_FIRST - 0) | |
442 | 267 #endif |
771 | 268 #ifndef CBEN_GETDISPINFOW |
269 #define CBEN_GETDISPINFOW (CBEN_FIRST - 7) | |
270 #endif | |
271 #ifndef CBEN_DRAGBEGINA | |
272 #define CBEN_DRAGBEGINA (CBEN_FIRST - 8) | |
273 #endif | |
274 #ifndef CBEN_DRAGBEGINW | |
275 #define CBEN_DRAGBEGINW (CBEN_FIRST - 9) | |
442 | 276 #endif |
771 | 277 |
278 #endif /* (_WIN32_IE >= 0x0400) */ | |
279 | |
280 #ifndef CBEN_ENDEDITA | |
281 #define CBEN_ENDEDITA (CBEN_FIRST - 5) | |
442 | 282 #endif |
771 | 283 #ifndef CBEN_ENDEDITW |
284 #define CBEN_ENDEDITW (CBEN_FIRST - 6) | |
285 #endif | |
286 | |
287 #ifndef CBEMAXSTRLEN | |
288 #define CBEMAXSTRLEN 260 | |
442 | 289 #endif |
290 | |
1111 | 291 #ifndef NMCBEENDEDIT |
292 | |
293 typedef struct | |
294 { | |
295 NMHDR hdr; | |
296 BOOL fChanged; | |
297 int iNewSelection; | |
298 WCHAR szText[CBEMAXSTRLEN]; | |
299 int iWhy; | |
771 | 300 } NMCBEENDEDITW, *LPNMCBEENDEDITW, *PNMCBEENDEDITW; |
301 | |
1111 | 302 typedef struct |
303 { | |
304 NMHDR hdr; | |
305 BOOL fChanged; | |
306 int iNewSelection; | |
307 char szText[CBEMAXSTRLEN]; | |
308 int iWhy; | |
771 | 309 } NMCBEENDEDITA, *LPNMCBEENDEDITA,*PNMCBEENDEDITA; |
310 | |
1111 | 311 #endif /* not NMCBEENDEDIT */ |
312 | |
771 | 313 #if (_WIN32_IE >= 0x0400) |
314 | |
1111 | 315 #ifndef NMCBEDRAGBEGIN |
316 | |
317 typedef struct | |
318 { | |
319 NMHDR hdr; | |
320 int iItemid; | |
321 WCHAR szText[CBEMAXSTRLEN]; | |
322 } NMCBEDRAGBEGINW, *LPNMCBEDRAGBEGINW, *PNMCBEDRAGBEGINW; | |
771 | 323 |
1111 | 324 typedef struct |
325 { | |
326 NMHDR hdr; | |
327 int iItemid; | |
328 char szText[CBEMAXSTRLEN]; | |
329 } NMCBEDRAGBEGINA, *LPNMCBEDRAGBEGINA, *PNMCBEDRAGBEGINA; | |
330 | |
331 #endif /* not NMCBEDRAGBEGIN */ | |
332 | |
771 | 333 typedef struct tagNMDATETIMEFORMATA |
334 { | |
1111 | 335 NMHDR nmhdr; |
336 LPCSTR pszFormat; | |
337 SYSTEMTIME st; | |
338 LPCSTR pszDisplay; | |
339 CHAR szDisplay[64]; | |
771 | 340 } NMDATETIMEFORMATA, FAR * LPNMDATETIMEFORMATA; |
341 | |
342 typedef struct tagNMDATETIMEFORMATW | |
343 { | |
1111 | 344 NMHDR nmhdr; |
345 LPCWSTR pszFormat; | |
346 SYSTEMTIME st; | |
347 LPCWSTR pszDisplay; | |
348 WCHAR szDisplay[64]; | |
771 | 349 } NMDATETIMEFORMATW, FAR * LPNMDATETIMEFORMATW; |
350 | |
1683 | 351 #if W32API_INSTALLED_VER < W32API_VER(2,2) |
1304 | 352 |
1111 | 353 typedef struct tagNMTTDISPIFNOA |
354 { | |
355 NMHDR hdr; | |
356 LPSTR lpszText; | |
357 char szText[80]; | |
358 HINSTANCE hinst; | |
359 UINT uFlags; | |
771 | 360 #if (_WIN32_IE >= 0x0300) |
1111 | 361 LPARAM lParam; |
771 | 362 #endif |
363 } NMTTDISPINFOA, FAR *LPNMTTDISPINFOA; | |
364 | |
1111 | 365 typedef struct tagNMTTDISPINFOW |
366 { | |
367 NMHDR hdr; | |
368 LPWSTR lpszText; | |
369 WCHAR szText[80]; | |
370 HINSTANCE hinst; | |
371 UINT uFlags; | |
771 | 372 #if (_WIN32_IE >= 0x0300) |
1111 | 373 LPARAM lParam; |
771 | 374 #endif |
375 } NMTTDISPINFOW, FAR *LPNMTTDISPINFOW; | |
376 | |
1683 | 377 #endif /* W32API_INSTALLED_VER < W32API_VER(2,2) */ |
1304 | 378 |
771 | 379 #endif /* (_WIN32_IE >= 0x0400) */ |
442 | 380 |
771 | 381 /* shlobj.h defines */ |
382 #ifndef BFFM_VALIDATEFAILEDA | |
383 #define BFFM_VALIDATEFAILEDA 3 | |
384 #endif | |
385 #ifndef BFFM_VALIDATEFAILEDW | |
386 #define BFFM_VALIDATEFAILEDW 4 | |
387 #endif | |
388 #ifndef BFFM_SETSELECTIONA | |
389 #define BFFM_SETSELECTIONA (WM_USER + 102) | |
390 #endif | |
391 #ifndef BFFM_SETSELECTIONW | |
392 #define BFFM_SETSELECTIONW (WM_USER + 103) | |
393 #endif | |
394 #ifndef BFFM_SETSTATUSTEXTA | |
395 #define BFFM_SETSTATUSTEXTA (WM_USER + 100) | |
396 #endif | |
397 #ifndef BFFM_SETSTATUSTEXTW | |
398 #define BFFM_SETSTATUSTEXTW (WM_USER + 104) | |
399 #endif | |
400 #ifndef SHARD_PATHA | |
401 #define SHARD_PATHA 2 | |
402 #endif | |
403 #ifndef SHARD_PATHW | |
404 #define SHARD_PATHW 3 | |
405 #endif | |
406 #ifndef SHCNF_PATHA | |
407 #define SHCNF_PATHA 1 | |
408 #endif | |
409 #ifndef SHCNF_PATHW | |
410 #define SHCNF_PATHW 5 | |
411 #endif | |
412 #ifndef SHCNF_PRINTERA | |
413 #define SHCNF_PRINTERA 2 | |
414 #endif | |
415 #ifndef SHCNF_PRINTERW | |
416 #define SHCNF_PRINTERW 6 | |
417 #endif | |
418 #ifndef BFFM_VALIDATEFAILED | |
419 #ifdef UNICODE | |
420 #define BFFM_VALIDATEFAILED BFFM_VALIDATEFAILEDW | |
421 #else | |
422 #define BFFM_VALIDATEFAILED BFFM_VALIDATEFAILEDA | |
423 #endif | |
819 | 424 #endif |
442 | 425 |
800 | 426 /* winnls.h defines */ |
819 | 427 #ifndef MAC_CHARSET |
428 #define MAC_CHARSET 77 | |
429 #endif | |
800 | 430 #ifndef LOCALE_RETURN_NUMBER |
819 | 431 #define LOCALE_RETURN_NUMBER 0x20000000 |
800 | 432 #endif |
433 | |
771 | 434 /* OEM resources */ |
435 #ifndef OCR_ICOCUR | |
436 #define OCR_ICOCUR 32647 | |
437 #define OIC_SAMPLE 32512 | |
438 #define OIC_HAND 32513 | |
439 #define OIC_QUES 32514 | |
440 #define OIC_BANG 32515 | |
441 #define OIC_NOTE 32516 | |
442 #define OIC_WINLOGO 32517 | |
443 #endif | |
444 | |
445 /* More Cygwin stupidity: Current w32api's winuser.h has IME message | |
446 constants and they conflict with imm.h. (NOTE: Currently fixed, but | |
447 I'm sure the problems were present post 1.0.) */ | |
448 #undef WM_IME_STARTCOMPOSITION | |
449 #undef WM_IME_ENDCOMPOSITION | |
450 #undef WM_IME_COMPOSITION | |
451 #undef WM_IME_KEYLAST | |
452 #undef WM_IME_SETCONTEXT | |
453 #undef WM_IME_NOTIFY | |
454 #undef WM_IME_CONTROL | |
455 #undef WM_IME_COMPOSITIONFULL | |
456 #undef WM_IME_SELECT | |
457 #undef WM_IME_CHAR | |
458 #undef WM_IME_KEYDOWN | |
459 #undef WM_IME_KEYUP | |
460 | |
461 #include <imm.h> | |
462 | |
1683 | 463 #if W32API_INSTALLED_VER < W32API_VER(2,4) |
771 | 464 typedef struct _SHQUERYRBINFO |
465 { | |
466 DWORD cbSize; | |
467 __int64 i64Size; | |
468 __int64 i64NumItems; | |
469 } SHQUERYRBINFO, *LPSHQUERYRBINFO; | |
1683 | 470 #endif |
771 | 471 |
472 typedef LPCDLGTEMPLATE LPCDLGTEMPLATEW; | |
473 typedef LPCDLGTEMPLATE LPCDLGTEMPLATEA; | |
474 | |
1685 | 475 #else /* !CYGWIN_HEADERS */ |
4893
99f2102552d7
Add typedefs for PCVOID and PDWORD_PTR for non-Cygwin-headers folks.
Ben Wing <ben@xemacs.org>
parents:
4867
diff
changeset
|
476 |
1685 | 477 #define W32API_VER(major,minor) 0 |
478 #define W32API_INSTALLED_VER 0 | |
4893
99f2102552d7
Add typedefs for PCVOID and PDWORD_PTR for non-Cygwin-headers folks.
Ben Wing <ben@xemacs.org>
parents:
4867
diff
changeset
|
479 |
99f2102552d7
Add typedefs for PCVOID and PDWORD_PTR for non-Cygwin-headers folks.
Ben Wing <ben@xemacs.org>
parents:
4867
diff
changeset
|
480 /* Some types that show up in Cygwin headers but not in Visual Studio headers, |
99f2102552d7
Add typedefs for PCVOID and PDWORD_PTR for non-Cygwin-headers folks.
Ben Wing <ben@xemacs.org>
parents:
4867
diff
changeset
|
481 and cause problems if we used Cygwin headers to generate |
99f2102552d7
Add typedefs for PCVOID and PDWORD_PTR for non-Cygwin-headers folks.
Ben Wing <ben@xemacs.org>
parents:
4867
diff
changeset
|
482 intl-auto-encap-win32.[ch]. */ |
99f2102552d7
Add typedefs for PCVOID and PDWORD_PTR for non-Cygwin-headers folks.
Ben Wing <ben@xemacs.org>
parents:
4867
diff
changeset
|
483 typedef LPCVOID PCVOID; |
99f2102552d7
Add typedefs for PCVOID and PDWORD_PTR for non-Cygwin-headers folks.
Ben Wing <ben@xemacs.org>
parents:
4867
diff
changeset
|
484 typedef LPDWORD *PDWORD_PTR; |
99f2102552d7
Add typedefs for PCVOID and PDWORD_PTR for non-Cygwin-headers folks.
Ben Wing <ben@xemacs.org>
parents:
4867
diff
changeset
|
485 |
771 | 486 #endif /* CYGWIN_HEADERS */ |
487 | |
488 /* Not in VC 6 */ | |
489 #ifndef BIF_NEWDIALOGSTYLE | |
490 #define BIF_NEWDIALOGSTYLE 64 | |
491 #endif | |
442 | 492 |
4538 | 493 #if defined (CYGWIN) && (CYGWIN_VERSION_DLL_COMBINED < 190) |
442 | 494 |
495 /* All but wcscmp and wcslen left out of Cygwin headers -- but present | |
771 | 496 in /usr/include/mingw/string.h! */ |
442 | 497 wchar_t* wcscat (wchar_t*, const wchar_t*); |
498 wchar_t* wcschr (const wchar_t*, wchar_t); | |
499 int wcscoll (const wchar_t*, const wchar_t*); | |
500 wchar_t* wcscpy (wchar_t*, const wchar_t*); | |
771 | 501 wchar_t* wcsdup (const wchar_t*); |
442 | 502 size_t wcscspn (const wchar_t*, const wchar_t*); |
503 /* Note: No wcserror in CRTDLL. */ | |
504 wchar_t* wcsncat (wchar_t*, const wchar_t*, size_t); | |
771 | 505 int wcsncmp (const wchar_t*, const wchar_t*, size_t); |
506 wchar_t* wcsncpy (wchar_t*, const wchar_t*, size_t); | |
507 wchar_t* wcspbrk (const wchar_t*, const wchar_t*); | |
508 wchar_t* wcsrchr (const wchar_t*, wchar_t); | |
509 size_t wcsspn (const wchar_t*, const wchar_t*); | |
510 wchar_t* wcsstr (const wchar_t*, const wchar_t*); | |
511 wchar_t* wcstok (wchar_t*, const wchar_t*); | |
512 size_t wcsxfrm (wchar_t*, const wchar_t*, size_t); | |
442 | 513 |
514 #endif /* CYGWIN */ | |
515 | |
771 | 516 /* ------------------------- Unicode encapsulation ------------------------- */ |
517 | |
2367 | 518 /* See intl-win32.c for more information about Unicode-encapsulation */ |
771 | 519 |
800 | 520 #define ERROR_WHEN_NONINTERCEPTED_FUNS_USED |
521 | |
771 | 522 #include "intl-auto-encap-win32.h" |
523 | |
524 /* would be encapsulatable but for parsing problems */ | |
800 | 525 |
526 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
527 #undef DefWindowProc | |
528 #define DefWindowProc error use qxeDefWindowProc or DefWindowProcA/DefWindowProcW | |
529 #endif | |
771 | 530 LRESULT qxeDefWindowProc (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); |
800 | 531 |
532 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
533 #undef CallWindowProc | |
534 #define CallWindowProc error use qxeCallWindowProc or CallWindowProcA/CallWindowProcW | |
535 #endif | |
771 | 536 LRESULT qxeCallWindowProc (WNDPROC lpPrevWndFunc, HWND hWnd, UINT Msg, |
537 WPARAM wParam, LPARAM lParam); | |
800 | 538 |
539 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
540 #undef DefDlgProc | |
541 #define DefDlgProc error use qxeDefDlgProc or DefDlgProcA/DefDlgProcW | |
542 #endif | |
771 | 543 LRESULT qxeDefDlgProc (HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam); |
800 | 544 |
545 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
546 #undef SetWindowsHook | |
547 #define SetWindowsHook error use qxeSetWindowsHook or SetWindowsHookA/SetWindowsHookW | |
548 #endif | |
771 | 549 HHOOK qxeSetWindowsHook (int nFilterType, HOOKPROC pfnFilterProc); |
800 | 550 |
551 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
552 #undef DefMDIChildProc | |
553 #define DefMDIChildProc error use qxeDefMDIChildProc or DefMDIChildProcA/DefMDIChildProcW | |
554 #endif | |
771 | 555 LRESULT qxeDefMDIChildProc (HWND hWnd, UINT uMsg, WPARAM wParam, |
556 LPARAM lParam); | |
557 | |
800 | 558 #undef GetEnvironmentStrings |
559 #undef GetEnvironmentStringsA | |
560 #define GetEnvironmentStringsA GetEnvironmentStrings | |
561 Extbyte * qxeGetEnvironmentStrings (void); | |
562 | |
771 | 563 /* would be encapsulatable but for Cygwin problems */ |
800 | 564 |
565 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
1111 | 566 #undef DdeCreateStringHandle |
567 #define DdeCreateStringHandle error use qxeDdeCreateStringHandle or DdeCreateStringHandleA/DdeCreateStringHandleW | |
568 #endif | |
569 HSZ qxeDdeCreateStringHandle (DWORD idInst, const Extbyte * psz, int iCodePage); | |
570 | |
571 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
800 | 572 #undef RegConnectRegistry |
573 #define RegConnectRegistry error use qxeRegConnectRegistry or RegConnectRegistryA/RegConnectRegistryW | |
574 #endif | |
771 | 575 LONG qxeRegConnectRegistry (const Extbyte * lpMachineName, HKEY hKey, PHKEY phkResult); |
800 | 576 |
577 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
578 #undef ExtractIconEx | |
579 #define ExtractIconEx error use qxeExtractIconEx or ExtractIconExA/ExtractIconExW | |
580 #endif | |
771 | 581 UINT qxeExtractIconEx (const Extbyte * lpszFile, int nIconIndex, HICON FAR * phiconLarge, HICON FAR * phiconSmall, UINT nIcons); |
800 | 582 |
583 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
584 #undef GetICMProfile | |
585 #define GetICMProfile error use qxeGetICMProfile or GetICMProfileA/GetICMProfileW | |
586 #endif | |
771 | 587 BOOL qxeGetICMProfile (HDC arg1, LPDWORD arg2, Extbyte * arg3); |
800 | 588 |
589 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
590 #undef UpdateICMRegKey | |
591 #define UpdateICMRegKey error use qxeUpdateICMRegKey or UpdateICMRegKeyA/UpdateICMRegKeyW | |
592 #endif | |
771 | 593 BOOL qxeUpdateICMRegKey (DWORD arg1, Extbyte * arg2, Extbyte * arg3, UINT arg4); |
594 | |
2500 | 595 /* would be encapsulatable but for header changes in different versions of VC++ */ |
596 | |
597 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
598 #undef EnumResourceTypes | |
599 #define EnumResourceTypes error_use_qxeEnumResourceTypes_or_EnumResourceTypesA_and_EnumResourceTypesW | |
600 #endif | |
601 #if MSC_VERSION >= 1300 | |
602 BOOL qxeEnumResourceTypes (HMODULE hModule, ENUMRESTYPEPROCW lpEnumFunc, LONG lParam); | |
603 #else | |
604 BOOL qxeEnumResourceTypes (HMODULE hModule, ENUMRESTYPEPROC lpEnumFunc, LONG lParam); | |
605 #endif | |
606 | |
607 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
608 #undef EnumResourceNames | |
609 #define EnumResourceNames error_use_qxeEnumResourceNames_or_EnumResourceNamesA_and_EnumResourceNamesW | |
610 #endif | |
611 #if MSC_VERSION >= 1300 | |
612 BOOL qxeEnumResourceNames (HMODULE hModule, const Extbyte * lpType, ENUMRESNAMEPROCW lpEnumFunc, LONG lParam); | |
613 #else | |
614 BOOL qxeEnumResourceNames (HMODULE hModule, const Extbyte * lpType, ENUMRESNAMEPROC lpEnumFunc, LONG lParam); | |
615 #endif | |
616 | |
617 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
618 #undef EnumResourceLanguages | |
619 #define EnumResourceLanguages error_use_qxeEnumResourceLanguages_or_EnumResourceLanguagesA_and_EnumResourceLanguagesW | |
620 #endif | |
621 #if MSC_VERSION >= 1300 | |
622 BOOL qxeEnumResourceLanguages (HMODULE hModule, const Extbyte * lpType, const Extbyte * lpName, ENUMRESLANGPROCW lpEnumFunc, LONG lParam); | |
623 #else | |
624 BOOL qxeEnumResourceLanguages (HMODULE hModule, const Extbyte * lpType, const Extbyte * lpName, ENUMRESLANGPROC lpEnumFunc, LONG lParam); | |
625 #endif | |
626 | |
771 | 627 /* files */ |
800 | 628 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED |
629 #undef FindFirstFile | |
630 #define FindFirstFile error use qxeFindFirstFile or FindFirstFileA/FindFirstFileW | |
631 #endif | |
771 | 632 HANDLE qxeFindFirstFile (const Extbyte *lpFileName, |
633 WIN32_FIND_DATAW *lpFindFileData); | |
800 | 634 |
635 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
636 #undef FindNextFile | |
637 #define FindNextFile error use qxeFindNextFile or FindNextFileA/FindNextFileW | |
638 #endif | |
771 | 639 BOOL qxeFindNextFile (HANDLE hFindFile, WIN32_FIND_DATAW *lpFindFileData); |
640 | |
641 /* shell */ | |
800 | 642 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED |
643 #undef SHGetFileInfo | |
644 #define SHGetFileInfo error use qxeSHGetFileInfo or SHGetFileInfoA/SHGetFileInfoW | |
645 #endif | |
771 | 646 DWORD qxeSHGetFileInfo (const Extbyte *pszPath, DWORD dwFileAttributes, |
647 SHFILEINFOW *psfi, UINT cbFileInfo, UINT uFlags); | |
800 | 648 |
649 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
650 #undef SHBrowseForFolder | |
651 #define SHBrowseForFolder error use qxeSHBrowseForFolder or SHBrowseForFolderA/SHBrowseForFolderW | |
652 #endif | |
771 | 653 LPITEMIDLIST qxeSHBrowseForFolder (LPBROWSEINFOW lpbi); |
800 | 654 |
655 /* Not Unicode-split */ | |
771 | 656 VOID qxeSHAddToRecentDocs (UINT uFlags, LPCVOID pv); |
800 | 657 |
658 /* Not Unicode-split */ | |
771 | 659 VOID qxeSHChangeNotify (LONG wEventId, UINT uFlags, LPCVOID dwItem1, |
660 LPCVOID dwItem2); | |
800 | 661 |
662 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
663 #undef SHGetDataFromIDList | |
664 #define SHGetDataFromIDList error use qxeSHGetDataFromIDList or SHGetDataFromIDListA/SHGetDataFromIDListW | |
665 #endif | |
771 | 666 HRESULT qxeSHGetDataFromIDList (IShellFolder *psf, LPCITEMIDLIST pidl, |
667 int nFormat, PVOID pv, int cb); | |
668 | |
669 /* devmode */ | |
800 | 670 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED |
671 #undef CreateDC | |
672 #define CreateDC error use qxeCreateDC or CreateDCA/CreateDCW | |
673 #endif | |
771 | 674 HDC qxeCreateDC (const Extbyte *lpszDriver, const Extbyte *lpszDevice, |
675 const Extbyte *lpszOutput, CONST DEVMODEW *lpInitData); | |
800 | 676 |
677 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
678 #undef ResetDC | |
679 #define ResetDC error use qxeResetDC or ResetDCA/ResetDCW | |
680 #endif | |
771 | 681 HDC qxeResetDC (HDC hdc, CONST DEVMODEW *lpInitData); |
800 | 682 |
683 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
684 #undef OpenPrinter | |
685 #define OpenPrinter error use qxeOpenPrinter or OpenPrinterA/OpenPrinterW | |
686 #endif | |
771 | 687 DWORD qxeOpenPrinter (Extbyte *pPrinterName, LPHANDLE phPrinter, |
688 LPPRINTER_DEFAULTSW pDefaultconst); | |
800 | 689 |
690 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
691 #undef DocumentProperties | |
692 #define DocumentProperties error use qxeDocumentProperties or DocumentPropertiesA/DocumentPropertiesW | |
693 #endif | |
771 | 694 LONG qxeDocumentProperties (HWND hWnd, HANDLE hPrinter, Extbyte *pDeviceName, |
695 DEVMODEW *pDevModeOutput, DEVMODEW *pDevModeInput, | |
696 DWORD fMode); | |
800 | 697 |
698 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
699 #undef PrintDlg | |
700 #define PrintDlg error use qxePrintDlg or PrintDlgA/PrintDlgW | |
701 #endif | |
771 | 702 BOOL qxePrintDlg (PRINTDLGW *lppd); |
800 | 703 |
704 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
705 #undef PageSetupDlg | |
706 #define PageSetupDlg error use qxePageSetupDlg or PageSetupDlgA/PageSetupDlgW | |
707 #endif | |
771 | 708 BOOL qxePageSetupDlg (PAGESETUPDLGW *lppd); |
709 | |
710 /* fonts */ | |
800 | 711 |
712 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
713 #undef EnumFontFamiliesEx | |
714 #define EnumFontFamiliesEx error use qxeEnumFontFamiliesEx or EnumFontFamiliesExA/EnumFontFamiliesExW | |
715 #endif | |
771 | 716 int qxeEnumFontFamiliesEx (HDC hdc, LOGFONTW *lpLogfont, |
717 FONTENUMPROCW lpEnumFontFamProc, LPARAM lParam, | |
718 DWORD dwFlags); | |
800 | 719 |
720 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
721 #undef CreateFontIndirect | |
722 #define CreateFontIndirect error use qxeCreateFontIndirect or CreateFontIndirectA/CreateFontIndirectW | |
723 #endif | |
771 | 724 HFONT qxeCreateFontIndirect (CONST LOGFONTW *lplf); |
800 | 725 |
2500 | 726 #if defined (HAVE_MS_WINDOWS) |
800 | 727 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED |
728 #undef ImmSetCompositionFont | |
729 #define ImmSetCompositionFont error use qxeImmSetCompositionFont or ImmSetCompositionFontA/ImmSetCompositionFontW | |
730 #endif | |
771 | 731 BOOL qxeImmSetCompositionFont (HIMC imc, LOGFONTW *lplf); |
2500 | 732 #endif /* defined (HAVE_MS_WINDOWS) */ |
800 | 733 |
2500 | 734 #if defined (HAVE_MS_WINDOWS) |
800 | 735 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED |
736 #undef ImmGetCompositionFont | |
737 #define ImmGetCompositionFont error use qxeImmGetCompositionFont or ImmGetCompositionFontA/ImmGetCompositionFontW | |
738 #endif | |
771 | 739 BOOL qxeImmGetCompositionFont (HIMC imc, LOGFONTW *lplf); |
2500 | 740 #endif /* defined (HAVE_MS_WINDOWS) */ |
741 | |
742 #if defined (HAVE_MS_WINDOWS) | |
743 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
744 #undef ImmSetCompositionString | |
745 #define ImmSetCompositionString error_use_qxeImmSetCompositionString_or_ImmSetCompositionStringA_and_ImmSetCompositionStringW | |
746 #endif | |
747 #if MSC_VERSION >= 1300 | |
748 BOOL qxeImmSetCompositionString (HIMC arg1, DWORD dwIndex, LPVOID lpComp, DWORD arg4, LPCVOID lpRead, DWORD arg6); | |
749 #else | |
750 BOOL qxeImmSetCompositionString (HIMC arg1, DWORD dwIndex, LPCVOID lpComp, DWORD arg4, LPCVOID lpRead, DWORD arg6); | |
751 #endif | |
752 #endif /* defined (HAVE_MS_WINDOWS) */ | |
800 | 753 |
754 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
755 #undef GetObject | |
756 #define GetObject error use qxeGetObject or GetObjectA/GetObjectW | |
757 #endif | |
771 | 758 int qxeGetObject (HGDIOBJ hgdiobj, int cbBuffer, LPVOID lpvObject); |
800 | 759 |
760 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
761 #undef GetTextMetrics | |
762 #define GetTextMetrics error use qxeGetTextMetrics or GetTextMetricsA/GetTextMetricsW | |
763 #endif | |
771 | 764 BOOL qxeGetTextMetrics (HDC hdc, LPTEXTMETRICW lptm); |
765 | |
766 /* COMMCTRL.H */ | |
800 | 767 |
768 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
769 #undef SendMessage | |
770 #define SendMessage error use qxeSendMessage or SendMessageA/SendMessageW | |
771 #endif | |
771 | 772 LRESULT qxeSendMessage (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); |
773 | |
774 /* windows */ | |
800 | 775 |
776 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
777 #undef RegisterClass | |
778 #define RegisterClass error use qxeRegisterClass or RegisterClassA/RegisterClassW | |
779 #endif | |
771 | 780 ATOM qxeRegisterClass (CONST WNDCLASSW * lpWndClass); |
800 | 781 |
782 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
783 #undef UnregisterClass | |
784 #define UnregisterClass error use qxeUnregisterClass or UnregisterClassA/UnregisterClassW | |
785 #endif | |
771 | 786 BOOL qxeUnregisterClass (const Extbyte * lpClassName, HINSTANCE hInstance); |
800 | 787 |
788 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
789 #undef RegisterClassEx | |
790 #define RegisterClassEx error use qxeRegisterClassEx or RegisterClassExA/RegisterClassExW | |
791 #endif | |
771 | 792 ATOM qxeRegisterClassEx (CONST WNDCLASSEXW * arg1); |
800 | 793 |
794 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
795 #undef CreateWindow | |
796 #define CreateWindow error use qxeCreateWindow or CreateWindowA/CreateWindowW | |
797 #endif | |
771 | 798 #define qxeCreateWindow(lpClassName, lpWindowName, dwStyle, x, y, \ |
799 nWidth, nHeight, hWndParent, hMenu, hInstance, \ | |
800 lpParam) \ | |
801 qxeCreateWindowEx (0L, lpClassName, lpWindowName, dwStyle, x, y, \ | |
802 nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam) | |
803 | |
804 /* ------------------------- Unicode conversion ------------------------- */ | |
805 | |
806 /* Set early in command-line processing, when -nuni or | |
807 --no-unicode-lib-calls is seen. */ | |
808 extern int no_mswin_unicode_lib_calls; | |
2367 | 809 /* Set early, in init_win32_very_very_early(). */ |
771 | 810 extern int mswindows_windows9x_p; |
811 #define XEUNICODE_P (!mswindows_windows9x_p && !no_mswin_unicode_lib_calls) | |
812 | |
813 #define XELPTSTR LPWSTR | |
814 #define XELPCTSTR LPCWSTR | |
442 | 815 |
816 #define XETCHAR_SIZE (XEUNICODE_P ? sizeof (WCHAR) : sizeof (CHAR)) | |
817 #define MAX_XETCHAR_SIZE sizeof (WCHAR) | |
818 #define XETEXT1(arg) (XEUNICODE_P ? ((char *) (L##arg)) : (arg)) | |
819 /* We need to do this indirection in case ARG is also a manifest constant. | |
820 I don't really understand why. --ben */ | |
821 #define XETEXT(arg) XETEXT1(arg) | |
822 #define XECOPY_TCHAR(ptr, ch) \ | |
823 (XEUNICODE_P ? (* (LPWSTR) (ptr) = L##ch) : (* (LPSTR) (ptr) = (ch))) | |
2421 | 824 #define qxetcslen(arg) \ |
771 | 825 (XEUNICODE_P ? wcslen ((wchar_t *) arg) : strlen (arg)) |
2421 | 826 #define qxetcsbytelen(arg) \ |
771 | 827 (XEUNICODE_P ? wcslen ((wchar_t *) arg) * XETCHAR_SIZE : strlen (arg)) |
2421 | 828 #define qxetcscmp(s1, s2) \ |
442 | 829 (XEUNICODE_P ? wcscmp ((wchar_t *) s1, (wchar_t *) s2) \ |
830 : strcmp (s1, s2)) | |
2421 | 831 #define qxetcscpy(s1, s2) \ |
442 | 832 (XEUNICODE_P ? (char *) wcscpy ((wchar_t *) s1, (wchar_t *) s2) \ |
833 : strcpy (s1, s2)) | |
2421 | 834 #define qxetcsncpy(s1, s2, n) \ |
771 | 835 (XEUNICODE_P ? (char *) wcsncpy ((wchar_t *) s1, (wchar_t *) s2, n) \ |
836 : strncpy (s1, s2, n)) | |
2421 | 837 #define qxetcschr(s, ch) \ |
442 | 838 (XEUNICODE_P ? (char *) wcschr ((wchar_t *) s, (WCHAR) ch) \ |
839 : strchr (s, ch)) | |
2421 | 840 #define qxetcsrchr(s, ch) \ |
442 | 841 (XEUNICODE_P ? (char *) wcsrchr ((wchar_t *) s, (WCHAR) ch) \ |
842 : strrchr (s, ch)) | |
2421 | 843 #define qxetcsdup(s) \ |
771 | 844 (XEUNICODE_P ? (char *) wcsdup ((wchar_t *) s) \ |
845 : xstrdup (s)) | |
442 | 846 |
4981
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4959
diff
changeset
|
847 #define ITEXT_TO_TSTR(in) ITEXT_TO_EXTERNAL (in, Qmswindows_tstr) |
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4959
diff
changeset
|
848 #define LISP_STRING_TO_TSTR(in) LISP_STRING_TO_EXTERNAL (in, Qmswindows_tstr) |
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4959
diff
changeset
|
849 #define TSTR_TO_ITEXT(in) EXTERNAL_TO_ITEXT (in, Qmswindows_tstr) |
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4959
diff
changeset
|
850 #define TSTR_TO_ITEXT_MALLOC(in) \ |
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4959
diff
changeset
|
851 EXTERNAL_TO_ITEXT_MALLOC (in, Qmswindows_tstr) |
771 | 852 |
853 #define build_tstr_string(in) \ | |
4953
304aebb79cd3
function renamings to track names of char typedefs
Ben Wing <ben@xemacs.org>
parents:
4952
diff
changeset
|
854 make_extstring (in, qxetcsbytelen ((Extbyte *) in), Qmswindows_tstr) |
771 | 855 |
856 #define MAX_ANSI_CHAR_LEN 1 | |
857 #define MAX_UNICODE_CHAR_LEN 2 | |
858 | |
859 DECLARE_INLINE_HEADER (int ansi_char_to_text (int ch, Extbyte *t)) | |
860 { | |
861 ch &= 0xFF; | |
862 t[0] = ch; | |
863 return 1; | |
864 } | |
865 | |
866 DECLARE_INLINE_HEADER (int unicode_char_to_text (int ch, Extbyte *t)) | |
867 { | |
868 t[0] = ch & 0xFF; | |
869 t[1] = (ch >> 8) & 0xFF; | |
870 return 2; | |
871 } | |
442 | 872 |
771 | 873 Extbyte *convert_multibyte_to_unicode_malloc (const Extbyte *src, |
874 Bytecount n, | |
875 int cp, Bytecount *size_out); | |
2367 | 876 Extbyte *convert_unicode_to_multibyte_malloc (const Extbyte *src, |
877 Bytecount n, | |
878 int cp, Bytecount *size_out); | |
867 | 879 Ibyte *convert_multibyte_to_internal_malloc (const Extbyte *src, |
771 | 880 Bytecount n, |
881 int cp, Bytecount *size_out); | |
882 void convert_multibyte_to_unicode_dynarr (const Extbyte *src, Bytecount n, | |
883 int cp, unsigned_char_dynarr *dst); | |
2367 | 884 void convert_unicode_to_multibyte_dynarr (const Extbyte *src, Bytecount n, |
885 int cp, unsigned_char_dynarr *dst); | |
886 | |
887 Bytecount unicode_multibyte_convert_size (const char *srctext, const void *src, | |
888 Bytecount src_size, int to_unicode, | |
889 int cp); | |
890 void *unicode_multibyte_convert_copy_data (const char *srctext, | |
891 void *alloca_data); | |
892 | |
893 /* NOTE: If you make two invocations of the following functions in the same | |
894 subexpression and use the exact same expression for the source in both | |
895 cases, you will lose. In this unlikely case, you may get an abort, and | |
896 need to rewrite the code. | |
897 | |
898 We need to use ALLOCA_FUNCALL_OK here, see NEW_DFC in text.h. | |
899 */ | |
900 | |
901 #ifdef WEXTTEXT_IS_WIDE | |
902 #define MULTIBYTE_TO_WEXTTEXT(str) \ | |
903 ((Wexttext *) \ | |
904 unicode_multibyte_convert_copy_data \ | |
905 (#str, ALLOCA_FUNCALL_OK (unicode_multibyte_convert_size \ | |
906 (#str, str, strlen (str) + 1, 1, CP_ACP)))) | |
907 | |
908 #define WEXTTEXT_TO_MULTIBYTE(str) \ | |
909 ((Extbyte *) \ | |
910 unicode_multibyte_convert_copy_data \ | |
911 (#str, ALLOCA_FUNCALL_OK (unicode_multibyte_convert_size \ | |
912 (#str, str, \ | |
913 (wcslen (str) + 1) * sizeof (WCHAR), 0, \ | |
914 CP_ACP)))) | |
915 #else | |
916 #define MULTIBYTE_TO_WEXTTEXT(str) ((Wexttext *) (str)) | |
917 #define WEXTTEXT_TO_MULTIBYTE(str) ((Extbyte *) (str)) | |
918 #endif | |
919 | |
920 /* #### mbstowcs() uses MB_ERR_INVALID_CHARS in addition to MB_PRECOMPOSED. | |
921 Should we do this? But then we have to handle errors. | |
922 #### Do we already check for invalid sequences in the coding system? */ | |
923 #define MBTOWC_OPTIONS MB_PRECOMPOSED /* | MB_ERR_INVALID_CHARS */ | |
924 /* The following options are what wcstombs() uses in the CRT. It uses | |
925 NULL in place of "~". */ | |
926 #define WCTOMB_OPTIONS WC_COMPOSITECHECK | WC_SEPCHARS | |
927 #define WCTOMB_INVALID_STRING "~" | |
771 | 928 |
929 /* ------------------------- Other Mule stuff ------------------------- */ | |
930 | |
931 LCID mswindows_current_locale (void); | |
932 int mswindows_locale_to_code_page (LCID lcid); | |
933 int mswindows_locale_to_oem_code_page (LCID lcid); | |
934 | |
935 /* ------------------------- Filename conversion ------------------------- */ | |
936 | |
937 #ifdef CYGWIN | |
1743 | 938 |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
939 /* We should just remove the Windows 9x support */ |
1743 | 940 |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
941 #define CCP_POSIX_TO_WIN_T \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
942 (XEUNICODE_P ? CCP_POSIX_TO_WIN_W : CCP_POSIX_TO_WIN_A) |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
943 #define CCP_WIN_T_TO_POSIX \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
944 (XEUNICODE_P ? CCP_WIN_W_TO_POSIX : CCP_WIN_A_TO_POSIX) |
1743 | 945 |
771 | 946 #endif |
947 | |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
948 #ifdef HAVE_CYGWIN_CONV_PATH |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
949 #define LOCAL_FILE_FORMAT_TO_TSTR(path, out) \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
950 do { \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
951 const Ibyte *lfftt = (path); \ |
4981
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4959
diff
changeset
|
952 const Extbyte **lffttout = (const Extbyte **) &(out); \ |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
953 if (isalpha (lfftt[0]) && (IS_DEVICE_SEP (lfftt[1]))) \ |
4981
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4959
diff
changeset
|
954 PATHNAME_CONVERT_OUT_TSTR (lfftt, *lffttout); \ |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
955 else \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
956 { \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
957 int lfftt_size; \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
958 Extbyte *lfftt_utf8_path; \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
959 Extbyte *lfftt_tstr_path; \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
960 \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
961 PATHNAME_CONVERT_OUT_UTF_8 (lfftt, lfftt_utf8_path); \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
962 lfftt_size = cygwin_conv_path (CCP_POSIX_TO_WIN_T | CCP_RELATIVE, \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
963 lfftt_utf8_path, NULL, 0); \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
964 lfftt_tstr_path = alloca_extbytes (lfftt_size); \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
965 cygwin_conv_path (CCP_POSIX_TO_WIN_T | CCP_RELATIVE, \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
966 lfftt_utf8_path, lfftt_tstr_path, lfftt_size); \ |
4981
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4959
diff
changeset
|
967 *lffttout = lfftt_tstr_path; \ |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
968 } \ |
442 | 969 } while (0) |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
970 #define TSTR_TO_LOCAL_FILE_FORMAT(path, out) \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
971 do { \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
972 const Extbyte *ttlff = (path); \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
973 int ttlff_size; \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
974 Extbyte *ttlff_utf8_path; \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
975 \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
976 ttlff_size = cygwin_conv_path (CCP_WIN_T_TO_POSIX | CCP_RELATIVE, \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
977 ttlff, NULL, 0); \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
978 ttlff_utf8_path = alloca_extbytes (ttlff_size); \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
979 cygwin_conv_path (CCP_WIN_T_TO_POSIX | CCP_RELATIVE, \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
980 ttlff, ttlff_utf8_path, ttlff_size); \ |
4988
4cfb6aeb989d
fix compile problems on Windows native
Ben Wing <ben@xemacs.org>
parents:
4981
diff
changeset
|
981 (out) = EXTERNAL_TO_ITEXT (ttlff_utf8_path, Qutf_8); \ |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
982 } while (0) |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
983 #else /* not HAVE_CYGWIN_CONV_PATH */ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
984 #define LOCAL_FILE_FORMAT_TO_TSTR(path, out) \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
985 do { \ |
4867
7822019c5d98
Revert cast in check_writable() and fix up macros to use const.
Vin Shelton <acs@xemacs.org>
parents:
4858
diff
changeset
|
986 const Ibyte *lfftt; \ |
4988
4cfb6aeb989d
fix compile problems on Windows native
Ben Wing <ben@xemacs.org>
parents:
4981
diff
changeset
|
987 const Extbyte **lffttout = (const Extbyte **) &(out); \ |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
988 \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
989 LOCAL_FILE_FORMAT_TO_INTERNAL_MSWIN (path, lfftt); \ |
4988
4cfb6aeb989d
fix compile problems on Windows native
Ben Wing <ben@xemacs.org>
parents:
4981
diff
changeset
|
990 PATHNAME_CONVERT_OUT_TSTR (lfftt, *lffttout); \ |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
991 } while (0) |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
992 #define TSTR_TO_LOCAL_FILE_FORMAT(path, out) \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
993 do { \ |
4867
7822019c5d98
Revert cast in check_writable() and fix up macros to use const.
Vin Shelton <acs@xemacs.org>
parents:
4858
diff
changeset
|
994 const Ibyte *ttlff; \ |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
995 \ |
4988
4cfb6aeb989d
fix compile problems on Windows native
Ben Wing <ben@xemacs.org>
parents:
4981
diff
changeset
|
996 ttlff = TSTR_TO_ITEXT (path); \ |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
997 INTERNAL_MSWIN_TO_LOCAL_FILE_FORMAT (ttlff, out); \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
998 } while (0) |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
999 #endif /* (not) HAVE_CYGWIN_CONV_PATH */ |
442 | 1000 |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1001 #define LISP_LOCAL_FILE_FORMAT_TO_TSTR(path, out) \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1002 LOCAL_FILE_FORMAT_TO_TSTR (XSTRING_DATA (path), out) |
826 | 1003 /* Convert from local file format, as used in XEmacs, to valid win32 |
1004 filenames as can be given to Windows API routines. Under native XEmacs, | |
1005 this is a no-op, but under Cygwin, the local names look different -- | |
1006 Cygwin mount points, forward slashes, etc. Currently, under Cygwin, we | |
1007 actually allow local names to be of both formats, i.e. Cygwin or Win32 | |
1008 native. So we check to see if we have Win32 native already (a cheesy | |
1009 check, look for letter plus colon at beginning of name) and do nothing | |
1010 in that case. */ | |
1011 | |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1012 #ifdef HAVE_CYGWIN_CONV_PATH |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1013 /* When Cygwin uses UTF-8, we can't just manipulate internal-format data |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1014 with its routines because it will mangle the high bytes, so we need to |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1015 convert to UTF-8 first, then to Win32 TSTR format (i.e. UTF-16, on |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1016 Windows NT), then back to internal format. Routines that want external |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1017 format should avoid this by using LISP_LOCAL_FILE_FORMAT_TO_TSTR(). |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1018 Same thing applies going the other direction. */ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1019 #define LOCAL_FILE_FORMAT_TO_INTERNAL_MSWIN(path, pathout) \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1020 do \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1021 { \ |
4867
7822019c5d98
Revert cast in check_writable() and fix up macros to use const.
Vin Shelton <acs@xemacs.org>
parents:
4858
diff
changeset
|
1022 const Extbyte *lfftiwp; \ |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1023 \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1024 LOCAL_FILE_FORMAT_TO_TSTR (path, lfftiwp); \ |
4981
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4959
diff
changeset
|
1025 (pathout) = TSTR_TO_ITEXT (lfftiwp); \ |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1026 } \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1027 while (0) |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1028 #define INTERNAL_MSWIN_TO_LOCAL_FILE_FORMAT(path, pathout) \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1029 do { \ |
4867
7822019c5d98
Revert cast in check_writable() and fix up macros to use const.
Vin Shelton <acs@xemacs.org>
parents:
4858
diff
changeset
|
1030 const Extbyte *iwtlffp; \ |
4981
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4959
diff
changeset
|
1031 iwtlffp = ITEXT_TO_TSTR (path); \ |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1032 TSTR_TO_LOCAL_FILE_FORMAT (iwtlffp, pathout); \ |
442 | 1033 } while (0) |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1034 #elif defined (CYGWIN) |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1035 #define LOCAL_FILE_FORMAT_TO_INTERNAL_MSWIN(path, pathout) \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1036 do { \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1037 /* NOTE: It is a bit evil that here and below we are passing \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1038 internal-format data to a function that (nominally) should work \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1039 with external-format data. But in point of fact, the Cygwin \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1040 conversion functions are *NOT* localized, and will fail if they \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1041 get 7-bit ISO2022-encoded data. We know that our internal format \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1042 is ASCII-compatible, and so these functions will work fine with \ |
4981
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4959
diff
changeset
|
1043 this data (maybe ... not when Cygwin uses UTF-8) */ \ |
4867
7822019c5d98
Revert cast in check_writable() and fix up macros to use const.
Vin Shelton <acs@xemacs.org>
parents:
4858
diff
changeset
|
1044 const Ibyte *lfftiwp = (path); \ |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1045 if (isalpha (lfftiwp[0]) && (IS_DEVICE_SEP (lfftiwp[1]))) \ |
4981
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4959
diff
changeset
|
1046 (pathout) = lfftiwp; \ |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1047 else \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1048 { \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1049 int lfftiw2 = \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1050 cygwin_posix_to_win32_path_list_buf_size ((char *) lfftiwp); \ |
4981
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4959
diff
changeset
|
1051 (pathout) = alloca_ibytes (lfftiw2); \ |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1052 cygwin_posix_to_win32_path_list ((char *) lfftiwp, (char *) pathout); \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1053 } \ |
442 | 1054 } while (0) |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1055 #define INTERNAL_MSWIN_TO_LOCAL_FILE_FORMAT(path, pathout) \ |
593 | 1056 do { \ |
4867
7822019c5d98
Revert cast in check_writable() and fix up macros to use const.
Vin Shelton <acs@xemacs.org>
parents:
4858
diff
changeset
|
1057 const Ibyte *wtlff1 = (path); \ |
593 | 1058 int wtlff2 = \ |
1059 cygwin_win32_to_posix_path_list_buf_size ((char *) wtlff1); \ | |
2367 | 1060 Ibyte *wtlff3 = alloca_ibytes (wtlff2); \ |
593 | 1061 cygwin_win32_to_posix_path_list ((char *) wtlff1, (char *) wtlff3); \ |
771 | 1062 (pathout) = wtlff3; \ |
442 | 1063 } while (0) |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1064 #else /* not defined (CYGWIN) */ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1065 #define LOCAL_FILE_FORMAT_TO_INTERNAL_MSWIN(path, pathout) \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1066 do { \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1067 (pathout) = (path); \ |
442 | 1068 } while (0) |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1069 #define INTERNAL_MSWIN_TO_LOCAL_FILE_FORMAT(path, pathout) \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1070 do { \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1071 (pathout) = (path); \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1072 } while (0) |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1073 #endif /* (not) defined (CYGWIN) */ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1074 |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1075 Lisp_Object tstr_to_local_file_format (Extbyte *pathout); |
442 | 1076 |
826 | 1077 /* Convert a local-format file name or URL in internal format into a Win32 |
1078 file name or URL in tstr format. */ | |
1079 | |
1080 #ifdef CYGWIN | |
1081 | |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1082 #define LISP_LOCAL_FILE_FORMAT_MAYBE_URL_TO_TSTR(lispstr, pathout) \ |
2526 | 1083 do \ |
1084 { \ | |
1085 Ibyte *lffmutt_fname1; \ | |
1086 Ibyte *lffmutt_pathint = XSTRING_DATA (lispstr); \ | |
1087 \ | |
1088 if ((lffmutt_fname1 = qxestrchr (lffmutt_pathint, ':')) != NULL \ | |
1089 && *++lffmutt_fname1 == '/' && *++lffmutt_fname1 == '/') \ | |
1090 { \ | |
1091 /* If URL style file, the innards may have Cygwin mount points and \ | |
1092 the like. so separate out the innards, process them, and put back \ | |
1093 together. */ \ | |
1094 if (qxestrncasecmp_ascii (lffmutt_pathint, "file://", 7) == 0) \ | |
1095 { \ | |
1096 Ibyte *lffmutt_path1, *lffmutt_path2; \ | |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1097 LOCAL_FILE_FORMAT_TO_INTERNAL_MSWIN (lffmutt_pathint + 7, \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1098 lffmutt_path1); \ |
2526 | 1099 if (lffmutt_path1 == lffmutt_pathint + 7) /* Optimization */ \ |
1100 lffmutt_path2 = lffmutt_pathint; \ | |
1101 else \ | |
1102 { \ | |
867 | 1103 lffmutt_path2 = alloca_ibytes (7 + qxestrlen (lffmutt_path1) \ |
2526 | 1104 + 1); \ |
1105 qxestrncpy (lffmutt_path2, lffmutt_pathint, 7); \ | |
1106 qxestrcpy (lffmutt_path2 + 7, lffmutt_path1); \ | |
1107 } \ | |
4981
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4959
diff
changeset
|
1108 (pathout) = ITEXT_TO_TSTR (lffmutt_path2); \ |
2526 | 1109 } \ |
1110 else \ | |
1111 /* A straight URL, just convert */ \ | |
4981
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4959
diff
changeset
|
1112 (pathout) = LISP_STRING_TO_TSTR (lispstr); \ |
2526 | 1113 } \ |
1114 else \ | |
1115 /* Not URL-style, must be a straight filename. */ \ | |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1116 LISP_LOCAL_FILE_FORMAT_TO_TSTR (lispstr, pathout); \ |
826 | 1117 } while (0) |
1118 | |
1119 #else /* not CYGWIN */ | |
1120 | |
1121 /* URL's (and everything else) are already in the right format */ | |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1122 #define LISP_LOCAL_FILE_FORMAT_MAYBE_URL_TO_TSTR(lispstr, pathout) \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1123 LISP_LOCAL_FILE_FORMAT_TO_TSTR (lispstr, pathout) |
826 | 1124 |
1125 #endif /* not CYGWIN */ | |
1126 | |
1127 | |
867 | 1128 Ibyte *urlify_filename (Ibyte *filename); |
1129 Ibyte *mswindows_canonicalize_filename (Ibyte *name); | |
771 | 1130 #define MSWINDOWS_NORMALIZE_FILENAME(name) \ |
867 | 1131 IBYTE_STRING_TO_ALLOCA (mswindows_canonicalize_filename (name), name) |
771 | 1132 |
1133 /* ------------------- Functions needed dynamic binding ------------------- */ | |
1134 | |
1135 typedef BOOL (WINAPI *pfSwitchToThread_t) (VOID); | |
1136 | |
1137 typedef NET_API_STATUS (NET_API_FUNCTION *pfNetUserEnum_t) | |
1138 (LPCWSTR, DWORD, DWORD, LPBYTE *, DWORD, LPDWORD, LPDWORD, LPDWORD); | |
1139 typedef NET_API_STATUS (NET_API_FUNCTION *pfNetApiBufferFree_t) (LPVOID); | |
1140 | |
1141 extern pfSwitchToThread_t xSwitchToThread; | |
1142 | |
1143 extern pfNetUserEnum_t xNetUserEnum; | |
1144 extern pfNetApiBufferFree_t xNetApiBufferFree; | |
1145 | |
1146 /* --------- Useful routines for manipulating memory-mapped files -------- */ | |
1147 | |
1148 typedef struct file_data | |
1149 { | |
867 | 1150 const Ibyte *name; |
771 | 1151 unsigned long size; |
1152 HANDLE file; | |
1153 HANDLE file_mapping; | |
1154 void *file_base; | |
1155 } file_data; | |
1156 | |
1157 #define OFFSET_TO_RVA(var,section) \ | |
1158 (section->VirtualAddress + \ | |
1159 ((DWORD)(var) - section->PointerToRawData)) | |
1160 | |
1161 #define RVA_TO_OFFSET(var,section) \ | |
1162 (section->PointerToRawData + \ | |
1163 ((DWORD)(var) - section->VirtualAddress)) | |
442 | 1164 |
771 | 1165 #define RVA_TO_PTR(var,section,filedata) \ |
1166 ((void *)(RVA_TO_OFFSET(var,section) + \ | |
1167 (char *)(filedata).file_base)) | |
1168 | |
867 | 1169 int open_input_file (file_data *p_file, const Ibyte *name); |
1170 int open_output_file (file_data *p_file, const Ibyte *name, | |
771 | 1171 unsigned long size); |
1172 void close_file_data (file_data *p_file); | |
1173 | |
1174 /* ------------------------- Heap related stuff ------------------------- */ | |
1175 | |
1176 #ifdef WIN32_NATIVE | |
442 | 1177 |
771 | 1178 #define get_reserved_heap_size() reserved_heap_size |
1179 #define get_committed_heap_size() (get_data_end () - get_data_start ()) | |
1180 #define get_heap_start() get_data_start () | |
1181 #define get_heap_end() get_data_end () | |
1182 #define get_page_size() sysinfo_cache.dwPageSize | |
1183 #define get_allocation_unit() sysinfo_cache.dwAllocationGranularity | |
1184 #define get_processor_type() sysinfo_cache.dwProcessorType | |
1185 #define get_nt_major_version() nt_major_version | |
1186 #define get_nt_minor_version() nt_minor_version | |
1187 | |
814 | 1188 unsigned char *get_data_start (void); |
1189 unsigned char *get_data_end (void); | |
771 | 1190 extern unsigned long data_region_size; |
1191 extern unsigned long reserved_heap_size; | |
1192 extern SYSTEM_INFO sysinfo_cache; | |
1193 extern int nt_major_version; | |
1194 extern int nt_minor_version; | |
1195 | |
1196 /* To prevent zero-initialized variables from being placed into the bss | |
1197 section, use non-zero values to represent an uninitialized state. */ | |
1198 #define UNINIT_PTR ((unsigned char*) 0xF0A0F0A0) | |
1199 #define UNINIT_LONG (0xF0A0F0A0L) | |
1200 | |
1201 /* Recreate the heap created during dumping. */ | |
814 | 1202 void recreate_heap (Extbyte *executable_path); |
771 | 1203 |
1204 /* Round the heap to this size. */ | |
814 | 1205 void round_heap (unsigned long size); |
771 | 1206 |
1207 /* Load in the dumped .bss section. */ | |
814 | 1208 void read_in_bss (Extbyte *name); |
771 | 1209 |
1210 /* Map in the dumped heap. */ | |
814 | 1211 void map_in_heap (Extbyte *name); |
771 | 1212 |
1213 /* Cache system info, e.g., the NT page size. */ | |
814 | 1214 void cache_system_info (void); |
771 | 1215 |
1216 /* Round ADDRESS up to be aligned with ALIGN. */ | |
814 | 1217 unsigned char *round_to_next (unsigned char *address, |
1218 unsigned long align); | |
771 | 1219 #endif /* WIN32_NATIVE */ |
1220 | |
1221 /* ------------------------- Misc prototypes ------------------------- */ | |
1222 | |
1223 #ifdef WIN32_NATIVE | |
1224 DECLARE_INLINE_HEADER (int strcasecmp (const char *a, const char *b)) | |
1225 { | |
867 | 1226 return qxestrcasecmp ((const Ibyte *) a, (const Ibyte *) b); |
771 | 1227 } |
1228 #endif /* WIN32_NATIVE */ | |
442 | 1229 |
771 | 1230 /* in nt.c */ |
867 | 1231 int mswindows_access (const Ibyte *path, int mode); |
3025 | 1232 int mswindows_link (const Ibyte *old, const Ibyte *new_); |
867 | 1233 int mswindows_rename (const Ibyte *oldname, const Ibyte *newname); |
1234 int mswindows_unlink (const Ibyte *path); | |
1235 int mswindows_stat (const Ibyte *path, struct stat *buf); | |
771 | 1236 int mswindows_fstat (int desc, struct stat *buf); |
1237 time_t mswindows_convert_time (FILETIME ft); | |
1204 | 1238 int mswindows_is_executable (const Ibyte *filename); |
1239 void mswindows_executable_type (const Ibyte *filename, int *is_dos_app, | |
1240 int *is_cygnus_app); | |
867 | 1241 Ibyte *mswindows_getdcwd (int drivelet); |
771 | 1242 |
872 | 1243 /* in process-nt.c */ |
771 | 1244 extern int mswindows_compare_env (const void *strp1, const void *strp2); |
1245 | |
1246 /* in win32.c */ | |
814 | 1247 Extbyte *mswindows_get_module_file_name (void); |
4932 | 1248 void mswindows_output_last_error (const Ascbyte *frob); |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4932
diff
changeset
|
1249 DECLARE_DOESNT_RETURN (mswindows_report_process_error (const Ascbyte *reason, |
771 | 1250 Lisp_Object data, |
1251 int errnum)); | |
1252 Lisp_Object mswindows_lisp_error (int errnum); | |
2526 | 1253 Ibyte *mswindows_read_link (const Ibyte *fname); |
771 | 1254 |
872 | 1255 /* in intl-win32.c */ |
1256 extern Lisp_Object Qmswindows_tstr, Qmswindows_unicode; | |
1257 extern Lisp_Object Qmswindows_multibyte, Qmswindows_multibyte_to_unicode; | |
1258 | |
442 | 1259 #endif /* INCLUDED_syswindows_h_ */ |