summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Makefile2
-rw-r--r--include/auxlib.h30
-rw-r--r--include/lua.h123
-rw-r--r--include/lualib.h19
4 files changed, 110 insertions, 64 deletions
diff --git a/include/Makefile b/include/Makefile
index e21de74d..6cd0c92d 100644
--- a/include/Makefile
+++ b/include/Makefile
@@ -4,7 +4,7 @@ LUA= ..
include $(LUA)/config
-SRCS= lua.h lualib.h luadebug.h
+SRCS= lua.h lualib.h luadebug.h auxlib.h
all:
diff --git a/include/auxlib.h b/include/auxlib.h
new file mode 100644
index 00000000..09020b46
--- /dev/null
+++ b/include/auxlib.h
@@ -0,0 +1,30 @@
+/*
+** $Id: auxlib.h,v 1.3 1997/04/07 14:48:53 roberto Exp $
+*/
+
+#ifndef auxlib_h
+#define auxlib_h
+
+#include "lua.h"
+
+struct luaL_reg {
+ char *name;
+ lua_CFunction func;
+};
+
+void luaL_openlib (struct luaL_reg *l, int n);
+void luaL_arg_check(int cond, int numarg, char *extramsg);
+char *luaL_check_string (int numArg);
+char *luaL_opt_string (int numArg, char *def);
+double luaL_check_number (int numArg);
+double luaL_opt_number (int numArg, double def);
+void luaL_verror (char *fmt, ...);
+
+
+
+/* -- private part (only for Lua modules */
+
+int luaI_findstring (char *name, char *list[]);
+
+
+#endif
diff --git a/include/lua.h b/include/lua.h
index 6a515d50..b0409d64 100644
--- a/include/lua.h
+++ b/include/lua.h
@@ -1,61 +1,50 @@
/*
-** LUA - Linguagem para Usuarios de Aplicacao
-** Grupo de Tecnologia em Computacao Grafica
-** TeCGraf - PUC-Rio
-** $Id: lua.h,v 3.32 1996/11/20 13:49:32 roberto Exp $
+** LUA - An Extensible Extension Language
+** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil
+** e-mail: lua@tecgraf.puc-rio.br
+** $Id: lua.h,v 4.11 1997/06/23 18:27:53 roberto Exp $
*/
#ifndef lua_h
#define lua_h
-#define LUA_VERSION "Lua 2.5.1"
-#define LUA_COPYRIGHT "Copyright (C) 1994-1996 TeCGraf"
+#define LUA_VERSION "Lua 3.0"
+#define LUA_COPYRIGHT "Copyright (C) 1994-1997 TeCGraf"
#define LUA_AUTHORS "W. Celes, R. Ierusalimschy & L. H. de Figueiredo"
-/* Private Part */
-
-typedef enum
-{
- LUA_T_NIL = -1,
- LUA_T_NUMBER = -2,
- LUA_T_STRING = -3,
- LUA_T_ARRAY = -4,
- LUA_T_FUNCTION = -5,
- LUA_T_CFUNCTION= -6,
- LUA_T_MARK = -7,
- LUA_T_CMARK = -8,
- LUA_T_LINE = -9,
- LUA_T_USERDATA = 0
-} lua_Type;
-
-
-/* Public Part */
-
#define LUA_NOOBJECT 0
+#define LUA_ANYTAG (-1)
+
typedef void (*lua_CFunction) (void);
typedef unsigned int lua_Object;
-lua_Object lua_setfallback (char *name, lua_CFunction fallback);
+lua_Object lua_settagmethod (int tag, char *event); /* In: new method */
+lua_Object lua_gettagmethod (int tag, char *event);
+lua_Object lua_seterrormethod (void); /* In: new method */
+
+int lua_newtag (void);
+void lua_settag (int tag); /* In: object */
void lua_error (char *s);
-int lua_dofile (char *filename);
-int lua_dostring (char *string);
-int lua_callfunction (lua_Object function);
-int lua_call (char *funcname);
+int lua_dofile (char *filename); /* Out: returns */
+int lua_dostring (char *string); /* Out: returns */
+int lua_callfunction (lua_Object f);
+ /* In: parameters; Out: returns */
void lua_beginblock (void);
void lua_endblock (void);
-lua_Object lua_getparam (int number);
-#define lua_getresult(_) lua_getparam(_)
+lua_Object lua_lua2C (int number);
+#define lua_getparam(_) lua_lua2C(_)
+#define lua_getresult(_) lua_lua2C(_)
-#define lua_isnil(_) (lua_type(_)==LUA_T_NIL)
-#define lua_istable(_) (lua_type(_)==LUA_T_ARRAY)
-#define lua_isuserdata(_) (lua_type(_)>=LUA_T_USERDATA)
-#define lua_iscfunction(_) (lua_type(_)==LUA_T_CFUNCTION)
+int lua_isnil (lua_Object object);
+int lua_istable (lua_Object object);
+int lua_isuserdata (lua_Object object);
+int lua_iscfunction (lua_Object object);
int lua_isnumber (lua_Object object);
int lua_isstring (lua_Object object);
int lua_isfunction (lua_Object object);
@@ -63,42 +52,73 @@ int lua_isfunction (lua_Object object);
float lua_getnumber (lua_Object object);
char *lua_getstring (lua_Object object);
lua_CFunction lua_getcfunction (lua_Object object);
-void *lua_getuserdata (lua_Object object);
+void *lua_getuserdata (lua_Object object);
+
void lua_pushnil (void);
void lua_pushnumber (float n);
void lua_pushstring (char *s);
void lua_pushcfunction (lua_CFunction fn);
-void lua_pushusertag (void *u, int tag);
+void lua_pushusertag (void *u, int tag);
void lua_pushobject (lua_Object object);
+lua_Object lua_pop (void);
+
lua_Object lua_getglobal (char *name);
-void lua_storeglobal (char *name);
+lua_Object lua_rawgetglobal (char *name);
+void lua_setglobal (char *name); /* In: value */
+void lua_rawsetglobal (char *name); /* In: value */
-void lua_storesubscript (void);
-lua_Object lua_getsubscript (void);
+void lua_settable (void); /* In: table, index, value */
+void lua_rawsettable (void); /* In: table, index, value */
+lua_Object lua_gettable (void); /* In: table, index */
+lua_Object lua_rawgettable (void); /* In: table, index */
-int lua_type (lua_Object object);
+int lua_tag (lua_Object object);
-int lua_ref (int lock);
+int lua_ref (int lock); /* In: value */
lua_Object lua_getref (int ref);
-void lua_pushref (int ref);
void lua_unref (int ref);
lua_Object lua_createtable (void);
+long lua_collectgarbage (long limit);
+
+/* =============================================================== */
/* some useful macros */
+#define lua_call(name) lua_callfunction(lua_getglobal(name))
+
+#define lua_pushref(ref) lua_pushobject(lua_getref(ref))
+
#define lua_refobject(o,l) (lua_pushobject(o), lua_ref(l))
-#define lua_register(n,f) (lua_pushcfunction(f), lua_storeglobal(n))
+#define lua_register(n,f) (lua_pushcfunction(f), lua_setglobal(n))
+
+#define lua_pushuserdata(u) lua_pushusertag(u, 0)
-#define lua_pushuserdata(u) lua_pushusertag(u, LUA_T_USERDATA)
-/* for compatibility with old versions. Avoid using these macros */
+
+/* ==========================================================================
+** for compatibility with old versions. Avoid using these macros/functions
+** If your program does not use any of these, define LUA_COMPAT2_5 to 0
+*/
+
+#ifndef LUA_COMPAT2_5
+#define LUA_COMPAT2_5 1
+#endif
+
+
+#if LUA_COMPAT2_5
+
+
+lua_Object lua_setfallback (char *event, lua_CFunction fallback);
+
+#define lua_storeglobal lua_setglobal
+#define lua_type lua_tag
#define lua_lockobject(o) lua_refobject(o,1)
#define lua_lock() lua_ref(1)
@@ -108,9 +128,14 @@ lua_Object lua_createtable (void);
#define lua_pushliteral(o) lua_pushstring(o)
-#define lua_getindexed(o,n) (lua_pushobject(o), lua_pushnumber(n), lua_getsubscript())
-#define lua_getfield(o,f) (lua_pushobject(o), lua_pushliteral(f), lua_getsubscript())
+#define lua_getindexed(o,n) (lua_pushobject(o), lua_pushnumber(n), lua_gettable())
+#define lua_getfield(o,f) (lua_pushobject(o), lua_pushstring(f), lua_gettable())
#define lua_copystring(o) (strdup(lua_getstring(o)))
+#define lua_getsubscript lua_gettable
+#define lua_storesubscript lua_settable
+
+#endif
+
#endif
diff --git a/include/lualib.h b/include/lualib.h
index 4fb0ed2d..38baf45e 100644
--- a/include/lualib.h
+++ b/include/lualib.h
@@ -2,7 +2,7 @@
** Libraries to be used in LUA programs
** Grupo de Tecnologia em Computacao Grafica
** TeCGraf - PUC-Rio
-** $Id: lualib.h,v 1.10 1996/08/05 20:55:24 roberto Exp $
+** $Id: lualib.h,v 1.13 1997/03/26 22:23:15 roberto Exp $
*/
#ifndef lualib_h
@@ -15,24 +15,15 @@ void strlib_open (void);
void mathlib_open (void);
+
/* auxiliar functions (private) */
-struct lua_reg {
- char *name;
- lua_CFunction func;
-};
-
-void luaI_openlib (struct lua_reg *l, int n);
-void lua_arg_check(int cond, char *funcname);
-char *lua_check_string (int numArg, char *funcname);
-char *lua_opt_string (int numArg, char *def, char *funcname);
-double lua_check_number (int numArg, char *funcname);
-long lua_opt_number (int numArg, long def, char *funcname);
char *luaI_addchar (int c);
+void luaI_emptybuff (void);
void luaI_addquoted (char *s);
-char *item_end (char *p);
-int singlematch (int c, char *p);
+char *luaL_item_end (char *p);
+int luaL_singlematch (int c, char *p);
#endif