nabaztag_hack_kit 0.1.0.beta3 → 0.1.0.beta8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +7 -2
- data/.gitmodules +3 -0
- data/.travis.yml +2 -2
- data/CHANGELOG.md +17 -2
- data/LICENSE +21 -0
- data/README.md +115 -44
- data/Rakefile +2 -6
- data/bytecode/{Commands.md → _docs/commands.md} +0 -0
- data/bytecode/{Docs.md → _docs/grammar.md} +0 -0
- data/bytecode/_docs/grammar.pdf +0 -0
- data/bytecode/{src → _original}/README.md +0 -0
- data/bytecode/{src → _original}/lib/arp.mtl +0 -0
- data/bytecode/{src → _original}/lib/cfg.mtl +0 -0
- data/bytecode/{src → _original}/lib/choreos.mtl +0 -0
- data/bytecode/{src → _original}/lib/dhcp.mtl +0 -0
- data/bytecode/{src → _original}/lib/dns.mtl +0 -0
- data/bytecode/{src → _original}/lib/http.mtl +0 -0
- data/bytecode/{src → _original}/lib/tcp.mtl +0 -0
- data/bytecode/{src → _original}/lib/udp.mtl +0 -0
- data/bytecode/{src → _original}/lib/util.mtl +0 -0
- data/bytecode/{src → _original}/lib/var.mtl +0 -0
- data/bytecode/{src → _original}/lib/wav.mtl +0 -0
- data/bytecode/{src → _original}/lib/wifi.mtl +0 -0
- data/bytecode/{src → _original}/nominal-ping.mtl +0 -0
- data/bytecode/main.mtl +11 -11
- data/bytecode/test/test.mtl +8 -8
- data/examples/basic/Gemfile +1 -3
- data/examples/basic/config.ru +14 -4
- data/examples/record/Gemfile +0 -5
- data/examples/record/{config.ru.example → config.ru} +2 -2
- data/examples/record/server.rb +0 -2
- data/ext/Makefile +10 -0
- data/ext/bin/mtl_comp +29 -0
- data/{bytecode → ext}/bin/mtl_merge +0 -0
- data/ext/bin/mtl_simu +29 -0
- data/{bytecode/src/mtl → ext}/extconf.rb +0 -0
- data/ext/mtl_linux/.gitignore +7 -0
- data/ext/mtl_linux/LICENSE +21 -0
- data/ext/mtl_linux/Makefile +116 -0
- data/ext/mtl_linux/MetalC.project +196 -0
- data/ext/mtl_linux/conf.bin +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux}/conf.bin.sans_password +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux}/config.txt +0 -0
- data/ext/mtl_linux/inc/log.h +21 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc}/properties.h +0 -0
- data/{bytecode/src/mtl/linux_simuaudio.h → ext/mtl_linux/inc/simu/linux/simuaudio.h} +0 -0
- data/{bytecode/src/mtl/linux_simunet.h → ext/mtl_linux/inc/simu/linux/simunet.h} +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc/simu/win}/simuaudio.h +18 -18
- data/{bytecode/src/mtl → ext/mtl_linux/inc/simu/win}/simunet.h +0 -0
- data/ext/mtl_linux/inc/vcomp/compiler.h +200 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/file.h +11 -11
- data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/filesystem.h +0 -0
- data/ext/mtl_linux/inc/vcomp/interpreter.h +121 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/memory.h +120 -92
- data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/param.h +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/parser.h +27 -27
- data/ext/mtl_linux/inc/vcomp/prodbuffer.h +42 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/resource.h +1 -1
- data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/terminal.h +8 -8
- data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/util.h +7 -7
- data/{bytecode/src/mtl → ext/mtl_linux/inc/vm}/vaudio.h +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc/vm}/vbc.h +1 -1
- data/ext/mtl_linux/inc/vm/vbc_str.h +167 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc/vm}/vinterp.h +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc/vm}/vloader.h +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc/vm}/vlog.h +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc/vm}/vmem.h +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc/vm}/vnet.h +0 -0
- data/ext/mtl_linux/nominal.mtl +3959 -0
- data/ext/mtl_linux/src/comp/main.cpp +123 -0
- data/ext/mtl_linux/src/simu/dumpbc.c +2566 -0
- data/ext/mtl_linux/src/simu/linux/main.cpp +288 -0
- data/ext/mtl_linux/src/simu/linux/simu.c +309 -0
- data/ext/mtl_linux/src/simu/linux/simuaudio.c +44 -0
- data/ext/mtl_linux/src/simu/linux/simunet.c +707 -0
- data/ext/mtl_linux/src/simu/log.c +340 -0
- data/ext/mtl_linux/src/simu/properties.c +368 -0
- data/{bytecode/src/mtl → ext/mtl_linux/src/simu/win}/mp3/GTKANAL.H +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux/src/simu/win}/mp3/LAYER3.C +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux/src/simu/win}/mp3/TABINIT.C +0 -0
- data/ext/mtl_linux/src/simu/win/mp3/common.c +302 -0
- data/ext/mtl_linux/src/simu/win/mp3/dct64_i386.c +316 -0
- data/ext/mtl_linux/src/simu/win/mp3/decode_i386.c +160 -0
- data/ext/mtl_linux/src/simu/win/mp3/huffman.h +332 -0
- data/ext/mtl_linux/src/simu/win/mp3/interface.c +276 -0
- data/{bytecode/src/mtl → ext/mtl_linux/src/simu/win}/mp3/mpg123.h +34 -30
- data/ext/mtl_linux/src/simu/win/mp3/mpglib.h +47 -0
- data/ext/mtl_linux/src/simu/win/simu.c +819 -0
- data/ext/mtl_linux/src/simu/win/simuaudio.c +787 -0
- data/ext/mtl_linux/src/simu/win/simunet.c +489 -0
- data/ext/mtl_linux/src/vcomp/bootstrap.cpp +95 -0
- data/ext/mtl_linux/src/vcomp/compiler.cpp +587 -0
- data/ext/mtl_linux/src/vcomp/compiler_file.cpp +1253 -0
- data/ext/mtl_linux/src/vcomp/compiler_prog.cpp +437 -0
- data/ext/mtl_linux/src/vcomp/compiler_term.cpp +1500 -0
- data/ext/mtl_linux/src/vcomp/compiler_type.cpp +1238 -0
- data/ext/mtl_linux/src/vcomp/compiler_var.cpp +502 -0
- data/ext/mtl_linux/src/vcomp/file.cpp +100 -0
- data/ext/mtl_linux/src/vcomp/interpreter.cpp +93 -0
- data/ext/mtl_linux/src/vcomp/memory.cpp +313 -0
- data/ext/mtl_linux/src/vcomp/parser.cpp +584 -0
- data/ext/mtl_linux/src/vcomp/parser_xml.cpp +137 -0
- data/{bytecode/src/mtl → ext/mtl_linux/src}/vcomp/prodbuffer.cpp +57 -36
- data/ext/mtl_linux/src/vcomp/stdlib_core.cpp +130 -0
- data/ext/mtl_linux/src/vcomp/terminal.cpp +80 -0
- data/{bytecode/src/mtl → ext/mtl_linux/src}/vcomp/util.cpp +18 -11
- data/ext/mtl_linux/src/vm/vaudio.c +830 -0
- data/ext/mtl_linux/src/vm/vinterp.c +1780 -0
- data/ext/mtl_linux/src/vm/vloader.c +139 -0
- data/ext/mtl_linux/src/vm/vlog.c +782 -0
- data/ext/mtl_linux/src/vm/vmem.c +461 -0
- data/ext/mtl_linux/src/vm/vnet.c +298 -0
- data/{bytecode/src/mtl → ext/mtl_linux}/utils/correct_const.sh +0 -0
- data/lib/nabaztag_hack_kit/server.rb +4 -7
- data/lib/nabaztag_hack_kit/version.rb +1 -1
- data/lib/nabaztag_hack_kit.rb +2 -2
- data/nabaztag_hack_kit.gemspec +10 -11
- data/spec/integration/server_spec.rb +3 -3
- data/spec/spec_helper.rb +2 -0
- data/spec/unit/message_spec.rb +12 -18
- data/spec/unit/server_spec.rb +13 -10
- metadata +145 -137
- data/bytecode/bin/mtl_comp +0 -50
- data/bytecode/bin/mtl_simu +0 -49
- data/bytecode/src/mtl/Makefile +0 -42
- data/bytecode/src/mtl/README.md +0 -13
- data/bytecode/src/mtl/bc.cpp +0 -1891
- data/bytecode/src/mtl/dumpbc.c +0 -2566
- data/bytecode/src/mtl/linux_simu.c +0 -271
- data/bytecode/src/mtl/linux_simuaudio.c +0 -16
- data/bytecode/src/mtl/linux_simunet.c +0 -620
- data/bytecode/src/mtl/log.c +0 -297
- data/bytecode/src/mtl/log.h +0 -20
- data/bytecode/src/mtl/main_compiler.cpp +0 -104
- data/bytecode/src/mtl/main_simu.cpp +0 -221
- data/bytecode/src/mtl/mp3/common.c +0 -265
- data/bytecode/src/mtl/mp3/dct64_i386.c +0 -316
- data/bytecode/src/mtl/mp3/decode_i386.c +0 -155
- data/bytecode/src/mtl/mp3/huffman.h +0 -332
- data/bytecode/src/mtl/mp3/interface.c +0 -258
- data/bytecode/src/mtl/mp3/mpglib.h +0 -44
- data/bytecode/src/mtl/properties.c +0 -293
- data/bytecode/src/mtl/simu.c +0 -750
- data/bytecode/src/mtl/simuaudio.c +0 -662
- data/bytecode/src/mtl/simunet.c +0 -400
- data/bytecode/src/mtl/vaudio.c +0 -677
- data/bytecode/src/mtl/vbc_str.h +0 -166
- data/bytecode/src/mtl/vcomp/Makefile +0 -29
- data/bytecode/src/mtl/vcomp/bootstrap.cpp +0 -89
- data/bytecode/src/mtl/vcomp/compiler.cpp +0 -470
- data/bytecode/src/mtl/vcomp/compiler.h +0 -200
- data/bytecode/src/mtl/vcomp/compiler_file.cpp +0 -929
- data/bytecode/src/mtl/vcomp/compiler_prog.cpp +0 -250
- data/bytecode/src/mtl/vcomp/compiler_term.cpp +0 -1053
- data/bytecode/src/mtl/vcomp/compiler_type.cpp +0 -872
- data/bytecode/src/mtl/vcomp/compiler_var.cpp +0 -289
- data/bytecode/src/mtl/vcomp/file.cpp +0 -79
- data/bytecode/src/mtl/vcomp/interpreter.cpp +0 -85
- data/bytecode/src/mtl/vcomp/interpreter.h +0 -121
- data/bytecode/src/mtl/vcomp/memory.cpp +0 -241
- data/bytecode/src/mtl/vcomp/parser.cpp +0 -427
- data/bytecode/src/mtl/vcomp/parser_xml.cpp +0 -124
- data/bytecode/src/mtl/vcomp/prodbuffer.h +0 -42
- data/bytecode/src/mtl/vcomp/stdlib_core.cpp +0 -122
- data/bytecode/src/mtl/vcomp/terminal.cpp +0 -73
- data/bytecode/src/mtl/vinterp.c +0 -1349
- data/bytecode/src/mtl/vloader.c +0 -127
- data/bytecode/src/mtl/vlog.c +0 -589
- data/bytecode/src/mtl/vmem.c +0 -424
- data/bytecode/src/mtl/vnet.c +0 -255
- data/examples/basic/Procfile +0 -2
- data/examples/basic/server.rb +0 -14
@@ -0,0 +1,437 @@
|
|
1
|
+
//-------------------
|
2
|
+
// MV
|
3
|
+
// version WIN32 et POCKETPC
|
4
|
+
// Sylvain Huet
|
5
|
+
// Derniere mise a jour : 07/01/2003
|
6
|
+
//
|
7
|
+
|
8
|
+
#include <stdio.h>
|
9
|
+
#include <string.h>
|
10
|
+
#include <stdint.h>
|
11
|
+
|
12
|
+
#include "param.h"
|
13
|
+
#include "terminal.h"
|
14
|
+
#include "memory.h"
|
15
|
+
#include "parser.h"
|
16
|
+
#include "prodbuffer.h"
|
17
|
+
#include "compiler.h"
|
18
|
+
#include "interpreter.h"
|
19
|
+
|
20
|
+
|
21
|
+
int Compiler::parseprogram()
|
22
|
+
{
|
23
|
+
int k;
|
24
|
+
|
25
|
+
while(1)
|
26
|
+
{
|
27
|
+
if (k=parseexpression())
|
28
|
+
{
|
29
|
+
return k;
|
30
|
+
}
|
31
|
+
if (!parser->next(0))
|
32
|
+
{
|
33
|
+
return 0;
|
34
|
+
}
|
35
|
+
if (strcmp(parser->token,";"))
|
36
|
+
{
|
37
|
+
parser->giveback();
|
38
|
+
return 0;
|
39
|
+
}
|
40
|
+
bc->addchar(OPdrop);
|
41
|
+
STACKDROP(m); // on supprime le type de l'expression
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
int Compiler::parseexpression()
|
46
|
+
{
|
47
|
+
int k;
|
48
|
+
//~ asm volatile ("int3;");
|
49
|
+
if (k=parsearithm())
|
50
|
+
{
|
51
|
+
return k;
|
52
|
+
}
|
53
|
+
//~ PRINTF(m)(LOG_COMPILER,"Compiler : parseexp arithm\n");
|
54
|
+
|
55
|
+
if (!parser->next(0))
|
56
|
+
{
|
57
|
+
return 0;
|
58
|
+
}
|
59
|
+
if (strcmp(parser->token,"::"))
|
60
|
+
{
|
61
|
+
parser->giveback();
|
62
|
+
return 0;
|
63
|
+
}
|
64
|
+
if (k=parseexpression())
|
65
|
+
{
|
66
|
+
return k; // r�cursion
|
67
|
+
}
|
68
|
+
|
69
|
+
if (k=createnodetuple(2))
|
70
|
+
{
|
71
|
+
return k;
|
72
|
+
}
|
73
|
+
if (k=copytype(VALTOPNT(TABGET(stdtypes,STDTYPE_fun__u0_list_u0__list_u0))))
|
74
|
+
{
|
75
|
+
return k;
|
76
|
+
}
|
77
|
+
if (k=unif_argfun())
|
78
|
+
{
|
79
|
+
return k;
|
80
|
+
}
|
81
|
+
|
82
|
+
bc->addchar(OPdeftabb);
|
83
|
+
bc->addchar(2);
|
84
|
+
|
85
|
+
return 0;
|
86
|
+
}
|
87
|
+
|
88
|
+
|
89
|
+
int Compiler::parsearithm()
|
90
|
+
{
|
91
|
+
int k;
|
92
|
+
|
93
|
+
if (k=parsea1())
|
94
|
+
{
|
95
|
+
return k;
|
96
|
+
}
|
97
|
+
while(1)
|
98
|
+
{
|
99
|
+
if (!parser->next(0))
|
100
|
+
{
|
101
|
+
return 0;
|
102
|
+
}
|
103
|
+
if ((strcmp(parser->token,"&&"))&&(strcmp(parser->token,"||")))
|
104
|
+
{
|
105
|
+
parser->giveback();
|
106
|
+
return 0;
|
107
|
+
}
|
108
|
+
bc->addchar(OPdup);
|
109
|
+
if (strcmp(parser->token,"&&"))
|
110
|
+
{
|
111
|
+
bc->addchar(OPnon);
|
112
|
+
}
|
113
|
+
bc->addchar(OPelse);
|
114
|
+
int bc_i=bc->getsize();
|
115
|
+
bc->addshort(0); // on pr�pare le champ pour le saut
|
116
|
+
bc->addchar(OPdrop);
|
117
|
+
if (k=parsea1())
|
118
|
+
{
|
119
|
+
return k;
|
120
|
+
}
|
121
|
+
bc->setshort(bc_i,bc->getsize()); // on r�gle le saut
|
122
|
+
|
123
|
+
if (k=unif(VALTOPNT(STACKGET(m,0)),VALTOPNT(TABGET(stdtypes,STDTYPE_I))))
|
124
|
+
{
|
125
|
+
return k;
|
126
|
+
}
|
127
|
+
STACKDROP(m);
|
128
|
+
if (k=unif(VALTOPNT(STACKGET(m,0)),VALTOPNT(TABGET(stdtypes,STDTYPE_I))))
|
129
|
+
{
|
130
|
+
return k;
|
131
|
+
}
|
132
|
+
}
|
133
|
+
}
|
134
|
+
|
135
|
+
|
136
|
+
int Compiler::parsea1()
|
137
|
+
{
|
138
|
+
int k;
|
139
|
+
|
140
|
+
if ((parser->next(0))&&(!strcmp(parser->token,"!")))
|
141
|
+
{
|
142
|
+
if (k=parsea1())
|
143
|
+
{
|
144
|
+
return k;
|
145
|
+
}
|
146
|
+
bc->addchar(OPnon);
|
147
|
+
if (k=unif(VALTOPNT(STACKGET(m,0)),VALTOPNT(TABGET(stdtypes,STDTYPE_I))))
|
148
|
+
{
|
149
|
+
return k;
|
150
|
+
}
|
151
|
+
return 0;
|
152
|
+
}
|
153
|
+
parser->giveback();
|
154
|
+
return parsea2();
|
155
|
+
}
|
156
|
+
|
157
|
+
int Compiler::parsea2()
|
158
|
+
{
|
159
|
+
int k,op,typ;
|
160
|
+
|
161
|
+
if (k=parsea3())
|
162
|
+
{
|
163
|
+
return k;
|
164
|
+
}
|
165
|
+
while(1)
|
166
|
+
{
|
167
|
+
if (!parser->next(0))
|
168
|
+
{
|
169
|
+
return 0;
|
170
|
+
}
|
171
|
+
if (!strcmp(parser->token,"=="))
|
172
|
+
{
|
173
|
+
op=OPeq;
|
174
|
+
typ=0;
|
175
|
+
}
|
176
|
+
else if (!strcmp(parser->token,"!="))
|
177
|
+
{
|
178
|
+
op=OPne;
|
179
|
+
typ=0;
|
180
|
+
}
|
181
|
+
else if (!strcmp(parser->token,"<"))
|
182
|
+
{
|
183
|
+
op=OPlt;
|
184
|
+
typ=1;
|
185
|
+
}
|
186
|
+
else if (!strcmp(parser->token,">"))
|
187
|
+
{
|
188
|
+
op=OPgt;
|
189
|
+
typ=1;
|
190
|
+
}
|
191
|
+
else if (!strcmp(parser->token,"<="))
|
192
|
+
{
|
193
|
+
op=OPle;
|
194
|
+
typ=1;
|
195
|
+
}
|
196
|
+
else if (!strcmp(parser->token,">="))
|
197
|
+
{
|
198
|
+
op=OPge;
|
199
|
+
typ=1;
|
200
|
+
}
|
201
|
+
else
|
202
|
+
{
|
203
|
+
parser->giveback();
|
204
|
+
return 0;
|
205
|
+
}
|
206
|
+
if (k=parsea3())
|
207
|
+
{
|
208
|
+
return k;
|
209
|
+
}
|
210
|
+
bc->addchar(op);
|
211
|
+
|
212
|
+
if (k=unif(VALTOPNT(STACKGET(m,0)),VALTOPNT(STACKGET(m,1))))
|
213
|
+
{
|
214
|
+
return k;
|
215
|
+
}
|
216
|
+
STACKDROP(m);
|
217
|
+
if (typ==1)
|
218
|
+
{
|
219
|
+
if (k=unif(VALTOPNT(STACKGET(m,0)),VALTOPNT(TABGET(stdtypes,STDTYPE_I))))
|
220
|
+
{
|
221
|
+
return k;
|
222
|
+
}
|
223
|
+
}
|
224
|
+
STACKSET(m,0,TABGET(stdtypes,STDTYPE_I));
|
225
|
+
}
|
226
|
+
}
|
227
|
+
|
228
|
+
int Compiler::parsea3()
|
229
|
+
{
|
230
|
+
int k,op,typ;
|
231
|
+
|
232
|
+
if (k=parsea4())
|
233
|
+
{
|
234
|
+
return k;
|
235
|
+
}
|
236
|
+
while(1)
|
237
|
+
{
|
238
|
+
if (!parser->next(0))
|
239
|
+
{
|
240
|
+
return 0;
|
241
|
+
}
|
242
|
+
if (!strcmp(parser->token,"+"))
|
243
|
+
{
|
244
|
+
op=OPadd;
|
245
|
+
typ=1;
|
246
|
+
}
|
247
|
+
else if (!strcmp(parser->token,"-"))
|
248
|
+
{
|
249
|
+
op=OPsub;
|
250
|
+
typ=1;
|
251
|
+
}
|
252
|
+
else
|
253
|
+
{
|
254
|
+
parser->giveback();
|
255
|
+
return 0;
|
256
|
+
}
|
257
|
+
if (k=parsea4())
|
258
|
+
{
|
259
|
+
return k;
|
260
|
+
}
|
261
|
+
bc->addchar(op);
|
262
|
+
|
263
|
+
intptr_t* ptyp;
|
264
|
+
if (typ==1)
|
265
|
+
{
|
266
|
+
ptyp=VALTOPNT(TABGET(stdtypes,STDTYPE_I));
|
267
|
+
}
|
268
|
+
if (k=unif(VALTOPNT(STACKGET(m,0)),ptyp))
|
269
|
+
{
|
270
|
+
return k;
|
271
|
+
}
|
272
|
+
STACKDROP(m);
|
273
|
+
if (k=unif(VALTOPNT(STACKGET(m,0)),ptyp))
|
274
|
+
{
|
275
|
+
return k;
|
276
|
+
}
|
277
|
+
}
|
278
|
+
}
|
279
|
+
|
280
|
+
int Compiler::parsea4()
|
281
|
+
{
|
282
|
+
int k,op,typ;
|
283
|
+
|
284
|
+
if (k=parsea5())
|
285
|
+
{
|
286
|
+
return k;
|
287
|
+
}
|
288
|
+
while(1)
|
289
|
+
{
|
290
|
+
if (!parser->next(0))
|
291
|
+
{
|
292
|
+
return 0;
|
293
|
+
}
|
294
|
+
if (!strcmp(parser->token,"*"))
|
295
|
+
{
|
296
|
+
op=OPmul;
|
297
|
+
typ=1;
|
298
|
+
}
|
299
|
+
else if (!strcmp(parser->token,"/"))
|
300
|
+
{
|
301
|
+
op=OPdiv;
|
302
|
+
typ=1;
|
303
|
+
}
|
304
|
+
else if (!strcmp(parser->token,"%"))
|
305
|
+
{
|
306
|
+
op=OPmod;
|
307
|
+
typ=1;
|
308
|
+
}
|
309
|
+
else
|
310
|
+
{
|
311
|
+
parser->giveback();
|
312
|
+
return 0;
|
313
|
+
}
|
314
|
+
if (k=parsea5())
|
315
|
+
{
|
316
|
+
return k;
|
317
|
+
}
|
318
|
+
bc->addchar(op);
|
319
|
+
|
320
|
+
intptr_t* ptyp;
|
321
|
+
if (typ==1)
|
322
|
+
{
|
323
|
+
ptyp=VALTOPNT(TABGET(stdtypes,STDTYPE_I));
|
324
|
+
}
|
325
|
+
if (k=unif(VALTOPNT(STACKGET(m,0)),ptyp))
|
326
|
+
{
|
327
|
+
return k;
|
328
|
+
}
|
329
|
+
STACKDROP(m);
|
330
|
+
if (k=unif(VALTOPNT(STACKGET(m,0)),ptyp))
|
331
|
+
{
|
332
|
+
return k;
|
333
|
+
}
|
334
|
+
}
|
335
|
+
}
|
336
|
+
|
337
|
+
int Compiler::parsea5()
|
338
|
+
{
|
339
|
+
int k,op;
|
340
|
+
|
341
|
+
if (k=parsea6())
|
342
|
+
{
|
343
|
+
return k;
|
344
|
+
}
|
345
|
+
while(1)
|
346
|
+
{
|
347
|
+
if (!parser->next(0))
|
348
|
+
{
|
349
|
+
return 0;
|
350
|
+
}
|
351
|
+
if (!strcmp(parser->token,"&"))
|
352
|
+
{
|
353
|
+
op=OPand;
|
354
|
+
}
|
355
|
+
else if (!strcmp(parser->token,"|"))
|
356
|
+
{
|
357
|
+
op=OPor;
|
358
|
+
}
|
359
|
+
else if (!strcmp(parser->token,"^"))
|
360
|
+
{
|
361
|
+
op=OPeor;
|
362
|
+
}
|
363
|
+
else if (!strcmp(parser->token,"<<"))
|
364
|
+
{
|
365
|
+
op=OPshl;
|
366
|
+
}
|
367
|
+
else if (!strcmp(parser->token,">>"))
|
368
|
+
{
|
369
|
+
op=OPshr;
|
370
|
+
}
|
371
|
+
else
|
372
|
+
{
|
373
|
+
parser->giveback();
|
374
|
+
return 0;
|
375
|
+
}
|
376
|
+
if (k=parsea6())
|
377
|
+
{
|
378
|
+
return k;
|
379
|
+
}
|
380
|
+
bc->addchar(op);
|
381
|
+
|
382
|
+
if (k=unif(VALTOPNT(STACKGET(m,0)),VALTOPNT(TABGET(stdtypes,STDTYPE_I))))
|
383
|
+
{
|
384
|
+
return k;
|
385
|
+
}
|
386
|
+
STACKDROP(m);
|
387
|
+
if (k=unif(VALTOPNT(STACKGET(m,0)),VALTOPNT(TABGET(stdtypes,STDTYPE_I))))
|
388
|
+
{
|
389
|
+
return k;
|
390
|
+
}
|
391
|
+
}
|
392
|
+
}
|
393
|
+
|
394
|
+
int Compiler::parsea6()
|
395
|
+
{
|
396
|
+
int k;
|
397
|
+
|
398
|
+
if (!parser->next(0))
|
399
|
+
{
|
400
|
+
return parseterm();
|
401
|
+
}
|
402
|
+
|
403
|
+
if (!strcmp(parser->token,"-"))
|
404
|
+
{
|
405
|
+
if (!parser->next(0))
|
406
|
+
{
|
407
|
+
return parsea6();
|
408
|
+
}
|
409
|
+
if (isdecimal(parser->token)) // gestion des entiers
|
410
|
+
{
|
411
|
+
int i=-mtl_atoi(parser->token);
|
412
|
+
bc->addchar(OPint);
|
413
|
+
bc->addint(i);
|
414
|
+
return STACKPUSH(m,TABGET(stdtypes,STDTYPE_I));
|
415
|
+
}
|
416
|
+
parser->giveback();
|
417
|
+
if (k=parsea6())
|
418
|
+
{
|
419
|
+
return k;
|
420
|
+
}
|
421
|
+
bc->addchar(OPneg);
|
422
|
+
return unif(VALTOPNT(STACKGET(m,0)),VALTOPNT(TABGET(stdtypes,STDTYPE_I)));
|
423
|
+
}
|
424
|
+
else if (!strcmp(parser->token,"~"))
|
425
|
+
{
|
426
|
+
if (k=parsea6())
|
427
|
+
{
|
428
|
+
return k;
|
429
|
+
}
|
430
|
+
bc->addchar(OPnot);
|
431
|
+
return unif(VALTOPNT(STACKGET(m,0)),VALTOPNT(TABGET(stdtypes,STDTYPE_I)));
|
432
|
+
}
|
433
|
+
parser->giveback();
|
434
|
+
return parseterm();
|
435
|
+
}
|
436
|
+
|
437
|
+
|