2
0

onelua.c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /*
  2. ** Lua core, libraries, and interpreter in a single file.
  3. ** Compiling just this file generates a complete Lua stand-alone
  4. ** program:
  5. **
  6. ** $ gcc -O2 -std=c99 -o lua onelua.c -lm
  7. **
  8. ** or
  9. **
  10. ** $ gcc -O2 -std=c89 -DLUA_USE_C89 -o lua onelua.c -lm
  11. **
  12. */
  13. /* default is to build the full interpreter */
  14. #ifndef MAKE_LIB
  15. #ifndef MAKE_LUAC
  16. #ifndef MAKE_LUA
  17. #define MAKE_LUA
  18. #endif
  19. #endif
  20. #endif
  21. /*
  22. ** Choose suitable platform-specific features. Default is no
  23. ** platform-specific features. Some of these options may need extra
  24. ** libraries such as -ldl -lreadline -lncurses
  25. */
  26. #if 0
  27. #define LUA_USE_LINUX
  28. #define LUA_USE_MACOSX
  29. #define LUA_USE_POSIX
  30. #define LUA_ANSI
  31. #endif
  32. /* no need to change anything below this line ----------------------------- */
  33. #include "lprefix.h"
  34. #include <assert.h>
  35. #include <ctype.h>
  36. #include <errno.h>
  37. #include <float.h>
  38. #include <limits.h>
  39. #include <locale.h>
  40. #include <math.h>
  41. #include <setjmp.h>
  42. #include <signal.h>
  43. #include <stdarg.h>
  44. #include <stddef.h>
  45. #include <stdio.h>
  46. #include <stdlib.h>
  47. #include <string.h>
  48. #include <time.h>
  49. /* setup for luaconf.h */
  50. #define LUA_CORE
  51. #define LUA_LIB
  52. #define ltable_c
  53. #define lvm_c
  54. #include "luaconf.h"
  55. /* do not export internal symbols */
  56. #undef LUAI_FUNC
  57. #undef LUAI_DDEC
  58. #undef LUAI_DDEF
  59. #define LUAI_FUNC static
  60. #define LUAI_DDEC(def) /* empty */
  61. #define LUAI_DDEF static
  62. /* core -- used by all */
  63. #include "lzio.c"
  64. #include "lctype.c"
  65. #include "lopcodes.c"
  66. #include "lmem.c"
  67. #include "lundump.c"
  68. #include "ldump.c"
  69. #include "lstate.c"
  70. #include "lgc.c"
  71. #include "llex.c"
  72. #include "lcode.c"
  73. #include "lparser.c"
  74. #include "ldebug.c"
  75. #include "lfunc.c"
  76. #include "lobject.c"
  77. #include "ltm.c"
  78. #include "lstring.c"
  79. #include "ltable.c"
  80. #include "ldo.c"
  81. #include "lvm.c"
  82. #include "lapi.c"
  83. /* auxiliary library -- used by all */
  84. #include "lauxlib.c"
  85. /* standard library -- not used by luac */
  86. #ifndef MAKE_LUAC
  87. #include "lbaselib.c"
  88. #include "lcorolib.c"
  89. #include "ldblib.c"
  90. #include "liolib.c"
  91. #include "lmathlib.c"
  92. #include "loadlib.c"
  93. #include "loslib.c"
  94. #include "lstrlib.c"
  95. #include "ltablib.c"
  96. #include "lutf8lib.c"
  97. #include "linit.c"
  98. #endif
  99. /* lua */
  100. #ifdef MAKE_LUA
  101. #include "lua.c"
  102. #endif
  103. /* luac */
  104. #ifdef MAKE_LUAC
  105. #include "luac.c"
  106. #endif