diff options
| author | YAMAMOTO Mitsuharu | 2005-04-14 09:25:01 +0000 |
|---|---|---|
| committer | YAMAMOTO Mitsuharu | 2005-04-14 09:25:01 +0000 |
| commit | 42c6741e0a3bede0ed18626ae2e66b4f2a8bb37e (patch) | |
| tree | 2623cf5b38b087e2dd812e59323c9c9f4b202b0c /src/mac.c | |
| parent | f0b40a1dc2bd963d40c143b8979f516ab446f5bb (diff) | |
| download | emacs-42c6741e0a3bede0ed18626ae2e66b4f2a8bb37e.tar.gz emacs-42c6741e0a3bede0ed18626ae2e66b4f2a8bb37e.zip | |
[!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.
Diffstat (limited to 'src/mac.c')
| -rw-r--r-- | src/mac.c | 40 |
1 files changed, 40 insertions, 0 deletions
| @@ -49,6 +49,7 @@ Boston, MA 02111-1307, USA. */ | |||
| 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> |
| @@ -67,6 +68,12 @@ Boston, MA 02111-1307, USA. */ | |||
| 67 | 68 | ||
| 68 | Lisp_Object QCLIPBOARD; | 69 | Lisp_Object QCLIPBOARD; |
| 69 | 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; | ||
| 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. */ |
| @@ -4167,6 +4174,29 @@ init_mac_osx_environment () | |||
| 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 | { |
| @@ -4197,6 +4227,16 @@ syms_of_mac () | |||
| 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 |