llimits.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. ** $Id: llimits.h,v 1.58 2004/04/30 20:13:38 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 LUA_INT32 l_int32;
  13. /*
  14. ** an unsigned integer big enough to count the total memory used by Lua;
  15. ** it should be at least as large as `size_t'
  16. */
  17. typedef lu_int32 lu_mem;
  18. /*
  19. ** a signed integer big enough to count the total memory used by Lua;
  20. ** it should be at least as large as `size_t'
  21. */
  22. typedef l_int32 l_mem;
  23. #define MAXLMEM LUA_MAXINT32
  24. /* chars used as small naturals (so that `char' is reserved for characters) */
  25. typedef unsigned char lu_byte;
  26. #define MAX_SIZET ((size_t)(~(size_t)0)-2)
  27. #define MAX_INT (INT_MAX-2) /* maximum value of an int (-2 for safety) */
  28. /*
  29. ** conversion of pointer to integer
  30. ** this is for hashing only; there is no problem if the integer
  31. ** cannot hold the whole pointer value
  32. */
  33. #define IntPoint(p) ((unsigned int)(p))
  34. /* type to ensure maximum alignment */
  35. typedef LUSER_ALIGNMENT_T L_Umaxalign;
  36. /* result of a `usual argument conversion' over lua_Number */
  37. typedef LUA_UACNUMBER l_uacNumber;
  38. #ifndef check_exp
  39. #define check_exp(c,e) (e)
  40. #endif
  41. #ifndef UNUSED
  42. #define UNUSED(x) ((void)(x)) /* to avoid warnings */
  43. #endif
  44. #ifndef cast
  45. #define cast(t, exp) ((t)(exp))
  46. #endif
  47. /*
  48. ** type for virtual-machine instructions
  49. ** must be an unsigned with (at least) 4 bytes (see details in lopcodes.h)
  50. */
  51. typedef lu_int32 Instruction;
  52. /* maximum stack for a Lua function */
  53. #define MAXSTACK 250
  54. /* minimum size for the string table (must be power of 2) */
  55. #ifndef MINSTRTABSIZE
  56. #define MINSTRTABSIZE 32
  57. #endif
  58. /* minimum size for string buffer */
  59. #ifndef LUA_MINBUFFER
  60. #define LUA_MINBUFFER 32
  61. #endif
  62. #endif