comparison src/syswindows.h @ 2526:902d5bd9b75c

[xemacs-hg @ 2005-01-28 02:36:11 by ben] Support symlinks under Windows nt.c, fileio.c: Fix sync comments. config.h.in, dired-msw.c, emacs.c, event-msw.c, fileio.c, glyphs.c, lisp.h, nt.c, process-nt.c, realpath.c, sound.c, symsinit.h, sysdep.c, sysfile.h, syswindows.h, win32.c: Add support for treating shortcuts under Windows as symbolic links. Enabled with mswindows-shortcuts-are-links (t by default). Rewrite lots of places to use PATHNAME_CONVERT_OUT, which is moved to sysfile.h. Add PATHNAME_RESOLVE_LINKS, which only does things under Windows. Add profiling section for expand_file_name calls. nt.c, sysdep.c: Unicode-ize. realpath.c: Renamed from readlink_and_correct_case. Fix some problems with Windows implementation due to incorrect understanding of workings of the function. sound.c, ntplay.c, sound.h: Rename play_sound_file to nt_play_sound_file and pass internally-formatted data to it to avoid converting out and back again. text.h: is_c -> is_ascii.
author ben
date Fri, 28 Jan 2005 02:36:28 +0000
parents 3d8143fc88e1
children facf3239ba30
comparison
equal deleted inserted replaced
2525:52f00344a629 2526:902d5bd9b75c
937 937
938 #endif 938 #endif
939 939
940 #define LOCAL_FILE_FORMAT_TO_TSTR(path, out) \ 940 #define LOCAL_FILE_FORMAT_TO_TSTR(path, out) \
941 do { \ 941 do { \
942 Ibyte *lttff; \ 942 Ibyte *lttff; \
943 \ 943 \
944 LOCAL_TO_WIN32_FILE_FORMAT (XSTRING_DATA (path), lttff); \ 944 LOCAL_TO_WIN32_FILE_FORMAT (XSTRING_DATA (path), lttff); \
945 C_STRING_TO_TSTR (lttff, out); \ 945 PATHNAME_CONVERT_OUT (lttff, out); \
946 } while (0) 946 } while (0)
947 947
948 Lisp_Object tstr_to_local_file_format (Extbyte *pathout); 948 Lisp_Object tstr_to_local_file_format (Extbyte *pathout);
949 949
950 /* Convert from local file format, as used in XEmacs, to valid win32 950 /* Convert from local file format, as used in XEmacs, to valid win32
1004 /* Convert a local-format file name or URL in internal format into a Win32 1004 /* Convert a local-format file name or URL in internal format into a Win32
1005 file name or URL in tstr format. */ 1005 file name or URL in tstr format. */
1006 1006
1007 #ifdef CYGWIN 1007 #ifdef CYGWIN
1008 1008
1009 #define LOCAL_FILE_FORMAT_MAYBE_URL_TO_TSTR(lispstr, pathout) \ 1009 #define LOCAL_FILE_FORMAT_MAYBE_URL_TO_TSTR(lispstr, pathout) \
1010 do \ 1010 do \
1011 { \ 1011 { \
1012 Ibyte *lffmutt_fname1; \ 1012 Ibyte *lffmutt_fname1; \
1013 Ibyte *lffmutt_pathint = XSTRING_DATA (lispstr); \ 1013 Ibyte *lffmutt_pathint = XSTRING_DATA (lispstr); \
1014 \ 1014 \
1015 if ((lffmutt_fname1 = qxestrchr (lffmutt_pathint, ':')) != NULL \ 1015 if ((lffmutt_fname1 = qxestrchr (lffmutt_pathint, ':')) != NULL \
1016 && *++lffmutt_fname1 == '/' && *++lffmutt_fname1 == '/') \ 1016 && *++lffmutt_fname1 == '/' && *++lffmutt_fname1 == '/') \
1017 { \ 1017 { \
1018 /* If URL style file, the innards may have Cygwin mount points and \ 1018 /* If URL style file, the innards may have Cygwin mount points and \
1019 the like. so separate out the innards, process them, and put back \ 1019 the like. so separate out the innards, process them, and put back \
1020 together. */ \ 1020 together. */ \
1021 if (qxestrncasecmp_ascii (lffmutt_pathint, "file://", 7) == 0) \ 1021 if (qxestrncasecmp_ascii (lffmutt_pathint, "file://", 7) == 0) \
1022 { \ 1022 { \
1023 Ibyte *lffmutt_path1, *lffmutt_path2; \ 1023 Ibyte *lffmutt_path1, *lffmutt_path2; \
1024 LOCAL_TO_WIN32_FILE_FORMAT (lffmutt_pathint + 7, lffmutt_path1); \ 1024 LOCAL_TO_WIN32_FILE_FORMAT (lffmutt_pathint + 7, lffmutt_path1); \
1025 if (lffmutt_path1 == lffmutt_pathint + 7) /* Optimization */ \ 1025 if (lffmutt_path1 == lffmutt_pathint + 7) /* Optimization */ \
1026 lffmutt_path2 = lffmutt_pathint; \ 1026 lffmutt_path2 = lffmutt_pathint; \
1027 else \ 1027 else \
1028 { \ 1028 { \
1029 lffmutt_path2 = alloca_ibytes (7 + qxestrlen (lffmutt_path1) \ 1029 lffmutt_path2 = alloca_ibytes (7 + qxestrlen (lffmutt_path1) \
1030 + 1); \ 1030 + 1); \
1031 qxestrncpy (lffmutt_path2, lffmutt_pathint, 7); \ 1031 qxestrncpy (lffmutt_path2, lffmutt_pathint, 7); \
1032 qxestrcpy (lffmutt_path2 + 7, lffmutt_path1); \ 1032 qxestrcpy (lffmutt_path2 + 7, lffmutt_path1); \
1033 } \ 1033 } \
1034 C_STRING_TO_TSTR (lffmutt_path2, pathout); \ 1034 C_STRING_TO_TSTR (lffmutt_path2, pathout); \
1035 } \ 1035 } \
1036 else \ 1036 else \
1037 /* A straight URL, just convert */ \ 1037 /* A straight URL, just convert */ \
1038 LISP_STRING_TO_TSTR (lispstr, pathout); \ 1038 LISP_STRING_TO_TSTR (lispstr, pathout); \
1039 } \ 1039 } \
1040 else \ 1040 else \
1041 /* Not URL-style, must be a straight filename. */ \ 1041 /* Not URL-style, must be a straight filename. */ \
1042 LOCAL_FILE_FORMAT_TO_TSTR (lispstr, pathout); \ 1042 LOCAL_FILE_FORMAT_TO_TSTR (lispstr, pathout); \
1043 } while (0) 1043 } while (0)
1044 1044
1045 #else /* not CYGWIN */ 1045 #else /* not CYGWIN */
1046 1046
1047 /* URL's (and everything else) are already in the right format */ 1047 /* URL's (and everything else) are already in the right format */
1174 void mswindows_output_last_error (char *frob); 1174 void mswindows_output_last_error (char *frob);
1175 DECLARE_DOESNT_RETURN (mswindows_report_process_error (const char *string, 1175 DECLARE_DOESNT_RETURN (mswindows_report_process_error (const char *string,
1176 Lisp_Object data, 1176 Lisp_Object data,
1177 int errnum)); 1177 int errnum));
1178 Lisp_Object mswindows_lisp_error (int errnum); 1178 Lisp_Object mswindows_lisp_error (int errnum);
1179 Ibyte *mswindows_read_link (const Ibyte *fname);
1179 1180
1180 /* in intl-win32.c */ 1181 /* in intl-win32.c */
1181 extern Lisp_Object Qmswindows_tstr, Qmswindows_unicode; 1182 extern Lisp_Object Qmswindows_tstr, Qmswindows_unicode;
1182 extern Lisp_Object Qmswindows_multibyte, Qmswindows_multibyte_to_unicode; 1183 extern Lisp_Object Qmswindows_multibyte, Qmswindows_multibyte_to_unicode;
1183 1184