lua_one.cpp (2831B)
1 /* 2 * one.c -- Lua core, libraries, and interpreter in a single file (Lua 5.3) 3 * modified from one.tar.gz avaialble here: https://www.lua.org/extras/5.3/ 4 * These files are distributed under the Lua license: 5 * http://www.lua.org/license.html 6 */ 7 8 /* default is to build only the lib */ 9 #ifndef MAKE_LIB 10 #ifndef MAKE_LUAC 11 #ifndef MAKE_LUA 12 #define MAKE_LIB 13 #endif 14 #endif 15 #endif 16 17 /* choose suitable platform-specific features */ 18 /* some of these may need extra libraries such as -ldl -lreadline -lncurses */ 19 /* 20 #define LUA_USE_LINUX 21 #define LUA_USE_MACOSX 22 #define LUA_USE_POSIX 23 #define LUA_USE_DLOPEN 24 #define LUA_USE_READLINE 25 */ 26 27 /* other specific features */ 28 /* 29 #define LUA_32BITS 30 #define LUA_USE_C89 31 #define LUA_C89_NUMBERS 32 */ 33 34 /* no need to change anything below this line ----------------------------- */ 35 36 /* activate system definitions in lprefix.h */ 37 #include "lprefix.h" 38 #include <assert.h> 39 #include <ctype.h> 40 #include <errno.h> 41 #include <float.h> 42 #include <limits.h> 43 #include <locale.h> 44 #include <math.h> 45 #include <setjmp.h> 46 #include <signal.h> 47 #include <stdarg.h> 48 #include <stddef.h> 49 #include <stdio.h> 50 #include <stdlib.h> 51 #include <string.h> 52 #include <time.h> 53 54 /* setup for luaconf.h */ 55 #define LUA_CORE 56 #define LUA_LIB 57 #define lvm_c 58 #include "luaconf.h" 59 60 /* do not export internal symbols */ 61 // this dicklicker piece of shit called C++ doesn't allow forward declarations 62 // of static variables, you'd have to use an anonymous namespace, but after 63 // namespace you need a limpdick curly bracket, so I can't put it into the macro 64 // here, so just export those faggot variables 65 #undef LUAI_FUNC 66 #undef LUAI_DDEC 67 #undef LUAI_DDEF 68 #define LUAI_FUNC static 69 #define LUAI_DDEC extern 70 #define LUAI_DDEF 71 72 // build as extern "C" 73 #undef LUA_API 74 #ifdef LUA_BUILD_AS_DLL 75 #define LUA_API extern "C" __declspec(dllexport) 76 #else 77 #define LUA_API extern "C" __attribute((visibility("default"))) 78 #endif 79 80 /* core -- used by all */ 81 #include "lapi.c" 82 #include "lcode.c" 83 #include "lctype.c" 84 #include "ldebug.c" 85 #include "ldo.c" 86 #include "ldump.c" 87 #include "lfunc.c" 88 #include "lgc.c" 89 #include "llex.c" 90 #include "lmem.c" 91 #include "lobject.c" 92 #include "lopcodes.c" 93 #include "lparser.c" 94 #include "lstate.c" 95 #include "lstring.c" 96 #include "ltable.c" 97 #include "ltm.c" 98 #include "lundump.c" 99 #include "lvm.c" 100 #include "lzio.c" 101 102 /* auxiliary library -- used by all */ 103 #include "lauxlib.c" 104 105 /* standard library -- not used by luac */ 106 #ifndef MAKE_LUAC 107 #include "lbaselib.c" 108 #if defined(LUA_COMPAT_BITLIB) 109 #include "lbitlib.c" 110 #endif 111 #include "lcorolib.c" 112 #include "ldblib.c" 113 #include "liolib.c" 114 #include "lmathlib.c" 115 #include "loadlib.c" 116 #include "loslib.c" 117 #include "lstrlib.c" 118 #include "ltablib.c" 119 #include "lutf8lib.c" 120 #include "linit.c" 121 #endif 122 123 /* lua */ 124 #ifdef MAKE_LUA 125 #include "lua.c" 126 #endif 127 128 /* luac */ 129 #ifdef MAKE_LUAC 130 #include "luac.c" 131 #endif