aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-03-31 13:28:45 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-03-31 13:28:45 -0300
commit36e1390631a4b89f0a8a3111978780de0d53466c (patch)
tree21fea050e98d3cf844377c58503ccd15e00a43db
parent8f0f54ec3835f5d1637ae2720e2b4de6a177574a (diff)
downloadlua-36e1390631a4b89f0a8a3111978780de0d53466c.tar.gz
lua-36e1390631a4b89f0a8a3111978780de0d53466c.tar.bz2
lua-36e1390631a4b89f0a8a3111978780de0d53466c.zip
details.
-rw-r--r--llimits.h13
-rw-r--r--lobject.c8
-rw-r--r--lobject.h12
-rw-r--r--lstate.c7
-rw-r--r--ltable.c4
5 files changed, 24 insertions, 20 deletions
diff --git a/llimits.h b/llimits.h
index ada86a9b..ea2298f7 100644
--- a/llimits.h
+++ b/llimits.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: llimits.h,v 1.2 2000/03/24 19:49:23 roberto Exp roberto $ 2** $Id: llimits.h,v 1.3 2000/03/27 20:08:33 roberto Exp roberto $
3** Limits, basic types, and some other "instalation-dependent" definitions 3** Limits, basic types, and some other "instalation-dependent" definitions
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -43,6 +43,13 @@ typedef LUA_NUM_TYPE Number;
43#define MINPOWER2 4 /* minimum size for "growing" vectors */ 43#define MINPOWER2 4 /* minimum size for "growing" vectors */
44 44
45 45
46
47#ifndef DEFAULT_STACK_SIZE
48#define DEFAULT_STACK_SIZE 1024
49#endif
50
51
52
46/* 53/*
47** type for virtual-machine instructions 54** type for virtual-machine instructions
48** must be an unsigned with 4 bytes (see details in lopcodes.h) 55** must be an unsigned with 4 bytes (see details in lopcodes.h)
@@ -151,7 +158,11 @@ typedef unsigned long Instruction;
151 158
152 159
153/* number of list items to accumulate before a SETLIST instruction */ 160/* number of list items to accumulate before a SETLIST instruction */
161#define LFIELDS_PER_FLUSH 64
162#if LFIELDS_PER_FLUSH>(MAXSTACK/4)
163#undef LFIELDS_PER_FLUSH
154#define LFIELDS_PER_FLUSH (MAXSTACK/4) 164#define LFIELDS_PER_FLUSH (MAXSTACK/4)
165#endif
155 166
156/* number of record items to accumulate before a SETMAP instruction */ 167/* number of record items to accumulate before a SETMAP instruction */
157/* (each item counts 2 elements on the stack: an index and a value) */ 168/* (each item counts 2 elements on the stack: an index and a value) */
diff --git a/lobject.c b/lobject.c
index edfed796..14cc2313 100644
--- a/lobject.c
+++ b/lobject.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lobject.c,v 1.34 2000/03/27 20:10:21 roberto Exp roberto $ 2** $Id: lobject.c,v 1.35 2000/03/29 20:19:20 roberto Exp roberto $
3** Some generic functions over Lua objects 3** Some generic functions over Lua objects
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -42,11 +42,9 @@ int luaO_equalval (const TObject *t1, const TObject *t2) {
42 return avalue(t1) == avalue(t2); 42 return avalue(t1) == avalue(t2);
43 case TAG_CCLOSURE: case TAG_LCLOSURE: 43 case TAG_CCLOSURE: case TAG_LCLOSURE:
44 return clvalue(t1) == clvalue(t2); 44 return clvalue(t1) == clvalue(t2);
45 case TAG_NIL:
46 return 1;
47 default: 45 default:
48 LUA_INTERNALERROR(L, "invalid type"); 46 LUA_ASSERT(L, ttype(t1) == TAG_NIL, "invalid type");
49 return 0; /* UNREACHABLE */ 47 return 1; /* TAG_NIL */
50 } 48 }
51} 49}
52 50
diff --git a/lobject.h b/lobject.h
index d4912251..09d43f6f 100644
--- a/lobject.h
+++ b/lobject.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lobject.h,v 1.57 2000/03/29 20:19:20 roberto Exp roberto $ 2** $Id: lobject.h,v 1.58 2000/03/30 20:55:50 roberto Exp roberto $
3** Type definitions for Lua objects 3** Type definitions for Lua objects
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -15,8 +15,8 @@
15#ifdef DEBUG 15#ifdef DEBUG
16#undef NDEBUG 16#undef NDEBUG
17#include <assert.h> 17#include <assert.h>
18#define LUA_INTERNALERROR(L,s) assert(0) 18#define LUA_INTERNALERROR(L,s) assert(((void)s,0))
19#define LUA_ASSERT(L,c,s) assert(c) 19#define LUA_ASSERT(L,c,s) assert(((void)s,(c)))
20#else 20#else
21#define LUA_INTERNALERROR(L,s) /* empty */ 21#define LUA_INTERNALERROR(L,s) /* empty */
22#define LUA_ASSERT(L,c,s) /* empty */ 22#define LUA_ASSERT(L,c,s) /* empty */
@@ -24,10 +24,10 @@
24 24
25 25
26#ifdef DEBUG 26#ifdef DEBUG
27/* to avoid warnings and make sure is is really unused */ 27/* to avoid warnings, and make sure value is really unused */
28#define UNUSED(x) (x=0, (void)x) 28#define UNUSED(x) (x=0, (void)(x))
29#else 29#else
30#define UNUSED(x) (void)x /* to avoid warnings */ 30#define UNUSED(x) ((void)(x)) /* to avoid warnings */
31#endif 31#endif
32 32
33 33
diff --git a/lstate.c b/lstate.c
index 563ec35e..f1949df0 100644
--- a/lstate.c
+++ b/lstate.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstate.c,v 1.23 1999/12/21 18:04:41 roberto Exp roberto $ 2** $Id: lstate.c,v 1.24 2000/01/13 16:30:47 roberto Exp roberto $
3** Global State 3** Global State
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -21,11 +21,6 @@
21#include "ltm.h" 21#include "ltm.h"
22 22
23 23
24#ifndef DEFAULT_STACK_SIZE
25#define DEFAULT_STACK_SIZE 1024
26#endif
27
28
29lua_State *lua_state = NULL; 24lua_State *lua_state = NULL;
30 25
31 26
diff --git a/ltable.c b/ltable.c
index 86357920..299821ca 100644
--- a/ltable.c
+++ b/ltable.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltable.c,v 1.37 2000/03/27 20:10:21 roberto Exp roberto $ 2** $Id: ltable.c,v 1.38 2000/03/29 20:19:20 roberto Exp roberto $
3** Lua tables (hash) 3** Lua tables (hash)
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -198,7 +198,7 @@ void luaH_set (lua_State *L, Hash *t, const TObject *key, const TObject *val) {
198 mp->key = *key; 198 mp->key = *key;
199 mp->val = *val; 199 mp->val = *val;
200 for (;;) { /* check free places */ 200 for (;;) { /* check free places */
201 if (ttype(&(t->firstfree)->key) == TAG_NIL) 201 if (ttype(&t->firstfree->key) == TAG_NIL)
202 return; /* OK; table still has a free place */ 202 return; /* OK; table still has a free place */
203 else if (t->firstfree == t->node) break; /* cannot decrement from here */ 203 else if (t->firstfree == t->node) break; /* cannot decrement from here */
204 else (t->firstfree)--; 204 else (t->firstfree)--;