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