3 ** Copyright (C) 2005-2012 Mike Pall. See Copyright Notice in luajit.h
11 /* Options for accepted/returned formats. */
12 #define STRSCAN_OPT_TOINT 0x01 /* Convert to int32_t, if possible. */
13 #define STRSCAN_OPT_TONUM 0x02 /* Always convert to double. */
14 #define STRSCAN_OPT_IMAG 0x04
15 #define STRSCAN_OPT_LL 0x08
16 #define STRSCAN_OPT_C 0x10
18 /* Returned format. */
21 STRSCAN_NUM
, STRSCAN_IMAG
,
22 STRSCAN_INT
, STRSCAN_U32
, STRSCAN_I64
, STRSCAN_U64
,
25 LJ_FUNC StrScanFmt
lj_strscan_scan(const uint8_t *p
, TValue
*o
, uint32_t opt
);
26 LJ_FUNC
int LJ_FASTCALL
lj_strscan_num(GCstr
*str
, TValue
*o
);
28 LJ_FUNC
int LJ_FASTCALL
lj_strscan_number(GCstr
*str
, TValue
*o
);
30 #define lj_strscan_number(s, o) lj_strscan_num((s), (o))
33 /* Check for number or convert string to number/int in-place (!). */
34 static LJ_AINLINE
int lj_strscan_numberobj(TValue
*o
)
36 return tvisnumber(o
) || (tvisstr(o
) && lj_strscan_number(strV(o
), o
));