mirror of
https://github.com/lua/lua
synced 2024-11-22 21:01:26 +03:00
buffer should be void *, as char now is not that neutral...
This commit is contained in:
parent
8399df5dcf
commit
dfd7ce74cf
4
ldebug.c
4
ldebug.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: ldebug.c,v 1.68 2001/02/22 18:59:59 roberto Exp roberto $
|
||||
** $Id: ldebug.c,v 1.69 2001/02/23 17:17:25 roberto Exp roberto $
|
||||
** Debug Interface
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -366,7 +366,7 @@ static Instruction luaG_symbexec (lua_State *L, const Proto *pt,
|
||||
int pc;
|
||||
if (stackpos < 0) { /* full check? */
|
||||
int i;
|
||||
sl = (lu_byte *)luaO_openspace(L, pt->sizecode);
|
||||
sl = luaO_openspace(L, pt->sizecode, lu_byte);
|
||||
for (i=0; i<pt->sizecode; i++) /* initialize stack-level array */
|
||||
sl[i] = SL_EMPTY;
|
||||
check(precheck(pt));
|
||||
|
23
llex.c
23
llex.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: llex.c,v 1.79 2001/02/22 18:59:59 roberto Exp roberto $
|
||||
** $Id: llex.c,v 1.80 2001/02/23 17:17:25 roberto Exp roberto $
|
||||
** Lexical Analyzer
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -69,7 +69,7 @@ void luaX_error (LexState *ls, const l_char *s, int token) {
|
||||
l_char buff[TOKEN_LEN];
|
||||
luaX_token2str(token, buff);
|
||||
if (buff[0] == l_c('\0'))
|
||||
luaX_syntaxerror(ls, s, G(ls->L)->Mbuffer);
|
||||
luaX_syntaxerror(ls, s, (l_char *)G(ls->L)->Mbuffer);
|
||||
else
|
||||
luaX_syntaxerror(ls, s, buff);
|
||||
}
|
||||
@ -87,8 +87,8 @@ void luaX_token2str (int token, l_char *s) {
|
||||
|
||||
static void luaX_invalidchar (LexState *ls, int c) {
|
||||
l_char buff[8];
|
||||
sprintf(buff, l_s("0x%02X"), c);
|
||||
luaX_syntaxerror(ls, l_s("invalid control l_char"), buff);
|
||||
sprintf(buff, l_s("0x%02X"), uchar(c));
|
||||
luaX_syntaxerror(ls, l_s("invalid control char"), buff);
|
||||
}
|
||||
|
||||
|
||||
@ -127,10 +127,11 @@ void luaX_setinput (lua_State *L, LexState *LS, ZIO *z, TString *source) {
|
||||
/* use Mbuffer to store names, literal strings and numbers */
|
||||
|
||||
#define EXTRABUFF 128
|
||||
#define checkbuffer(L, n, len) if ((len)+(n) > G(L)->Mbuffsize) \
|
||||
luaO_openspace(L, (len)+(n)+EXTRABUFF)
|
||||
#define checkbuffer(L, n, len) \
|
||||
if (((len)+(n))*sizeof(l_char) > G(L)->Mbuffsize) \
|
||||
luaO_openspace(L, (len)+(n)+EXTRABUFF, l_char)
|
||||
|
||||
#define save(L, c, l) (G(L)->Mbuffer[l++] = (l_char)c)
|
||||
#define save(L, c, l) (((l_char *)G(L)->Mbuffer)[l++] = (l_char)c)
|
||||
#define save_and_next(L, LS, l) (save(L, LS->current, l), next(LS))
|
||||
|
||||
|
||||
@ -181,7 +182,7 @@ static void read_number (LexState *LS, int comma, SemInfo *seminfo) {
|
||||
}
|
||||
}
|
||||
save(L, l_c('\0'), l);
|
||||
if (!luaO_str2d(G(L)->Mbuffer, &seminfo->r))
|
||||
if (!luaO_str2d((l_char *)G(L)->Mbuffer, &seminfo->r))
|
||||
luaX_error(LS, l_s("malformed number"), TK_NUMBER);
|
||||
}
|
||||
|
||||
@ -225,7 +226,7 @@ static void read_long_string (LexState *LS, SemInfo *seminfo) {
|
||||
} endloop:
|
||||
save_and_next(L, LS, l); /* skip the second `]' */
|
||||
save(L, l_c('\0'), l);
|
||||
seminfo->ts = luaS_newlstr(L, G(L)->Mbuffer+2, l-5);
|
||||
seminfo->ts = luaS_newlstr(L, (l_char *)G(L)->Mbuffer+2, l-5);
|
||||
}
|
||||
|
||||
|
||||
@ -277,7 +278,7 @@ static void read_string (LexState *LS, int del, SemInfo *seminfo) {
|
||||
}
|
||||
save_and_next(L, LS, l); /* skip delimiter */
|
||||
save(L, l_c('\0'), l);
|
||||
seminfo->ts = luaS_newlstr(L, G(L)->Mbuffer+1, l-3);
|
||||
seminfo->ts = luaS_newlstr(L, (l_char *)G(L)->Mbuffer+1, l-3);
|
||||
}
|
||||
|
||||
|
||||
@ -365,7 +366,7 @@ int luaX_lex (LexState *LS, SemInfo *seminfo) {
|
||||
else if (isalpha(LS->current) || LS->current == l_c('_')) {
|
||||
/* identifier or reserved word */
|
||||
size_t l = readname(LS);
|
||||
TString *ts = luaS_newlstr(LS->L, G(LS->L)->Mbuffer, l);
|
||||
TString *ts = luaS_newlstr(LS->L, (l_char *)G(LS->L)->Mbuffer, l);
|
||||
if (ts->marked >= RESERVEDMARK) /* reserved word? */
|
||||
return ts->marked-RESERVEDMARK+FIRST_RESERVED;
|
||||
seminfo->ts = ts;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lobject.c,v 1.66 2001/02/22 17:15:18 roberto Exp roberto $
|
||||
** $Id: lobject.c,v 1.67 2001/02/23 17:17:25 roberto Exp roberto $
|
||||
** Some generic functions over Lua objects
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -35,9 +35,9 @@ int luaO_equalObj (const TObject *t1, const TObject *t2) {
|
||||
}
|
||||
|
||||
|
||||
l_char *luaO_openspace (lua_State *L, size_t n) {
|
||||
void *luaO_openspaceaux (lua_State *L, size_t n) {
|
||||
if (n > G(L)->Mbuffsize) {
|
||||
luaM_reallocvector(L, G(L)->Mbuffer, G(L)->Mbuffsize, n, l_char);
|
||||
luaM_reallocvector(L, G(L)->Mbuffer, G(L)->Mbuffsize, n, lu_byte);
|
||||
G(L)->Mbuffsize = n;
|
||||
}
|
||||
return G(L)->Mbuffer;
|
||||
|
4
lstate.h
4
lstate.h
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lstate.h,v 1.51 2001/02/20 18:15:33 roberto Exp roberto $
|
||||
** $Id: lstate.h,v 1.52 2001/02/23 17:17:25 roberto Exp roberto $
|
||||
** Global State
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -64,7 +64,7 @@ typedef struct stringtable {
|
||||
** `global state', shared by all threads of this state
|
||||
*/
|
||||
typedef struct global_State {
|
||||
l_char *Mbuffer; /* global buffer */
|
||||
void *Mbuffer; /* global buffer */
|
||||
size_t Mbuffsize; /* size of Mbuffer */
|
||||
Proto *rootproto; /* list of all prototypes */
|
||||
Closure *rootcl; /* list of all closures */
|
||||
|
4
lvm.c
4
lvm.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lvm.c,v 1.171 2001/02/22 18:59:59 roberto Exp roberto $
|
||||
** $Id: lvm.c,v 1.172 2001/02/23 17:17:25 roberto Exp roberto $
|
||||
** Lua virtual machine
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -281,7 +281,7 @@ void luaV_strconc (lua_State *L, int total, StkId top) {
|
||||
n++;
|
||||
}
|
||||
if (tl > MAX_SIZET) luaD_error(L, l_s("string size overflow"));
|
||||
buffer = luaO_openspace(L, tl);
|
||||
buffer = luaO_openspace(L, tl, l_char);
|
||||
tl = 0;
|
||||
for (i=n; i>0; i--) { /* concat all strings */
|
||||
size_t l = tsvalue(top-i)->len;
|
||||
|
Loading…
Reference in New Issue
Block a user