This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
f8ad196da2a6587476549b4583a837a74368cec8
[perl5.git] / dist / Devel-PPPort / parts / inc / locale
1 =provides
2
3 __UNDEFINED__
4
5 =implementation
6
7
8 /* If this doesn't exist, it's not needed, so noop */
9 __UNDEFINED__  switch_to_global_locale()
10
11 /* Originally, this didn't return a value, but in perls like that, the value
12  * should always be TRUE.  Add a return to Perl_sync_locale() when it's
13  * available.  And actually do a sync when its not, if locales are available on
14  * this system. */
15 #ifdef sync_locale
16 #  if { VERSION < 5.27.9 }
17 #    if { VERSION >= 5.21.3 }
18 #      undef sync_locale
19 #      define sync_locale() (Perl_sync_locale(aTHX), 1)
20 #    elif defined(new_ctype) && defined(LC_CTYPE)
21 #      define sync_locale() (new_ctype(setlocale(LC_CTYPE, NULL)), 1)
22 #    else
23 #      undef sync_locale
24 #    endif
25 #  endif
26 #endif
27
28 __UNDEFINED__ sync_locale() 1
29
30 =xsubs
31
32 bool
33 sync_locale()
34         CODE:
35             RETVAL = sync_locale();
36         OUTPUT:
37             RETVAL
38
39
40 =tests plan => 1
41
42 use Config;
43
44   # We don't know for sure that we are in the global locale for testing.  But
45   # if this is unthreaded, it almost certainly is.  But Configure can be called
46   # to force POSIX locales on unthreaded systems.  If this becomes a problem
47   # this check could be beefed up.
48   if ($Config{usethreads}) {
49     ok(1);
50 }
51 else {
52     ok(&Devel::PPPort::sync_locale());
53 }