blob: b06258d3c1a08f82e6796b0ecf8be3b1d272e2f5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
MODULE = XS::APItest PACKAGE = XS::APItest::numeric
void
grok_number(number)
SV *number
PREINIT:
STRLEN len;
const char *pv = SvPV(number, len);
UV value;
int result;
PPCODE:
EXTEND(SP,2);
result = grok_number(pv, len, &value);
PUSHs(sv_2mortal(newSViv(result)));
if (result & IS_NUMBER_IN_UV)
PUSHs(sv_2mortal(newSVuv(value)));
|