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.
Files changed (173) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +7 -2
  3. data/.gitmodules +3 -0
  4. data/.travis.yml +2 -2
  5. data/CHANGELOG.md +17 -2
  6. data/LICENSE +21 -0
  7. data/README.md +115 -44
  8. data/Rakefile +2 -6
  9. data/bytecode/{Commands.md → _docs/commands.md} +0 -0
  10. data/bytecode/{Docs.md → _docs/grammar.md} +0 -0
  11. data/bytecode/_docs/grammar.pdf +0 -0
  12. data/bytecode/{src → _original}/README.md +0 -0
  13. data/bytecode/{src → _original}/lib/arp.mtl +0 -0
  14. data/bytecode/{src → _original}/lib/cfg.mtl +0 -0
  15. data/bytecode/{src → _original}/lib/choreos.mtl +0 -0
  16. data/bytecode/{src → _original}/lib/dhcp.mtl +0 -0
  17. data/bytecode/{src → _original}/lib/dns.mtl +0 -0
  18. data/bytecode/{src → _original}/lib/http.mtl +0 -0
  19. data/bytecode/{src → _original}/lib/tcp.mtl +0 -0
  20. data/bytecode/{src → _original}/lib/udp.mtl +0 -0
  21. data/bytecode/{src → _original}/lib/util.mtl +0 -0
  22. data/bytecode/{src → _original}/lib/var.mtl +0 -0
  23. data/bytecode/{src → _original}/lib/wav.mtl +0 -0
  24. data/bytecode/{src → _original}/lib/wifi.mtl +0 -0
  25. data/bytecode/{src → _original}/nominal-ping.mtl +0 -0
  26. data/bytecode/main.mtl +11 -11
  27. data/bytecode/test/test.mtl +8 -8
  28. data/examples/basic/Gemfile +1 -3
  29. data/examples/basic/config.ru +14 -4
  30. data/examples/record/Gemfile +0 -5
  31. data/examples/record/{config.ru.example → config.ru} +2 -2
  32. data/examples/record/server.rb +0 -2
  33. data/ext/Makefile +10 -0
  34. data/ext/bin/mtl_comp +29 -0
  35. data/{bytecode → ext}/bin/mtl_merge +0 -0
  36. data/ext/bin/mtl_simu +29 -0
  37. data/{bytecode/src/mtl → ext}/extconf.rb +0 -0
  38. data/ext/mtl_linux/.gitignore +7 -0
  39. data/ext/mtl_linux/LICENSE +21 -0
  40. data/ext/mtl_linux/Makefile +116 -0
  41. data/ext/mtl_linux/MetalC.project +196 -0
  42. data/ext/mtl_linux/conf.bin +0 -0
  43. data/{bytecode/src/mtl → ext/mtl_linux}/conf.bin.sans_password +0 -0
  44. data/{bytecode/src/mtl → ext/mtl_linux}/config.txt +0 -0
  45. data/ext/mtl_linux/inc/log.h +21 -0
  46. data/{bytecode/src/mtl → ext/mtl_linux/inc}/properties.h +0 -0
  47. data/{bytecode/src/mtl/linux_simuaudio.h → ext/mtl_linux/inc/simu/linux/simuaudio.h} +0 -0
  48. data/{bytecode/src/mtl/linux_simunet.h → ext/mtl_linux/inc/simu/linux/simunet.h} +0 -0
  49. data/{bytecode/src/mtl → ext/mtl_linux/inc/simu/win}/simuaudio.h +18 -18
  50. data/{bytecode/src/mtl → ext/mtl_linux/inc/simu/win}/simunet.h +0 -0
  51. data/ext/mtl_linux/inc/vcomp/compiler.h +200 -0
  52. data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/file.h +11 -11
  53. data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/filesystem.h +0 -0
  54. data/ext/mtl_linux/inc/vcomp/interpreter.h +121 -0
  55. data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/memory.h +120 -92
  56. data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/param.h +0 -0
  57. data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/parser.h +27 -27
  58. data/ext/mtl_linux/inc/vcomp/prodbuffer.h +42 -0
  59. data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/resource.h +1 -1
  60. data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/terminal.h +8 -8
  61. data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/util.h +7 -7
  62. data/{bytecode/src/mtl → ext/mtl_linux/inc/vm}/vaudio.h +0 -0
  63. data/{bytecode/src/mtl → ext/mtl_linux/inc/vm}/vbc.h +1 -1
  64. data/ext/mtl_linux/inc/vm/vbc_str.h +167 -0
  65. data/{bytecode/src/mtl → ext/mtl_linux/inc/vm}/vinterp.h +0 -0
  66. data/{bytecode/src/mtl → ext/mtl_linux/inc/vm}/vloader.h +0 -0
  67. data/{bytecode/src/mtl → ext/mtl_linux/inc/vm}/vlog.h +0 -0
  68. data/{bytecode/src/mtl → ext/mtl_linux/inc/vm}/vmem.h +0 -0
  69. data/{bytecode/src/mtl → ext/mtl_linux/inc/vm}/vnet.h +0 -0
  70. data/ext/mtl_linux/nominal.mtl +3959 -0
  71. data/ext/mtl_linux/src/comp/main.cpp +123 -0
  72. data/ext/mtl_linux/src/simu/dumpbc.c +2566 -0
  73. data/ext/mtl_linux/src/simu/linux/main.cpp +288 -0
  74. data/ext/mtl_linux/src/simu/linux/simu.c +309 -0
  75. data/ext/mtl_linux/src/simu/linux/simuaudio.c +44 -0
  76. data/ext/mtl_linux/src/simu/linux/simunet.c +707 -0
  77. data/ext/mtl_linux/src/simu/log.c +340 -0
  78. data/ext/mtl_linux/src/simu/properties.c +368 -0
  79. data/{bytecode/src/mtl → ext/mtl_linux/src/simu/win}/mp3/GTKANAL.H +0 -0
  80. data/{bytecode/src/mtl → ext/mtl_linux/src/simu/win}/mp3/LAYER3.C +0 -0
  81. data/{bytecode/src/mtl → ext/mtl_linux/src/simu/win}/mp3/TABINIT.C +0 -0
  82. data/ext/mtl_linux/src/simu/win/mp3/common.c +302 -0
  83. data/ext/mtl_linux/src/simu/win/mp3/dct64_i386.c +316 -0
  84. data/ext/mtl_linux/src/simu/win/mp3/decode_i386.c +160 -0
  85. data/ext/mtl_linux/src/simu/win/mp3/huffman.h +332 -0
  86. data/ext/mtl_linux/src/simu/win/mp3/interface.c +276 -0
  87. data/{bytecode/src/mtl → ext/mtl_linux/src/simu/win}/mp3/mpg123.h +34 -30
  88. data/ext/mtl_linux/src/simu/win/mp3/mpglib.h +47 -0
  89. data/ext/mtl_linux/src/simu/win/simu.c +819 -0
  90. data/ext/mtl_linux/src/simu/win/simuaudio.c +787 -0
  91. data/ext/mtl_linux/src/simu/win/simunet.c +489 -0
  92. data/ext/mtl_linux/src/vcomp/bootstrap.cpp +95 -0
  93. data/ext/mtl_linux/src/vcomp/compiler.cpp +587 -0
  94. data/ext/mtl_linux/src/vcomp/compiler_file.cpp +1253 -0
  95. data/ext/mtl_linux/src/vcomp/compiler_prog.cpp +437 -0
  96. data/ext/mtl_linux/src/vcomp/compiler_term.cpp +1500 -0
  97. data/ext/mtl_linux/src/vcomp/compiler_type.cpp +1238 -0
  98. data/ext/mtl_linux/src/vcomp/compiler_var.cpp +502 -0
  99. data/ext/mtl_linux/src/vcomp/file.cpp +100 -0
  100. data/ext/mtl_linux/src/vcomp/interpreter.cpp +93 -0
  101. data/ext/mtl_linux/src/vcomp/memory.cpp +313 -0
  102. data/ext/mtl_linux/src/vcomp/parser.cpp +584 -0
  103. data/ext/mtl_linux/src/vcomp/parser_xml.cpp +137 -0
  104. data/{bytecode/src/mtl → ext/mtl_linux/src}/vcomp/prodbuffer.cpp +57 -36
  105. data/ext/mtl_linux/src/vcomp/stdlib_core.cpp +130 -0
  106. data/ext/mtl_linux/src/vcomp/terminal.cpp +80 -0
  107. data/{bytecode/src/mtl → ext/mtl_linux/src}/vcomp/util.cpp +18 -11
  108. data/ext/mtl_linux/src/vm/vaudio.c +830 -0
  109. data/ext/mtl_linux/src/vm/vinterp.c +1780 -0
  110. data/ext/mtl_linux/src/vm/vloader.c +139 -0
  111. data/ext/mtl_linux/src/vm/vlog.c +782 -0
  112. data/ext/mtl_linux/src/vm/vmem.c +461 -0
  113. data/ext/mtl_linux/src/vm/vnet.c +298 -0
  114. data/{bytecode/src/mtl → ext/mtl_linux}/utils/correct_const.sh +0 -0
  115. data/lib/nabaztag_hack_kit/server.rb +4 -7
  116. data/lib/nabaztag_hack_kit/version.rb +1 -1
  117. data/lib/nabaztag_hack_kit.rb +2 -2
  118. data/nabaztag_hack_kit.gemspec +10 -11
  119. data/spec/integration/server_spec.rb +3 -3
  120. data/spec/spec_helper.rb +2 -0
  121. data/spec/unit/message_spec.rb +12 -18
  122. data/spec/unit/server_spec.rb +13 -10
  123. metadata +145 -137
  124. data/bytecode/bin/mtl_comp +0 -50
  125. data/bytecode/bin/mtl_simu +0 -49
  126. data/bytecode/src/mtl/Makefile +0 -42
  127. data/bytecode/src/mtl/README.md +0 -13
  128. data/bytecode/src/mtl/bc.cpp +0 -1891
  129. data/bytecode/src/mtl/dumpbc.c +0 -2566
  130. data/bytecode/src/mtl/linux_simu.c +0 -271
  131. data/bytecode/src/mtl/linux_simuaudio.c +0 -16
  132. data/bytecode/src/mtl/linux_simunet.c +0 -620
  133. data/bytecode/src/mtl/log.c +0 -297
  134. data/bytecode/src/mtl/log.h +0 -20
  135. data/bytecode/src/mtl/main_compiler.cpp +0 -104
  136. data/bytecode/src/mtl/main_simu.cpp +0 -221
  137. data/bytecode/src/mtl/mp3/common.c +0 -265
  138. data/bytecode/src/mtl/mp3/dct64_i386.c +0 -316
  139. data/bytecode/src/mtl/mp3/decode_i386.c +0 -155
  140. data/bytecode/src/mtl/mp3/huffman.h +0 -332
  141. data/bytecode/src/mtl/mp3/interface.c +0 -258
  142. data/bytecode/src/mtl/mp3/mpglib.h +0 -44
  143. data/bytecode/src/mtl/properties.c +0 -293
  144. data/bytecode/src/mtl/simu.c +0 -750
  145. data/bytecode/src/mtl/simuaudio.c +0 -662
  146. data/bytecode/src/mtl/simunet.c +0 -400
  147. data/bytecode/src/mtl/vaudio.c +0 -677
  148. data/bytecode/src/mtl/vbc_str.h +0 -166
  149. data/bytecode/src/mtl/vcomp/Makefile +0 -29
  150. data/bytecode/src/mtl/vcomp/bootstrap.cpp +0 -89
  151. data/bytecode/src/mtl/vcomp/compiler.cpp +0 -470
  152. data/bytecode/src/mtl/vcomp/compiler.h +0 -200
  153. data/bytecode/src/mtl/vcomp/compiler_file.cpp +0 -929
  154. data/bytecode/src/mtl/vcomp/compiler_prog.cpp +0 -250
  155. data/bytecode/src/mtl/vcomp/compiler_term.cpp +0 -1053
  156. data/bytecode/src/mtl/vcomp/compiler_type.cpp +0 -872
  157. data/bytecode/src/mtl/vcomp/compiler_var.cpp +0 -289
  158. data/bytecode/src/mtl/vcomp/file.cpp +0 -79
  159. data/bytecode/src/mtl/vcomp/interpreter.cpp +0 -85
  160. data/bytecode/src/mtl/vcomp/interpreter.h +0 -121
  161. data/bytecode/src/mtl/vcomp/memory.cpp +0 -241
  162. data/bytecode/src/mtl/vcomp/parser.cpp +0 -427
  163. data/bytecode/src/mtl/vcomp/parser_xml.cpp +0 -124
  164. data/bytecode/src/mtl/vcomp/prodbuffer.h +0 -42
  165. data/bytecode/src/mtl/vcomp/stdlib_core.cpp +0 -122
  166. data/bytecode/src/mtl/vcomp/terminal.cpp +0 -73
  167. data/bytecode/src/mtl/vinterp.c +0 -1349
  168. data/bytecode/src/mtl/vloader.c +0 -127
  169. data/bytecode/src/mtl/vlog.c +0 -589
  170. data/bytecode/src/mtl/vmem.c +0 -424
  171. data/bytecode/src/mtl/vnet.c +0 -255
  172. data/examples/basic/Procfile +0 -2
  173. data/examples/basic/server.rb +0 -14
