nabaztag_hack_kit 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. data/.gitignore +7 -0
  2. data/.travis.yml +3 -0
  3. data/CHANGELOG.md +11 -0
  4. data/Gemfile +4 -0
  5. data/README.md +119 -0
  6. data/Rakefile +21 -0
  7. data/bin/mtl_comp +41 -0
  8. data/bin/mtl_merge +22 -0
  9. data/bin/mtl_simu +40 -0
  10. data/bytecode/lib/buffer.mtl +109 -0
  11. data/bytecode/lib/button.mtl +27 -0
  12. data/bytecode/lib/data_helper.mtl +88 -0
  13. data/bytecode/lib/ear.mtl +90 -0
  14. data/bytecode/lib/led.mtl +33 -0
  15. data/bytecode/lib/rfid.mtl +50 -0
  16. data/bytecode/main.mtl +129 -0
  17. data/config.ru +6 -0
  18. data/ext/bytecode/Commands.md +172 -0
  19. data/ext/bytecode/Docs.md +488 -0
  20. data/ext/bytecode/README.md +5 -0
  21. data/ext/bytecode/lib/arp.mtl +159 -0
  22. data/ext/bytecode/lib/cfg.mtl +74 -0
  23. data/ext/bytecode/lib/choreos.mtl +1487 -0
  24. data/ext/bytecode/lib/dhcp.mtl +152 -0
  25. data/ext/bytecode/lib/dns.mtl +89 -0
  26. data/ext/bytecode/lib/http.mtl +84 -0
  27. data/ext/bytecode/lib/tcp.mtl +340 -0
  28. data/ext/bytecode/lib/udp.mtl +49 -0
  29. data/ext/bytecode/lib/util.mtl +74 -0
  30. data/ext/bytecode/lib/var.mtl +15 -0
  31. data/ext/bytecode/lib/wifi.mtl +243 -0
  32. data/ext/bytecode/nominal-ping.mtl +5828 -0
  33. data/ext/mtl/Makefile +42 -0
  34. data/ext/mtl/README.md +13 -0
  35. data/ext/mtl/bc.cpp +1891 -0
  36. data/ext/mtl/conf.bin.sans_password +0 -0
  37. data/ext/mtl/config.txt +5 -0
  38. data/ext/mtl/dumpbc.c +2566 -0
  39. data/ext/mtl/extconf.rb +1 -0
  40. data/ext/mtl/linux_simu.c +271 -0
  41. data/ext/mtl/linux_simuaudio.c +16 -0
  42. data/ext/mtl/linux_simuaudio.h +18 -0
  43. data/ext/mtl/linux_simunet.c +620 -0
  44. data/ext/mtl/linux_simunet.h +7 -0
  45. data/ext/mtl/log.c +297 -0
  46. data/ext/mtl/log.h +20 -0
  47. data/ext/mtl/main_compiler.cpp +104 -0
  48. data/ext/mtl/main_simu.cpp +221 -0
  49. data/ext/mtl/mp3/GTKANAL.H +97 -0
  50. data/ext/mtl/mp3/LAYER3.C +2090 -0
  51. data/ext/mtl/mp3/TABINIT.C +82 -0
  52. data/ext/mtl/mp3/common.c +265 -0
  53. data/ext/mtl/mp3/dct64_i386.c +316 -0
  54. data/ext/mtl/mp3/decode_i386.c +155 -0
  55. data/ext/mtl/mp3/huffman.h +332 -0
  56. data/ext/mtl/mp3/interface.c +258 -0
  57. data/ext/mtl/mp3/mpg123.h +182 -0
  58. data/ext/mtl/mp3/mpglib.h +44 -0
  59. data/ext/mtl/properties.c +293 -0
  60. data/ext/mtl/properties.h +10 -0
  61. data/ext/mtl/simu.c +750 -0
  62. data/ext/mtl/simuaudio.c +662 -0
  63. data/ext/mtl/simuaudio.h +74 -0
  64. data/ext/mtl/simunet.c +400 -0
  65. data/ext/mtl/simunet.h +30 -0
  66. data/ext/mtl/utils/correct_const.sh +34 -0
  67. data/ext/mtl/vaudio.c +677 -0
  68. data/ext/mtl/vaudio.h +46 -0
  69. data/ext/mtl/vbc.h +160 -0
  70. data/ext/mtl/vbc_str.h +166 -0
  71. data/ext/mtl/vcomp/Makefile +29 -0
  72. data/ext/mtl/vcomp/bootstrap.cpp +89 -0
  73. data/ext/mtl/vcomp/compiler.cpp +470 -0
  74. data/ext/mtl/vcomp/compiler.h +200 -0
  75. data/ext/mtl/vcomp/compiler_file.cpp +929 -0
  76. data/ext/mtl/vcomp/compiler_prog.cpp +250 -0
  77. data/ext/mtl/vcomp/compiler_term.cpp +1053 -0
  78. data/ext/mtl/vcomp/compiler_type.cpp +872 -0
  79. data/ext/mtl/vcomp/compiler_var.cpp +289 -0
  80. data/ext/mtl/vcomp/file.cpp +79 -0
  81. data/ext/mtl/vcomp/file.h +39 -0
  82. data/ext/mtl/vcomp/filesystem.h +14 -0
  83. data/ext/mtl/vcomp/interpreter.cpp +85 -0
  84. data/ext/mtl/vcomp/interpreter.h +121 -0
  85. data/ext/mtl/vcomp/memory.cpp +241 -0
  86. data/ext/mtl/vcomp/memory.h +326 -0
  87. data/ext/mtl/vcomp/param.h +95 -0
  88. data/ext/mtl/vcomp/parser.cpp +427 -0
  89. data/ext/mtl/vcomp/parser.h +97 -0
  90. data/ext/mtl/vcomp/parser_xml.cpp +124 -0
  91. data/ext/mtl/vcomp/prodbuffer.cpp +125 -0
  92. data/ext/mtl/vcomp/prodbuffer.h +42 -0
  93. data/ext/mtl/vcomp/resource.h +17 -0
  94. data/ext/mtl/vcomp/stdlib_core.cpp +122 -0
  95. data/ext/mtl/vcomp/terminal.cpp +73 -0
  96. data/ext/mtl/vcomp/terminal.h +30 -0
  97. data/ext/mtl/vcomp/util.cpp +48 -0
  98. data/ext/mtl/vcomp/util.h +31 -0
  99. data/ext/mtl/vinterp.c +1349 -0
  100. data/ext/mtl/vinterp.h +11 -0
  101. data/ext/mtl/vloader.c +127 -0
  102. data/ext/mtl/vloader.h +31 -0
  103. data/ext/mtl/vlog.c +589 -0
  104. data/ext/mtl/vlog.h +69 -0
  105. data/ext/mtl/vmem.c +424 -0
  106. data/ext/mtl/vmem.h +107 -0
  107. data/ext/mtl/vnet.c +255 -0
  108. data/ext/mtl/vnet.h +19 -0
  109. data/lib/nabaztag_hack_kit/message/api.rb +39 -0
  110. data/lib/nabaztag_hack_kit/message/helper.rb +39 -0
  111. data/lib/nabaztag_hack_kit/message.rb +36 -0
  112. data/lib/nabaztag_hack_kit/server.rb +50 -0
  113. data/lib/nabaztag_hack_kit/version.rb +3 -0
  114. data/lib/nabaztag_hack_kit.rb +4 -0
  115. data/nabaztag_hack_kit.gemspec +29 -0
  116. data/public/bytecode.bin +0 -0
  117. data/test/bytecode/helper.mtl +60 -0
  118. data/test/bytecode/native.mtl +28 -0
  119. data/test/bytecode/test.mtl +221 -0
  120. data/test/spec_helper.rb +5 -0
  121. data/test/unit/message_spec.rb +56 -0
  122. metadata +209 -0
