aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lapi.c9
-rw-r--r--lauxlib.c6
-rw-r--r--ldo.c14
-rw-r--r--liolib.c38
-rw-r--r--llex.c14
-rw-r--r--llex.h7
-rw-r--r--lmem.c4
-rw-r--r--lref.c6
-rw-r--r--lref.h4
-rw-r--r--lstate.h6
-rw-r--r--lstrlib.c4
-rw-r--r--ltable.c4
-rw-r--r--ltests.c6
-rw-r--r--lvm.c6
-rw-r--r--lzio.c6
15 files changed, 69 insertions, 65 deletions
diff --git a/lapi.c b/lapi.c
index a3d1f8c1..427cf3ab 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lapi.c,v 1.69 2000/01/19 12:00:45 roberto Exp roberto $ 2** $Id: lapi.c,v 1.70 2000/01/24 20:14:07 roberto Exp roberto $
3** Lua API 3** Lua API
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -129,12 +129,13 @@ lua_Object lua_gettable (lua_State *L) {
129 129
130 130
131lua_Object lua_rawgettable (lua_State *L) { 131lua_Object lua_rawgettable (lua_State *L) {
132 lua_Object res;
132 luaA_checkCparams(L, 2); 133 luaA_checkCparams(L, 2);
133 if (ttype(L->top-2) != LUA_T_ARRAY) 134 if (ttype(L->top-2) != LUA_T_ARRAY)
134 lua_error(L, "indexed expression not a table in rawgettable"); 135 lua_error(L, "indexed expression not a table in rawgettable");
135 *(L->top-2) = *luaH_get(L, avalue(L->top-2), L->top-1); 136 res = luaA_putluaObject(L, luaH_get(L, avalue(L->top-2), L->top-1));
136 --L->top; 137 L->top -= 2;
137 return luaA_putObjectOnTop(L); 138 return res;
138} 139}
139 140
140 141
diff --git a/lauxlib.c b/lauxlib.c
index a85064da..42551e52 100644
--- a/lauxlib.c
+++ b/lauxlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lauxlib.c,v 1.24 1999/12/28 11:52:49 roberto Exp roberto $ 2** $Id: lauxlib.c,v 1.25 2000/01/19 12:00:45 roberto Exp roberto $
3** Auxiliary functions for building Lua libraries 3** Auxiliary functions for building Lua libraries
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -42,11 +42,11 @@ void luaL_argerror (lua_State *L, int narg, const char *extramsg) {
42} 42}
43 43
44 44
45static void type_error (lua_State *L, int narg, const char *typename, 45static void type_error (lua_State *L, int narg, const char *type_name,
46 lua_Object o) { 46 lua_Object o) {
47 char buff[100]; 47 char buff[100];
48 const char *otype = (o == LUA_NOOBJECT) ? "no value" : lua_type(L, o); 48 const char *otype = (o == LUA_NOOBJECT) ? "no value" : lua_type(L, o);
49 sprintf(buff, "%.10s expected, got %.10s", typename, otype); 49 sprintf(buff, "%.10s expected, got %.10s", type_name, otype);
50 luaL_argerror(L, narg, buff); 50 luaL_argerror(L, narg, buff);
51} 51}
52 52
diff --git a/ldo.c b/ldo.c
index 7bc45199..694da7bf 100644
--- a/ldo.c
+++ b/ldo.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldo.c,v 1.65 2000/01/13 15:56:03 roberto Exp roberto $ 2** $Id: ldo.c,v 1.66 2000/01/19 12:00:45 roberto Exp roberto $
3** Stack and Call structure of Lua 3** Stack and Call structure of Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -266,9 +266,9 @@ void lua_error (lua_State *L, const char *s) {
266*/ 266*/
267int luaD_protectedrun (lua_State *L) { 267int luaD_protectedrun (lua_State *L) {
268 struct lua_longjmp myErrorJmp; 268 struct lua_longjmp myErrorJmp;
269 volatile StkId base = L->Cstack.base; 269 StkId base = L->Cstack.base;
270 volatile int numCblocks = L->numCblocks; 270 int numCblocks = L->numCblocks;
271 volatile int status; 271 int status;
272 struct lua_longjmp *volatile oldErr = L->errorJmp; 272 struct lua_longjmp *volatile oldErr = L->errorJmp;
273 L->errorJmp = &myErrorJmp; 273 L->errorJmp = &myErrorJmp;
274 if (setjmp(myErrorJmp.b) == 0) { 274 if (setjmp(myErrorJmp.b) == 0) {
@@ -295,9 +295,9 @@ int luaD_protectedrun (lua_State *L) {
295*/ 295*/
296static int protectedparser (lua_State *L, ZIO *z, int bin) { 296static int protectedparser (lua_State *L, ZIO *z, int bin) {
297 struct lua_longjmp myErrorJmp; 297 struct lua_longjmp myErrorJmp;
298 volatile StkId base = L->Cstack.base; 298 StkId base = L->Cstack.base;
299 volatile int numCblocks = L->numCblocks; 299 int numCblocks = L->numCblocks;
300 volatile int status; 300 int status;
301 TProtoFunc *volatile tf; 301 TProtoFunc *volatile tf;
302 struct lua_longjmp *volatile oldErr = L->errorJmp; 302 struct lua_longjmp *volatile oldErr = L->errorJmp;
303 L->errorJmp = &myErrorJmp; 303 L->errorJmp = &myErrorJmp;
diff --git a/liolib.c b/liolib.c
index e9f114fe..0d75ac0d 100644
--- a/liolib.c
+++ b/liolib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: liolib.c,v 1.55 1999/12/30 18:28:40 roberto Exp roberto $ 2** $Id: liolib.c,v 1.56 2000/01/19 12:00:45 roberto Exp roberto $
3** Standard I/O (and system) library 3** Standard I/O (and system) library
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -80,28 +80,30 @@ static int gettag (lua_State *L) {
80} 80}
81 81
82 82
83static int ishandle (lua_State *L, lua_Object f) { 83static FILE *gethandle (lua_State *L, lua_Object f) {
84 if (lua_isuserdata(L, f)) { 84 if (lua_isuserdata(L, f)) {
85 int tag = gettag(L); 85 int ftag = lua_tag(L, f);
86 if (lua_tag(L, f) == CLOSEDTAG(L, tag)) 86 int iotag = gettag(L);
87 if (ftag == iotag)
88 return (FILE *)lua_getuserdata(L, f);
89 if (ftag == CLOSEDTAG(L, iotag))
87 lua_error(L, "cannot access a closed file"); 90 lua_error(L, "cannot access a closed file");
88 return lua_tag(L, f) == tag; 91 /* else go through */
89 } 92 }
90 else return 0; 93 return NULL;
91} 94}
92 95
93 96
94static FILE *getfilebyname (lua_State *L, const char *name) { 97static FILE *getfilebyname (lua_State *L, const char *name) {
95 lua_Object f = lua_rawgetglobal(L, name); 98 FILE *handle = gethandle(L, lua_rawgetglobal(L, name));
96 if (!ishandle(L, f)) 99 if (!handle)
97 luaL_verror(L, "global variable `%.50s' is not a file handle", name); 100 luaL_verror(L, "global variable `%.50s' is not a file handle", name);
98 return lua_getuserdata(L, f); 101 return handle;
99} 102}
100 103
101 104
102static FILE *getfile (lua_State *L, int arg) { 105static FILE *getfile (lua_State *L, int arg) {
103 lua_Object f = lua_getparam(L, arg); 106 return gethandle(L, lua_getparam(L, arg));
104 return (ishandle(L, f)) ? lua_getuserdata(L, f) : NULL;
105} 107}
106 108
107 109
@@ -182,7 +184,7 @@ static void io_readfrom (lua_State *L) {
182 current = NULL; /* to signal error */ 184 current = NULL; /* to signal error */
183 } 185 }
184 else if (lua_tag(L, f) == gettag(L)) /* deprecated option */ 186 else if (lua_tag(L, f) == gettag(L)) /* deprecated option */
185 current = lua_getuserdata(L, f); 187 current = (FILE *)lua_getuserdata(L, f);
186 else { 188 else {
187 const char *s = luaL_check_string(L, FIRSTARG); 189 const char *s = luaL_check_string(L, FIRSTARG);
188 current = (*s == '|') ? popen(s+1, "r") : fopen(s, "r"); 190 current = (*s == '|') ? popen(s+1, "r") : fopen(s, "r");
@@ -201,7 +203,7 @@ static void io_writeto (lua_State *L) {
201 current = NULL; /* to signal error */ 203 current = NULL; /* to signal error */
202 } 204 }
203 else if (lua_tag(L, f) == gettag(L)) /* deprecated option */ 205 else if (lua_tag(L, f) == gettag(L)) /* deprecated option */
204 current = lua_getuserdata(L, f); 206 current = (FILE *)lua_getuserdata(L, f);
205 else { 207 else {
206 const char *s = luaL_check_string(L, FIRSTARG); 208 const char *s = luaL_check_string(L, FIRSTARG);
207 current = (*s == '|') ? popen(s+1,"w") : fopen(s, "w"); 209 current = (*s == '|') ? popen(s+1,"w") : fopen(s, "w");
@@ -301,7 +303,7 @@ static int read_number (lua_State *L, FILE *f) {
301 303
302static void read_word (lua_State *L, FILE *f) { 304static void read_word (lua_State *L, FILE *f) {
303 int c; 305 int c;
304 do { c = fgetc(f); } while isspace(c); /* skip spaces */ 306 do { c = fgetc(f); } while (isspace(c)); /* skip spaces */
305 while (c != EOF && !isspace(c)) { 307 while (c != EOF && !isspace(c)) {
306 luaL_addchar(L, c); 308 luaL_addchar(L, c);
307 c = fgetc(f); 309 c = fgetc(f);
@@ -477,10 +479,10 @@ static void io_clock (lua_State *L) {
477static void io_date (lua_State *L) { 479static void io_date (lua_State *L) {
478 char b[256]; 480 char b[256];
479 const char *s = luaL_opt_string(L, 1, "%c"); 481 const char *s = luaL_opt_string(L, 1, "%c");
480 struct tm *tm; 482 struct tm *stm;
481 time_t t; 483 time_t t;
482 time(&t); tm = localtime(&t); 484 time(&t); stm = localtime(&t);
483 if (strftime(b,sizeof(b),s,tm)) 485 if (strftime(b, sizeof(b), s, stm))
484 lua_pushstring(L, b); 486 lua_pushstring(L, b);
485 else 487 else
486 lua_error(L, "invalid `date' format"); 488 lua_error(L, "invalid `date' format");
diff --git a/llex.c b/llex.c
index b74186d1..19edb8f0 100644
--- a/llex.c
+++ b/llex.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: llex.c,v 1.49 2000/01/25 18:44:21 roberto Exp roberto $ 2** $Id: llex.c,v 1.50 2000/01/26 18:51:49 roberto Exp roberto $
3** Lexical Analyzer 3** Lexical Analyzer
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -31,15 +31,15 @@
31 31
32 32
33/* ORDER RESERVED */ 33/* ORDER RESERVED */
34static const char *const reserved [] = {"and", "do", "else", "elseif", "end", 34static const char *const token2string [] = {"and", "do", "else", "elseif", "end",
35 "function", "if", "local", "nil", "not", "or", "repeat", "return", "then", 35 "function", "if", "local", "nil", "not", "or", "repeat", "return", "then",
36 "until", "while", "", "..", "...", "==", ">=", "<=", "~=", "", "", ""}; 36 "until", "while", "", "..", "...", "==", ">=", "<=", "~=", "", "", "<eof>"};
37 37
38 38
39void luaX_init (lua_State *L) { 39void luaX_init (lua_State *L) {
40 unsigned int i; 40 unsigned int i;
41 for (i=0; i<(sizeof(reserved)/sizeof(reserved[0])); i++) { 41 for (i=0; i<NUM_RESERVED; i++) {
42 TaggedString *ts = luaS_new(L, reserved[i]); 42 TaggedString *ts = luaS_new(L, token2string[i]);
43 ts->marked = (unsigned char)(RESERVEDMARK+i); /* reserved word */ 43 ts->marked = (unsigned char)(RESERVEDMARK+i); /* reserved word */
44 } 44 }
45} 45}
@@ -50,8 +50,6 @@ void luaX_init (lua_State *L) {
50void luaX_syntaxerror (LexState *ls, const char *s, const char *token) { 50void luaX_syntaxerror (LexState *ls, const char *s, const char *token) {
51 char buff[MAXSRC]; 51 char buff[MAXSRC];
52 luaL_chunkid(buff, zname(ls->lex_z), sizeof(buff)); 52 luaL_chunkid(buff, zname(ls->lex_z), sizeof(buff));
53 if (token[0] == '\0')
54 token = "<eof>";
55 luaL_verror(ls->L, "%.100s;\n last token read: `%.50s' at line %d in %.80s", 53 luaL_verror(ls->L, "%.100s;\n last token read: `%.50s' at line %d in %.80s",
56 s, token, ls->linenumber, buff); 54 s, token, ls->linenumber, buff);
57} 55}
@@ -75,7 +73,7 @@ void luaX_token2str (int token, char *s) {
75 s[1] = '\0'; 73 s[1] = '\0';
76 } 74 }
77 else 75 else
78 strcpy(s, reserved[token-FIRST_RESERVED]); 76 strcpy(s, token2string[token-FIRST_RESERVED]);
79} 77}
80 78
81 79
diff --git a/llex.h b/llex.h
index 918b4125..8b11cd64 100644
--- a/llex.h
+++ b/llex.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: llex.h,v 1.16 1999/12/27 17:33:22 roberto Exp roberto $ 2** $Id: llex.h,v 1.17 2000/01/25 18:44:21 roberto Exp roberto $
3** Lexical Analyzer 3** Lexical Analyzer
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -27,7 +27,10 @@ enum RESERVED {
27 DO, ELSE, ELSEIF, END, FUNCTION, IF, LOCAL, NIL, NOT, OR, 27 DO, ELSE, ELSEIF, END, FUNCTION, IF, LOCAL, NIL, NOT, OR,
28 REPEAT, RETURN, THEN, UNTIL, WHILE, 28 REPEAT, RETURN, THEN, UNTIL, WHILE,
29 /* other terminal symbols */ 29 /* other terminal symbols */
30 NAME, CONC, DOTS, EQ, GE, LE, NE, NUMBER, STRING, EOS}; 30 NAME, CONC, DOTS, EQ, GE, LE, NE, NUMBER, STRING, EOS
31};
32
33#define NUM_RESERVED (WHILE-FIRST_RESERVED+1) /* number of reserved words */
31 34
32 35
33#ifndef MAX_IFS 36#ifndef MAX_IFS
diff --git a/lmem.c b/lmem.c
index 81935d98..c8cbb0fe 100644
--- a/lmem.c
+++ b/lmem.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lmem.c,v 1.23 1999/12/27 17:33:22 roberto Exp roberto $ 2** $Id: lmem.c,v 1.24 2000/01/13 16:30:47 roberto Exp roberto $
3** Interface to Memory Manager 3** Interface to Memory Manager
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -83,7 +83,7 @@ static void *debug_realloc (void *block, size_t size) {
83 return NULL; 83 return NULL;
84 } 84 }
85 else { 85 else {
86 char *newblock = (malloc)(realsize); /* alloc a new block */ 86 char *newblock = (char *)(malloc)(realsize); /* alloc a new block */
87 int i; 87 int i;
88 if (block) { 88 if (block) {
89 size_t oldsize = *blocksize(block); 89 size_t oldsize = *blocksize(block);
diff --git a/lref.c b/lref.c
index 879f25d7..2bfa773f 100644
--- a/lref.c
+++ b/lref.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lref.c,v 1.5 1999/12/23 18:19:57 roberto Exp roberto $ 2** $Id: lref.c,v 1.6 1999/12/27 17:33:22 roberto Exp roberto $
3** reference mechanism 3** reference mechanism
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -25,7 +25,7 @@ int lua_ref (lua_State *L, int lock) {
25 L->refFree = L->refArray[ref].st; 25 L->refFree = L->refArray[ref].st;
26 } 26 }
27 else { /* no more free places */ 27 else { /* no more free places */
28 luaM_growvector(L, L->refArray, L->refSize, 1, struct ref, refEM, MAX_INT); 28 luaM_growvector(L, L->refArray, L->refSize, 1, struct Ref, refEM, MAX_INT);
29 ref = L->refSize++; 29 ref = L->refSize++;
30 } 30 }
31 L->refArray[ref].o = *(L->top-1); 31 L->refArray[ref].o = *(L->top-1);
@@ -102,7 +102,7 @@ void luaR_invalidaterefs (lua_State *L) {
102 int n = L->refSize; 102 int n = L->refSize;
103 int i; 103 int i;
104 for (i=0; i<n; i++) { 104 for (i=0; i<n; i++) {
105 struct ref *r = &L->refArray[i]; 105 struct Ref *r = &L->refArray[i];
106 if (r->st == HOLD && !ismarked(&r->o)) 106 if (r->st == HOLD && !ismarked(&r->o))
107 r->st = COLLECTED; 107 r->st = COLLECTED;
108 LUA_ASSERT(L, (r->st == LOCK && ismarked(&r->o)) || 108 LUA_ASSERT(L, (r->st == LOCK && ismarked(&r->o)) ||
diff --git a/lref.h b/lref.h
index 1d140d38..4aec948d 100644
--- a/lref.h
+++ b/lref.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lref.h,v 1.4 1999/12/14 18:33:29 roberto Exp roberto $ 2** $Id: lref.h,v 1.5 1999/12/27 17:33:22 roberto Exp roberto $
3** reference mechanism 3** reference mechanism
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -16,7 +16,7 @@
16#define LOCK -4 16#define LOCK -4
17 17
18 18
19struct ref { 19struct Ref {
20 TObject o; 20 TObject o;
21 int st; /* can be LOCK, HOLD, COLLECTED, or next (for free list) */ 21 int st; /* can be LOCK, HOLD, COLLECTED, or next (for free list) */
22}; 22};
diff --git a/lstate.h b/lstate.h
index f24f2d0a..da0f1681 100644
--- a/lstate.h
+++ b/lstate.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstate.h,v 1.27 1999/12/27 17:33:22 roberto Exp roberto $ 2** $Id: lstate.h,v 1.28 2000/01/19 12:00:45 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*/
@@ -30,7 +30,7 @@ struct lua_longjmp {
30/* 30/*
31** stack layout for C point of view: 31** stack layout for C point of view:
32** [lua2C, lua2C+num) - `array' lua2C 32** [lua2C, lua2C+num) - `array' lua2C
33** [lua2C+num, base) - space for extra lua_Objects 33** [lua2C+num, base) - space for extra lua_Objects (limbo)
34** [base, L->top) - `stack' C2Lua 34** [base, L->top) - `stack' C2Lua
35*/ 35*/
36struct C_Lua_Stack { 36struct C_Lua_Stack {
@@ -70,7 +70,7 @@ struct lua_State {
70 stringtable *string_root; /* array of hash tables for strings and udata */ 70 stringtable *string_root; /* array of hash tables for strings and udata */
71 struct IM *IMtable; /* table for tag methods */ 71 struct IM *IMtable; /* table for tag methods */
72 int last_tag; /* last used tag in IMtable */ 72 int last_tag; /* last used tag in IMtable */
73 struct ref *refArray; /* locked objects */ 73 struct Ref *refArray; /* locked objects */
74 int refSize; /* size of refArray */ 74 int refSize; /* size of refArray */
75 int refFree; /* list of free positions in refArray */ 75 int refFree; /* list of free positions in refArray */
76 unsigned long GCthreshold; 76 unsigned long GCthreshold;
diff --git a/lstrlib.c b/lstrlib.c
index c724d076..713cc72e 100644
--- a/lstrlib.c
+++ b/lstrlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstrlib.c,v 1.38 1999/11/22 17:39:51 roberto Exp roberto $ 2** $Id: lstrlib.c,v 1.39 1999/12/27 17:33:22 roberto Exp roberto $
3** Standard library for string operations and pattern-matching 3** Standard library for string operations and pattern-matching
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -382,7 +382,7 @@ static const char *memfind (const char *s1, long l1, const char *s2, long l2) {
382 const char *init; /* to search for a `*s2' inside `s1' */ 382 const char *init; /* to search for a `*s2' inside `s1' */
383 l2--; /* 1st char will be checked by `memchr' */ 383 l2--; /* 1st char will be checked by `memchr' */
384 l1 = l1-l2; /* `s2' cannot be found after that */ 384 l1 = l1-l2; /* `s2' cannot be found after that */
385 while (l1 > 0 && (init = memchr(s1, *s2, l1)) != NULL) { 385 while (l1 > 0 && (init = (const char *)memchr(s1, *s2, l1)) != NULL) {
386 init++; /* 1st char is already checked */ 386 init++; /* 1st char is already checked */
387 if (memcmp(init, s2+1, l2) == 0) 387 if (memcmp(init, s2+1, l2) == 0)
388 return init-1; 388 return init-1;
diff --git a/ltable.c b/ltable.c
index 59adf0d9..bd250e53 100644
--- a/ltable.c
+++ b/ltable.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltable.c,v 1.32 1999/12/07 12:05:34 roberto Exp roberto $ 2** $Id: ltable.c,v 1.33 1999/12/23 18:19:57 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*/
@@ -86,7 +86,7 @@ const TObject *luaH_get (lua_State *L, const Hash *t, const TObject *key) {
86int luaH_pos (lua_State *L, const Hash *t, const TObject *key) { 86int luaH_pos (lua_State *L, const Hash *t, const TObject *key) {
87 const TObject *v = luaH_get(L, t, key); 87 const TObject *v = luaH_get(L, t, key);
88 return (v == &luaO_nilobject) ? -1 : /* key not found */ 88 return (v == &luaO_nilobject) ? -1 : /* key not found */
89 ((const char *)v - (const char *)(&t->node[0].val))/sizeof(Node); 89 (int)(((const char *)v - (const char *)(&t->node[0].val))/sizeof(Node));
90} 90}
91 91
92 92
diff --git a/ltests.c b/ltests.c
index 320d5304..3dca88b7 100644
--- a/ltests.c
+++ b/ltests.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltests.c,v 1.5 2000/01/19 12:00:45 roberto Exp roberto $ 2** $Id: ltests.c,v 1.6 2000/01/24 20:11:26 roberto Exp roberto $
3** Internal Module for Debugging of the Lua Implementation 3** Internal Module for Debugging of the Lua Implementation
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -243,7 +243,7 @@ static void testC (lua_State *L) {
243 lua_pushuserdata(L, L1); 243 lua_pushuserdata(L, L1);
244 } 244 }
245 else if EQ("closestate") { 245 else if EQ("closestate") {
246 lua_close(lua_getuserdata(L, reg[getreg(L, &pc)])); 246 lua_close((lua_State *)lua_getuserdata(L, reg[getreg(L, &pc)]));
247 } 247 }
248 else if EQ("doremote") { 248 else if EQ("doremote") {
249 lua_Object ol1 = reg[getreg(L, &pc)]; 249 lua_Object ol1 = reg[getreg(L, &pc)];
@@ -253,7 +253,7 @@ static void testC (lua_State *L) {
253 int i; 253 int i;
254 if (!lua_isuserdata(L, ol1) || !lua_isstring(L, str)) 254 if (!lua_isuserdata(L, ol1) || !lua_isstring(L, str))
255 lua_error(L, "bad arguments for `doremote'"); 255 lua_error(L, "bad arguments for `doremote'");
256 L1 = lua_getuserdata(L, ol1); 256 L1 = (lua_State *)lua_getuserdata(L, ol1);
257 lua_dostring(L1, lua_getstring(L, str)); 257 lua_dostring(L1, lua_getstring(L, str));
258 i = 1; 258 i = 1;
259 while ((temp = lua_getresult(L1, i++)) != LUA_NOOBJECT) 259 while ((temp = lua_getresult(L1, i++)) != LUA_NOOBJECT)
diff --git a/lvm.c b/lvm.c
index 463373b3..1a94e3f4 100644
--- a/lvm.c
+++ b/lvm.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lvm.c,v 1.83 2000/01/25 13:57:18 roberto Exp roberto $ 2** $Id: lvm.c,v 1.84 2000/01/28 16:53:00 roberto Exp roberto $
3** Lua virtual machine 3** Lua virtual machine
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -311,7 +311,7 @@ static void adjust_varargs (lua_State *L, StkId base, int nfixargs) {
311** Returns n such that the the results are between [n,top). 311** Returns n such that the the results are between [n,top).
312*/ 312*/
313StkId luaV_execute (lua_State *L, const Closure *cl, const TProtoFunc *tf, 313StkId luaV_execute (lua_State *L, const Closure *cl, const TProtoFunc *tf,
314 StkId base) { 314 register StkId base) {
315 register StkId top; /* keep top local, for performance */ 315 register StkId top; /* keep top local, for performance */
316 register const Byte *pc = tf->code; 316 register const Byte *pc = tf->code;
317 TaggedString **kstr = tf->kstr; 317 TaggedString **kstr = tf->kstr;
@@ -661,7 +661,7 @@ StkId luaV_execute (lua_State *L, const Closure *cl, const TProtoFunc *tf,
661 case SETNAMEW: aux += highbyte(L, *pc++); 661 case SETNAMEW: aux += highbyte(L, *pc++);
662 case SETNAME: aux += *pc++; 662 case SETNAME: aux += *pc++;
663 if ((base-2)->ttype == LUA_T_LINE) { /* function has debug info? */ 663 if ((base-2)->ttype == LUA_T_LINE) { /* function has debug info? */
664 (base-1)->ttype = -(*pc++); 664 (base-1)->ttype = (lua_Type)(-(*pc++));
665 (base-1)->value.i = aux; 665 (base-1)->value.i = aux;
666 } 666 }
667 break; 667 break;
diff --git a/lzio.c b/lzio.c
index 1216ef91..48269ca7 100644
--- a/lzio.c
+++ b/lzio.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lzio.c,v 1.8 1999/08/16 20:52:00 roberto Exp roberto $ 2** $Id: lzio.c,v 1.9 1999/11/09 17:59:35 roberto Exp roberto $
3** a generic input stream interface 3** a generic input stream interface
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -35,7 +35,7 @@ ZIO* zmopen (ZIO* z, const char* b, int size, const char *name) {
35 35
36ZIO* zsopen (ZIO* z, const char* s, const char *name) { 36ZIO* zsopen (ZIO* z, const char* s, const char *name) {
37 if (s==NULL) return NULL; 37 if (s==NULL) return NULL;
38 return zmopen(z,s,strlen(s),name); 38 return zmopen(z, s, strlen(s), name);
39} 39}
40 40
41/* -------------------------------------------------------------- FILEs --- */ 41/* -------------------------------------------------------------- FILEs --- */
@@ -43,7 +43,7 @@ ZIO* zsopen (ZIO* z, const char* s, const char *name) {
43static int zffilbuf (ZIO* z) { 43static int zffilbuf (ZIO* z) {
44 int n; 44 int n;
45 if (feof((FILE *)z->u)) return EOZ; 45 if (feof((FILE *)z->u)) return EOZ;
46 n = fread(z->buffer,1,ZBSIZE,z->u); 46 n = fread(z->buffer, 1, ZBSIZE, (FILE *)z->u);
47 if (n==0) return EOZ; 47 if (n==0) return EOZ;
48 z->n = n-1; 48 z->n = n-1;
49 z->p = z->buffer; 49 z->p = z->buffer;