The Battle for Wesnoth  1.15.12+dev
Go to the documentation of this file.
1 /*
2 ** $Id: lcode.h $
3 ** Code generator for Lua
4 ** See Copyright Notice in lua.h
5 */
7 #ifndef lcode_h
8 #define lcode_h
10 #include "llex.h"
11 #include "lobject.h"
12 #include "lopcodes.h"
13 #include "lparser.h"
16 /*
17 ** Marks the end of a patch list. It is an invalid value both as an absolute
18 ** address, and as a list link (would link an element to itself).
19 */
20 #define NO_JUMP (-1)
23 /*
24 ** grep "ORDER OPR" if you change these enums (ORDER OP)
25 */
26 typedef enum BinOpr {
27  /* arithmetic operators */
30  /* bitwise operators */
33  /* string operator */
35  /* comparison operators */
38  /* logical operators */
41 } BinOpr;
44 /* true if operation is foldable (that is, it is arithmetic or bitwise) */
45 #define foldbinop(op) ((op) <= OPR_SHR)
48 #define luaK_codeABC(fs,o,a,b,c) luaK_codeABCk(fs,o,a,b,c,0)
54 /* get (pointer to) instruction of given 'expdesc' */
55 #define getinstruction(fs,e) ((fs)->f->code[(e)->])
58 #define luaK_setmultret(fs,e) luaK_setreturns(fs, e, LUA_MULTRET)
60 #define luaK_jumpto(fs,t) luaK_patchlist(fs, luaK_jump(fs), t)
63 LUAI_FUNC int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned int Bx);
64 LUAI_FUNC int luaK_codeAsBx (FuncState *fs, OpCode o, int A, int Bx);
65 LUAI_FUNC int luaK_codeABCk (FuncState *fs, OpCode o, int A,
66  int B, int C, int k);
69 LUAI_FUNC void luaK_fixline (FuncState *fs, int line);
70 LUAI_FUNC void luaK_nil (FuncState *fs, int from, int n);
73 LUAI_FUNC void luaK_int (FuncState *fs, int reg, lua_Integer n);
85 LUAI_FUNC void luaK_setreturns (FuncState *fs, expdesc *e, int nresults);
88 LUAI_FUNC void luaK_ret (FuncState *fs, int first, int nret);
89 LUAI_FUNC void luaK_patchlist (FuncState *fs, int list, int target);
90 LUAI_FUNC void luaK_patchtohere (FuncState *fs, int list);
91 LUAI_FUNC void luaK_concat (FuncState *fs, int *l1, int l2);
93 LUAI_FUNC void luaK_prefix (FuncState *fs, UnOpr op, expdesc *v, int line);
96  expdesc *v2, int line);
98  int ra, int asize, int hsize);
99 LUAI_FUNC void luaK_setlist (FuncState *fs, int base, int nelems, int tostore);
101 LUAI_FUNC l_noret luaK_semerror (LexState *ls, const char *msg);
104 #endif
Definition: lcode.h:37
Definition: lcode.h:28
Definition: lcode.h:36
Definition: lcode.h:32
LUAI_FUNC int luaK_codeABCk(FuncState *fs, OpCode o, int A, int B, int C, int k)
Definition: lcode.cpp:405
#define LUAI_FUNC
Definition: luaconf.h:307
LUAI_FUNC void luaK_exp2val(FuncState *fs, expdesc *e)
Definition: lcode.cpp:973
LUAI_FUNC int luaK_codeAsBx(FuncState *fs, OpCode o, int A, int Bx)
Definition: lcode.cpp:426
LUAI_FUNC void luaK_checkstack(FuncState *fs, int n)
Definition: lcode.cpp:474
LUAI_FUNC void luaK_finish(FuncState *fs)
Definition: lcode.cpp:1790
LUAI_FUNC void luaK_fixline(FuncState *fs, int line)
Definition: lcode.cpp:1730
Definition: lobject.h:65
LUAI_FUNC void luaK_exp2nextreg(FuncState *fs, expdesc *e)
Definition: lcode.cpp:929
LUAI_FUNC void luaK_infix(FuncState *fs, BinOpr op, expdesc *v)
Definition: lcode.cpp:1578
#define l_noret
Definition: llimits.h:178
LUAI_FUNC int luaK_exp2RK(FuncState *fs, expdesc *e)
Definition: lcode.cpp:1015
static void msg(const char *act, debug_info &i, const char *to="", const char *result="")
Definition: debugger.cpp:109
LUAI_FUNC void luaK_dischargevars(FuncState *fs, expdesc *e)
Definition: lcode.cpp:759
Definition: lcode.h:29
Definition: lcode.h:39
LUAI_FUNC void luaK_storevar(FuncState *fs, expdesc *var, expdesc *e)
Definition: lcode.cpp:1035
LUAI_FUNC int luaK_codeABx(FuncState *fs, OpCode o, int A, unsigned int Bx)
Definition: lcode.cpp:416
Definition: lcode.h:32
Definition: lopcodes.h:196
Definition: lcode.h:36
LUA_INTEGER lua_Integer
Definition: lua.h:94
LUAI_FUNC void luaK_patchtohere(FuncState *fs, int list)
Definition: lcode.cpp:311
LUAI_FUNC void luaK_self(FuncState *fs, expdesc *e, expdesc *key)
Definition: lcode.cpp:1072
Definition: lcode.h:51
Definition: lcode.h:31
Definition: lcode.h:36
LUAI_FUNC void luaK_exp2anyregup(FuncState *fs, expdesc *e)
Definition: lcode.cpp:963
LUAI_FUNC void luaK_setreturns(FuncState *fs, expdesc *e, int nresults)
Definition: lcode.cpp:708
LUAI_FUNC void luaK_posfix(FuncState *fs, BinOpr op, expdesc *v1, expdesc *v2, int line)
Definition: lcode.cpp:1646
LUAI_FUNC void luaK_ret(FuncState *fs, int first, int nret)
Definition: lcode.cpp:206
LUAI_FUNC int luaK_exp2anyreg(FuncState *fs, expdesc *e)
Definition: lcode.cpp:941
LUAI_FUNC void luaK_indexed(FuncState *fs, expdesc *t, expdesc *k)
Definition: lcode.cpp:1265
Definition: lcode.h:26
LUAI_FUNC l_noret luaK_semerror(LexState *ls, const char *msg)
Definition: lcode.cpp:45
Definition: lcode.h:28
LUAI_FUNC void luaK_patchlist(FuncState *fs, int list, int target)
Definition: lcode.cpp:305
Definition: lcode.h:51
Definition: lcode.h:28
Definition: lcode.h:31
Definition: lcode.h:28
LUAI_FUNC void luaK_prefix(FuncState *fs, UnOpr op, expdesc *v, int line)
Definition: lcode.cpp:1557
LUAI_FUNC void luaK_goiffalse(FuncState *fs, expdesc *e)
Definition: lcode.cpp:1147
std::size_t i
Definition: function.cpp:940
Definition: lcode.h:39
LUAI_FUNC void luaK_setlist(FuncState *fs, int base, int nelems, int tostore)
Definition: lcode.cpp:1754
LUAI_FUNC void luaK_setoneret(FuncState *fs, expdesc *e)
Definition: lcode.cpp:741
LUAI_FUNC void luaK_settablesize(FuncState *fs, int pc, int ra, int asize, int hsize)
Definition: lcode.cpp:1736
Definition: lcode.h:29
Definition: llex.h:64
Definition: lcode.h:28
LUAI_FUNC int luaK_code(FuncState *fs, Instruction i)
Definition: lcode.cpp:390
LUAI_FUNC int luaK_isKint(expdesc *e)
Definition: lcode.cpp:1215
Definition: lcode.h:51
Definition: lcode.h:37
LUAI_FUNC void luaK_concat(FuncState *fs, int *l1, int l2)
Definition: lcode.cpp:180
Definition: lcode.h:37
LUAI_FUNC void luaK_nil(FuncState *fs, int from, int n)
Definition: lcode.cpp:130
Definition: lcode.h:31
double t
Definition: astarsearch.cpp:64
LUAI_FUNC void luaK_goiftrue(FuncState *fs, expdesc *e)
Definition: lcode.cpp:1120
LUAI_FUNC int luaK_exp2const(FuncState *fs, const expdesc *e, TValue *v)
Definition: lcode.cpp:83
LUAI_FUNC int luaK_getlabel(FuncState *fs)
Definition: lcode.cpp:231
Definition: lcode.h:51
l_uint32 Instruction
Definition: llimits.h:194
#define e
LUAI_FUNC void luaK_int(FuncState *fs, int reg, lua_Integer n)
Definition: lcode.cpp:659
static map_location::DIRECTION n
LUAI_FUNC void luaK_reserveregs(FuncState *fs, int n)
Definition: lcode.cpp:488
LUAI_FUNC int luaK_jump(FuncState *fs)
Definition: lcode.cpp:198