summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Makefile4
-rw-r--r--include/auxlib.h30
-rw-r--r--include/lauxlib.h47
-rw-r--r--include/lua.h87
-rw-r--r--include/luadebug.h10
-rw-r--r--include/lualib.h31
6 files changed, 144 insertions, 65 deletions
diff --git a/include/Makefile b/include/Makefile
index 6cd0c92d..48f12a79 100644
--- a/include/Makefile
+++ b/include/Makefile
@@ -4,14 +4,14 @@ LUA= ..
include $(LUA)/config
-SRCS= lua.h lualib.h luadebug.h auxlib.h
+SRCS= lua.h lualib.h luadebug.h lauxlib.h
all:
clean:
co:
- co -f -M $(SRCS)
+ co -q -f -M $(SRCS)
klean: clean
rm -f $(SRCS)
diff --git a/include/auxlib.h b/include/auxlib.h
deleted file mode 100644
index 09020b46..00000000
--- a/include/auxlib.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
-** $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/lauxlib.h b/include/lauxlib.h
new file mode 100644
index 00000000..e4d46fb5
--- /dev/null
+++ b/include/lauxlib.h
@@ -0,0 +1,47 @@
+/*
+** $Id: lauxlib.h,v 1.9 1998/06/19 16:14:09 roberto Exp $
+** Auxiliary functions for building Lua libraries
+** See Copyright Notice in lua.h
+*/
+
+
+#ifndef auxlib_h
+#define auxlib_h
+
+
+#include "lua.h"
+
+
+struct luaL_reg {
+ char *name;
+ lua_CFunction func;
+};
+
+
+#define luaL_arg_check(cond,numarg,extramsg) if (!(cond)) \
+ luaL_argerror(numarg,extramsg)
+
+void luaL_openlib (struct luaL_reg *l, int n);
+void luaL_argerror (int numarg, char *extramsg);
+#define luaL_check_string(n) (luaL_check_lstr((n), NULL))
+char *luaL_check_lstr (int numArg, long *len);
+#define luaL_opt_string(n, d) (luaL_opt_lstr((n), (d), NULL))
+char *luaL_opt_lstr (int numArg, char *def, long *len);
+double luaL_check_number (int numArg);
+double luaL_opt_number (int numArg, double def);
+lua_Object luaL_functionarg (int arg);
+lua_Object luaL_tablearg (int arg);
+lua_Object luaL_nonnullarg (int numArg);
+void luaL_verror (char *fmt, ...);
+char *luaL_openspace (int size);
+void luaL_resetbuffer (void);
+void luaL_addchar (int c);
+int luaL_getsize (void);
+void luaL_addsize (int n);
+int luaL_newbuffer (int size);
+void luaL_oldbuffer (int old);
+char *luaL_buffer (void);
+int luaL_findstring (char *name, char *list[]);
+
+
+#endif
diff --git a/include/lua.h b/include/lua.h
index b0409d64..bce5a2c7 100644
--- a/include/lua.h
+++ b/include/lua.h
@@ -1,16 +1,18 @@
/*
-** LUA - An Extensible Extension Language
+** $Id: lua.h,v 1.23 1998/06/18 16:51:53 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 $
+** www: http://www.tecgraf.puc-rio.br/lua/
+** See Copyright Notice at the end of this file
*/
#ifndef lua_h
#define lua_h
-#define LUA_VERSION "Lua 3.0"
-#define LUA_COPYRIGHT "Copyright (C) 1994-1997 TeCGraf"
+#define LUA_VERSION "Lua 3.1"
+#define LUA_COPYRIGHT "Copyright (C) 1994-1998 TeCGraf, PUC-Rio"
#define LUA_AUTHORS "W. Celes, R. Ierusalimschy & L. H. de Figueiredo"
@@ -21,16 +23,26 @@
typedef void (*lua_CFunction) (void);
typedef unsigned int lua_Object;
-lua_Object lua_settagmethod (int tag, char *event); /* In: new method */
+typedef struct lua_State lua_State;
+extern lua_State *lua_state;
+
+void lua_open (void);
+void lua_close (void);
+lua_State *lua_setstate (lua_State *st);
+
+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);
+int lua_copytagmethods (int tagto, int tagfrom);
void lua_settag (int tag); /* In: object */
void lua_error (char *s);
int lua_dofile (char *filename); /* Out: returns */
int lua_dostring (char *string); /* Out: returns */
+int lua_dobuffer (char *buff, int size, char *name);
+ /* Out: returns */
int lua_callfunction (lua_Object f);
/* In: parameters; Out: returns */
@@ -49,16 +61,18 @@ int lua_isnumber (lua_Object object);
int lua_isstring (lua_Object object);
int lua_isfunction (lua_Object object);
-float lua_getnumber (lua_Object object);
+double lua_getnumber (lua_Object object);
char *lua_getstring (lua_Object object);
+long lua_strlen (lua_Object object);
lua_CFunction lua_getcfunction (lua_Object object);
void *lua_getuserdata (lua_Object object);
void lua_pushnil (void);
-void lua_pushnumber (float n);
+void lua_pushnumber (double n);
+void lua_pushlstring (char *s, long len);
void lua_pushstring (char *s);
-void lua_pushcfunction (lua_CFunction fn);
+void lua_pushcclosure (lua_CFunction fn, int n);
void lua_pushusertag (void *u, int tag);
void lua_pushobject (lua_Object object);
@@ -87,32 +101,37 @@ long lua_collectgarbage (long limit);
/* =============================================================== */
-/* some useful macros */
+/* some useful macros/derived functions */
+int (lua_call) (char *name);
#define lua_call(name) lua_callfunction(lua_getglobal(name))
+void (lua_pushref) (int ref);
#define lua_pushref(ref) lua_pushobject(lua_getref(ref))
+int (lua_refobject) (lua_Object o, int l);
#define lua_refobject(o,l) (lua_pushobject(o), lua_ref(l))
+void (lua_register) (char *n, lua_CFunction f);
#define lua_register(n,f) (lua_pushcfunction(f), lua_setglobal(n))
+void (lua_pushuserdata) (void *u);
#define lua_pushuserdata(u) lua_pushusertag(u, 0)
+void (lua_pushcfunction) (lua_CFunction f);
+#define lua_pushcfunction(f) lua_pushcclosure(f, 0)
+int (lua_clonetag) (int t);
+#define lua_clonetag(t) lua_copytagmethods(lua_newtag(), (t))
-/* ==========================================================================
+/* ==========================================================================
** 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
+** If your program does need any of these, define LUA_COMPAT2_5
*/
-#ifndef LUA_COMPAT2_5
-#define LUA_COMPAT2_5 1
-#endif
-
-#if LUA_COMPAT2_5
+#ifdef LUA_COMPAT2_5
lua_Object lua_setfallback (char *event, lua_CFunction fallback);
@@ -139,3 +158,39 @@ lua_Object lua_setfallback (char *event, lua_CFunction fallback);
#endif
#endif
+
+
+
+/******************************************************************************
+* Copyright (c) 1994-1998 TeCGraf, PUC-Rio. All rights reserved.
+*
+* Permission is hereby granted, without written agreement and without license
+* or royalty fees, to use, copy, modify, and distribute this software and its
+* documentation for any purpose, including commercial applications, subject to
+* the following conditions:
+*
+* - The above copyright notice and this permission notice shall appear in all
+* copies or substantial portions of this software.
+*
+* - The origin of this software must not be misrepresented; you must not
+* claim that you wrote the original software. If you use this software in a
+* product, an acknowledgment in the product documentation would be greatly
+* appreciated (but it is not required).
+*
+* - Altered source versions must be plainly marked as such, and must not be
+* misrepresented as being the original software.
+*
+* The authors specifically disclaim any warranties, including, but not limited
+* to, the implied warranties of merchantability and fitness for a particular
+* purpose. The software provided hereunder is on an "as is" basis, and the
+* authors have no obligation to provide maintenance, support, updates,
+* enhancements, or modifications. In no event shall TeCGraf, PUC-Rio, or the
+* authors be held liable to any party for direct, indirect, special,
+* incidental, or consequential damages arising out of the use of this software
+* and its documentation.
+*
+* The Lua language and this implementation have been entirely designed and
+* written by Waldemar Celes Filho, Roberto Ierusalimschy and
+* Luiz Henrique de Figueiredo at TeCGraf, PUC-Rio.
+* This implementation contains no third-party code.
+******************************************************************************/
diff --git a/include/luadebug.h b/include/luadebug.h
index 9392967c..36726f7f 100644
--- a/include/luadebug.h
+++ b/include/luadebug.h
@@ -1,14 +1,14 @@
/*
-** LUA - Linguagem para Usuarios de Aplicacao
-** Grupo de Tecnologia em Computacao Grafica
-** TeCGraf - PUC-Rio
-** $Id: luadebug.h,v 1.6 1996/03/20 17:05:44 roberto Exp $
+** $Id: luadebug.h,v 1.2 1998/06/19 16:14:09 roberto Exp $
+** Debugging API
+** See Copyright Notice in lua.h
*/
#ifndef luadebug_h
#define luadebug_h
+
#include "lua.h"
typedef lua_Object lua_Function;
@@ -24,8 +24,10 @@ char *lua_getobjname (lua_Object o, char **name);
lua_Object lua_getlocal (lua_Function func, int local_number, char **name);
int lua_setlocal (lua_Function func, int local_number);
+
extern lua_LHFunction lua_linehook;
extern lua_CHFunction lua_callhook;
extern int lua_debug;
+
#endif
diff --git a/include/lualib.h b/include/lualib.h
index 38baf45e..583f1b54 100644
--- a/include/lualib.h
+++ b/include/lualib.h
@@ -1,29 +1,34 @@
/*
-** Libraries to be used in LUA programs
-** Grupo de Tecnologia em Computacao Grafica
-** TeCGraf - PUC-Rio
-** $Id: lualib.h,v 1.13 1997/03/26 22:23:15 roberto Exp $
+** $Id: lualib.h,v 1.4 1998/06/19 16:14:09 roberto Exp $
+** Lua standard libraries
+** See Copyright Notice in lua.h
*/
+
#ifndef lualib_h
#define lualib_h
#include "lua.h"
-void iolib_open (void);
-void strlib_open (void);
-void mathlib_open (void);
+void lua_iolibopen (void);
+void lua_strlibopen (void);
+void lua_mathlibopen (void);
+
+
+
+
+/* To keep compatibility with old versions */
+
+#define iolib_open lua_iolibopen
+#define strlib_open lua_strlibopen
+#define mathlib_open lua_mathlibopen
-/* auxiliar functions (private) */
-char *luaI_addchar (int c);
-void luaI_emptybuff (void);
-void luaI_addquoted (char *s);
+/* Auxiliary functions (private) */
-char *luaL_item_end (char *p);
-int luaL_singlematch (int c, char *p);
+int luaI_singlematch (int c, char *p, char **ep);
#endif