diff options
author | Marcin Bukat <marcin.bukat@gmail.com> | 2014-04-02 20:46:06 +0200 |
---|---|---|
committer | Marcin Bukat <marcin.bukat@gmail.com> | 2014-04-02 20:46:06 +0200 |
commit | bfd0179042b0b02fb88748d54e56e7e208bb117f (patch) | |
tree | 42d5fd51574054caaf673420fca1ec962d62d2f2 /apps/plugins/lua/lparser.h | |
parent | 36378988ad4059982742f05f5eb50580b456840a (diff) | |
download | rockbox-bfd0179042b0b02fb88748d54e56e7e208bb117f.tar.gz rockbox-bfd0179042b0b02fb88748d54e56e7e208bb117f.zip |
Revert "Update lua plugin to 5.2.3"
FILE typedef to *void needs more work to not break sim and
application builds. I checked only a few random native builds
unfortunately. Sorry for inconvenience.
Diffstat (limited to 'apps/plugins/lua/lparser.h')
-rw-r--r-- | apps/plugins/lua/lparser.h | 75 |
1 files changed, 19 insertions, 56 deletions
diff --git a/apps/plugins/lua/lparser.h b/apps/plugins/lua/lparser.h index 0346e3c41a..f9b8e24913 100644 --- a/apps/plugins/lua/lparser.h +++ b/apps/plugins/lua/lparser.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lparser.h,v 1.70.1.1 2013/04/12 18:48:47 roberto Exp $ | 2 | ** $Id$ |
3 | ** Lua Parser | 3 | ** Lua Parser |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -23,72 +23,34 @@ typedef enum { | |||
23 | VFALSE, | 23 | VFALSE, |
24 | VK, /* info = index of constant in `k' */ | 24 | VK, /* info = index of constant in `k' */ |
25 | VKNUM, /* nval = numerical value */ | 25 | VKNUM, /* nval = numerical value */ |
26 | VNONRELOC, /* info = result register */ | ||
27 | VLOCAL, /* info = local register */ | 26 | VLOCAL, /* info = local register */ |
28 | VUPVAL, /* info = index of upvalue in 'upvalues' */ | 27 | VUPVAL, /* info = index of upvalue in `upvalues' */ |
29 | VINDEXED, /* t = table register/upvalue; idx = index R/K */ | 28 | VGLOBAL, /* info = index of table; aux = index of global name in `k' */ |
29 | VINDEXED, /* info = table register; aux = index register (or `k') */ | ||
30 | VJMP, /* info = instruction pc */ | 30 | VJMP, /* info = instruction pc */ |
31 | VRELOCABLE, /* info = instruction pc */ | 31 | VRELOCABLE, /* info = instruction pc */ |
32 | VNONRELOC, /* info = result register */ | ||
32 | VCALL, /* info = instruction pc */ | 33 | VCALL, /* info = instruction pc */ |
33 | VVARARG /* info = instruction pc */ | 34 | VVARARG /* info = instruction pc */ |
34 | } expkind; | 35 | } expkind; |
35 | 36 | ||
36 | |||
37 | #define vkisvar(k) (VLOCAL <= (k) && (k) <= VINDEXED) | ||
38 | #define vkisinreg(k) ((k) == VNONRELOC || (k) == VLOCAL) | ||
39 | |||
40 | typedef struct expdesc { | 37 | typedef struct expdesc { |
41 | expkind k; | 38 | expkind k; |
42 | union { | 39 | union { |
43 | struct { /* for indexed variables (VINDEXED) */ | 40 | struct { int info, aux; } s; |
44 | short idx; /* index (R/K) */ | 41 | lua_Number nval; |
45 | lu_byte t; /* table (register or upvalue) */ | ||
46 | lu_byte vt; /* whether 't' is register (VLOCAL) or upvalue (VUPVAL) */ | ||
47 | } ind; | ||
48 | int info; /* for generic use */ | ||
49 | lua_Number nval; /* for VKNUM */ | ||
50 | } u; | 42 | } u; |
51 | int t; /* patch list of `exit when true' */ | 43 | int t; /* patch list of `exit when true' */ |
52 | int f; /* patch list of `exit when false' */ | 44 | int f; /* patch list of `exit when false' */ |
53 | } expdesc; | 45 | } expdesc; |
54 | 46 | ||
55 | 47 | ||
56 | /* description of active local variable */ | 48 | typedef struct upvaldesc { |
57 | typedef struct Vardesc { | 49 | lu_byte k; |
58 | short idx; /* variable index in stack */ | 50 | lu_byte info; |
59 | } Vardesc; | 51 | } upvaldesc; |
60 | |||
61 | |||
62 | /* description of pending goto statements and label statements */ | ||
63 | typedef struct Labeldesc { | ||
64 | TString *name; /* label identifier */ | ||
65 | int pc; /* position in code */ | ||
66 | int line; /* line where it appeared */ | ||
67 | lu_byte nactvar; /* local level where it appears in current block */ | ||
68 | } Labeldesc; | ||
69 | |||
70 | |||
71 | /* list of labels or gotos */ | ||
72 | typedef struct Labellist { | ||
73 | Labeldesc *arr; /* array */ | ||
74 | int n; /* number of entries in use */ | ||
75 | int size; /* array size */ | ||
76 | } Labellist; | ||
77 | |||
78 | |||
79 | /* dynamic structures used by the parser */ | ||
80 | typedef struct Dyndata { | ||
81 | struct { /* list of active local variables */ | ||
82 | Vardesc *arr; | ||
83 | int n; | ||
84 | int size; | ||
85 | } actvar; | ||
86 | Labellist gt; /* list of pending gotos */ | ||
87 | Labellist label; /* list of active labels */ | ||
88 | } Dyndata; | ||
89 | 52 | ||
90 | 53 | ||
91 | /* control of blocks */ | ||
92 | struct BlockCnt; /* defined in lparser.c */ | 54 | struct BlockCnt; /* defined in lparser.c */ |
93 | 55 | ||
94 | 56 | ||
@@ -98,22 +60,23 @@ typedef struct FuncState { | |||
98 | Table *h; /* table to find (and reuse) elements in `k' */ | 60 | Table *h; /* table to find (and reuse) elements in `k' */ |
99 | struct FuncState *prev; /* enclosing function */ | 61 | struct FuncState *prev; /* enclosing function */ |
100 | struct LexState *ls; /* lexical state */ | 62 | struct LexState *ls; /* lexical state */ |
63 | struct lua_State *L; /* copy of the Lua state */ | ||
101 | struct BlockCnt *bl; /* chain of current blocks */ | 64 | struct BlockCnt *bl; /* chain of current blocks */ |
102 | int pc; /* next position to code (equivalent to `ncode') */ | 65 | int pc; /* next position to code (equivalent to `ncode') */ |
103 | int lasttarget; /* 'label' of last 'jump label' */ | 66 | int lasttarget; /* `pc' of last `jump target' */ |
104 | int jpc; /* list of pending jumps to `pc' */ | 67 | int jpc; /* list of pending jumps to `pc' */ |
68 | int freereg; /* first free register */ | ||
105 | int nk; /* number of elements in `k' */ | 69 | int nk; /* number of elements in `k' */ |
106 | int np; /* number of elements in `p' */ | 70 | int np; /* number of elements in `p' */ |
107 | int firstlocal; /* index of first local var (in Dyndata array) */ | 71 | short nlocvars; /* number of elements in `locvars' */ |
108 | short nlocvars; /* number of elements in 'f->locvars' */ | ||
109 | lu_byte nactvar; /* number of active local variables */ | 72 | lu_byte nactvar; /* number of active local variables */ |
110 | lu_byte nups; /* number of upvalues */ | 73 | upvaldesc upvalues[LUAI_MAXUPVALUES]; /* upvalues */ |
111 | lu_byte freereg; /* first free register */ | 74 | unsigned short actvar[LUAI_MAXVARS]; /* declared-variable stack */ |
112 | } FuncState; | 75 | } FuncState; |
113 | 76 | ||
114 | 77 | ||
115 | LUAI_FUNC Closure *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, | 78 | LUAI_FUNC Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, |
116 | Dyndata *dyd, const char *name, int firstchar); | 79 | const char *name); |
117 | 80 | ||
118 | 81 | ||
119 | #endif | 82 | #endif |