aboutsummaryrefslogtreecommitdiff
path: root/src/lj_lib.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_lib.h')
-rw-r--r--src/lj_lib.h21
1 files changed, 8 insertions, 13 deletions
diff --git a/src/lj_lib.h b/src/lj_lib.h
index daacb921..5bfd8d7c 100644
--- a/src/lj_lib.h
+++ b/src/lj_lib.h
@@ -41,7 +41,6 @@ LJ_FUNC void lj_lib_checknumber(lua_State *L, int narg);
41LJ_FUNC lua_Number lj_lib_checknum(lua_State *L, int narg); 41LJ_FUNC lua_Number lj_lib_checknum(lua_State *L, int narg);
42LJ_FUNC int32_t lj_lib_checkint(lua_State *L, int narg); 42LJ_FUNC int32_t lj_lib_checkint(lua_State *L, int narg);
43LJ_FUNC int32_t lj_lib_optint(lua_State *L, int narg, int32_t def); 43LJ_FUNC int32_t lj_lib_optint(lua_State *L, int narg, int32_t def);
44LJ_FUNC int32_t lj_lib_checkbit(lua_State *L, int narg);
45LJ_FUNC GCfunc *lj_lib_checkfunc(lua_State *L, int narg); 44LJ_FUNC GCfunc *lj_lib_checkfunc(lua_State *L, int narg);
46LJ_FUNC GCtab *lj_lib_checktab(lua_State *L, int narg); 45LJ_FUNC GCtab *lj_lib_checktab(lua_State *L, int narg);
47LJ_FUNC GCtab *lj_lib_checktabornil(lua_State *L, int narg); 46LJ_FUNC GCtab *lj_lib_checktabornil(lua_State *L, int narg);
@@ -60,23 +59,14 @@ LJ_FUNC int lj_lib_checkopt(lua_State *L, int narg, int def, const char *lst);
60#define lj_lib_checkfpu(L) UNUSED(L) 59#define lj_lib_checkfpu(L) UNUSED(L)
61#endif 60#endif
62 61
63/* Push internal function on the stack. */ 62LJ_FUNC GCfunc *lj_lib_pushcc(lua_State *L, lua_CFunction f, int id, int n);
64static LJ_AINLINE void lj_lib_pushcc(lua_State *L, lua_CFunction f,
65 int id, int n)
66{
67 GCfunc *fn;
68 lua_pushcclosure(L, f, n);
69 fn = funcV(L->top-1);
70 fn->c.ffid = (uint8_t)id;
71 setmref(fn->c.pc, &G(L)->bc_cfunc_int);
72}
73
74#define lj_lib_pushcf(L, fn, id) (lj_lib_pushcc(L, (fn), (id), 0)) 63#define lj_lib_pushcf(L, fn, id) (lj_lib_pushcc(L, (fn), (id), 0))
75 64
76/* Library function declarations. Scanned by buildvm. */ 65/* Library function declarations. Scanned by buildvm. */
77#define LJLIB_CF(name) static int lj_cf_##name(lua_State *L) 66#define LJLIB_CF(name) static int lj_cf_##name(lua_State *L)
78#define LJLIB_ASM(name) static int lj_ffh_##name(lua_State *L) 67#define LJLIB_ASM(name) static int lj_ffh_##name(lua_State *L)
79#define LJLIB_ASM_(name) 68#define LJLIB_ASM_(name)
69#define LJLIB_LUA(name)
80#define LJLIB_SET(name) 70#define LJLIB_SET(name)
81#define LJLIB_PUSH(arg) 71#define LJLIB_PUSH(arg)
82#define LJLIB_REC(handler) 72#define LJLIB_REC(handler)
@@ -88,6 +78,10 @@ static LJ_AINLINE void lj_lib_pushcc(lua_State *L, lua_CFunction f,
88 78
89LJ_FUNC void lj_lib_register(lua_State *L, const char *libname, 79LJ_FUNC void lj_lib_register(lua_State *L, const char *libname,
90 const uint8_t *init, const lua_CFunction *cf); 80 const uint8_t *init, const lua_CFunction *cf);
81LJ_FUNC void lj_lib_prereg(lua_State *L, const char *name, lua_CFunction f,
82 GCtab *env);
83LJ_FUNC int lj_lib_postreg(lua_State *L, lua_CFunction cf, int id,
84 const char *name);
91 85
92/* Library init data tags. */ 86/* Library init data tags. */
93#define LIBINIT_LENMASK 0x3f 87#define LIBINIT_LENMASK 0x3f
@@ -96,7 +90,8 @@ LJ_FUNC void lj_lib_register(lua_State *L, const char *libname,
96#define LIBINIT_ASM 0x40 90#define LIBINIT_ASM 0x40
97#define LIBINIT_ASM_ 0x80 91#define LIBINIT_ASM_ 0x80
98#define LIBINIT_STRING 0xc0 92#define LIBINIT_STRING 0xc0
99#define LIBINIT_MAXSTR 0x39 93#define LIBINIT_MAXSTR 0x38
94#define LIBINIT_LUA 0xf9
100#define LIBINIT_SET 0xfa 95#define LIBINIT_SET 0xfa
101#define LIBINIT_NUMBER 0xfb 96#define LIBINIT_NUMBER 0xfb
102#define LIBINIT_COPY 0xfc 97#define LIBINIT_COPY 0xfc