llimits.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. ** $Id: llimits.h,v 1.61 2004/11/24 18:55:56 roberto Exp roberto $
  3. ** Limits, basic types, and some other `installation-dependent' definitions
  4. ** See Copyright Notice in lua.h
  5. */
  6. #ifndef llimits_h
  7. #define llimits_h
  8. #include <limits.h>
  9. #include <stddef.h>
  10. #include "lua.h"
  11. typedef LUA_UINT32 lu_int32;
  12. typedef LU_MEM lu_mem;
  13. typedef L_MEM l_mem;
  14. /* chars used as small naturals (so that `char' is reserved for characters) */
  15. typedef unsigned char lu_byte;
  16. #define MAX_SIZET ((size_t)(~(size_t)0)-2)
  17. #define MAX_LUMEM ((lu_mem)(~(lu_mem)0)-2)
  18. #define MAX_INT (INT_MAX-2) /* maximum value of an int (-2 for safety) */
  19. /*
  20. ** conversion of pointer to integer
  21. ** this is for hashing only; there is no problem if the integer
  22. ** cannot hold the whole pointer value
  23. */
  24. #define IntPoint(p) ((unsigned int)(lu_mem)(p))
  25. /* type to ensure maximum alignment */
  26. typedef LUSER_ALIGNMENT_T L_Umaxalign;
  27. /* result of a `usual argument conversion' over lua_Number */
  28. typedef LUA_UACNUMBER l_uacNumber;
  29. #define check_exp(c,e) (lua_assert(c), (e))
  30. #ifndef UNUSED
  31. #define UNUSED(x) ((void)(x)) /* to avoid warnings */
  32. #endif
  33. #ifndef cast
  34. #define cast(t, exp) ((t)(exp))
  35. #endif
  36. /*
  37. ** type for virtual-machine instructions
  38. ** must be an unsigned with (at least) 4 bytes (see details in lopcodes.h)
  39. */
  40. typedef lu_int32 Instruction;
  41. /* divisor for GC pace */
  42. #define GCDIV 8
  43. /* maximum stack for a Lua function */
  44. #define MAXSTACK 250
  45. /* minimum size for the string table (must be power of 2) */
  46. #ifndef MINSTRTABSIZE
  47. #define MINSTRTABSIZE 32
  48. #endif
  49. /* minimum size for string buffer */
  50. #ifndef LUA_MINBUFFER
  51. #define LUA_MINBUFFER 32
  52. #endif
  53. #endif