Mercurial > emacs
comparison src/mac.c @ 61553:72c95a1c84c6
[!TARGET_API_MAC_CARBON]: Include MacLocales.h. Don't include
TextEncodingConverter.h.
(mac_system_script_code, Vmac_system_locale): New variables.
(syms_of_mac): Defvar them.
(mac_get_system_locale): New function.
author | YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> |
---|---|
date | Thu, 14 Apr 2005 09:25:01 +0000 |
parents | b44917251d3a |
children | 4fdfaa49202b |
comparison
equal
deleted
inserted
replaced
61552:31beabfbf424 | 61553:72c95a1c84c6 |
---|---|
47 #include <AppleScript.h> | 47 #include <AppleScript.h> |
48 #include <Scrap.h> | 48 #include <Scrap.h> |
49 #include <Events.h> | 49 #include <Events.h> |
50 #include <Processes.h> | 50 #include <Processes.h> |
51 #include <EPPC.h> | 51 #include <EPPC.h> |
52 #include <MacLocales.h> | |
52 #endif /* not HAVE_CARBON */ | 53 #endif /* not HAVE_CARBON */ |
53 | 54 |
54 #include <utime.h> | 55 #include <utime.h> |
55 #include <dirent.h> | 56 #include <dirent.h> |
56 #include <sys/types.h> | 57 #include <sys/types.h> |
64 #if __MWERKS__ | 65 #if __MWERKS__ |
65 #include <unistd.h> | 66 #include <unistd.h> |
66 #endif | 67 #endif |
67 | 68 |
68 Lisp_Object QCLIPBOARD; | 69 Lisp_Object QCLIPBOARD; |
70 | |
71 /* The system script code. */ | |
72 static int mac_system_script_code; | |
73 | |
74 /* The system locale identifier string. */ | |
75 static Lisp_Object Vmac_system_locale; | |
69 | 76 |
70 /* An instance of the AppleScript component. */ | 77 /* An instance of the AppleScript component. */ |
71 static ComponentInstance as_scripting_component; | 78 static ComponentInstance as_scripting_component; |
72 /* The single script context used for all script executions. */ | 79 /* The single script context used for all script executions. */ |
73 static OSAID as_script_context; | 80 static OSAID as_script_context; |
4165 setenv ("INFOPATH", p, 1); | 4172 setenv ("INFOPATH", p, 1); |
4166 } | 4173 } |
4167 } | 4174 } |
4168 #endif /* MAC_OSX */ | 4175 #endif /* MAC_OSX */ |
4169 | 4176 |
4177 | |
4178 static Lisp_Object | |
4179 mac_get_system_locale () | |
4180 { | |
4181 OSErr err; | |
4182 LangCode lang; | |
4183 RegionCode region; | |
4184 LocaleRef locale; | |
4185 Str255 str; | |
4186 | |
4187 lang = GetScriptVariable (smSystemScript, smScriptLang); | |
4188 region = GetScriptManagerVariable (smRegionCode); | |
4189 err = LocaleRefFromLangOrRegionCode (lang, region, &locale); | |
4190 if (err == noErr) | |
4191 err = LocaleRefGetPartString (locale, kLocaleAllPartsMask, | |
4192 sizeof (str), str); | |
4193 if (err == noErr) | |
4194 return build_string (str); | |
4195 else | |
4196 return Qnil; | |
4197 } | |
4198 | |
4199 | |
4170 void | 4200 void |
4171 syms_of_mac () | 4201 syms_of_mac () |
4172 { | 4202 { |
4173 QCLIPBOARD = intern ("CLIPBOARD"); | 4203 QCLIPBOARD = intern ("CLIPBOARD"); |
4174 staticpro (&QCLIPBOARD); | 4204 staticpro (&QCLIPBOARD); |
4195 defsubr (&Smac_clear_font_name_table); | 4225 defsubr (&Smac_clear_font_name_table); |
4196 | 4226 |
4197 defsubr (&Sdo_applescript); | 4227 defsubr (&Sdo_applescript); |
4198 defsubr (&Smac_file_name_to_posix); | 4228 defsubr (&Smac_file_name_to_posix); |
4199 defsubr (&Sposix_file_name_to_mac); | 4229 defsubr (&Sposix_file_name_to_mac); |
4230 | |
4231 DEFVAR_INT ("mac-system-script-code", &mac_system_script_code, | |
4232 doc: /* The system script code. */); | |
4233 mac_system_script_code = (ScriptCode) GetScriptManagerVariable (smSysScript); | |
4234 | |
4235 DEFVAR_LISP ("mac-system-locale", &Vmac_system_locale, | |
4236 doc: /* The system locale identifier string. | |
4237 This is not a POSIX locale ID, but an ICU locale ID. So encoding | |
4238 information is not included. */); | |
4239 Vmac_system_locale = mac_get_system_locale (); | |
4200 } | 4240 } |
4201 | 4241 |
4202 /* arch-tag: 29d30c1f-0c6b-4f88-8a6d-0558d7f9dbff | 4242 /* arch-tag: 29d30c1f-0c6b-4f88-8a6d-0558d7f9dbff |
4203 (do not change this comment) */ | 4243 (do not change this comment) */ |