Mercurial > hg > xemacs-beta
comparison src/win32.c @ 673:685b588e92d8
[xemacs-hg @ 2001-10-30 05:13:26 by andyp]
merge of windows 21.4.5 codeline
author | andyp |
---|---|
date | Tue, 30 Oct 2001 05:13:31 +0000 |
parents | fdefd0186b75 |
children | a307f9a2021d |
comparison
equal
deleted
inserted
replaced
672:42a8626b741e | 673:685b588e92d8 |
---|---|
181 (operation, document, parameters, show_flag)) | 181 (operation, document, parameters, show_flag)) |
182 { | 182 { |
183 /* Encode filename and current directory. */ | 183 /* Encode filename and current directory. */ |
184 Lisp_Object current_dir = Ffile_name_directory (document); | 184 Lisp_Object current_dir = Ffile_name_directory (document); |
185 char* path = NULL; | 185 char* path = NULL; |
186 #ifdef CYGWIN | |
187 char* fname1, *fname2; | |
188 int pos, sz; | |
189 #endif | |
186 char* doc = NULL; | 190 char* doc = NULL; |
187 Extbyte* f=0; | |
188 int ret; | 191 int ret; |
189 struct gcpro gcpro1, gcpro2; | 192 struct gcpro gcpro1, gcpro2; |
190 | 193 |
191 CHECK_STRING (document); | 194 CHECK_STRING (document); |
192 | 195 |
196 GCPRO2 (current_dir, document); | 199 GCPRO2 (current_dir, document); |
197 | 200 |
198 /* Use mule and cygwin-safe APIs top get at file data. */ | 201 /* Use mule and cygwin-safe APIs top get at file data. */ |
199 if (STRINGP (current_dir)) | 202 if (STRINGP (current_dir)) |
200 { | 203 { |
201 TO_EXTERNAL_FORMAT (LISP_STRING, current_dir, | 204 LOCAL_TO_WIN32_FILE_FORMAT (current_dir, path); |
202 C_STRING_ALLOCA, f, | 205 } |
203 Qfile_name); | 206 |
207 if (STRINGP (document)) | |
208 { | |
209 doc = XSTRING_DATA (document); | |
204 #ifdef CYGWIN | 210 #ifdef CYGWIN |
205 CYGWIN_WIN32_PATH (f, path); | 211 if ((fname1 = strchr (doc, ':')) != NULL |
206 #else | 212 && *++fname1 == '/' && *++fname1 == '/') |
207 path = f; | 213 { |
208 #endif | 214 fname1++; |
209 } | 215 pos = fname1 - doc; |
210 | 216 if (!(isalpha (fname1[0]) && (IS_DEVICE_SEP (fname1[1])))) |
211 if (STRINGP (document)) | 217 { |
212 { | 218 sz = cygwin_posix_to_win32_path_list_buf_size (fname1); |
213 TO_EXTERNAL_FORMAT (LISP_STRING, document, | 219 fname2 = alloca (sz + pos); |
214 C_STRING_ALLOCA, f, | 220 strncpy (fname2, doc, pos); |
215 Qfile_name); | 221 doc = fname2; |
216 #ifdef CYGWIN | 222 fname2 += pos; |
217 CYGWIN_WIN32_PATH (f, doc); | 223 cygwin_posix_to_win32_path_list (fname1, fname2); |
218 #else | 224 } |
219 doc = f; | 225 } |
226 else { | |
227 LOCAL_TO_WIN32_FILE_FORMAT (document, doc); | |
228 } | |
220 #endif | 229 #endif |
221 } | 230 } |
222 | 231 |
223 UNGCPRO; | 232 UNGCPRO; |
224 | 233 |
246 else | 255 else |
247 signal_error (Qinternal_error, "internal error", Qunbound); | 256 signal_error (Qinternal_error, "internal error", Qunbound); |
248 | 257 |
249 return Qnil; | 258 return Qnil; |
250 } | 259 } |
260 | |
261 #ifdef CYGWIN | |
262 DEFUN ("mswindows-cygwin-to-win32-path", Fmswindows_cygwin_to_win32_path, 1, 1, 0, /* | |
263 Get the cygwin environment to convert the Unix PATH to win32 format. | |
264 No expansion is performed, all conversion is done by the cygwin runtime. | |
265 */ | |
266 (path)) | |
267 { | |
268 Extbyte* f; | |
269 Intbyte* p; | |
270 CHECK_STRING (path); | |
271 | |
272 /* There appears to be a bug in the cygwin conversion routines in | |
273 that they are not idempotent. */ | |
274 p = XSTRING_DATA (path); | |
275 if (isalpha (p[0]) && (IS_DEVICE_SEP (p[1]))) | |
276 return path; | |
277 | |
278 /* Use mule and cygwin-safe APIs top get at file data. */ | |
279 LOCAL_TO_WIN32_FILE_FORMAT (path, f); | |
280 return build_ext_string (f, Qnative); | |
281 } | |
282 #endif | |
251 | 283 |
252 #if defined (WIN32_NATIVE) || defined (CYGWIN_BROKEN_SIGNALS) | 284 #if defined (WIN32_NATIVE) || defined (CYGWIN_BROKEN_SIGNALS) |
253 | 285 |
254 /* setitimer() does not exist on native MS Windows, and appears broken | 286 /* setitimer() does not exist on native MS Windows, and appears broken |
255 on Cygwin (random lockups when BROKEN_SIGIO is defined), so we | 287 on Cygwin (random lockups when BROKEN_SIGIO is defined), so we |
500 | 532 |
501 void | 533 void |
502 syms_of_win32 (void) | 534 syms_of_win32 (void) |
503 { | 535 { |
504 DEFSUBR (Fmswindows_shell_execute); | 536 DEFSUBR (Fmswindows_shell_execute); |
537 #ifdef CYGWIN | |
538 DEFSUBR (Fmswindows_cygwin_to_win32_path); | |
539 #endif | |
505 } | 540 } |
506 | 541 |
507 void | 542 void |
508 init_win32 (void) | 543 init_win32 (void) |
509 { | 544 { |