first (big) step to support wide chars

This commit is contained in:
Roberto Ierusalimschy
2001-02-23 14:17:25 -03:00
parent d164e2294f
commit 39b7978329
40 changed files with 1151 additions and 1121 deletions

16
lcode.c
View File

@@ -1,5 +1,5 @@
/*
** $Id: lcode.c,v 1.61 2001/02/08 11:19:10 roberto Exp roberto $
** $Id: lcode.c,v 1.62 2001/02/12 19:21:19 roberto Exp roberto $
** Code generator for Lua
** See Copyright Notice in lua.h
*/
@@ -18,7 +18,7 @@
#include "lparser.h"
void luaK_error (LexState *ls, const char *msg) {
void luaK_error (LexState *ls, const l_char *msg) {
luaX_error(ls, msg, ls->t.token);
}
@@ -53,7 +53,7 @@ static void luaK_fixjump (FuncState *fs, int pc, int dest) {
else { /* jump is relative to position following jump instruction */
int offset = dest-(pc+1);
if (abs(offset) > MAXARG_S)
luaK_error(fs->ls, "control structure too long");
luaK_error(fs->ls, l_s("control structure too long"));
SETARG_S(*jmp, offset);
}
}
@@ -99,7 +99,7 @@ void luaK_deltastack (FuncState *fs, int delta) {
fs->stacklevel += delta;
if (fs->stacklevel > fs->f->maxstacksize) {
if (fs->stacklevel > MAXSTACK)
luaK_error(fs->ls, "function or expression too complex");
luaK_error(fs->ls, l_s("function or expression too complex"));
fs->f->maxstacksize = (short)fs->stacklevel;
}
}
@@ -119,7 +119,7 @@ static int number_constant (FuncState *fs, lua_Number r) {
if (f->knum[c] == r) return c;
/* not found; create a new entry */
luaM_growvector(fs->L, f->knum, fs->nknum, f->sizeknum, lua_Number,
MAXARG_U, "constant table overflow");
MAXARG_U, l_s("constant table overflow"));
c = fs->nknum++;
f->knum[c] = r;
return c;
@@ -436,11 +436,11 @@ static void codelineinfo (FuncState *fs) {
if (ls->lastline > fs->lastline) {
if (ls->lastline > fs->lastline+1) {
luaM_growvector(fs->L, f->lineinfo, fs->nlineinfo, f->sizelineinfo, int,
MAX_INT, "line info overflow");
MAX_INT, l_s("line info overflow"));
f->lineinfo[fs->nlineinfo++] = -(ls->lastline - (fs->lastline+1));
}
luaM_growvector(fs->L, f->lineinfo, fs->nlineinfo, f->sizelineinfo, int,
MAX_INT, "line info overflow");
MAX_INT, l_s("line info overflow"));
f->lineinfo[fs->nlineinfo++] = fs->pc;
fs->lastline = ls->lastline;
}
@@ -660,7 +660,7 @@ int luaK_code2 (FuncState *fs, OpCode o, int arg1, int arg2) {
codelineinfo(fs);
/* put new instruction in code array */
luaM_growvector(fs->L, f->code, fs->pc, f->sizecode, Instruction,
MAX_INT, "code size overflow");
MAX_INT, l_s("code size overflow"));
f->code[fs->pc] = i;
return fs->pc++;
}