source: EcnlProtoTool/trunk/webapp/webmrbc/Arduino/SystemBlock.cs@ 270

Last change on this file since 270 was 270, checked in by coas-nagasima, 7 years ago

mruby版ECNLプロトタイピング・ツールを追加

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-csharp
File size: 7.5 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4
5namespace WebMrbc
6{
7 public class SystemExitBlock : Block
8 {
9 public const string type_name = "system_exit";
10
11 public SystemExitBlock()
12 : base(type_name)
13 {
14 }
15
16 public void init()
17 {
18 this.appendDummyInput()
19 .appendField("終了させます");
20 this.setPreviousStatement(true, null);
21 this.setNextStatement(true, null);
22 this.setColour(160);
23 this.setTooltip("");
24 this.setHelpUrl("http://www.example.com/");
25 }
26 }
27
28 public class SystemSetRunBlock : Block
29 {
30 public const string type_name = "system_setrun";
31
32 public SystemSetRunBlock()
33 : base(type_name)
34 {
35 }
36
37 public void init()
38 {
39 this.appendDummyInput()
40 .appendField("次に実行するスクリプトファイルをセットします");
41 this.appendValueInput("FILENAME")
42 .setCheck("String");
43 this.setInputsInline(true);
44 this.setPreviousStatement(true, null);
45 this.setNextStatement(true, null);
46 this.setColour(160);
47 this.setTooltip("");
48 this.setHelpUrl("http://www.example.com/");
49 }
50 }
51
52 public class SystemVersionBlock : Block
53 {
54 public const string type_name = "system_version";
55
56 public SystemVersionBlock()
57 : base(type_name)
58 {
59 }
60
61 public void init()
62 {
63 this.appendDummyInput()
64 .appendField("システムのバージョンを取得します");
65 this.setOutput(true, "String");
66 this.setColour(160);
67 this.setTooltip("");
68 this.setHelpUrl("http://www.example.com/");
69 }
70 }
71
72 public class SystemPushBlock : Block
73 {
74 public const string type_name = "system_push";
75
76 public SystemPushBlock()
77 : base(type_name)
78 {
79 }
80 public void init()
81 {
82 this.appendDummyInput()
83 .appendField("フラッシュメモリに書き込みます");
84 this.appendValueInput("ADDRESS")
85 .setCheck("Number")
86 .appendField("開始アドレス");
87 this.appendValueInput("DATA")
88 .setCheck("String")
89 .appendField("データ");
90 this.appendValueInput("LENGTH")
91 .setCheck("Number")
92 .appendField("サイズ");
93 this.setInputsInline(true);
94 this.setPreviousStatement(true, null);
95 this.setNextStatement(true, null);
96 this.setColour(160);
97 this.setTooltip("");
98 this.setHelpUrl("http://www.example.com/");
99 }
100 }
101
102 public class SystemPopBlock : Block
103 {
104 public const string type_name = "system_pop";
105
106 public SystemPopBlock()
107 : base(type_name)
108 {
109 }
110
111 public void init()
112 {
113 this.appendDummyInput()
114 .appendField("フラッシュメモリから読み出します");
115 this.appendValueInput("ADDRESS")
116 .setCheck("Number")
117 .appendField("開始アドレス");
118 this.appendValueInput("LENGTH")
119 .setCheck("Number")
120 .appendField("サイズ");
121 this.setInputsInline(true);
122 this.setOutput(true, "String");
123 this.setColour(160);
124 this.setTooltip("");
125 this.setHelpUrl("http://www.example.com/");
126 }
127 }
128
129 public class SystemFileLoadBlock : Block
130 {
131 public const string type_name = "system_fileload";
132
133 public SystemFileLoadBlock()
134 : base(type_name)
135 {
136 }
137 public void init()
138 {
139 this.appendDummyInput()
140 .appendField("ファイルローダーを呼び出します");
141 this.setInputsInline(true);
142 this.setPreviousStatement(true, null);
143 this.setNextStatement(true, null);
144 this.setColour(160);
145 this.setTooltip("");
146 this.setHelpUrl("http://www.example.com/");
147 }
148 }
149
150 public class SystemResetBlock : Block
151 {
152 public const string type_name = "system_reset";
153
154 public SystemResetBlock()
155 : base(type_name)
156 {
157 }
158
159 public void init()
160 {
161 this.appendDummyInput()
162 .appendField("リセットします");
163 this.setInputsInline(true);
164 this.setPreviousStatement(true, null);
165 this.setNextStatement(true, null);
166 this.setColour(160);
167 this.setTooltip("");
168 this.setHelpUrl("http://www.example.com/");
169 }
170 }
171
172 public class SystemUseSdBlock : Block
173 {
174 public const string type_name = "system_use_sd";
175
176 public SystemUseSdBlock()
177 : base(type_name)
178 {
179 }
180
181 public void init()
182 {
183 this.appendDummyInput()
184 .appendField("SDカードを使えるようにします");
185 this.setInputsInline(true);
186 this.setOutput(true, "Boolean");
187 this.setColour(160);
188 this.setTooltip("");
189 this.setHelpUrl("http://www.example.com/");
190 }
191 }
192
193 public class SystemUseWifiBlock : Block
194 {
195 public const string type_name = "system_use_wifi";
196
197 public SystemUseWifiBlock()
198 : base(type_name)
199 {
200 }
201
202 public void init()
203 {
204 this.appendDummyInput()
205 .appendField("WiFiモジュールESP8266ボードを使えるようにします");
206 this.setInputsInline(true);
207 this.setOutput(true, "Boolean");
208 this.setColour(160);
209 this.setTooltip("");
210 this.setHelpUrl("http://www.example.com/");
211 }
212 }
213
214 public class SystemGetMrbPathBlock : Block
215 {
216 public const string type_name = "system_get_mrb_path";
217
218 public SystemGetMrbPathBlock()
219 : base(type_name)
220 {
221 }
222
223 public void init()
224 {
225 this.appendDummyInput()
226 .appendField("実行しているmrbファイルパスを取得します");
227 this.setInputsInline(true);
228 this.setOutput(true, "String");
229 this.setColour(160);
230 this.setTooltip("");
231 this.setHelpUrl("http://www.example.com/");
232 }
233 }
234
235 partial class Ruby
236 {
237 public node system_exit(SystemExitBlock block)
238 {
239 var c = new const_node(this, intern("System"));
240 var p = new node[0];
241 return new call_node(this, c, intern("exit"), p, null);
242 }
243
244 public node system_setrun(SystemSetRunBlock block)
245 {
246 var value_filename = valueToCode(block, "FILENAME");
247 var c = new const_node(this, intern("System"));
248 var p = new node[] {
249 value_filename
250 };
251 return new call_node(this, c, intern("setRun"), p, null);
252 }
253
254 public node system_version(SystemVersionBlock block)
255 {
256 var c = new const_node(this, intern("System"));
257 var p = new node[0];
258 return new call_node(this, c, intern("version"), p, null);
259 }
260
261 public node system_push(SystemPushBlock block)
262 {
263 var value_address = valueToCode(block, "ADDRESS");
264 var value_data = valueToCode(block, "DATA");
265 var value_length = valueToCode(block, "LENGTH");
266 var c = new const_node(this, intern("System"));
267 var p = new node[] {
268 value_address,
269 value_data,
270 value_length
271 };
272 return new call_node(this, c, intern("push"), p, null);
273 }
274
275 public node system_pop(SystemPopBlock block)
276 {
277 var value_address = valueToCode(block, "ADDRESS");
278 var value_length = valueToCode(block, "LENGTH");
279 var c = new const_node(this, intern("System"));
280 var p = new node[] {
281 value_address,
282 value_length
283 };
284 return new call_node(this, c, intern("pop"), p, null);
285 }
286
287 public node system_fileload(SystemFileLoadBlock block)
288 {
289 var c = new const_node(this, intern("System"));
290 var p = new node[0];
291 return new call_node(this, c, intern("fileload"), p, null);
292 }
293
294 public node system_reset(SystemResetBlock block)
295 {
296 var c = new const_node(this, intern("System"));
297 var p = new node[0];
298 return new call_node(this, c, intern("reset"), p, null);
299 }
300
301 public node system_use_sd(SystemUseSdBlock block)
302 {
303 var c = new const_node(this, intern("System"));
304 var p = new node[0];
305 return new call_node(this, c, intern("useSD"), p, null);
306 }
307
308 public node system_use_wifi(SystemUseWifiBlock block)
309 {
310 var c = new const_node(this, intern("System"));
311 var p = new node[0];
312 return new call_node(this, c, intern("useWiFi"), p, null);
313 }
314
315 public node system_get_mrb_path(SystemGetMrbPathBlock block)
316 {
317 var c = new const_node(this, intern("System"));
318 var p = new node[0];
319 return new call_node(this, c, intern("getMrbPath"), p, null);
320 }
321 }
322}
Note: See TracBrowser for help on using the repository browser.