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