aboutsummaryrefslogtreecommitdiff
path: root/lcode.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-02-23 14:17:25 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-02-23 14:17:25 -0300
commit39b79783297bee79db9853b63d199e120a009a8f (patch)
treec738c621c4c28d8822c2f785400786301985273b /lcode.c
parentd164e2294f73d8e69f00d95a66014514b2dd0ec0 (diff)
downloadlua-39b79783297bee79db9853b63d199e120a009a8f.tar.gz
lua-39b79783297bee79db9853b63d199e120a009a8f.tar.bz2
lua-39b79783297bee79db9853b63d199e120a009a8f.zip
first (big) step to support wide chars
Diffstat (limited to 'lcode.c')
-rw-r--r--lcode.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/lcode.c b/lcode.c
index 1c3ffedd..6997272f 100644
--- a/lcode.c
+++ b/lcode.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lcode.c,v 1.61 2001/02/08 11:19:10 roberto Exp roberto $ 2** $Id: lcode.c,v 1.62 2001/02/12 19:21:19 roberto Exp roberto $
3** Code generator for Lua 3** Code generator for Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -18,7 +18,7 @@
18#include "lparser.h" 18#include "lparser.h"
19 19
20 20
21void luaK_error (LexState *ls, const char *msg) { 21void luaK_error (LexState *ls, const l_char *msg) {
22 luaX_error(ls, msg, ls->t.token); 22 luaX_error(ls, msg, ls->t.token);
23} 23}
24 24
@@ -53,7 +53,7 @@ static void luaK_fixjump (FuncState *fs, int pc, int dest) {
53 else { /* jump is relative to position following jump instruction */ 53 else { /* jump is relative to position following jump instruction */
54 int offset = dest-(pc+1); 54 int offset = dest-(pc+1);
55 if (abs(offset) > MAXARG_S) 55 if (abs(offset) > MAXARG_S)
56 luaK_error(fs->ls, "control structure too long"); 56 luaK_error(fs->ls, l_s("control structure too long"));
57 SETARG_S(*jmp, offset); 57 SETARG_S(*jmp, offset);
58 } 58 }
59} 59}
@@ -99,7 +99,7 @@ void luaK_deltastack (FuncState *fs, int delta) {
99 fs->stacklevel += delta; 99 fs->stacklevel += delta;
100 if (fs->stacklevel > fs->f->maxstacksize) { 100 if (fs->stacklevel > fs->f->maxstacksize) {
101 if (fs->stacklevel > MAXSTACK) 101 if (fs->stacklevel > MAXSTACK)
102 luaK_error(fs->ls, "function or expression too complex"); 102 luaK_error(fs->ls, l_s("function or expression too complex"));
103 fs->f->maxstacksize = (short)fs->stacklevel; 103 fs->f->maxstacksize = (short)fs->stacklevel;
104 } 104 }
105} 105}
@@ -119,7 +119,7 @@ static int number_constant (FuncState *fs, lua_Number r) {
119 if (f->knum[c] == r) return c; 119 if (f->knum[c] == r) return c;
120 /* not found; create a new entry */ 120 /* not found; create a new entry */
121 luaM_growvector(fs->L, f->knum, fs->nknum, f->sizeknum, lua_Number, 121 luaM_growvector(fs->L, f->knum, fs->nknum, f->sizeknum, lua_Number,
122 MAXARG_U, "constant table overflow"); 122 MAXARG_U, l_s("constant table overflow"));
123 c = fs->nknum++; 123 c = fs->nknum++;
124 f->knum[c] = r; 124 f->knum[c] = r;
125 return c; 125 return c;
@@ -436,11 +436,11 @@ static void codelineinfo (FuncState *fs) {
436 if (ls->lastline > fs->lastline) { 436 if (ls->lastline > fs->lastline) {
437 if (ls->lastline > fs->lastline+1) { 437 if (ls->lastline > fs->lastline+1) {
438 luaM_growvector(fs->L, f->lineinfo, fs->nlineinfo, f->sizelineinfo, int, 438 luaM_growvector(fs->L, f->lineinfo, fs->nlineinfo, f->sizelineinfo, int,
439 MAX_INT, "line info overflow"); 439 MAX_INT, l_s("line info overflow"));
440 f->lineinfo[fs->nlineinfo++] = -(ls->lastline - (fs->lastline+1)); 440 f->lineinfo[fs->nlineinfo++] = -(ls->lastline - (fs->lastline+1));
441 } 441 }
442 luaM_growvector(fs->L, f->lineinfo, fs->nlineinfo, f->sizelineinfo, int, 442 luaM_growvector(fs->L, f->lineinfo, fs->nlineinfo, f->sizelineinfo, int,
443 MAX_INT, "line info overflow"); 443 MAX_INT, l_s("line info overflow"));
444 f->lineinfo[fs->nlineinfo++] = fs->pc; 444 f->lineinfo[fs->nlineinfo++] = fs->pc;
445 fs->lastline = ls->lastline; 445 fs->lastline = ls->lastline;
446 } 446 }
@@ -660,7 +660,7 @@ int luaK_code2 (FuncState *fs, OpCode o, int arg1, int arg2) {
660 codelineinfo(fs); 660 codelineinfo(fs);
661 /* put new instruction in code array */ 661 /* put new instruction in code array */
662 luaM_growvector(fs->L, f->code, fs->pc, f->sizecode, Instruction, 662 luaM_growvector(fs->L, f->code, fs->pc, f->sizecode, Instruction,
663 MAX_INT, "code size overflow"); 663 MAX_INT, l_s("code size overflow"));
664 f->code[fs->pc] = i; 664 f->code[fs->pc] = i;
665 return fs->pc++; 665 return fs->pc++;
666} 666}