summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Wilgus <me.theuser@yahoo.com>2019-07-11 11:57:50 -0500
committerWilliam Wilgus <me.theuser@yahoo.com>2019-07-11 11:59:43 -0500
commitee58f2601c2a03cec96568371a68e5f1bf0de170 (patch)
tree363b703f180be5f1b64beb5a25023c799ca15a20
parenta332924f68e1237ec69af84ef10362fd9b4623c3 (diff)
downloadrockbox-ee58f26.tar.gz
rockbox-ee58f26.tar.bz2
rockbox-ee58f26.zip
lua reduce heap allocated buffer sizes, organize luaconf.h
Change-Id: Ib9e568ea73a01474facd57cc155e62fa3dc093f7
-rw-r--r--apps/plugins/lua/luaconf.h335
1 files changed, 194 insertions, 141 deletions
diff --git a/apps/plugins/lua/luaconf.h b/apps/plugins/lua/luaconf.h
index 3ed495b207..4b6f25d008 100644
--- a/apps/plugins/lua/luaconf.h
+++ b/apps/plugins/lua/luaconf.h
@@ -1,5 +1,5 @@
/*
-** $Id$
+** $Id: luaconf.h,v 1.82.1.7 2008/02/11 16:25:08 roberto Exp $
** Configuration file for Lua
** See Copyright Notice in lua.h
*/
@@ -35,13 +35,13 @@
#if defined(LUA_USE_LINUX)
#define LUA_USE_POSIX
-#define LUA_USE_DLOPEN /* needs an extra library: -ldl */
-#define LUA_USE_READLINE /* needs some extra libraries */
+#define LUA_USE_DLOPEN /* needs an extra library: -ldl */
+#define LUA_USE_READLINE /* needs some extra libraries */
#endif
#if defined(LUA_USE_MACOSX)
#define LUA_USE_POSIX
-#define LUA_DL_DYLD /* does not need extra library */
+#define LUA_DL_DYLD /* does not need extra library */
#endif
@@ -68,7 +68,7 @@
*/
#define LUA_PATH "LUA_PATH"
#define LUA_CPATH "LUA_CPATH"
-#define LUA_INIT "LUA_INIT"
+#define LUA_INIT "LUA_INIT"
/*
@@ -85,23 +85,23 @@
** In Windows, any exclamation mark ('!') in the path is replaced by the
** path of the directory of the executable file of the current process.
*/
-#define LUA_LDIR "!\\lua\\"
-#define LUA_CDIR "!\\"
+#define LUA_LDIR "!\\lua\\"
+#define LUA_CDIR "!\\"
#define LUA_PATH_DEFAULT \
- ".\\?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \
- LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua"
+ ".\\?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \
+ LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua"
#define LUA_CPATH_DEFAULT \
- ".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll"
+ ".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll"
#else
-#define LUA_ROOT "/usr/local/"
-#define LUA_LDIR LUA_ROOT "share/lua/5.1/"
-#define LUA_CDIR LUA_ROOT "lib/lua/5.1/"
+#define LUA_ROOT "/usr/local/"
+#define LUA_LDIR LUA_ROOT "share/lua/5.1/"
+#define LUA_CDIR LUA_ROOT "lib/lua/5.1/"
#define LUA_PATH_DEFAULT \
- "./?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \
- LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua"
+ "./?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \
+ LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua"
#define LUA_CPATH_DEFAULT \
- "./?.so;" LUA_CDIR"?.so;" LUA_CDIR"loadall.so"
+ "./?.so;" LUA_CDIR"?.so;" LUA_CDIR"loadall.so"
#endif
@@ -111,9 +111,9 @@
** and is not Windows. (On Windows Lua automatically uses "\".)
*/
#if defined(_WIN32)
-#define LUA_DIRSEP "\\"
+#define LUA_DIRSEP "\\"
#else
-#define LUA_DIRSEP "/"
+#define LUA_DIRSEP "/"
#endif
@@ -129,10 +129,10 @@
** characters. (E.g., if one of those characters is a common character
** in file/directory names.) Probably you do not need to change them.
*/
-#define LUA_PATHSEP ";"
-#define LUA_PATH_MARK "?"
-#define LUA_EXECDIR "!"
-#define LUA_IGMARK "-"
+#define LUA_PATHSEP ";"
+#define LUA_PATH_MARK "?"
+#define LUA_EXECDIR "!"
+#define LUA_IGMARK "-"
/*
@@ -140,7 +140,7 @@
** CHANGE that if ptrdiff_t is not adequate on your machine. (On most
** machines, ptrdiff_t gives a good choice between int or long.)
*/
-#define LUA_INTEGER ptrdiff_t
+#define LUA_INTEGER ptrdiff_t
/*
@@ -161,12 +161,12 @@
#else
-#define LUA_API extern
+#define LUA_API extern
#endif
/* more often than not the libs go together with the core */
-#define LUALIB_API LUA_API
+#define LUALIB_API LUA_API
/*
@@ -179,17 +179,17 @@
** when Lua is compiled as a shared library.
*/
#if defined(luaall_c)
-#define LUAI_FUNC static
-#define LUAI_DATA /* empty */
+#define LUAI_FUNC static
+#define LUAI_DATA /* empty */
#elif defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \
defined(__ELF__)
-#define LUAI_FUNC __attribute__((visibility("hidden"))) extern
-#define LUAI_DATA LUAI_FUNC
+#define LUAI_FUNC __attribute__((visibility("hidden"))) extern
+#define LUAI_DATA LUAI_FUNC
#else
-#define LUAI_FUNC extern
-#define LUAI_DATA extern
+#define LUAI_FUNC extern
+#define LUAI_DATA extern
#endif
@@ -198,8 +198,8 @@
@@ LUA_QL describes how error messages quote program elements.
** CHANGE it if you want a different appearance.
*/
-#define LUA_QL(x) "'" x "'"
-#define LUA_QS LUA_QL("%s")
+#define LUA_QL(x) "'" x "'"
+#define LUA_QS LUA_QL("%s")
/*
@@ -207,7 +207,7 @@
@* of a function in debug information.
** CHANGE it if you want a different size.
*/
-#define LUA_IDSIZE 60
+#define LUA_IDSIZE 60
/*
@@ -226,13 +226,13 @@
*/
#if defined(LUA_USE_ISATTY)
#include <unistd.h>
-#define lua_stdin_is_tty() isatty(0)
+#define lua_stdin_is_tty() isatty(0)
#elif defined(LUA_WIN)
#include <io.h>
#include <stdio.h>
-#define lua_stdin_is_tty() _isatty(_fileno(stdin))
+#define lua_stdin_is_tty() _isatty(_fileno(stdin))
#else
-#define lua_stdin_is_tty() 1 /* assume stdin is a tty */
+#define lua_stdin_is_tty() 1 /* assume stdin is a tty */
#endif
@@ -242,8 +242,8 @@
** CHANGE them if you want different prompts. (You can also change the
** prompts dynamically, assigning to globals _PROMPT/_PROMPT2.)
*/
-#define LUA_PROMPT "> "
-#define LUA_PROMPT2 ">> "
+#define LUA_PROMPT "> "
+#define LUA_PROMPT2 ">> "
/*
@@ -251,7 +251,7 @@
** CHANGE it if your stand-alone interpreter has a different name and
** your system is not able to detect that name automatically.
*/
-#define LUA_PROGNAME "lua"
+#define LUA_PROGNAME "lua"
/*
@@ -259,7 +259,7 @@
@* stand-alone interpreter.
** CHANGE it if you need longer lines.
*/
-#define LUA_MAXINPUT 512
+#define LUA_MAXINPUT 512
/*
@@ -274,17 +274,17 @@
#include <stdio.h>
#include <readline/readline.h>
#include <readline/history.h>
-#define lua_readline(L,b,p) ((void)L, ((b)=readline(p)) != NULL)
+#define lua_readline(L,b,p) ((void)L, ((b)=readline(p)) != NULL)
#define lua_saveline(L,idx) \
- if (lua_strlen(L,idx) > 0) /* non-empty line? */ \
- add_history(lua_tostring(L, idx)); /* add it to history */
-#define lua_freeline(L,b) ((void)L, free(b))
+ if (lua_strlen(L,idx) > 0) /* non-empty line? */ \
+ add_history(lua_tostring(L, idx)); /* add it to history */
+#define lua_freeline(L,b) ((void)L, free(b))
#else
-#define lua_readline(L,b,p) \
- ((void)L, fputs(p, stdout), fflush(stdout), /* show prompt */ \
- fgets(b, LUA_MAXINPUT, stdin) != NULL) /* get line */
-#define lua_saveline(L,idx) { (void)L; (void)idx; }
-#define lua_freeline(L,b) { (void)L; (void)b; }
+#define lua_readline(L,b,p) \
+ ((void)L, fputs(p, stdout), fflush(stdout), /* show prompt */ \
+ fgets(b, LUA_MAXINPUT, stdin) != NULL) /* get line */
+#define lua_saveline(L,idx) { (void)L; (void)idx; }
+#define lua_freeline(L,b) { (void)L; (void)b; }
#endif
#endif
@@ -299,7 +299,7 @@
** mean larger pauses which mean slower collection.) You can also change
** this value dynamically.
*/
-#define LUAI_GCPAUSE 200 /* 200% (wait memory to double before next GC) */
+#define LUAI_GCPAUSE 200 /* 200% (wait memory to double before next GC) */
/*
@@ -310,7 +310,7 @@
** infinity, where each step performs a full collection.) You can also
** change this value dynamically.
*/
-#define LUAI_GCMUL 200 /* GC runs 'twice the speed' of memory allocation */
+#define LUAI_GCMUL 200 /* GC runs 'twice the speed' of memory allocation */
@@ -333,14 +333,14 @@
** CHANGE it to undefined as soon as your programs use only '...' to
** access vararg parameters (instead of the old 'arg' table).
*/
-#undef LUA_COMPAT_VARARG
+#define LUA_COMPAT_VARARG
/*
@@ LUA_COMPAT_MOD controls compatibility with old math.mod function.
** CHANGE it to undefined as soon as your programs use 'math.fmod' or
** the new '%' operator instead of 'math.mod'.
*/
-#undef LUA_COMPAT_MOD
+#define LUA_COMPAT_MOD
/*
@@ LUA_COMPAT_LSTR controls compatibility with old long string nesting
@@ -348,22 +348,22 @@
** CHANGE it to 2 if you want the old behaviour, or undefine it to turn
** off the advisory error when nesting [[...]].
*/
-#undef LUA_COMPAT_LSTR
+#define LUA_COMPAT_LSTR 1
/*
@@ LUA_COMPAT_GFIND controls compatibility with old 'string.gfind' name.
** CHANGE it to undefined as soon as you rename 'string.gfind' to
** 'string.gmatch'.
*/
-#undef LUA_COMPAT_GFIND
+#define LUA_COMPAT_GFIND
/*
@@ LUA_COMPAT_OPENLIB controls compatibility with old 'luaL_openlib'
@* behavior.
-** CHANGE it to undefined as soon as you replace to 'luaL_registry'
+** CHANGE it to undefined as soon as you replace to 'luaL_register'
** your uses of 'luaL_openlib'
*/
-#undef LUA_COMPAT_OPENLIB
+#define LUA_COMPAT_OPENLIB
@@ -376,9 +376,9 @@
*/
#if defined(LUA_USE_APICHECK)
#include <assert.h>
-#define luai_apicheck(L,o) { (void)L; assert(o); }
+#define luai_apicheck(L,o) { (void)L; assert(o); }
#else
-#define luai_apicheck(L,o) { (void)L; }
+#define luai_apicheck(L,o) { (void)L; }
#endif
@@ -389,10 +389,10 @@
*/
/* avoid overflows in comparison */
#if INT_MAX-20 < 32760
-#define LUAI_BITSINT 16
+#define LUAI_BITSINT 16
#elif INT_MAX > 2147483640L
/* int has at least 32 bits */
-#define LUAI_BITSINT 32
+#define LUAI_BITSINT 32
#else
#error "you must define LUA_BITSINT with number of bits in an integer"
#endif
@@ -411,18 +411,18 @@
** longs.) Probably you do not need to change this.
*/
#if LUAI_BITSINT >= 32
-#define LUAI_UINT32 unsigned int
-#define LUAI_INT32 int
-#define LUAI_MAXINT32 INT_MAX
-#define LUAI_UMEM size_t
-#define LUAI_MEM ptrdiff_t
+#define LUAI_UINT32 unsigned int
+#define LUAI_INT32 int
+#define LUAI_MAXINT32 INT_MAX
+#define LUAI_UMEM size_t
+#define LUAI_MEM ptrdiff_t
#else
/* 16-bit ints */
-#define LUAI_UINT32 unsigned long
-#define LUAI_INT32 long
-#define LUAI_MAXINT32 LONG_MAX
-#define LUAI_UMEM unsigned long
-#define LUAI_MEM long
+#define LUAI_UINT32 unsigned long
+#define LUAI_INT32 long
+#define LUAI_MAXINT32 LONG_MAX
+#define LUAI_UMEM unsigned long
+#define LUAI_MEM long
#endif
@@ -432,7 +432,7 @@
** arbitrary; its only purpose is to stop infinite recursion before
** exhausting memory.
*/
-#define LUAI_MAXCALLS 20000
+#define LUAI_MAXCALLS 20000
/*
@@ -443,7 +443,7 @@
** functions to consume unlimited stack space. (must be smaller than
** -LUA_REGISTRYINDEX)
*/
-#define LUAI_MAXCSTACK 8000
+#define LUAI_MAXCSTACK 8000
@@ -465,27 +465,27 @@
@@ LUAI_MAXCCALLS is the maximum depth for nested C calls (short) and
@* syntactical nested non-terminals in a program.
*/
-#define LUAI_MAXCCALLS 200
+#define LUAI_MAXCCALLS 200
/*
@@ LUAI_MAXVARS is the maximum number of local variables per function
@* (must be smaller than 250).
*/
-#define LUAI_MAXVARS 200
+#define LUAI_MAXVARS 200
/*
@@ LUAI_MAXUPVALUES is the maximum number of upvalues per function
@* (must be smaller than 250).
*/
-#define LUAI_MAXUPVALUES 60
+#define LUAI_MAXUPVALUES 60
/*
@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system.
*/
-#define LUAL_BUFFERSIZE 1024
+#define LUAL_BUFFERSIZE BUFSIZ
/* }================================================================== */
@@ -501,14 +501,14 @@
** ===================================================================
*/
-#undef LUA_NUMBER_DOUBLE
-#define LUA_NUMBER long
+#define LUA_NUMBER_DOUBLE
+#define LUA_NUMBER double
/*
@@ LUAI_UACNUMBER is the result of an 'usual argument conversion'
@* over a number.
*/
-#define LUAI_UACNUMBER long
+#define LUAI_UACNUMBER double
/*
@@ -518,29 +518,29 @@
@@ LUAI_MAXNUMBER2STR is maximum size of previous conversion.
@@ lua_str2number converts a string to a number.
*/
-#define LUA_NUMBER_SCAN "%ld"
-#define LUA_NUMBER_FMT "%ld"
-#define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */
-#define lua_number2str(s,n) snprintf((s), 32, LUA_NUMBER_FMT, (n))
-#define lua_str2number(s,p) strtol((s), (p), 10)
+#define LUA_NUMBER_SCAN "%lf"
+#define LUA_NUMBER_FMT "%.14g"
+#define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n))
+#define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */
+#define lua_str2number(s,p) strtod((s), (p))
/*
@@ The luai_num* macros define the primitive operations over numbers.
*/
#if defined(LUA_CORE)
-extern long rb_pow(long, long);
-#define luai_numadd(a,b) ((a)+(b))
-#define luai_numsub(a,b) ((a)-(b))
-#define luai_nummul(a,b) ((a)*(b))
-#define luai_numdiv(a,b) ((a)/(b))
-#define luai_nummod(a,b) ((a)%(b))
-#define luai_numpow(a,b) (rb_pow(a,b))
-#define luai_numunm(a) (-(a))
-#define luai_numeq(a,b) ((a)==(b))
-#define luai_numlt(a,b) ((a)<(b))
-#define luai_numle(a,b) ((a)<=(b))
-#define luai_numisnan(a) (!luai_numeq((a), (a)))
+/*#include <math.h> //ROCKLUA_REMOVED */
+#define luai_numadd(a,b) ((a)+(b))
+#define luai_numsub(a,b) ((a)-(b))
+#define luai_nummul(a,b) ((a)*(b))
+#define luai_numdiv(a,b) ((a)/(b))
+#define luai_nummod(a,b) ((a) - floor((a)/(b))*(b))
+#define luai_numpow(a,b) (pow(a,b))
+#define luai_numunm(a) (-(a))
+#define luai_numeq(a,b) ((a)==(b))
+#define luai_numlt(a,b) ((a)<(b))
+#define luai_numle(a,b) ((a)<=(b))
+#define luai_numisnan(a) (!luai_numeq((a), (a)))
#endif
@@ -561,7 +561,7 @@ extern long rb_pow(long, long);
#if defined(_MSC_VER)
#define lua_number2int(i,d) __asm fld d __asm fistp i
-#define lua_number2integer(i,n) lua_number2int(i, n)
+#define lua_number2integer(i,n) lua_number2int(i, n)
/* the next trick should work on any Pentium, but sometimes clashes
with a DirectX idiosyncrasy */
@@ -570,15 +570,15 @@ extern long rb_pow(long, long);
union luai_Cast { double l_d; long l_l; };
#define lua_number2int(i,d) \
{ volatile union luai_Cast u; u.l_d = (d) + 6755399441055744.0; (i) = u.l_l; }
-#define lua_number2integer(i,n) lua_number2int(i, n)
+#define lua_number2integer(i,n) lua_number2int(i, n)
#endif
/* this option always works, but may be slow */
#else
-#define lua_number2int(i,d) ((i)=(int)(d))
-#define lua_number2integer(i,d) ((i)=(lua_Integer)(d))
+#define lua_number2int(i,d) ((i)=(int)(d))
+#define lua_number2integer(i,d) ((i)=(lua_Integer)(d))
#endif
@@ -592,7 +592,7 @@ union luai_Cast { double l_d; long l_l; };
** aligned in 16-byte boundaries, then you should add long double in the
** union.) Probably you do not need to change this.
*/
-#define LUAI_USER_ALIGNMENT_T union { void *s; long l; }
+#define LUAI_USER_ALIGNMENT_T union { double u; void *s; long l; }
/*
@@ -605,22 +605,22 @@ union luai_Cast { double l_d; long l_l; };
*/
#if defined(__cplusplus)
/* C++ exceptions */
-#define LUAI_THROW(L,c) throw(c)
-#define LUAI_TRY(L,c,a) try { a } catch(...) \
- { if ((c)->status == 0) (c)->status = -1; }
-#define luai_jmpbuf int /* dummy variable */
+#define LUAI_THROW(L,c) throw(c)
+#define LUAI_TRY(L,c,a) try { a } catch(...) \
+ { if ((c)->status == 0) (c)->status = -1; }
+#define luai_jmpbuf int /* dummy variable */
#elif defined(LUA_USE_ULONGJMP)
/* in Unix, try _longjmp/_setjmp (more efficient) */
-#define LUAI_THROW(L,c) _longjmp((c)->b, 1)
-#define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a }
-#define luai_jmpbuf jmp_buf
+#define LUAI_THROW(L,c) _longjmp((c)->b, 1)
+#define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a }
+#define luai_jmpbuf jmp_buf
#else
/* default handling with long jumps */
-#define LUAI_THROW(L,c) longjmp((c)->b, 1)
-#define LUAI_TRY(L,c,a) if (setjmp((c)->b) == 0) { a }
-#define luai_jmpbuf jmp_buf
+#define LUAI_THROW(L,c) longjmp((c)->b, 1)
+#define LUAI_TRY(L,c,a) if (setjmp((c)->b) == 0) { a }
+#define luai_jmpbuf jmp_buf
#endif
@@ -630,7 +630,7 @@ union luai_Cast { double l_d; long l_l; };
@* can do during pattern-matching.
** CHANGE it if you need more captures. This limit is arbitrary.
*/
-#define LUA_MAXCAPTURES 32
+#define LUA_MAXCAPTURES 32
/*
@@ -645,16 +645,16 @@ union luai_Cast { double l_d; long l_l; };
#if defined(LUA_USE_MKSTEMP)
#include <unistd.h>
-#define LUA_TMPNAMBUFSIZE 32
-#define lua_tmpnam(b,e) { \
- strcpy(b, "/tmp/lua_XXXXXX"); \
- e = mkstemp(b); \
- if (e != -1) close(e); \
- e = (e == -1); }
+#define LUA_TMPNAMBUFSIZE 32
+#define lua_tmpnam(b,e) { \
+ strcpy(b, "/tmp/lua_XXXXXX"); \
+ e = mkstemp(b); \
+ if (e != -1) close(e); \
+ e = (e == -1); }
#else
-#define LUA_TMPNAMBUFSIZE L_tmpnam
-#define lua_tmpnam(b,e) { e = (tmpnam(b) == NULL); }
+#define LUA_TMPNAMBUFSIZE L_tmpnam
+#define lua_tmpnam(b,e) { e = (tmpnam(b) == NULL); }
#endif
#endif
@@ -667,19 +667,19 @@ union luai_Cast { double l_d; long l_l; };
*/
#if defined(LUA_USE_POPEN)
-#define lua_popen(L,c,m) ((void)L, fflush(NULL), popen(c,m))
-#define lua_pclose(L,file) ((void)L, (pclose(file) != -1))
+#define lua_popen(L,c,m) ((void)L, fflush(NULL), popen(c,m))
+#define lua_pclose(L,file) ((void)L, (pclose(file) != -1))
#elif defined(LUA_WIN)
-#define lua_popen(L,c,m) ((void)L, _popen(c,m))
-#define lua_pclose(L,file) ((void)L, (_pclose(file) != -1))
+#define lua_popen(L,c,m) ((void)L, _popen(c,m))
+#define lua_pclose(L,file) ((void)L, (_pclose(file) != -1))
#else
-#define lua_popen(L,c,m) ((void)((void)c, m), \
- luaL_error(L, LUA_QL("popen") " not supported"), (FILE*)0)
-#define lua_pclose(L,file) ((void)((void)L, file), 0)
+#define lua_popen(L,c,m) ((void)((void)c, m), \
+ luaL_error(L, LUA_QL("popen") " not supported"), (FILE*)0)
+#define lua_pclose(L,file) ((void)((void)L, file), 0)
#endif
@@ -712,7 +712,7 @@ union luai_Cast { double l_d; long l_l; };
** CHANGE (define) this if you really need that. This value must be
** a multiple of the maximum alignment required for your machine.
*/
-#define LUAI_EXTRASPACE 0
+#define LUAI_EXTRASPACE 0
/*
@@ -720,12 +720,12 @@ union luai_Cast { double l_d; long l_l; };
** CHANGE them if you defined LUAI_EXTRASPACE and need to do something
** extra when a thread is created/deleted/resumed/yielded.
*/
-#define luai_userstateopen(L) ((void)L)
-#define luai_userstateclose(L) ((void)L)
-#define luai_userstatethread(L,L1) ((void)L)
-#define luai_userstatefree(L) ((void)L)
-#define luai_userstateresume(L,n) ((void)L)
-#define luai_userstateyield(L,n) ((void)L)
+#define luai_userstateopen(L) ((void)L)
+#define luai_userstateclose(L) ((void)L)
+#define luai_userstatethread(L,L1) ((void)L)
+#define luai_userstatefree(L) ((void)L)
+#define luai_userstateresume(L,n) ((void)L)
+#define luai_userstateyield(L,n) ((void)L)
/*
@@ -738,13 +738,13 @@ union luai_Cast { double l_d; long l_l; };
#if defined(LUA_USELONGLONG)
-#define LUA_INTFRMLEN "ll"
-#define LUA_INTFRM_T long long
+#define LUA_INTFRMLEN "ll"
+#define LUA_INTFRM_T long long
#else
-#define LUA_INTFRMLEN "l"
-#define LUA_INTFRM_T long
+#define LUA_INTFRMLEN "l"
+#define LUA_INTFRM_T long
#endif
@@ -757,7 +757,60 @@ union luai_Cast { double l_d; long l_l; };
** without modifying the main part of the file.
*/
+/*Rocklua integer patch */
+#undef LUA_NUMBER_DOUBLE
+
+#undef LUA_NUMBER
+#define LUA_NUMBER long
+
+#undef LUAI_UACNUMBER
+#define LUAI_UACNUMBER long
+
+#undef LUA_NUMBER_SCAN
+#define LUA_NUMBER_SCAN "%ld"
+
+#undef LUA_NUMBER_FMT
+#define LUA_NUMBER_FMT "%ld"
+
+#undef lua_number2str
+#define lua_number2str(s,n) snprintf((s), 32, LUA_NUMBER_FMT, (n))
+
+#define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */
+
+#undef lua_str2number
+#define lua_str2number(s,p) strtol((s), (p), 10)
+
+#undef luai_nummod
+#define luai_nummod(a,b) ((a)%(b))
+
+extern long rb_pow(long, long);
+#undef luai_numpow
+#define luai_numpow(a,b) (rb_pow(a,b))
+
+#undef LUAI_USER_ALIGNMENT_T
+#define LUAI_USER_ALIGNMENT_T union { void *s; long l; }
+
+/* Compatibility */
+#undef LUA_COMPAT_VARARG
+#undef LUA_COMPAT_MOD
+#undef LUA_COMPAT_LSTR
+#undef LUA_COMPAT_GFIND
+#undef LUA_COMPAT_OPENLIB
+
+/* Resize heap allocated buffers */
+#undef LUAI_MAXVARS /*200*/
+#define LUAI_MAXVARS 100
+
+#undef LUAI_MAXUPVALUES /*60*/
+#define LUAI_MAXUPVALUES 30
+
+#undef LUAL_BUFFERSIZE /*1024*/
+#define LUAL_BUFFERSIZE 512
+
+/*Rocklua functions*/
#include "rockconf.h"
+
+/*else*/
#define LUAC_TRUST_BINARIES
-#endif
+#endif