diff options
Diffstat (limited to 'src/lj_api.c')
-rw-r--r-- | src/lj_api.c | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/src/lj_api.c b/src/lj_api.c index a9ea38d8..5a0bd07a 100644 --- a/src/lj_api.c +++ b/src/lj_api.c | |||
@@ -23,9 +23,6 @@ | |||
23 | #include "lj_frame.h" | 23 | #include "lj_frame.h" |
24 | #include "lj_trace.h" | 24 | #include "lj_trace.h" |
25 | #include "lj_vm.h" | 25 | #include "lj_vm.h" |
26 | #include "lj_lex.h" | ||
27 | #include "lj_bcdump.h" | ||
28 | #include "lj_parse.h" | ||
29 | #include "lj_strscan.h" | 26 | #include "lj_strscan.h" |
30 | 27 | ||
31 | /* -- Common helper functions --------------------------------------------- */ | 28 | /* -- Common helper functions --------------------------------------------- */ |
@@ -1138,47 +1135,6 @@ LUA_API int lua_resume(lua_State *L, int nargs) | |||
1138 | return LUA_ERRRUN; | 1135 | return LUA_ERRRUN; |
1139 | } | 1136 | } |
1140 | 1137 | ||
1141 | /* -- Load and dump Lua code ---------------------------------------------- */ | ||
1142 | |||
1143 | static TValue *cpparser(lua_State *L, lua_CFunction dummy, void *ud) | ||
1144 | { | ||
1145 | LexState *ls = (LexState *)ud; | ||
1146 | GCproto *pt; | ||
1147 | GCfunc *fn; | ||
1148 | UNUSED(dummy); | ||
1149 | cframe_errfunc(L->cframe) = -1; /* Inherit error function. */ | ||
1150 | pt = lj_lex_setup(L, ls) ? lj_bcread(ls) : lj_parse(ls); | ||
1151 | fn = lj_func_newL_empty(L, pt, tabref(L->env)); | ||
1152 | /* Don't combine above/below into one statement. */ | ||
1153 | setfuncV(L, L->top++, fn); | ||
1154 | return NULL; | ||
1155 | } | ||
1156 | |||
1157 | LUA_API int lua_load(lua_State *L, lua_Reader reader, void *data, | ||
1158 | const char *chunkname) | ||
1159 | { | ||
1160 | LexState ls; | ||
1161 | int status; | ||
1162 | ls.rfunc = reader; | ||
1163 | ls.rdata = data; | ||
1164 | ls.chunkarg = chunkname ? chunkname : "?"; | ||
1165 | lj_str_initbuf(&ls.sb); | ||
1166 | status = lj_vm_cpcall(L, NULL, &ls, cpparser); | ||
1167 | lj_lex_cleanup(L, &ls); | ||
1168 | lj_gc_check(L); | ||
1169 | return status; | ||
1170 | } | ||
1171 | |||
1172 | LUA_API int lua_dump(lua_State *L, lua_Writer writer, void *data) | ||
1173 | { | ||
1174 | cTValue *o = L->top-1; | ||
1175 | api_checknelems(L, 1); | ||
1176 | if (tvisfunc(o) && isluafunc(funcV(o))) | ||
1177 | return lj_bcwrite(L, funcproto(funcV(o)), writer, data, 0); | ||
1178 | else | ||
1179 | return 1; | ||
1180 | } | ||
1181 | |||
1182 | /* -- GC and memory management -------------------------------------------- */ | 1138 | /* -- GC and memory management -------------------------------------------- */ |
1183 | 1139 | ||
1184 | LUA_API int lua_gc(lua_State *L, int what, int data) | 1140 | LUA_API int lua_gc(lua_State *L, int what, int data) |