1 /* $NetBSD: llimits.h,v 1.1.1.2 2012/03/15 00:08:12 alnsn Exp $ */
4 ** $Id: llimits.h,v 1.1.1.2 2012/03/15 00:08:12 alnsn Exp $
5 ** Limits, basic types, and some other `installation-dependent' definitions
6 ** See Copyright Notice in lua.h
20 typedef LUAI_UINT32 lu_int32
;
22 typedef LUAI_UMEM lu_mem
;
24 typedef LUAI_MEM l_mem
;
28 /* chars used as small naturals (so that `char' is reserved for characters) */
29 typedef unsigned char lu_byte
;
32 #define MAX_SIZET ((size_t)(~(size_t)0)-2)
34 #define MAX_LUMEM ((lu_mem)(~(lu_mem)0)-2)
37 #define MAX_INT (INT_MAX-2) /* maximum value of an int (-2 for safety) */
40 ** conversion of pointer to integer
41 ** this is for hashing only; there is no problem if the integer
42 ** cannot hold the whole pointer value
44 #define IntPoint(p) ((unsigned int)(lu_mem)(p))
48 /* type to ensure maximum alignment */
49 typedef LUAI_USER_ALIGNMENT_T L_Umaxalign
;
52 /* result of a `usual argument conversion' over lua_Number */
53 typedef LUAI_UACNUMBER l_uacNumber
;
56 /* internal assertions for in-house debugging */
59 #define check_exp(c,e) (lua_assert(c), (e))
60 #define api_check(l,e) lua_assert(e)
64 #define lua_assert(c) ((void)0)
65 #define check_exp(c,e) (e)
66 #define api_check luai_apicheck
72 #define UNUSED(x) ((void)(x)) /* to avoid warnings */
77 #define cast(t, exp) ((t)(exp))
80 #define cast_byte(i) cast(lu_byte, (i))
81 #define cast_num(i) cast(lua_Number, (i))
82 #define cast_int(i) cast(int, (i))
87 ** type for virtual-machine instructions
88 ** must be an unsigned with (at least) 4 bytes (see details in lopcodes.h)
90 typedef lu_int32 Instruction
;
94 /* maximum stack for a Lua function */
99 /* minimum size for the string table (must be power of 2) */
100 #ifndef MINSTRTABSIZE
101 #define MINSTRTABSIZE 32
105 /* minimum size for string buffer */
106 #ifndef LUA_MINBUFFER
107 #define LUA_MINBUFFER 32
112 #define lua_lock(L) ((void) 0)
113 #define lua_unlock(L) ((void) 0)
116 #ifndef luai_threadyield
117 #define luai_threadyield(L) {lua_unlock(L); lua_lock(L);}
122 ** macro to control inclusion of some hard tests on stack reallocation
124 #ifndef HARDSTACKTESTS
125 #define condhardstacktests(x) ((void)0)
127 #define condhardstacktests(x) x