]> git.proxmox.com Git - mirror_edk2.git/blobdiff - StdLib/Include/Lua/luaconf.h
AppPkg: Add the Lua interpreter and library.
[mirror_edk2.git] / StdLib / Include / Lua / luaconf.h
diff --git a/StdLib/Include/Lua/luaconf.h b/StdLib/Include/Lua/luaconf.h
new file mode 100644 (file)
index 0000000..db154d6
--- /dev/null
@@ -0,0 +1,550 @@
+/*\r
+** $Id: luaconf.h,v 1.176.1.1 2013/04/12 18:48:47 roberto Exp $\r
+** Configuration file for Lua\r
+** See Copyright Notice in lua.h\r
+*/\r
+\r
+\r
+#ifndef lconfig_h\r
+#define lconfig_h\r
+\r
+#include <limits.h>\r
+#include <stddef.h>\r
+\r
+\r
+/*\r
+** ==================================================================\r
+** Search for "@@" to find all configurable definitions.\r
+** ===================================================================\r
+*/\r
+\r
+#if defined(_DOS_WATCOM) || defined(UEFI_C_SOURCE)\r
+#undef _WIN32\r
+#define LUA_ANSI\r
+#endif\r
+\r
+/*\r
+@@ LUA_ANSI controls the use of non-ansi features.\r
+** CHANGE it (define it) if you want Lua to avoid the use of any\r
+** non-ansi feature or library.\r
+*/\r
+#if !defined(LUA_ANSI) && defined(__STRICT_ANSI__)\r
+#define LUA_ANSI\r
+#endif\r
+\r
+\r
+#if !defined(LUA_ANSI) && defined(_WIN32) && !defined(_WIN32_WCE)\r
+#define LUA_WIN     /* enable goodies for regular Windows platforms */\r
+#endif\r
+\r
+#if defined(LUA_WIN)\r
+#define LUA_DL_DLL\r
+#define LUA_USE_AFORMAT     /* assume 'printf' handles 'aA' specifiers */\r
+#endif\r
+\r
+#if defined(LUA_USE_LINUX)\r
+#define LUA_USE_POSIX\r
+#define LUA_USE_DLOPEN      /* needs an extra library: -ldl */\r
+#define LUA_USE_READLINE    /* needs some extra libraries */\r
+#define LUA_USE_STRTODHEX   /* assume 'strtod' handles hex formats */\r
+#define LUA_USE_AFORMAT     /* assume 'printf' handles 'aA' specifiers */\r
+#define LUA_USE_LONGLONG    /* assume support for long long */\r
+#endif\r
+\r
+#if defined(LUA_USE_MACOSX)\r
+#define LUA_USE_POSIX\r
+#define LUA_USE_DLOPEN      /* does not need -ldl */\r
+#define LUA_USE_READLINE    /* needs an extra library: -lreadline */\r
+#define LUA_USE_STRTODHEX   /* assume 'strtod' handles hex formats */\r
+#define LUA_USE_AFORMAT     /* assume 'printf' handles 'aA' specifiers */\r
+#define LUA_USE_LONGLONG    /* assume support for long long */\r
+#endif\r
+\r
+/*\r
+@@ LUA_USE_POSIX includes all functionality listed as X/Open System\r
+@* Interfaces Extension (XSI).\r
+** CHANGE it (define it) if your system is XSI compatible.\r
+*/\r
+#if defined(LUA_USE_POSIX)\r
+#define LUA_USE_MKSTEMP\r
+#define LUA_USE_ISATTY\r
+#define LUA_USE_POPEN\r
+#define LUA_USE_ULONGJMP\r
+#define LUA_USE_GMTIME_R\r
+#endif\r
+\r
+\r
+\r
+/*\r
+@@ LUA_PATH_DEFAULT is the default path that Lua uses to look for\r
+@* Lua libraries.\r
+@@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for\r
+@* C libraries.\r
+** CHANGE them if your machine has a non-conventional directory\r
+** hierarchy or if you want to install your libraries in\r
+** non-conventional directories.\r
+*/\r
+#if defined(_WIN32) /* { */\r
+/*\r
+** In Windows, any exclamation mark ('!') in the path is replaced by the\r
+** path of the directory of the executable file of the current process.\r
+*/\r
+#define LUA_LDIR    "!\\lua\\"\r
+#define LUA_CDIR    "!\\"\r
+#define LUA_PATH_DEFAULT  \\r
+        LUA_LDIR"?.lua;"  LUA_LDIR"?\\init.lua;" \\r
+        LUA_CDIR"?.lua;"  LUA_CDIR"?\\init.lua;" ".\\?.lua"\r
+#define LUA_CPATH_DEFAULT \\r
+        LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll;" ".\\?.dll"\r
+\r
+#else           /* }{ */\r
+\r
+#define LUA_VDIR    LUA_VERSION_MAJOR "." LUA_VERSION_MINOR "/"\r
+#define LUA_ROOT    "/usr/local/"\r
+#define LUA_LDIR    LUA_ROOT "share/lua/" LUA_VDIR\r
+#define LUA_CDIR    LUA_ROOT "lib/lua/" LUA_VDIR\r
+#define LUA_PATH_DEFAULT  \\r
+        LUA_LDIR"?.lua;"  LUA_LDIR"?/init.lua;" \\r
+        LUA_CDIR"?.lua;"  LUA_CDIR"?/init.lua;" "./?.lua"\r
+#define LUA_CPATH_DEFAULT \\r
+        LUA_CDIR"?.so;" LUA_CDIR"loadall.so;" "./?.so"\r
+#endif          /* } */\r
+\r
+\r
+/*\r
+@@ LUA_DIRSEP is the directory separator (for submodules).\r
+** CHANGE it if your machine does not use "/" as the directory separator\r
+** and is not Windows. (On Windows Lua automatically uses "\".)\r
+*/\r
+#if defined(_WIN32) || defined (_DOS_WATCOM) || defined(_EFI)\r
+#define LUA_DIRSEP  "\\"\r
+#else\r
+#define LUA_DIRSEP  "/"\r
+#endif\r
+\r
+\r
+/*\r
+@@ LUA_ENV is the name of the variable that holds the current\r
+@@ environment, used to access global names.\r
+** CHANGE it if you do not like this name.\r
+*/\r
+#define LUA_ENV     "_ENV"\r
+\r
+\r
+/*\r
+@@ LUA_API is a mark for all core API functions.\r
+@@ LUALIB_API is a mark for all auxiliary library functions.\r
+@@ LUAMOD_API is a mark for all standard library opening functions.\r
+** CHANGE them if you need to define those functions in some special way.\r
+** For instance, if you want to create one Windows DLL with the core and\r
+** the libraries, you may want to use the following definition (define\r
+** LUA_BUILD_AS_DLL to get it).\r
+*/\r
+#if defined(LUA_BUILD_AS_DLL)   /* { */\r
+\r
+#if defined(LUA_CORE) || defined(LUA_LIB)   /* { */\r
+#define LUA_API __declspec(dllexport)\r
+#else                       /* }{ */\r
+#define LUA_API __declspec(dllimport)\r
+#endif                      /* } */\r
+\r
+#else               /* }{ */\r
+\r
+#define LUA_API     extern\r
+\r
+#endif              /* } */\r
+\r
+\r
+/* more often than not the libs go together with the core */\r
+#define LUALIB_API  LUA_API\r
+#define LUAMOD_API  LUALIB_API\r
+\r
+\r
+/*\r
+@@ LUAI_FUNC is a mark for all extern functions that are not to be\r
+@* exported to outside modules.\r
+@@ LUAI_DDEF and LUAI_DDEC are marks for all extern (const) variables\r
+@* that are not to be exported to outside modules (LUAI_DDEF for\r
+@* definitions and LUAI_DDEC for declarations).\r
+** CHANGE them if you need to mark them in some special way. Elf/gcc\r
+** (versions 3.2 and later) mark them as "hidden" to optimize access\r
+** when Lua is compiled as a shared library. Not all elf targets support\r
+** this attribute. Unfortunately, gcc does not offer a way to check\r
+** whether the target offers that support, and those without support\r
+** give a warning about it. To avoid these warnings, change to the\r
+** default definition.\r
+*/\r
+#if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \\r
+    defined(__ELF__)        /* { */\r
+#define LUAI_FUNC   __attribute__((visibility("hidden"))) extern\r
+#define LUAI_DDEC   LUAI_FUNC\r
+#define LUAI_DDEF   /* empty */\r
+\r
+#else               /* }{ */\r
+#define LUAI_FUNC   extern\r
+#define LUAI_DDEC   extern\r
+#define LUAI_DDEF   /* empty */\r
+#endif              /* } */\r
+\r
+\r
+\r
+/*\r
+@@ LUA_QL describes how error messages quote program elements.\r
+** CHANGE it if you want a different appearance.\r
+*/\r
+#define LUA_QL(x)   "'" x "'"\r
+#define LUA_QS      LUA_QL("%s")\r
+\r
+\r
+/*\r
+@@ LUA_IDSIZE gives the maximum size for the description of the source\r
+@* of a function in debug information.\r
+** CHANGE it if you want a different size.\r
+*/\r
+#define LUA_IDSIZE  60\r
+\r
+\r
+/*\r
+@@ luai_writestring/luai_writeline define how 'print' prints its results.\r
+** They are only used in libraries and the stand-alone program. (The #if\r
+** avoids including 'stdio.h' everywhere.)\r
+*/\r
+#if defined(LUA_LIB) || defined(lua_c)\r
+#include <stdio.h>\r
+#define luai_writestring(s,l)   fwrite((s), sizeof(char), (l), stdout)\r
+#define luai_writeline()    (luai_writestring("\n", 1), fflush(stdout))\r
+#endif\r
+\r
+/*\r
+@@ luai_writestringerror defines how to print error messages.\r
+** (A format string with one argument is enough for Lua...)\r
+*/\r
+#define luai_writestringerror(s,p) \\r
+    (fprintf(stderr, (s), (p)), fflush(stderr))\r
+\r
+\r
+/*\r
+@@ LUAI_MAXSHORTLEN is the maximum length for short strings, that is,\r
+** strings that are internalized. (Cannot be smaller than reserved words\r
+** or tags for metamethods, as these strings must be internalized;\r
+** #("function") = 8, #("__newindex") = 10.)\r
+*/\r
+#define LUAI_MAXSHORTLEN        40\r
+\r
+\r
+\r
+/*\r
+** {==================================================================\r
+** Compatibility with previous versions\r
+** ===================================================================\r
+*/\r
+\r
+/*\r
+@@ LUA_COMPAT_ALL controls all compatibility options.\r
+** You can define it to get all options, or change specific options\r
+** to fit your specific needs.\r
+*/\r
+#if defined(LUA_COMPAT_ALL) /* { */\r
+\r
+/*\r
+@@ LUA_COMPAT_UNPACK controls the presence of global 'unpack'.\r
+** You can replace it with 'table.unpack'.\r
+*/\r
+#define LUA_COMPAT_UNPACK\r
+\r
+/*\r
+@@ LUA_COMPAT_LOADERS controls the presence of table 'package.loaders'.\r
+** You can replace it with 'package.searchers'.\r
+*/\r
+#define LUA_COMPAT_LOADERS\r
+\r
+/*\r
+@@ macro 'lua_cpcall' emulates deprecated function lua_cpcall.\r
+** You can call your C function directly (with light C functions).\r
+*/\r
+#define lua_cpcall(L,f,u)  \\r
+    (lua_pushcfunction(L, (f)), \\r
+     lua_pushlightuserdata(L,(u)), \\r
+     lua_pcall(L,1,0,0))\r
+\r
+\r
+/*\r
+@@ LUA_COMPAT_LOG10 defines the function 'log10' in the math library.\r
+** You can rewrite 'log10(x)' as 'log(x, 10)'.\r
+*/\r
+#define LUA_COMPAT_LOG10\r
+\r
+/*\r
+@@ LUA_COMPAT_LOADSTRING defines the function 'loadstring' in the base\r
+** library. You can rewrite 'loadstring(s)' as 'load(s)'.\r
+*/\r
+#define LUA_COMPAT_LOADSTRING\r
+\r
+/*\r
+@@ LUA_COMPAT_MAXN defines the function 'maxn' in the table library.\r
+*/\r
+#define LUA_COMPAT_MAXN\r
+\r
+/*\r
+@@ The following macros supply trivial compatibility for some\r
+** changes in the API. The macros themselves document how to\r
+** change your code to avoid using them.\r
+*/\r
+#define lua_strlen(L,i)     lua_rawlen(L, (i))\r
+\r
+#define lua_objlen(L,i)     lua_rawlen(L, (i))\r
+\r
+#define lua_equal(L,idx1,idx2)      lua_compare(L,(idx1),(idx2),LUA_OPEQ)\r
+#define lua_lessthan(L,idx1,idx2)   lua_compare(L,(idx1),(idx2),LUA_OPLT)\r
+\r
+/*\r
+@@ LUA_COMPAT_MODULE controls compatibility with previous\r
+** module functions 'module' (Lua) and 'luaL_register' (C).\r
+*/\r
+#define LUA_COMPAT_MODULE\r
+\r
+#endif              /* } */\r
+\r
+/* }================================================================== */\r
+\r
+\r
+\r
+/*\r
+@@ LUAI_BITSINT defines the number of bits in an int.\r
+** CHANGE here if Lua cannot automatically detect the number of bits of\r
+** your machine. Probably you do not need to change this.\r
+*/\r
+/* avoid overflows in comparison */\r
+#if INT_MAX-20 < 32760      /* { */\r
+#define LUAI_BITSINT    16\r
+#elif INT_MAX > 2147483640L /* }{ */\r
+/* int has at least 32 bits */\r
+#define LUAI_BITSINT    32\r
+#else               /* }{ */\r
+#error "you must define LUA_BITSINT with number of bits in an integer"\r
+#endif              /* } */\r
+\r
+\r
+/*\r
+@@ LUA_INT32 is an signed integer with exactly 32 bits.\r
+@@ LUAI_UMEM is an unsigned integer big enough to count the total\r
+@* memory used by Lua.\r
+@@ LUAI_MEM is a signed integer big enough to count the total memory\r
+@* used by Lua.\r
+** CHANGE here if for some weird reason the default definitions are not\r
+** good enough for your machine. Probably you do not need to change\r
+** this.\r
+*/\r
+#if LUAI_BITSINT >= 32      /* { */\r
+#define LUA_INT32   int\r
+#define LUAI_UMEM   size_t\r
+#define LUAI_MEM    ptrdiff_t\r
+#else               /* }{ */\r
+/* 16-bit ints */\r
+#define LUA_INT32   long\r
+#define LUAI_UMEM   unsigned long\r
+#define LUAI_MEM    long\r
+#endif              /* } */\r
+\r
+\r
+/*\r
+@@ LUAI_MAXSTACK limits the size of the Lua stack.\r
+** CHANGE it if you need a different limit. This limit is arbitrary;\r
+** its only purpose is to stop Lua to consume unlimited stack\r
+** space (and to reserve some numbers for pseudo-indices).\r
+*/\r
+#if LUAI_BITSINT >= 32\r
+#define LUAI_MAXSTACK       1000000\r
+#else\r
+#define LUAI_MAXSTACK       15000\r
+#endif\r
+\r
+/* reserve some space for error handling */\r
+#define LUAI_FIRSTPSEUDOIDX (-LUAI_MAXSTACK - 1000)\r
+\r
+\r
+\r
+\r
+/*\r
+@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system.\r
+** CHANGE it if it uses too much C-stack space.\r
+*/\r
+#define LUAL_BUFFERSIZE     BUFSIZ\r
+\r
+\r
+\r
+\r
+/*\r
+** {==================================================================\r
+@@ LUA_NUMBER is the type of numbers in Lua.\r
+** CHANGE the following definitions only if you want to build Lua\r
+** with a number type different from double. You may also need to\r
+** change lua_number2int & lua_number2integer.\r
+** ===================================================================\r
+*/\r
+\r
+#define LUA_NUMBER_DOUBLE\r
+#define LUA_NUMBER  double\r
+\r
+/*\r
+@@ LUAI_UACNUMBER is the result of an 'usual argument conversion'\r
+@* over a number.\r
+*/\r
+#define LUAI_UACNUMBER  double\r
+\r
+/*\r
+@@ LUA_NUMBER_SCAN is the format for reading numbers.\r
+@@ LUA_NUMBER_FMT is the format for writing numbers.\r
+@@ lua_number2str converts a number to a string.\r
+@@ LUAI_MAXNUMBER2STR is maximum size of previous conversion.\r
+*/\r
+#define LUA_NUMBER_SCAN     "%lf"\r
+#define LUA_NUMBER_FMT      "%.14g"\r
+#define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n))\r
+#define LUAI_MAXNUMBER2STR  32 /* 16 digits, sign, point, and \0 */\r
+\r
+\r
+/*\r
+@@ l_mathop allows the addition of an 'l' or 'f' to all math operations\r
+*/\r
+#define l_mathop(x)     (x)\r
+\r
+\r
+/*\r
+@@ lua_str2number converts a decimal numeric string to a number.\r
+@@ lua_strx2number converts an hexadecimal numeric string to a number.\r
+** In C99, 'strtod' does both conversions. C89, however, has no function\r
+** to convert floating hexadecimal strings to numbers. For these\r
+** systems, you can leave 'lua_strx2number' undefined and Lua will\r
+** provide its own implementation.\r
+*/\r
+#define lua_str2number(s,p) strtod((s), (p))\r
+\r
+#if defined(LUA_USE_STRTODHEX)\r
+#define lua_strx2number(s,p)    strtod((s), (p))\r
+#endif\r
+\r
+\r
+/*\r
+@@ The luai_num* macros define the primitive operations over numbers.\r
+*/\r
+\r
+/* the following operations need the math library */\r
+#if defined(lobject_c) || defined(lvm_c)\r
+#include <math.h>\r
+#define luai_nummod(L,a,b)  ((a) - l_mathop(floor)((a)/(b))*(b))\r
+#define luai_numpow(L,a,b)  (l_mathop(pow)(a,b))\r
+#endif\r
+\r
+/* these are quite standard operations */\r
+#if defined(LUA_CORE)\r
+#define luai_numadd(L,a,b)  ((a)+(b))\r
+#define luai_numsub(L,a,b)  ((a)-(b))\r
+#define luai_nummul(L,a,b)  ((a)*(b))\r
+#define luai_numdiv(L,a,b)  ((a)/(b))\r
+#define luai_numunm(L,a)    (-(a))\r
+#define luai_numeq(a,b)     ((a)==(b))\r
+#define luai_numlt(L,a,b)   ((a)<(b))\r
+#define luai_numle(L,a,b)   ((a)<=(b))\r
+#define luai_numisnan(L,a)  (!luai_numeq((a), (a)))\r
+#endif\r
+\r
+\r
+\r
+/*\r
+@@ LUA_INTEGER is the integral type used by lua_pushinteger/lua_tointeger.\r
+** CHANGE that if ptrdiff_t is not adequate on your machine. (On most\r
+** machines, ptrdiff_t gives a good choice between int or long.)\r
+*/\r
+#define LUA_INTEGER ptrdiff_t\r
+\r
+/*\r
+@@ LUA_UNSIGNED is the integral type used by lua_pushunsigned/lua_tounsigned.\r
+** It must have at least 32 bits.\r
+*/\r
+#define LUA_UNSIGNED    unsigned LUA_INT32\r
+\r
+\r
+\r
+/*\r
+** Some tricks with doubles\r
+*/\r
+\r
+#if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI)    /* { */\r
+/*\r
+** The next definitions activate some tricks to speed up the\r
+** conversion from doubles to integer types, mainly to LUA_UNSIGNED.\r
+**\r
+@@ LUA_MSASMTRICK uses Microsoft assembler to avoid clashes with a\r
+** DirectX idiosyncrasy.\r
+**\r
+@@ LUA_IEEE754TRICK uses a trick that should work on any machine\r
+** using IEEE754 with a 32-bit integer type.\r
+**\r
+@@ LUA_IEEELL extends the trick to LUA_INTEGER; should only be\r
+** defined when LUA_INTEGER is a 32-bit integer.\r
+**\r
+@@ LUA_IEEEENDIAN is the endianness of doubles in your machine\r
+** (0 for little endian, 1 for big endian); if not defined, Lua will\r
+** check it dynamically for LUA_IEEE754TRICK (but not for LUA_NANTRICK).\r
+**\r
+@@ LUA_NANTRICK controls the use of a trick to pack all types into\r
+** a single double value, using NaN values to represent non-number\r
+** values. The trick only works on 32-bit machines (ints and pointers\r
+** are 32-bit values) with numbers represented as IEEE 754-2008 doubles\r
+** with conventional endianess (12345678 or 87654321), in CPUs that do\r
+** not produce signaling NaN values (all NaNs are quiet).\r
+*/\r
+\r
+/* Microsoft compiler on a Pentium (32 bit) ? */\r
+#if defined(LUA_WIN) && defined(_MSC_VER) && defined(_M_IX86)   /* { */\r
+\r
+#define LUA_MSASMTRICK\r
+#define LUA_IEEEENDIAN      0\r
+#define LUA_NANTRICK\r
+\r
+\r
+/* pentium 32 bits? */\r
+#elif defined(__i386__) || defined(__i386) || defined(__X86__) /* }{ */\r
+\r
+#define LUA_IEEE754TRICK\r
+#define LUA_IEEELL\r
+#define LUA_IEEEENDIAN      0\r
+#define LUA_NANTRICK\r
+\r
+/* pentium 64 bits? */\r
+#elif defined(__x86_64)                     /* }{ */\r
+\r
+#define LUA_IEEE754TRICK\r
+#define LUA_IEEEENDIAN      0\r
+\r
+#elif defined(__POWERPC__) || defined(__ppc__)          /* }{ */\r
+\r
+#define LUA_IEEE754TRICK\r
+#define LUA_IEEEENDIAN      1\r
+\r
+#else                               /* }{ */\r
+\r
+/* assume IEEE754 and a 32-bit integer type */\r
+#define LUA_IEEE754TRICK\r
+\r
+#endif                              /* } */\r
+\r
+#endif                          /* } */\r
+\r
+/* }================================================================== */\r
+\r
+\r
+\r
+\r
+/* =================================================================== */\r
+\r
+/*\r
+** Local configuration. You can use this space to add your redefinitions\r
+** without modifying the main part of the file.\r
+*/\r
+\r
+\r
+\r
+#endif\r
+\r