blob: 3a97dafa1769ef7e02e1fff8bee7f97be63c1922 (
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
|
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#ifdef I_LANGINFO
# include <langinfo.h>
#endif
#include "constants.c"
MODULE = I18N::Langinfo PACKAGE = I18N::Langinfo
PROTOTYPES: ENABLE
INCLUDE: constants.xs
SV*
langinfo(code)
int code
CODE:
#ifdef HAS_NL_LANGINFO
char *s;
if (code > 0) { /* bold assumption: all valid langinfo codes > 0 */
#ifdef _MAXSTRMSG
if (code > _MAXSTRMSG)
RETVAL = &PL_sv_undef;
else
#else
# ifdef _NL_NUM_ITEMS
if (code >= _NL_NUM_ITEMS)
RETVAL = &PL_sv_undef;
else
# else
# ifdef _NL_NUM
if (code >= _NL_NUM)
RETVAL = &PL_sv_undef;
else
# endif
# endif
#endif
{
s = nl_langinfo(code);
RETVAL = newSVpvn(s, strlen(s));
}
} else {
RETVAL = &PL_sv_undef;
}
#else
croak("nl_langinfo() not implemented on this architecture");
#endif
OUTPUT:
RETVAL
|