aboutsummaryrefslogtreecommitdiff
path: root/lua.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-07-17 10:53:37 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-07-17 10:53:37 -0300
commit1aa4f69b51a92dc4f5c9d35925b9977d35650679 (patch)
treed63d6534a52452d1c9f4f0c0e6210f4c0435f769 /lua.h
parent8bb272a3e3d0693a1d587cfa3469153978ae617f (diff)
downloadlua-1aa4f69b51a92dc4f5c9d35925b9977d35650679.tar.gz
lua-1aa4f69b51a92dc4f5c9d35925b9977d35650679.tar.bz2
lua-1aa4f69b51a92dc4f5c9d35925b9977d35650679.zip
new type 'lua_Ctx' for continuation-function contexts (to allow type
to be configurable)
Diffstat (limited to 'lua.h')
-rw-r--r--lua.h60
1 files changed, 32 insertions, 28 deletions
diff --git a/lua.h b/lua.h
index 812df98f..f79da4bc 100644
--- a/lua.h
+++ b/lua.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lua.h,v 1.307 2014/06/10 17:41:38 roberto Exp roberto $ 2** $Id: lua.h,v 1.308 2014/06/26 17:25:11 roberto Exp roberto $
3** Lua - A Scripting Language 3** Lua - A Scripting Language
4** Lua.org, PUC-Rio, Brazil (http://www.lua.org) 4** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
5** See Copyright Notice at the end of this file 5** See Copyright Notice at the end of this file
@@ -53,30 +53,6 @@
53 53
54typedef struct lua_State lua_State; 54typedef struct lua_State lua_State;
55 55
56/*
57** Type for C functions registered with Lua
58*/
59typedef int (*lua_CFunction) (lua_State *L);
60
61/*
62** Type for continuation functions
63*/
64typedef int (*lua_KFunction) (lua_State *L, int status, int ctx);
65
66
67/*
68** functions that read/write blocks when loading/dumping Lua chunks
69*/
70typedef const char * (*lua_Reader) (lua_State *L, void *ud, size_t *sz);
71
72typedef int (*lua_Writer) (lua_State *L, const void *p, size_t sz, void *ud);
73
74
75/*
76** prototype for memory-allocation functions
77*/
78typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize);
79
80 56
81/* 57/*
82** basic types 58** basic types
@@ -117,6 +93,34 @@ typedef LUA_INTEGER lua_Integer;
117/* unsigned integer type */ 93/* unsigned integer type */
118typedef LUA_UNSIGNED lua_Unsigned; 94typedef LUA_UNSIGNED lua_Unsigned;
119 95
96/* type for continuation-function contexts */
97typedef LUA_CTXT lua_Ctx;
98
99
100/*
101** Type for C functions registered with Lua
102*/
103typedef int (*lua_CFunction) (lua_State *L);
104
105/*
106** Type for continuation functions
107*/
108typedef int (*lua_KFunction) (lua_State *L, int status, lua_Ctx ctx);
109
110
111/*
112** Type for functions that read/write blocks when loading/dumping Lua chunks
113*/
114typedef const char * (*lua_Reader) (lua_State *L, void *ud, size_t *sz);
115
116typedef int (*lua_Writer) (lua_State *L, const void *p, size_t sz, void *ud);
117
118
119/*
120** Type for memory-allocation functions
121*/
122typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize);
123
120 124
121 125
122/* 126/*
@@ -262,12 +266,12 @@ LUA_API void (lua_setuservalue) (lua_State *L, int idx);
262/* 266/*
263** 'load' and 'call' functions (load and run Lua code) 267** 'load' and 'call' functions (load and run Lua code)
264*/ 268*/
265LUA_API void (lua_callk) (lua_State *L, int nargs, int nresults, int ctx, 269LUA_API void (lua_callk) (lua_State *L, int nargs, int nresults, lua_Ctx ctx,
266 lua_KFunction k); 270 lua_KFunction k);
267#define lua_call(L,n,r) lua_callk(L, (n), (r), 0, NULL) 271#define lua_call(L,n,r) lua_callk(L, (n), (r), 0, NULL)
268 272
269LUA_API int (lua_pcallk) (lua_State *L, int nargs, int nresults, int errfunc, 273LUA_API int (lua_pcallk) (lua_State *L, int nargs, int nresults, int errfunc,
270 int ctx, lua_KFunction k); 274 lua_Ctx ctx, lua_KFunction k);
271#define lua_pcall(L,n,r,f) lua_pcallk(L, (n), (r), (f), 0, NULL) 275#define lua_pcall(L,n,r,f) lua_pcallk(L, (n), (r), (f), 0, NULL)
272 276
273LUA_API int (lua_load) (lua_State *L, lua_Reader reader, void *dt, 277LUA_API int (lua_load) (lua_State *L, lua_Reader reader, void *dt,
@@ -280,7 +284,7 @@ LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data, int strip);
280/* 284/*
281** coroutine functions 285** coroutine functions
282*/ 286*/
283LUA_API int (lua_yieldk) (lua_State *L, int nresults, int ctx, 287LUA_API int (lua_yieldk) (lua_State *L, int nresults, lua_Ctx ctx,
284 lua_KFunction k); 288 lua_KFunction k);
285#define lua_yield(L,n) lua_yieldk(L, (n), 0, NULL) 289#define lua_yield(L,n) lua_yieldk(L, (n), 0, NULL)
286LUA_API int (lua_resume) (lua_State *L, lua_State *from, int narg); 290LUA_API int (lua_resume) (lua_State *L, lua_State *from, int narg);