@@ -0,0 +1,125 @@
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 <stdio.h>
10
+ #include <string.h>
11
+ #include <stdarg.h>
12
+
13
+ #include "param.h"
14
+ #include "prodbuffer.h"
15
+
16
+
17
+ Prodbuffer::Prodbuffer()
18
+ {
19
+ size=PRODBUFFER_FIRSTSIZE;
20
+ buffer=new char[size];
21
+ index=0;
22
+ };
23
+
24
+ Prodbuffer::~Prodbuffer()
25
+ {
26
+ delete buffer;
27
+ };
28
+
29
+
30
+ // initialiation du buffer (à appeler au début de toute nouvelle production)
31
+ void Prodbuffer::reinit()
32
+ {
33
+ index=0;
34
+ }
35
+
36
+ void Prodbuffer::bigger()
37
+ {
38
+ char* newbuf=new char[size*2];
39
+ memcpy(newbuf,buffer,size);
40
+ delete buffer;
41
+ size*=2;
42
+ buffer=newbuf;
43
+ }
44
+
45
+ // ajout d'un caractère en fin de buffer
46
+ void Prodbuffer::addchar(char c)
47
+ {
48
+ if (index>=size) bigger();
49
+ buffer[index++]=c;
50
+ }
51
+
52
+ // printf à la suite du buffer
53
+ void Prodbuffer::printf(const char *format, ...)
54
+ {
55
+ va_list arglist;
56
+ int sizeout;
57
+
58
+ va_start(arglist,format);
59
+ //while(((sizeout=vsnprintf(buffer+index,size-index-1,format,arglist))<0)||(sizeout>=size-index-1)) bigger();
60
+ va_end(arglist);
61
+ index+=sizeout;
62
+ }
63
+
64
+ // ajout d'un entier en fin de buffer
65
+ void Prodbuffer::addint(int i)
66
+ {
67
+ addchar(i); i>>=8;
68
+ addchar(i); i>>=8;
69
+ addchar(i); i>>=8;
70
+ addchar(i);
71
+ }
72
+
73
+ // ajout d'un short en fin de buffer
74
+ void Prodbuffer::addshort(int i)
75
+ {
76
+ addchar(i); i>>=8;
77
+ addchar(i);
78
+ }
79
+
80
+ // ajout d'une chaîne
81
+ void Prodbuffer::addstr(char *src,int len)
82
+ {
83
+ // addint(len);
84
+ int i; for(i=0;i<len;i++) addchar(*(src++));
85
+ }
86
+
87
+ // modification d'un caractère dans le buffer
88
+ void Prodbuffer::setchar(int ind,char c)
89
+ {
90
+ buffer[ind]=c;
91
+ }
92
+
93
+ // modification d'un entier dans le buffer
94
+ void Prodbuffer::setint(int ind,int i)
95
+ {
96
+ setchar(ind,i); i>>=8;
97
+ setchar(ind+1,i); i>>=8;
98
+ setchar(ind+2,i); i>>=8;
99
+ setchar(ind+3,i);
100
+ }
101
+
102
+ // modification d'un short dans le buffer
103
+ void Prodbuffer::setshort(int ind,int i)
104
+ {
105
+ setchar(ind,i); i>>=8;
106
+ setchar(ind+1,i);
107
+ }
108
+
109
+ // diminue la taille actuelle
110
+ void Prodbuffer::cut(int len)
111
+ {
112
+ if ((len>=0)&&(len<index)) index=len;
113
+ }
114
+
115
+ // retourne la taille actuelle
116
+ int Prodbuffer::getsize()
117
+ {
118
+ return index;
119
+ }
120
+
121
+ // retourne un pointeur vers le début du buffer
122
+ char* Prodbuffer::getstart()
123
+ {
124
+ return buffer;
125
+ }
@@ -0,0 +1,42 @@
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
+ #ifndef _PRODBUFFER_
10
+ #define _PRODBUFFER_
11
+
12
+ class Prodbuffer
13
+ {
14
+ //public:
15
+ private:
16
+ int size; // taille du buffer de bytecode
17
+ char* buffer; // buffer de bytecode
18
+ int index; // index du buffer de bytecode
19
+
20
+ void bigger(); // augmentation de la taille du buffer
21
+
22
+ public:
23
+ // buffer bytecode
24
+ Prodbuffer();
25
+ ~Prodbuffer();
26
+ void reinit();
27
+ void addchar(char c);
28
+ void addint(int i);
29
+ void addshort(int i);
30
+ void setchar(int index,char c);
31
+ void setint(int index,int i);
32
+ void setshort(int index,int i);
33
+ void addstr(char *src,int len);
34
+ void printf(const char *format, ...);
35
+ void cut(int len);
36
+ int getsize();
37
+ char* getstart();
38
+ };
39
+
40
+ #define PRODBUFFER_FIRSTSIZE 128
41
+
42
+ #endif
@@ -0,0 +1,17 @@
1
+ //{{NO_DEPENDENCIES}}
2
+ // Microsoft Developer Studio generated include file.
3
+ // Used by Script1.rc
4
+ //
5
+ #define IDI_ICON1 101
6
+ #define IDI_ICON2 103
7
+
8
+ // Next default values for new objects
9
+ //
10
+ #ifdef APSTUDIO_INVOKED
11
+ #ifndef APSTUDIO_READONLY_SYMBOLS
12
+ #define _APS_NEXT_RESOURCE_VALUE 104
13
+ #define _APS_NEXT_COMMAND_VALUE 40001
14
+ #define _APS_NEXT_CONTROL_VALUE 1000
15
+ #define _APS_NEXT_SYMED_VALUE 101
16
+ #endif
17
+ #endif
@@ -0,0 +1,122 @@
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
+
12
+ #include <stdlib.h>
13
+ #include <string.h>
14
+ #include <time.h>
15
+ #include <math.h>
16
+
17
+
18
+ #include "terminal.h"
19
+ #include "prodbuffer.h"
20
+ #include "memory.h"
21
+ #include "util.h"
22
+ #include "interpreter.h"
23
+ #include "parser.h"
24
+ #include "compiler.h"
25
+
26
+
27
+ // types de base
28
+ #define NBcore 115 /******** A ACTUALISER! ************/
29
+ const char* corename[]=
30
+ {NULL,NULL,NULL,NULL,NULL,"hd","tl","Secholn","Secho","Iecholn", //10
31
+ "Iecho","time_ms","tabnew","abs","min","max","rand","srand", //8
32
+ "time","strnew","strset","strcpy","vstrcmp","strfind","strfindrev","strlen", //8
33
+ "strget","strsub","strcat","tablen","strcatlist","led","motorset","motorget", //8
34
+ "fixarg1","fixarg2","fixarg3","fixarg4","fixarg5","fixarg6","fixarg7","fixarg8", //8
35
+ "button2","button3","playStart","playFeed","playStop","recStart","recStop","recVol", //8
36
+ "load","gc","save","bytecode","loopcb", // 5
37
+ "udpStart","udpCb","udpStop","udpSend","tcpOpen","tcpClose","tcpSend","tcpCb","tcpListen","tcpEnable", //10
38
+ "envget","envset","sndVol","rfidGet","playTime","sndRefresh","sndWrite","sndRead","sndFeed","sndAmpli", //10
39
+ "netCb","netSend","netState","netMac","netChk","netSetmode","netScan","netAuth","netPmk","netRssi", //10
40
+ "netSeqAdd","strgetword","strputword","atoi","htoi","itoa","ctoa","itoh", // 8
41
+ "ctoh","itobin2","listswitch","listswitchstr","corePP","corePush","corePull","coreBit0", //8
42
+ "reboot","flashFirmware","strcmp","adp2wav","wav2adp","alaw2wav","wav2alaw", //7
43
+ "crypt","uncrypt","rfidGetList","rfidRead","rfidWrite", // 5
44
+ "i2cRead", "i2cWrite" // 2
45
+ };
46
+
47
+
48
+
49
+ int coreval[]=
50
+ {0,0,0,0,0,OPhd,OPtl,OPSecholn,OPSecho,OPIecholn,
51
+ OPIecho,OPtime_ms,OPtabnew,OPabs,OPmin,OPmax,OPrand,OPsrand,
52
+ OPtime,OPstrnew,OPstrset,OPstrcpy,OPvstrcmp,OPstrfind,OPstrfindrev,OPstrlen,
53
+ OPstrget,OPstrsub,OPstrcat,OPtablen,OPstrcatlist,OPled,OPmotorset,OPmotorget,
54
+ OPfixarg,OPfixarg,OPfixarg,OPfixarg,OPfixarg,OPfixarg,OPfixarg,OPfixarg,
55
+ OPbutton2,OPbutton3,OPplayStart,OPplayFeed,OPplayStop,OPrecStart,OPrecStop,OPrecVol,
56
+ OPload,OPgc,OPsave,OPbytecode,OPloopcb,
57
+ OPudpStart,OPudpCb,OPudpStop,OPudpSend,OPtcpOpen,OPtcpClose,OPtcpSend,OPtcpCb,OPtcpListen,OPtcpEnable,
58
+ OPenvget,OPenvset,OPsndVol,OPrfidGet,OPplayTime,OPsndRefresh,OPsndWrite,OPsndRead,OPsndFeed,OPsndAmpli,
59
+ OPnetCb,OPnetSend,OPnetState,OPnetMac,OPnetChk,OPnetSetmode,OPnetScan,OPnetAuth,OPnetPmk,OPnetRssi,
60
+ OPnetSeqAdd,OPstrgetword,OPstrputword,OPatoi,OPhtoi,OPitoa,OPctoa,OPitoh,
61
+ OPctoh,OPitobin2,OPlistswitch,OPlistswitchstr,OPcorePP,OPcorePush,OPcorePull,OPcoreBit0,
62
+ OPreboot,OPflashFirmware,OPstrcmp,OPadp2wav,OPwav2adp,OPalaw2wav,OPwav2alaw,
63
+ OPcrypt,OPuncrypt,OPrfidGetList,OPrfidRead,OPrfidWrite,
64
+ OPi2cRead, OPi2cWrite
65
+ };
66
+
67
+ int corecode[]=
68
+ {CODE_TYPE,CODE_TYPE,CODE_TYPE,CODE_TYPE,CODE_TYPE,1,1,1,1,1,
69
+ 1,0,2,1,2,2,0,1,
70
+ 0,1,3,5,5,5,5,1,
71
+ 2,3,2,1,1,2,2,1,
72
+ 2,2,2,2,2,2,2,2,
73
+ 0,0,2,3,0,3,0,2,
74
+ 5,0,5,1,1,
75
+ 1,1,1,6,2,1,4,1,1,2,
76
+ 0,1,1,0,0,0,2,1,3,1,
77
+ 1,6,0,0,4,3,1,4,2,0,
78
+ 2,2,3,1,1,1,1,1,
79
+ 1,1,2,2,0,1,1,2,
80
+ 2,3,2,5,5,6,6,
81
+ 5,5,0,2,3,
82
+ 2,3
83
+ };
84
+
85
+ const char* coretype[]=
86
+ {"I","S","F","Env","Xml","fun[list u0]u0","fun[list u0]list u0","fun[S]S","fun[S]S","fun[u0]u0",
87
+ "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",
88
+ "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",
89
+ "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",
90
+ "fun[fun[u0]u100 u0]fun[]u100",
91
+ "fun[fun[u1 u0]u100 u0]fun[u1]u100",
92
+ "fun[fun[u1 u2 u0]u100 u0]fun[u1 u2]u100",
93
+ "fun[fun[u1 u2 u3 u0]u100 u0]fun[u1 u2 u3]u100",
94
+ "fun[fun[u1 u2 u3 u4 u0]u100 u0]fun[u1 u2 u3 u4]u100",
95
+ "fun[fun[u1 u2 u3 u4 u5 u0]u100 u0]fun[u1 u2 u3 u4 u5]u100",
96
+ "fun[fun[u1 u2 u3 u4 u5 u6 u0]u100 u0]fun[u1 u2 u3 u4 u5 u6]u100",
97
+ "fun[fun[u1 u2 u3 u4 u5 u6 u7 u0]u100 u0]fun[u1 u2 u3 u4 u5 u6 u7]u100",
98
+ "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",
99
+ "fun[S I S I I]I","fun[]I","fun[S I S I I]I","fun[S]S","fun[fun[]I]fun[]I",
100
+ "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",
101
+ "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",
102
+ "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",
103
+ "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",
104
+ "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",
105
+ "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",
106
+ "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",
107
+ "fun[I I]S", "fun[I S I]I"
108
+ };
109
+
110
+
111
+ int Compiler::addstdlibcore()
112
+ {
113
+ int k;
114
+ if (k=addnative(NBcore,corename,coreval,corecode,coretype,m)) return k;
115
+ /* FILE* f=fopen("bc.txt","w");
116
+ for(k=0;k<NBcore;k++)
117
+ {
118
+ if (corename[k]) fprintf(f,"%s%c%s\n",corename[k],9,coretype[k]);
119
+ }
120
+ fclose(f);
121
+ */ return 0;
122
+ }
@@ -0,0 +1,73 @@
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
+
16
+ #include "filesystem.h"
17
+ #include "file.h"
18
+ #include "terminal.h"
19
+ #include "memory.h"
20
+ #include <stdarg.h>
21
+
22
+
23
+ Terminal::Terminal(void)
24
+ {
25
+ m=NULL;
26
+ sizeinternalbuffer=64;
27
+ internalbuffer=new char[sizeinternalbuffer];
28
+ }
29
+
30
+ Terminal::~Terminal()
31
+ {
32
+
33
+ }
34
+
35
+
36
+ void Terminal::echo(int msk,char *s)
37
+ {
38
+ if (s)
39
+ {
40
+ if (msk&LOG_USER) fprintf(stdout,"%s",s);
41
+ else fprintf(stderr,"%s",s);
42
+ }
43
+ }
44
+
45
+ void Terminal::echo(int msk,char* s,int size)
46
+ {
47
+ if (size+1>sizeinternalbuffer)
48
+ {
49
+ delete internalbuffer;
50
+ sizeinternalbuffer=size+1;
51
+ internalbuffer=new char[sizeinternalbuffer];
52
+ }
53
+ memcpy(internalbuffer,s,size);
54
+ internalbuffer[size]=0;
55
+ echo(msk,internalbuffer);
56
+ }
57
+
58
+ void Terminal::printf(int msk,const char *format, ...)
59
+ {
60
+ va_list arglist;
61
+ int sizeout;
62
+ va_start(arglist,format);
63
+ while(((sizeout=vsnprintf(internalbuffer,sizeinternalbuffer-1,format,arglist))<0)||(sizeout>=sizeinternalbuffer-1))
64
+ {
65
+ delete internalbuffer;
66
+ sizeinternalbuffer*=2;
67
+ internalbuffer=new char[sizeinternalbuffer];
68
+ }
69
+ va_end(arglist);
70
+ echo(msk,internalbuffer);
71
+ }
72
+
73
+
@@ -0,0 +1,30 @@
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
+ #ifndef _TERMINAL_
10
+ #define _TERMINAL_
11
+
12
+ class File;
13
+ class FileSystem;
14
+ class Memory;
15
+ class Terminal
16
+ {
17
+ private:
18
+ char* internalbuffer;
19
+ int sizeinternalbuffer;
20
+ public:
21
+ Memory* m;
22
+ Terminal();
23
+ ~Terminal();
24
+
25
+ void echo(int mask,char *s);
26
+ void echo(int mask,char *s,int size);
27
+ void printf(int mask,const char *format, ...);
28
+ };
29
+
30
+ #endif
@@ -0,0 +1,48 @@
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
+
10
+ #include <stdio.h>
11
+
12
+ #include "param.h"
13
+ #include "filesystem.h"
14
+ #include "terminal.h"
15
+ #include "memory.h"
16
+
17
+ #include "parser.h"
18
+ #include "compiler.h"
19
+ #include "interpreter.h"
20
+ #include "util.h"
21
+
22
+ Util::Util(Memory* mem)
23
+ {
24
+ m=mem;
25
+ compiler=new Compiler(m);
26
+ interpreter=new Interpreter(m);
27
+ }
28
+
29
+ Util::~Util()
30
+ {
31
+ delete interpreter;
32
+ delete compiler;
33
+ }
34
+
35
+ void Util::stop()
36
+ {
37
+ interpreter->stop();
38
+ compiler->stop();
39
+ }
40
+
41
+ int Util::start()
42
+ {
43
+ int k;
44
+ if (k=compiler->start()) return k;
45
+ if (k=interpreter->start()) return k;
46
+ return 0;
47
+ }
48
+
@@ -0,0 +1,31 @@
1
+ //-------------------
2
+ // Moteur 3d
3
+ // version WIN32 et POCKETPC
4
+ // Sylvain Huet
5
+ // Premiere version : 03/09/2002
6
+ // Derniere mise a jour : 05/10/2002
7
+ //
8
+
9
+
10
+
11
+ #ifndef _UTIL_
12
+ #define _UTIL_
13
+
14
+ class Memory;
15
+ class Compiler;
16
+ class Interpreter;
17
+
18
+ class Util
19
+ {
20
+ private :
21
+ Memory* m;
22
+ public:
23
+ Util(Memory* mem);
24
+ ~Util();
25
+ int start();
26
+ void stop();
27
+
28
+ Compiler* compiler;
29
+ Interpreter* interpreter;
30
+ };
31
+ #endif