diff options
author | YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | 2005-04-14 09:25:01 +0000 |
---|---|---|
committer | YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | 2005-04-14 09:25:01 +0000 |
commit | 42c6741e0a3bede0ed18626ae2e66b4f2a8bb37e (patch) | |
tree | 2623cf5b38b087e2dd812e59323c9c9f4b202b0c /src/mac.c | |
parent | f0b40a1dc2bd963d40c143b8979f516ab446f5bb (diff) | |
download | emacs-42c6741e0a3bede0ed18626ae2e66b4f2a8bb37e.tar.gz |
[!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
diff --git a/src/mac.c b/src/mac.c index da6a61633dc..a11b097264c 100644 --- a/src/mac.c +++ b/src/mac.c @@ -49,6 +49,7 @@ Boston, MA 02111-1307, USA. */ #include <Events.h> #include <Processes.h> #include <EPPC.h> +#include <MacLocales.h> #endif /* not HAVE_CARBON */ #include <utime.h> @@ -67,6 +68,12 @@ Boston, MA 02111-1307, USA. */ Lisp_Object QCLIPBOARD; +/* The system script code. */ +static int mac_system_script_code; + +/* The system locale identifier string. */ +static Lisp_Object Vmac_system_locale; + /* An instance of the AppleScript component. */ static ComponentInstance as_scripting_component; /* The single script context used for all script executions. */ @@ -4167,6 +4174,29 @@ init_mac_osx_environment () } #endif /* MAC_OSX */ + +static Lisp_Object +mac_get_system_locale () +{ + OSErr err; + LangCode lang; + RegionCode region; + LocaleRef locale; + Str255 str; + + lang = GetScriptVariable (smSystemScript, smScriptLang); + region = GetScriptManagerVariable (smRegionCode); + err = LocaleRefFromLangOrRegionCode (lang, region, &locale); + if (err == noErr) + err = LocaleRefGetPartString (locale, kLocaleAllPartsMask, + sizeof (str), str); + if (err == noErr) + return build_string (str); + else + return Qnil; +} + + void syms_of_mac () { @@ -4197,6 +4227,16 @@ syms_of_mac () defsubr (&Sdo_applescript); defsubr (&Smac_file_name_to_posix); defsubr (&Sposix_file_name_to_mac); + + DEFVAR_INT ("mac-system-script-code", &mac_system_script_code, + doc: /* The system script code. */); + mac_system_script_code = (ScriptCode) GetScriptManagerVariable (smSysScript); + + DEFVAR_LISP ("mac-system-locale", &Vmac_system_locale, + doc: /* The system locale identifier string. +This is not a POSIX locale ID, but an ICU locale ID. So encoding +information is not included. */); + Vmac_system_locale = mac_get_system_locale (); } /* arch-tag: 29d30c1f-0c6b-4f88-8a6d-0558d7f9dbff |