The Battle for Wesnoth  1.15.2+dev
Go to the documentation of this file.
1 /*
2 ** $Id: lcode.h,v 2017/04/19 17:20:42 roberto Exp $
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 {
37 } BinOpr;
43 /* get (pointer to) instruction of given 'expdesc' */
44 #define getinstruction(fs,e) ((fs)->f->code[(e)->])
46 #define luaK_codeAsBx(fs,o,A,sBx) luaK_codeABx(fs,o,A,(sBx)+MAXARG_sBx)
48 #define luaK_setmultret(fs,e) luaK_setreturns(fs, e, LUA_MULTRET)
50 #define luaK_jumpto(fs,t) luaK_patchlist(fs, luaK_jump(fs), t)
52 LUAI_FUNC int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned int Bx);
53 LUAI_FUNC int luaK_codeABC (FuncState *fs, OpCode o, int A, int B, int C);
54 LUAI_FUNC int luaK_codek (FuncState *fs, int reg, int k);
55 LUAI_FUNC void luaK_fixline (FuncState *fs, int line);
56 LUAI_FUNC void luaK_nil (FuncState *fs, int from, int n);
72 LUAI_FUNC void luaK_setreturns (FuncState *fs, expdesc *e, int nresults);
75 LUAI_FUNC void luaK_ret (FuncState *fs, int first, int nret);
76 LUAI_FUNC void luaK_patchlist (FuncState *fs, int list, int target);
77 LUAI_FUNC void luaK_patchtohere (FuncState *fs, int list);
78 LUAI_FUNC void luaK_patchclose (FuncState *fs, int list, int level);
79 LUAI_FUNC void luaK_concat (FuncState *fs, int *l1, int l2);
81 LUAI_FUNC void luaK_prefix (FuncState *fs, UnOpr op, expdesc *v, int line);
84  expdesc *v2, int line);
85 LUAI_FUNC void luaK_setlist (FuncState *fs, int base, int nelems, int tostore);
88 #endif
Definition: lcode.h:34
Definition: lcode.h:27
Definition: lcode.h:33
Definition: lcode.h:31
#define LUAI_FUNC
Definition: luaconf.h:282
LUAI_FUNC void luaK_exp2val(FuncState *fs, expdesc *e)
Definition: lcode.cpp:744
LUAI_FUNC void luaK_checkstack(FuncState *fs, int n)
Definition: lcode.cpp:361
LUAI_FUNC void luaK_fixline(FuncState *fs, int line)
Definition: lcode.cpp:1177
LUAI_FUNC void luaK_exp2nextreg(FuncState *fs, expdesc *e)
Definition: lcode.cpp:703
LUAI_FUNC void luaK_infix(FuncState *fs, BinOpr op, expdesc *v)
Definition: lcode.cpp:1086
LUAI_FUNC int luaK_exp2RK(FuncState *fs, expdesc *e)
Definition: lcode.cpp:758
LUAI_FUNC void luaK_dischargevars(FuncState *fs, expdesc *e)
Definition: lcode.cpp:556
Definition: lcode.h:29
LUAI_FUNC int luaK_codeABC(FuncState *fs, OpCode o, int A, int B, int C)
Definition: lcode.cpp:312
Definition: lcode.h:35
LUAI_FUNC int luaK_stringK(FuncState *fs, TString *s)
Definition: lcode.cpp:458
LUAI_FUNC void luaK_storevar(FuncState *fs, expdesc *var, expdesc *e)
Definition: lcode.cpp:782
LUAI_FUNC int luaK_codeABx(FuncState *fs, OpCode o, int A, unsigned int Bx)
Definition: lcode.cpp:324
Definition: lcode.h:31
Definition: lopcodes.h:167
Definition: lcode.h:33
LUAI_FUNC int luaK_codek(FuncState *fs, int reg, int k)
Definition: lcode.cpp:346
LUA_INTEGER lua_Integer
Definition: lua.h:93
LUAI_FUNC void luaK_patchtohere(FuncState *fs, int list)
Definition: lcode.cpp:252
LUAI_FUNC void luaK_self(FuncState *fs, expdesc *e, expdesc *key)
Definition: lcode.cpp:809
Definition: lcode.h:40
Definition: lcode.h:30
LUAI_FUNC void luaK_patchclose(FuncState *fs, int list, int level)
Definition: lcode.cpp:278
Definition: lcode.h:33
LUAI_FUNC void luaK_exp2anyregup(FuncState *fs, expdesc *e)
Definition: lcode.cpp:734
LUAI_FUNC void luaK_setreturns(FuncState *fs, expdesc *e, int nresults)
Definition: lcode.cpp:515
LUAI_FUNC void luaK_posfix(FuncState *fs, BinOpr op, expdesc *v1, expdesc *v2, int line)
Definition: lcode.cpp:1124
LUAI_FUNC void luaK_ret(FuncState *fs, int first, int nret)
Definition: lcode.cpp:149
LUAI_FUNC int luaK_exp2anyreg(FuncState *fs, expdesc *e)
Definition: lcode.cpp:715
LUAI_FUNC void luaK_indexed(FuncState *fs, expdesc *t, expdesc *k)
Definition: lcode.cpp:946
Definition: lcode.h:26
Definition: lcode.h:27
LUAI_FUNC void luaK_patchlist(FuncState *fs, int list, int target)
Definition: lcode.cpp:263
Definition: lcode.h:40
Definition: lcode.h:27
Definition: lcode.h:30
Definition: lcode.h:27
LUAI_FUNC void luaK_prefix(FuncState *fs, UnOpr op, expdesc *v, int line)
Definition: lcode.cpp:1066
LUAI_FUNC void luaK_goiffalse(FuncState *fs, expdesc *e)
Definition: lcode.cpp:884
Definition: lcode.h:35
LUAI_FUNC void luaK_setlist(FuncState *fs, int base, int nelems, int tostore)
Definition: lcode.cpp:1189
LUAI_FUNC void luaK_setoneret(FuncState *fs, expdesc *e)
Definition: lcode.cpp:539
Definition: lcode.h:28
static map_location::DIRECTION s
LUAI_FUNC int luaK_intK(FuncState *fs, lua_Integer n)
Definition: lcode.cpp:471
Definition: lcode.h:27
Definition: lcode.h:40
Definition: lcode.h:34
LUAI_FUNC void luaK_concat(FuncState *fs, int *l1, int l2)
Definition: lcode.cpp:116
Definition: lcode.h:34
LUAI_FUNC void luaK_nil(FuncState *fs, int from, int n)
Definition: lcode.cpp:64
Definition: lcode.h:30
double t
Definition: astarsearch.cpp:64
LUAI_FUNC void luaK_goiftrue(FuncState *fs, expdesc *e)
Definition: lcode.cpp:857
LUAI_FUNC int luaK_getlabel(FuncState *fs)
Definition: lcode.cpp:168
Definition: lcode.h:40
#define e
static map_location::DIRECTION n
LUAI_FUNC void luaK_reserveregs(FuncState *fs, int n)
Definition: lcode.cpp:375
LUAI_FUNC int luaK_jump(FuncState *fs)
Definition: lcode.cpp:136