diff src/lua/src/llimits.h @ 1:f9f4f1b99eed

importing src directory
author Robert McIntyre <rlm@mit.edu>
date Sat, 03 Mar 2012 10:31:27 -0600
parents
children
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/lua/src/llimits.h	Sat Mar 03 10:31:27 2012 -0600
     1.3 @@ -0,0 +1,128 @@
     1.4 +/*
     1.5 +** $Id: llimits.h,v 1.69.1.1 2007/12/27 13:02:25 roberto Exp $
     1.6 +** Limits, basic types, and some other `installation-dependent' definitions
     1.7 +** See Copyright Notice in lua.h
     1.8 +*/
     1.9 +
    1.10 +#ifndef llimits_h
    1.11 +#define llimits_h
    1.12 +
    1.13 +
    1.14 +#include <limits.h>
    1.15 +#include <stddef.h>
    1.16 +
    1.17 +
    1.18 +#include "lua.h"
    1.19 +
    1.20 +
    1.21 +typedef LUAI_UINT32 lu_int32;
    1.22 +
    1.23 +typedef LUAI_UMEM lu_mem;
    1.24 +
    1.25 +typedef LUAI_MEM l_mem;
    1.26 +
    1.27 +
    1.28 +
    1.29 +/* chars used as small naturals (so that `char' is reserved for characters) */
    1.30 +typedef unsigned char lu_byte;
    1.31 +
    1.32 +
    1.33 +#define MAX_SIZET	((size_t)(~(size_t)0)-2)
    1.34 +
    1.35 +#define MAX_LUMEM	((lu_mem)(~(lu_mem)0)-2)
    1.36 +
    1.37 +
    1.38 +#define MAX_INT (INT_MAX-2)  /* maximum value of an int (-2 for safety) */
    1.39 +
    1.40 +/*
    1.41 +** conversion of pointer to integer
    1.42 +** this is for hashing only; there is no problem if the integer
    1.43 +** cannot hold the whole pointer value
    1.44 +*/
    1.45 +#define IntPoint(p)  ((unsigned int)(lu_mem)(p))
    1.46 +
    1.47 +
    1.48 +
    1.49 +/* type to ensure maximum alignment */
    1.50 +typedef LUAI_USER_ALIGNMENT_T L_Umaxalign;
    1.51 +
    1.52 +
    1.53 +/* result of a `usual argument conversion' over lua_Number */
    1.54 +typedef LUAI_UACNUMBER l_uacNumber;
    1.55 +
    1.56 +
    1.57 +/* internal assertions for in-house debugging */
    1.58 +#ifdef lua_assert
    1.59 +
    1.60 +#define check_exp(c,e)		(lua_assert(c), (e))
    1.61 +#define api_check(l,e)		lua_assert(e)
    1.62 +
    1.63 +#else
    1.64 +
    1.65 +#define lua_assert(c)		((void)0)
    1.66 +#define check_exp(c,e)		(e)
    1.67 +#define api_check		luai_apicheck
    1.68 +
    1.69 +#endif
    1.70 +
    1.71 +
    1.72 +#ifndef UNUSED
    1.73 +#define UNUSED(x)	((void)(x))	/* to avoid warnings */
    1.74 +#endif
    1.75 +
    1.76 +
    1.77 +#ifndef cast
    1.78 +#define cast(t, exp)	((t)(exp))
    1.79 +#endif
    1.80 +
    1.81 +#define cast_byte(i)	cast(lu_byte, (i))
    1.82 +#define cast_num(i)	cast(lua_Number, (i))
    1.83 +#define cast_int(i)	cast(int, (i))
    1.84 +
    1.85 +
    1.86 +
    1.87 +/*
    1.88 +** type for virtual-machine instructions
    1.89 +** must be an unsigned with (at least) 4 bytes (see details in lopcodes.h)
    1.90 +*/
    1.91 +typedef lu_int32 Instruction;
    1.92 +
    1.93 +
    1.94 +
    1.95 +/* maximum stack for a Lua function */
    1.96 +#define MAXSTACK	250
    1.97 +
    1.98 +
    1.99 +
   1.100 +/* minimum size for the string table (must be power of 2) */
   1.101 +#ifndef MINSTRTABSIZE
   1.102 +#define MINSTRTABSIZE	32
   1.103 +#endif
   1.104 +
   1.105 +
   1.106 +/* minimum size for string buffer */
   1.107 +#ifndef LUA_MINBUFFER
   1.108 +#define LUA_MINBUFFER	32
   1.109 +#endif
   1.110 +
   1.111 +
   1.112 +#ifndef lua_lock
   1.113 +#define lua_lock(L)     ((void) 0) 
   1.114 +#define lua_unlock(L)   ((void) 0)
   1.115 +#endif
   1.116 +
   1.117 +#ifndef luai_threadyield
   1.118 +#define luai_threadyield(L)     {lua_unlock(L); lua_lock(L);}
   1.119 +#endif
   1.120 +
   1.121 +
   1.122 +/*
   1.123 +** macro to control inclusion of some hard tests on stack reallocation
   1.124 +*/ 
   1.125 +#ifndef HARDSTACKTESTS
   1.126 +#define condhardstacktests(x)	((void)0)
   1.127 +#else
   1.128 +#define condhardstacktests(x)	x
   1.129 +#endif
   1.130 +
   1.131 +#endif