diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.dep | 4 | ||||
-rw-r--r-- | src/host/buildvm_libbc.h | 17 | ||||
-rw-r--r-- | src/lib_base.c | 7 | ||||
-rw-r--r-- | src/lib_io.c | 11 | ||||
-rw-r--r-- | src/lib_package.c | 4 | ||||
-rw-r--r-- | src/lib_table.c | 20 |
6 files changed, 52 insertions, 11 deletions
diff --git a/src/Makefile.dep b/src/Makefile.dep index 4ef002e9..2b1cb5ef 100644 --- a/src/Makefile.dep +++ b/src/Makefile.dep | |||
@@ -3,8 +3,8 @@ lib_aux.o: lib_aux.c lua.h luaconf.h lauxlib.h lj_obj.h lj_def.h \ | |||
3 | lj_dispatch.h lj_bc.h lj_traceerr.h lj_lib.h lj_alloc.h | 3 | lj_dispatch.h lj_bc.h lj_traceerr.h lj_lib.h lj_alloc.h |
4 | lib_base.o: lib_base.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h \ | 4 | lib_base.o: lib_base.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h \ |
5 | lj_def.h lj_arch.h lj_gc.h lj_err.h lj_errmsg.h lj_debug.h lj_str.h \ | 5 | lj_def.h lj_arch.h lj_gc.h lj_err.h lj_errmsg.h lj_debug.h lj_str.h \ |
6 | lj_tab.h lj_meta.h lj_state.h lj_ctype.h lj_cconv.h lj_bc.h lj_ff.h \ | 6 | lj_tab.h lj_meta.h lj_state.h lj_frame.h lj_bc.h lj_ctype.h lj_cconv.h \ |
7 | lj_ffdef.h lj_dispatch.h lj_jit.h lj_ir.h lj_char.h lj_strscan.h \ | 7 | lj_ff.h lj_ffdef.h lj_dispatch.h lj_jit.h lj_ir.h lj_char.h lj_strscan.h \ |
8 | lj_strfmt.h lj_lib.h lj_libdef.h | 8 | lj_strfmt.h lj_lib.h lj_libdef.h |
9 | lib_bit.o: lib_bit.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h lj_def.h \ | 9 | lib_bit.o: lib_bit.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h lj_def.h \ |
10 | lj_arch.h lj_err.h lj_errmsg.h lj_buf.h lj_gc.h lj_str.h lj_strscan.h \ | 10 | lj_arch.h lj_err.h lj_errmsg.h lj_buf.h lj_gc.h lj_str.h lj_strscan.h \ |
diff --git a/src/host/buildvm_libbc.h b/src/host/buildvm_libbc.h index 45f8f8cb..b2600bd5 100644 --- a/src/host/buildvm_libbc.h +++ b/src/host/buildvm_libbc.h | |||
@@ -15,7 +15,12 @@ static const uint8_t libbc_code[] = { | |||
15 | 8,2,0,0,88,3,23,128,59,3,2,0,43,4,0,0,64,4,2,0,76,3,2,0,88,3,18,128,16,1,14, | 15 | 8,2,0,0,88,3,23,128,59,3,2,0,43,4,0,0,64,4,2,0,76,3,2,0,88,3,18,128,16,1,14, |
16 | 0,41,3,1,0,3,3,1,0,88,3,14,128,3,1,2,0,88,3,12,128,59,3,1,0,22,4,1,1,18,5,2, | 16 | 0,41,3,1,0,3,3,1,0,88,3,14,128,3,1,2,0,88,3,12,128,59,3,1,0,22,4,1,1,18,5,2, |
17 | 0,41,6,1,0,77,4,4,128,23,8,1,7,59,9,7,0,64,9,8,0,79,4,252,127,43,4,0,0,64,4, | 17 | 0,41,6,1,0,77,4,4,128,23,8,1,7,59,9,7,0,64,9,8,0,79,4,252,127,43,4,0,0,64,4, |
18 | 2,0,76,3,2,0,75,0,1,0,0,2,0 | 18 | 2,0,76,3,2,0,75,0,1,0,0,2,0,5,12,0,0,0,35,16,0,12,0,16,1,14,0,16,2,14,0,16, |
19 | 3,14,0,11,4,0,0,88,5,1,128,18,4,0,0,16,4,12,0,3,1,2,0,88,5,24,128,33,5,1,3, | ||
20 | 0,2,3,0,88,6,4,128,2,3,1,0,88,6,2,128,4,4,0,0,88,6,9,128,18,6,1,0,18,7,2,0, | ||
21 | 41,8,1,0,77,6,4,128,32,10,5,9,59,11,9,0,64,11,10,4,79,6,252,127,88,6,8,128, | ||
22 | 18,6,2,0,18,7,1,0,41,8,255,255,77,6,4,128,32,10,5,9,59,11,9,0,64,11,10,4,79, | ||
23 | 6,252,127,76,4,2,0,0 | ||
19 | #else | 24 | #else |
20 | 0,1,2,0,0,1,2,24,1,0,0,76,1,2,0,241,135,158,166,3,220,203,178,130,4,0,1,2,0, | 25 | 0,1,2,0,0,1,2,24,1,0,0,76,1,2,0,241,135,158,166,3,220,203,178,130,4,0,1,2,0, |
21 | 0,1,2,24,1,0,0,76,1,2,0,243,244,148,165,20,198,190,199,252,3,0,1,2,0,0,0,3, | 26 | 0,1,2,24,1,0,0,76,1,2,0,243,244,148,165,20,198,190,199,252,3,0,1,2,0,0,0,3, |
@@ -28,7 +33,12 @@ static const uint8_t libbc_code[] = { | |||
28 | 8,2,0,0,88,3,23,128,59,3,2,0,43,4,0,0,64,4,2,0,76,3,2,0,88,3,18,128,16,1,14, | 33 | 8,2,0,0,88,3,23,128,59,3,2,0,43,4,0,0,64,4,2,0,76,3,2,0,88,3,18,128,16,1,14, |
29 | 0,41,3,1,0,3,3,1,0,88,3,14,128,3,1,2,0,88,3,12,128,59,3,1,0,22,4,1,1,18,5,2, | 34 | 0,41,3,1,0,3,3,1,0,88,3,14,128,3,1,2,0,88,3,12,128,59,3,1,0,22,4,1,1,18,5,2, |
30 | 0,41,6,1,0,77,4,4,128,23,8,1,7,59,9,7,0,64,9,8,0,79,4,252,127,43,4,0,0,64,4, | 35 | 0,41,6,1,0,77,4,4,128,23,8,1,7,59,9,7,0,64,9,8,0,79,4,252,127,43,4,0,0,64,4, |
31 | 2,0,76,3,2,0,75,0,1,0,0,2,0 | 36 | 2,0,76,3,2,0,75,0,1,0,0,2,0,5,12,0,0,0,35,16,0,12,0,16,1,14,0,16,2,14,0,16, |
37 | 3,14,0,11,4,0,0,88,5,1,128,18,4,0,0,16,4,12,0,3,1,2,0,88,5,24,128,33,5,1,3, | ||
38 | 0,2,3,0,88,6,4,128,2,3,1,0,88,6,2,128,4,4,0,0,88,6,9,128,18,6,1,0,18,7,2,0, | ||
39 | 41,8,1,0,77,6,4,128,32,10,5,9,59,11,9,0,64,11,10,4,79,6,252,127,88,6,8,128, | ||
40 | 18,6,2,0,18,7,1,0,41,8,255,255,77,6,4,128,32,10,5,9,59,11,9,0,64,11,10,4,79, | ||
41 | 6,252,127,76,4,2,0,0 | ||
32 | #endif | 42 | #endif |
33 | }; | 43 | }; |
34 | 44 | ||
@@ -40,6 +50,7 @@ static const struct { const char *name; int ofs; } libbc_map[] = { | |||
40 | {"table_foreach",136}, | 50 | {"table_foreach",136}, |
41 | {"table_getn",207}, | 51 | {"table_getn",207}, |
42 | {"table_remove",226}, | 52 | {"table_remove",226}, |
43 | {NULL,355} | 53 | {"table_move",355}, |
54 | {NULL,502} | ||
44 | }; | 55 | }; |
45 | 56 | ||
diff --git a/src/lib_base.c b/src/lib_base.c index 6107bde0..7c523241 100644 --- a/src/lib_base.c +++ b/src/lib_base.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include "lj_tab.h" | 23 | #include "lj_tab.h" |
24 | #include "lj_meta.h" | 24 | #include "lj_meta.h" |
25 | #include "lj_state.h" | 25 | #include "lj_state.h" |
26 | #include "lj_frame.h" | ||
26 | #if LJ_HASFFI | 27 | #if LJ_HASFFI |
27 | #include "lj_ctype.h" | 28 | #include "lj_ctype.h" |
28 | #include "lj_cconv.h" | 29 | #include "lj_cconv.h" |
@@ -557,6 +558,12 @@ LJLIB_CF(coroutine_running) | |||
557 | #endif | 558 | #endif |
558 | } | 559 | } |
559 | 560 | ||
561 | LJLIB_CF(coroutine_isyieldable) | ||
562 | { | ||
563 | setboolV(L->top++, cframe_canyield(L->cframe)); | ||
564 | return 1; | ||
565 | } | ||
566 | |||
560 | LJLIB_CF(coroutine_create) | 567 | LJLIB_CF(coroutine_create) |
561 | { | 568 | { |
562 | lua_State *L1; | 569 | lua_State *L1; |
diff --git a/src/lib_io.c b/src/lib_io.c index 31f0ea97..53c17d92 100644 --- a/src/lib_io.c +++ b/src/lib_io.c | |||
@@ -203,13 +203,12 @@ static int io_file_read(lua_State *L, FILE *fp, int start) | |||
203 | for (n = start; nargs-- && ok; n++) { | 203 | for (n = start; nargs-- && ok; n++) { |
204 | if (tvisstr(L->base+n)) { | 204 | if (tvisstr(L->base+n)) { |
205 | const char *p = strVdata(L->base+n); | 205 | const char *p = strVdata(L->base+n); |
206 | if (p[0] != '*') | 206 | if (p[0] == '*') p++; |
207 | lj_err_arg(L, n+1, LJ_ERR_INVOPT); | 207 | if (p[0] == 'n') |
208 | if (p[1] == 'n') | ||
209 | ok = io_file_readnum(L, fp); | 208 | ok = io_file_readnum(L, fp); |
210 | else if ((p[1] & ~0x20) == 'L') | 209 | else if ((p[0] & ~0x20) == 'L') |
211 | ok = io_file_readline(L, fp, (p[1] == 'l')); | 210 | ok = io_file_readline(L, fp, (p[0] == 'l')); |
212 | else if (p[1] == 'a') | 211 | else if (p[0] == 'a') |
213 | io_file_readall(L, fp); | 212 | io_file_readall(L, fp); |
214 | else | 213 | else |
215 | lj_err_arg(L, n+1, LJ_ERR_INVFMT); | 214 | lj_err_arg(L, n+1, LJ_ERR_INVFMT); |
diff --git a/src/lib_package.c b/src/lib_package.c index 898897b1..c0252b73 100644 --- a/src/lib_package.c +++ b/src/lib_package.c | |||
@@ -589,6 +589,10 @@ LUALIB_API int luaopen_package(lua_State *L) | |||
589 | lj_lib_pushcf(L, package_loaders[i], 1); | 589 | lj_lib_pushcf(L, package_loaders[i], 1); |
590 | lua_rawseti(L, -2, i+1); | 590 | lua_rawseti(L, -2, i+1); |
591 | } | 591 | } |
592 | #if LJ_52 | ||
593 | lua_pushvalue(L, -1); | ||
594 | lua_setfield(L, -3, "searchers"); | ||
595 | #endif | ||
592 | lua_setfield(L, -2, "loaders"); | 596 | lua_setfield(L, -2, "loaders"); |
593 | lua_getfield(L, LUA_REGISTRYINDEX, "LUA_NOENV"); | 597 | lua_getfield(L, LUA_REGISTRYINDEX, "LUA_NOENV"); |
594 | noenv = lua_toboolean(L, -1); | 598 | noenv = lua_toboolean(L, -1); |
diff --git a/src/lib_table.c b/src/lib_table.c index f9a3693d..0204f25d 100644 --- a/src/lib_table.c +++ b/src/lib_table.c | |||
@@ -129,6 +129,26 @@ LJLIB_LUA(table_remove) /* | |||
129 | end | 129 | end |
130 | */ | 130 | */ |
131 | 131 | ||
132 | LJLIB_LUA(table_move) /* | ||
133 | function(a1, f, e, t, a2) | ||
134 | CHECK_tab(a1) | ||
135 | CHECK_int(f) | ||
136 | CHECK_int(e) | ||
137 | CHECK_int(t) | ||
138 | if a2 == nil then a2 = a1 end | ||
139 | CHECK_tab(a2) | ||
140 | if e >= f then | ||
141 | local d = t - f | ||
142 | if t > e or t <= f or a2 ~= a1 then | ||
143 | for i=f,e do a2[i+d] = a1[i] end | ||
144 | else | ||
145 | for i=e,f,-1 do a2[i+d] = a1[i] end | ||
146 | end | ||
147 | end | ||
148 | return a2 | ||
149 | end | ||
150 | */ | ||
151 | |||
132 | LJLIB_CF(table_concat) LJLIB_REC(.) | 152 | LJLIB_CF(table_concat) LJLIB_REC(.) |
133 | { | 153 | { |
134 | GCtab *t = lj_lib_checktab(L, 1); | 154 | GCtab *t = lj_lib_checktab(L, 1); |