Nut/OS  4.10.3
API Reference
llimits.h
Go to the documentation of this file.
00001 /*
00002 ** $Id: llimits.h 2345 2008-10-10 11:52:25Z haraldkipp $
00003 ** Limits, basic types, and some other `installation-dependent' definitions
00004 ** See Copyright Notice in lua.h
00005 */
00006 
00007 #ifndef llimits_h
00008 #define llimits_h
00009 
00010 
00011 #include <limits.h>
00012 #include <stddef.h>
00013 
00014 
00015 #include <lua/lua.h>
00016 
00017 
00018 typedef LUAI_UINT32 lu_int32;
00019 
00020 typedef LUAI_UMEM lu_mem;
00021 
00022 typedef LUAI_MEM l_mem;
00023 
00024 
00025 
00026 /* chars used as small naturals (so that `char' is reserved for characters) */
00027 typedef unsigned char lu_byte;
00028 
00029 
00030 #define MAX_SIZET       ((size_t)(~(size_t)0)-2)
00031 
00032 #define MAX_LUMEM       ((lu_mem)(~(lu_mem)0)-2)
00033 
00034 
00035 #define MAX_INT (INT_MAX-2)  /* maximum value of an int (-2 for safety) */
00036 
00037 /*
00038 ** conversion of pointer to integer
00039 ** this is for hashing only; there is no problem if the integer
00040 ** cannot hold the whole pointer value
00041 */
00042 #define IntPoint(p)  ((unsigned int)(lu_mem)(p))
00043 
00044 
00045 
00046 /* type to ensure maximum alignment */
00047 typedef LUAI_USER_ALIGNMENT_T L_Umaxalign;
00048 
00049 
00050 /* result of a `usual argument conversion' over lua_Number */
00051 typedef LUAI_UACNUMBER l_uacNumber;
00052 
00053 
00054 /* internal assertions for in-house debugging */
00055 #ifdef lua_assert
00056 
00057 #define check_exp(c,e)          (lua_assert(c), (e))
00058 #define api_check(l,e)          lua_assert(e)
00059 
00060 #else
00061 
00062 #define lua_assert(c)           ((void)0)
00063 #define check_exp(c,e)          (e)
00064 #define api_check               luai_apicheck
00065 
00066 #endif
00067 
00068 
00069 #ifndef UNUSED
00070 #define UNUSED(x)       ((void)(x))     /* to avoid warnings */
00071 #endif
00072 
00073 
00074 #ifndef cast
00075 #define cast(t, exp)    ((t)(exp))
00076 #endif
00077 
00078 #define cast_byte(i)    cast(lu_byte, (i))
00079 #define cast_num(i)     cast(lua_Number, (i))
00080 #define cast_int(i)     cast(int, (i))
00081 
00082 
00083 
00084 /*
00085 ** type for virtual-machine instructions
00086 ** must be an unsigned with (at least) 4 bytes (see details in lopcodes.h)
00087 */
00088 typedef lu_int32 Instruction;
00089 
00090 
00091 
00092 /* maximum stack for a Lua function */
00093 #define MAXSTACK        250
00094 
00095 
00096 
00097 /* minimum size for the string table (must be power of 2) */
00098 #ifndef MINSTRTABSIZE
00099 #define MINSTRTABSIZE   32
00100 #endif
00101 
00102 
00103 /* minimum size for string buffer */
00104 #ifndef LUA_MINBUFFER
00105 #define LUA_MINBUFFER   32
00106 #endif
00107 
00108 
00109 #ifndef lua_lock
00110 #define lua_lock(L)     ((void) 0) 
00111 #define lua_unlock(L)   ((void) 0)
00112 #endif
00113 
00114 #ifndef luai_threadyield
00115 #define luai_threadyield(L)     {lua_unlock(L); lua_lock(L);}
00116 #endif
00117 
00118 
00119 /*
00120 ** macro to control inclusion of some hard tests on stack reallocation
00121 */ 
00122 #ifndef HARDSTACKTESTS
00123 #define condhardstacktests(x)   ((void)0)
00124 #else
00125 #define condhardstacktests(x)   x
00126 #endif
00127 
00128 #endif