annotate src/lua/llimits.h @ 349:37616a97beaa

fixed a few blocks that were not tangling properly.
author Dylan Holmes <ocsenave@gmail.com>
date Sun, 08 Apr 2012 07:57:52 -0500
parents 27763b933818
children
rev   line source
rlm@1 1 /*
rlm@1 2 ** $Id: llimits.h,v 1.69.1.1 2007/12/27 13:02:25 roberto Exp $
rlm@1 3 ** Limits, basic types, and some other `installation-dependent' definitions
rlm@1 4 ** See Copyright Notice in lua.h
rlm@1 5 */
rlm@1 6
rlm@1 7 #ifndef llimits_h
rlm@1 8 #define llimits_h
rlm@1 9
rlm@1 10
rlm@1 11 #include <limits.h>
rlm@1 12 #include <stddef.h>
rlm@1 13
rlm@1 14
rlm@1 15 #include "lua.h"
rlm@1 16
rlm@1 17
rlm@1 18 typedef LUAI_UINT32 lu_int32;
rlm@1 19
rlm@1 20 typedef LUAI_UMEM lu_mem;
rlm@1 21
rlm@1 22 typedef LUAI_MEM l_mem;
rlm@1 23
rlm@1 24
rlm@1 25
rlm@1 26 /* chars used as small naturals (so that `char' is reserved for characters) */
rlm@1 27 typedef unsigned char lu_byte;
rlm@1 28
rlm@1 29
rlm@1 30 #define MAX_SIZET ((size_t)(~(size_t)0)-2)
rlm@1 31
rlm@1 32 #define MAX_LUMEM ((lu_mem)(~(lu_mem)0)-2)
rlm@1 33
rlm@1 34
rlm@1 35 #define MAX_INT (INT_MAX-2) /* maximum value of an int (-2 for safety) */
rlm@1 36
rlm@1 37 /*
rlm@1 38 ** conversion of pointer to integer
rlm@1 39 ** this is for hashing only; there is no problem if the integer
rlm@1 40 ** cannot hold the whole pointer value
rlm@1 41 */
rlm@1 42 #define IntPoint(p) ((unsigned int)(lu_mem)(p))
rlm@1 43
rlm@1 44
rlm@1 45
rlm@1 46 /* type to ensure maximum alignment */
rlm@1 47 typedef LUAI_USER_ALIGNMENT_T L_Umaxalign;
rlm@1 48
rlm@1 49
rlm@1 50 /* result of a `usual argument conversion' over lua_Number */
rlm@1 51 typedef LUAI_UACNUMBER l_uacNumber;
rlm@1 52
rlm@1 53
rlm@1 54 /* internal assertions for in-house debugging */
rlm@1 55 #ifdef lua_assert
rlm@1 56
rlm@1 57 #define check_exp(c,e) (lua_assert(c), (e))
rlm@1 58 #define api_check(l,e) lua_assert(e)
rlm@1 59
rlm@1 60 #else
rlm@1 61
rlm@1 62 #define lua_assert(c) ((void)0)
rlm@1 63 #define check_exp(c,e) (e)
rlm@1 64 #define api_check luai_apicheck
rlm@1 65
rlm@1 66 #endif
rlm@1 67
rlm@1 68
rlm@1 69 #ifndef UNUSED
rlm@1 70 #define UNUSED(x) ((void)(x)) /* to avoid warnings */
rlm@1 71 #endif
rlm@1 72
rlm@1 73
rlm@1 74 #ifndef cast
rlm@1 75 #define cast(t, exp) ((t)(exp))
rlm@1 76 #endif
rlm@1 77
rlm@1 78 #define cast_byte(i) cast(lu_byte, (i))
rlm@1 79 #define cast_num(i) cast(lua_Number, (i))
rlm@1 80 #define cast_int(i) cast(int, (i))
rlm@1 81
rlm@1 82
rlm@1 83
rlm@1 84 /*
rlm@1 85 ** type for virtual-machine instructions
rlm@1 86 ** must be an unsigned with (at least) 4 bytes (see details in lopcodes.h)
rlm@1 87 */
rlm@1 88 typedef lu_int32 Instruction;
rlm@1 89
rlm@1 90
rlm@1 91
rlm@1 92 /* maximum stack for a Lua function */
rlm@1 93 #define MAXSTACK 250
rlm@1 94
rlm@1 95
rlm@1 96
rlm@1 97 /* minimum size for the string table (must be power of 2) */
rlm@1 98 #ifndef MINSTRTABSIZE
rlm@1 99 #define MINSTRTABSIZE 32
rlm@1 100 #endif
rlm@1 101
rlm@1 102
rlm@1 103 /* minimum size for string buffer */
rlm@1 104 #ifndef LUA_MINBUFFER
rlm@1 105 #define LUA_MINBUFFER 32
rlm@1 106 #endif
rlm@1 107
rlm@1 108
rlm@1 109 #ifndef lua_lock
rlm@1 110 #define lua_lock(L) ((void) 0)
rlm@1 111 #define lua_unlock(L) ((void) 0)
rlm@1 112 #endif
rlm@1 113
rlm@1 114 #ifndef luai_threadyield
rlm@1 115 #define luai_threadyield(L) {lua_unlock(L); lua_lock(L);}
rlm@1 116 #endif
rlm@1 117
rlm@1 118
rlm@1 119 /*
rlm@1 120 ** macro to control inclusion of some hard tests on stack reallocation
rlm@1 121 */
rlm@1 122 #ifndef HARDSTACKTESTS
rlm@1 123 #define condhardstacktests(x) ((void)0)
rlm@1 124 #else
rlm@1 125 #define condhardstacktests(x) x
rlm@1 126 #endif
rlm@1 127
rlm@1 128 #endif