aboutsummaryrefslogtreecommitdiff
path: root/llimits.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-10-29 15:07:45 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-10-29 15:07:45 -0200
commitff6c03433079c0ca7535bfdfd5cae6e90e0ae9da (patch)
treefde7a2bca2692899ed23ec6199fb2f184d6f4e1b /llimits.h
parent05afee0f50f64b64dbb4c0614ccf737ffdc06ab6 (diff)
downloadlua-ff6c03433079c0ca7535bfdfd5cae6e90e0ae9da.tar.gz
lua-ff6c03433079c0ca7535bfdfd5cae6e90e0ae9da.tar.bz2
lua-ff6c03433079c0ca7535bfdfd5cae6e90e0ae9da.zip
configurations for types 'lu_mem'/'l_mem'/'Instruction' moved to here
(from 'luaconf.h'), as they are not needed by the API and probably will not be changed
Diffstat (limited to 'llimits.h')
-rw-r--r--llimits.h40
1 files changed, 26 insertions, 14 deletions
diff --git a/llimits.h b/llimits.h
index 076a0952..01a0d29b 100644
--- a/llimits.h
+++ b/llimits.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: llimits.h,v 1.121 2014/10/25 11:50:46 roberto Exp roberto $ 2** $Id: llimits.h,v 1.122 2014/10/27 16:29:58 roberto Exp roberto $
3** Limits, basic types, and some other 'installation-dependent' definitions 3** Limits, basic types, and some other 'installation-dependent' definitions
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -14,13 +14,21 @@
14 14
15#include "lua.h" 15#include "lua.h"
16 16
17 17/*
18typedef unsigned LUA_INT32 lu_int32; 18** 'lu_mem' and 'l_mem' are unsigned/signed integers big enough to count
19 19** the total memory used by Lua (in bytes). Usually, 'size_t' and
20** 'ptrdiff_t' should work, but we use 'long' for 16-bit machines.
21*/
22#if defined(LUAI_MEM) /* { external definitions? */
20typedef LUAI_UMEM lu_mem; 23typedef LUAI_UMEM lu_mem;
21
22typedef LUAI_MEM l_mem; 24typedef LUAI_MEM l_mem;
23 25#elif LUAI_BITSINT >= 32 /* }{ */
26typedef size_t lu_mem;
27typedef ptrdiff_t l_mem;
28#else /* 16-bit ints */ /* }{ */
29typedef unsigned long lu_mem;
30typedef long l_mem;
31#endif /* } */
24 32
25 33
26/* chars used as small naturals (so that 'char' is reserved for characters) */ 34/* chars used as small naturals (so that 'char' is reserved for characters) */
@@ -48,7 +56,7 @@ typedef unsigned char lu_byte;
48** this is for hashing only; there is no problem if the integer 56** this is for hashing only; there is no problem if the integer
49** cannot hold the whole pointer value 57** cannot hold the whole pointer value
50*/ 58*/
51#define point2int(p) ((unsigned int)((lu_mem)(p) & UINT_MAX)) 59#define point2int(p) ((unsigned int)((size_t)(p) & UINT_MAX))
52 60
53 61
54 62
@@ -149,10 +157,14 @@ typedef LUAI_UACINT l_uacInt;
149 157
150 158
151/* 159/*
152** type for virtual-machine instructions 160** type for virtual-machine instructions;
153** must be an unsigned with (at least) 4 bytes (see details in lopcodes.h) 161** must be an unsigned with (at least) 4 bytes (see details in lopcodes.h)
154*/ 162*/
155typedef lu_int32 Instruction; 163#if LUAI_BITSINT >= 32
164typedef unsigned int Instruction;
165#else
166typedef unsigned long Instruction;
167#endif
156 168
157 169
158 170
@@ -170,12 +182,12 @@ typedef lu_int32 Instruction;
170 182
171 183
172#if !defined(lua_lock) 184#if !defined(lua_lock)
173#define lua_lock(L) ((void) 0) 185#define lua_lock(L) ((void) 0)
174#define lua_unlock(L) ((void) 0) 186#define lua_unlock(L) ((void) 0)
175#endif 187#endif
176 188
177#if !defined(luai_threadyield) 189#if !defined(luai_threadyield)
178#define luai_threadyield(L) {lua_unlock(L); lua_lock(L);} 190#define luai_threadyield(L) {lua_unlock(L); lua_lock(L);}
179#endif 191#endif
180 192
181 193
@@ -201,11 +213,11 @@ typedef lu_int32 Instruction;
201#endif 213#endif
202 214
203#if !defined(luai_userstateresume) 215#if !defined(luai_userstateresume)
204#define luai_userstateresume(L,n) ((void)L) 216#define luai_userstateresume(L,n) ((void)L)
205#endif 217#endif
206 218
207#if !defined(luai_userstateyield) 219#if !defined(luai_userstateyield)
208#define luai_userstateyield(L,n) ((void)L) 220#define luai_userstateyield(L,n) ((void)L)
209#endif 221#endif
210 222
211 223