comparison src/syswindows.h @ 4990:8f0cf4fd3d2c

Automatic merge
author Ben Wing <ben@xemacs.org>
date Sat, 06 Feb 2010 04:01:46 -0600
parents 4cfb6aeb989d
children cfe36e196dc7
comparison
equal deleted inserted replaced
4989:d2ec55325515 4990:8f0cf4fd3d2c
842 : strrchr (s, ch)) 842 : strrchr (s, ch))
843 #define qxetcsdup(s) \ 843 #define qxetcsdup(s) \
844 (XEUNICODE_P ? (char *) wcsdup ((wchar_t *) s) \ 844 (XEUNICODE_P ? (char *) wcsdup ((wchar_t *) s) \
845 : xstrdup (s)) 845 : xstrdup (s))
846 846
847 #define C_STRING_TO_TSTR(in, out) \ 847 #define ITEXT_TO_TSTR(in) ITEXT_TO_EXTERNAL (in, Qmswindows_tstr)
848 C_STRING_TO_EXTERNAL (in, out, Qmswindows_tstr) 848 #define LISP_STRING_TO_TSTR(in) LISP_STRING_TO_EXTERNAL (in, Qmswindows_tstr)
849 #define LISP_STRING_TO_TSTR(in, out) \ 849 #define TSTR_TO_ITEXT(in) EXTERNAL_TO_ITEXT (in, Qmswindows_tstr)
850 LISP_STRING_TO_EXTERNAL (in, out, Qmswindows_tstr) 850 #define TSTR_TO_ITEXT_MALLOC(in) \
851 #define TSTR_TO_C_STRING(in, out) \ 851 EXTERNAL_TO_ITEXT_MALLOC (in, Qmswindows_tstr)
852 EXTERNAL_TO_C_STRING (in, out, Qmswindows_tstr)
853 #define TSTR_TO_C_STRING_MALLOC(in, out) \
854 EXTERNAL_TO_C_STRING_MALLOC (in, out, Qmswindows_tstr)
855 852
856 #define build_tstr_string(in) \ 853 #define build_tstr_string(in) \
857 make_ext_string (in, qxetcsbytelen ((Extbyte *) in), Qmswindows_tstr) 854 make_extstring (in, qxetcsbytelen ((Extbyte *) in), Qmswindows_tstr)
858 855
859 #define MAX_ANSI_CHAR_LEN 1 856 #define MAX_ANSI_CHAR_LEN 1
860 #define MAX_UNICODE_CHAR_LEN 2 857 #define MAX_UNICODE_CHAR_LEN 2
861 858
862 DECLARE_INLINE_HEADER (int ansi_char_to_text (int ch, Extbyte *t)) 859 DECLARE_INLINE_HEADER (int ansi_char_to_text (int ch, Extbyte *t))
950 947
951 #ifdef HAVE_CYGWIN_CONV_PATH 948 #ifdef HAVE_CYGWIN_CONV_PATH
952 #define LOCAL_FILE_FORMAT_TO_TSTR(path, out) \ 949 #define LOCAL_FILE_FORMAT_TO_TSTR(path, out) \
953 do { \ 950 do { \
954 const Ibyte *lfftt = (path); \ 951 const Ibyte *lfftt = (path); \
952 const Extbyte **lffttout = (const Extbyte **) &(out); \
955 if (isalpha (lfftt[0]) && (IS_DEVICE_SEP (lfftt[1]))) \ 953 if (isalpha (lfftt[0]) && (IS_DEVICE_SEP (lfftt[1]))) \
956 PATHNAME_CONVERT_OUT_TSTR (lfftt, out); \ 954 PATHNAME_CONVERT_OUT_TSTR (lfftt, *lffttout); \
957 else \ 955 else \
958 { \ 956 { \
959 int lfftt_size; \ 957 int lfftt_size; \
960 Extbyte *lfftt_utf8_path; \ 958 Extbyte *lfftt_utf8_path; \
961 Extbyte *lfftt_tstr_path; \ 959 Extbyte *lfftt_tstr_path; \
964 lfftt_size = cygwin_conv_path (CCP_POSIX_TO_WIN_T | CCP_RELATIVE, \ 962 lfftt_size = cygwin_conv_path (CCP_POSIX_TO_WIN_T | CCP_RELATIVE, \
965 lfftt_utf8_path, NULL, 0); \ 963 lfftt_utf8_path, NULL, 0); \
966 lfftt_tstr_path = alloca_extbytes (lfftt_size); \ 964 lfftt_tstr_path = alloca_extbytes (lfftt_size); \
967 cygwin_conv_path (CCP_POSIX_TO_WIN_T | CCP_RELATIVE, \ 965 cygwin_conv_path (CCP_POSIX_TO_WIN_T | CCP_RELATIVE, \
968 lfftt_utf8_path, lfftt_tstr_path, lfftt_size); \ 966 lfftt_utf8_path, lfftt_tstr_path, lfftt_size); \
969 * (const Extbyte **) &(out) = lfftt_tstr_path; \ 967 *lffttout = lfftt_tstr_path; \
970 } \ 968 } \
971 } while (0) 969 } while (0)
972 #define TSTR_TO_LOCAL_FILE_FORMAT(path, out) \ 970 #define TSTR_TO_LOCAL_FILE_FORMAT(path, out) \
973 do { \ 971 do { \
974 const Extbyte *ttlff = (path); \ 972 const Extbyte *ttlff = (path); \
978 ttlff_size = cygwin_conv_path (CCP_WIN_T_TO_POSIX | CCP_RELATIVE, \ 976 ttlff_size = cygwin_conv_path (CCP_WIN_T_TO_POSIX | CCP_RELATIVE, \
979 ttlff, NULL, 0); \ 977 ttlff, NULL, 0); \
980 ttlff_utf8_path = alloca_extbytes (ttlff_size); \ 978 ttlff_utf8_path = alloca_extbytes (ttlff_size); \
981 cygwin_conv_path (CCP_WIN_T_TO_POSIX | CCP_RELATIVE, \ 979 cygwin_conv_path (CCP_WIN_T_TO_POSIX | CCP_RELATIVE, \
982 ttlff, ttlff_utf8_path, ttlff_size); \ 980 ttlff, ttlff_utf8_path, ttlff_size); \
983 EXTERNAL_TO_C_STRING (ttlff_utf8_path, out, Qutf_8); \ 981 (out) = EXTERNAL_TO_ITEXT (ttlff_utf8_path, Qutf_8); \
984 } while (0) 982 } while (0)
985 #else /* not HAVE_CYGWIN_CONV_PATH */ 983 #else /* not HAVE_CYGWIN_CONV_PATH */
986 #define LOCAL_FILE_FORMAT_TO_TSTR(path, out) \ 984 #define LOCAL_FILE_FORMAT_TO_TSTR(path, out) \
987 do { \ 985 do { \
988 const Ibyte *lfftt; \ 986 const Ibyte *lfftt; \
987 const Extbyte **lffttout = (const Extbyte **) &(out); \
989 \ 988 \
990 LOCAL_FILE_FORMAT_TO_INTERNAL_MSWIN (path, lfftt); \ 989 LOCAL_FILE_FORMAT_TO_INTERNAL_MSWIN (path, lfftt); \
991 PATHNAME_CONVERT_OUT_TSTR (lfftt, out); \ 990 PATHNAME_CONVERT_OUT_TSTR (lfftt, *lffttout); \
992 } while (0) 991 } while (0)
993 #define TSTR_TO_LOCAL_FILE_FORMAT(path, out) \ 992 #define TSTR_TO_LOCAL_FILE_FORMAT(path, out) \
994 do { \ 993 do { \
995 const Ibyte *ttlff; \ 994 const Ibyte *ttlff; \
996 \ 995 \
997 TSTR_TO_C_STRING (path, ttlff); \ 996 ttlff = TSTR_TO_ITEXT (path); \
998 INTERNAL_MSWIN_TO_LOCAL_FILE_FORMAT (ttlff, out); \ 997 INTERNAL_MSWIN_TO_LOCAL_FILE_FORMAT (ttlff, out); \
999 } while (0) 998 } while (0)
1000 #endif /* (not) HAVE_CYGWIN_CONV_PATH */ 999 #endif /* (not) HAVE_CYGWIN_CONV_PATH */
1001 1000
1002 #define LISP_LOCAL_FILE_FORMAT_TO_TSTR(path, out) \ 1001 #define LISP_LOCAL_FILE_FORMAT_TO_TSTR(path, out) \
1021 do \ 1020 do \
1022 { \ 1021 { \
1023 const Extbyte *lfftiwp; \ 1022 const Extbyte *lfftiwp; \
1024 \ 1023 \
1025 LOCAL_FILE_FORMAT_TO_TSTR (path, lfftiwp); \ 1024 LOCAL_FILE_FORMAT_TO_TSTR (path, lfftiwp); \
1026 TSTR_TO_C_STRING (lfftiwp, pathout); \ 1025 (pathout) = TSTR_TO_ITEXT (lfftiwp); \
1027 } \ 1026 } \
1028 while (0) 1027 while (0)
1029 #define INTERNAL_MSWIN_TO_LOCAL_FILE_FORMAT(path, pathout) \ 1028 #define INTERNAL_MSWIN_TO_LOCAL_FILE_FORMAT(path, pathout) \
1030 do { \ 1029 do { \
1031 const Extbyte *iwtlffp; \ 1030 const Extbyte *iwtlffp; \
1032 C_STRING_TO_TSTR (path, iwtlffp); \ 1031 iwtlffp = ITEXT_TO_TSTR (path); \
1033 TSTR_TO_LOCAL_FILE_FORMAT (iwtlffp, pathout); \ 1032 TSTR_TO_LOCAL_FILE_FORMAT (iwtlffp, pathout); \
1034 } while (0) 1033 } while (0)
1035 #elif defined (CYGWIN) 1034 #elif defined (CYGWIN)
1036 #define LOCAL_FILE_FORMAT_TO_INTERNAL_MSWIN(path, pathout) \ 1035 #define LOCAL_FILE_FORMAT_TO_INTERNAL_MSWIN(path, pathout) \
1037 do { \ 1036 do { \
1039 internal-format data to a function that (nominally) should work \ 1038 internal-format data to a function that (nominally) should work \
1040 with external-format data. But in point of fact, the Cygwin \ 1039 with external-format data. But in point of fact, the Cygwin \
1041 conversion functions are *NOT* localized, and will fail if they \ 1040 conversion functions are *NOT* localized, and will fail if they \
1042 get 7-bit ISO2022-encoded data. We know that our internal format \ 1041 get 7-bit ISO2022-encoded data. We know that our internal format \
1043 is ASCII-compatible, and so these functions will work fine with \ 1042 is ASCII-compatible, and so these functions will work fine with \
1044 this data. */ \ 1043 this data (maybe ... not when Cygwin uses UTF-8) */ \
1045 const Ibyte *lfftiwp = (path); \ 1044 const Ibyte *lfftiwp = (path); \
1046 if (isalpha (lfftiwp[0]) && (IS_DEVICE_SEP (lfftiwp[1]))) \ 1045 if (isalpha (lfftiwp[0]) && (IS_DEVICE_SEP (lfftiwp[1]))) \
1047 pathout = lfftiwp; \ 1046 (pathout) = lfftiwp; \
1048 else \ 1047 else \
1049 { \ 1048 { \
1050 int lfftiw2 = \ 1049 int lfftiw2 = \
1051 cygwin_posix_to_win32_path_list_buf_size ((char *) lfftiwp); \ 1050 cygwin_posix_to_win32_path_list_buf_size ((char *) lfftiwp); \
1052 pathout = alloca_ibytes (lfftiw2); \ 1051 (pathout) = alloca_ibytes (lfftiw2); \
1053 cygwin_posix_to_win32_path_list ((char *) lfftiwp, (char *) pathout); \ 1052 cygwin_posix_to_win32_path_list ((char *) lfftiwp, (char *) pathout); \
1054 } \ 1053 } \
1055 } while (0) 1054 } while (0)
1056 #define INTERNAL_MSWIN_TO_LOCAL_FILE_FORMAT(path, pathout) \ 1055 #define INTERNAL_MSWIN_TO_LOCAL_FILE_FORMAT(path, pathout) \
1057 do { \ 1056 do { \
1104 lffmutt_path2 = alloca_ibytes (7 + qxestrlen (lffmutt_path1) \ 1103 lffmutt_path2 = alloca_ibytes (7 + qxestrlen (lffmutt_path1) \
1105 + 1); \ 1104 + 1); \
1106 qxestrncpy (lffmutt_path2, lffmutt_pathint, 7); \ 1105 qxestrncpy (lffmutt_path2, lffmutt_pathint, 7); \
1107 qxestrcpy (lffmutt_path2 + 7, lffmutt_path1); \ 1106 qxestrcpy (lffmutt_path2 + 7, lffmutt_path1); \
1108 } \ 1107 } \
1109 C_STRING_TO_TSTR (lffmutt_path2, pathout); \ 1108 (pathout) = ITEXT_TO_TSTR (lffmutt_path2); \
1110 } \ 1109 } \
1111 else \ 1110 else \
1112 /* A straight URL, just convert */ \ 1111 /* A straight URL, just convert */ \
1113 LISP_STRING_TO_TSTR (lispstr, pathout); \ 1112 (pathout) = LISP_STRING_TO_TSTR (lispstr); \
1114 } \ 1113 } \
1115 else \ 1114 else \
1116 /* Not URL-style, must be a straight filename. */ \ 1115 /* Not URL-style, must be a straight filename. */ \
1117 LISP_LOCAL_FILE_FORMAT_TO_TSTR (lispstr, pathout); \ 1116 LISP_LOCAL_FILE_FORMAT_TO_TSTR (lispstr, pathout); \
1118 } while (0) 1117 } while (0)
1244 /* in process-nt.c */ 1243 /* in process-nt.c */
1245 extern int mswindows_compare_env (const void *strp1, const void *strp2); 1244 extern int mswindows_compare_env (const void *strp1, const void *strp2);
1246 1245
1247 /* in win32.c */ 1246 /* in win32.c */
1248 Extbyte *mswindows_get_module_file_name (void); 1247 Extbyte *mswindows_get_module_file_name (void);
1249 void mswindows_output_last_error (char *frob); 1248 void mswindows_output_last_error (const Ascbyte *frob);
1250 DECLARE_DOESNT_RETURN (mswindows_report_process_error (const char *string, 1249 DECLARE_DOESNT_RETURN (mswindows_report_process_error (const Ascbyte *reason,
1251 Lisp_Object data, 1250 Lisp_Object data,
1252 int errnum)); 1251 int errnum));
1253 Lisp_Object mswindows_lisp_error (int errnum); 1252 Lisp_Object mswindows_lisp_error (int errnum);
1254 Ibyte *mswindows_read_link (const Ibyte *fname); 1253 Ibyte *mswindows_read_link (const Ibyte *fname);
1255 1254