summaryrefslogtreecommitdiff
path: root/lib/lua
diff options
context:
space:
mode:
Diffstat (limited to 'lib/lua')
-rw-r--r--lib/lua/include/lauxlib.h298
-rw-r--r--lib/lua/include/lua.h800
-rw-r--r--lib/lua/include/lualib.h132
-rw-r--r--lib/lua/includes/lapi.h32
-rw-r--r--lib/lua/includes/lcode.h148
-rw-r--r--lib/lua/includes/ldebug.h62
-rw-r--r--lib/lua/includes/ldo.h120
-rw-r--r--lib/lua/includes/lfunc.h50
-rw-r--r--lib/lua/includes/lgc.h50
-rw-r--r--lib/lua/includes/llex.h150
-rw-r--r--lib/lua/includes/llimits.h370
-rw-r--r--lib/lua/includes/lmem.h88
-rw-r--r--lib/lua/includes/lobject.h672
-rw-r--r--lib/lua/includes/lopcodes.h476
-rw-r--r--lib/lua/includes/lparser.h142
-rw-r--r--lib/lua/includes/lstate.h400
-rw-r--r--lib/lua/includes/lstring.h66
-rw-r--r--lib/lua/includes/ltable.h62
-rw-r--r--lib/lua/includes/ltm.h102
-rw-r--r--lib/lua/includes/lundump.h68
-rw-r--r--lib/lua/includes/lvm.h70
-rw-r--r--lib/lua/includes/lzio.h128
22 files changed, 2243 insertions, 2243 deletions
diff --git a/lib/lua/include/lauxlib.h b/lib/lua/include/lauxlib.h
index 1c79c15..dd4dd7b 100644
--- a/lib/lua/include/lauxlib.h
+++ b/lib/lua/include/lauxlib.h
@@ -1,149 +1,149 @@
-/*
-** $Id: lauxlib.h,v 1.3 2003-12-11 16:53:28 pixel 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"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef LUALIB_API
-#define LUALIB_API LUA_API
-#endif
-
-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 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 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);
-
-
-
-/*
-** ===============================================================
-** some useful macros
-** ===============================================================
-*/
-
-#define luaL_argcheck(L, cond,numarg,extramsg) if (!(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_checknumber(L, n))
-#define luaL_checklong(L,n) ((long)luaL_checknumber(L, n))
-#define luaL_optint(L,n,d) ((int)luaL_optnumber(L, n,(lua_Number)(d)))
-#define luaL_optlong(L,n,d) ((long)luaL_optnumber(L, n,(lua_Number)(d)))
-
-
-/*
-** {======================================================
-** Generic Buffer manipulation
-** =======================================================
-*/
-
-
-#ifndef LUAL_BUFFERSIZE
-#define LUAL_BUFFERSIZE BUFSIZ
-#endif
-
-
-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 macros and functions
-*/
-
-LUALIB_API int lua_dofile (lua_State *L, const char *filename);
-LUALIB_API int lua_dostring (lua_State *L, const char *str);
-LUALIB_API int lua_dobuffer (lua_State *L, const char *buff, size_t sz,
- const char *n);
-
-
-#define luaL_check_lstr luaL_checklstring
-#define luaL_opt_lstr luaL_optlstring
-#define luaL_check_number luaL_checknumber
-#define luaL_opt_number luaL_optnumber
-#define luaL_arg_check luaL_argcheck
-#define luaL_check_string luaL_checkstring
-#define luaL_opt_string luaL_optstring
-#define luaL_check_int luaL_checkint
-#define luaL_check_long luaL_checklong
-#define luaL_opt_int luaL_optint
-#define luaL_opt_long luaL_optlong
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-
+/*
+** $Id: lauxlib.h,v 1.4 2004-11-27 21:43:49 pixel 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"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef LUALIB_API
+#define LUALIB_API LUA_API
+#endif
+
+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 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 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);
+
+
+
+/*
+** ===============================================================
+** some useful macros
+** ===============================================================
+*/
+
+#define luaL_argcheck(L, cond,numarg,extramsg) if (!(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_checknumber(L, n))
+#define luaL_checklong(L,n) ((long)luaL_checknumber(L, n))
+#define luaL_optint(L,n,d) ((int)luaL_optnumber(L, n,(lua_Number)(d)))
+#define luaL_optlong(L,n,d) ((long)luaL_optnumber(L, n,(lua_Number)(d)))
+
+
+/*
+** {======================================================
+** Generic Buffer manipulation
+** =======================================================
+*/
+
+
+#ifndef LUAL_BUFFERSIZE
+#define LUAL_BUFFERSIZE BUFSIZ
+#endif
+
+
+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 macros and functions
+*/
+
+LUALIB_API int lua_dofile (lua_State *L, const char *filename);
+LUALIB_API int lua_dostring (lua_State *L, const char *str);
+LUALIB_API int lua_dobuffer (lua_State *L, const char *buff, size_t sz,
+ const char *n);
+
+
+#define luaL_check_lstr luaL_checklstring
+#define luaL_opt_lstr luaL_optlstring
+#define luaL_check_number luaL_checknumber
+#define luaL_opt_number luaL_optnumber
+#define luaL_arg_check luaL_argcheck
+#define luaL_check_string luaL_checkstring
+#define luaL_opt_string luaL_optstring
+#define luaL_check_int luaL_checkint
+#define luaL_check_long luaL_checklong
+#define luaL_opt_int luaL_optint
+#define luaL_opt_long luaL_optlong
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
diff --git a/lib/lua/include/lua.h b/lib/lua/include/lua.h
index 109b16e..87e69af 100644
--- a/lib/lua/include/lua.h
+++ b/lib/lua/include/lua.h
@@ -1,400 +1,400 @@
-/*
-** $Id: lua.h,v 1.4 2004-07-23 13:08:23 pixel 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>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define LUA_VERSION "Lua 5.0"
-#define LUA_COPYRIGHT "Copyright (C) 1994-2003 Tecgraf, PUC-Rio"
-#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo & W. Celes"
-
-
-
-/* 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))
-
-
-/* error codes for `lua_load' and `lua_pcall' */
-#define LUA_ERRRUN 1
-#define LUA_ERRFILE 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);
-
-
-/*
-** 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
-
-
-/* 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 */
-#ifndef LUA_NUMBER
-typedef double lua_Number;
-#else
-typedef LUA_NUMBER lua_Number;
-#endif
-
-
-/* mark for all API functions */
-#ifndef LUA_API
-#define LUA_API extern
-#endif
-
-
-/*
-** state manipulation
-*/
-LUA_API lua_State *lua_open (void);
-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 int lua_toboolean (lua_State *L, int idx);
-LUA_API const char *lua_tostring (lua_State *L, int idx);
-LUA_API size_t lua_strlen (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_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);
-
-
-/*
-** get functions (Lua -> stack)
-*/
-LUA_API void lua_gettable (lua_State *L, int idx);
-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_newtable (lua_State *L);
-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_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);
-
-/*
-** garbage-collection functions
-*/
-LUA_API int lua_getgcthreshold (lua_State *L);
-LUA_API int lua_getgccount (lua_State *L);
-LUA_API void lua_setgcthreshold (lua_State *L, int newthreshold);
-
-/*
-** 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 void lua_break (lua_State *L);
-
-
-
-/*
-** ===============================================================
-** some useful macros
-** ===============================================================
-*/
-
-#define lua_boxpointer(L,u) \
- (*(void **)(lua_newuserdata(L, sizeof(void *))) = (u))
-
-#define lua_unboxpointer(L,i) (*(void **)(lua_touserdata(L, i)))
-
-#define lua_pop(L,n) lua_settop(L, -(n)-1)
-
-#define lua_register(L,n,f) \
- (lua_pushstring(L, n), \
- lua_pushcfunction(L, f), \
- lua_settable(L, LUA_GLOBALSINDEX))
-
-#define lua_pushcfunction(L,f) lua_pushcclosure(L, f, 0)
-
-#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_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)
-
-
-
-/*
-** compatibility macros and functions
-*/
-
-
-LUA_API int lua_pushupvalues (lua_State *L);
-
-#define lua_getregistry(L) lua_pushvalue(L, LUA_REGISTRYINDEX)
-#define lua_setglobal(L,s) \
- (lua_pushstring(L, s), lua_insert(L, -2), lua_settable(L, LUA_GLOBALSINDEX))
-
-#define lua_getglobal(L,s) \
- (lua_pushstring(L, s), lua_gettable(L, LUA_GLOBALSINDEX))
-
-
-/* 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)
-
-
-
-/*
-** {======================================================================
-** useful definitions for Lua kernel and libraries
-** =======================================================================
-*/
-
-/* formats for Lua numbers */
-#ifndef LUA_NUMBER_SCAN
-#define LUA_NUMBER_SCAN "%lf"
-#endif
-
-#ifndef LUA_NUMBER_FMT
-#define LUA_NUMBER_FMT "%.14g"
-#endif
-
-/* }====================================================================== */
-
-
-/*
-** {======================================================================
-** 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 */
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-/* }====================================================================== */
-
-
-/******************************************************************************
-* Copyright (C) 1994-2003 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
+/*
+** $Id: lua.h,v 1.5 2004-11-27 21:43:49 pixel 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>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define LUA_VERSION "Lua 5.0"
+#define LUA_COPYRIGHT "Copyright (C) 1994-2003 Tecgraf, PUC-Rio"
+#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo & W. Celes"
+
+
+
+/* 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))
+
+
+/* error codes for `lua_load' and `lua_pcall' */
+#define LUA_ERRRUN 1
+#define LUA_ERRFILE 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);
+
+
+/*
+** 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
+
+
+/* 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 */
+#ifndef LUA_NUMBER
+typedef double lua_Number;
+#else
+typedef LUA_NUMBER lua_Number;
+#endif
+
+
+/* mark for all API functions */
+#ifndef LUA_API
+#define LUA_API extern
+#endif
+
+
+/*
+** state manipulation
+*/
+LUA_API lua_State *lua_open (void);
+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 int lua_toboolean (lua_State *L, int idx);
+LUA_API const char *lua_tostring (lua_State *L, int idx);
+LUA_API size_t lua_strlen (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_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);
+
+
+/*
+** get functions (Lua -> stack)
+*/
+LUA_API void lua_gettable (lua_State *L, int idx);
+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_newtable (lua_State *L);
+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_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);
+
+/*
+** garbage-collection functions
+*/
+LUA_API int lua_getgcthreshold (lua_State *L);
+LUA_API int lua_getgccount (lua_State *L);
+LUA_API void lua_setgcthreshold (lua_State *L, int newthreshold);
+
+/*
+** 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 void lua_break (lua_State *L);
+
+
+
+/*
+** ===============================================================
+** some useful macros
+** ===============================================================
+*/
+
+#define lua_boxpointer(L,u) \
+ (*(void **)(lua_newuserdata(L, sizeof(void *))) = (u))
+
+#define lua_unboxpointer(L,i) (*(void **)(lua_touserdata(L, i)))
+
+#define lua_pop(L,n) lua_settop(L, -(n)-1)
+
+#define lua_register(L,n,f) \
+ (lua_pushstring(L, n), \
+ lua_pushcfunction(L, f), \
+ lua_settable(L, LUA_GLOBALSINDEX))
+
+#define lua_pushcfunction(L,f) lua_pushcclosure(L, f, 0)
+
+#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_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)
+
+
+
+/*
+** compatibility macros and functions
+*/
+
+
+LUA_API int lua_pushupvalues (lua_State *L);
+
+#define lua_getregistry(L) lua_pushvalue(L, LUA_REGISTRYINDEX)
+#define lua_setglobal(L,s) \
+ (lua_pushstring(L, s), lua_insert(L, -2), lua_settable(L, LUA_GLOBALSINDEX))
+
+#define lua_getglobal(L,s) \
+ (lua_pushstring(L, s), lua_gettable(L, LUA_GLOBALSINDEX))
+
+
+/* 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)
+
+
+
+/*
+** {======================================================================
+** useful definitions for Lua kernel and libraries
+** =======================================================================
+*/
+
+/* formats for Lua numbers */
+#ifndef LUA_NUMBER_SCAN
+#define LUA_NUMBER_SCAN "%lf"
+#endif
+
+#ifndef LUA_NUMBER_FMT
+#define LUA_NUMBER_FMT "%.14g"
+#endif
+
+/* }====================================================================== */
+
+
+/*
+** {======================================================================
+** 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 */
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+/* }====================================================================== */
+
+
+/******************************************************************************
+* Copyright (C) 1994-2003 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/lib/lua/include/lualib.h b/lib/lua/include/lualib.h
index 081d7c3..7c7a7b5 100644
--- a/lib/lua/include/lualib.h
+++ b/lib/lua/include/lualib.h
@@ -1,66 +1,66 @@
-/*
-** $Id: lualib.h,v 1.4 2004-11-27 21:01:20 pixel Exp $
-** Lua standard libraries
-** See Copyright Notice in lua.h
-*/
-
-
-#ifndef lualib_h
-#define lualib_h
-
-#include "lua.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef LUALIB_API
-#define LUALIB_API LUA_API
-#endif
-
-
-#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"
-#define LUA_OSLIBNAME "os"
-LUALIB_API int luaopen_io (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);
-
-#define LUA_DIRLIBNAME "dir"
-LUALIB_API int luaopen_dir (lua_State *L);
-
-
-LUALIB_API int luaopen_loadlib (lua_State *L);
-
-
-/* to help testing the libraries */
-#ifndef lua_assert
-#define lua_assert(c) /* empty */
-#endif
-
-
-/* compatibility code */
-#define lua_baselibopen luaopen_base
-#define lua_tablibopen luaopen_table
-#define lua_iolibopen luaopen_io
-#define lua_strlibopen luaopen_string
-#define lua_mathlibopen luaopen_math
-#define lua_dblibopen luaopen_debug
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
+/*
+** $Id: lualib.h,v 1.5 2004-11-27 21:43:49 pixel Exp $
+** Lua standard libraries
+** See Copyright Notice in lua.h
+*/
+
+
+#ifndef lualib_h
+#define lualib_h
+
+#include "lua.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef LUALIB_API
+#define LUALIB_API LUA_API
+#endif
+
+
+#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"
+#define LUA_OSLIBNAME "os"
+LUALIB_API int luaopen_io (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);
+
+#define LUA_DIRLIBNAME "dir"
+LUALIB_API int luaopen_dir (lua_State *L);
+
+
+LUALIB_API int luaopen_loadlib (lua_State *L);
+
+
+/* to help testing the libraries */
+#ifndef lua_assert
+#define lua_assert(c) /* empty */
+#endif
+
+
+/* compatibility code */
+#define lua_baselibopen luaopen_base
+#define lua_tablibopen luaopen_table
+#define lua_iolibopen luaopen_io
+#define lua_strlibopen luaopen_string
+#define lua_mathlibopen luaopen_math
+#define lua_dblibopen luaopen_debug
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/lib/lua/includes/lapi.h b/lib/lua/includes/lapi.h
index 7a438e8..1e18867 100644
--- a/lib/lua/includes/lapi.h
+++ b/lib/lua/includes/lapi.h
@@ -1,16 +1,16 @@
-/*
-** $Id: lapi.h,v 1.2 2003-12-11 16:53:29 pixel Exp $
-** Auxiliary functions from Lua API
-** See Copyright Notice in lua.h
-*/
-
-#ifndef lapi_h
-#define lapi_h
-
-
-#include "lobject.h"
-
-
-void luaA_pushobject (lua_State *L, const TObject *o);
-
-#endif
+/*
+** $Id: lapi.h,v 1.3 2004-11-27 21:43:50 pixel Exp $
+** Auxiliary functions from Lua API
+** See Copyright Notice in lua.h
+*/
+
+#ifndef lapi_h
+#define lapi_h
+
+
+#include "lobject.h"
+
+
+void luaA_pushobject (lua_State *L, const TObject *o);
+
+#endif
diff --git a/lib/lua/includes/lcode.h b/lib/lua/includes/lcode.h
index 77b1c58..fdd7025 100644
--- a/lib/lua/includes/lcode.h
+++ b/lib/lua/includes/lcode.h
@@ -1,74 +1,74 @@
-/*
-** $Id: lcode.h,v 1.2 2003-12-11 16:53:29 pixel Exp $
-** Code generator for Lua
-** See Copyright Notice in lua.h
-*/
-
-#ifndef lcode_h
-#define lcode_h
-
-#include "llex.h"
-#include "lobject.h"
-#include "lopcodes.h"
-#include "lparser.h"
-
-
-/*
-** Marks the end of a patch list. It is an invalid value both as an absolute
-** address, and as a list link (would link an element to itself).
-*/
-#define NO_JUMP (-1)
-
-
-/*
-** grep "ORDER OPR" if you change these enums
-*/
-typedef enum BinOpr {
- OPR_ADD, OPR_SUB, OPR_MULT, OPR_DIV, OPR_POW,
- OPR_CONCAT,
- OPR_NE, OPR_EQ,
- OPR_LT, OPR_LE, OPR_GT, OPR_GE,
- OPR_AND, OPR_OR,
- OPR_NOBINOPR
-} BinOpr;
-
-#define binopistest(op) ((op) >= OPR_NE)
-
-typedef enum UnOpr { OPR_MINUS, OPR_NOT, OPR_NOUNOPR } UnOpr;
-
-
-#define getcode(fs,e) ((fs)->f->code[(e)->info])
-
-#define luaK_codeAsBx(fs,o,A,sBx) luaK_codeABx(fs,o,A,(sBx)+MAXARG_sBx)
-
-int luaK_code (FuncState *fs, Instruction i, int line);
-int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned int Bx);
-int luaK_codeABC (FuncState *fs, OpCode o, int A, int B, int C);
-void luaK_fixline (FuncState *fs, int line);
-void luaK_nil (FuncState *fs, int from, int n);
-void luaK_reserveregs (FuncState *fs, int n);
-void luaK_checkstack (FuncState *fs, int n);
-int luaK_stringK (FuncState *fs, TString *s);
-int luaK_numberK (FuncState *fs, lua_Number r);
-void luaK_dischargevars (FuncState *fs, expdesc *e);
-int luaK_exp2anyreg (FuncState *fs, expdesc *e);
-void luaK_exp2nextreg (FuncState *fs, expdesc *e);
-void luaK_exp2val (FuncState *fs, expdesc *e);
-int luaK_exp2RK (FuncState *fs, expdesc *e);
-void luaK_self (FuncState *fs, expdesc *e, expdesc *key);
-void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k);
-void luaK_goiftrue (FuncState *fs, expdesc *e);
-void luaK_goiffalse (FuncState *fs, expdesc *e);
-void luaK_storevar (FuncState *fs, expdesc *var, expdesc *e);
-void luaK_setcallreturns (FuncState *fs, expdesc *var, int nresults);
-int luaK_jump (FuncState *fs);
-void luaK_patchlist (FuncState *fs, int list, int target);
-void luaK_patchtohere (FuncState *fs, int list);
-void luaK_concat (FuncState *fs, int *l1, int l2);
-int luaK_getlabel (FuncState *fs);
-void luaK_prefix (FuncState *fs, UnOpr op, expdesc *v);
-void luaK_infix (FuncState *fs, BinOpr op, expdesc *v);
-void luaK_posfix (FuncState *fs, BinOpr op, expdesc *v1, expdesc *v2);
-
-
-#endif
+/*
+** $Id: lcode.h,v 1.3 2004-11-27 21:43:50 pixel Exp $
+** Code generator for Lua
+** See Copyright Notice in lua.h
+*/
+
+#ifndef lcode_h
+#define lcode_h
+
+#include "llex.h"
+#include "lobject.h"
+#include "lopcodes.h"
+#include "lparser.h"
+
+
+/*
+** Marks the end of a patch list. It is an invalid value both as an absolute
+** address, and as a list link (would link an element to itself).
+*/
+#define NO_JUMP (-1)
+
+
+/*
+** grep "ORDER OPR" if you change these enums
+*/
+typedef enum BinOpr {
+ OPR_ADD, OPR_SUB, OPR_MULT, OPR_DIV, OPR_POW,
+ OPR_CONCAT,
+ OPR_NE, OPR_EQ,
+ OPR_LT, OPR_LE, OPR_GT, OPR_GE,
+ OPR_AND, OPR_OR,
+ OPR_NOBINOPR
+} BinOpr;
+
+#define binopistest(op) ((op) >= OPR_NE)
+
+typedef enum UnOpr { OPR_MINUS, OPR_NOT, OPR_NOUNOPR } UnOpr;
+
+
+#define getcode(fs,e) ((fs)->f->code[(e)->info])
+
+#define luaK_codeAsBx(fs,o,A,sBx) luaK_codeABx(fs,o,A,(sBx)+MAXARG_sBx)
+
+int luaK_code (FuncState *fs, Instruction i, int line);
+int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned int Bx);
+int luaK_codeABC (FuncState *fs, OpCode o, int A, int B, int C);
+void luaK_fixline (FuncState *fs, int line);
+void luaK_nil (FuncState *fs, int from, int n);
+void luaK_reserveregs (FuncState *fs, int n);
+void luaK_checkstack (FuncState *fs, int n);
+int luaK_stringK (FuncState *fs, TString *s);
+int luaK_numberK (FuncState *fs, lua_Number r);
+void luaK_dischargevars (FuncState *fs, expdesc *e);
+int luaK_exp2anyreg (FuncState *fs, expdesc *e);
+void luaK_exp2nextreg (FuncState *fs, expdesc *e);
+void luaK_exp2val (FuncState *fs, expdesc *e);
+int luaK_exp2RK (FuncState *fs, expdesc *e);
+void luaK_self (FuncState *fs, expdesc *e, expdesc *key);
+void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k);
+void luaK_goiftrue (FuncState *fs, expdesc *e);
+void luaK_goiffalse (FuncState *fs, expdesc *e);
+void luaK_storevar (FuncState *fs, expdesc *var, expdesc *e);
+void luaK_setcallreturns (FuncState *fs, expdesc *var, int nresults);
+int luaK_jump (FuncState *fs);
+void luaK_patchlist (FuncState *fs, int list, int target);
+void luaK_patchtohere (FuncState *fs, int list);
+void luaK_concat (FuncState *fs, int *l1, int l2);
+int luaK_getlabel (FuncState *fs);
+void luaK_prefix (FuncState *fs, UnOpr op, expdesc *v);
+void luaK_infix (FuncState *fs, BinOpr op, expdesc *v);
+void luaK_posfix (FuncState *fs, BinOpr op, expdesc *v1, expdesc *v2);
+
+
+#endif
diff --git a/lib/lua/includes/ldebug.h b/lib/lua/includes/ldebug.h
index 49a29e2..2494575 100644
--- a/lib/lua/includes/ldebug.h
+++ b/lib/lua/includes/ldebug.h
@@ -1,31 +1,31 @@
-/*
-** $Id: ldebug.h,v 1.2 2003-12-11 16:53:29 pixel Exp $
-** Auxiliary functions from Debug Interface module
-** See Copyright Notice in lua.h
-*/
-
-#ifndef ldebug_h
-#define ldebug_h
-
-
-#include "lstate.h"
-
-
-#define pcRel(pc, p) (cast(int, (pc) - (p)->code) - 1)
-
-#define getline(f,pc) (((f)->lineinfo) ? (f)->lineinfo[pc] : 0)
-
-#define resethookcount(L) (L->hookcount = L->basehookcount)
-
-
-void luaG_inithooks (lua_State *L);
-void luaG_typeerror (lua_State *L, const TObject *o, const char *opname);
-void luaG_concaterror (lua_State *L, StkId p1, StkId p2);
-void luaG_aritherror (lua_State *L, const TObject *p1, const TObject *p2);
-int luaG_ordererror (lua_State *L, const TObject *p1, const TObject *p2);
-void luaG_runerror (lua_State *L, const char *fmt, ...);
-void luaG_errormsg (lua_State *L);
-int luaG_checkcode (const Proto *pt);
-
-
-#endif
+/*
+** $Id: ldebug.h,v 1.3 2004-11-27 21:43:50 pixel Exp $
+** Auxiliary functions from Debug Interface module
+** See Copyright Notice in lua.h
+*/
+
+#ifndef ldebug_h
+#define ldebug_h
+
+
+#include "lstate.h"
+
+
+#define pcRel(pc, p) (cast(int, (pc) - (p)->code) - 1)
+
+#define getline(f,pc) (((f)->lineinfo) ? (f)->lineinfo[pc] : 0)
+
+#define resethookcount(L) (L->hookcount = L->basehookcount)
+
+
+void luaG_inithooks (lua_State *L);
+void luaG_typeerror (lua_State *L, const TObject *o, const char *opname);
+void luaG_concaterror (lua_State *L, StkId p1, StkId p2);
+void luaG_aritherror (lua_State *L, const TObject *p1, const TObject *p2);
+int luaG_ordererror (lua_State *L, const TObject *p1, const TObject *p2);
+void luaG_runerror (lua_State *L, const char *fmt, ...);
+void luaG_errormsg (lua_State *L);
+int luaG_checkcode (const Proto *pt);
+
+
+#endif
diff --git a/lib/lua/includes/ldo.h b/lib/lua/includes/ldo.h
index 15ec588..e7b24d8 100644
--- a/lib/lua/includes/ldo.h
+++ b/lib/lua/includes/ldo.h
@@ -1,60 +1,60 @@
-/*
-** $Id: ldo.h,v 1.2 2003-12-11 16:53:29 pixel Exp $
-** Stack and Call structure of Lua
-** See Copyright Notice in lua.h
-*/
-
-#ifndef ldo_h
-#define ldo_h
-
-
-#include "lobject.h"
-#include "lstate.h"
-#include "lzio.h"
-
-
-/*
-** macro to control inclusion of some hard tests on stack reallocation
-*/
-#ifndef HARDSTACKTESTS
-#define condhardstacktests(x) { /* empty */ }
-#else
-#define condhardstacktests(x) x
-#endif
-
-
-#define luaD_checkstack(L,n) \
- if ((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TObject)) \
- luaD_growstack(L, n); \
- else condhardstacktests(luaD_reallocstack(L, L->stacksize));
-
-
-#define incr_top(L) {luaD_checkstack(L,1); L->top++;}
-
-#define savestack(L,p) ((char *)(p) - (char *)L->stack)
-#define restorestack(L,n) ((TObject *)((char *)L->stack + (n)))
-
-#define saveci(L,p) ((char *)(p) - (char *)L->base_ci)
-#define restoreci(L,n) ((CallInfo *)((char *)L->base_ci + (n)))
-
-
-/* type of protected functions, to be ran by `runprotected' */
-typedef void (*Pfunc) (lua_State *L, void *ud);
-
-void luaD_resetprotection (lua_State *L);
-int luaD_protectedparser (lua_State *L, ZIO *z, int bin);
-void luaD_callhook (lua_State *L, int event, int line);
-StkId luaD_precall (lua_State *L, StkId func);
-void luaD_call (lua_State *L, StkId func, int nResults);
-int luaD_pcall (lua_State *L, Pfunc func, void *u,
- ptrdiff_t oldtop, ptrdiff_t ef);
-void luaD_poscall (lua_State *L, int wanted, StkId firstResult);
-void luaD_reallocCI (lua_State *L, int newsize);
-void luaD_reallocstack (lua_State *L, int newsize);
-void luaD_growstack (lua_State *L, int n);
-
-void luaD_throw (lua_State *L, int errcode);
-int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud);
-
-
-#endif
+/*
+** $Id: ldo.h,v 1.3 2004-11-27 21:43:50 pixel Exp $
+** Stack and Call structure of Lua
+** See Copyright Notice in lua.h
+*/
+
+#ifndef ldo_h
+#define ldo_h
+
+
+#include "lobject.h"
+#include "lstate.h"
+#include "lzio.h"
+
+
+/*
+** macro to control inclusion of some hard tests on stack reallocation
+*/
+#ifndef HARDSTACKTESTS
+#define condhardstacktests(x) { /* empty */ }
+#else
+#define condhardstacktests(x) x
+#endif
+
+
+#define luaD_checkstack(L,n) \
+ if ((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TObject)) \
+ luaD_growstack(L, n); \
+ else condhardstacktests(luaD_reallocstack(L, L->stacksize));
+
+
+#define incr_top(L) {luaD_checkstack(L,1); L->top++;}
+
+#define savestack(L,p) ((char *)(p) - (char *)L->stack)
+#define restorestack(L,n) ((TObject *)((char *)L->stack + (n)))
+
+#define saveci(L,p) ((char *)(p) - (char *)L->base_ci)
+#define restoreci(L,n) ((CallInfo *)((char *)L->base_ci + (n)))
+
+
+/* type of protected functions, to be ran by `runprotected' */
+typedef void (*Pfunc) (lua_State *L, void *ud);
+
+void luaD_resetprotection (lua_State *L);
+int luaD_protectedparser (lua_State *L, ZIO *z, int bin);
+void luaD_callhook (lua_State *L, int event, int line);
+StkId luaD_precall (lua_State *L, StkId func);
+void luaD_call (lua_State *L, StkId func, int nResults);
+int luaD_pcall (lua_State *L, Pfunc func, void *u,
+ ptrdiff_t oldtop, ptrdiff_t ef);
+void luaD_poscall (lua_State *L, int wanted, StkId firstResult);
+void luaD_reallocCI (lua_State *L, int newsize);
+void luaD_reallocstack (lua_State *L, int newsize);
+void luaD_growstack (lua_State *L, int n);
+
+void luaD_throw (lua_State *L, int errcode);
+int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud);
+
+
+#endif
diff --git a/lib/lua/includes/lfunc.h b/lib/lua/includes/lfunc.h
index f09448d..68c129b 100644
--- a/lib/lua/includes/lfunc.h
+++ b/lib/lua/includes/lfunc.h
@@ -1,25 +1,25 @@
-/*
-** $Id: lfunc.h,v 1.2 2003-12-11 16:53:29 pixel Exp $
-** Auxiliary functions to manipulate prototypes and closures
-** See Copyright Notice in lua.h
-*/
-
-#ifndef lfunc_h
-#define lfunc_h
-
-
-#include "lobject.h"
-
-
-Proto *luaF_newproto (lua_State *L);
-Closure *luaF_newCclosure (lua_State *L, int nelems);
-Closure *luaF_newLclosure (lua_State *L, int nelems, TObject *e);
-UpVal *luaF_findupval (lua_State *L, StkId level);
-void luaF_close (lua_State *L, StkId level);
-void luaF_freeproto (lua_State *L, Proto *f);
-void luaF_freeclosure (lua_State *L, Closure *c);
-
-const char *luaF_getlocalname (const Proto *func, int local_number, int pc);
-
-
-#endif
+/*
+** $Id: lfunc.h,v 1.3 2004-11-27 21:43:50 pixel Exp $
+** Auxiliary functions to manipulate prototypes and closures
+** See Copyright Notice in lua.h
+*/
+
+#ifndef lfunc_h
+#define lfunc_h
+
+
+#include "lobject.h"
+
+
+Proto *luaF_newproto (lua_State *L);
+Closure *luaF_newCclosure (lua_State *L, int nelems);
+Closure *luaF_newLclosure (lua_State *L, int nelems, TObject *e);
+UpVal *luaF_findupval (lua_State *L, StkId level);
+void luaF_close (lua_State *L, StkId level);
+void luaF_freeproto (lua_State *L, Proto *f);
+void luaF_freeclosure (lua_State *L, Closure *c);
+
+const char *luaF_getlocalname (const Proto *func, int local_number, int pc);
+
+
+#endif
diff --git a/lib/lua/includes/lgc.h b/lib/lua/includes/lgc.h
index af86654..52e0c58 100644
--- a/lib/lua/includes/lgc.h
+++ b/lib/lua/includes/lgc.h
@@ -1,25 +1,25 @@
-/*
-** $Id: lgc.h,v 1.2 2003-12-11 16:53:29 pixel Exp $
-** Garbage Collector
-** See Copyright Notice in lua.h
-*/
-
-#ifndef lgc_h
-#define lgc_h
-
-
-#include "lobject.h"
-
-
-#define luaC_checkGC(L) { lua_assert(!(L->ci->state & CI_CALLING)); \
- if (G(L)->nblocks >= G(L)->GCthreshold) luaC_collectgarbage(L); }
-
-
-void luaC_separateudata (lua_State *L);
-void luaC_callGCTM (lua_State *L);
-void luaC_sweep (lua_State *L, int all);
-void luaC_collectgarbage (lua_State *L);
-void luaC_link (lua_State *L, GCObject *o, lu_byte tt);
-
-
-#endif
+/*
+** $Id: lgc.h,v 1.3 2004-11-27 21:43:50 pixel Exp $
+** Garbage Collector
+** See Copyright Notice in lua.h
+*/
+
+#ifndef lgc_h
+#define lgc_h
+
+
+#include "lobject.h"
+
+
+#define luaC_checkGC(L) { lua_assert(!(L->ci->state & CI_CALLING)); \
+ if (G(L)->nblocks >= G(L)->GCthreshold) luaC_collectgarbage(L); }
+
+
+void luaC_separateudata (lua_State *L);
+void luaC_callGCTM (lua_State *L);
+void luaC_sweep (lua_State *L, int all);
+void luaC_collectgarbage (lua_State *L);
+void luaC_link (lua_State *L, GCObject *o, lu_byte tt);
+
+
+#endif
diff --git a/lib/lua/includes/llex.h b/lib/lua/includes/llex.h
index 355979c..94f0b8f 100644
--- a/lib/lua/includes/llex.h
+++ b/lib/lua/includes/llex.h
@@ -1,75 +1,75 @@
-/*
-** $Id: llex.h,v 1.2 2003-12-11 16:53:29 pixel Exp $
-** Lexical Analyzer
-** See Copyright Notice in lua.h
-*/
-
-#ifndef llex_h
-#define llex_h
-
-#include "lobject.h"
-#include "lzio.h"
-
-
-#define FIRST_RESERVED 257
-
-/* maximum length of a reserved word */
-#define TOKEN_LEN (sizeof("function")/sizeof(char))
-
-
-/*
-* WARNING: if you change the order of this enumeration,
-* grep "ORDER RESERVED"
-*/
-enum RESERVED {
- /* terminal symbols denoted by reserved words */
- TK_AND = FIRST_RESERVED, TK_BREAK,
- TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FALSE, TK_FOR, TK_FUNCTION,
- TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT,
- TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE,
- /* other terminal symbols */
- TK_NAME, TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, TK_NUMBER,
- TK_STRING, TK_EOS
-};
-
-/* number of reserved words */
-#define NUM_RESERVED (cast(int, TK_WHILE-FIRST_RESERVED+1))
-
-
-typedef union {
- lua_Number r;
- TString *ts;
-} SemInfo; /* semantics information */
-
-
-typedef struct Token {
- int token;
- SemInfo seminfo;
-} Token;
-
-
-typedef struct LexState {
- int current; /* current character (charint) */
- int linenumber; /* input line counter */
- int lastline; /* line of last token `consumed' */
- Token t; /* current token */
- Token lookahead; /* look ahead token */
- struct FuncState *fs; /* `FuncState' is private to the parser */
- struct lua_State *L;
- ZIO *z; /* input stream */
- Mbuffer *buff; /* buffer for tokens */
- TString *source; /* current source name */
- int nestlevel; /* level of nested non-terminals */
-} LexState;
-
-
-void luaX_init (lua_State *L);
-void luaX_setinput (lua_State *L, LexState *LS, ZIO *z, TString *source);
-int luaX_lex (LexState *LS, SemInfo *seminfo);
-void luaX_checklimit (LexState *ls, int val, int limit, const char *msg);
-void luaX_syntaxerror (LexState *ls, const char *s);
-void luaX_errorline (LexState *ls, const char *s, const char *token, int line);
-const char *luaX_token2str (LexState *ls, int token);
-
-
-#endif
+/*
+** $Id: llex.h,v 1.3 2004-11-27 21:43:50 pixel Exp $
+** Lexical Analyzer
+** See Copyright Notice in lua.h
+*/
+
+#ifndef llex_h
+#define llex_h
+
+#include "lobject.h"
+#include "lzio.h"
+
+
+#define FIRST_RESERVED 257
+
+/* maximum length of a reserved word */
+#define TOKEN_LEN (sizeof("function")/sizeof(char))
+
+
+/*
+* WARNING: if you change the order of this enumeration,
+* grep "ORDER RESERVED"
+*/
+enum RESERVED {
+ /* terminal symbols denoted by reserved words */
+ TK_AND = FIRST_RESERVED, TK_BREAK,
+ TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FALSE, TK_FOR, TK_FUNCTION,
+ TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT,
+ TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE,
+ /* other terminal symbols */
+ TK_NAME, TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, TK_NUMBER,
+ TK_STRING, TK_EOS
+};
+
+/* number of reserved words */
+#define NUM_RESERVED (cast(int, TK_WHILE-FIRST_RESERVED+1))
+
+
+typedef union {
+ lua_Number r;
+ TString *ts;
+} SemInfo; /* semantics information */
+
+
+typedef struct Token {
+ int token;
+ SemInfo seminfo;
+} Token;
+
+
+typedef struct LexState {
+ int current; /* current character (charint) */
+ int linenumber; /* input line counter */
+ int lastline; /* line of last token `consumed' */
+ Token t; /* current token */
+ Token lookahead; /* look ahead token */
+ struct FuncState *fs; /* `FuncState' is private to the parser */
+ struct lua_State *L;
+ ZIO *z; /* input stream */
+ Mbuffer *buff; /* buffer for tokens */
+ TString *source; /* current source name */
+ int nestlevel; /* level of nested non-terminals */
+} LexState;
+
+
+void luaX_init (lua_State *L);
+void luaX_setinput (lua_State *L, LexState *LS, ZIO *z, TString *source);
+int luaX_lex (LexState *LS, SemInfo *seminfo);
+void luaX_checklimit (LexState *ls, int val, int limit, const char *msg);
+void luaX_syntaxerror (LexState *ls, const char *s);
+void luaX_errorline (LexState *ls, const char *s, const char *token, int line);
+const char *luaX_token2str (LexState *ls, int token);
+
+
+#endif
diff --git a/lib/lua/includes/llimits.h b/lib/lua/includes/llimits.h
index 57fad83..0b4a084 100644
--- a/lib/lua/includes/llimits.h
+++ b/lib/lua/includes/llimits.h
@@ -1,185 +1,185 @@
-/*
-** $Id: llimits.h,v 1.2 2003-12-11 16:53:29 pixel Exp $
-** Limits, basic types, and some other `installation-dependent' definitions
-** See Copyright Notice in lua.h
-*/
-
-#ifndef llimits_h
-#define llimits_h
-
-
-#include <limits.h>
-#include <stddef.h>
-
-
-#include "lua.h"
-
-
-/*
-** try to find number of bits in an integer
-*/
-#ifndef BITS_INT
-/* avoid overflows in comparison */
-#if INT_MAX-20 < 32760
-#define BITS_INT 16
-#else
-#if INT_MAX > 2147483640L
-/* machine has at least 32 bits */
-#define BITS_INT 32
-#else
-#error "you must define BITS_INT with number of bits in an integer"
-#endif
-#endif
-#endif
-
-
-/*
-** the following types define integer types for values that may not
-** fit in a `small int' (16 bits), but may waste space in a
-** `large long' (64 bits). The current definitions should work in
-** any machine, but may not be optimal.
-*/
-
-/* an unsigned integer to hold hash values */
-typedef unsigned int lu_hash;
-/* its signed equivalent */
-typedef int ls_hash;
-
-/* an unsigned integer big enough to count the total memory used by Lua; */
-/* it should be at least as large as size_t */
-typedef unsigned long lu_mem;
-
-#define MAX_LUMEM ULONG_MAX
-
-
-/* an integer big enough to count the number of strings in use */
-typedef long ls_nstr;
-
-/* chars used as small naturals (so that `char' is reserved for characters) */
-typedef unsigned char lu_byte;
-
-
-#define MAX_SIZET ((size_t)(~(size_t)0)-2)
-
-
-#define MAX_INT (INT_MAX-2) /* maximum value of an int (-2 for safety) */
-
-/*
-** conversion of pointer to integer
-** this is for hashing only; there is no problem if the integer
-** cannot hold the whole pointer value
-*/
-#define IntPoint(p) ((lu_hash)(p))
-
-
-
-/* type to ensure maximum alignment */
-#ifndef LUSER_ALIGNMENT_T
-typedef union { double u; void *s; long l; } L_Umaxalign;
-#else
-typedef LUSER_ALIGNMENT_T L_Umaxalign;
-#endif
-
-
-/* result of `usual argument conversion' over lua_Number */
-#ifndef LUA_UACNUMBER
-typedef double l_uacNumber;
-#else
-typedef LUA_UACNUMBER l_uacNumber;
-#endif
-
-
-#ifndef lua_assert
-#define lua_assert(c) /* empty */
-#endif
-
-
-#ifndef check_exp
-#define check_exp(c,e) (e)
-#endif
-
-
-#ifndef UNUSED
-#define UNUSED(x) ((void)(x)) /* to avoid warnings */
-#endif
-
-
-#ifndef cast
-#define cast(t, exp) ((t)(exp))
-#endif
-
-
-
-/*
-** type for virtual-machine instructions
-** must be an unsigned with (at least) 4 bytes (see details in lopcodes.h)
-*/
-typedef unsigned long Instruction;
-
-
-/* maximum depth for calls (unsigned short) */
-#ifndef LUA_MAXCALLS
-#define LUA_MAXCALLS 4096
-#endif
-
-
-/*
-** maximum depth for C calls (unsigned short): Not too big, or may
-** overflow the C stack...
-*/
-
-#ifndef LUA_MAXCCALLS
-#define LUA_MAXCCALLS 200
-#endif
-
-
-/* maximum size for the C stack */
-#ifndef LUA_MAXCSTACK
-#define LUA_MAXCSTACK 2048
-#endif
-
-
-/* maximum stack for a Lua function */
-#define MAXSTACK 250
-
-
-/* maximum number of variables declared in a function */
-#ifndef MAXVARS
-#define MAXVARS 200 /* arbitrary limit (<MAXSTACK) */
-#endif
-
-
-/* maximum number of upvalues per function */
-#ifndef MAXUPVALUES
-#define MAXUPVALUES 32
-#endif
-
-
-/* maximum number of parameters in a function */
-#ifndef MAXPARAMS
-#define MAXPARAMS 100 /* arbitrary limit (<MAXLOCALS) */
-#endif
-
-
-/* minimum size for the string table (must be power of 2) */
-#ifndef MINSTRTABSIZE
-#define MINSTRTABSIZE 32
-#endif
-
-
-/* minimum size for string buffer */
-#ifndef LUA_MINBUFFER
-#define LUA_MINBUFFER 32
-#endif
-
-
-/*
-** maximum number of syntactical nested non-terminals: Not too big,
-** or may overflow the C stack...
-*/
-#ifndef LUA_MAXPARSERLEVEL
-#define LUA_MAXPARSERLEVEL 200
-#endif
-
-
-#endif
+/*
+** $Id: llimits.h,v 1.3 2004-11-27 21:43:50 pixel Exp $
+** Limits, basic types, and some other `installation-dependent' definitions
+** See Copyright Notice in lua.h
+*/
+
+#ifndef llimits_h
+#define llimits_h
+
+
+#include <limits.h>
+#include <stddef.h>
+
+
+#include "lua.h"
+
+
+/*
+** try to find number of bits in an integer
+*/
+#ifndef BITS_INT
+/* avoid overflows in comparison */
+#if INT_MAX-20 < 32760
+#define BITS_INT 16
+#else
+#if INT_MAX > 2147483640L
+/* machine has at least 32 bits */
+#define BITS_INT 32
+#else
+#error "you must define BITS_INT with number of bits in an integer"
+#endif
+#endif
+#endif
+
+
+/*
+** the following types define integer types for values that may not
+** fit in a `small int' (16 bits), but may waste space in a
+** `large long' (64 bits). The current definitions should work in
+** any machine, but may not be optimal.
+*/
+
+/* an unsigned integer to hold hash values */
+typedef unsigned int lu_hash;
+/* its signed equivalent */
+typedef int ls_hash;
+
+/* an unsigned integer big enough to count the total memory used by Lua; */
+/* it should be at least as large as size_t */
+typedef unsigned long lu_mem;
+
+#define MAX_LUMEM ULONG_MAX
+
+
+/* an integer big enough to count the number of strings in use */
+typedef long ls_nstr;
+
+/* chars used as small naturals (so that `char' is reserved for characters) */
+typedef unsigned char lu_byte;
+
+
+#define MAX_SIZET ((size_t)(~(size_t)0)-2)
+
+
+#define MAX_INT (INT_MAX-2) /* maximum value of an int (-2 for safety) */
+
+/*
+** conversion of pointer to integer
+** this is for hashing only; there is no problem if the integer
+** cannot hold the whole pointer value
+*/
+#define IntPoint(p) ((lu_hash)(p))
+
+
+
+/* type to ensure maximum alignment */
+#ifndef LUSER_ALIGNMENT_T
+typedef union { double u; void *s; long l; } L_Umaxalign;
+#else
+typedef LUSER_ALIGNMENT_T L_Umaxalign;
+#endif
+
+
+/* result of `usual argument conversion' over lua_Number */
+#ifndef LUA_UACNUMBER
+typedef double l_uacNumber;
+#else
+typedef LUA_UACNUMBER l_uacNumber;
+#endif
+
+
+#ifndef lua_assert
+#define lua_assert(c) /* empty */
+#endif
+
+
+#ifndef check_exp
+#define check_exp(c,e) (e)
+#endif
+
+
+#ifndef UNUSED
+#define UNUSED(x) ((void)(x)) /* to avoid warnings */
+#endif
+
+
+#ifndef cast
+#define cast(t, exp) ((t)(exp))
+#endif
+
+
+
+/*
+** type for virtual-machine instructions
+** must be an unsigned with (at least) 4 bytes (see details in lopcodes.h)
+*/
+typedef unsigned long Instruction;
+
+
+/* maximum depth for calls (unsigned short) */
+#ifndef LUA_MAXCALLS
+#define LUA_MAXCALLS 4096
+#endif
+
+
+/*
+** maximum depth for C calls (unsigned short): Not too big, or may
+** overflow the C stack...
+*/
+
+#ifndef LUA_MAXCCALLS
+#define LUA_MAXCCALLS 200
+#endif
+
+
+/* maximum size for the C stack */
+#ifndef LUA_MAXCSTACK
+#define LUA_MAXCSTACK 2048
+#endif
+
+
+/* maximum stack for a Lua function */
+#define MAXSTACK 250
+
+
+/* maximum number of variables declared in a function */
+#ifndef MAXVARS
+#define MAXVARS 200 /* arbitrary limit (<MAXSTACK) */
+#endif
+
+
+/* maximum number of upvalues per function */
+#ifndef MAXUPVALUES
+#define MAXUPVALUES 32
+#endif
+
+
+/* maximum number of parameters in a function */
+#ifndef MAXPARAMS
+#define MAXPARAMS 100 /* arbitrary limit (<MAXLOCALS) */
+#endif
+
+
+/* minimum size for the string table (must be power of 2) */
+#ifndef MINSTRTABSIZE
+#define MINSTRTABSIZE 32
+#endif
+
+
+/* minimum size for string buffer */
+#ifndef LUA_MINBUFFER
+#define LUA_MINBUFFER 32
+#endif
+
+
+/*
+** maximum number of syntactical nested non-terminals: Not too big,
+** or may overflow the C stack...
+*/
+#ifndef LUA_MAXPARSERLEVEL
+#define LUA_MAXPARSERLEVEL 200
+#endif
+
+
+#endif
diff --git a/lib/lua/includes/lmem.h b/lib/lua/includes/lmem.h
index 16363be..3211713 100644
--- a/lib/lua/includes/lmem.h
+++ b/lib/lua/includes/lmem.h
@@ -1,44 +1,44 @@
-/*
-** $Id: lmem.h,v 1.2 2003-12-11 16:53:29 pixel Exp $
-** Interface to Memory Manager
-** See Copyright Notice in lua.h
-*/
-
-#ifndef lmem_h
-#define lmem_h
-
-
-#include <stddef.h>
-
-#include "llimits.h"
-#include "lua.h"
-
-#define MEMERRMSG "not enough memory"
-
-
-void *luaM_realloc (lua_State *L, void *oldblock, lu_mem oldsize, lu_mem size);
-
-void *luaM_growaux (lua_State *L, void *block, int *size, int size_elem,
- int limit, const char *errormsg);
-
-#define luaM_free(L, b, s) luaM_realloc(L, (b), (s), 0)
-#define luaM_freelem(L, b) luaM_realloc(L, (b), sizeof(*(b)), 0)
-#define luaM_freearray(L, b, n, t) luaM_realloc(L, (b), \
- cast(lu_mem, n)*cast(lu_mem, sizeof(t)), 0)
-
-#define luaM_malloc(L, t) luaM_realloc(L, NULL, 0, (t))
-#define luaM_new(L, t) cast(t *, luaM_malloc(L, sizeof(t)))
-#define luaM_newvector(L, n,t) cast(t *, luaM_malloc(L, \
- cast(lu_mem, n)*cast(lu_mem, sizeof(t))))
-
-#define luaM_growvector(L,v,nelems,size,t,limit,e) \
- if (((nelems)+1) > (size)) \
- ((v)=cast(t *, luaM_growaux(L,v,&(size),sizeof(t),limit,e)))
-
-#define luaM_reallocvector(L, v,oldn,n,t) \
- ((v)=cast(t *, luaM_realloc(L, v,cast(lu_mem, oldn)*cast(lu_mem, sizeof(t)), \
- cast(lu_mem, n)*cast(lu_mem, sizeof(t)))))
-
-
-#endif
-
+/*
+** $Id: lmem.h,v 1.3 2004-11-27 21:43:50 pixel Exp $
+** Interface to Memory Manager
+** See Copyright Notice in lua.h
+*/
+
+#ifndef lmem_h
+#define lmem_h
+
+
+#include <stddef.h>
+
+#include "llimits.h"
+#include "lua.h"
+
+#define MEMERRMSG "not enough memory"
+
+
+void *luaM_realloc (lua_State *L, void *oldblock, lu_mem oldsize, lu_mem size);
+
+void *luaM_growaux (lua_State *L, void *block, int *size, int size_elem,
+ int limit, const char *errormsg);
+
+#define luaM_free(L, b, s) luaM_realloc(L, (b), (s), 0)
+#define luaM_freelem(L, b) luaM_realloc(L, (b), sizeof(*(b)), 0)
+#define luaM_freearray(L, b, n, t) luaM_realloc(L, (b), \
+ cast(lu_mem, n)*cast(lu_mem, sizeof(t)), 0)
+
+#define luaM_malloc(L, t) luaM_realloc(L, NULL, 0, (t))
+#define luaM_new(L, t) cast(t *, luaM_malloc(L, sizeof(t)))
+#define luaM_newvector(L, n,t) cast(t *, luaM_malloc(L, \
+ cast(lu_mem, n)*cast(lu_mem, sizeof(t))))
+
+#define luaM_growvector(L,v,nelems,size,t,limit,e) \
+ if (((nelems)+1) > (size)) \
+ ((v)=cast(t *, luaM_growaux(L,v,&(size),sizeof(t),limit,e)))
+
+#define luaM_reallocvector(L, v,oldn,n,t) \
+ ((v)=cast(t *, luaM_realloc(L, v,cast(lu_mem, oldn)*cast(lu_mem, sizeof(t)), \
+ cast(lu_mem, n)*cast(lu_mem, sizeof(t)))))
+
+
+#endif
+
diff --git a/lib/lua/includes/lobject.h b/lib/lua/includes/lobject.h
index 4741e93..02f3d80 100644
--- a/lib/lua/includes/lobject.h
+++ b/lib/lua/includes/lobject.h
@@ -1,336 +1,336 @@
-/*
-** $Id: lobject.h,v 1.2 2003-12-11 16:53:29 pixel Exp $
-** Type definitions for Lua objects
-** See Copyright Notice in lua.h
-*/
-
-#ifndef lobject_h
-#define lobject_h
-
-
-#include "llimits.h"
-#include "lua.h"
-
-
-/* tags for values visible from Lua */
-#define NUM_TAGS LUA_TTHREAD
-
-
-/*
-** Extra tags for non-values
-*/
-#define LUA_TPROTO (NUM_TAGS+1)
-#define LUA_TUPVAL (NUM_TAGS+2)
-
-
-/*
-** Union of all collectable objects
-*/
-typedef union GCObject GCObject;
-
-
-/*
-** Common Header for all collectable objects (in macro form, to be
-** included in other objects)
-*/
-#define CommonHeader GCObject *next; lu_byte tt; lu_byte marked
-
-
-/*
-** Common header in struct form
-*/
-typedef struct GCheader {
- CommonHeader;
-} GCheader;
-
-
-
-
-/*
-** Union of all Lua values
-*/
-typedef union {
- GCObject *gc;
- void *p;
- lua_Number n;
- int b;
-} Value;
-
-
-/*
-** Lua values (or `tagged objects')
-*/
-typedef struct lua_TObject {
- int tt;
- Value value;
-} TObject;
-
-
-/* Macros to test type */
-#define ttisnil(o) (ttype(o) == LUA_TNIL)
-#define ttisnumber(o) (ttype(o) == LUA_TNUMBER)
-#define ttisstring(o) (ttype(o) == LUA_TSTRING)
-#define ttistable(o) (ttype(o) == LUA_TTABLE)
-#define ttisfunction(o) (ttype(o) == LUA_TFUNCTION)
-#define ttisboolean(o) (ttype(o) == LUA_TBOOLEAN)
-#define ttisuserdata(o) (ttype(o) == LUA_TUSERDATA)
-#define ttisthread(o) (ttype(o) == LUA_TTHREAD)
-#define ttislightuserdata(o) (ttype(o) == LUA_TLIGHTUSERDATA)
-
-/* Macros to access values */
-#define ttype(o) ((o)->tt)
-#define gcvalue(o) check_exp(iscollectable(o), (o)->value.gc)
-#define pvalue(o) check_exp(ttislightuserdata(o), (o)->value.p)
-#define nvalue(o) check_exp(ttisnumber(o), (o)->value.n)
-#define tsvalue(o) check_exp(ttisstring(o), &(o)->value.gc->ts)
-#define uvalue(o) check_exp(ttisuserdata(o), &(o)->value.gc->u)
-#define clvalue(o) check_exp(ttisfunction(o), &(o)->value.gc->cl)
-#define hvalue(o) check_exp(ttistable(o), &(o)->value.gc->h)
-#define bvalue(o) check_exp(ttisboolean(o), (o)->value.b)
-#define thvalue(o) check_exp(ttisthread(o), &(o)->value.gc->th)
-
-#define l_isfalse(o) (ttisnil(o) || (ttisboolean(o) && bvalue(o) == 0))
-
-/* Macros to set values */
-#define setnvalue(obj,x) \
- { TObject *i_o=(obj); i_o->tt=LUA_TNUMBER; i_o->value.n=(x); }
-
-#define chgnvalue(obj,x) \
- check_exp(ttype(obj)==LUA_TNUMBER, (obj)->value.n=(x))
-
-#define setpvalue(obj,x) \
- { TObject *i_o=(obj); i_o->tt=LUA_TLIGHTUSERDATA; i_o->value.p=(x); }
-
-#define setbvalue(obj,x) \
- { TObject *i_o=(obj); i_o->tt=LUA_TBOOLEAN; i_o->value.b=(x); }
-
-#define setsvalue(obj,x) \
- { TObject *i_o=(obj); i_o->tt=LUA_TSTRING; \
- i_o->value.gc=cast(GCObject *, (x)); \
- lua_assert(i_o->value.gc->gch.tt == LUA_TSTRING); }
-
-#define setuvalue(obj,x) \
- { TObject *i_o=(obj); i_o->tt=LUA_TUSERDATA; \
- i_o->value.gc=cast(GCObject *, (x)); \
- lua_assert(i_o->value.gc->gch.tt == LUA_TUSERDATA); }
-
-#define setthvalue(obj,x) \
- { TObject *i_o=(obj); i_o->tt=LUA_TTHREAD; \
- i_o->value.gc=cast(GCObject *, (x)); \
- lua_assert(i_o->value.gc->gch.tt == LUA_TTHREAD); }
-
-#define setclvalue(obj,x) \
- { TObject *i_o=(obj); i_o->tt=LUA_TFUNCTION; \
- i_o->value.gc=cast(GCObject *, (x)); \
- lua_assert(i_o->value.gc->gch.tt == LUA_TFUNCTION); }
-
-#define sethvalue(obj,x) \
- { TObject *i_o=(obj); i_o->tt=LUA_TTABLE; \
- i_o->value.gc=cast(GCObject *, (x)); \
- lua_assert(i_o->value.gc->gch.tt == LUA_TTABLE); }
-
-#define setnilvalue(obj) ((obj)->tt=LUA_TNIL)
-
-
-
-/*
-** for internal debug only
-*/
-#define checkconsistency(obj) \
- lua_assert(!iscollectable(obj) || (ttype(obj) == (obj)->value.gc->gch.tt))
-
-
-#define setobj(obj1,obj2) \
- { const TObject *o2=(obj2); TObject *o1=(obj1); \
- checkconsistency(o2); \
- o1->tt=o2->tt; o1->value = o2->value; }
-
-
-/*
-** different types of sets, according to destination
-*/
-
-/* from stack to (same) stack */
-#define setobjs2s setobj
-/* to stack (not from same stack) */
-#define setobj2s setobj
-#define setsvalue2s setsvalue
-/* from table to same table */
-#define setobjt2t setobj
-/* to table */
-#define setobj2t setobj
-/* to new object */
-#define setobj2n setobj
-#define setsvalue2n setsvalue
-
-#define setttype(obj, tt) (ttype(obj) = (tt))
-
-
-#define iscollectable(o) (ttype(o) >= LUA_TSTRING)
-
-
-
-typedef TObject *StkId; /* index to stack elements */
-
-
-/*
-** String headers for string table
-*/
-typedef union TString {
- L_Umaxalign dummy; /* ensures maximum alignment for strings */
- struct {
- CommonHeader;
- lu_byte reserved;
- lu_hash hash;
- size_t len;
- } tsv;
-} TString;
-
-
-#define getstr(ts) cast(const char *, (ts) + 1)
-#define svalue(o) getstr(tsvalue(o))
-
-
-
-typedef union Udata {
- L_Umaxalign dummy; /* ensures maximum alignment for `local' udata */
- struct {
- CommonHeader;
- struct Table *metatable;
- size_t len;
- } uv;
-} Udata;
-
-
-
-
-/*
-** Function Prototypes
-*/
-typedef struct Proto {
- CommonHeader;
- TObject *k; /* constants used by the function */
- Instruction *code;
- struct Proto **p; /* functions defined inside the function */
- int *lineinfo; /* map from opcodes to source lines */
- struct LocVar *locvars; /* information about local variables */
- TString **upvalues; /* upvalue names */
- TString *source;
- int sizeupvalues;
- int sizek; /* size of `k' */
- int sizecode;
- int sizelineinfo;
- int sizep; /* size of `p' */
- int sizelocvars;
- int lineDefined;
- GCObject *gclist;
- lu_byte nups; /* number of upvalues */
- lu_byte numparams;
- lu_byte is_vararg;
- lu_byte maxstacksize;
-} Proto;
-
-
-typedef struct LocVar {
- TString *varname;
- int startpc; /* first point where variable is active */
- int endpc; /* first point where variable is dead */
-} LocVar;
-
-
-
-/*
-** Upvalues
-*/
-
-typedef struct UpVal {
- CommonHeader;
- TObject *v; /* points to stack or to its own value */
- TObject value; /* the value (when closed) */
-} UpVal;
-
-
-/*
-** Closures
-*/
-
-#define ClosureHeader \
- CommonHeader; lu_byte isC; lu_byte nupvalues; GCObject *gclist
-
-typedef struct CClosure {
- ClosureHeader;
- lua_CFunction f;
- TObject upvalue[1];
-} CClosure;
-
-
-typedef struct LClosure {
- ClosureHeader;
- struct Proto *p;
- TObject g; /* global table for this closure */
- UpVal *upvals[1];
-} LClosure;
-
-
-typedef union Closure {
- CClosure c;
- LClosure l;
-} Closure;
-
-
-#define iscfunction(o) (ttype(o) == LUA_TFUNCTION && clvalue(o)->c.isC)
-#define isLfunction(o) (ttype(o) == LUA_TFUNCTION && !clvalue(o)->c.isC)
-
-
-/*
-** Tables
-*/
-
-typedef struct Node {
- TObject i_key;
- TObject i_val;
- struct Node *next; /* for chaining */
-} Node;
-
-
-typedef struct Table {
- CommonHeader;
- lu_byte flags; /* 1<<p means tagmethod(p) is not present */
- lu_byte lsizenode; /* log2 of size of `node' array */
- struct Table *metatable;
- TObject *array; /* array part */
- Node *node;
- Node *firstfree; /* this position is free; all positions after it are full */
- GCObject *gclist;
- int sizearray; /* size of `array' array */
-} Table;
-
-
-
-/*
-** `module' operation for hashing (size is always a power of 2)
-*/
-#define lmod(s,size) \
- check_exp((size&(size-1))==0, (cast(int, (s) & ((size)-1))))
-
-
-#define twoto(x) (1<<(x))
-#define sizenode(t) (twoto((t)->lsizenode))
-
-
-
-extern const TObject luaO_nilobject;
-
-int luaO_log2 (unsigned int x);
-int luaO_int2fb (unsigned int x);
-#define fb2int(x) (((x) & 7) << ((x) >> 3))
-
-int luaO_rawequalObj (const TObject *t1, const TObject *t2);
-int luaO_str2d (const char *s, lua_Number *result);
-
-const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp);
-const char *luaO_pushfstring (lua_State *L, const char *fmt, ...);
-void luaO_chunkid (char *out, const char *source, int len);
-
-
-#endif
+/*
+** $Id: lobject.h,v 1.3 2004-11-27 21:43:50 pixel Exp $
+** Type definitions for Lua objects
+** See Copyright Notice in lua.h
+*/
+
+#ifndef lobject_h
+#define lobject_h
+
+
+#include "llimits.h"
+#include "lua.h"
+
+
+/* tags for values visible from Lua */
+#define NUM_TAGS LUA_TTHREAD
+
+
+/*
+** Extra tags for non-values
+*/
+#define LUA_TPROTO (NUM_TAGS+1)
+#define LUA_TUPVAL (NUM_TAGS+2)
+
+
+/*
+** Union of all collectable objects
+*/
+typedef union GCObject GCObject;
+
+
+/*
+** Common Header for all collectable objects (in macro form, to be
+** included in other objects)
+*/
+#define CommonHeader GCObject *next; lu_byte tt; lu_byte marked
+
+
+/*
+** Common header in struct form
+*/
+typedef struct GCheader {
+ CommonHeader;
+} GCheader;
+
+
+
+
+/*
+** Union of all Lua values
+*/
+typedef union {
+ GCObject *gc;
+ void *p;
+ lua_Number n;
+ int b;
+} Value;
+
+
+/*
+** Lua values (or `tagged objects')
+*/
+typedef struct lua_TObject {
+ int tt;
+ Value value;
+} TObject;
+
+
+/* Macros to test type */
+#define ttisnil(o) (ttype(o) == LUA_TNIL)
+#define ttisnumber(o) (ttype(o) == LUA_TNUMBER)
+#define ttisstring(o) (ttype(o) == LUA_TSTRING)
+#define ttistable(o) (ttype(o) == LUA_TTABLE)
+#define ttisfunction(o) (ttype(o) == LUA_TFUNCTION)
+#define ttisboolean(o) (ttype(o) == LUA_TBOOLEAN)
+#define ttisuserdata(o) (ttype(o) == LUA_TUSERDATA)
+#define ttisthread(o) (ttype(o) == LUA_TTHREAD)
+#define ttislightuserdata(o) (ttype(o) == LUA_TLIGHTUSERDATA)
+
+/* Macros to access values */
+#define ttype(o) ((o)->tt)
+#define gcvalue(o) check_exp(iscollectable(o), (o)->value.gc)
+#define pvalue(o) check_exp(ttislightuserdata(o), (o)->value.p)
+#define nvalue(o) check_exp(ttisnumber(o), (o)->value.n)
+#define tsvalue(o) check_exp(ttisstring(o), &(o)->value.gc->ts)
+#define uvalue(o) check_exp(ttisuserdata(o), &(o)->value.gc->u)
+#define clvalue(o) check_exp(ttisfunction(o), &(o)->value.gc->cl)
+#define hvalue(o) check_exp(ttistable(o), &(o)->value.gc->h)
+#define bvalue(o) check_exp(ttisboolean(o), (o)->value.b)
+#define thvalue(o) check_exp(ttisthread(o), &(o)->value.gc->th)
+
+#define l_isfalse(o) (ttisnil(o) || (ttisboolean(o) && bvalue(o) == 0))
+
+/* Macros to set values */
+#define setnvalue(obj,x) \
+ { TObject *i_o=(obj); i_o->tt=LUA_TNUMBER; i_o->value.n=(x); }
+
+#define chgnvalue(obj,x) \
+ check_exp(ttype(obj)==LUA_TNUMBER, (obj)->value.n=(x))
+
+#define setpvalue(obj,x) \
+ { TObject *i_o=(obj); i_o->tt=LUA_TLIGHTUSERDATA; i_o->value.p=(x); }
+
+#define setbvalue(obj,x) \
+ { TObject *i_o=(obj); i_o->tt=LUA_TBOOLEAN; i_o->value.b=(x); }
+
+#define setsvalue(obj,x) \
+ { TObject *i_o=(obj); i_o->tt=LUA_TSTRING; \
+ i_o->value.gc=cast(GCObject *, (x)); \
+ lua_assert(i_o->value.gc->gch.tt == LUA_TSTRING); }
+
+#define setuvalue(obj,x) \
+ { TObject *i_o=(obj); i_o->tt=LUA_TUSERDATA; \
+ i_o->value.gc=cast(GCObject *, (x)); \
+ lua_assert(i_o->value.gc->gch.tt == LUA_TUSERDATA); }
+
+#define setthvalue(obj,x) \
+ { TObject *i_o=(obj); i_o->tt=LUA_TTHREAD; \
+ i_o->value.gc=cast(GCObject *, (x)); \
+ lua_assert(i_o->value.gc->gch.tt == LUA_TTHREAD); }
+
+#define setclvalue(obj,x) \
+ { TObject *i_o=(obj); i_o->tt=LUA_TFUNCTION; \
+ i_o->value.gc=cast(GCObject *, (x)); \
+ lua_assert(i_o->value.gc->gch.tt == LUA_TFUNCTION); }
+
+#define sethvalue(obj,x) \
+ { TObject *i_o=(obj); i_o->tt=LUA_TTABLE; \
+ i_o->value.gc=cast(GCObject *, (x)); \
+ lua_assert(i_o->value.gc->gch.tt == LUA_TTABLE); }
+
+#define setnilvalue(obj) ((obj)->tt=LUA_TNIL)
+
+
+
+/*
+** for internal debug only
+*/
+#define checkconsistency(obj) \
+ lua_assert(!iscollectable(obj) || (ttype(obj) == (obj)->value.gc->gch.tt))
+
+
+#define setobj(obj1,obj2) \
+ { const TObject *o2=(obj2); TObject *o1=(obj1); \
+ checkconsistency(o2); \
+ o1->tt=o2->tt; o1->value = o2->value; }
+
+
+/*
+** different types of sets, according to destination
+*/
+
+/* from stack to (same) stack */
+#define setobjs2s setobj
+/* to stack (not from same stack) */
+#define setobj2s setobj
+#define setsvalue2s setsvalue
+/* from table to same table */
+#define setobjt2t setobj
+/* to table */
+#define setobj2t setobj
+/* to new object */
+#define setobj2n setobj
+#define setsvalue2n setsvalue
+
+#define setttype(obj, tt) (ttype(obj) = (tt))
+
+
+#define iscollectable(o) (ttype(o) >= LUA_TSTRING)
+
+
+
+typedef TObject *StkId; /* index to stack elements */
+
+
+/*
+** String headers for string table
+*/
+typedef union TString {
+ L_Umaxalign dummy; /* ensures maximum alignment for strings */
+ struct {
+ CommonHeader;
+ lu_byte reserved;
+ lu_hash hash;
+ size_t len;
+ } tsv;
+} TString;
+
+
+#define getstr(ts) cast(const char *, (ts) + 1)
+#define svalue(o) getstr(tsvalue(o))
+
+
+
+typedef union Udata {
+ L_Umaxalign dummy; /* ensures maximum alignment for `local' udata */
+ struct {
+ CommonHeader;
+ struct Table *metatable;
+ size_t len;
+ } uv;
+} Udata;
+
+
+
+
+/*
+** Function Prototypes
+*/
+typedef struct Proto {
+ CommonHeader;
+ TObject *k; /* constants used by the function */
+ Instruction *code;
+ struct Proto **p; /* functions defined inside the function */
+ int *lineinfo; /* map from opcodes to source lines */
+ struct LocVar *locvars; /* information about local variables */
+ TString **upvalues; /* upvalue names */
+ TString *source;
+ int sizeupvalues;
+ int sizek; /* size of `k' */
+ int sizecode;
+ int sizelineinfo;
+ int sizep; /* size of `p' */
+ int sizelocvars;
+ int lineDefined;
+ GCObject *gclist;
+ lu_byte nups; /* number of upvalues */
+ lu_byte numparams;
+ lu_byte is_vararg;
+ lu_byte maxstacksize;
+} Proto;
+
+
+typedef struct LocVar {
+ TString *varname;
+ int startpc; /* first point where variable is active */
+ int endpc; /* first point where variable is dead */
+} LocVar;
+
+
+
+/*
+** Upvalues
+*/
+
+typedef struct UpVal {
+ CommonHeader;
+ TObject *v; /* points to stack or to its own value */
+ TObject value; /* the value (when closed) */
+} UpVal;
+
+
+/*
+** Closures
+*/
+
+#define ClosureHeader \
+ CommonHeader; lu_byte isC; lu_byte nupvalues; GCObject *gclist
+
+typedef struct CClosure {
+ ClosureHeader;
+ lua_CFunction f;
+ TObject upvalue[1];
+} CClosure;
+
+
+typedef struct LClosure {
+ ClosureHeader;
+ struct Proto *p;
+ TObject g; /* global table for this closure */
+ UpVal *upvals[1];
+} LClosure;
+
+
+typedef union Closure {
+ CClosure c;
+ LClosure l;
+} Closure;
+
+
+#define iscfunction(o) (ttype(o) == LUA_TFUNCTION && clvalue(o)->c.isC)
+#define isLfunction(o) (ttype(o) == LUA_TFUNCTION && !clvalue(o)->c.isC)
+
+
+/*
+** Tables
+*/
+
+typedef struct Node {
+ TObject i_key;
+ TObject i_val;
+ struct Node *next; /* for chaining */
+} Node;
+
+
+typedef struct Table {
+ CommonHeader;
+ lu_byte flags; /* 1<<p means tagmethod(p) is not present */
+ lu_byte lsizenode; /* log2 of size of `node' array */
+ struct Table *metatable;
+ TObject *array; /* array part */
+ Node *node;
+ Node *firstfree; /* this position is free; all positions after it are full */
+ GCObject *gclist;
+ int sizearray; /* size of `array' array */
+} Table;
+
+
+
+/*
+** `module' operation for hashing (size is always a power of 2)
+*/
+#define lmod(s,size) \
+ check_exp((size&(size-1))==0, (cast(int, (s) & ((size)-1))))
+
+
+#define twoto(x) (1<<(x))
+#define sizenode(t) (twoto((t)->lsizenode))
+
+
+
+extern const TObject luaO_nilobject;
+
+int luaO_log2 (unsigned int x);
+int luaO_int2fb (unsigned int x);
+#define fb2int(x) (((x) & 7) << ((x) >> 3))
+
+int luaO_rawequalObj (const TObject *t1, const TObject *t2);
+int luaO_str2d (const char *s, lua_Number *result);
+
+const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp);
+const char *luaO_pushfstring (lua_State *L, const char *fmt, ...);
+void luaO_chunkid (char *out, const char *source, int len);
+
+
+#endif
diff --git a/lib/lua/includes/lopcodes.h b/lib/lua/includes/lopcodes.h
index f315ec1..0418593 100644
--- a/lib/lua/includes/lopcodes.h
+++ b/lib/lua/includes/lopcodes.h
@@ -1,238 +1,238 @@
-/*
-** $Id: lopcodes.h,v 1.2 2003-12-11 16:53:29 pixel Exp $
-** Opcodes for Lua virtual machine
-** See Copyright Notice in lua.h
-*/
-
-#ifndef lopcodes_h
-#define lopcodes_h
-
-#include "llimits.h"
-
-
-/*===========================================================================
- We assume that instructions are unsigned numbers.
- All instructions have an opcode in the first 6 bits.
- Instructions can have the following fields:
- `A' : 8 bits
- `B' : 9 bits
- `C' : 9 bits
- `Bx' : 18 bits (`B' and `C' together)
- `sBx' : signed Bx
-
- A signed argument is represented in excess K; that is, the number
- value is the unsigned value minus K. K is exactly the maximum value
- for that argument (so that -max is represented by 0, and +max is
- represented by 2*max), which is half the maximum for the corresponding
- unsigned argument.
-===========================================================================*/
-
-
-enum OpMode {iABC, iABx, iAsBx}; /* basic instruction format */
-
-
-/*
-** size and position of opcode arguments.
-*/
-#define SIZE_C 9
-#define SIZE_B 9
-#define SIZE_Bx (SIZE_C + SIZE_B)
-#define SIZE_A 8
-
-#define SIZE_OP 6
-
-#define POS_C SIZE_OP
-#define POS_B (POS_C + SIZE_C)
-#define POS_Bx POS_C
-#define POS_A (POS_B + SIZE_B)
-
-
-/*
-** limits for opcode arguments.
-** we use (signed) int to manipulate most arguments,
-** so they must fit in BITS_INT-1 bits (-1 for sign)
-*/
-#if SIZE_Bx < BITS_INT-1
-#define MAXARG_Bx ((1<<SIZE_Bx)-1)
-#define MAXARG_sBx (MAXARG_Bx>>1) /* `sBx' is signed */
-#else
-#define MAXARG_Bx MAX_INT
-#define MAXARG_sBx MAX_INT
-#endif
-
-
-#define MAXARG_A ((1<<SIZE_A)-1)
-#define MAXARG_B ((1<<SIZE_B)-1)
-#define MAXARG_C ((1<<SIZE_C)-1)
-
-
-/* creates a mask with `n' 1 bits at position `p' */
-#define MASK1(n,p) ((~((~(Instruction)0)<<n))<<p)
-
-/* creates a mask with `n' 0 bits at position `p' */
-#define MASK0(n,p) (~MASK1(n,p))
-
-/*
-** the following macros help to manipulate instructions
-*/
-
-#define GET_OPCODE(i) (cast(OpCode, (i)&MASK1(SIZE_OP,0)))
-#define SET_OPCODE(i,o) ((i) = (((i)&MASK0(SIZE_OP,0)) | cast(Instruction, o)))
-
-#define GETARG_A(i) (cast(int, (i)>>POS_A))
-#define SETARG_A(i,u) ((i) = (((i)&MASK0(SIZE_A,POS_A)) | \
- ((cast(Instruction, u)<<POS_A)&MASK1(SIZE_A,POS_A))))
-
-#define GETARG_B(i) (cast(int, ((i)>>POS_B) & MASK1(SIZE_B,0)))
-#define SETARG_B(i,b) ((i) = (((i)&MASK0(SIZE_B,POS_B)) | \
- ((cast(Instruction, b)<<POS_B)&MASK1(SIZE_B,POS_B))))
-
-#define GETARG_C(i) (cast(int, ((i)>>POS_C) & MASK1(SIZE_C,0)))
-#define SETARG_C(i,b) ((i) = (((i)&MASK0(SIZE_C,POS_C)) | \
- ((cast(Instruction, b)<<POS_C)&MASK1(SIZE_C,POS_C))))
-
-#define GETARG_Bx(i) (cast(int, ((i)>>POS_Bx) & MASK1(SIZE_Bx,0)))
-#define SETARG_Bx(i,b) ((i) = (((i)&MASK0(SIZE_Bx,POS_Bx)) | \
- ((cast(Instruction, b)<<POS_Bx)&MASK1(SIZE_Bx,POS_Bx))))
-
-#define GETARG_sBx(i) (GETARG_Bx(i)-MAXARG_sBx)
-#define SETARG_sBx(i,b) SETARG_Bx((i),cast(unsigned int, (b)+MAXARG_sBx))
-
-
-#define CREATE_ABC(o,a,b,c) (cast(Instruction, o) \
- | (cast(Instruction, a)<<POS_A) \
- | (cast(Instruction, b)<<POS_B) \
- | (cast(Instruction, c)<<POS_C))
-
-#define CREATE_ABx(o,a,bc) (cast(Instruction, o) \
- | (cast(Instruction, a)<<POS_A) \
- | (cast(Instruction, bc)<<POS_Bx))
-
-
-
-
-/*
-** invalid register that fits in 8 bits
-*/
-#define NO_REG MAXARG_A
-
-
-/*
-** R(x) - register
-** Kst(x) - constant (in constant table)
-** RK(x) == if x < MAXSTACK then R(x) else Kst(x-MAXSTACK)
-*/
-
-
-/*
-** grep "ORDER OP" if you change these enums
-*/
-
-typedef enum {
-/*----------------------------------------------------------------------
-name args description
-------------------------------------------------------------------------*/
-OP_MOVE,/* A B R(A) := R(B) */
-OP_LOADK,/* A Bx R(A) := Kst(Bx) */
-OP_LOADBOOL,/* A B C R(A) := (Bool)B; if (C) PC++ */
-OP_LOADNIL,/* A B R(A) := ... := R(B) := nil */
-OP_GETUPVAL,/* A B R(A) := UpValue[B] */
-
-OP_GETGLOBAL,/* A Bx R(A) := Gbl[Kst(Bx)] */
-OP_GETTABLE,/* A B C R(A) := R(B)[RK(C)] */
-
-OP_SETGLOBAL,/* A Bx Gbl[Kst(Bx)] := R(A) */
-OP_SETUPVAL,/* A B UpValue[B] := R(A) */
-OP_SETTABLE,/* A B C R(A)[RK(B)] := RK(C) */
-
-OP_NEWTABLE,/* A B C R(A) := {} (size = B,C) */
-
-OP_SELF,/* A B C R(A+1) := R(B); R(A) := R(B)[RK(C)] */
-
-OP_ADD,/* A B C R(A) := RK(B) + RK(C) */
-OP_SUB,/* A B C R(A) := RK(B) - RK(C) */
-OP_MUL,/* A B C R(A) := RK(B) * RK(C) */
-OP_DIV,/* A B C R(A) := RK(B) / RK(C) */
-OP_POW,/* A B C R(A) := RK(B) ^ RK(C) */
-OP_UNM,/* A B R(A) := -R(B) */
-OP_NOT,/* A B R(A) := not R(B) */
-
-OP_CONCAT,/* A B C R(A) := R(B).. ... ..R(C) */
-
-OP_JMP,/* sBx PC += sBx */
-
-OP_EQ,/* A B C if ((RK(B) == RK(C)) ~= A) then pc++ */
-OP_LT,/* A B C if ((RK(B) < RK(C)) ~= A) then pc++ */
-OP_LE,/* A B C if ((RK(B) <= RK(C)) ~= A) then pc++ */
-
-OP_TEST,/* A B C if (R(B) <=> C) then R(A) := R(B) else pc++ */
-
-OP_CALL,/* A B C R(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1)) */
-OP_TAILCALL,/* A B C return R(A)(R(A+1), ... ,R(A+B-1)) */
-OP_RETURN,/* A B return R(A), ... ,R(A+B-2) (see note) */
-
-OP_FORLOOP,/* A sBx R(A)+=R(A+2); if R(A) <?= R(A+1) then PC+= sBx */
-
-OP_TFORLOOP,/* A C R(A+2), ... ,R(A+2+C) := R(A)(R(A+1), R(A+2));
- if R(A+2) ~= nil then pc++ */
-OP_TFORPREP,/* A sBx if type(R(A)) == table then R(A+1):=R(A), R(A):=next;
- PC += sBx */
-
-OP_SETLIST,/* A Bx R(A)[Bx-Bx%FPF+i] := R(A+i), 1 <= i <= Bx%FPF+1 */
-OP_SETLISTO,/* A Bx */
-
-OP_CLOSE,/* A close all variables in the stack up to (>=) R(A)*/
-OP_CLOSURE/* A Bx R(A) := closure(KPROTO[Bx], R(A), ... ,R(A+n)) */
-} OpCode;
-
-
-#define NUM_OPCODES (cast(int, OP_CLOSURE+1))
-
-
-
-/*===========================================================================
- Notes:
- (1) In OP_CALL, if (B == 0) then B = top. C is the number of returns - 1,
- and can be 0: OP_CALL then sets `top' to last_result+1, so
- next open instruction (OP_CALL, OP_RETURN, OP_SETLIST) may use `top'.
-
- (2) In OP_RETURN, if (B == 0) then return up to `top'
-
- (3) For comparisons, B specifies what conditions the test should accept.
-
- (4) All `skips' (pc++) assume that next instruction is a jump
-===========================================================================*/
-
-
-/*
-** masks for instruction properties
-*/
-enum OpModeMask {
- OpModeBreg = 2, /* B is a register */
- OpModeBrk, /* B is a register/constant */
- OpModeCrk, /* C is a register/constant */
- OpModesetA, /* instruction set register A */
- OpModeK, /* Bx is a constant */
- OpModeT /* operator is a test */
-
-};
-
-
-extern const lu_byte luaP_opmodes[NUM_OPCODES];
-
-#define getOpMode(m) (cast(enum OpMode, luaP_opmodes[m] & 3))
-#define testOpMode(m, b) (luaP_opmodes[m] & (1 << (b)))
-
-
-#ifdef LUA_OPNAMES
-extern const char *const luaP_opnames[]; /* opcode names */
-#endif
-
-
-
-/* number of list items to accumulate before a SETLIST instruction */
-/* (must be a power of 2) */
-#define LFIELDS_PER_FLUSH 32
-
-
-#endif
+/*
+** $Id: lopcodes.h,v 1.3 2004-11-27 21:43:50 pixel Exp $
+** Opcodes for Lua virtual machine
+** See Copyright Notice in lua.h
+*/
+
+#ifndef lopcodes_h
+#define lopcodes_h
+
+#include "llimits.h"
+
+
+/*===========================================================================
+ We assume that instructions are unsigned numbers.
+ All instructions have an opcode in the first 6 bits.
+ Instructions can have the following fields:
+ `A' : 8 bits
+ `B' : 9 bits
+ `C' : 9 bits
+ `Bx' : 18 bits (`B' and `C' together)
+ `sBx' : signed Bx
+
+ A signed argument is represented in excess K; that is, the number
+ value is the unsigned value minus K. K is exactly the maximum value
+ for that argument (so that -max is represented by 0, and +max is
+ represented by 2*max), which is half the maximum for the corresponding
+ unsigned argument.
+===========================================================================*/
+
+
+enum OpMode {iABC, iABx, iAsBx}; /* basic instruction format */
+
+
+/*
+** size and position of opcode arguments.
+*/
+#define SIZE_C 9
+#define SIZE_B 9
+#define SIZE_Bx (SIZE_C + SIZE_B)
+#define SIZE_A 8
+
+#define SIZE_OP 6
+
+#define POS_C SIZE_OP
+#define POS_B (POS_C + SIZE_C)
+#define POS_Bx POS_C
+#define POS_A (POS_B + SIZE_B)
+
+
+/*
+** limits for opcode arguments.
+** we use (signed) int to manipulate most arguments,
+** so they must fit in BITS_INT-1 bits (-1 for sign)
+*/
+#if SIZE_Bx < BITS_INT-1
+#define MAXARG_Bx ((1<<SIZE_Bx)-1)
+#define MAXARG_sBx (MAXARG_Bx>>1) /* `sBx' is signed */
+#else
+#define MAXARG_Bx MAX_INT
+#define MAXARG_sBx MAX_INT
+#endif
+
+
+#define MAXARG_A ((1<<SIZE_A)-1)
+#define MAXARG_B ((1<<SIZE_B)-1)
+#define MAXARG_C ((1<<SIZE_C)-1)
+
+
+/* creates a mask with `n' 1 bits at position `p' */
+#define MASK1(n,p) ((~((~(Instruction)0)<<n))<<p)
+
+/* creates a mask with `n' 0 bits at position `p' */
+#define MASK0(n,p) (~MASK1(n,p))
+
+/*
+** the following macros help to manipulate instructions
+*/
+
+#define GET_OPCODE(i) (cast(OpCode, (i)&MASK1(SIZE_OP,0)))
+#define SET_OPCODE(i,o) ((i) = (((i)&MASK0(SIZE_OP,0)) | cast(Instruction, o)))
+
+#define GETARG_A(i) (cast(int, (i)>>POS_A))
+#define SETARG_A(i,u) ((i) = (((i)&MASK0(SIZE_A,POS_A)) | \
+ ((cast(Instruction, u)<<POS_A)&MASK1(SIZE_A,POS_A))))
+
+#define GETARG_B(i) (cast(int, ((i)>>POS_B) & MASK1(SIZE_B,0)))
+#define SETARG_B(i,b) ((i) = (((i)&MASK0(SIZE_B,POS_B)) | \
+ ((cast(Instruction, b)<<POS_B)&MASK1(SIZE_B,POS_B))))
+
+#define GETARG_C(i) (cast(int, ((i)>>POS_C) & MASK1(SIZE_C,0)))
+#define SETARG_C(i,b) ((i) = (((i)&MASK0(SIZE_C,POS_C)) | \
+ ((cast(Instruction, b)<<POS_C)&MASK1(SIZE_C,POS_C))))
+
+#define GETARG_Bx(i) (cast(int, ((i)>>POS_Bx) & MASK1(SIZE_Bx,0)))
+#define SETARG_Bx(i,b) ((i) = (((i)&MASK0(SIZE_Bx,POS_Bx)) | \
+ ((cast(Instruction, b)<<POS_Bx)&MASK1(SIZE_Bx,POS_Bx))))
+
+#define GETARG_sBx(i) (GETARG_Bx(i)-MAXARG_sBx)
+#define SETARG_sBx(i,b) SETARG_Bx((i),cast(unsigned int, (b)+MAXARG_sBx))
+
+
+#define CREATE_ABC(o,a,b,c) (cast(Instruction, o) \
+ | (cast(Instruction, a)<<POS_A) \
+ | (cast(Instruction, b)<<POS_B) \
+ | (cast(Instruction, c)<<POS_C))
+
+#define CREATE_ABx(o,a,bc) (cast(Instruction, o) \
+ | (cast(Instruction, a)<<POS_A) \
+ | (cast(Instruction, bc)<<POS_Bx))
+
+
+
+
+/*
+** invalid register that fits in 8 bits
+*/
+#define NO_REG MAXARG_A
+
+
+/*
+** R(x) - register
+** Kst(x) - constant (in constant table)
+** RK(x) == if x < MAXSTACK then R(x) else Kst(x-MAXSTACK)
+*/
+
+
+/*
+** grep "ORDER OP" if you change these enums
+*/
+
+typedef enum {
+/*----------------------------------------------------------------------
+name args description
+------------------------------------------------------------------------*/
+OP_MOVE,/* A B R(A) := R(B) */
+OP_LOADK,/* A Bx R(A) := Kst(Bx) */
+OP_LOADBOOL,/* A B C R(A) := (Bool)B; if (C) PC++ */
+OP_LOADNIL,/* A B R(A) := ... := R(B) := nil */
+OP_GETUPVAL,/* A B R(A) := UpValue[B] */
+
+OP_GETGLOBAL,/* A Bx R(A) := Gbl[Kst(Bx)] */
+OP_GETTABLE,/* A B C R(A) := R(B)[RK(C)] */
+
+OP_SETGLOBAL,/* A Bx Gbl[Kst(Bx)] := R(A) */
+OP_SETUPVAL,/* A B UpValue[B] := R(A) */
+OP_SETTABLE,/* A B C R(A)[RK(B)] := RK(C) */
+
+OP_NEWTABLE,/* A B C R(A) := {} (size = B,C) */
+
+OP_SELF,/* A B C R(A+1) := R(B); R(A) := R(B)[RK(C)] */
+
+OP_ADD,/* A B C R(A) := RK(B) + RK(C) */
+OP_SUB,/* A B C R(A) := RK(B) - RK(C) */
+OP_MUL,/* A B C R(A) := RK(B) * RK(C) */
+OP_DIV,/* A B C R(A) := RK(B) / RK(C) */
+OP_POW,/* A B C R(A) := RK(B) ^ RK(C) */
+OP_UNM,/* A B R(A) := -R(B) */
+OP_NOT,/* A B R(A) := not R(B) */
+
+OP_CONCAT,/* A B C R(A) := R(B).. ... ..R(C) */
+
+OP_JMP,/* sBx PC += sBx */
+
+OP_EQ,/* A B C if ((RK(B) == RK(C)) ~= A) then pc++ */
+OP_LT,/* A B C if ((RK(B) < RK(C)) ~= A) then pc++ */
+OP_LE,/* A B C if ((RK(B) <= RK(C)) ~= A) then pc++ */
+
+OP_TEST,/* A B C if (R(B) <=> C) then R(A) := R(B) else pc++ */
+
+OP_CALL,/* A B C R(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1)) */
+OP_TAILCALL,/* A B C return R(A)(R(A+1), ... ,R(A+B-1)) */
+OP_RETURN,/* A B return R(A), ... ,R(A+B-2) (see note) */
+
+OP_FORLOOP,/* A sBx R(A)+=R(A+2); if R(A) <?= R(A+1) then PC+= sBx */
+
+OP_TFORLOOP,/* A C R(A+2), ... ,R(A+2+C) := R(A)(R(A+1), R(A+2));
+ if R(A+2) ~= nil then pc++ */
+OP_TFORPREP,/* A sBx if type(R(A)) == table then R(A+1):=R(A), R(A):=next;
+ PC += sBx */
+
+OP_SETLIST,/* A Bx R(A)[Bx-Bx%FPF+i] := R(A+i), 1 <= i <= Bx%FPF+1 */
+OP_SETLISTO,/* A Bx */
+
+OP_CLOSE,/* A close all variables in the stack up to (>=) R(A)*/
+OP_CLOSURE/* A Bx R(A) := closure(KPROTO[Bx], R(A), ... ,R(A+n)) */
+} OpCode;
+
+
+#define NUM_OPCODES (cast(int, OP_CLOSURE+1))
+
+
+
+/*===========================================================================
+ Notes:
+ (1) In OP_CALL, if (B == 0) then B = top. C is the number of returns - 1,
+ and can be 0: OP_CALL then sets `top' to last_result+1, so
+ next open instruction (OP_CALL, OP_RETURN, OP_SETLIST) may use `top'.
+
+ (2) In OP_RETURN, if (B == 0) then return up to `top'
+
+ (3) For comparisons, B specifies what conditions the test should accept.
+
+ (4) All `skips' (pc++) assume that next instruction is a jump
+===========================================================================*/
+
+
+/*
+** masks for instruction properties
+*/
+enum OpModeMask {
+ OpModeBreg = 2, /* B is a register */
+ OpModeBrk, /* B is a register/constant */
+ OpModeCrk, /* C is a register/constant */
+ OpModesetA, /* instruction set register A */
+ OpModeK, /* Bx is a constant */
+ OpModeT /* operator is a test */
+
+};
+
+
+extern const lu_byte luaP_opmodes[NUM_OPCODES];
+
+#define getOpMode(m) (cast(enum OpMode, luaP_opmodes[m] & 3))
+#define testOpMode(m, b) (luaP_opmodes[m] & (1 << (b)))
+
+
+#ifdef LUA_OPNAMES
+extern const char *const luaP_opnames[]; /* opcode names */
+#endif
+
+
+
+/* number of list items to accumulate before a SETLIST instruction */
+/* (must be a power of 2) */
+#define LFIELDS_PER_FLUSH 32
+
+
+#endif
diff --git a/lib/lua/includes/lparser.h b/lib/lua/includes/lparser.h
index 1fd24cf..7055a9e 100644
--- a/lib/lua/includes/lparser.h
+++ b/lib/lua/includes/lparser.h
@@ -1,71 +1,71 @@
-/*
-** $Id: lparser.h,v 1.2 2003-12-11 16:53:29 pixel Exp $
-** Lua Parser
-** See Copyright Notice in lua.h
-*/
-
-#ifndef lparser_h
-#define lparser_h
-
-#include "llimits.h"
-#include "lobject.h"
-#include "ltable.h"
-#include "lzio.h"
-
-
-/*
-** Expression descriptor
-*/
-
-typedef enum {
- VVOID, /* no value */
- VNIL,
- VTRUE,
- VFALSE,
- VK, /* info = index of constant in `k' */
- VLOCAL, /* info = local register */
- VUPVAL, /* info = index of upvalue in `upvalues' */
- VGLOBAL, /* info = index of table; aux = index of global name in `k' */
- VINDEXED, /* info = table register; aux = index register (or `k') */
- VJMP, /* info = instruction pc */
- VRELOCABLE, /* info = instruction pc */
- VNONRELOC, /* info = result register */
- VCALL /* info = result register */
-} expkind;
-
-typedef struct expdesc {
- expkind k;
- int info, aux;
- int t; /* patch list of `exit when true' */
- int f; /* patch list of `exit when false' */
-} expdesc;
-
-
-struct BlockCnt; /* defined in lparser.c */
-
-
-/* state needed to generate code for a given function */
-typedef struct FuncState {
- Proto *f; /* current function header */
- Table *h; /* table to find (and reuse) elements in `k' */
- struct FuncState *prev; /* enclosing function */
- struct LexState *ls; /* lexical state */
- struct lua_State *L; /* copy of the Lua state */
- struct BlockCnt *bl; /* chain of current blocks */
- int pc; /* next position to code (equivalent to `ncode') */
- int lasttarget; /* `pc' of last `jump target' */
- int jpc; /* list of pending jumps to `pc' */
- int freereg; /* first free register */
- int nk; /* number of elements in `k' */
- int np; /* number of elements in `p' */
- int nlocvars; /* number of elements in `locvars' */
- int nactvar; /* number of active local variables */
- expdesc upvalues[MAXUPVALUES]; /* upvalues */
- int actvar[MAXVARS]; /* declared-variable stack */
-} FuncState;
-
-
-Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff);
-
-
-#endif
+/*
+** $Id: lparser.h,v 1.3 2004-11-27 21:43:50 pixel Exp $
+** Lua Parser
+** See Copyright Notice in lua.h
+*/
+
+#ifndef lparser_h
+#define lparser_h
+
+#include "llimits.h"
+#include "lobject.h"
+#include "ltable.h"
+#include "lzio.h"
+
+
+/*
+** Expression descriptor
+*/
+
+typedef enum {
+ VVOID, /* no value */
+ VNIL,
+ VTRUE,
+ VFALSE,
+ VK, /* info = index of constant in `k' */
+ VLOCAL, /* info = local register */
+ VUPVAL, /* info = index of upvalue in `upvalues' */
+ VGLOBAL, /* info = index of table; aux = index of global name in `k' */
+ VINDEXED, /* info = table register; aux = index register (or `k') */
+ VJMP, /* info = instruction pc */
+ VRELOCABLE, /* info = instruction pc */
+ VNONRELOC, /* info = result register */
+ VCALL /* info = result register */
+} expkind;
+
+typedef struct expdesc {
+ expkind k;
+ int info, aux;
+ int t; /* patch list of `exit when true' */
+ int f; /* patch list of `exit when false' */
+} expdesc;
+
+
+struct BlockCnt; /* defined in lparser.c */
+
+
+/* state needed to generate code for a given function */
+typedef struct FuncState {
+ Proto *f; /* current function header */
+ Table *h; /* table to find (and reuse) elements in `k' */
+ struct FuncState *prev; /* enclosing function */
+ struct LexState *ls; /* lexical state */
+ struct lua_State *L; /* copy of the Lua state */
+ struct BlockCnt *bl; /* chain of current blocks */
+ int pc; /* next position to code (equivalent to `ncode') */
+ int lasttarget; /* `pc' of last `jump target' */
+ int jpc; /* list of pending jumps to `pc' */
+ int freereg; /* first free register */
+ int nk; /* number of elements in `k' */
+ int np; /* number of elements in `p' */
+ int nlocvars; /* number of elements in `locvars' */
+ int nactvar; /* number of active local variables */
+ expdesc upvalues[MAXUPVALUES]; /* upvalues */
+ int actvar[MAXVARS]; /* declared-variable stack */
+} FuncState;
+
+
+Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff);
+
+
+#endif
diff --git a/lib/lua/includes/lstate.h b/lib/lua/includes/lstate.h
index 191cb45..93cec30 100644
--- a/lib/lua/includes/lstate.h
+++ b/lib/lua/includes/lstate.h
@@ -1,200 +1,200 @@
-/*
-** $Id: lstate.h,v 1.3 2004-07-23 13:08:23 pixel Exp $
-** Global State
-** See Copyright Notice in lua.h
-*/
-
-#ifndef lstate_h
-#define lstate_h
-
-#include "lua.h"
-
-#include "lobject.h"
-#include "ltm.h"
-#include "lzio.h"
-
-
-/*
-** 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).
-*/
-
-void do_lua_lock(lua_State *);
-void do_lua_unlock(lua_State *);
-
-#ifndef lua_lock
-#define lua_lock(L) do_lua_lock(L)
-#endif
-
-#ifndef lua_unlock
-#define lua_unlock(L) do_lua_unlock(L)
-#endif
-
-
-#ifndef lua_userstateopen
-#define lua_userstateopen(l)
-#endif
-
-
-
-struct lua_longjmp; /* defined in ldo.c */
-
-
-/* default meta table (both for tables and udata) */
-#define defaultmeta(L) (&G(L)->_defaultmeta)
-
-/* table of globals */
-#define gt(L) (&L->_gt)
-
-/* registry */
-#define registry(L) (&G(L)->_registry)
-
-
-/* extra stack space to handle TM calls and some other extras */
-#define EXTRA_STACK 5
-
-
-#define BASIC_CI_SIZE 8
-
-#define BASIC_STACK_SIZE (2*LUA_MINSTACK)
-
-
-
-typedef struct stringtable {
- GCObject **hash;
- ls_nstr nuse; /* number of elements */
- int size;
-} stringtable;
-
-
-/*
-** informations about a call
-*/
-typedef struct CallInfo {
- StkId base; /* base for called function */
- StkId top; /* top for this function */
- int state; /* bit fields; see below */
- union {
- struct { /* for Lua functions */
- const Instruction *savedpc;
- const Instruction **pc; /* points to `pc' variable in `luaV_execute' */
- int tailcalls; /* number of tail calls lost under this entry */
- } l;
- struct { /* for C functions */
- int dummy; /* just to avoid an empty struct */
- } c;
- } u;
-} CallInfo;
-
-
-/*
-** bit fields for `CallInfo.state'
-*/
-#define CI_C (1<<0) /* 1 if function is a C function */
-/* 1 if (Lua) function has an active `luaV_execute' running it */
-#define CI_HASFRAME (1<<1)
-/* 1 if Lua function is calling another Lua function (and therefore its
- `pc' is being used by the other, and therefore CI_SAVEDPC is 1 too) */
-#define CI_CALLING (1<<2)
-#define CI_SAVEDPC (1<<3) /* 1 if `savedpc' is updated */
-#define CI_YIELD (1<<4) /* 1 if thread is suspended */
-#define CI_BREAK (1<<5) /* 1 if user break */
-
-
-#define ci_func(ci) (clvalue((ci)->base - 1))
-
-
-/*
-** `global state', shared by all threads of this state
-*/
-typedef struct global_State {
- stringtable strt; /* hash table for strings */
- GCObject *rootgc; /* list of (almost) all collectable objects */
- GCObject *rootudata; /* (separated) list of all userdata */
- GCObject *tmudata; /* list of userdata to be GC */
- Mbuffer buff; /* temporary buffer for string concatentation */
- lu_mem GCthreshold;
- lu_mem nblocks; /* number of `bytes' currently allocated */
- lua_CFunction panic; /* to be called in unprotected errors */
- TObject _registry;
- TObject _defaultmeta;
- struct lua_State *mainthread;
- Node dummynode[1]; /* common node array for all empty tables */
- TString *tmname[TM_N]; /* array with tag-method names */
-} global_State;
-
-
-/*
-** `per thread' state
-*/
-struct lua_State {
- CommonHeader;
- StkId top; /* first free slot in the stack */
- StkId base; /* base of current function */
- global_State *l_G;
- CallInfo *ci; /* call info for current function */
- StkId stack_last; /* last free slot in the stack */
- StkId stack; /* stack base */
- int stacksize;
- CallInfo *end_ci; /* points after end of ci array*/
- CallInfo *base_ci; /* array of CallInfo's */
- unsigned short size_ci; /* size of array `base_ci' */
- unsigned short nCcalls; /* number of nested C calls */
- lu_byte hookmask;
- lu_byte allowhook;
- lu_byte hookinit;
- int basehookcount;
- int hookcount;
- lua_Hook hook;
- TObject _gt; /* table of globals */
- GCObject *openupval; /* list of open upvalues in this stack */
- GCObject *gclist;
- struct lua_longjmp *errorJmp; /* current error recover point */
- ptrdiff_t errfunc; /* current error handling function (stack index) */
-};
-
-
-#define G(L) (L->l_G)
-
-
-/*
-** Union of all collectable objects
-*/
-union GCObject {
- GCheader gch;
- union TString ts;
- union Udata u;
- union Closure cl;
- struct Table h;
- struct Proto p;
- struct UpVal uv;
- struct lua_State th; /* thread */
-};
-
-
-/* macros to convert a GCObject into a specific value */
-#define gcotots(o) check_exp((o)->gch.tt == LUA_TSTRING, &((o)->ts))
-#define gcotou(o) check_exp((o)->gch.tt == LUA_TUSERDATA, &((o)->u))
-#define gcotocl(o) check_exp((o)->gch.tt == LUA_TFUNCTION, &((o)->cl))
-#define gcotoh(o) check_exp((o)->gch.tt == LUA_TTABLE, &((o)->h))
-#define gcotop(o) check_exp((o)->gch.tt == LUA_TPROTO, &((o)->p))
-#define gcotouv(o) check_exp((o)->gch.tt == LUA_TUPVAL, &((o)->uv))
-#define ngcotouv(o) \
- check_exp((o) == NULL || (o)->gch.tt == LUA_TUPVAL, &((o)->uv))
-#define gcototh(o) check_exp((o)->gch.tt == LUA_TTHREAD, &((o)->th))
-
-/* macro to convert any value into a GCObject */
-#define valtogco(v) (cast(GCObject *, (v)))
-
-
-lua_State *luaE_newthread (lua_State *L);
-void luaE_freethread (lua_State *L, lua_State *L1);
-
-#endif
-
+/*
+** $Id: lstate.h,v 1.4 2004-11-27 21:43:50 pixel Exp $
+** Global State
+** See Copyright Notice in lua.h
+*/
+
+#ifndef lstate_h
+#define lstate_h
+
+#include "lua.h"
+
+#include "lobject.h"
+#include "ltm.h"
+#include "lzio.h"
+
+
+/*
+** 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).
+*/
+
+void do_lua_lock(lua_State *);
+void do_lua_unlock(lua_State *);
+
+#ifndef lua_lock
+#define lua_lock(L) do_lua_lock(L)
+#endif
+
+#ifndef lua_unlock
+#define lua_unlock(L) do_lua_unlock(L)
+#endif
+
+
+#ifndef lua_userstateopen
+#define lua_userstateopen(l)
+#endif
+
+
+
+struct lua_longjmp; /* defined in ldo.c */
+
+
+/* default meta table (both for tables and udata) */
+#define defaultmeta(L) (&G(L)->_defaultmeta)
+
+/* table of globals */
+#define gt(L) (&L->_gt)
+
+/* registry */
+#define registry(L) (&G(L)->_registry)
+
+
+/* extra stack space to handle TM calls and some other extras */
+#define EXTRA_STACK 5
+
+
+#define BASIC_CI_SIZE 8
+
+#define BASIC_STACK_SIZE (2*LUA_MINSTACK)
+
+
+
+typedef struct stringtable {
+ GCObject **hash;
+ ls_nstr nuse; /* number of elements */
+ int size;
+} stringtable;
+
+
+/*
+** informations about a call
+*/
+typedef struct CallInfo {
+ StkId base; /* base for called function */
+ StkId top; /* top for this function */
+ int state; /* bit fields; see below */
+ union {
+ struct { /* for Lua functions */
+ const Instruction *savedpc;
+ const Instruction **pc; /* points to `pc' variable in `luaV_execute' */
+ int tailcalls; /* number of tail calls lost under this entry */
+ } l;
+ struct { /* for C functions */
+ int dummy; /* just to avoid an empty struct */
+ } c;
+ } u;
+} CallInfo;
+
+
+/*
+** bit fields for `CallInfo.state'
+*/
+#define CI_C (1<<0) /* 1 if function is a C function */
+/* 1 if (Lua) function has an active `luaV_execute' running it */
+#define CI_HASFRAME (1<<1)
+/* 1 if Lua function is calling another Lua function (and therefore its
+ `pc' is being used by the other, and therefore CI_SAVEDPC is 1 too) */
+#define CI_CALLING (1<<2)
+#define CI_SAVEDPC (1<<3) /* 1 if `savedpc' is updated */
+#define CI_YIELD (1<<4) /* 1 if thread is suspended */
+#define CI_BREAK (1<<5) /* 1 if user break */
+
+
+#define ci_func(ci) (clvalue((ci)->base - 1))
+
+
+/*
+** `global state', shared by all threads of this state
+*/
+typedef struct global_State {
+ stringtable strt; /* hash table for strings */
+ GCObject *rootgc; /* list of (almost) all collectable objects */
+ GCObject *rootudata; /* (separated) list of all userdata */
+ GCObject *tmudata; /* list of userdata to be GC */
+ Mbuffer buff; /* temporary buffer for string concatentation */
+ lu_mem GCthreshold;
+ lu_mem nblocks; /* number of `bytes' currently allocated */
+ lua_CFunction panic; /* to be called in unprotected errors */
+ TObject _registry;
+ TObject _defaultmeta;
+ struct lua_State *mainthread;
+ Node dummynode[1]; /* common node array for all empty tables */
+ TString *tmname[TM_N]; /* array with tag-method names */
+} global_State;
+
+
+/*
+** `per thread' state
+*/
+struct lua_State {
+ CommonHeader;
+ StkId top; /* first free slot in the stack */
+ StkId base; /* base of current function */
+ global_State *l_G;
+ CallInfo *ci; /* call info for current function */
+ StkId stack_last; /* last free slot in the stack */
+ StkId stack; /* stack base */
+ int stacksize;
+ CallInfo *end_ci; /* points after end of ci array*/
+ CallInfo *base_ci; /* array of CallInfo's */
+ unsigned short size_ci; /* size of array `base_ci' */
+ unsigned short nCcalls; /* number of nested C calls */
+ lu_byte hookmask;
+ lu_byte allowhook;
+ lu_byte hookinit;
+ int basehookcount;
+ int hookcount;
+ lua_Hook hook;
+ TObject _gt; /* table of globals */
+ GCObject *openupval; /* list of open upvalues in this stack */
+ GCObject *gclist;
+ struct lua_longjmp *errorJmp; /* current error recover point */
+ ptrdiff_t errfunc; /* current error handling function (stack index) */
+};
+
+
+#define G(L) (L->l_G)
+
+
+/*
+** Union of all collectable objects
+*/
+union GCObject {
+ GCheader gch;
+ union TString ts;
+ union Udata u;
+ union Closure cl;
+ struct Table h;
+ struct Proto p;
+ struct UpVal uv;
+ struct lua_State th; /* thread */
+};
+
+
+/* macros to convert a GCObject into a specific value */
+#define gcotots(o) check_exp((o)->gch.tt == LUA_TSTRING, &((o)->ts))
+#define gcotou(o) check_exp((o)->gch.tt == LUA_TUSERDATA, &((o)->u))
+#define gcotocl(o) check_exp((o)->gch.tt == LUA_TFUNCTION, &((o)->cl))
+#define gcotoh(o) check_exp((o)->gch.tt == LUA_TTABLE, &((o)->h))
+#define gcotop(o) check_exp((o)->gch.tt == LUA_TPROTO, &((o)->p))
+#define gcotouv(o) check_exp((o)->gch.tt == LUA_TUPVAL, &((o)->uv))
+#define ngcotouv(o) \
+ check_exp((o) == NULL || (o)->gch.tt == LUA_TUPVAL, &((o)->uv))
+#define gcototh(o) check_exp((o)->gch.tt == LUA_TTHREAD, &((o)->th))
+
+/* macro to convert any value into a GCObject */
+#define valtogco(v) (cast(GCObject *, (v)))
+
+
+lua_State *luaE_newthread (lua_State *L);
+void luaE_freethread (lua_State *L, lua_State *L1);
+
+#endif
+
diff --git a/lib/lua/includes/lstring.h b/lib/lua/includes/lstring.h
index c584ad6..11791f0 100644
--- a/lib/lua/includes/lstring.h
+++ b/lib/lua/includes/lstring.h
@@ -1,33 +1,33 @@
-/*
-** $Id: lstring.h,v 1.2 2003-12-11 16:53:29 pixel Exp $
-** String table (keep all strings handled by Lua)
-** See Copyright Notice in lua.h
-*/
-
-#ifndef lstring_h
-#define lstring_h
-
-
-#include "lobject.h"
-#include "lstate.h"
-
-
-
-#define sizestring(l) (cast(lu_mem, sizeof(union TString))+ \
- (cast(lu_mem, l)+1)*sizeof(char))
-
-#define sizeudata(l) (cast(lu_mem, sizeof(union Udata))+(l))
-
-#define luaS_new(L, s) (luaS_newlstr(L, s, strlen(s)))
-#define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \
- (sizeof(s)/sizeof(char))-1))
-
-#define luaS_fix(s) ((s)->tsv.marked |= (1<<4))
-
-void luaS_resize (lua_State *L, int newsize);
-Udata *luaS_newudata (lua_State *L, size_t s);
-void luaS_freeall (lua_State *L);
-TString *luaS_newlstr (lua_State *L, const char *str, size_t l);
-
-
-#endif
+/*
+** $Id: lstring.h,v 1.3 2004-11-27 21:43:50 pixel Exp $
+** String table (keep all strings handled by Lua)
+** See Copyright Notice in lua.h
+*/
+
+#ifndef lstring_h
+#define lstring_h
+
+
+#include "lobject.h"
+#include "lstate.h"
+
+
+
+#define sizestring(l) (cast(lu_mem, sizeof(union TString))+ \
+ (cast(lu_mem, l)+1)*sizeof(char))
+
+#define sizeudata(l) (cast(lu_mem, sizeof(union Udata))+(l))
+
+#define luaS_new(L, s) (luaS_newlstr(L, s, strlen(s)))
+#define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \
+ (sizeof(s)/sizeof(char))-1))
+
+#define luaS_fix(s) ((s)->tsv.marked |= (1<<4))
+
+void luaS_resize (lua_State *L, int newsize);
+Udata *luaS_newudata (lua_State *L, size_t s);
+void luaS_freeall (lua_State *L);
+TString *luaS_newlstr (lua_State *L, const char *str, size_t l);
+
+
+#endif
diff --git a/lib/lua/includes/ltable.h b/lib/lua/includes/ltable.h
index fbf4614..97695d0 100644
--- a/lib/lua/includes/ltable.h
+++ b/lib/lua/includes/ltable.h
@@ -1,31 +1,31 @@
-/*
-** $Id: ltable.h,v 1.2 2003-12-11 16:53:29 pixel Exp $
-** Lua tables (hash)
-** See Copyright Notice in lua.h
-*/
-
-#ifndef ltable_h
-#define ltable_h
-
-#include "lobject.h"
-
-
-#define gnode(t,i) (&(t)->node[i])
-#define gkey(n) (&(n)->i_key)
-#define gval(n) (&(n)->i_val)
-
-
-const TObject *luaH_getnum (Table *t, int key);
-TObject *luaH_setnum (lua_State *L, Table *t, int key);
-const TObject *luaH_getstr (Table *t, TString *key);
-const TObject *luaH_get (Table *t, const TObject *key);
-TObject *luaH_set (lua_State *L, Table *t, const TObject *key);
-Table *luaH_new (lua_State *L, int narray, int lnhash);
-void luaH_free (lua_State *L, Table *t);
-int luaH_next (lua_State *L, Table *t, StkId key);
-
-/* exported only for debugging */
-Node *luaH_mainposition (const Table *t, const TObject *key);
-
-
-#endif
+/*
+** $Id: ltable.h,v 1.3 2004-11-27 21:43:50 pixel Exp $
+** Lua tables (hash)
+** See Copyright Notice in lua.h
+*/
+
+#ifndef ltable_h
+#define ltable_h
+
+#include "lobject.h"
+
+
+#define gnode(t,i) (&(t)->node[i])
+#define gkey(n) (&(n)->i_key)
+#define gval(n) (&(n)->i_val)
+
+
+const TObject *luaH_getnum (Table *t, int key);
+TObject *luaH_setnum (lua_State *L, Table *t, int key);
+const TObject *luaH_getstr (Table *t, TString *key);
+const TObject *luaH_get (Table *t, const TObject *key);
+TObject *luaH_set (lua_State *L, Table *t, const TObject *key);
+Table *luaH_new (lua_State *L, int narray, int lnhash);
+void luaH_free (lua_State *L, Table *t);
+int luaH_next (lua_State *L, Table *t, StkId key);
+
+/* exported only for debugging */
+Node *luaH_mainposition (const Table *t, const TObject *key);
+
+
+#endif
diff --git a/lib/lua/includes/ltm.h b/lib/lua/includes/ltm.h
index 42bf2ea..7652e4d 100644
--- a/lib/lua/includes/ltm.h
+++ b/lib/lua/includes/ltm.h
@@ -1,51 +1,51 @@
-/*
-** $Id: ltm.h,v 1.2 2003-12-11 16:53:29 pixel Exp $
-** Tag methods
-** See Copyright Notice in lua.h
-*/
-
-#ifndef ltm_h
-#define ltm_h
-
-
-#include "lobject.h"
-
-
-/*
-* WARNING: if you change the order of this enumeration,
-* grep "ORDER TM"
-*/
-typedef enum {
- TM_INDEX,
- TM_NEWINDEX,
- TM_GC,
- TM_MODE,
- TM_EQ, /* last tag method with `fast' access */
- TM_ADD,
- TM_SUB,
- TM_MUL,
- TM_DIV,
- TM_POW,
- TM_UNM,
- TM_LT,
- TM_LE,
- TM_CONCAT,
- TM_CALL,
- TM_N /* number of elements in the enum */
-} TMS;
-
-
-
-#define gfasttm(g,et,e) \
- (((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e]))
-
-#define fasttm(l,et,e) gfasttm(G(l), et, e)
-
-
-const TObject *luaT_gettm (Table *events, TMS event, TString *ename);
-const TObject *luaT_gettmbyobj (lua_State *L, const TObject *o, TMS event);
-void luaT_init (lua_State *L);
-
-extern const char *const luaT_typenames[];
-
-#endif
+/*
+** $Id: ltm.h,v 1.3 2004-11-27 21:43:50 pixel Exp $
+** Tag methods
+** See Copyright Notice in lua.h
+*/
+
+#ifndef ltm_h
+#define ltm_h
+
+
+#include "lobject.h"
+
+
+/*
+* WARNING: if you change the order of this enumeration,
+* grep "ORDER TM"
+*/
+typedef enum {
+ TM_INDEX,
+ TM_NEWINDEX,
+ TM_GC,
+ TM_MODE,
+ TM_EQ, /* last tag method with `fast' access */
+ TM_ADD,
+ TM_SUB,
+ TM_MUL,
+ TM_DIV,
+ TM_POW,
+ TM_UNM,
+ TM_LT,
+ TM_LE,
+ TM_CONCAT,
+ TM_CALL,
+ TM_N /* number of elements in the enum */
+} TMS;
+
+
+
+#define gfasttm(g,et,e) \
+ (((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e]))
+
+#define fasttm(l,et,e) gfasttm(G(l), et, e)
+
+
+const TObject *luaT_gettm (Table *events, TMS event, TString *ename);
+const TObject *luaT_gettmbyobj (lua_State *L, const TObject *o, TMS event);
+void luaT_init (lua_State *L);
+
+extern const char *const luaT_typenames[];
+
+#endif
diff --git a/lib/lua/includes/lundump.h b/lib/lua/includes/lundump.h
index a7e3705..adcb85c 100644
--- a/lib/lua/includes/lundump.h
+++ b/lib/lua/includes/lundump.h
@@ -1,34 +1,34 @@
-/*
-** $Id: lundump.h,v 1.2 2003-12-11 16:53:29 pixel Exp $
-** load pre-compiled Lua chunks
-** See Copyright Notice in lua.h
-*/
-
-#ifndef lundump_h
-#define lundump_h
-
-#include "lobject.h"
-#include "lzio.h"
-
-/* load one chunk; from lundump.c */
-Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff);
-
-/* find byte order; from lundump.c */
-int luaU_endianness (void);
-
-/* dump one chunk; from ldump.c */
-void luaU_dump (lua_State* L, const Proto* Main, lua_Chunkwriter w, void* data);
-
-/* print one chunk; from print.c */
-void luaU_print (const Proto* Main);
-
-/* definitions for headers of binary files */
-#define LUA_SIGNATURE "\033Lua" /* binary files start with "<esc>Lua" */
-#define VERSION 0x50 /* last format change was in 5.0 */
-#define VERSION0 0x50 /* last major change was in 5.0 */
-
-/* a multiple of PI for testing native format */
-/* multiplying by 1E7 gives non-trivial integer values */
-#define TEST_NUMBER ((lua_Number)3.14159265358979323846E7)
-
-#endif
+/*
+** $Id: lundump.h,v 1.3 2004-11-27 21:43:50 pixel Exp $
+** load pre-compiled Lua chunks
+** See Copyright Notice in lua.h
+*/
+
+#ifndef lundump_h
+#define lundump_h
+
+#include "lobject.h"
+#include "lzio.h"
+
+/* load one chunk; from lundump.c */
+Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff);
+
+/* find byte order; from lundump.c */
+int luaU_endianness (void);
+
+/* dump one chunk; from ldump.c */
+void luaU_dump (lua_State* L, const Proto* Main, lua_Chunkwriter w, void* data);
+
+/* print one chunk; from print.c */
+void luaU_print (const Proto* Main);
+
+/* definitions for headers of binary files */
+#define LUA_SIGNATURE "\033Lua" /* binary files start with "<esc>Lua" */
+#define VERSION 0x50 /* last format change was in 5.0 */
+#define VERSION0 0x50 /* last major change was in 5.0 */
+
+/* a multiple of PI for testing native format */
+/* multiplying by 1E7 gives non-trivial integer values */
+#define TEST_NUMBER ((lua_Number)3.14159265358979323846E7)
+
+#endif
diff --git a/lib/lua/includes/lvm.h b/lib/lua/includes/lvm.h
index a1ae850..56f6415 100644
--- a/lib/lua/includes/lvm.h
+++ b/lib/lua/includes/lvm.h
@@ -1,35 +1,35 @@
-/*
-** $Id: lvm.h,v 1.2 2003-12-11 16:53:29 pixel Exp $
-** Lua virtual machine
-** See Copyright Notice in lua.h
-*/
-
-#ifndef lvm_h
-#define lvm_h
-
-
-#include "ldo.h"
-#include "lobject.h"
-#include "ltm.h"
-
-
-#define tostring(L,o) ((ttype(o) == LUA_TSTRING) || (luaV_tostring(L, o)))
-
-#define tonumber(o,n) (ttype(o) == LUA_TNUMBER || \
- (((o) = luaV_tonumber(o,n)) != NULL))
-
-#define equalobj(L,o1,o2) \
- (ttype(o1) == ttype(o2) && luaV_equalval(L, o1, o2))
-
-
-int luaV_lessthan (lua_State *L, const TObject *l, const TObject *r);
-int luaV_equalval (lua_State *L, const TObject *t1, const TObject *t2);
-const TObject *luaV_tonumber (const TObject *obj, TObject *n);
-int luaV_tostring (lua_State *L, StkId obj);
-const TObject *luaV_gettable (lua_State *L, const TObject *t, TObject *key,
- int loop);
-void luaV_settable (lua_State *L, const TObject *t, TObject *key, StkId val);
-StkId luaV_execute (lua_State *L);
-void luaV_concat (lua_State *L, int total, int last);
-
-#endif
+/*
+** $Id: lvm.h,v 1.3 2004-11-27 21:43:50 pixel Exp $
+** Lua virtual machine
+** See Copyright Notice in lua.h
+*/
+
+#ifndef lvm_h
+#define lvm_h
+
+
+#include "ldo.h"
+#include "lobject.h"
+#include "ltm.h"
+
+
+#define tostring(L,o) ((ttype(o) == LUA_TSTRING) || (luaV_tostring(L, o)))
+
+#define tonumber(o,n) (ttype(o) == LUA_TNUMBER || \
+ (((o) = luaV_tonumber(o,n)) != NULL))
+
+#define equalobj(L,o1,o2) \
+ (ttype(o1) == ttype(o2) && luaV_equalval(L, o1, o2))
+
+
+int luaV_lessthan (lua_State *L, const TObject *l, const TObject *r);
+int luaV_equalval (lua_State *L, const TObject *t1, const TObject *t2);
+const TObject *luaV_tonumber (const TObject *obj, TObject *n);
+int luaV_tostring (lua_State *L, StkId obj);
+const TObject *luaV_gettable (lua_State *L, const TObject *t, TObject *key,
+ int loop);
+void luaV_settable (lua_State *L, const TObject *t, TObject *key, StkId val);
+StkId luaV_execute (lua_State *L);
+void luaV_concat (lua_State *L, int total, int last);
+
+#endif
diff --git a/lib/lua/includes/lzio.h b/lib/lua/includes/lzio.h
index 2dd4e81..6fff60d 100644
--- a/lib/lua/includes/lzio.h
+++ b/lib/lua/includes/lzio.h
@@ -1,64 +1,64 @@
-/*
-** $Id: lzio.h,v 1.2 2003-12-11 16:53:29 pixel Exp $
-** Buffered streams
-** See Copyright Notice in lua.h
-*/
-
-
-#ifndef lzio_h
-#define lzio_h
-
-#include "lua.h"
-
-
-#define EOZ (-1) /* end of stream */
-
-typedef struct Zio ZIO;
-
-
-#define char2int(c) cast(int, cast(unsigned char, (c)))
-
-#define zgetc(z) (((z)->n--)>0 ? char2int(*(z)->p++) : luaZ_fill(z))
-
-#define zname(z) ((z)->name)
-
-void luaZ_init (ZIO *z, lua_Chunkreader reader, void *data, const char *name);
-size_t luaZ_read (ZIO* z, void* b, size_t n); /* read next n bytes */
-int luaZ_lookahead (ZIO *z);
-
-
-
-typedef struct Mbuffer {
- char *buffer;
- size_t buffsize;
-} Mbuffer;
-
-
-char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n);
-
-#define luaZ_initbuffer(L, buff) ((buff)->buffer = NULL, (buff)->buffsize = 0)
-
-#define luaZ_sizebuffer(buff) ((buff)->buffsize)
-#define luaZ_buffer(buff) ((buff)->buffer)
-
-#define luaZ_resizebuffer(L, buff, size) \
- (luaM_reallocvector(L, (buff)->buffer, (buff)->buffsize, size, char), \
- (buff)->buffsize = size)
-
-#define luaZ_freebuffer(L, buff) luaZ_resizebuffer(L, buff, 0)
-
-
-/* --------- Private Part ------------------ */
-
-struct Zio {
- size_t n; /* bytes still unread */
- const char *p; /* current position in buffer */
- lua_Chunkreader reader;
- void* data; /* additional data */
- const char *name;
-};
-
-
-int luaZ_fill (ZIO *z);
-
-#endif
+/*
+** $Id: lzio.h,v 1.3 2004-11-27 21:43:50 pixel Exp $
+** Buffered streams
+** See Copyright Notice in lua.h
+*/
+
+
+#ifndef lzio_h
+#define lzio_h
+
+#include "lua.h"
+
+
+#define EOZ (-1) /* end of stream */
+
+typedef struct Zio ZIO;
+
+
+#define char2int(c) cast(int, cast(unsigned char, (c)))
+
+#define zgetc(z) (((z)->n--)>0 ? char2int(*(z)->p++) : luaZ_fill(z))
+
+#define zname(z) ((z)->name)
+
+void luaZ_init (ZIO *z, lua_Chunkreader reader, void *data, const char *name);
+size_t luaZ_read (ZIO* z, void* b, size_t n); /* read next n bytes */
+int luaZ_lookahead (ZIO *z);
+
+
+
+typedef struct Mbuffer {
+ char *buffer;
+ size_t buffsize;
+} Mbuffer;
+
+
+char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n);
+
+#define luaZ_initbuffer(L, buff) ((buff)->buffer = NULL, (buff)->buffsize = 0)
+
+#define luaZ_sizebuffer(buff) ((buff)->buffsize)
+#define luaZ_buffer(buff) ((buff)->buffer)
+
+#define luaZ_resizebuffer(L, buff, size) \
+ (luaM_reallocvector(L, (buff)->buffer, (buff)->buffsize, size, char), \
+ (buff)->buffsize = size)
+
+#define luaZ_freebuffer(L, buff) luaZ_resizebuffer(L, buff, 0)
+
+
+/* --------- Private Part ------------------ */
+
+struct Zio {
+ size_t n; /* bytes still unread */
+ const char *p; /* current position in buffer */
+ lua_Chunkreader reader;
+ void* data; /* additional data */
+ const char *name;
+};
+
+
+int luaZ_fill (ZIO *z);
+
+#endif