2 ** $Id: llimits.h,v 1.69 2005/12/27 17:12:00 roberto Exp $
3 ** Limits, basic types, and some other `installation-dependent' definitions
4 ** See Copyright Notice in lua.h
18 typedef LUAI_UINT32 lu_int32
;
20 typedef LUAI_UMEM lu_mem
;
22 typedef LUAI_MEM l_mem
;
24 /* Only for internal functions; for public ABI, use 'int' */
25 typedef LUAI_BOOL lu_bool
;
29 /* chars used as small naturals (so that `char' is reserved for characters) */
30 typedef unsigned char lu_byte
;
33 #define MAX_SIZET ((size_t)(~(size_t)0)-2)
35 #define MAX_LUMEM ((lu_mem)(~(lu_mem)0)-2)
38 #define MAX_INT (INT_MAX-2) /* maximum value of an int (-2 for safety) */
41 ** conversion of pointer to integer
42 ** this is for hashing only; there is no problem if the integer
43 ** cannot hold the whole pointer value
45 #define IntPoint(p) ((unsigned int)(lu_mem)(p))
49 /* type to ensure maximum alignment */
50 typedef LUAI_USER_ALIGNMENT_T L_Umaxalign
;
53 /* result of a `usual argument conversion' over lua_Number */
54 typedef LUAI_UACNUMBER l_uacNumber
;
55 typedef LUAI_UACINTEGER l_uacInteger
;
58 /* internal assertions for in-house debugging */
61 #define check_exp(c,e) (lua_assert(c), (e))
62 #define api_check(l,e) lua_assert(e)
66 #define lua_assert(c) ((void)0)
67 #define check_exp(c,e) (e)
68 #define api_check luai_apicheck
74 #define UNUSED(x) ((void)(x)) /* to avoid warnings */
79 #define cast(t, exp) ((t)(exp))
82 #define cast_byte(i) cast(lu_byte, (i))
83 #define cast_num(i) cast(lua_Number, (i))
84 #define cast_int(i) cast(int, (i))
87 #define cast_complex(i) cast(lua_Complex, (i))
92 ** type for virtual-machine instructions
93 ** must be an unsigned with (at least) 4 bytes (see details in lopcodes.h)
95 typedef lu_int32 Instruction
;
99 /* maximum stack for a Lua function */
104 /* minimum size for the string table (must be power of 2) */
105 #ifndef MINSTRTABSIZE
106 #define MINSTRTABSIZE 32
110 /* minimum size for string buffer */
111 #ifndef LUA_MINBUFFER
112 #define LUA_MINBUFFER 32
117 #define lua_lock(L) ((void) 0)
118 #define lua_unlock(L) ((void) 0)
121 #ifndef luai_threadyield
122 #define luai_threadyield(L) {lua_unlock(L); lua_lock(L);}
127 ** macro to control inclusion of some hard tests on stack reallocation
129 #ifndef HARDSTACKTESTS
130 #define condhardstacktests(x) ((void)0)
132 #define condhardstacktests(x) x