25 |
25 |
26 /* chars used as small naturals (so that `char' is reserved for characters) */ |
26 /* chars used as small naturals (so that `char' is reserved for characters) */ |
27 typedef unsigned char lu_byte; |
27 typedef unsigned char lu_byte; |
28 |
28 |
29 |
29 |
30 #define MAX_SIZET ((size_t)(~(size_t)0)-2) |
30 #define MAX_SIZET ((size_t)(~(size_t)0)-2) |
31 |
31 |
32 #define MAX_LUMEM ((lu_mem)(~(lu_mem)0)-2) |
32 #define MAX_LUMEM ((lu_mem)(~(lu_mem)0)-2) |
33 |
33 |
34 |
34 |
35 #define MAX_INT (INT_MAX-2) /* maximum value of an int (-2 for safety) */ |
35 #define MAX_INT (INT_MAX-2) /* maximum value of an int (-2 for safety) */ |
36 |
36 |
37 /* |
37 /* |
52 |
52 |
53 |
53 |
54 /* internal assertions for in-house debugging */ |
54 /* internal assertions for in-house debugging */ |
55 #ifdef lua_assert |
55 #ifdef lua_assert |
56 |
56 |
57 #define check_exp(c,e) (lua_assert(c), (e)) |
57 #define check_exp(c,e) (lua_assert(c), (e)) |
58 #define api_check(l,e) lua_assert(e) |
58 #define api_check(l,e) lua_assert(e) |
59 |
59 |
60 #else |
60 #else |
61 |
61 |
62 #define lua_assert(c) ((void)0) |
62 #define lua_assert(c) ((void)0) |
63 #define check_exp(c,e) (e) |
63 #define check_exp(c,e) (e) |
64 #define api_check luai_apicheck |
64 #define api_check luai_apicheck |
65 |
65 |
66 #endif |
66 #endif |
67 |
67 |
68 |
68 |
69 #ifndef UNUSED |
69 #ifndef UNUSED |
70 #define UNUSED(x) ((void)(x)) /* to avoid warnings */ |
70 #define UNUSED(x) ((void)(x)) /* to avoid warnings */ |
71 #endif |
71 #endif |
72 |
72 |
73 |
73 |
74 #ifndef cast |
74 #ifndef cast |
75 #define cast(t, exp) ((t)(exp)) |
75 #define cast(t, exp) ((t)(exp)) |
76 #endif |
76 #endif |
77 |
77 |
78 #define cast_byte(i) cast(lu_byte, (i)) |
78 #define cast_byte(i) cast(lu_byte, (i)) |
79 #define cast_num(i) cast(lua_Number, (i)) |
79 #define cast_num(i) cast(lua_Number, (i)) |
80 #define cast_int(i) cast(int, (i)) |
80 #define cast_int(i) cast(int, (i)) |
81 |
81 |
82 |
82 |
83 |
83 |
84 /* |
84 /* |
85 ** type for virtual-machine instructions |
85 ** type for virtual-machine instructions |
88 typedef lu_int32 Instruction; |
88 typedef lu_int32 Instruction; |
89 |
89 |
90 |
90 |
91 |
91 |
92 /* maximum stack for a Lua function */ |
92 /* maximum stack for a Lua function */ |
93 #define MAXSTACK 250 |
93 #define MAXSTACK 250 |
94 |
94 |
95 |
95 |
96 |
96 |
97 /* minimum size for the string table (must be power of 2) */ |
97 /* minimum size for the string table (must be power of 2) */ |
98 #ifndef MINSTRTABSIZE |
98 #ifndef MINSTRTABSIZE |
99 #define MINSTRTABSIZE 32 |
99 #define MINSTRTABSIZE 32 |
100 #endif |
100 #endif |
101 |
101 |
102 |
102 |
103 /* minimum size for string buffer */ |
103 /* minimum size for string buffer */ |
104 #ifndef LUA_MINBUFFER |
104 #ifndef LUA_MINBUFFER |
105 #define LUA_MINBUFFER 32 |
105 #define LUA_MINBUFFER 32 |
106 #endif |
106 #endif |
107 |
107 |
108 |
108 |
109 #ifndef lua_lock |
109 #ifndef lua_lock |
110 #define lua_lock(L) ((void) 0) |
110 #define lua_lock(L) ((void) 0) |