Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src merged luaconf.h of kernel and userspace Lua



details:   https://anonhg.NetBSD.org/src/rev/591642ecff7a
branches:  trunk
changeset: 791795:591642ecff7a
user:      lneto <lneto%NetBSD.org@localhost>
date:      Mon Dec 02 06:07:22 2013 +0000

description:
merged luaconf.h of kernel and userspace Lua

diffstat:

 external/mit/lua/dist/src/luaconf.h |   37 +-
 sys/modules/lua/Makefile            |    4 +-
 sys/modules/lua/luaconf.h           |  790 ------------------------------------
 3 files changed, 30 insertions(+), 801 deletions(-)

diffs (truncated from 898 to 300 lines):

diff -r f926f9bf1570 -r 591642ecff7a external/mit/lua/dist/src/luaconf.h
--- a/external/mit/lua/dist/src/luaconf.h       Mon Dec 02 05:06:32 2013 +0000
+++ b/external/mit/lua/dist/src/luaconf.h       Mon Dec 02 06:07:22 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: luaconf.h,v 1.4 2012/03/15 01:02:19 alnsn Exp $        */
+/*     $NetBSD: luaconf.h,v 1.5 2013/12/02 06:07:22 lneto Exp $        */
 
 /*
 ** Id: luaconf.h,v 1.82.1.7 2008/02/11 16:25:08 roberto Exp $
@@ -510,15 +510,18 @@
 ** ===================================================================
 */
 
+#ifdef _KERNEL
+#define LUA_NUMBER     int64_t
+#else
 #define LUA_NUMBER_DOUBLE
 #define LUA_NUMBER     double
+#endif
 
 /*
 @@ LUAI_UACNUMBER is the result of an 'usual argument conversion'
 @* over a number.
 */
-#define LUAI_UACNUMBER double
-
+#define LUAI_UACNUMBER LUA_NUMBER      
 
 /*
 @@ LUA_NUMBER_SCAN is the format for reading numbers.
@@ -527,24 +530,36 @@
 @@ LUAI_MAXNUMBER2STR is maximum size of previous conversion.
 @@ lua_str2number converts a string to a number.
 */
+#ifdef _KERNEL
+#define LUA_NUMBER_SCAN                "%" SCNd64
+#define LUA_NUMBER_FMT         "%" PRId64
+#define lua_str2number(s,p)    ((int64_t) strtoimax((s), (p), 10))
+#else
 #define LUA_NUMBER_SCAN                "%lf"
 #define LUA_NUMBER_FMT         "%.14g"
+#define lua_str2number(s,p)    strtod((s), (p))
+#endif
+
 #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)
+#ifdef _KERNEL
+#define luai_nummod(a,b)       ((a)%(b))
+#define luai_numpow(a,b)       luai_nummul(a,b)
+#else
 #include <math.h>
+#define luai_nummod(a,b)       ((a) - floor((a)/(b))*(b))
+#define luai_numpow(a,b)       (pow(a,b))
+#endif
+
 #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))
@@ -612,7 +627,13 @@
 ** compiling as C++ code, with _longjmp/_setjmp when asked to use them,
 ** and with longjmp/setjmp otherwise.
 */
-#if defined(__cplusplus)
+#ifdef _KERNEL
+/* in NetBSD kernel */
+#define LUAI_THROW(L,c)        longjmp(& ((c)->b))
+#define LUAI_TRY(L,c,a)        if (setjmp(& ((c)->b)) == 0) { a }
+#define luai_jmpbuf    label_t
+
+#elif defined(__cplusplus)
 /* C++ exceptions */
 #define LUAI_THROW(L,c)        throw(c)
 #define LUAI_TRY(L,c,a)        try { a } catch(...) \
diff -r f926f9bf1570 -r 591642ecff7a sys/modules/lua/Makefile
--- a/sys/modules/lua/Makefile  Mon Dec 02 05:06:32 2013 +0000
+++ b/sys/modules/lua/Makefile  Mon Dec 02 06:07:22 2013 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.4 2013/12/02 04:57:41 lneto Exp $
+#      $NetBSD: Makefile,v 1.5 2013/12/02 06:07:22 lneto Exp $
 
 .include "../Makefile.inc"
 
@@ -46,8 +46,6 @@
                strpbrk.c \
                strspn.c
 
-CFLAGS+=       -include ${.CURDIR}/luaconf.h
-
 CPPFLAGS+=     -I${S}/../external/mit/lua/dist/src \
                -I${S}/sys
 
