misc/liblua/llimits.h
author unc0rr
Mon, 04 Jun 2012 22:43:56 +0400
changeset 7178 c61cfc9eb29d
parent 3697 d5b30d6373fc
child 10017 de822cd3df3a
permissions -rw-r--r--
Don't make unnecessary calls to TestWhip, TestFirePunch, TestBaseballBat and TestHammer functions as they have no need to take Targ parameter into account and thus may only be called once per position
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     1
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     2
** $Id: llimits.h,v 1.69.1.1 2007/12/27 13:02:25 roberto Exp $
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     3
** Limits, basic types, and some other `installation-dependent' definitions
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     4
** See Copyright Notice in lua.h
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     5
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     6
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     7
#ifndef llimits_h
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     8
#define llimits_h
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     9
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    10
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    11
#include <limits.h>
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    12
#include <stddef.h>
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    13
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    14
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    15
#include "lua.h"
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    16
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    17
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    18
typedef LUAI_UINT32 lu_int32;
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    19
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    20
typedef LUAI_UMEM lu_mem;
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    21
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    22
typedef LUAI_MEM l_mem;
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    23
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    24
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    25
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    26
/* chars used as small naturals (so that `char' is reserved for characters) */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    27
typedef unsigned char lu_byte;
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    28
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    29
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    30
#define MAX_SIZET	((size_t)(~(size_t)0)-2)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    31
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    32
#define MAX_LUMEM	((lu_mem)(~(lu_mem)0)-2)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    33
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    34
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    35
#define MAX_INT (INT_MAX-2)  /* maximum value of an int (-2 for safety) */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    36
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    37
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    38
** conversion of pointer to integer
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    39
** this is for hashing only; there is no problem if the integer
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    40
** cannot hold the whole pointer value
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    41
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    42
#define IntPoint(p)  ((unsigned int)(lu_mem)(p))
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    43
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    44
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    45
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    46
/* type to ensure maximum alignment */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    47
typedef LUAI_USER_ALIGNMENT_T L_Umaxalign;
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    48
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    49
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    50
/* result of a `usual argument conversion' over lua_Number */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    51
typedef LUAI_UACNUMBER l_uacNumber;
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    52
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    53
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    54
/* internal assertions for in-house debugging */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    55
#ifdef lua_assert
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    56
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    57
#define check_exp(c,e)		(lua_assert(c), (e))
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    58
#define api_check(l,e)		lua_assert(e)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    59
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    60
#else
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    61
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    62
#define lua_assert(c)		((void)0)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    63
#define check_exp(c,e)		(e)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    64
#define api_check		luai_apicheck
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    65
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    66
#endif
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    67
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    68
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    69
#ifndef UNUSED
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    70
#define UNUSED(x)	((void)(x))	/* to avoid warnings */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    71
#endif
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    72
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    73
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    74
#ifndef cast
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    75
#define cast(t, exp)	((t)(exp))
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    76
#endif
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    77
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    78
#define cast_byte(i)	cast(lu_byte, (i))
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    79
#define cast_num(i)	cast(lua_Number, (i))
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    80
#define cast_int(i)	cast(int, (i))
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    81
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    82
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    83
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    84
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    85
** type for virtual-machine instructions
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    86
** must be an unsigned with (at least) 4 bytes (see details in lopcodes.h)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    87
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    88
typedef lu_int32 Instruction;
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    89
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    90
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    91
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    92
/* maximum stack for a Lua function */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    93
#define MAXSTACK	250
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    94
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    95
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    96
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    97
/* minimum size for the string table (must be power of 2) */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    98
#ifndef MINSTRTABSIZE
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    99
#define MINSTRTABSIZE	32
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   100
#endif
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   101
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   102
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   103
/* minimum size for string buffer */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   104
#ifndef LUA_MINBUFFER
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   105
#define LUA_MINBUFFER	32
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   106
#endif
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   107
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   108
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   109
#ifndef lua_lock
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 2812
diff changeset
   110
#define lua_lock(L)     ((void) 0)
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   111
#define lua_unlock(L)   ((void) 0)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   112
#endif
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   113
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   114
#ifndef luai_threadyield
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   115
#define luai_threadyield(L)     {lua_unlock(L); lua_lock(L);}
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   116
#endif
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   117
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   118
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   119
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   120
** macro to control inclusion of some hard tests on stack reallocation
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 2812
diff changeset
   121
*/
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   122
#ifndef HARDSTACKTESTS
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   123
#define condhardstacktests(x)	((void)0)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   124
#else
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   125
#define condhardstacktests(x)	x
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   126
#endif
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   127
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   128
#endif