From 831e814ce9bdb84e86c06c4a52008f6bdaaa00d6 Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 16 Nov 2018 00:24:51 +0800 Subject: =?UTF-8?q?*=E5=90=88=E5=B9=B6master=E5=88=B0minimal=E5=88=86?= =?UTF-8?q?=E6=94=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LuaJIT-2.0.5/include/LuaJIT/lj_strscan.h | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_strscan.h (limited to 'src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_strscan.h') diff --git a/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_strscan.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_strscan.h new file mode 100644 index 0000000..6fb0dda --- /dev/null +++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_strscan.h @@ -0,0 +1,39 @@ +/* +** String scanning. +** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h +*/ + +#ifndef _LJ_STRSCAN_H +#define _LJ_STRSCAN_H + +#include "lj_obj.h" + +/* Options for accepted/returned formats. */ +#define STRSCAN_OPT_TOINT 0x01 /* Convert to int32_t, if possible. */ +#define STRSCAN_OPT_TONUM 0x02 /* Always convert to double. */ +#define STRSCAN_OPT_IMAG 0x04 +#define STRSCAN_OPT_LL 0x08 +#define STRSCAN_OPT_C 0x10 + +/* Returned format. */ +typedef enum { + STRSCAN_ERROR, + STRSCAN_NUM, STRSCAN_IMAG, + STRSCAN_INT, STRSCAN_U32, STRSCAN_I64, STRSCAN_U64, +} StrScanFmt; + +LJ_FUNC StrScanFmt lj_strscan_scan(const uint8_t *p, TValue *o, uint32_t opt); +LJ_FUNC int LJ_FASTCALL lj_strscan_num(GCstr *str, TValue *o); +#if LJ_DUALNUM +LJ_FUNC int LJ_FASTCALL lj_strscan_number(GCstr *str, TValue *o); +#else +#define lj_strscan_number(s, o) lj_strscan_num((s), (o)) +#endif + +/* Check for number or convert string to number/int in-place (!). */ +static LJ_AINLINE int lj_strscan_numberobj(TValue *o) +{ + return tvisnumber(o) || (tvisstr(o) && lj_strscan_number(strV(o), o)); +} + +#endif -- cgit v1.1-26-g67d0