History

Lua 5.3.0-work3

Lua Team committed 12 years ago

Commit f8a66271 parent ad386d945 files · +2323 −1590Browse files

Showing the changes to src/lua.h (1 of 45 files). Show all

Unified · Split

src/lua.h+25−14
@@ -1,5 +1,5 @@
11 /*
2−** $Id: lua.h,v 1.302 2014/03/20 19:42:35 roberto Exp $
2+** $Id: lua.h,v 1.307 2014/06/10 17:41:38 roberto Exp $
33 ** Lua - A Scripting Language
44 ** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
55 ** See Copyright Notice at the end of this file
@@ -19,7 +19,7 @@ · 13 unmodified lines
1919 #define LUA_VERSION_MAJOR "5"
2020 #define LUA_VERSION_MINOR "3"
2121 #define LUA_VERSION_NUM 503
22−#define LUA_VERSION_RELEASE "0 (work2)"
22+#define LUA_VERSION_RELEASE "0 (work3)"
2323
2424 #define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR
2525 #define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE
@@ -53,8 +53,16 @@ · 27 unmodified lines
5353
5454 typedef struct lua_State lua_State;
5555
56+/*
57+** Type for C functions registered with Lua
58+*/
5659 typedef int (*lua_CFunction) (lua_State *L);
5760
61+/*
62+** Type for continuation functions
63+*/
64+typedef int (*lua_KFunction) (lua_State *L, int status, int ctx);
65+
5866
5967 /*
6068 ** functions that read/write blocks when loading/dumping Lua chunks
@@ -145,8 +153,7 @@ LUA_API int (lua_absindex) (lua_State *L, int idx); · 84 unmodified lines
145153 LUA_API int (lua_gettop) (lua_State *L);
146154 LUA_API void (lua_settop) (lua_State *L, int idx);
147155 LUA_API void (lua_pushvalue) (lua_State *L, int idx);
148−LUA_API void (lua_remove) (lua_State *L, int idx);
149−LUA_API void (lua_insert) (lua_State *L, int idx);
156+LUA_API void (lua_rotate) (lua_State *L, int idx, int n);
150157 LUA_API void (lua_replace) (lua_State *L, int idx);
151158 LUA_API void (lua_copy) (lua_State *L, int fromidx, int toidx);
152159 LUA_API int (lua_checkstack) (lua_State *L, int sz);
@@ -238,7 +245,7 @@ LUA_API int (lua_rawgetp) (lua_State *L, int idx, const void *p); · 85 unmodified lines
238245 LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec);
239246 LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz);
240247 LUA_API int (lua_getmetatable) (lua_State *L, int objindex);
241−LUA_API void (lua_getuservalue) (lua_State *L, int idx);
248+LUA_API int (lua_getuservalue) (lua_State *L, int idx);
242249
243250
244251 /*
@@ -258,13 +265,11 @@ LUA_API void (lua_setuservalue) (lua_State *L, int idx); · 13 unmodified lines
258265 ** 'load' and 'call' functions (load and run Lua code)
259266 */
260267 LUA_API void (lua_callk) (lua_State *L, int nargs, int nresults, int ctx,
261− lua_CFunction k);
268+ lua_KFunction k);
262269 #define lua_call(L,n,r) lua_callk(L, (n), (r), 0, NULL)
263270
264−LUA_API int (lua_getctx) (lua_State *L, int *ctx);
265−
266271 LUA_API int (lua_pcallk) (lua_State *L, int nargs, int nresults, int errfunc,
267− int ctx, lua_CFunction k);
272+ int ctx, lua_KFunction k);
268273 #define lua_pcall(L,n,r,f) lua_pcallk(L, (n), (r), (f), 0, NULL)
269274
270275 LUA_API int (lua_load) (lua_State *L, lua_Reader reader, void *dt,
@@ -278,10 +283,12 @@ LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data, int strip); · 7 unmodified lines
278283 ** coroutine functions
279284 */
280285 LUA_API int (lua_yieldk) (lua_State *L, int nresults, int ctx,
281− lua_CFunction k);
286+ lua_KFunction k);
282287 #define lua_yield(L,n) lua_yieldk(L, (n), 0, NULL)
283288 LUA_API int (lua_resume) (lua_State *L, lua_State *from, int narg);
284289 LUA_API int (lua_status) (lua_State *L);
290+LUA_API int lua_isyieldable (lua_State *L);
291+
285292
286293 /*
287294 ** garbage-collection function and options
@@ -311,7 +318,7 @@ LUA_API int (lua_next) (lua_State *L, int idx); · 23 unmodified lines
311318 LUA_API void (lua_concat) (lua_State *L, int n);
312319 LUA_API void (lua_len) (lua_State *L, int idx);
313320
314−LUA_API int (lua_strtonum) (lua_State *L, const char *s, size_t len);
321+LUA_API size_t (lua_strtonum) (lua_State *L, const char *s);
315322
316323 LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud);
317324 LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud);
@@ -324,9 +331,9 @@ LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud); · 6 unmodified lines
324331 ** ===============================================================
325332 */
326333
327−#define lua_tonumber(L,i) lua_tonumberx(L,i,NULL)
328−#define lua_tointeger(L,i) lua_tointegerx(L,i,NULL)
329−#define lua_tounsigned(L,i) lua_tounsignedx(L,i,NULL)
334+#define lua_tonumber(L,i) lua_tonumberx(L,(i),NULL)
335+#define lua_tointeger(L,i) lua_tointegerx(L,(i),NULL)
336+#define lua_tounsigned(L,i) lua_tounsignedx(L,(i),NULL)
330337
331338 #define lua_pop(L,n) lua_settop(L, -(n)-1)
332339
@@ -354,6 +361,10 @@ LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud); · 21 unmodified lines
354361 #define lua_tostring(L,i) lua_tolstring(L, (i), NULL)
355362
356363
364+#define lua_insert(L,idx) lua_rotate(L, (idx), 1)
365+
366+#define lua_remove(L,idx) (lua_rotate(L, (idx), -1), lua_pop(L, 1))
367+
357368
358369 /*
359370 ** {======================================================================