1=provides 2 3__UNDEFINED__ 4LOCK_NUMERIC_STANDARD 5UNLOCK_NUMERIC_STANDARD 6 7=implementation 8 9#if PERL_VERSION_LT(5,27,9) 10__UNDEFINED__ LC_NUMERIC_LOCK 11__UNDEFINED__ LC_NUMERIC_UNLOCK 12# if PERL_VERSION_LT(5,19,0) 13# undef STORE_LC_NUMERIC_SET_STANDARD 14# undef RESTORE_LC_NUMERIC 15# undef DECLARATION_FOR_LC_NUMERIC_MANIPULATION 16# ifdef USE_LOCALE 17__UNDEFINED__ DECLARATION_FOR_LC_NUMERIC_MANIPULATION char *LoC_ 18__UNDEFINED__ STORE_NUMERIC_SET_STANDARD() \ 19 LoC_ = savepv(setlocale(LC_NUMERIC, NULL)); \ 20 SAVEFREEPV(LoC_); \ 21 setlocale(LC_NUMERIC, "C"); 22__UNDEFINED__ RESTORE_LC_NUMERIC() \ 23 setlocale(LC_NUMERIC, LoC_); 24# else 25__UNDEFINED__ DECLARATION_FOR_LC_NUMERIC_MANIPULATION 26__UNDEFINED__ STORE_LC_NUMERIC_SET_STANDARD() 27__UNDEFINED__ RESTORE_LC_NUMERIC() 28# endif 29# endif 30#endif 31 32#ifndef LOCK_NUMERIC_STANDARD 33# define LOCK_NUMERIC_STANDARD() 34#endif 35 36#ifndef UNLOCK_NUMERIC_STANDARD 37# define UNLOCK_NUMERIC_STANDARD() 38#endif 39 40/* The names of these changed in 5.28 */ 41__UNDEFINED__ LOCK_LC_NUMERIC_STANDARD LOCK_NUMERIC_STANDARD 42__UNDEFINED__ UNLOCK_LC_NUMERIC_STANDARD UNLOCK_NUMERIC_STANDARD 43 44/* If this doesn't exist, it's not needed, so is void noop */ 45__UNDEFINED__ switch_to_global_locale() 46 47/* Originally, this didn't return a value, but in perls like that, the value 48 * should always be TRUE. Add a return to Perl_sync_locale() when it's 49 * available. And actually do a sync when its not, if locales are available on 50 * this system. */ 51#ifdef sync_locale 52# if { VERSION < 5.27.9 } 53# if { VERSION >= 5.21.3 } 54# undef sync_locale 55# define sync_locale() (Perl_sync_locale(aTHX), 1) 56# elif defined(sync_locale) /* These should only be the 5.20 maints*/ 57# undef sync_locale /* Just copy their defn and return 1 */ 58# define sync_locale() (new_ctype(setlocale(LC_CTYPE, NULL)), \ 59 new_collate(setlocale(LC_COLLATE, NULL)), \ 60 set_numeric_local(), \ 61 new_numeric(setlocale(LC_NUMERIC, NULL)), \ 62 1) 63# elif defined(new_ctype) && defined(LC_CTYPE) 64# define sync_locale() (new_ctype(setlocale(LC_CTYPE, NULL)), 1) 65# endif 66# endif 67#endif 68 69__UNDEFINED__ sync_locale() 1 70 71=xsubs 72 73bool 74sync_locale() 75 CODE: 76 RETVAL = sync_locale(); 77 OUTPUT: 78 RETVAL 79 80 81=tests plan => 1 82 83use Config; 84 85# We don't know for sure that we are in the global locale for testing. But 86# if this is unthreaded, it almost certainly is. But Configure can be called 87# to force POSIX locales on unthreaded systems. If this becomes a problem 88# this check could be beefed up. 89if ($Config{usethreads}) { 90 ok(1, "ironically we have to skip testing sync_locale under threads"); 91} 92else { 93 ok(&Devel::PPPort::sync_locale(), "sync_locale returns TRUE"); 94} 95