aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYAMAMOTO Mitsuharu2005-07-23 07:47:51 +0000
committerYAMAMOTO Mitsuharu2005-07-23 07:47:51 +0000
commitfc3216cb119b3f67cae6a9089666ba775a983c65 (patch)
tree0fd33cff5c3ebbcfefaf8da5c0b4eaf0055ba09e /src
parent6696f2a495b6cc41cf0e5f098ca23ed9d0a6ab6b (diff)
downloademacs-fc3216cb119b3f67cae6a9089666ba775a983c65.tar.gz
emacs-fc3216cb119b3f67cae6a9089666ba775a983c65.zip
Don't include stdlib.h or string.h.
(Fdo_applescript, Fmac_file_name_to_posix) (Fmac_file_name_to_posix): Doc fixes. [TARGET_API_MAC_CARBON] (Fmac_get_preference) (Fmac_code_convert_string): Likewise. [MAC_OSX] (init_mac_osx_environment): Fall back on terminal mode if the executable is not contained in a bundle.
Diffstat (limited to 'src')
-rw-r--r--src/mac.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/src/mac.c b/src/mac.c
index 11dd93aa88d..5558cbb797e 100644
--- a/src/mac.c
+++ b/src/mac.c
@@ -59,11 +59,9 @@ Boston, MA 02110-1301, USA. */
59#include <dirent.h> 59#include <dirent.h>
60#include <sys/types.h> 60#include <sys/types.h>
61#include <sys/stat.h> 61#include <sys/stat.h>
62#include <string.h>
63#include <pwd.h> 62#include <pwd.h>
64#include <grp.h> 63#include <grp.h>
65#include <sys/param.h> 64#include <sys/param.h>
66#include <stdlib.h>
67#include <fcntl.h> 65#include <fcntl.h>
68#if __MWERKS__ 66#if __MWERKS__
69#include <unistd.h> 67#include <unistd.h>
@@ -3447,7 +3445,7 @@ mac_get_object_from_code(OSType defCode)
3447 3445
3448DEFUN ("mac-get-file-creator", Fmac_get_file_creator, Smac_get_file_creator, 1, 1, 0, 3446DEFUN ("mac-get-file-creator", Fmac_get_file_creator, Smac_get_file_creator, 1, 1, 0,
3449 doc: /* Get the creator code of FILENAME as a four character string. */) 3447 doc: /* Get the creator code of FILENAME as a four character string. */)
3450 (filename) 3448 (filename)
3451 Lisp_Object filename; 3449 Lisp_Object filename;
3452{ 3450{
3453 OSErr status; 3451 OSErr status;
@@ -3502,7 +3500,7 @@ DEFUN ("mac-get-file-creator", Fmac_get_file_creator, Smac_get_file_creator, 1,
3502 3500
3503DEFUN ("mac-get-file-type", Fmac_get_file_type, Smac_get_file_type, 1, 1, 0, 3501DEFUN ("mac-get-file-type", Fmac_get_file_type, Smac_get_file_type, 1, 1, 0,
3504 doc: /* Get the type code of FILENAME as a four character string. */) 3502 doc: /* Get the type code of FILENAME as a four character string. */)
3505 (filename) 3503 (filename)
3506 Lisp_Object filename; 3504 Lisp_Object filename;
3507{ 3505{
3508 OSErr status; 3506 OSErr status;
@@ -3559,7 +3557,7 @@ DEFUN ("mac-set-file-creator", Fmac_set_file_creator, Smac_set_file_creator, 1,
3559 doc: /* Set creator code of file FILENAME to CODE. 3557 doc: /* Set creator code of file FILENAME to CODE.
3560If non-nil, CODE must be a 4-character string. Otherwise, 'EMAx' is 3558If non-nil, CODE must be a 4-character string. Otherwise, 'EMAx' is
3561assumed. Return non-nil if successful. */) 3559assumed. Return non-nil if successful. */)
3562 (filename, code) 3560 (filename, code)
3563 Lisp_Object filename, code; 3561 Lisp_Object filename, code;
3564{ 3562{
3565 OSErr status; 3563 OSErr status;
@@ -3619,7 +3617,7 @@ assumed. Return non-nil if successful. */)
3619DEFUN ("mac-set-file-type", Fmac_set_file_type, Smac_set_file_type, 2, 2, 0, 3617DEFUN ("mac-set-file-type", Fmac_set_file_type, Smac_set_file_type, 2, 2, 0,
3620 doc: /* Set file code of file FILENAME to CODE. 3618 doc: /* Set file code of file FILENAME to CODE.
3621CODE must be a 4-character string. Return non-nil if successful. */) 3619CODE must be a 4-character string. Return non-nil if successful. */)
3622 (filename, code) 3620 (filename, code)
3623 Lisp_Object filename, code; 3621 Lisp_Object filename, code;
3624{ 3622{
3625 OSErr status; 3623 OSErr status;
@@ -3766,12 +3764,12 @@ do_applescript (char *script, char **result)
3766 3764
3767 3765
3768DEFUN ("do-applescript", Fdo_applescript, Sdo_applescript, 1, 1, 0, 3766DEFUN ("do-applescript", Fdo_applescript, Sdo_applescript, 1, 1, 0,
3769 doc: /* Compile and execute AppleScript SCRIPT and retrieve and return the result. 3767 doc: /* Compile and execute AppleScript SCRIPT and return the result.
3770If compilation and execution are successful, the resulting script 3768If compilation and execution are successful, the resulting script
3771value is returned as a string. Otherwise the function aborts and 3769value is returned as a string. Otherwise the function aborts and
3772displays the error message returned by the AppleScript scripting 3770displays the error message returned by the AppleScript scripting
3773component. */) 3771component. */)
3774 (script) 3772 (script)
3775 Lisp_Object script; 3773 Lisp_Object script;
3776{ 3774{
3777 char *result, *temp; 3775 char *result, *temp;
@@ -3811,16 +3809,15 @@ component. */)
3811 3809
3812DEFUN ("mac-file-name-to-posix", Fmac_file_name_to_posix, 3810DEFUN ("mac-file-name-to-posix", Fmac_file_name_to_posix,
3813 Smac_file_name_to_posix, 1, 1, 0, 3811 Smac_file_name_to_posix, 1, 1, 0,
3814 doc: /* Convert Macintosh filename to Posix form. */) 3812 doc: /* Convert Macintosh FILENAME to Posix form. */)
3815 (mac_filename) 3813 (filename)
3816 Lisp_Object mac_filename; 3814 Lisp_Object filename;
3817{ 3815{
3818 char posix_filename[MAXPATHLEN+1]; 3816 char posix_filename[MAXPATHLEN+1];
3819 3817
3820 CHECK_STRING (mac_filename); 3818 CHECK_STRING (filename);
3821 3819
3822 if (mac_to_posix_pathname (SDATA (mac_filename), posix_filename, 3820 if (mac_to_posix_pathname (SDATA (filename), posix_filename, MAXPATHLEN))
3823 MAXPATHLEN))
3824 return build_string (posix_filename); 3821 return build_string (posix_filename);
3825 else 3822 else
3826 return Qnil; 3823 return Qnil;
@@ -3829,16 +3826,15 @@ DEFUN ("mac-file-name-to-posix", Fmac_file_name_to_posix,
3829 3826
3830DEFUN ("posix-file-name-to-mac", Fposix_file_name_to_mac, 3827DEFUN ("posix-file-name-to-mac", Fposix_file_name_to_mac,
3831 Sposix_file_name_to_mac, 1, 1, 0, 3828 Sposix_file_name_to_mac, 1, 1, 0,
3832 doc: /* Convert Posix filename to Mac form. */) 3829 doc: /* Convert Posix FILENAME to Mac form. */)
3833 (posix_filename) 3830 (filename)
3834 Lisp_Object posix_filename; 3831 Lisp_Object filename;
3835{ 3832{
3836 char mac_filename[MAXPATHLEN+1]; 3833 char mac_filename[MAXPATHLEN+1];
3837 3834
3838 CHECK_STRING (posix_filename); 3835 CHECK_STRING (filename);
3839 3836
3840 if (posix_to_mac_pathname (SDATA (posix_filename), mac_filename, 3837 if (posix_to_mac_pathname (SDATA (filename), mac_filename, MAXPATHLEN))
3841 MAXPATHLEN))
3842 return build_string (mac_filename); 3838 return build_string (mac_filename);
3843 else 3839 else
3844 return Qnil; 3840 return Qnil;
@@ -3853,8 +3849,8 @@ DEFUN ("mac-get-preference", Fmac_get_preference, Smac_get_preference, 1, 4, 0,
3853 doc: /* Return the application preference value for KEY. 3849 doc: /* Return the application preference value for KEY.
3854KEY is either a string specifying a preference key, or a list of key 3850KEY is either a string specifying a preference key, or a list of key
3855strings. If it is a list, the (i+1)-th element is used as a key for 3851strings. If it is a list, the (i+1)-th element is used as a key for
3856the CFDictionary value obtained by the i-th element. If lookup is 3852the CFDictionary value obtained by the i-th element. Return nil if
3857failed at some stage, nil is returned. 3853lookup is failed at some stage.
3858 3854
3859Optional arg APPLICATION is an application ID string. If omitted or 3855Optional arg APPLICATION is an application ID string. If omitted or
3860nil, that stands for the current application. 3856nil, that stands for the current application.
@@ -3885,7 +3881,7 @@ CFDictionary. If HASH-BOUND is a negative integer or nil, always
3885generate alists. If HASH-BOUND >= 0, generate an alist if the number 3881generate alists. If HASH-BOUND >= 0, generate an alist if the number
3886of keys in the dictionary is smaller than HASH-BOUND, and a hash table 3882of keys in the dictionary is smaller than HASH-BOUND, and a hash table
3887otherwise. */) 3883otherwise. */)
3888 (key, application, format, hash_bound) 3884 (key, application, format, hash_bound)
3889 Lisp_Object key, application, format, hash_bound; 3885 Lisp_Object key, application, format, hash_bound;
3890{ 3886{
3891 CFStringRef app_id, key_str; 3887 CFStringRef app_id, key_str;
@@ -4122,9 +4118,8 @@ charset string, or an integer as a CFStringEncoding value.
4122On Mac OS X 10.2 and later, you can do Unicode Normalization by 4118On Mac OS X 10.2 and later, you can do Unicode Normalization by
4123specifying the optional argument NORMALIZATION-FORM with a symbol NFD, 4119specifying the optional argument NORMALIZATION-FORM with a symbol NFD,
4124NFKD, NFC, NFKC, HFS+D, or HFS+C. 4120NFKD, NFC, NFKC, HFS+D, or HFS+C.
4125On successful conversion, returns the result string, else returns 4121On successful conversion, return the result string, else return nil. */)
4126nil. */) 4122 (string, source, target, normalization_form)
4127 (string, source, target, normalization_form)
4128 Lisp_Object string, source, target, normalization_form; 4123 Lisp_Object string, source, target, normalization_form;
4129{ 4124{
4130 Lisp_Object result = Qnil; 4125 Lisp_Object result = Qnil;
@@ -4183,7 +4178,7 @@ nil. */)
4183 4178
4184DEFUN ("mac-clear-font-name-table", Fmac_clear_font_name_table, Smac_clear_font_name_table, 0, 0, 0, 4179DEFUN ("mac-clear-font-name-table", Fmac_clear_font_name_table, Smac_clear_font_name_table, 0, 0, 0,
4185 doc: /* Clear the font name table. */) 4180 doc: /* Clear the font name table. */)
4186 () 4181 ()
4187{ 4182{
4188 check_mac (); 4183 check_mac ();
4189 mac_clear_font_name_table (); 4184 mac_clear_font_name_table ();
@@ -4483,8 +4478,13 @@ init_mac_osx_environment ()
4483 app_bundle_pathname. */ 4478 app_bundle_pathname. */
4484 4479
4485 bundle = CFBundleGetMainBundle (); 4480 bundle = CFBundleGetMainBundle ();
4486 if (!bundle) 4481 if (!bundle || CFBundleGetIdentifier (bundle) == NULL)
4487 return; 4482 {
4483 /* We could not find the bundle identifier. For now, prevent
4484 the fatal error by bringing it up in the terminal. */
4485 inhibit_window_system = 1;
4486 return;
4487 }
4488 4488
4489 bundleURL = CFBundleCopyBundleURL (bundle); 4489 bundleURL = CFBundleCopyBundleURL (bundle);
4490 if (!bundleURL) 4490 if (!bundleURL)