diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-02-23 17:32:16 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-02-23 17:32:16 -0300 |
commit | dfd7ce74cf040dba710657963db0144201823670 (patch) | |
tree | 72117e389dbb172a0cd464c1d74e917c3e106f47 | |
parent | 8399df5dcf40d078cc6b0fa4df640ef0fc49b5be (diff) | |
download | lua-dfd7ce74cf040dba710657963db0144201823670.tar.gz lua-dfd7ce74cf040dba710657963db0144201823670.tar.bz2 lua-dfd7ce74cf040dba710657963db0144201823670.zip |
buffer should be void *, as char now is not that neutral...
-rw-r--r-- | ldebug.c | 4 | ||||
-rw-r--r-- | llex.c | 23 | ||||
-rw-r--r-- | lobject.c | 6 | ||||
-rw-r--r-- | lstate.h | 4 | ||||
-rw-r--r-- | lvm.c | 4 |
5 files changed, 21 insertions, 20 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldebug.c,v 1.68 2001/02/22 18:59:59 roberto Exp roberto $ | 2 | ** $Id: ldebug.c,v 1.69 2001/02/23 17:17:25 roberto Exp roberto $ |
3 | ** Debug Interface | 3 | ** Debug Interface |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -366,7 +366,7 @@ static Instruction luaG_symbexec (lua_State *L, const Proto *pt, | |||
366 | int pc; | 366 | int pc; |
367 | if (stackpos < 0) { /* full check? */ | 367 | if (stackpos < 0) { /* full check? */ |
368 | int i; | 368 | int i; |
369 | sl = (lu_byte *)luaO_openspace(L, pt->sizecode); | 369 | sl = luaO_openspace(L, pt->sizecode, lu_byte); |
370 | for (i=0; i<pt->sizecode; i++) /* initialize stack-level array */ | 370 | for (i=0; i<pt->sizecode; i++) /* initialize stack-level array */ |
371 | sl[i] = SL_EMPTY; | 371 | sl[i] = SL_EMPTY; |
372 | check(precheck(pt)); | 372 | check(precheck(pt)); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: llex.c,v 1.79 2001/02/22 18:59:59 roberto Exp roberto $ | 2 | ** $Id: llex.c,v 1.80 2001/02/23 17:17:25 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 | */ |
@@ -69,7 +69,7 @@ void luaX_error (LexState *ls, const l_char *s, int token) { | |||
69 | l_char buff[TOKEN_LEN]; | 69 | l_char buff[TOKEN_LEN]; |
70 | luaX_token2str(token, buff); | 70 | luaX_token2str(token, buff); |
71 | if (buff[0] == l_c('\0')) | 71 | if (buff[0] == l_c('\0')) |
72 | luaX_syntaxerror(ls, s, G(ls->L)->Mbuffer); | 72 | luaX_syntaxerror(ls, s, (l_char *)G(ls->L)->Mbuffer); |
73 | else | 73 | else |
74 | luaX_syntaxerror(ls, s, buff); | 74 | luaX_syntaxerror(ls, s, buff); |
75 | } | 75 | } |
@@ -87,8 +87,8 @@ void luaX_token2str (int token, l_char *s) { | |||
87 | 87 | ||
88 | static void luaX_invalidchar (LexState *ls, int c) { | 88 | static void luaX_invalidchar (LexState *ls, int c) { |
89 | l_char buff[8]; | 89 | l_char buff[8]; |
90 | sprintf(buff, l_s("0x%02X"), c); | 90 | sprintf(buff, l_s("0x%02X"), uchar(c)); |
91 | luaX_syntaxerror(ls, l_s("invalid control l_char"), buff); | 91 | luaX_syntaxerror(ls, l_s("invalid control char"), buff); |
92 | } | 92 | } |
93 | 93 | ||
94 | 94 | ||
@@ -127,10 +127,11 @@ void luaX_setinput (lua_State *L, LexState *LS, ZIO *z, TString *source) { | |||
127 | /* use Mbuffer to store names, literal strings and numbers */ | 127 | /* use Mbuffer to store names, literal strings and numbers */ |
128 | 128 | ||
129 | #define EXTRABUFF 128 | 129 | #define EXTRABUFF 128 |
130 | #define checkbuffer(L, n, len) if ((len)+(n) > G(L)->Mbuffsize) \ | 130 | #define checkbuffer(L, n, len) \ |
131 | luaO_openspace(L, (len)+(n)+EXTRABUFF) | 131 | if (((len)+(n))*sizeof(l_char) > G(L)->Mbuffsize) \ |
132 | luaO_openspace(L, (len)+(n)+EXTRABUFF, l_char) | ||
132 | 133 | ||
133 | #define save(L, c, l) (G(L)->Mbuffer[l++] = (l_char)c) | 134 | #define save(L, c, l) (((l_char *)G(L)->Mbuffer)[l++] = (l_char)c) |
134 | #define save_and_next(L, LS, l) (save(L, LS->current, l), next(LS)) | 135 | #define save_and_next(L, LS, l) (save(L, LS->current, l), next(LS)) |
135 | 136 | ||
136 | 137 | ||
@@ -181,7 +182,7 @@ static void read_number (LexState *LS, int comma, SemInfo *seminfo) { | |||
181 | } | 182 | } |
182 | } | 183 | } |
183 | save(L, l_c('\0'), l); | 184 | save(L, l_c('\0'), l); |
184 | if (!luaO_str2d(G(L)->Mbuffer, &seminfo->r)) | 185 | if (!luaO_str2d((l_char *)G(L)->Mbuffer, &seminfo->r)) |
185 | luaX_error(LS, l_s("malformed number"), TK_NUMBER); | 186 | luaX_error(LS, l_s("malformed number"), TK_NUMBER); |
186 | } | 187 | } |
187 | 188 | ||
@@ -225,7 +226,7 @@ static void read_long_string (LexState *LS, SemInfo *seminfo) { | |||
225 | } endloop: | 226 | } endloop: |
226 | save_and_next(L, LS, l); /* skip the second `]' */ | 227 | save_and_next(L, LS, l); /* skip the second `]' */ |
227 | save(L, l_c('\0'), l); | 228 | save(L, l_c('\0'), l); |
228 | seminfo->ts = luaS_newlstr(L, G(L)->Mbuffer+2, l-5); | 229 | seminfo->ts = luaS_newlstr(L, (l_char *)G(L)->Mbuffer+2, l-5); |
229 | } | 230 | } |
230 | 231 | ||
231 | 232 | ||
@@ -277,7 +278,7 @@ static void read_string (LexState *LS, int del, SemInfo *seminfo) { | |||
277 | } | 278 | } |
278 | save_and_next(L, LS, l); /* skip delimiter */ | 279 | save_and_next(L, LS, l); /* skip delimiter */ |
279 | save(L, l_c('\0'), l); | 280 | save(L, l_c('\0'), l); |
280 | seminfo->ts = luaS_newlstr(L, G(L)->Mbuffer+1, l-3); | 281 | seminfo->ts = luaS_newlstr(L, (l_char *)G(L)->Mbuffer+1, l-3); |
281 | } | 282 | } |
282 | 283 | ||
283 | 284 | ||
@@ -365,7 +366,7 @@ int luaX_lex (LexState *LS, SemInfo *seminfo) { | |||
365 | else if (isalpha(LS->current) || LS->current == l_c('_')) { | 366 | else if (isalpha(LS->current) || LS->current == l_c('_')) { |
366 | /* identifier or reserved word */ | 367 | /* identifier or reserved word */ |
367 | size_t l = readname(LS); | 368 | size_t l = readname(LS); |
368 | TString *ts = luaS_newlstr(LS->L, G(LS->L)->Mbuffer, l); | 369 | TString *ts = luaS_newlstr(LS->L, (l_char *)G(LS->L)->Mbuffer, l); |
369 | if (ts->marked >= RESERVEDMARK) /* reserved word? */ | 370 | if (ts->marked >= RESERVEDMARK) /* reserved word? */ |
370 | return ts->marked-RESERVEDMARK+FIRST_RESERVED; | 371 | return ts->marked-RESERVEDMARK+FIRST_RESERVED; |
371 | seminfo->ts = ts; | 372 | seminfo->ts = ts; |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lobject.c,v 1.66 2001/02/22 17:15:18 roberto Exp roberto $ | 2 | ** $Id: lobject.c,v 1.67 2001/02/23 17:17:25 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 | */ |
@@ -35,9 +35,9 @@ int luaO_equalObj (const TObject *t1, const TObject *t2) { | |||
35 | } | 35 | } |
36 | 36 | ||
37 | 37 | ||
38 | l_char *luaO_openspace (lua_State *L, size_t n) { | 38 | void *luaO_openspaceaux (lua_State *L, size_t n) { |
39 | if (n > G(L)->Mbuffsize) { | 39 | if (n > G(L)->Mbuffsize) { |
40 | luaM_reallocvector(L, G(L)->Mbuffer, G(L)->Mbuffsize, n, l_char); | 40 | luaM_reallocvector(L, G(L)->Mbuffer, G(L)->Mbuffsize, n, lu_byte); |
41 | G(L)->Mbuffsize = n; | 41 | G(L)->Mbuffsize = n; |
42 | } | 42 | } |
43 | return G(L)->Mbuffer; | 43 | return G(L)->Mbuffer; |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstate.h,v 1.51 2001/02/20 18:15:33 roberto Exp roberto $ | 2 | ** $Id: lstate.h,v 1.52 2001/02/23 17:17:25 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 | */ |
@@ -64,7 +64,7 @@ typedef struct stringtable { | |||
64 | ** `global state', shared by all threads of this state | 64 | ** `global state', shared by all threads of this state |
65 | */ | 65 | */ |
66 | typedef struct global_State { | 66 | typedef struct global_State { |
67 | l_char *Mbuffer; /* global buffer */ | 67 | void *Mbuffer; /* global buffer */ |
68 | size_t Mbuffsize; /* size of Mbuffer */ | 68 | size_t Mbuffsize; /* size of Mbuffer */ |
69 | Proto *rootproto; /* list of all prototypes */ | 69 | Proto *rootproto; /* list of all prototypes */ |
70 | Closure *rootcl; /* list of all closures */ | 70 | Closure *rootcl; /* list of all closures */ |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 1.171 2001/02/22 18:59:59 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 1.172 2001/02/23 17:17:25 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 | */ |
@@ -281,7 +281,7 @@ void luaV_strconc (lua_State *L, int total, StkId top) { | |||
281 | n++; | 281 | n++; |
282 | } | 282 | } |
283 | if (tl > MAX_SIZET) luaD_error(L, l_s("string size overflow")); | 283 | if (tl > MAX_SIZET) luaD_error(L, l_s("string size overflow")); |
284 | buffer = luaO_openspace(L, tl); | 284 | buffer = luaO_openspace(L, tl, l_char); |
285 | tl = 0; | 285 | tl = 0; |
286 | for (i=n; i>0; i--) { /* concat all strings */ | 286 | for (i=n; i>0; i--) { /* concat all strings */ |
287 | size_t l = tsvalue(top-i)->len; | 287 | size_t l = tsvalue(top-i)->len; |