diff options
| author | Lua Team <team@lua.org> | 2004-12-30 12:00:00 +0000 |
|---|---|---|
| committer | repogen <> | 2004-12-30 12:00:00 +0000 |
| commit | e2493a40ee611d5a718fd2a81fe67e24c04c91a0 (patch) | |
| tree | 0dca96133b3cd52d262dfa2592ad076fc0ea7852 /include | |
| parent | 226f7859b5392b6680b7e703f9cc7f7f101fd365 (diff) | |
| download | lua-github-5.1-work4.tar.gz | |
Lua 5.1-work45.1-work4
Diffstat (limited to 'include')
| -rw-r--r-- | include/Makefile | 17 | ||||
| -rw-r--r-- | include/lauxlib.h | 145 | ||||
| -rw-r--r-- | include/lua.h | 383 | ||||
| -rw-r--r-- | include/luaconf.h | 356 | ||||
| -rw-r--r-- | include/lualib.h | 47 |
5 files changed, 0 insertions, 948 deletions
diff --git a/include/Makefile b/include/Makefile deleted file mode 100644 index 687cf383..00000000 --- a/include/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -# makefile for Lua distribution (includes) - -LUA= .. - -include $(LUA)/config - -SRCS= lua.h lualib.h lauxlib.h luaconf.h - -all: - -clean: - -co: - co -q -f -M $(SRCS) - -klean: clean - rm -f $(SRCS) diff --git a/include/lauxlib.h b/include/lauxlib.h deleted file mode 100644 index b47663ce..00000000 --- a/include/lauxlib.h +++ /dev/null @@ -1,145 +0,0 @@ -/* -** $Id: lauxlib.h,v 1.73 2004/10/18 12:51:44 roberto Exp $ -** Auxiliary functions for building Lua libraries -** See Copyright Notice in lua.h -*/ - - -#ifndef lauxlib_h -#define lauxlib_h - - -#include <stddef.h> -#include <stdio.h> - -#include "lua.h" - - -/* extra error code for `luaL_load' */ -#define LUA_ERRFILE (LUA_ERRERR+1) - - -typedef struct luaL_reg { - const char *name; - lua_CFunction func; -} luaL_reg; - - -LUALIB_API void luaL_openlib (lua_State *L, const char *libname, - const luaL_reg *l, int nup); -LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *e); -LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *e); -LUALIB_API int luaL_typerror (lua_State *L, int narg, const char *tname); -LUALIB_API int luaL_argerror (lua_State *L, int numarg, const char *extramsg); -LUALIB_API const char *luaL_checklstring (lua_State *L, int numArg, size_t *l); -LUALIB_API const char *luaL_optlstring (lua_State *L, int numArg, - const char *def, size_t *l); -LUALIB_API lua_Number luaL_checknumber (lua_State *L, int numArg); -LUALIB_API lua_Number luaL_optnumber (lua_State *L, int nArg, lua_Number def); - -LUALIB_API lua_Integer luaL_checkinteger (lua_State *L, int numArg); -LUALIB_API lua_Integer luaL_optinteger (lua_State *L, int nArg, - lua_Integer def); - -LUALIB_API void luaL_checkstack (lua_State *L, int sz, const char *msg); -LUALIB_API void luaL_checktype (lua_State *L, int narg, int t); -LUALIB_API void luaL_checkany (lua_State *L, int narg); - -LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname); -LUALIB_API void luaL_getmetatable (lua_State *L, const char *tname); -LUALIB_API void *luaL_checkudata (lua_State *L, int ud, const char *tname); - -LUALIB_API void luaL_where (lua_State *L, int lvl); -LUALIB_API int luaL_error (lua_State *L, const char *fmt, ...); - -LUALIB_API int luaL_findstring (const char *st, const char *const lst[]); - -LUALIB_API const char *luaL_searchpath (lua_State *L, const char *name, - const char *path); - -LUALIB_API int luaL_ref (lua_State *L, int t); -LUALIB_API void luaL_unref (lua_State *L, int t, int ref); - -LUALIB_API int luaL_getn (lua_State *L, int t); -LUALIB_API void luaL_setn (lua_State *L, int t, int n); - -LUALIB_API int luaL_loadfile (lua_State *L, const char *filename); -LUALIB_API int luaL_loadbuffer (lua_State *L, const char *buff, size_t sz, - const char *name); - -LUALIB_API lua_State *(luaL_newstate) (void); - - -LUALIB_API const char *luaL_gsub (lua_State *L, const char *s, const char *p, - const char *r); -LUALIB_API const char *luaL_getfield (lua_State *L, int idx, const char *fname); -LUALIB_API const char *luaL_setfield (lua_State *L, int idx, const char *fname); - - - -/* -** =============================================================== -** some useful macros -** =============================================================== -*/ - -#define luaL_argcheck(L, cond,numarg,extramsg) \ - ((void)((cond) || luaL_argerror(L, (numarg), (extramsg)))) -#define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL)) -#define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL)) -#define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n))) -#define luaL_optint(L,n,d) ((int)luaL_optinteger(L, (n), (d))) -#define luaL_checklong(L,n) ((long)luaL_checkinteger(L, (n))) -#define luaL_optlong(L,n,d) ((long)luaL_optinteger(L, (n), (d))) - -#define luaL_typename(L,i) lua_typename(L, lua_type(L,(i))) - -/* -** {====================================================== -** Generic Buffer manipulation -** ======================================================= -*/ - - - -typedef struct luaL_Buffer { - char *p; /* current position in buffer */ - int lvl; /* number of strings in the stack (level) */ - lua_State *L; - char buffer[LUAL_BUFFERSIZE]; -} luaL_Buffer; - -#define luaL_putchar(B,c) \ - ((void)((B)->p < ((B)->buffer+LUAL_BUFFERSIZE) || luaL_prepbuffer(B)), \ - (*(B)->p++ = (char)(c))) - -#define luaL_addsize(B,n) ((B)->p += (n)) - -LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B); -LUALIB_API char *luaL_prepbuffer (luaL_Buffer *B); -LUALIB_API void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l); -LUALIB_API void luaL_addstring (luaL_Buffer *B, const char *s); -LUALIB_API void luaL_addvalue (luaL_Buffer *B); -LUALIB_API void luaL_pushresult (luaL_Buffer *B); - - -/* }====================================================== */ - - -/* compatibility with ref system */ - -/* pre-defined references */ -#define LUA_NOREF (-2) -#define LUA_REFNIL (-1) - -#define lua_ref(L,lock) ((lock) ? luaL_ref(L, LUA_REGISTRYINDEX) : \ - (lua_pushstring(L, "unlocked references are obsolete"), lua_error(L), 0)) - -#define lua_unref(L,ref) luaL_unref(L, LUA_REGISTRYINDEX, (ref)) - -#define lua_getref(L,ref) lua_rawgeti(L, LUA_REGISTRYINDEX, (ref)) - - -#endif - - diff --git a/include/lua.h b/include/lua.h deleted file mode 100644 index aa4401c7..00000000 --- a/include/lua.h +++ /dev/null @@ -1,383 +0,0 @@ -/* -** $Id: lua.h,v 1.196 2004/12/06 17:53:42 roberto Exp $ -** Lua - An Extensible Extension Language -** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil -** http://www.lua.org mailto:info@lua.org -** See Copyright Notice at the end of this file -*/ - - -#ifndef lua_h -#define lua_h - -#include <stdarg.h> -#include <stddef.h> - - -#include "luaconf.h" - - -#define LUA_VERSION "Lua 5.1 (work3)" -#define LUA_COPYRIGHT "Copyright (C) 1994-2004 Tecgraf, PUC-Rio" -#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo & W. Celes" - - -/* mark for precompiled code (`<esc>Lua') */ -#define LUA_SIGNATURE "\033Lua" - -/* option for multiple returns in `lua_pcall' and `lua_call' */ -#define LUA_MULTRET (-1) - - -/* -** pseudo-indices -*/ -#define LUA_REGISTRYINDEX (-10000) -#define LUA_GLOBALSINDEX (-10001) -#define lua_upvalueindex(i) (LUA_GLOBALSINDEX-(i)) - - -/* return codes for `lua_pcall', `lua_resume', and `lua_threadstatus' */ -#define LUA_YIELD 1 -#define LUA_ERRRUN 2 -#define LUA_ERRSYNTAX 3 -#define LUA_ERRMEM 4 -#define LUA_ERRERR 5 - - -typedef struct lua_State lua_State; - -typedef int (*lua_CFunction) (lua_State *L); - - -/* -** functions that read/write blocks when loading/dumping Lua chunks -*/ -typedef const char * (*lua_Chunkreader) (lua_State *L, void *ud, size_t *sz); - -typedef int (*lua_Chunkwriter) (lua_State *L, const void* p, - size_t sz, void* ud); - - -/* -** prototype for memory-allocation functions -*/ -typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize); - - -/* -** basic types -*/ -#define LUA_TNONE (-1) - -#define LUA_TNIL 0 -#define LUA_TBOOLEAN 1 -#define LUA_TLIGHTUSERDATA 2 -#define LUA_TNUMBER 3 -#define LUA_TSTRING 4 -#define LUA_TTABLE 5 -#define LUA_TFUNCTION 6 -#define LUA_TUSERDATA 7 -#define LUA_TTHREAD 8 - - -/* first index for arrays */ -#define LUA_FIRSTINDEX 1 - - -/* minimum Lua stack available to a C function */ -#define LUA_MINSTACK 20 - - -/* -** generic extra include file -*/ -#ifdef LUA_USER_H -#include LUA_USER_H -#endif - - -/* type of numbers in Lua */ -typedef LUA_NUMBER lua_Number; - - -/* type for integer functions */ -typedef LUA_INTEGER lua_Integer; - - - -/* -** state manipulation -*/ -LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud); -LUA_API void lua_close (lua_State *L); -LUA_API lua_State *lua_newthread (lua_State *L); - -LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf); - - -/* -** basic stack manipulation -*/ -LUA_API int lua_gettop (lua_State *L); -LUA_API void lua_settop (lua_State *L, int idx); -LUA_API void lua_pushvalue (lua_State *L, int idx); -LUA_API void lua_remove (lua_State *L, int idx); -LUA_API void lua_insert (lua_State *L, int idx); -LUA_API void lua_replace (lua_State *L, int idx); -LUA_API int lua_checkstack (lua_State *L, int sz); - -LUA_API void lua_xmove (lua_State *from, lua_State *to, int n); - - -/* -** access functions (stack -> C) -*/ - -LUA_API int lua_isnumber (lua_State *L, int idx); -LUA_API int lua_isstring (lua_State *L, int idx); -LUA_API int lua_iscfunction (lua_State *L, int idx); -LUA_API int lua_isuserdata (lua_State *L, int idx); -LUA_API int lua_type (lua_State *L, int idx); -LUA_API const char *lua_typename (lua_State *L, int tp); - -LUA_API int lua_equal (lua_State *L, int idx1, int idx2); -LUA_API int lua_rawequal (lua_State *L, int idx1, int idx2); -LUA_API int lua_lessthan (lua_State *L, int idx1, int idx2); - -LUA_API lua_Number lua_tonumber (lua_State *L, int idx); -LUA_API lua_Integer lua_tointeger (lua_State *L, int idx); -LUA_API int lua_toboolean (lua_State *L, int idx); -LUA_API const char *lua_tostring (lua_State *L, int idx); -LUA_API size_t lua_objsize (lua_State *L, int idx); -LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx); -LUA_API void *lua_touserdata (lua_State *L, int idx); -LUA_API lua_State *lua_tothread (lua_State *L, int idx); -LUA_API const void *lua_topointer (lua_State *L, int idx); - - -/* -** push functions (C -> stack) -*/ -LUA_API void lua_pushnil (lua_State *L); -LUA_API void lua_pushnumber (lua_State *L, lua_Number n); -LUA_API void lua_pushinteger (lua_State *L, lua_Integer n); -LUA_API void lua_pushlstring (lua_State *L, const char *s, size_t l); -LUA_API void lua_pushstring (lua_State *L, const char *s); -LUA_API const char *lua_pushvfstring (lua_State *L, const char *fmt, - va_list argp); -LUA_API const char *lua_pushfstring (lua_State *L, const char *fmt, ...); -LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n); -LUA_API void lua_pushboolean (lua_State *L, int b); -LUA_API void lua_pushlightuserdata (lua_State *L, void *p); -LUA_API int lua_pushthread (lua_State *L); - - -/* -** get functions (Lua -> stack) -*/ -LUA_API void lua_gettable (lua_State *L, int idx); -LUA_API void lua_getfield (lua_State *L, int idx, const char *k); -LUA_API void lua_rawget (lua_State *L, int idx); -LUA_API void lua_rawgeti (lua_State *L, int idx, int n); -LUA_API void lua_createtable (lua_State *L, int narr, int nrec); -LUA_API void *lua_newuserdata (lua_State *L, size_t sz); -LUA_API int lua_getmetatable (lua_State *L, int objindex); -LUA_API void lua_getfenv (lua_State *L, int idx); - - -/* -** set functions (stack -> Lua) -*/ -LUA_API void lua_settable (lua_State *L, int idx); -LUA_API void lua_setfield (lua_State *L, int idx, const char *k); -LUA_API void lua_rawset (lua_State *L, int idx); -LUA_API void lua_rawseti (lua_State *L, int idx, int n); -LUA_API int lua_setmetatable (lua_State *L, int objindex); -LUA_API int lua_setfenv (lua_State *L, int idx); - - -/* -** `load' and `call' functions (load and run Lua code) -*/ -LUA_API void lua_call (lua_State *L, int nargs, int nresults); -LUA_API int lua_pcall (lua_State *L, int nargs, int nresults, int errfunc); -LUA_API int lua_cpcall (lua_State *L, lua_CFunction func, void *ud); -LUA_API int lua_load (lua_State *L, lua_Chunkreader reader, void *dt, - const char *chunkname); - -LUA_API int lua_dump (lua_State *L, lua_Chunkwriter writer, void *data); - - -/* -** coroutine functions -*/ -LUA_API int lua_yield (lua_State *L, int nresults); -LUA_API int lua_resume (lua_State *L, int narg); -LUA_API int lua_threadstatus (lua_State *L); - -/* -** garbage-collection function and options -*/ - -#define LUA_GCSTOP 0 -#define LUA_GCRESTART 1 -#define LUA_GCCOLLECT 2 -#define LUA_GCCOUNT 3 -#define LUA_GCSTEP 4 -#define LUA_GCSETSTEPMUL 5 -#define LUA_GCSETINCMODE 6 - -LUA_API int lua_gc (lua_State *L, int what, int data); - - -/* -** miscellaneous functions -*/ - -LUA_API const char *lua_version (void); - -LUA_API int lua_error (lua_State *L); - -LUA_API int lua_next (lua_State *L, int idx); - -LUA_API void lua_concat (lua_State *L, int n); - -LUA_API lua_Alloc lua_getallocf (lua_State *L, void **ud); - - - -/* -** =============================================================== -** some useful macros -** =============================================================== -*/ - -#define lua_pop(L,n) lua_settop(L, -(n)-1) - -#define lua_newtable(L) lua_createtable(L, 0, 0) - -#define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n))) - -#define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0) - -#define lua_strlen(L,i) lua_objsize(L, (i)) - -#define lua_isfunction(L,n) (lua_type(L, (n)) == LUA_TFUNCTION) -#define lua_istable(L,n) (lua_type(L, (n)) == LUA_TTABLE) -#define lua_islightuserdata(L,n) (lua_type(L, (n)) == LUA_TLIGHTUSERDATA) -#define lua_isnil(L,n) (lua_type(L, (n)) == LUA_TNIL) -#define lua_isboolean(L,n) (lua_type(L, (n)) == LUA_TBOOLEAN) -#define lua_isthread(L,n) (lua_type(L, (n)) == LUA_TTHREAD) -#define lua_isnone(L,n) (lua_type(L, (n)) == LUA_TNONE) -#define lua_isnoneornil(L, n) (lua_type(L, (n)) <= 0) - -#define lua_pushliteral(L, s) \ - lua_pushlstring(L, "" s, (sizeof(s)/sizeof(char))-1) - -#define lua_setglobal(L,s) lua_setfield(L, LUA_GLOBALSINDEX, (s)) -#define lua_getglobal(L,s) lua_getfield(L, LUA_GLOBALSINDEX, (s)) - - - -/* -** compatibility macros and functions -*/ - -#define lua_open() luaL_newstate() - -#define lua_getregistry(L) lua_pushvalue(L, LUA_REGISTRYINDEX) - -#define lua_getgccount(L) lua_gc(L, LUA_GCCOUNT, 0) - - - - - -/* -** {====================================================================== -** Debug API -** ======================================================================= -*/ - - -/* -** Event codes -*/ -#define LUA_HOOKCALL 0 -#define LUA_HOOKRET 1 -#define LUA_HOOKLINE 2 -#define LUA_HOOKCOUNT 3 -#define LUA_HOOKTAILRET 4 - - -/* -** Event masks -*/ -#define LUA_MASKCALL (1 << LUA_HOOKCALL) -#define LUA_MASKRET (1 << LUA_HOOKRET) -#define LUA_MASKLINE (1 << LUA_HOOKLINE) -#define LUA_MASKCOUNT (1 << LUA_HOOKCOUNT) - -typedef struct lua_Debug lua_Debug; /* activation record */ - -typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar); - - -LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar); -LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar); -LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n); -LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n); -LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n); -LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n); - -LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count); -LUA_API lua_Hook lua_gethook (lua_State *L); -LUA_API int lua_gethookmask (lua_State *L); -LUA_API int lua_gethookcount (lua_State *L); - - -#define LUA_IDSIZE 60 - -struct lua_Debug { - int event; - const char *name; /* (n) */ - const char *namewhat; /* (n) `global', `local', `field', `method' */ - const char *what; /* (S) `Lua', `C', `main', `tail' */ - const char *source; /* (S) */ - int currentline; /* (l) */ - int nups; /* (u) number of upvalues */ - int linedefined; /* (S) */ - char short_src[LUA_IDSIZE]; /* (S) */ - /* private part */ - int i_ci; /* active function */ -}; - -/* }====================================================================== */ - - -/****************************************************************************** -* Copyright (C) 1994-2004 Tecgraf, PUC-Rio. All rights reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining -* a copy of this software and associated documentation files (the -* "Software"), to deal in the Software without restriction, including -* without limitation the rights to use, copy, modify, merge, publish, -* distribute, sublicense, and/or sell copies of the Software, and to -* permit persons to whom the Software is furnished to do so, subject to -* the following conditions: -* -* The above copyright notice and this permission notice shall be -* included in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -******************************************************************************/ - - -#endif diff --git a/include/luaconf.h b/include/luaconf.h deleted file mode 100644 index f00bbd05..00000000 --- a/include/luaconf.h +++ /dev/null @@ -1,356 +0,0 @@ -/* -** $Id: luaconf.h,v 1.20 2004/12/06 17:53:42 roberto Exp $ -** Configuration file for Lua -** See Copyright Notice in lua.h -*/ - - -#ifndef lconfig_h -#define lconfig_h - -#include <limits.h> -#include <stddef.h> - - -/* -** {====================================================== -** Index (search for keyword to find corresponding entry) -** ======================================================= -*/ - - -/* }====================================================== */ - - - - -/* -** {====================================================== -** Generic configuration -** ======================================================= -*/ - -/* default path */ -#define LUA_PATH_DEFAULT \ - "./?.lua;/usr/local/share/lua/5.0/?.lua;/usr/local/share/lua/5.0/?/init.lua" -#define LUA_CPATH_DEFAULT \ - "./?.so;/usr/local/lib/lua/5.0/?.so;/usr/local/lib/lua/5.0/lib?.so" - - - -/* type of numbers in Lua */ -#define LUA_NUMBER double - -/* formats for Lua numbers */ -#define LUA_NUMBER_SCAN "%lf" -#define LUA_NUMBER_FMT "%.14g" - - -/* -** type for integer functions -** on most machines, `ptrdiff_t' gives a reasonable size for integers -*/ -#define LUA_INTEGER ptrdiff_t - - -/* mark for all API functions */ -#define LUA_API extern - -/* mark for auxlib functions */ -#define LUALIB_API extern - -/* buffer size used by lauxlib buffer system */ -#define LUAL_BUFFERSIZE BUFSIZ - - -/* assertions in Lua (mainly for internal debugging) */ -#define lua_assert(c) ((void)0) - -/* }====================================================== */ - - - -/* -** {====================================================== -** Stand-alone configuration -** ======================================================= -*/ - -#ifdef lua_c - -/* definition of `isatty' */ -#ifdef _POSIX_C_SOURCE -#include <unistd.h> -#define stdin_is_tty() isatty(0) -#else -#define stdin_is_tty() 1 /* assume stdin is a tty */ -#endif - - -#define PROMPT "> " -#define PROMPT2 ">> " -#define PROGNAME "lua" - - -/* -** this macro allows you to open other libraries when starting the -** stand-alone interpreter -*/ -#define lua_userinit(L) luaopen_stdlibs(L) -/* -** #define lua_userinit(L) { int luaopen_mylibs(lua_State *L); \ -** luaopen_stdlibs(L); luaopen_mylibs(L); } -*/ - - - -/* -** this macro can be used by some `history' system to save lines -** read in manual input -*/ -#define lua_saveline(L,line) /* empty */ - - - -#endif - -/* }====================================================== */ - - - -/* -** {====================================================== -** Core configuration -** ======================================================= -*/ - -#ifdef LUA_CORE - -/* LUA-C API assertions */ -#define api_check(L,o) lua_assert(o) - - -/* number of bits in an `int' */ -/* avoid overflows in comparison */ -#if INT_MAX-20 < 32760 -#define LUA_BITSINT 16 -#elif INT_MAX > 2147483640L -/* `int' has at least 32 bits */ -#define LUA_BITSINT 32 -#else -#error "you must define LUA_BITSINT with number of bits in an integer" -#endif - - -/* -** L_UINT32: unsigned integer with at least 32 bits -** L_INT32: signed integer with at least 32 bits -** LU_MEM: an unsigned integer big enough to count the total memory used by Lua -** L_MEM: a signed integer big enough to count the total memory used by Lua -*/ -#if LUA_BITSINT >= 32 -#define LUA_UINT32 unsigned int -#define LUA_INT32 int -#define LUA_MAXINT32 INT_MAX -#define LU_MEM size_t -#define L_MEM ptrdiff_t -#else -/* 16-bit ints */ -#define LUA_UINT32 unsigned long -#define LUA_INT32 long -#define LUA_MAXINT32 LONG_MAX -#define LU_MEM LUA_UINT32 -#define L_MEM ptrdiff_t -#endif - - -/* maximum depth for calls (unsigned short) */ -#define LUA_MAXCALLS 10000 - -/* -** maximum depth for C calls (unsigned short): Not too big, or may -** overflow the C stack... -*/ -#define LUA_MAXCCALLS 200 - - -/* maximum size for the virtual stack of a C function */ -#define MAXCSTACK 2048 - - -/* -** maximum number of syntactical nested non-terminals: Not too big, -** or may overflow the C stack... -*/ -#define LUA_MAXPARSERLEVEL 200 - - -/* maximum number of variables declared in a function */ -#define MAXVARS 200 /* <MAXSTACK */ - - -/* maximum number of upvalues per function */ -#define MAXUPVALUES 60 /* <MAXSTACK */ - - -/* maximum size of expressions for optimizing `while' code */ -#define MAXEXPWHILE 100 - - -/* function to convert a lua_Number to int (with any rounding method) */ -#if defined(__GNUC__) && defined(__i386) -#define lua_number2int(i,d) __asm__ ("fistpl %0":"=m"(i):"t"(d):"st") -#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199900L) -/* on machines compliant with C99, you can try `lrint' */ -#include <math.h> -#define lua_number2int(i,d) ((i)=lrint(d)) -#else -#define lua_number2int(i,d) ((i)=(int)(d)) -#endif - -/* function to convert a lua_Number to lua_Integer (with any rounding method) */ -#define lua_number2integer(i,n) lua_number2int((i), (n)) - - -/* function to convert a lua_Number to a string */ -#include <stdio.h> -#define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n)) - -/* function to convert a string to a lua_Number */ -#define lua_str2number(s,p) strtod((s), (p)) - - - -/* result of a `usual argument conversion' over lua_Number */ -#define LUA_UACNUMBER double - - - -/* type to ensure maximum alignment */ -#define LUSER_ALIGNMENT_T union { double u; void *s; long l; } - - -/* exception handling */ -#ifndef __cplusplus -/* default handling with long jumps */ -#include <setjmp.h> -#define L_THROW(L,c) longjmp((c)->b, 1) -#define L_TRY(L,c,a) if (setjmp((c)->b) == 0) { a } -#define l_jmpbuf jmp_buf - -#else -/* C++ exceptions */ -#define L_THROW(L,c) throw(c) -#define L_TRY(L,c,a) try { a } catch(...) \ - { if ((c)->status == 0) (c)->status = -1; } -#define l_jmpbuf int /* dummy variable */ -#endif - - - -/* -** macros for thread synchronization inside Lua core machine: -** all accesses to the global state and to global objects are synchronized. -** Because threads can read the stack of other threads -** (when running garbage collection), -** a thread must also synchronize any write-access to its own stack. -** Unsynchronized accesses are allowed only when reading its own stack, -** or when reading immutable fields from global objects -** (such as string values and udata values). -*/ -#define lua_lock(L) ((void) 0) -#define lua_unlock(L) ((void) 0) - -/* -** this macro allows a thread switch in appropriate places in the Lua -** core -*/ -#define lua_threadyield(L) {lua_unlock(L); lua_lock(L);} - - - -/* allows user-specific initialization on new threads */ -#define lua_userstateopen(L) /* empty */ - - -/* initial GC parameters */ -#define STEPMUL 4 - -#endif - -/* }====================================================== */ - - - -/* -** {====================================================== -** Library configuration -** ======================================================= -*/ - -#ifdef LUA_LIB - - - -/* `assert' options */ - -/* environment variables that hold the search path for packages */ -#define LUA_PATH "LUA_PATH" -#define LUA_CPATH "LUA_CPATH" - -/* prefix for open functions in C libraries */ -#if defined(__APPLE__) && defined(__MACH__) -#define LUA_POF "_luaopen_" -#else -#define LUA_POF "luaopen_" -#endif - -/* directory separator (for submodules) */ -#define LUA_DIRSEP "/" - -/* separator of templates in a path */ -#define LUA_PATH_SEP ';' - -/* wild char in each template */ -#define LUA_PATH_MARK "?" - - -/* maximum number of captures in pattern-matching */ -#define MAX_CAPTURES 32 /* arbitrary limit */ - - -/* -** by default, gcc does not get `tmpname' -*/ -#ifdef __GNUC__ -#define USE_TMPNAME 0 -#else -#define USE_TMPNAME 1 -#endif - - -/* -** Configuration for loadlib -*/ -#if defined(__linux) || defined(sun) || defined(sgi) || defined(BSD) -#define USE_DLOPEN -#elif defined(_WIN32) -#define USE_DLL -#elif defined(__APPLE__) && defined(__MACH__) -#define USE_DYLD -#endif - - -#endif - -/* }====================================================== */ - - - - -/* Local configuration */ - -#undef USE_TMPNAME -#define USE_TMPNAME 1 - -#endif diff --git a/include/lualib.h b/include/lualib.h deleted file mode 100644 index c8114ed2..00000000 --- a/include/lualib.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -** $Id: lualib.h,v 1.32 2004/07/09 15:47:48 roberto Exp $ -** Lua standard libraries -** See Copyright Notice in lua.h -*/ - - -#ifndef lualib_h -#define lualib_h - -#include "lua.h" - - -/* Key to file-handle type */ -#define LUA_FILEHANDLE "FILE*" - - -#define LUA_COLIBNAME "coroutine" -LUALIB_API int luaopen_base (lua_State *L); - -#define LUA_TABLIBNAME "table" -LUALIB_API int luaopen_table (lua_State *L); - -#define LUA_IOLIBNAME "io" -LUALIB_API int luaopen_io (lua_State *L); - -#define LUA_OSLIBNAME "os" -LUALIB_API int luaopen_os (lua_State *L); - -#define LUA_STRLIBNAME "string" -LUALIB_API int luaopen_string (lua_State *L); - -#define LUA_MATHLIBNAME "math" -LUALIB_API int luaopen_math (lua_State *L); - -#define LUA_DBLIBNAME "debug" -LUALIB_API int luaopen_debug (lua_State *L); - - -LUALIB_API int luaopen_loadlib (lua_State *L); - - -/* open all previous libraries */ -LUALIB_API int luaopen_stdlibs (lua_State *L); - - -#endif |