@@ -1,166 +0,0 @@
1
- // VLISP Virtual Machine - 2006 - by Sylvain Huet
2
- // Lowcost IS Powerfull
3
-
4
- #ifndef VBC_STR_H_
5
- # define VBC_STR_H_
6
-
7
- // cette table ne sert qu'� l'affichage du bytecode dans la console
8
- #define MaxOpcode 152
9
- const char* strbytecod[MaxOpcode]=
10
- {
11
- "exec",
12
- "ret",
13
- "intb",
14
- "int",
15
- "nil",
16
- "drop",
17
- "dup",
18
- "getlocalb",
19
- "getlocal",
20
- "add",
21
- "sub",
22
- "mul",
23
- "div",
24
- "mod",
25
- "and",
26
- "or",
27
- "eor",
28
- "shl",
29
- "shr",
30
- "neg",
31
- "not",
32
- "non",
33
- "eq",
34
- "ne",
35
- "lt",
36
- "gt",
37
- "le",
38
- "ge",
39
- "goto",
40
- "else",
41
- "mktabb",
42
- "mktab",
43
- "deftabb",
44
- "deftab",
45
- "fetchb",
46
- "fetch",
47
- "getglobalb",
48
- "getglobal",
49
- "Secho",
50
- "Iecho",
51
- "setlocalb",
52
- "setlocal",
53
- "setglobal",
54
- "setstructb",
55
- "setstruct",
56
- "hd",
57
- "tl",
58
- "setlocal2",
59
- "store",
60
- "call",
61
- "callrb",
62
- "callr",
63
- "first",
64
- "time_ms",
65
- "tabnew",
66
- "fixarg",
67
- "abs",
68
- "max",
69
- "min",
70
- "rand",
71
- "srand",
72
- "time",
73
- "strnew",
74
- "strset",
75
- "strcpy",
76
- "vstrcmp",
77
- "strfind",
78
- "strfindrev",
79
- "strlen",
80
- "strget",
81
- "strsub",
82
- "strcat",
83
- "tablen",
84
- "strcatlist",
85
- "led",
86
- "motorset",
87
- "motorget",
88
- "button2",
89
- "button3",
90
- "playStart",
91
- "playFeed",
92
- "playStop",
93
- "load",
94
- "udpStart",
95
- "udpCb",
96
- "udpStop",
97
- "udpSend",
98
- "gc",
99
- "tcpOpen",
100
- "tcpClose",
101
- "tcpSend",
102
- "tcpCb",
103
- "save",
104
- "bytecode",
105
- "loopcb",
106
- "Iecholn",
107
- "Secholn",
108
- "tcpListen",
109
- "envget",
110
- "envset",
111
- "sndVol",
112
- "rfidGet",
113
- "playTime",
114
- "netCb",
115
- "netSend",
116
- "netState",
117
- "netMac",
118
- "netChk",
119
- "netSetmode",
120
- "netScan",
121
- "netAuth",
122
- "recStart",
123
- "recStop",
124
- "recVol",
125
- "netSeqAdd",
126
- "strgetword",
127
- "strputword",
128
- "atoi",
129
- "htoi",
130
- "itoa",
131
- "ctoa",
132
- "itoh",
133
- "ctoh",
134
- "itobin2",
135
- "listswitch",
136
- "listswitchstr",
137
- "sndRefresh",
138
- "sndWrite",
139
- "sndRead",
140
- "sndFeed",
141
- "sndAmpli",
142
- "corePP",
143
- "corePush",
144
- "corePull",
145
- "coreBit0",
146
- "tcpEnable",
147
- "reboot",
148
- "strcmp",
149
- "adp2wav",
150
- "wav2adp",
151
- "alaw2wav",
152
- "wav2alaw",
153
- "netPmk",
154
- "flashFirmware",
155
- "crypt",
156
- "uncrypt",
157
- "netRssi",
158
- "rfidGetList",
159
- "rfidRead",
160
- "rfidWrite",
161
- "i2cRead",
162
- "i2cWrite"
163
- };
164
-
165
- #endif // ! VBC_STR_H_
166
-
@@ -1,29 +0,0 @@
1
- OBJS = \
2
- bootstrap.o \
3
- compiler_file.o \
4
- compiler.o \
5
- compiler_prog.o \
6
- compiler_term.o \
7
- compiler_type.o \
8
- compiler_var.o \
9
- file.o \
10
- interpreter.o \
11
- memory.o \
12
- parser.o \
13
- parser_xml.o \
14
- prodbuffer.o \
15
- stdlib_core.o \
16
- terminal.o \
17
- util.o
18
-
19
- libvcomp.a : $(OBJS)
20
- ar rcs $@ $(OBJS)
21
- ranlib $@
22
-
23
- # %.o : %.cpp
24
- # g++ -c $^ -o $@
25
-
26
- CPPFLAGS=-fpermissive
27
-
28
- clean :
29
- rm -f $(OBJS)
@@ -1,89 +0,0 @@
1
- //-------------------
2
- // MV
3
- // version WIN32 et POCKETPC
4
- // Sylvain Huet
5
- // Derniere mise a jour : 07/01/2003
6
- //
7
-
8
-
9
- //#include <windows.h>
10
- //#include <windowsx.h>
11
- //#include <wingdi.h>
12
- //#include <commctrl.h>
13
- //#include <commdlg.h>
14
- //#include <string.h>
15
- #include "param.h"
16
-
17
- #include <stdio.h>
18
-
19
- #include "param.h"
20
- #include "prodbuffer.h"
21
- #include "filesystem.h"
22
- #include "file.h"
23
- #include "terminal.h"
24
-
25
- #include "memory.h"
26
- #include "util.h"
27
- #include "parser.h"
28
- #include "compiler.h"
29
- #include "interpreter.h"
30
-
31
-
32
-
33
- void AbortMetal(Memory* m,int donotstop)
34
- {
35
- if (m->abort) return;
36
- PRINTF(m)(LOG_RUNTIME,"\n---------- end of execution\n");
37
- m->stop();
38
- }
39
-
40
-
41
-
42
- int StartMetal(const char *starter, const char* output, bool inSign)
43
- {
44
- int k;
45
-
46
- // passe dans le r�pertoire de l'executable, en retenant le r�pertoire courant
47
-
48
- Terminal* t=new Terminal();
49
- Memory* m=new Memory(32*1024,t,NULL);
50
- t->m=m;
51
-
52
- if (k=m->start())
53
- {
54
- t->printf(LOG_RUNTIME,"Launcher : erreur d'initialisation Memory\n");
55
- return -1;
56
- }
57
- STRPUSH(m, (char*) starter);
58
- if (!(k=m->util->compiler->gocompile(COMPILE_FROMFILE)))
59
- {
60
- t->printf(LOG_RUNTIME,"\nCompiler : done !\n");
61
- File* f=new File(NULL);
62
- f->openwrite(output);
63
- if (inSign) {
64
- f->write("amber", 5);
65
- char sizeStr[9];
66
- sprintf(sizeStr, "%.8x", m->util->compiler->brelease->getsize());
67
- f->write(sizeStr, 8);
68
- }
69
- f->write(m->util->compiler->brelease->getstart(),m->util->compiler->brelease->getsize());
70
- if (inSign) {
71
- f->write("Mind", 4);
72
- }
73
- f->close();
74
- return 0;
75
- }
76
- else
77
- {
78
- t->printf(LOG_RUNTIME,"Launcher : %s\n\n",m->errorname(k));
79
- return -1;
80
- }
81
- }
82
-
83
-
84
- int vcompDoit(char *starter)
85
- {
86
- int k=StartMetal(starter, "foo.bin", false);
87
- getchar();
88
- return k;
89
- }