diff options
author | Mike Pall <mike> | 2013-11-25 15:17:44 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2013-11-25 15:17:44 +0100 |
commit | c378f7dbb882068d1ae06edc8e7049fb1907db2d (patch) | |
tree | 2a99541a907ac84a3be740ef67dfadb640832dce /src/lj_lib.h | |
parent | a8c3862d63ad60acf07252304bbfd74bce35371c (diff) | |
download | luajit-c378f7dbb882068d1ae06edc8e7049fb1907db2d.tar.gz luajit-c378f7dbb882068d1ae06edc8e7049fb1907db2d.tar.bz2 luajit-c378f7dbb882068d1ae06edc8e7049fb1907db2d.zip |
Abstract out post-registration handling of pre-registered modules.
Diffstat (limited to 'src/lj_lib.h')
-rw-r--r-- | src/lj_lib.h | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/src/lj_lib.h b/src/lj_lib.h index f9377bad..c77c5229 100644 --- a/src/lj_lib.h +++ b/src/lj_lib.h | |||
@@ -59,18 +59,7 @@ LJ_FUNC int lj_lib_checkopt(lua_State *L, int narg, int def, const char *lst); | |||
59 | #define lj_lib_checkfpu(L) UNUSED(L) | 59 | #define lj_lib_checkfpu(L) UNUSED(L) |
60 | #endif | 60 | #endif |
61 | 61 | ||
62 | /* Push internal function on the stack. */ | 62 | LJ_FUNC GCfunc *lj_lib_pushcc(lua_State *L, lua_CFunction f, int id, int n); |
63 | static LJ_AINLINE GCfunc *lj_lib_pushcc(lua_State *L, lua_CFunction f, | ||
64 | int id, int n) | ||
65 | { | ||
66 | GCfunc *fn; | ||
67 | lua_pushcclosure(L, f, n); | ||
68 | fn = funcV(L->top-1); | ||
69 | fn->c.ffid = (uint8_t)id; | ||
70 | setmref(fn->c.pc, &G(L)->bc_cfunc_int); | ||
71 | return fn; | ||
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. */ |
@@ -91,6 +80,8 @@ LJ_FUNC void lj_lib_register(lua_State *L, const char *libname, | |||
91 | const uint8_t *init, const lua_CFunction *cf); | 80 | const uint8_t *init, const lua_CFunction *cf); |
92 | LJ_FUNC void lj_lib_prereg(lua_State *L, const char *name, lua_CFunction f, | 81 | LJ_FUNC void lj_lib_prereg(lua_State *L, const char *name, lua_CFunction f, |
93 | GCtab *env); | 82 | GCtab *env); |
83 | LJ_FUNC int lj_lib_postreg(lua_State *L, lua_CFunction cf, int id, | ||
84 | const char *name); | ||
94 | 85 | ||
95 | /* Library init data tags. */ | 86 | /* Library init data tags. */ |
96 | #define LIBINIT_LENMASK 0x3f | 87 | #define LIBINIT_LENMASK 0x3f |