summaryrefslogtreecommitdiff
path: root/dist/Devel-PPPort/parts/inc/locale
blob: 699adfdc39c8eb65ba327481b4eecca2d7367c17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
=provides

__UNDEFINED__

=implementation


/* If this doesn't exist, it's not needed, so noop */
__UNDEFINED__  switch_to_global_locale()

/* Originally, this didn't return a value, but in perls like that, the value
 * should always be TRUE.  Add a return to Perl_sync_locale() when it's
 * available.  And actually do a sync when its not, if locales are available on
 * this system. */
#ifdef sync_locale
#  if { VERSION < 5.27.9 }
#    if { VERSION >= 5.21.3 }
#      undef sync_locale
#      define sync_locale() (Perl_sync_locale(aTHX), 1)
#    elif defined(sync_locale)  /* These should be the 5.20 maints*/
#      undef sync_locale        /* Just copy their defn and return 1 */
#      define sync_locale() (new_ctype(setlocale(LC_CTYPE, NULL)),        \
                             new_collate(setlocale(LC_COLLATE, NULL)),    \
                             set_numeric_local(),                         \
                             new_numeric(setlocale(LC_NUMERIC, NULL)),    \
                             1)
#    elif defined(new_ctype) && defined(LC_CTYPE)
#      define sync_locale() (new_ctype(setlocale(LC_CTYPE, NULL)), 1)
#    endif
#  endif
#endif

__UNDEFINED__ sync_locale() 1

=xsubs

bool
sync_locale()
        CODE:
            RETVAL = sync_locale();
        OUTPUT:
            RETVAL


=tests plan => 1

use Config;

  # We don't know for sure that we are in the global locale for testing.  But
  # if this is unthreaded, it almost certainly is.  But Configure can be called
  # to force POSIX locales on unthreaded systems.  If this becomes a problem
  # this check could be beefed up.
  if ($Config{usethreads}) {
    ok(1);
}
else {
    ok(&Devel::PPPort::sync_locale());
}