misc/liblua/luaconf.h
author unC0Rr
Thu, 25 Jul 2019 15:18:00 +0200
changeset 15265 07e909ba4203
parent 10017 de822cd3df3a
permissions -rw-r--r--
Implement ipc queue which takes care of message ordering and timestamps
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     1
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     2
** $Id: luaconf.h,v 1.82.1.7 2008/02/11 16:25:08 roberto Exp $
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     3
** Configuration file for Lua
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     4
** See Copyright Notice in lua.h
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     5
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     6
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     7
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     8
#ifndef lconfig_h
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     9
#define lconfig_h
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    10
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    11
#include <limits.h>
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    12
#include <stddef.h>
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    13
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    14
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    15
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    16
** ==================================================================
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    17
** Search for "@@" to find all configurable definitions.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    18
** ===================================================================
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    19
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    20
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    21
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    22
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    23
@@ LUA_ANSI controls the use of non-ansi features.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    24
** CHANGE it (define it) if you want Lua to avoid the use of any
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    25
** non-ansi feature or library.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    26
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    27
#if defined(__STRICT_ANSI__)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    28
#define LUA_ANSI
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    29
#endif
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    30
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    31
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    32
#if !defined(LUA_ANSI) && defined(_WIN32)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    33
#define LUA_WIN
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    34
#endif
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    35
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    36
#if defined(LUA_USE_LINUX)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    37
#define LUA_USE_POSIX
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    38
#define LUA_USE_DLOPEN      /* needs an extra library: -ldl */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    39
#define LUA_USE_READLINE    /* needs some extra libraries */
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    40
#endif
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    41
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    42
#if defined(LUA_USE_MACOSX)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    43
#define LUA_USE_POSIX
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    44
#define LUA_DL_DYLD     /* does not need extra library */
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    45
#endif
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    46
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    47
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    48
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    49
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    50
@@ LUA_USE_POSIX includes all functionallity listed as X/Open System
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    51
@* Interfaces Extension (XSI).
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    52
** CHANGE it (define it) if your system is XSI compatible.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    53
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    54
#if defined(LUA_USE_POSIX)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    55
#define LUA_USE_MKSTEMP
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    56
#define LUA_USE_ISATTY
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    57
#define LUA_USE_POPEN
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    58
#define LUA_USE_ULONGJMP
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    59
#endif
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    60
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    61
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    62
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    63
@@ LUA_PATH and LUA_CPATH are the names of the environment variables that
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    64
@* Lua check to set its paths.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    65
@@ LUA_INIT is the name of the environment variable that Lua
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    66
@* checks for initialization code.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    67
** CHANGE them if you want different names.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    68
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    69
#define LUA_PATH        "LUA_PATH"
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    70
#define LUA_CPATH       "LUA_CPATH"
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    71
#define LUA_INIT    "LUA_INIT"
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    72
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    73
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    74
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    75
@@ LUA_PATH_DEFAULT is the default path that Lua uses to look for
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    76
@* Lua libraries.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    77
@@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    78
@* C libraries.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    79
** CHANGE them if your machine has a non-conventional directory
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    80
** hierarchy or if you want to install your libraries in
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    81
** non-conventional directories.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    82
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    83
#if defined(_WIN32)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    84
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    85
** In Windows, any exclamation mark ('!') in the path is replaced by the
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    86
** path of the directory of the executable file of the current process.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    87
*/
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    88
#define LUA_LDIR    "!\\lua\\"
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    89
#define LUA_CDIR    "!\\"
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    90
#define LUA_PATH_DEFAULT  \
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    91
        ".\\?.lua;"  LUA_LDIR"?.lua;"  LUA_LDIR"?\\init.lua;" \
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    92
                     LUA_CDIR"?.lua;"  LUA_CDIR"?\\init.lua"
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    93
#define LUA_CPATH_DEFAULT \
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    94
    ".\\?.dll;"  LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll"
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    95
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    96
#else
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    97
#define LUA_ROOT    "/usr/local/"
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    98
#define LUA_LDIR    LUA_ROOT "share/lua/5.1/"
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    99
#define LUA_CDIR    LUA_ROOT "lib/lua/5.1/"
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   100
#define LUA_PATH_DEFAULT  \
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   101
        "./?.lua;"  LUA_LDIR"?.lua;"  LUA_LDIR"?/init.lua;" \
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   102
                    LUA_CDIR"?.lua;"  LUA_CDIR"?/init.lua"
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   103
#define LUA_CPATH_DEFAULT \
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   104
    "./?.so;"  LUA_CDIR"?.so;" LUA_CDIR"loadall.so"
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   105
#endif
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   106
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   107
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   108
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   109
@@ LUA_DIRSEP is the directory separator (for submodules).
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   110
** CHANGE it if your machine does not use "/" as the directory separator
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   111
** and is not Windows. (On Windows Lua automatically uses "\".)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   112
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   113
#if defined(_WIN32)
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   114
#define LUA_DIRSEP  "\\"
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   115
#else
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   116
#define LUA_DIRSEP  "/"
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   117
#endif
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   118
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   119
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   120
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   121
@@ LUA_PATHSEP is the character that separates templates in a path.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   122
@@ LUA_PATH_MARK is the string that marks the substitution points in a
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   123
@* template.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   124
@@ LUA_EXECDIR in a Windows path is replaced by the executable's
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   125
@* directory.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   126
@@ LUA_IGMARK is a mark to ignore all before it when bulding the
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   127
@* luaopen_ function name.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   128
** CHANGE them if for some reason your system cannot use those
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   129
** characters. (E.g., if one of those characters is a common character
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   130
** in file/directory names.) Probably you do not need to change them.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   131
*/
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   132
#define LUA_PATHSEP ";"
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   133
#define LUA_PATH_MARK   "?"
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   134
#define LUA_EXECDIR "!"
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   135
#define LUA_IGMARK  "-"
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   136
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   137
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   138
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   139
@@ LUA_INTEGER is the integral type used by lua_pushinteger/lua_tointeger.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   140
** CHANGE that if ptrdiff_t is not adequate on your machine. (On most
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   141
** machines, ptrdiff_t gives a good choice between int or long.)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   142
*/
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   143
#define LUA_INTEGER ptrdiff_t
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   144
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   145
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   146
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   147
@@ LUA_API is a mark for all core API functions.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   148
@@ LUALIB_API is a mark for all standard library functions.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   149
** CHANGE them if you need to define those functions in some special way.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   150
** For instance, if you want to create one Windows DLL with the core and
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   151
** the libraries, you may want to use the following definition (define
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   152
** LUA_BUILD_AS_DLL to get it).
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   153
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   154
#if defined(LUA_BUILD_AS_DLL)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   155
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   156
#if defined(LUA_CORE) || defined(LUA_LIB)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   157
#define LUA_API __declspec(dllexport)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   158
#else
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   159
#define LUA_API __declspec(dllimport)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   160
#endif
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   161
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   162
#else
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   163
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   164
#define LUA_API     extern
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   165
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   166
#endif
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   167
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   168
/* more often than not the libs go together with the core */
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   169
#define LUALIB_API  LUA_API
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   170
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   171
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   172
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   173
@@ LUAI_FUNC is a mark for all extern functions that are not to be
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   174
@* exported to outside modules.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   175
@@ LUAI_DATA is a mark for all extern (const) variables that are not to
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   176
@* be exported to outside modules.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   177
** CHANGE them if you need to mark them in some special way. Elf/gcc
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   178
** (versions 3.2 and later) mark them as "hidden" to optimize access
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   179
** when Lua is compiled as a shared library.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   180
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   181
#if defined(luaall_c)
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   182
#define LUAI_FUNC   static
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   183
#define LUAI_DATA   /* empty */
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   184
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   185
#elif defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   186
      defined(__ELF__)
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   187
#define LUAI_FUNC   __attribute__((visibility("hidden"))) extern
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   188
#define LUAI_DATA   LUAI_FUNC
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   189
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   190
#else
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   191
#define LUAI_FUNC   extern
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   192
#define LUAI_DATA   extern
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   193
#endif
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   194
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   195
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   196
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   197
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   198
@@ LUA_QL describes how error messages quote program elements.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   199
** CHANGE it if you want a different appearance.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   200
*/
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   201
#define LUA_QL(x)   "'" x "'"
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   202
#define LUA_QS      LUA_QL("%s")
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   203
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   204
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   205
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   206
@@ LUA_IDSIZE gives the maximum size for the description of the source
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   207
@* of a function in debug information.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   208
** CHANGE it if you want a different size.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   209
*/
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   210
#define LUA_IDSIZE  60
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   211
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   212
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   213
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   214
** {==================================================================
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   215
** Stand-alone configuration
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   216
** ===================================================================
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   217
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   218
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   219
#if defined(lua_c) || defined(luaall_c)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   220
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   221
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   222
@@ lua_stdin_is_tty detects whether the standard input is a 'tty' (that
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   223
@* is, whether we're running lua interactively).
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   224
** CHANGE it if you have a better definition for non-POSIX/non-Windows
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   225
** systems.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   226
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   227
#if defined(LUA_USE_ISATTY)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   228
#include <unistd.h>
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   229
#define lua_stdin_is_tty()  isatty(0)
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   230
#elif defined(LUA_WIN)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   231
#include <io.h>
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   232
#include <stdio.h>
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   233
#define lua_stdin_is_tty()  _isatty(_fileno(stdin))
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   234
#else
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   235
#define lua_stdin_is_tty()  1  /* assume stdin is a tty */
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   236
#endif
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   237
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   238
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   239
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   240
@@ LUA_PROMPT is the default prompt used by stand-alone Lua.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   241
@@ LUA_PROMPT2 is the default continuation prompt used by stand-alone Lua.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   242
** CHANGE them if you want different prompts. (You can also change the
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   243
** prompts dynamically, assigning to globals _PROMPT/_PROMPT2.)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   244
*/
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   245
#define LUA_PROMPT      "> "
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   246
#define LUA_PROMPT2     ">> "
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   247
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   248
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   249
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   250
@@ LUA_PROGNAME is the default name for the stand-alone Lua program.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   251
** CHANGE it if your stand-alone interpreter has a different name and
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   252
** your system is not able to detect that name automatically.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   253
*/
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   254
#define LUA_PROGNAME        "lua"
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   255
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   256
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   257
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   258
@@ LUA_MAXINPUT is the maximum length for an input line in the
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   259
@* stand-alone interpreter.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   260
** CHANGE it if you need longer lines.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   261
*/
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   262
#define LUA_MAXINPUT    512
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   263
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   264
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   265
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   266
@@ lua_readline defines how to show a prompt and then read a line from
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   267
@* the standard input.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   268
@@ lua_saveline defines how to "save" a read line in a "history".
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   269
@@ lua_freeline defines how to free a line read by lua_readline.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   270
** CHANGE them if you want to improve this functionality (e.g., by using
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   271
** GNU readline and history facilities).
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   272
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   273
#if defined(LUA_USE_READLINE)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   274
#include <stdio.h>
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   275
#include <readline/readline.h>
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   276
#include <readline/history.h>
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   277
#define lua_readline(L,b,p) ((void)L, ((b)=readline(p)) != NULL)
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   278
#define lua_saveline(L,idx) \
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   279
    if (lua_strlen(L,idx) > 0)  /* non-empty line? */ \
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   280
      add_history(lua_tostring(L, idx));  /* add it to history */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   281
#define lua_freeline(L,b)   ((void)L, free(b))
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   282
#else
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   283
#define lua_readline(L,b,p) \
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   284
    ((void)L, fputs(p, stdout), fflush(stdout),  /* show prompt */ \
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   285
    fgets(b, LUA_MAXINPUT, stdin) != NULL)  /* get line */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   286
#define lua_saveline(L,idx) { (void)L; (void)idx; }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   287
#define lua_freeline(L,b)   { (void)L; (void)b; }
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   288
#endif
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   289
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   290
#endif
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   291
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   292
/* }================================================================== */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   293
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   294
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   295
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   296
@@ LUAI_GCPAUSE defines the default pause between garbage-collector cycles
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   297
@* as a percentage.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   298
** CHANGE it if you want the GC to run faster or slower (higher values
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   299
** mean larger pauses which mean slower collection.) You can also change
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   300
** this value dynamically.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   301
*/
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   302
#define LUAI_GCPAUSE    200  /* 200% (wait memory to double before next GC) */
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   303
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   304
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   305
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   306
@@ LUAI_GCMUL defines the default speed of garbage collection relative to
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   307
@* memory allocation as a percentage.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   308
** CHANGE it if you want to change the granularity of the garbage
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   309
** collection. (Higher values mean coarser collections. 0 represents
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   310
** infinity, where each step performs a full collection.) You can also
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   311
** change this value dynamically.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   312
*/
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   313
#define LUAI_GCMUL  200 /* GC runs 'twice the speed' of memory allocation */
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   314
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   315
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   316
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   317
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   318
@@ LUA_COMPAT_GETN controls compatibility with old getn behavior.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   319
** CHANGE it (define it) if you want exact compatibility with the
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   320
** behavior of setn/getn in Lua 5.0.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   321
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   322
#undef LUA_COMPAT_GETN
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   323
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   324
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   325
@@ LUA_COMPAT_LOADLIB controls compatibility about global loadlib.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   326
** CHANGE it to undefined as soon as you do not need a global 'loadlib'
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   327
** function (the function is still available as 'package.loadlib').
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   328
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   329
#undef LUA_COMPAT_LOADLIB
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   330
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   331
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   332
@@ LUA_COMPAT_VARARG controls compatibility with old vararg feature.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   333
** CHANGE it to undefined as soon as your programs use only '...' to
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   334
** access vararg parameters (instead of the old 'arg' table).
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   335
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   336
#define LUA_COMPAT_VARARG
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   337
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   338
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   339
@@ LUA_COMPAT_MOD controls compatibility with old math.mod function.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   340
** CHANGE it to undefined as soon as your programs use 'math.fmod' or
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   341
** the new '%' operator instead of 'math.mod'.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   342
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   343
#define LUA_COMPAT_MOD
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   344
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   345
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   346
@@ LUA_COMPAT_LSTR controls compatibility with old long string nesting
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   347
@* facility.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   348
** CHANGE it to 2 if you want the old behaviour, or undefine it to turn
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   349
** off the advisory error when nesting [[...]].
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   350
*/
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   351
#define LUA_COMPAT_LSTR     1
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   352
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   353
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   354
@@ LUA_COMPAT_GFIND controls compatibility with old 'string.gfind' name.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   355
** CHANGE it to undefined as soon as you rename 'string.gfind' to
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   356
** 'string.gmatch'.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   357
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   358
#define LUA_COMPAT_GFIND
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   359
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   360
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   361
@@ LUA_COMPAT_OPENLIB controls compatibility with old 'luaL_openlib'
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   362
@* behavior.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   363
** CHANGE it to undefined as soon as you replace to 'luaL_register'
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   364
** your uses of 'luaL_openlib'
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   365
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   366
#define LUA_COMPAT_OPENLIB
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   367
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   368
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   369
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   370
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   371
@@ luai_apicheck is the assert macro used by the Lua-C API.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   372
** CHANGE luai_apicheck if you want Lua to perform some checks in the
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   373
** parameters it gets from API calls. This may slow down the interpreter
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   374
** a bit, but may be quite useful when debugging C code that interfaces
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   375
** with Lua. A useful redefinition is to use assert.h.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   376
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   377
#if defined(LUA_USE_APICHECK)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   378
#include <assert.h>
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   379
#define luai_apicheck(L,o)  { (void)L; assert(o); }
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   380
#else
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   381
#define luai_apicheck(L,o)  { (void)L; }
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   382
#endif
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   383
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   384
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   385
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   386
@@ LUAI_BITSINT defines the number of bits in an int.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   387
** CHANGE here if Lua cannot automatically detect the number of bits of
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   388
** your machine. Probably you do not need to change this.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   389
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   390
/* avoid overflows in comparison */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   391
#if INT_MAX-20 < 32760
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   392
#define LUAI_BITSINT    16
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   393
#elif INT_MAX > 2147483640L
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   394
/* int has at least 32 bits */
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   395
#define LUAI_BITSINT    32
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   396
#else
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   397
#error "you must define LUA_BITSINT with number of bits in an integer"
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   398
#endif
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   399
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   400
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   401
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   402
@@ LUAI_UINT32 is an unsigned integer with at least 32 bits.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   403
@@ LUAI_INT32 is an signed integer with at least 32 bits.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   404
@@ LUAI_UMEM is an unsigned integer big enough to count the total
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   405
@* memory used by Lua.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   406
@@ LUAI_MEM is a signed integer big enough to count the total memory
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   407
@* used by Lua.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   408
** CHANGE here if for some weird reason the default definitions are not
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   409
** good enough for your machine. (The definitions in the 'else'
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   410
** part always works, but may waste space on machines with 64-bit
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   411
** longs.) Probably you do not need to change this.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   412
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   413
#if LUAI_BITSINT >= 32
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   414
#define LUAI_UINT32 unsigned int
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   415
#define LUAI_INT32  int
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   416
#define LUAI_MAXINT32   INT_MAX
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   417
#define LUAI_UMEM   size_t
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   418
#define LUAI_MEM    ptrdiff_t
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   419
#else
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   420
/* 16-bit ints */
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   421
#define LUAI_UINT32 unsigned long
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   422
#define LUAI_INT32  long
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   423
#define LUAI_MAXINT32   LONG_MAX
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   424
#define LUAI_UMEM   unsigned long
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   425
#define LUAI_MEM    long
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   426
#endif
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   427
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   428
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   429
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   430
@@ LUAI_MAXCALLS limits the number of nested calls.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   431
** CHANGE it if you need really deep recursive calls. This limit is
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   432
** arbitrary; its only purpose is to stop infinite recursion before
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   433
** exhausting memory.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   434
*/
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   435
#define LUAI_MAXCALLS   20000
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   436
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   437
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   438
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   439
@@ LUAI_MAXCSTACK limits the number of Lua stack slots that a C function
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   440
@* can use.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   441
** CHANGE it if you need lots of (Lua) stack space for your C
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   442
** functions. This limit is arbitrary; its only purpose is to stop C
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   443
** functions to consume unlimited stack space. (must be smaller than
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   444
** -LUA_REGISTRYINDEX)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   445
*/
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   446
#define LUAI_MAXCSTACK  8000
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   447
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   448
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   449
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   450
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   451
** {==================================================================
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   452
** CHANGE (to smaller values) the following definitions if your system
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   453
** has a small C stack. (Or you may want to change them to larger
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   454
** values if your system has a large C stack and these limits are
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   455
** too rigid for you.) Some of these constants control the size of
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   456
** stack-allocated arrays used by the compiler or the interpreter, while
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   457
** others limit the maximum number of recursive calls that the compiler
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   458
** or the interpreter can perform. Values too large may cause a C stack
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   459
** overflow for some forms of deep constructs.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   460
** ===================================================================
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   461
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   462
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   463
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   464
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   465
@@ LUAI_MAXCCALLS is the maximum depth for nested C calls (short) and
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   466
@* syntactical nested non-terminals in a program.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   467
*/
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   468
#define LUAI_MAXCCALLS      200
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   469
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   470
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   471
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   472
@@ LUAI_MAXVARS is the maximum number of local variables per function
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   473
@* (must be smaller than 250).
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   474
*/
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   475
#define LUAI_MAXVARS        200
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   476
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   477
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   478
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   479
@@ LUAI_MAXUPVALUES is the maximum number of upvalues per function
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   480
@* (must be smaller than 250).
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   481
*/
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   482
#define LUAI_MAXUPVALUES    60
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   483
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   484
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   485
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   486
@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   487
*/
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   488
#define LUAL_BUFFERSIZE     BUFSIZ
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   489
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   490
/* }================================================================== */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   491
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   492
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   493
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   494
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   495
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   496
** {==================================================================
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   497
@@ LUA_NUMBER is the type of numbers in Lua.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   498
** CHANGE the following definitions only if you want to build Lua
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   499
** with a number type different from double. You may also need to
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   500
** change lua_number2int & lua_number2integer.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   501
** ===================================================================
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   502
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   503
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   504
#define LUA_NUMBER_DOUBLE
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   505
#define LUA_NUMBER  double
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   506
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   507
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   508
@@ LUAI_UACNUMBER is the result of an 'usual argument conversion'
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   509
@* over a number.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   510
*/
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   511
#define LUAI_UACNUMBER  double
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   512
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   513
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   514
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   515
@@ LUA_NUMBER_SCAN is the format for reading numbers.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   516
@@ LUA_NUMBER_FMT is the format for writing numbers.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   517
@@ lua_number2str converts a number to a string.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   518
@@ LUAI_MAXNUMBER2STR is maximum size of previous conversion.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   519
@@ lua_str2number converts a string to a number.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   520
*/
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   521
#define LUA_NUMBER_SCAN     "%lf"
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   522
#define LUA_NUMBER_FMT      "%.14g"
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   523
#define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n))
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   524
#define LUAI_MAXNUMBER2STR  32 /* 16 digits, sign, point, and \0 */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   525
#define lua_str2number(s,p) strtod((s), (p))
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   526
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   527
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   528
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   529
@@ The luai_num* macros define the primitive operations over numbers.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   530
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   531
#if defined(LUA_CORE)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   532
#include <math.h>
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   533
#define luai_numadd(a,b)    ((a)+(b))
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   534
#define luai_numsub(a,b)    ((a)-(b))
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   535
#define luai_nummul(a,b)    ((a)*(b))
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   536
#define luai_numdiv(a,b)    ((a)/(b))
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   537
#define luai_nummod(a,b)    ((a) - floor((a)/(b))*(b))
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   538
#define luai_numpow(a,b)    (pow(a,b))
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   539
#define luai_numunm(a)      (-(a))
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   540
#define luai_numeq(a,b)     ((a)==(b))
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   541
#define luai_numlt(a,b)     ((a)<(b))
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   542
#define luai_numle(a,b)     ((a)<=(b))
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   543
#define luai_numisnan(a)    (!luai_numeq((a), (a)))
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   544
#endif
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   545
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   546
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   547
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   548
@@ lua_number2int is a macro to convert lua_Number to int.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   549
@@ lua_number2integer is a macro to convert lua_Number to lua_Integer.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   550
** CHANGE them if you know a faster way to convert a lua_Number to
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   551
** int (with any rounding method and without throwing errors) in your
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   552
** system. In Pentium machines, a naive typecast from double to int
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   553
** in C is extremely slow, so any alternative is worth trying.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   554
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   555
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   556
/* On a Pentium, resort to a trick */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   557
#if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) && !defined(__SSE2__) && \
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   558
    (defined(__i386) || defined (_M_IX86) || defined(__i386__))
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   559
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   560
/* On a Microsoft compiler, use assembler */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   561
#if defined(_MSC_VER)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   562
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   563
#define lua_number2int(i,d)   __asm fld d   __asm fistp i
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   564
#define lua_number2integer(i,n)     lua_number2int(i, n)
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   565
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   566
/* the next trick should work on any Pentium, but sometimes clashes
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   567
   with a DirectX idiosyncrasy */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   568
#else
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   569
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   570
union luai_Cast { double l_d; long l_l; };
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   571
#define lua_number2int(i,d) \
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   572
  { volatile union luai_Cast u; u.l_d = (d) + 6755399441055744.0; (i) = u.l_l; }
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   573
#define lua_number2integer(i,n)     lua_number2int(i, n)
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   574
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   575
#endif
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   576
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   577
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   578
/* this option always works, but may be slow */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   579
#else
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   580
#define lua_number2int(i,d) ((i)=(int)(d))
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   581
#define lua_number2integer(i,d) ((i)=(lua_Integer)(d))
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   582
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   583
#endif
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   584
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   585
/* }================================================================== */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   586
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   587
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   588
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   589
@@ LUAI_USER_ALIGNMENT_T is a type that requires maximum alignment.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   590
** CHANGE it if your system requires alignments larger than double. (For
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   591
** instance, if your system supports long doubles and they must be
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   592
** aligned in 16-byte boundaries, then you should add long double in the
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   593
** union.) Probably you do not need to change this.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   594
*/
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   595
#define LUAI_USER_ALIGNMENT_T   union { double u; void *s; long l; }
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   596
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   597
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   598
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   599
@@ LUAI_THROW/LUAI_TRY define how Lua does exception handling.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   600
** CHANGE them if you prefer to use longjmp/setjmp even with C++
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   601
** or if want/don't to use _longjmp/_setjmp instead of regular
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   602
** longjmp/setjmp. By default, Lua handles errors with exceptions when
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   603
** compiling as C++ code, with _longjmp/_setjmp when asked to use them,
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   604
** and with longjmp/setjmp otherwise.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   605
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   606
#if defined(__cplusplus)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   607
/* C++ exceptions */
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   608
#define LUAI_THROW(L,c) throw(c)
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   609
#define LUAI_TRY(L,c,a) try { a } catch(...) \
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   610
    { if ((c)->status == 0) (c)->status = -1; }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   611
#define luai_jmpbuf int  /* dummy variable */
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   612
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   613
#elif defined(LUA_USE_ULONGJMP)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   614
/* in Unix, try _longjmp/_setjmp (more efficient) */
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   615
#define LUAI_THROW(L,c) _longjmp((c)->b, 1)
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   616
#define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   617
#define luai_jmpbuf jmp_buf
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   618
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   619
#else
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   620
/* default handling with long jumps */
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   621
#define LUAI_THROW(L,c) longjmp((c)->b, 1)
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   622
#define LUAI_TRY(L,c,a) if (setjmp((c)->b) == 0) { a }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   623
#define luai_jmpbuf jmp_buf
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   624
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   625
#endif
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   626
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   627
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   628
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   629
@@ LUA_MAXCAPTURES is the maximum number of captures that a pattern
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   630
@* can do during pattern-matching.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   631
** CHANGE it if you need more captures. This limit is arbitrary.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   632
*/
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   633
#define LUA_MAXCAPTURES     32
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   634
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   635
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   636
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   637
@@ lua_tmpnam is the function that the OS library uses to create a
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   638
@* temporary name.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   639
@@ LUA_TMPNAMBUFSIZE is the maximum size of a name created by lua_tmpnam.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   640
** CHANGE them if you have an alternative to tmpnam (which is considered
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   641
** insecure) or if you want the original tmpnam anyway.  By default, Lua
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   642
** uses tmpnam except when POSIX is available, where it uses mkstemp.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   643
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   644
#if defined(loslib_c) || defined(luaall_c)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   645
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   646
#if defined(LUA_USE_MKSTEMP)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   647
#include <unistd.h>
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   648
#define LUA_TMPNAMBUFSIZE   32
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   649
#define lua_tmpnam(b,e) { \
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   650
    strcpy(b, "/tmp/lua_XXXXXX"); \
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   651
    e = mkstemp(b); \
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   652
    if (e != -1) close(e); \
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   653
    e = (e == -1); }
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   654
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   655
#else
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   656
#define LUA_TMPNAMBUFSIZE   L_tmpnam
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   657
#define lua_tmpnam(b,e)     { e = (tmpnam(b) == NULL); }
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   658
#endif
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   659
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   660
#endif
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   661
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   662
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   663
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   664
@@ lua_popen spawns a new process connected to the current one through
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   665
@* the file streams.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   666
** CHANGE it if you have a way to implement it in your system.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   667
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   668
#if defined(LUA_USE_POPEN)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   669
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   670
#define lua_popen(L,c,m)    ((void)L, fflush(NULL), popen(c,m))
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   671
#define lua_pclose(L,file)  ((void)L, (pclose(file) != -1))
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   672
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   673
#elif defined(LUA_WIN)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   674
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   675
#define lua_popen(L,c,m)    ((void)L, _popen(c,m))
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   676
#define lua_pclose(L,file)  ((void)L, (_pclose(file) != -1))
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   677
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   678
#else
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   679
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   680
#define lua_popen(L,c,m)    ((void)((void)c, m),  \
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   681
        luaL_error(L, LUA_QL("popen") " not supported"), (FILE*)0)
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   682
#define lua_pclose(L,file)      ((void)((void)L, file), 0)
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   683
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   684
#endif
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   685
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   686
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   687
@@ LUA_DL_* define which dynamic-library system Lua should use.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   688
** CHANGE here if Lua has problems choosing the appropriate
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   689
** dynamic-library system for your platform (either Windows' DLL, Mac's
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   690
** dyld, or Unix's dlopen). If your system is some kind of Unix, there
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   691
** is a good chance that it has dlopen, so LUA_DL_DLOPEN will work for
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   692
** it.  To use dlopen you also need to adapt the src/Makefile (probably
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   693
** adding -ldl to the linker options), so Lua does not select it
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   694
** automatically.  (When you change the makefile to add -ldl, you must
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   695
** also add -DLUA_USE_DLOPEN.)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   696
** If you do not want any kind of dynamic library, undefine all these
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   697
** options.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   698
** By default, _WIN32 gets LUA_DL_DLL and MAC OS X gets LUA_DL_DYLD.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   699
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   700
#if defined(LUA_USE_DLOPEN)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   701
#define LUA_DL_DLOPEN
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   702
#endif
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   703
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   704
#if defined(LUA_WIN)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   705
#define LUA_DL_DLL
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   706
#endif
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   707
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   708
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   709
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   710
@@ LUAI_EXTRASPACE allows you to add user-specific data in a lua_State
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   711
@* (the data goes just *before* the lua_State pointer).
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   712
** CHANGE (define) this if you really need that. This value must be
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   713
** a multiple of the maximum alignment required for your machine.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   714
*/
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   715
#define LUAI_EXTRASPACE     0
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   716
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   717
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   718
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   719
@@ luai_userstate* allow user-specific actions on threads.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   720
** CHANGE them if you defined LUAI_EXTRASPACE and need to do something
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   721
** extra when a thread is created/deleted/resumed/yielded.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   722
*/
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   723
#define luai_userstateopen(L)       ((void)L)
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   724
#define luai_userstateclose(L)      ((void)L)
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   725
#define luai_userstatethread(L,L1)  ((void)L)
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   726
#define luai_userstatefree(L)       ((void)L)
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   727
#define luai_userstateresume(L,n)   ((void)L)
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   728
#define luai_userstateyield(L,n)    ((void)L)
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   729
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   730
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   731
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   732
@@ LUA_INTFRMLEN is the length modifier for integer conversions
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   733
@* in 'string.format'.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   734
@@ LUA_INTFRM_T is the integer type correspoding to the previous length
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   735
@* modifier.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   736
** CHANGE them if your system supports long long or does not support long.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   737
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   738
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   739
#if defined(LUA_USELONGLONG)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   740
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   741
#define LUA_INTFRMLEN       "ll"
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   742
#define LUA_INTFRM_T        long long
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   743
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   744
#else
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   745
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   746
#define LUA_INTFRMLEN       "l"
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
   747
#define LUA_INTFRM_T        long
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   748
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   749
#endif
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   750
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   751
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   752
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   753
/* =================================================================== */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   754
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   755
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   756
** Local configuration. You can use this space to add your redefinitions
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   757
** without modifying the main part of the file.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   758
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   759
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   760
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   761
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   762
#endif
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   763