42 return ((e+1) << 3) | (
cast_int(x) - 8);
48 int e = (x >> 3) & 0x1f;
50 else return ((x & 7) + 8) << (e - 1);
55 static const lu_byte log_2[256] = {
56 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
57 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
58 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
59 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
60 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
61 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
62 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
63 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8
67 while (x >= 256) { l += 8; x >>= 8; }
74 case LUA_OPADD:
return luai_numadd(NULL, v1, v2);
75 case LUA_OPSUB:
return luai_numsub(NULL, v1, v2);
76 case LUA_OPMUL:
return luai_nummul(NULL, v1, v2);
77 case LUA_OPDIV:
return luai_numdiv(NULL, v1, v2);
78 case LUA_OPMOD:
return luai_nummod(NULL, v1, v2);
79 case LUA_OPPOW:
return luai_numpow(NULL, v1, v2);
80 case LUA_OPUNM:
return luai_numunm(NULL, v1);
92 #if !defined(lua_strx2number)
98 if (**s ==
'-') { (*s)++;
return 1; }
99 else if (**s ==
'+') (*s)++;
121 *endptr =
cast(
char *, s);
124 if (!(*s ==
'0' && (*(s + 1) ==
'x' || *(s + 1) ==
'X')))
132 if (
i == 0 && e == 0)
135 *endptr =
cast(
char *, s);
136 if (*s ==
'p' || *s ==
'P') {
144 exp1 = exp1 * 10 + *(s++) -
'0';
145 if (neg1) exp1 = -
exp1;
148 *endptr =
cast(
char *, s);
159 if (strpbrk(s,
"nN"))
161 else if (strpbrk(s,
"xX"))
165 if (endptr == s)
return 0;
167 return (endptr == s + len);
181 const char *
e = strchr(fmt,
'%');
182 if (e == NULL)
break;
187 const char *
s = va_arg(argp,
char *);
188 if (s == NULL) s =
"(null)";
194 buff =
cast(
char, va_arg(argp,
int));
207 char buff[4*
sizeof(
void *) + 8];
208 int l = sprintf(buff,
"%p", va_arg(argp,
void *));
218 "invalid option " LUA_QL(
"%%%c")
" to " LUA_QL(
"lua_pushfstring"),
243 #define LL(x) (sizeof(x)/sizeof(char) - 1)
246 #define PRE "[string \""
249 #define addstr(a,b,l) ( memcpy(a,b,(l) * sizeof(char)), a += (l) )
252 size_t l = strlen(source);
253 if (*source ==
'=') {
255 memcpy(out, source + 1, l *
sizeof(
char));
257 addstr(out, source + 1, bufflen - 1);
261 else if (*source ==
'@') {
263 memcpy(out, source + 1, l *
sizeof(
char));
267 memcpy(out, source + 1 + l - bufflen, bufflen *
sizeof(
char));
271 const char *nl = strchr(source,
'\n');
274 if (l < bufflen && nl == NULL) {
278 if (nl != NULL) l = nl -
source;
279 if (l > bufflen) l = bufflen;
283 memcpy(out, POS, (
LL(POS) + 1) *
sizeof(
char));
const char * luaO_pushvfstring(lua_State *L, const char *fmt, va_list argp)
lua_Number luaO_arith(int op, lua_Number v1, lua_Number v2)
void luaV_concat(lua_State *L, int total)
l_noret luaG_runerror(lua_State *L, const char *fmt,...)
static int exp1(LexState *ls)
static lua_Number lua_strx2number(const char *s, char **endptr)
int luaO_ceillog2(unsigned int x)
#define setnvalue(obj, x)
GLfloat GLfloat GLfloat v2
int luaO_str2d(const char *s, size_t len, lua_Number *result)
static void pushstr(lua_State *L, const char *str, size_t l)
#define luaD_checkstack(L, n)
GLuint GLuint GLsizei count
int luaO_int2fb(unsigned int x)
LUAI_DDEF const TValue luaO_nilobject_
static void msg(const char *act, debug_info &i, const char *to="", const char *result="")
GLint GLint GLint GLint GLint x
GLdouble GLdouble GLdouble r
static int isneg(const char **s)
const char * luaO_pushfstring(lua_State *L, const char *fmt,...)
int luaO_hexavalue(int c)
void luaO_chunkid(char *out, const char *source, size_t bufflen)
#define lua_str2number(s, p)
static lua_Number readhexa(const char **s, lua_Number r, int *count)
TString * luaS_newlstr(lua_State *L, const char *str, size_t l)
LUAI_UACNUMBER l_uacNumber
GLsizei GLsizei GLchar * source