diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-04-14 14:46:37 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-04-14 14:46:37 -0300 |
commit | e02750ec60189e15b68fe5a6b9d9a9a802b47def (patch) | |
tree | eb0d04be2a50e8a6501155866565b40fe6bc8f9f | |
parent | 0b56646bafa5e83a689c42313d9d1e598ad7e591 (diff) | |
download | lua-e02750ec60189e15b68fe5a6b9d9a9a802b47def.tar.gz lua-e02750ec60189e15b68fe5a6b9d9a9a802b47def.tar.bz2 lua-e02750ec60189e15b68fe5a6b9d9a9a802b47def.zip |
new type for CFunction (for "pure" C)
-rw-r--r-- | lua.h | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lua.h,v 1.44 1999/12/30 18:29:46 roberto Exp roberto $ | 2 | ** $Id: lua.h,v 1.45 2000/03/27 14:00:35 roberto Exp roberto $ |
3 | ** Lua - An Extensible Extension Language | 3 | ** Lua - An Extensible Extension Language |
4 | ** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil | 4 | ** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil |
5 | ** e-mail: lua@tecgraf.puc-rio.br | 5 | ** e-mail: lua@tecgraf.puc-rio.br |
@@ -23,7 +23,7 @@ | |||
23 | 23 | ||
24 | typedef struct lua_State lua_State; | 24 | typedef struct lua_State lua_State; |
25 | 25 | ||
26 | typedef void (*lua_CFunction) ( /* lua_State *L */ ); | 26 | typedef void (*lua_CFunction) (lua_State *L); |
27 | 27 | ||
28 | typedef struct TObject *lua_Object; | 28 | typedef struct TObject *lua_Object; |
29 | 29 | ||
@@ -154,7 +154,7 @@ lua_Object lua_seterrormethod (lua_State *L); /* In: new method */ | |||
154 | 154 | ||
155 | extern lua_State *lua_state; | 155 | extern lua_State *lua_state; |
156 | 156 | ||
157 | #define lua_open() ((void)(lua_state?0:(lua_state=lua_newstate(NULL)))) | 157 | #define lua_open() ((void)(lua_state?0:(lua_state=lua_newstate(0)))) |
158 | 158 | ||
159 | #define lua_close() (lua_close)(lua_state) | 159 | #define lua_close() (lua_close)(lua_state) |
160 | #define lua_settagmethod(tag,event) (lua_settagmethod)(lua_state, tag,event) | 160 | #define lua_settagmethod(tag,event) (lua_settagmethod)(lua_state, tag,event) |
@@ -188,7 +188,6 @@ extern lua_State *lua_state; | |||
188 | #define lua_pushnumber(n) (lua_pushnumber)(lua_state, n) | 188 | #define lua_pushnumber(n) (lua_pushnumber)(lua_state, n) |
189 | #define lua_pushlstring(s,len) (lua_pushlstring)(lua_state, s,len) | 189 | #define lua_pushlstring(s,len) (lua_pushlstring)(lua_state, s,len) |
190 | #define lua_pushstring(s) (lua_pushstring)(lua_state, s) | 190 | #define lua_pushstring(s) (lua_pushstring)(lua_state, s) |
191 | #define lua_pushcclosure(fn,n) (lua_pushcclosure)(lua_state, fn,n) | ||
192 | #define lua_pushusertag(u,tag) (lua_pushusertag)(lua_state, u,tag) | 191 | #define lua_pushusertag(u,tag) (lua_pushusertag)(lua_state, u,tag) |
193 | #define lua_pushobject(obj) (lua_pushobject)(lua_state, obj) | 192 | #define lua_pushobject(obj) (lua_pushobject)(lua_state, obj) |
194 | #define lua_pop() (lua_pop)(lua_state) | 193 | #define lua_pop() (lua_pop)(lua_state) |
@@ -209,6 +208,12 @@ extern lua_State *lua_state; | |||
209 | #define lua_createtable() (lua_createtable)(lua_state) | 208 | #define lua_createtable() (lua_createtable)(lua_state) |
210 | #define lua_collectgarbage(limit) (lua_collectgarbage)(lua_state, limit) | 209 | #define lua_collectgarbage(limit) (lua_collectgarbage)(lua_state, limit) |
211 | #define lua_seterrormethod() (lua_seterrormethod)(lua_state) | 210 | #define lua_seterrormethod() (lua_seterrormethod)(lua_state) |
211 | /* | ||
212 | ** the following typecast is a little dirty, but we cannot find another | ||
213 | ** way to keep compatibility with old definition of `lua_CFunction' | ||
214 | */ | ||
215 | #define lua_pushcclosure(fn,n) \ | ||
216 | (lua_pushcclosure)(lua_state, (lua_CFunction)(fn), n) | ||
212 | 217 | ||
213 | #endif | 218 | #endif |
214 | 219 | ||
@@ -217,6 +222,7 @@ extern lua_State *lua_state; | |||
217 | 222 | ||
218 | 223 | ||
219 | 224 | ||
225 | |||
220 | /****************************************************************************** | 226 | /****************************************************************************** |
221 | * Copyright (C) 1994-2000 TeCGraf, PUC-Rio. All rights reserved. | 227 | * Copyright (C) 1994-2000 TeCGraf, PUC-Rio. All rights reserved. |
222 | * | 228 | * |