diff -r f926f9bf1570 -r 591642ecff7a sys/modules/lua/luaconf.h
--- a/sys/modules/lua/luaconf.h Mon Dec 02 05:06:32 2013 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,790 +0,0 @@
-/*
-** $Id: luaconf.h,v 1.2 2013/12/02 04:39:10 lneto Exp $
-** Configuration file for Lua
-** See Copyright Notice in lua.h
-*/
-
-
-#ifndef lconfig_h
-#define lconfig_h
-
-#include <limits.h>
-#include <stddef.h>
-
-#ifndef LUA_CORE
-#define LUA_CORE
-#endif
-
-/*
-** ==================================================================
-** Search for "@@" to find all configurable definitions.
-** ===================================================================
-*/
-
-
-/*
-@@ lUA_ANSI controls the use of non-ansi features.
-** CHANGE it (define it) if you want Lua to avoid the use of any
-** non-ansi feature or library.
-*/
-#if defined(__STRICT_ANSI__)
-#define LUA_ANSI
-#endif
-
-
-#if !defined(LUA_ANSI) && defined(_WIN32)
-#define LUA_WIN
-#endif
-
-#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 */
-#endif
-
-#if defined(LUA_USE_MACOSX)
-#define LUA_USE_POSIX
-#define LUA_DL_DYLD            /* does not need extra library */
-#endif
-
-
-
-/*
-@@ LUA_USE_POSIX includes all functionallity listed as X/Open System
-@* Interfaces Extension (XSI).
-** CHANGE it (define it) if your system is XSI compatible.
-*/
-#if defined(LUA_USE_POSIX)
-#define LUA_USE_MKSTEMP
-#define LUA_USE_ISATTY
-#define LUA_USE_POPEN
-#define LUA_USE_ULONGJMP
-#endif
-
-
-/*
-@@ LUA_PATH and LUA_CPATH are the names of the environment variables that
-@* Lua check to set its paths.
-@@ LUA_INIT is the name of the environment variable that Lua
-@* checks for initialization code.
-** CHANGE them if you want different names.
-*/
-#define LUA_PATH        "LUA_PATH"
-#define LUA_CPATH       "LUA_CPATH"
-#define LUA_INIT       "LUA_INIT"
-
-
-/*
-@@ LUA_PATH_DEFAULT is the default path that Lua uses to look for
-@* Lua libraries.
-@@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for
-@* C libraries.
-** CHANGE them if your machine has a non-conventional directory
-** hierarchy or if you want to install your libraries in
-** non-conventional directories.
-*/
-#if defined(_WIN32)
-/*
-** 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_PATH_DEFAULT  \
-               ".\\?.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"
-
-#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_PATH_DEFAULT  \
-               "./?.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"
-#endif
-
-
-/*
-@@ LUA_DIRSEP is the directory separator (for submodules).
-** CHANGE it if your machine does not use "/" as the directory separator
-** and is not Windows. (On Windows Lua automatically uses "\".)
-*/
-#if defined(_WIN32)
-#define LUA_DIRSEP     "\\"
-#else
-#define LUA_DIRSEP     "/"
-#endif
-
-
-/*
-@@ LUA_PATHSEP is the character that separates templates in a path.
-@@ LUA_PATH_MARK is the string that marks the substitution points in a
-@* template.
-@@ LUA_EXECDIR in a Windows path is replaced by the executable's
-@* directory.
-@@ LUA_IGMARK is a mark to ignore all before it when bulding the
-@* luaopen_ function name.
-** CHANGE them if for some reason your system cannot use those
-** 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     "-"
-
-
-/*
-@@ LUA_INTEGER is the integral type used by lua_pushinteger/lua_tointeger.
-** 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
-
-
-/*
-@@ LUA_API is a mark for all core API functions.
-@@ LUALIB_API is a mark for all standard library functions.
-** CHANGE them if you need to define those functions in some special way.
-** For instance, if you want to create one Windows DLL with the core and
-** the libraries, you may want to use the following definition (define
-** LUA_BUILD_AS_DLL to get it).
-*/
-#if defined(LUA_BUILD_AS_DLL)
-
-#if defined(LUA_CORE) || defined(LUA_LIB)
-#define LUA_API __declspec(dllexport)
-#else
-#define LUA_API __declspec(dllimport)
-#endif
-
-#else
-
-#define LUA_API                extern
-
-#endif
-
-/* more often than not the libs go together with the core */
-#define LUALIB_API     LUA_API
-
-
-/*
-@@ LUAI_FUNC is a mark for all extern functions that are not to be
-@* exported to outside modules.
-@@ LUAI_DATA is a mark for all extern (const) variables that are not to
-@* be exported to outside modules.
-** CHANGE them if you need to mark them in some special way. Elf/gcc
-** (versions 3.2 and later) mark them as "hidden" to optimize access
-** when Lua is compiled as a shared library.
-*/
-#if defined(luaall_c)
-#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
-



Home | Main Index | Thread Index | Old Index