diff options
| author | YAMAMOTO Mitsuharu | 2005-11-09 08:07:59 +0000 |
|---|---|---|
| committer | YAMAMOTO Mitsuharu | 2005-11-09 08:07:59 +0000 |
| commit | 10ae126cfca41014f920dbc02031f00974752b7a (patch) | |
| tree | d711d8cc8eeccedf230dbc5b90bba639480f0f02 /src | |
| parent | 54eaa188d395edadc69744bf58cce7ba92c92af3 (diff) | |
| download | emacs-10ae126cfca41014f920dbc02031f00974752b7a.tar.gz emacs-10ae126cfca41014f920dbc02031f00974752b7a.zip | |
[MAC_OSX] (init_mac_osx_environment): Reinitialize locale
related variables for dumped executable.
Diffstat (limited to 'src')
| -rw-r--r-- | src/mac.c | 54 |
1 files changed, 30 insertions, 24 deletions
| @@ -4119,7 +4119,7 @@ DEFUN ("mac-code-convert-string", Fmac_code_convert_string, Smac_code_convert_st | |||
| 4119 | The conversion is performed using the converter provided by the system. | 4119 | The conversion is performed using the converter provided by the system. |
| 4120 | Each encoding is specified by either a coding system symbol, a mime | 4120 | Each encoding is specified by either a coding system symbol, a mime |
| 4121 | charset string, or an integer as a CFStringEncoding value. Nil for | 4121 | charset string, or an integer as a CFStringEncoding value. Nil for |
| 4122 | encoding means UTF-16 in native byte order, no byte order marker. | 4122 | encoding means UTF-16 in native byte order, no byte order mark. |
| 4123 | On Mac OS X 10.2 and later, you can do Unicode Normalization by | 4123 | On Mac OS X 10.2 and later, you can do Unicode Normalization by |
| 4124 | specifying the optional argument NORMALIZATION-FORM with a symbol NFD, | 4124 | specifying the optional argument NORMALIZATION-FORM with a symbol NFD, |
| 4125 | NFKD, NFC, NFKC, HFS+D, or HFS+C. | 4125 | NFKD, NFC, NFKC, HFS+D, or HFS+C. |
| @@ -4192,6 +4192,29 @@ DEFUN ("mac-clear-font-name-table", Fmac_clear_font_name_table, Smac_clear_font_ | |||
| 4192 | return Qnil; | 4192 | return Qnil; |
| 4193 | } | 4193 | } |
| 4194 | 4194 | ||
| 4195 | |||
| 4196 | static Lisp_Object | ||
| 4197 | mac_get_system_locale () | ||
| 4198 | { | ||
| 4199 | OSErr err; | ||
| 4200 | LangCode lang; | ||
| 4201 | RegionCode region; | ||
| 4202 | LocaleRef locale; | ||
| 4203 | Str255 str; | ||
| 4204 | |||
| 4205 | lang = GetScriptVariable (smSystemScript, smScriptLang); | ||
| 4206 | region = GetScriptManagerVariable (smRegionCode); | ||
| 4207 | err = LocaleRefFromLangOrRegionCode (lang, region, &locale); | ||
| 4208 | if (err == noErr) | ||
| 4209 | err = LocaleRefGetPartString (locale, kLocaleAllPartsMask, | ||
| 4210 | sizeof (str), str); | ||
| 4211 | if (err == noErr) | ||
| 4212 | return build_string (str); | ||
| 4213 | else | ||
| 4214 | return Qnil; | ||
| 4215 | } | ||
| 4216 | |||
| 4217 | |||
| 4195 | #ifdef MAC_OSX | 4218 | #ifdef MAC_OSX |
| 4196 | #undef select | 4219 | #undef select |
| 4197 | 4220 | ||
| @@ -4213,7 +4236,7 @@ extern int noninteractive; | |||
| 4213 | involved, and timeout is not too short (greater than | 4236 | involved, and timeout is not too short (greater than |
| 4214 | SELECT_TIMEOUT_THRESHHOLD_RUNLOOP seconds). | 4237 | SELECT_TIMEOUT_THRESHHOLD_RUNLOOP seconds). |
| 4215 | -> Create CFSocket for each socket and add it into the current | 4238 | -> Create CFSocket for each socket and add it into the current |
| 4216 | event RunLoop so that an `ready-to-read' event can be posted | 4239 | event RunLoop so that a `ready-to-read' event can be posted |
| 4217 | to the event queue that is also used for window events. Then | 4240 | to the event queue that is also used for window events. Then |
| 4218 | ReceiveNextEvent can wait for both kinds of inputs. | 4241 | ReceiveNextEvent can wait for both kinds of inputs. |
| 4219 | 4. Otherwise. | 4242 | 4. Otherwise. |
| @@ -4481,6 +4504,11 @@ init_mac_osx_environment () | |||
| 4481 | char *p, *q; | 4504 | char *p, *q; |
| 4482 | struct stat st; | 4505 | struct stat st; |
| 4483 | 4506 | ||
| 4507 | /* Initialize locale related variables. */ | ||
| 4508 | mac_system_script_code = | ||
| 4509 | (ScriptCode) GetScriptManagerVariable (smSysScript); | ||
| 4510 | Vmac_system_locale = mac_get_system_locale (); | ||
| 4511 | |||
| 4484 | /* Fetch the pathname of the application bundle as a C string into | 4512 | /* Fetch the pathname of the application bundle as a C string into |
| 4485 | app_bundle_pathname. */ | 4513 | app_bundle_pathname. */ |
| 4486 | 4514 | ||
| @@ -4600,28 +4628,6 @@ init_mac_osx_environment () | |||
| 4600 | #endif /* MAC_OSX */ | 4628 | #endif /* MAC_OSX */ |
| 4601 | 4629 | ||
| 4602 | 4630 | ||
| 4603 | static Lisp_Object | ||
| 4604 | mac_get_system_locale () | ||
| 4605 | { | ||
| 4606 | OSErr err; | ||
| 4607 | LangCode lang; | ||
| 4608 | RegionCode region; | ||
| 4609 | LocaleRef locale; | ||
| 4610 | Str255 str; | ||
| 4611 | |||
| 4612 | lang = GetScriptVariable (smSystemScript, smScriptLang); | ||
| 4613 | region = GetScriptManagerVariable (smRegionCode); | ||
| 4614 | err = LocaleRefFromLangOrRegionCode (lang, region, &locale); | ||
| 4615 | if (err == noErr) | ||
| 4616 | err = LocaleRefGetPartString (locale, kLocaleAllPartsMask, | ||
| 4617 | sizeof (str), str); | ||
| 4618 | if (err == noErr) | ||
| 4619 | return build_string (str); | ||
| 4620 | else | ||
| 4621 | return Qnil; | ||
| 4622 | } | ||
| 4623 | |||
| 4624 | |||
| 4625 | void | 4631 | void |
| 4626 | syms_of_mac () | 4632 | syms_of_mac () |
| 4627 | { | 4633 | { |