/*1** $Id: llimits.h,v 1.69.1.1 2007/12/27 13:02:25 roberto Exp $2** Limits, basic types, and some other `installation-dependent' definitions3** See Copyright Notice in lua.h4*/56#ifndef llimits_h7#define llimits_h8910#include <limits.h>11#include <stddef.h>121314#include "lua.h"151617typedef LUAI_UINT32 lu_int32;1819typedef LUAI_UMEM lu_mem;2021typedef LUAI_MEM l_mem;22232425/* chars used as small naturals (so that `char' is reserved for characters) */26typedef unsigned char lu_byte;272829#define MAX_SIZET ((size_t)(~(size_t)0)-2)3031#define MAX_LUMEM ((lu_mem)(~(lu_mem)0)-2)323334#define MAX_INT (INT_MAX-2) /* maximum value of an int (-2 for safety) */3536/*37** conversion of pointer to integer38** this is for hashing only; there is no problem if the integer39** cannot hold the whole pointer value40*/41#define IntPoint(p) ((unsigned int)(lu_mem)(p))42434445/* type to ensure maximum alignment */46typedef LUAI_USER_ALIGNMENT_T L_Umaxalign;474849/* result of a `usual argument conversion' over lua_Number */50typedef LUAI_UACNUMBER l_uacNumber;515253/* internal assertions for in-house debugging */54#ifdef lua_assert5556#define check_exp(c,e) (lua_assert(c), (e))57#define api_check(l,e) lua_assert(e)5859#else6061#define lua_assert(c) ((void)0)62#define check_exp(c,e) (e)63#define api_check luai_apicheck6465#endif666768#ifndef UNUSED69#define UNUSED(x) ((void)(x)) /* to avoid warnings */70#endif717273#ifndef cast74#define cast(t, exp) ((t)(exp))75#endif7677#define cast_byte(i) cast(lu_byte, (i))78#define cast_num(i) cast(lua_Number, (i))79#define cast_int(i) cast(int, (i))80818283/*84** type for virtual-machine instructions85** must be an unsigned with (at least) 4 bytes (see details in lopcodes.h)86*/87typedef lu_int32 Instruction;88899091/* maximum stack for a Lua function */92#define MAXSTACK 25093949596/* minimum size for the string table (must be power of 2) */97#ifndef MINSTRTABSIZE98#define MINSTRTABSIZE 3299#endif100101102/* minimum size for string buffer */103#ifndef LUA_MINBUFFER104#define LUA_MINBUFFER 32105#endif106107108#ifndef lua_lock109#define lua_lock(L) ((void) 0)110#define lua_unlock(L) ((void) 0)111#endif112113#ifndef luai_threadyield114#define luai_threadyield(L) {lua_unlock(L); lua_lock(L);}115#endif116117118/*119** macro to control inclusion of some hard tests on stack reallocation120*/121#ifndef HARDSTACKTESTS122#define condhardstacktests(x) ((void)0)123#else124#define condhardstacktests(x) x125#endif126127#endif128129130