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
@@ -16,110 +16,131 @@
|
|
16
16
|
|
17
17
|
Prodbuffer::Prodbuffer()
|
18
18
|
{
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
size=PRODBUFFER_FIRSTSIZE;
|
20
|
+
buffer=new char[size];
|
21
|
+
index=0;
|
22
22
|
};
|
23
23
|
|
24
24
|
Prodbuffer::~Prodbuffer()
|
25
25
|
{
|
26
|
-
|
26
|
+
delete buffer;
|
27
27
|
};
|
28
28
|
|
29
29
|
|
30
30
|
// initialiation du buffer (à appeler au début de toute nouvelle production)
|
31
31
|
void Prodbuffer::reinit()
|
32
32
|
{
|
33
|
-
|
33
|
+
index=0;
|
34
34
|
}
|
35
35
|
|
36
36
|
void Prodbuffer::bigger()
|
37
37
|
{
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
38
|
+
char* newbuf=new char[size*2];
|
39
|
+
memcpy(newbuf,buffer,size);
|
40
|
+
delete buffer;
|
41
|
+
size*=2;
|
42
|
+
buffer=newbuf;
|
43
43
|
}
|
44
44
|
|
45
45
|
// ajout d'un caractère en fin de buffer
|
46
46
|
void Prodbuffer::addchar(char c)
|
47
47
|
{
|
48
|
-
|
49
|
-
|
48
|
+
if (index>=size)
|
49
|
+
{
|
50
|
+
bigger();
|
51
|
+
}
|
52
|
+
buffer[index++]=c;
|
50
53
|
}
|
51
54
|
|
52
55
|
// printf à la suite du buffer
|
53
56
|
void Prodbuffer::printf(const char *format, ...)
|
54
57
|
{
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
58
|
+
va_list arglist;
|
59
|
+
int sizeout;
|
60
|
+
|
61
|
+
va_start(arglist,format);
|
62
|
+
while(((sizeout=vsnprintf(buffer+index,size-index-1,format,arglist))<0)||(sizeout>=size-index-1))
|
63
|
+
{
|
64
|
+
bigger();
|
65
|
+
}
|
66
|
+
va_end(arglist);
|
67
|
+
index+=sizeout;
|
62
68
|
}
|
63
69
|
|
64
70
|
// ajout d'un entier en fin de buffer
|
65
71
|
void Prodbuffer::addint(int i)
|
66
72
|
{
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
73
|
+
addchar(i);
|
74
|
+
i>>=8;
|
75
|
+
addchar(i);
|
76
|
+
i>>=8;
|
77
|
+
addchar(i);
|
78
|
+
i>>=8;
|
79
|
+
addchar(i);
|
71
80
|
}
|
72
81
|
|
73
82
|
// ajout d'un short en fin de buffer
|
74
83
|
void Prodbuffer::addshort(int i)
|
75
84
|
{
|
76
|
-
|
77
|
-
|
85
|
+
addchar(i);
|
86
|
+
i>>=8;
|
87
|
+
addchar(i);
|
78
88
|
}
|
79
89
|
|
80
90
|
// ajout d'une chaîne
|
81
91
|
void Prodbuffer::addstr(char *src,int len)
|
82
92
|
{
|
83
93
|
// addint(len);
|
84
|
-
|
94
|
+
int i;
|
95
|
+
for(i=0; i<len; i++)
|
96
|
+
{
|
97
|
+
addchar(*(src++));
|
98
|
+
}
|
85
99
|
}
|
86
100
|
|
87
101
|
// modification d'un caractère dans le buffer
|
88
102
|
void Prodbuffer::setchar(int ind,char c)
|
89
103
|
{
|
90
|
-
|
104
|
+
buffer[ind]=c;
|
91
105
|
}
|
92
106
|
|
93
107
|
// modification d'un entier dans le buffer
|
94
108
|
void Prodbuffer::setint(int ind,int i)
|
95
109
|
{
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
110
|
+
setchar(ind,i);
|
111
|
+
i>>=8;
|
112
|
+
setchar(ind+1,i);
|
113
|
+
i>>=8;
|
114
|
+
setchar(ind+2,i);
|
115
|
+
i>>=8;
|
116
|
+
setchar(ind+3,i);
|
100
117
|
}
|
101
118
|
|
102
119
|
// modification d'un short dans le buffer
|
103
120
|
void Prodbuffer::setshort(int ind,int i)
|
104
121
|
{
|
105
|
-
|
106
|
-
|
122
|
+
setchar(ind,i);
|
123
|
+
i>>=8;
|
124
|
+
setchar(ind+1,i);
|
107
125
|
}
|
108
126
|
|
109
127
|
// diminue la taille actuelle
|
110
128
|
void Prodbuffer::cut(int len)
|
111
129
|
{
|
112
|
-
|
130
|
+
if ((len>=0)&&(len<index))
|
131
|
+
{
|
132
|
+
index=len;
|
133
|
+
}
|
113
134
|
}
|
114
135
|
|
115
136
|
// retourne la taille actuelle
|
116
137
|
int Prodbuffer::getsize()
|
117
138
|
{
|
118
|
-
|
139
|
+
return index;
|
119
140
|
}
|
120
141
|
|
121
142
|
// retourne un pointeur vers le début du buffer
|
122
143
|
char* Prodbuffer::getstart()
|
123
144
|
{
|
124
|
-
|
145
|
+
return buffer;
|
125
146
|
}
|
@@ -0,0 +1,130 @@
|
|
1
|
+
//-------------------
|
2
|
+
// MV
|
3
|
+
// version WIN32 et POCKETPC
|
4
|
+
// Sylvain Huet
|
5
|
+
// Premiere version : 07/01/2003
|
6
|
+
// Derniere mise a jour : 07/01/2003
|
7
|
+
//
|
8
|
+
|
9
|
+
#include "param.h"
|
10
|
+
#include <stdio.h>
|
11
|
+
#include <stdint.h>
|
12
|
+
|
13
|
+
#include <stdlib.h>
|
14
|
+
#include <string.h>
|
15
|
+
#include <time.h>
|
16
|
+
#include <math.h>
|
17
|
+
|
18
|
+
|
19
|
+
#include "terminal.h"
|
20
|
+
#include "prodbuffer.h"
|
21
|
+
#include "memory.h"
|
22
|
+
#include "util.h"
|
23
|
+
#include "interpreter.h"
|
24
|
+
#include "parser.h"
|
25
|
+
#include "compiler.h"
|
26
|
+
|
27
|
+
|
28
|
+
// types de base
|
29
|
+
#define NBcore 119 /******** A ACTUALISER! ************/
|
30
|
+
// mnemonic
|
31
|
+
const char* corename[]=
|
32
|
+
/* 1*/ {NULL,NULL,NULL,NULL,NULL,"hd","tl","Secholn","Secho","Iecholn", //10
|
33
|
+
/* 2*/"Iecho","time_ms","tabnew","abs","min","max","rand","srand", //10+8
|
34
|
+
/* 3*/"time","strnew","strset","strcpy","vstrcmp","strfind","strfindrev","strlen", //10+8+8
|
35
|
+
/* 4*/"strget","strsub","strcat","tablen","strcatlist","led","motorset","motorget", //10+8+8+8
|
36
|
+
/* 5*/"fixarg1","fixarg2","fixarg3","fixarg4","fixarg5","fixarg6","fixarg7","fixarg8", //10+8+8+8+8
|
37
|
+
/* 6*/"button2","button3","playStart","playFeed","playStop","recStart","recStop","recVol", //10+8+8+8+8+8
|
38
|
+
/* 7*/"load","gc","save","bytecode","loopcb", //10+8+8+8+8+8+5
|
39
|
+
/* 8*/"udpStart","udpCb","udpStop","udpSend","tcpOpen","tcpClose","tcpSend","tcpCb","tcpListen","tcpEnable", //10+8+8+8+8+8+5+10
|
40
|
+
/* 9*/"envget","envset","sndVol","rfidGet","playTime","sndRefresh","sndWrite","sndRead","sndFeed","sndAmpli", //10+8+8+8+8+8+5+10+10
|
41
|
+
/*10*/"netCb","netSend","netState","netMac","netChk","netSetmode","netScan","netAuth","netPmk","netRssi", //10+8+8+8+8+8+5+10+10+10
|
42
|
+
/*11*/"netSeqAdd","strgetword","strputword","atoi","htoi","itoa","ctoa","itoh", //10+8+8+8+8+8+5+10+10+10+8
|
43
|
+
/*12*/"ctoh","itobin2","listswitch","listswitchstr","corePP","corePush","corePull","coreBit0", //10+8+8+8+8+8+5+10+10+10+8+8
|
44
|
+
/*13*/"reboot","flashFirmware","strcmp","adp2wav","wav2adp","alaw2wav","wav2alaw", //10+8+8+8+8+8+5+10+10+10+8+8+7
|
45
|
+
/*14*/"crypt","uncrypt","rfidGetList","rfidRead","rfidWrite", //10+8+8+8+8+8+5+10+10+10+8+8+7+5
|
46
|
+
/*15*/"i2cRead", "i2cWrite", //10+8+8+8+8+8+5+10+10+10+8+8+7+5+2 => 115
|
47
|
+
/*16*/"strright","strcrypt8","loadf","savef"
|
48
|
+
};
|
49
|
+
|
50
|
+
// Opcode
|
51
|
+
int coreval[]=
|
52
|
+
/* 1*/ {0,0,0,0,0,OPhd,OPtl,OPSecholn,OPSecho,OPIecholn,
|
53
|
+
/* 2*/OPIecho,OPtime_ms,OPtabnew,OPabs,OPmin,OPmax,OPrand,OPsrand,
|
54
|
+
/* 3*/OPtime,OPstrnew,OPstrset,OPstrcpy,OPvstrcmp,OPstrfind,OPstrfindrev,OPstrlen,
|
55
|
+
/* 4*/OPstrget,OPstrsub,OPstrcat,OPtablen,OPstrcatlist,OPled,OPmotorset,OPmotorget,
|
56
|
+
/* 5*/OPfixarg,OPfixarg,OPfixarg,OPfixarg,OPfixarg,OPfixarg,OPfixarg,OPfixarg,
|
57
|
+
/* 6*/OPbutton2,OPbutton3,OPplayStart,OPplayFeed,OPplayStop,OPrecStart,OPrecStop,OPrecVol,
|
58
|
+
/* 7*/OPload,OPgc,OPsave,OPbytecode,OPloopcb,
|
59
|
+
/* 8*/OPudpStart,OPudpCb,OPudpStop,OPudpSend,OPtcpOpen,OPtcpClose,OPtcpSend,OPtcpCb,OPtcpListen,OPtcpEnable,
|
60
|
+
/* 9*/OPenvget,OPenvset,OPsndVol,OPrfidGet,OPplayTime,OPsndRefresh,OPsndWrite,OPsndRead,OPsndFeed,OPsndAmpli,
|
61
|
+
/*10*/OPnetCb,OPnetSend,OPnetState,OPnetMac,OPnetChk,OPnetSetmode,OPnetScan,OPnetAuth,OPnetPmk,OPnetRssi,
|
62
|
+
/*11*/OPnetSeqAdd,OPstrgetword,OPstrputword,OPatoi,OPhtoi,OPitoa,OPctoa,OPitoh,
|
63
|
+
/*12*/OPctoh,OPitobin2,OPlistswitch,OPlistswitchstr,OPcorePP,OPcorePush,OPcorePull,OPcoreBit0,
|
64
|
+
/*13*/OPreboot,OPflashFirmware,OPstrcmp,OPadp2wav,OPwav2adp,OPalaw2wav,OPwav2alaw,
|
65
|
+
/*14*/OPcrypt,OPuncrypt,OPrfidGetList,OPrfidRead,OPrfidWrite,
|
66
|
+
/*15*/OPi2cRead, OPi2cWrite,
|
67
|
+
/*16*/OPstrright,OPstrright,OPstrright,OPstrright,
|
68
|
+
};
|
69
|
+
// N args
|
70
|
+
int corecode[]=
|
71
|
+
/* 1*/ {CODE_TYPE,CODE_TYPE,CODE_TYPE,CODE_TYPE,CODE_TYPE,1,1,1,1,1,
|
72
|
+
/* 2*/1,0,2,1,2,2,0,1,
|
73
|
+
/* 3*/0,1,3,5,5,5,5,1,
|
74
|
+
/* 4*/2,3,2,1,1,2,2,1,
|
75
|
+
/* 5*/2,2,2,2,2,2,2,2,
|
76
|
+
/* 6*/0,0,2,3,0,3,0,2,
|
77
|
+
/* 7*/5,0,5,1,1,
|
78
|
+
/* 8*/1,1,1,6,2,1,4,1,1,2,
|
79
|
+
/* 9*/0,1,1,0,0,0,2,1,3,1,
|
80
|
+
/*10*/1,6,0,0,4,3,1,4,2,0,
|
81
|
+
/*11*/2,2,3,1,1,1,1,1,
|
82
|
+
/*12*/1,1,2,2,0,1,1,2,
|
83
|
+
/*13*/2,3,2,5,5,6,6,
|
84
|
+
/*14*/5,5,0,2,3,
|
85
|
+
/*15*/2,3,
|
86
|
+
/*16*/2,3,1,2
|
87
|
+
};
|
88
|
+
// Proto
|
89
|
+
const char* coretype[]=
|
90
|
+
/* 1*/ {"I","S","F","Env","Xml","fun[list u0]u0","fun[list u0]list u0","fun[S]S","fun[S]S","fun[u0]u0",
|
91
|
+
/* 2*/"fun[u0]u0","fun[]I","fun[u0 I]tab u0","fun[I]I","fun[I I]I","fun[I I]I","fun[]I","fun[I]I",
|
92
|
+
/* 3*/"fun[]I","fun[I]S","fun[S I I]S","fun[S I S I I]S","fun[S I S I I]I","fun[S I S I I]I","fun[S I S I I]I","fun[S]I",
|
93
|
+
/* 4*/"fun[S I]I","fun[S I I]S","fun[S S]S","fun[tab u0]I","fun[list S]S","fun[I I]I","fun[I I]I","fun[I]I",
|
94
|
+
/* 5*/"fun[fun[u0]u100 u0]fun[]u100",
|
95
|
+
"fun[fun[u1 u0]u100 u0]fun[u1]u100",
|
96
|
+
"fun[fun[u1 u2 u0]u100 u0]fun[u1 u2]u100",
|
97
|
+
"fun[fun[u1 u2 u3 u0]u100 u0]fun[u1 u2 u3]u100",
|
98
|
+
"fun[fun[u1 u2 u3 u4 u0]u100 u0]fun[u1 u2 u3 u4]u100",
|
99
|
+
"fun[fun[u1 u2 u3 u4 u5 u0]u100 u0]fun[u1 u2 u3 u4 u5]u100",
|
100
|
+
"fun[fun[u1 u2 u3 u4 u5 u6 u0]u100 u0]fun[u1 u2 u3 u4 u5 u6]u100",
|
101
|
+
"fun[fun[u1 u2 u3 u4 u5 u6 u7 u0]u100 u0]fun[u1 u2 u3 u4 u5 u6 u7]u100",
|
102
|
+
/* 6*/"fun[]I","fun[]I","fun[I fun[I]I]I","fun[S I I]I","fun[]I","fun[I I fun[S]I]I","fun[]I","fun[S I]I",
|
103
|
+
/* 7*/"fun[S I S I I]I","fun[]I","fun[S I S I I]I","fun[S]S","fun[fun[]I]fun[]I",
|
104
|
+
/* 8*/"fun[I]I","fun[fun[I S S]I]fun[I S S]I","fun[I]I","fun[I S I S I I]I","fun[S I]I","fun[I]I","fun[I S I I]I","fun[fun[I I S]I]fun[I I S]I","fun[I]I","fun[I I]I",
|
105
|
+
/* 9*/"fun[]S","fun[S]S","fun[I]I","fun[]S","fun[]I","fun[]I","fun[I I]I","fun[I]I","fun[S I I]I","fun[I]I",
|
106
|
+
/*10*/"fun[fun[S S]I]fun[S S]I","fun[S I I S I I]I","fun[]I","fun[]S","fun[S I I I]I","fun[I S I]I","fun[S]list[S S S I I I I]","fun[[S S S I I I I] I I S][S S S I I I I]","fun[S S]S","fun[]I",
|
107
|
+
/*11*/"fun[S I]S","fun[S I]I","fun[S I I]S","fun[S]I","fun[S]I","fun[I]S","fun[I]S","fun[I]S",
|
108
|
+
/*12*/"fun[I]S","fun[I]S","fun[list[u0 u1] u0]u1","fun[list[S u1] S]u1","fun[]I","fun[u0]u0","fun[I]I","fun[u0 I]u0",
|
109
|
+
/*13*/"fun[I I]I","fun[S I I]I","fun[S S]I","fun[S I S I I]S","fun[S I S I I]S","fun[S I S I I I]S","fun[S I S I I I]S",
|
110
|
+
/*14*/"fun[S I I I I]I","fun[S I I I I]I","fun[]list S","fun[S I]S","fun[S I S]I",
|
111
|
+
/*15*/"fun[I I]S", "fun[I S I]I",
|
112
|
+
/*16*/"fun[S I]S","fun[S I I][S I]","fun[S]S","fun[S S]I"
|
113
|
+
};
|
114
|
+
|
115
|
+
|
116
|
+
intptr_t Compiler::addstdlibcore()
|
117
|
+
{
|
118
|
+
intptr_t k;
|
119
|
+
if (k=addnative(NBcore,corename,coreval,corecode,coretype,m))
|
120
|
+
{
|
121
|
+
return k;
|
122
|
+
}
|
123
|
+
/* FILE* f=fopen("bc.txt","w");
|
124
|
+
for(k=0;k<NBcore;k++)
|
125
|
+
{
|
126
|
+
if (corename[k]) fprintf(f,"%s%c%s\n",corename[k],9,coretype[k]);
|
127
|
+
}
|
128
|
+
fclose(f);
|
129
|
+
*/ return 0;
|
130
|
+
}
|
@@ -0,0 +1,80 @@
|
|
1
|
+
//-------------------
|
2
|
+
// MV
|
3
|
+
// version WIN32 et POCKETPC
|
4
|
+
// Sylvain Huet
|
5
|
+
// Premiere version : 07/01/2003
|
6
|
+
// Derniere mise a jour : 07/01/2003
|
7
|
+
//
|
8
|
+
|
9
|
+
#include "resource.h"
|
10
|
+
|
11
|
+
#include "param.h"
|
12
|
+
#include <stdio.h>
|
13
|
+
#include <stdlib.h>
|
14
|
+
#include <string.h>
|
15
|
+
#include <stdint.h>
|
16
|
+
|
17
|
+
#include "filesystem.h"
|
18
|
+
#include "file.h"
|
19
|
+
#include "terminal.h"
|
20
|
+
#include "memory.h"
|
21
|
+
#include <stdarg.h>
|
22
|
+
|
23
|
+
|
24
|
+
Terminal::Terminal(void)
|
25
|
+
{
|
26
|
+
m=NULL;
|
27
|
+
sizeinternalbuffer=64;
|
28
|
+
internalbuffer=new char[sizeinternalbuffer];
|
29
|
+
}
|
30
|
+
|
31
|
+
Terminal::~Terminal()
|
32
|
+
{
|
33
|
+
|
34
|
+
}
|
35
|
+
|
36
|
+
|
37
|
+
void Terminal::echo(int msk,char *s)
|
38
|
+
{
|
39
|
+
if (s)
|
40
|
+
{
|
41
|
+
if (msk&LOG_USER)
|
42
|
+
{
|
43
|
+
fprintf(stdout,"%s",s);
|
44
|
+
}
|
45
|
+
else
|
46
|
+
{
|
47
|
+
fprintf(stderr,"%s",s);
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
52
|
+
void Terminal::echo(int msk,char* s,int size)
|
53
|
+
{
|
54
|
+
if (size+1>sizeinternalbuffer)
|
55
|
+
{
|
56
|
+
delete internalbuffer;
|
57
|
+
sizeinternalbuffer=size+1;
|
58
|
+
internalbuffer=new char[sizeinternalbuffer];
|
59
|
+
}
|
60
|
+
memcpy(internalbuffer,s,size);
|
61
|
+
internalbuffer[size]=0;
|
62
|
+
echo(msk,internalbuffer);
|
63
|
+
}
|
64
|
+
|
65
|
+
void Terminal::printf(int msk,const char *format, ...)
|
66
|
+
{
|
67
|
+
va_list arglist;
|
68
|
+
int sizeout;
|
69
|
+
va_start(arglist,format);
|
70
|
+
while(((sizeout=vsnprintf(internalbuffer,sizeinternalbuffer-1,format,arglist))<0)||(sizeout>=sizeinternalbuffer-1))
|
71
|
+
{
|
72
|
+
delete internalbuffer;
|
73
|
+
sizeinternalbuffer*=2;
|
74
|
+
internalbuffer=new char[sizeinternalbuffer];
|
75
|
+
}
|
76
|
+
va_end(arglist);
|
77
|
+
echo(msk,internalbuffer);
|
78
|
+
}
|
79
|
+
|
80
|
+
|
@@ -8,6 +8,7 @@
|
|
8
8
|
|
9
9
|
|
10
10
|
#include <stdio.h>
|
11
|
+
#include <stdint.h>
|
11
12
|
|
12
13
|
#include "param.h"
|
13
14
|
#include "filesystem.h"
|
@@ -21,28 +22,34 @@
|
|
21
22
|
|
22
23
|
Util::Util(Memory* mem)
|
23
24
|
{
|
24
|
-
|
25
|
-
|
26
|
-
|
25
|
+
m=mem;
|
26
|
+
compiler=new Compiler(m);
|
27
|
+
interpreter=new Interpreter(m);
|
27
28
|
}
|
28
29
|
|
29
30
|
Util::~Util()
|
30
31
|
{
|
31
|
-
|
32
|
-
|
32
|
+
delete interpreter;
|
33
|
+
delete compiler;
|
33
34
|
}
|
34
35
|
|
35
36
|
void Util::stop()
|
36
37
|
{
|
37
|
-
|
38
|
-
|
38
|
+
interpreter->stop();
|
39
|
+
compiler->stop();
|
39
40
|
}
|
40
41
|
|
41
42
|
int Util::start()
|
42
43
|
{
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
44
|
+
int k;
|
45
|
+
if (k=compiler->start())
|
46
|
+
{
|
47
|
+
return k;
|
48
|
+
}
|
49
|
+
if (k=interpreter->start())
|
50
|
+
{
|
51
|
+
return k;
|
52
|
+
}
|
53
|
+
return 0;
|
47
54
|
}
|
48
55
|
|