Mercurial > emacs
comparison src/mac.c @ 72542:bb89b5bbed54
(create_apple_event_from_event_ref, select)
(Fmac_get_file_creator, Fmac_get_file_type, Fmac_set_file_creator)
(Fmac_set_file_type, cfstring_create_normalized)
(mac_get_system_locale, select_and_poll_event, sys_select): Use
OSStatus instead of OSErr.
author | YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> |
---|---|
date | Sun, 27 Aug 2006 07:09:23 +0000 |
parents | a322faa9b90c |
children | 49fb9398679c 6823a91487f2 |
comparison
equal
deleted
inserted
replaced
72541:607718436ce2 | 72542:bb89b5bbed54 |
---|---|
829 } | 829 } |
830 | 830 |
831 return err; | 831 return err; |
832 } | 832 } |
833 | 833 |
834 OSErr | 834 OSStatus |
835 create_apple_event_from_event_ref (event, num_params, names, types, result) | 835 create_apple_event_from_event_ref (event, num_params, names, types, result) |
836 EventRef event; | 836 EventRef event; |
837 UInt32 num_params; | 837 UInt32 num_params; |
838 EventParamName *names; | 838 EventParamName *names; |
839 EventParamType *types; | 839 EventParamType *types; |
840 AppleEvent *result; | 840 AppleEvent *result; |
841 { | 841 { |
842 OSErr err; | 842 OSStatus err; |
843 UInt32 i, size; | 843 UInt32 i, size; |
844 CFStringRef string; | 844 CFStringRef string; |
845 CFDataRef data; | 845 CFDataRef data; |
846 char *buf = NULL; | 846 char *buf = NULL; |
847 | 847 |
2422 SELECT_TYPE *rfds; | 2422 SELECT_TYPE *rfds; |
2423 SELECT_TYPE *wfds; | 2423 SELECT_TYPE *wfds; |
2424 SELECT_TYPE *efds; | 2424 SELECT_TYPE *efds; |
2425 struct timeval *timeout; | 2425 struct timeval *timeout; |
2426 { | 2426 { |
2427 OSErr err; | 2427 OSStatus err; |
2428 #if TARGET_API_MAC_CARBON | 2428 #if TARGET_API_MAC_CARBON |
2429 EventTimeout timeout_sec = | 2429 EventTimeout timeout_sec = |
2430 (timeout | 2430 (timeout |
2431 ? (EMACS_SECS (*timeout) * kEventDurationSecond | 2431 ? (EMACS_SECS (*timeout) * kEventDurationSecond |
2432 + EMACS_USECS (*timeout) * kEventDurationMicrosecond) | 2432 + EMACS_USECS (*timeout) * kEventDurationMicrosecond) |
4190 DEFUN ("mac-get-file-creator", Fmac_get_file_creator, Smac_get_file_creator, 1, 1, 0, | 4190 DEFUN ("mac-get-file-creator", Fmac_get_file_creator, Smac_get_file_creator, 1, 1, 0, |
4191 doc: /* Get the creator code of FILENAME as a four character string. */) | 4191 doc: /* Get the creator code of FILENAME as a four character string. */) |
4192 (filename) | 4192 (filename) |
4193 Lisp_Object filename; | 4193 Lisp_Object filename; |
4194 { | 4194 { |
4195 OSErr status; | 4195 OSStatus status; |
4196 #ifdef MAC_OSX | 4196 #ifdef MAC_OSX |
4197 FSRef fref; | 4197 FSRef fref; |
4198 #else | 4198 #else |
4199 FSSpec fss; | 4199 FSSpec fss; |
4200 #endif | 4200 #endif |
4244 DEFUN ("mac-get-file-type", Fmac_get_file_type, Smac_get_file_type, 1, 1, 0, | 4244 DEFUN ("mac-get-file-type", Fmac_get_file_type, Smac_get_file_type, 1, 1, 0, |
4245 doc: /* Get the type code of FILENAME as a four character string. */) | 4245 doc: /* Get the type code of FILENAME as a four character string. */) |
4246 (filename) | 4246 (filename) |
4247 Lisp_Object filename; | 4247 Lisp_Object filename; |
4248 { | 4248 { |
4249 OSErr status; | 4249 OSStatus status; |
4250 #ifdef MAC_OSX | 4250 #ifdef MAC_OSX |
4251 FSRef fref; | 4251 FSRef fref; |
4252 #else | 4252 #else |
4253 FSSpec fss; | 4253 FSSpec fss; |
4254 #endif | 4254 #endif |
4300 If non-nil, CODE must be a 4-character string. Otherwise, 'EMAx' is | 4300 If non-nil, CODE must be a 4-character string. Otherwise, 'EMAx' is |
4301 assumed. Return non-nil if successful. */) | 4301 assumed. Return non-nil if successful. */) |
4302 (filename, code) | 4302 (filename, code) |
4303 Lisp_Object filename, code; | 4303 Lisp_Object filename, code; |
4304 { | 4304 { |
4305 OSErr status; | 4305 OSStatus status; |
4306 #ifdef MAC_OSX | 4306 #ifdef MAC_OSX |
4307 FSRef fref; | 4307 FSRef fref; |
4308 #else | 4308 #else |
4309 FSSpec fss; | 4309 FSSpec fss; |
4310 #endif | 4310 #endif |
4360 doc: /* Set file code of file FILENAME to CODE. | 4360 doc: /* Set file code of file FILENAME to CODE. |
4361 CODE must be a 4-character string. Return non-nil if successful. */) | 4361 CODE must be a 4-character string. Return non-nil if successful. */) |
4362 (filename, code) | 4362 (filename, code) |
4363 Lisp_Object filename, code; | 4363 Lisp_Object filename, code; |
4364 { | 4364 { |
4365 OSErr status; | 4365 OSStatus status; |
4366 #ifdef MAC_OSX | 4366 #ifdef MAC_OSX |
4367 FSRef fref; | 4367 FSRef fref; |
4368 #else | 4368 #else |
4369 FSSpec fss; | 4369 FSSpec fss; |
4370 #endif | 4370 #endif |
4773 { | 4773 { |
4774 UnicodeToTextInfo uni = NULL; | 4774 UnicodeToTextInfo uni = NULL; |
4775 UnicodeMapping map; | 4775 UnicodeMapping map; |
4776 CFIndex length; | 4776 CFIndex length; |
4777 UniChar *in_text, *buffer = NULL, *out_buf = NULL; | 4777 UniChar *in_text, *buffer = NULL, *out_buf = NULL; |
4778 OSErr err = noErr; | 4778 OSStatus err = noErr; |
4779 ByteCount out_read, out_size, out_len; | 4779 ByteCount out_read, out_size, out_len; |
4780 | 4780 |
4781 map.unicodeEncoding = CreateTextEncoding (kTextEncodingUnicodeDefault, | 4781 map.unicodeEncoding = CreateTextEncoding (kTextEncodingUnicodeDefault, |
4782 kUnicodeNoSubset, | 4782 kUnicodeNoSubset, |
4783 kTextEncodingDefaultFormat); | 4783 kTextEncodingDefaultFormat); |
4908 | 4908 |
4909 | 4909 |
4910 static Lisp_Object | 4910 static Lisp_Object |
4911 mac_get_system_locale () | 4911 mac_get_system_locale () |
4912 { | 4912 { |
4913 OSErr err; | 4913 OSStatus err; |
4914 LangCode lang; | 4914 LangCode lang; |
4915 RegionCode region; | 4915 RegionCode region; |
4916 LocaleRef locale; | 4916 LocaleRef locale; |
4917 Str255 str; | 4917 Str255 str; |
4918 | 4918 |
4985 SELECT_TYPE *wfds; | 4985 SELECT_TYPE *wfds; |
4986 SELECT_TYPE *efds; | 4986 SELECT_TYPE *efds; |
4987 struct timeval *timeout; | 4987 struct timeval *timeout; |
4988 { | 4988 { |
4989 int r; | 4989 int r; |
4990 OSErr err; | 4990 OSStatus err; |
4991 | 4991 |
4992 r = select (n, rfds, wfds, efds, timeout); | 4992 r = select (n, rfds, wfds, efds, timeout); |
4993 if (r != -1) | 4993 if (r != -1) |
4994 { | 4994 { |
4995 BLOCK_INPUT; | 4995 BLOCK_INPUT; |
5015 SELECT_TYPE *rfds; | 5015 SELECT_TYPE *rfds; |
5016 SELECT_TYPE *wfds; | 5016 SELECT_TYPE *wfds; |
5017 SELECT_TYPE *efds; | 5017 SELECT_TYPE *efds; |
5018 struct timeval *timeout; | 5018 struct timeval *timeout; |
5019 { | 5019 { |
5020 OSErr err; | 5020 OSStatus err; |
5021 int i, r; | 5021 int i, r; |
5022 EMACS_TIME select_timeout; | 5022 EMACS_TIME select_timeout; |
5023 | 5023 |
5024 if (inhibit_window_system || noninteractive | 5024 if (inhibit_window_system || noninteractive |
5025 || rfds == NULL || !FD_ISSET (0, rfds)) | 5025 || rfds == NULL || !FD_ISSET (0, rfds)) |