lua

A copy of the Lua development repository
Log | Files | Refs | README

onelua.c (2235B)


      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 
     14 /* default is to build the full interpreter */
     15 #ifndef MAKE_LIB
     16 #ifndef MAKE_LUAC
     17 #ifndef MAKE_LUA
     18 #define MAKE_LUA
     19 #endif
     20 #endif
     21 #endif
     22 
     23 
     24 /*
     25 ** Choose suitable platform-specific features. Default is no
     26 ** platform-specific features. Some of these options may need extra
     27 ** libraries such as -ldl -lreadline -lncurses
     28 */
     29 #if 0
     30 #define LUA_USE_LINUX
     31 #define LUA_USE_MACOSX
     32 #define LUA_USE_POSIX
     33 #define LUA_ANSI
     34 #endif
     35 
     36 
     37 /* no need to change anything below this line ----------------------------- */
     38 
     39 #include "lprefix.h"
     40 
     41 #include <assert.h>
     42 #include <ctype.h>
     43 #include <errno.h>
     44 #include <float.h>
     45 #include <limits.h>
     46 #include <locale.h>
     47 #include <math.h>
     48 #include <setjmp.h>
     49 #include <signal.h>
     50 #include <stdarg.h>
     51 #include <stddef.h>
     52 #include <stdio.h>
     53 #include <stdlib.h>
     54 #include <string.h>
     55 #include <time.h>
     56 
     57 
     58 /* setup for luaconf.h */
     59 #define LUA_CORE
     60 #define LUA_LIB
     61 #define ltable_c
     62 #define lvm_c
     63 #include "luaconf.h"
     64 
     65 /* do not export internal symbols */
     66 #undef LUAI_FUNC
     67 #undef LUAI_DDEC
     68 #undef LUAI_DDEF
     69 #define LUAI_FUNC	static
     70 #define LUAI_DDEC(def)	/* empty */
     71 #define LUAI_DDEF	static
     72 
     73 /* core -- used by all */
     74 #include "lzio.c"
     75 #include "lctype.c"
     76 #include "lopcodes.c"
     77 #include "lmem.c"
     78 #include "lundump.c"
     79 #include "ldump.c"
     80 #include "lstate.c"
     81 #include "lgc.c"
     82 #include "llex.c"
     83 #include "lcode.c"
     84 #include "lparser.c"
     85 #include "ldebug.c"
     86 #include "lfunc.c"
     87 #include "lobject.c"
     88 #include "ltm.c"
     89 #include "lstring.c"
     90 #include "ltable.c"
     91 #include "ldo.c"
     92 #include "lvm.c"
     93 #include "lapi.c"
     94 
     95 /* auxiliary library -- used by all */
     96 #include "lauxlib.c"
     97 
     98 /* standard library  -- not used by luac */
     99 #ifndef MAKE_LUAC
    100 #include "lbaselib.c"
    101 #include "lcorolib.c"
    102 #include "ldblib.c"
    103 #include "liolib.c"
    104 #include "lmathlib.c"
    105 #include "loadlib.c"
    106 #include "loslib.c"
    107 #include "lstrlib.c"
    108 #include "ltablib.c"
    109 #include "lutf8lib.c"
    110 #include "linit.c"
    111 #endif
    112 
    113 /* lua */
    114 #ifdef MAKE_LUA
    115 #include "lua.c"
    116 #endif
    117 
    118 /* luac */
    119 #ifdef MAKE_LUAC
    120 #include "luac.c"
    121 #endif