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

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

ファイルヘッダーコメントを追加

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-csharp
File size: 9.9 KB
Line 
1/*
2 * TOPPERS/ECNL Prototyping tool
3 *
4 * Copyright (C) 2017 Cores Co., Ltd. Japan
5 *
6 * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
7 * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
8 * 変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
9 * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
10 * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
11 * スコード中に含まれていること.
12 * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
13 * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用
14 * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記
15 * の無保証規定を掲載すること.
16 * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
17 * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ
18 * と.
19 * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
20 * 作権表示,この利用条件および下記の無保証規定を掲載すること.
21 * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
22 * 報告すること.
23 * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
24 * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
25 * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
26 * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
27 * 免責すること.
28 *
29 * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お
30 * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
31 * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
32 * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
33 * の責任を負わない.
34 *
35 * @(#) $Id: SystemBlock.cs 287 2017-05-05 14:22:23Z coas-nagasima $
36 */
37using System;
38using System.Collections.Generic;
39using System.Linq;
40
41namespace WebMrbc
42{
43 public class SystemExitBlock : Block
44 {
45 public const string type_name = "system_exit";
46
47 public SystemExitBlock()
48 : base(type_name)
49 {
50 }
51
52 public void init()
53 {
54 this.appendDummyInput()
55 .appendField("終了させます");
56 this.setPreviousStatement(true, null);
57 this.setNextStatement(true, null);
58 this.setColour(160);
59 this.setTooltip("");
60 this.setHelpUrl("http://www.example.com/");
61 }
62 }
63
64 public class SystemSetRunBlock : Block
65 {
66 public const string type_name = "system_setrun";
67
68 public SystemSetRunBlock()
69 : base(type_name)
70 {
71 }
72
73 public void init()
74 {
75 this.appendDummyInput()
76 .appendField("次に実行するスクリプトファイルをセットします");
77 this.appendValueInput("FILENAME")
78 .setCheck("String");
79 this.setInputsInline(true);
80 this.setPreviousStatement(true, null);
81 this.setNextStatement(true, null);
82 this.setColour(160);
83 this.setTooltip("");
84 this.setHelpUrl("http://www.example.com/");
85 }
86 }
87
88 public class SystemVersionBlock : Block
89 {
90 public const string type_name = "system_version";
91
92 public SystemVersionBlock()
93 : base(type_name)
94 {
95 }
96
97 public void init()
98 {
99 this.appendDummyInput()
100 .appendField("システムのバージョンを取得します");
101 this.setOutput(true, "String");
102 this.setColour(160);
103 this.setTooltip("");
104 this.setHelpUrl("http://www.example.com/");
105 }
106 }
107
108 public class SystemPushBlock : Block
109 {
110 public const string type_name = "system_push";
111
112 public SystemPushBlock()
113 : base(type_name)
114 {
115 }
116 public void init()
117 {
118 this.appendDummyInput()
119 .appendField("フラッシュメモリに書き込みます");
120 this.appendValueInput("ADDRESS")
121 .setCheck("Number")
122 .appendField("開始アドレス");
123 this.appendValueInput("DATA")
124 .setCheck("String")
125 .appendField("データ");
126 this.appendValueInput("LENGTH")
127 .setCheck("Number")
128 .appendField("サイズ");
129 this.setInputsInline(true);
130 this.setPreviousStatement(true, null);
131 this.setNextStatement(true, null);
132 this.setColour(160);
133 this.setTooltip("");
134 this.setHelpUrl("http://www.example.com/");
135 }
136 }
137
138 public class SystemPopBlock : Block
139 {
140 public const string type_name = "system_pop";
141
142 public SystemPopBlock()
143 : base(type_name)
144 {
145 }
146
147 public void init()
148 {
149 this.appendDummyInput()
150 .appendField("フラッシュメモリから読み出します");
151 this.appendValueInput("ADDRESS")
152 .setCheck("Number")
153 .appendField("開始アドレス");
154 this.appendValueInput("LENGTH")
155 .setCheck("Number")
156 .appendField("サイズ");
157 this.setInputsInline(true);
158 this.setOutput(true, "String");
159 this.setColour(160);
160 this.setTooltip("");
161 this.setHelpUrl("http://www.example.com/");
162 }
163 }
164
165 public class SystemFileLoadBlock : Block
166 {
167 public const string type_name = "system_fileload";
168
169 public SystemFileLoadBlock()
170 : base(type_name)
171 {
172 }
173 public void init()
174 {
175 this.appendDummyInput()
176 .appendField("ファイルローダーを呼び出します");
177 this.setInputsInline(true);
178 this.setPreviousStatement(true, null);
179 this.setNextStatement(true, null);
180 this.setColour(160);
181 this.setTooltip("");
182 this.setHelpUrl("http://www.example.com/");
183 }
184 }
185
186 public class SystemResetBlock : Block
187 {
188 public const string type_name = "system_reset";
189
190 public SystemResetBlock()
191 : base(type_name)
192 {
193 }
194
195 public void init()
196 {
197 this.appendDummyInput()
198 .appendField("リセットします");
199 this.setInputsInline(true);
200 this.setPreviousStatement(true, null);
201 this.setNextStatement(true, null);
202 this.setColour(160);
203 this.setTooltip("");
204 this.setHelpUrl("http://www.example.com/");
205 }
206 }
207
208 public class SystemUseSdBlock : Block
209 {
210 public const string type_name = "system_use_sd";
211
212 public SystemUseSdBlock()
213 : base(type_name)
214 {
215 }
216
217 public void init()
218 {
219 this.appendDummyInput()
220 .appendField("SDカードを使えるようにします");
221 this.setInputsInline(true);
222 this.setOutput(true, "Boolean");
223 this.setColour(160);
224 this.setTooltip("");
225 this.setHelpUrl("http://www.example.com/");
226 }
227 }
228
229 public class SystemUseWifiBlock : Block
230 {
231 public const string type_name = "system_use_wifi";
232
233 public SystemUseWifiBlock()
234 : base(type_name)
235 {
236 }
237
238 public void init()
239 {
240 this.appendDummyInput()
241 .appendField("WiFiモジュールESP8266ボードを使えるようにします");
242 this.setInputsInline(true);
243 this.setOutput(true, "Boolean");
244 this.setColour(160);
245 this.setTooltip("");
246 this.setHelpUrl("http://www.example.com/");
247 }
248 }
249
250 public class SystemGetMrbPathBlock : Block
251 {
252 public const string type_name = "system_get_mrb_path";
253
254 public SystemGetMrbPathBlock()
255 : base(type_name)
256 {
257 }
258
259 public void init()
260 {
261 this.appendDummyInput()
262 .appendField("実行しているmrbファイルパスを取得します");
263 this.setInputsInline(true);
264 this.setOutput(true, "String");
265 this.setColour(160);
266 this.setTooltip("");
267 this.setHelpUrl("http://www.example.com/");
268 }
269 }
270
271 partial class Ruby
272 {
273 public node system_exit(SystemExitBlock block)
274 {
275 var c = new const_node(this, intern("System"));
276 var p = new node[0];
277 return new call_node(this, c, intern("exit"), p, null);
278 }
279
280 public node system_setrun(SystemSetRunBlock block)
281 {
282 var value_filename = valueToCode(block, "FILENAME");
283 var c = new const_node(this, intern("System"));
284 var p = new node[] {
285 value_filename
286 };
287 return new call_node(this, c, intern("setRun"), p, null);
288 }
289
290 public node system_version(SystemVersionBlock block)
291 {
292 var c = new const_node(this, intern("System"));
293 var p = new node[0];
294 return new call_node(this, c, intern("version"), p, null);
295 }
296
297 public node system_push(SystemPushBlock block)
298 {
299 var value_address = valueToCode(block, "ADDRESS");
300 var value_data = valueToCode(block, "DATA");
301 var value_length = valueToCode(block, "LENGTH");
302 var c = new const_node(this, intern("System"));
303 var p = new node[] {
304 value_address,
305 value_data,
306 value_length
307 };
308 return new call_node(this, c, intern("push"), p, null);
309 }
310
311 public node system_pop(SystemPopBlock block)
312 {
313 var value_address = valueToCode(block, "ADDRESS");
314 var value_length = valueToCode(block, "LENGTH");
315 var c = new const_node(this, intern("System"));
316 var p = new node[] {
317 value_address,
318 value_length
319 };
320 return new call_node(this, c, intern("pop"), p, null);
321 }
322
323 public node system_fileload(SystemFileLoadBlock block)
324 {
325 var c = new const_node(this, intern("System"));
326 var p = new node[0];
327 return new call_node(this, c, intern("fileload"), p, null);
328 }
329
330 public node system_reset(SystemResetBlock block)
331 {
332 var c = new const_node(this, intern("System"));
333 var p = new node[0];
334 return new call_node(this, c, intern("reset"), p, null);
335 }
336
337 public node system_use_sd(SystemUseSdBlock block)
338 {
339 var c = new const_node(this, intern("System"));
340 var p = new node[0];
341 return new call_node(this, c, intern("useSD"), p, null);
342 }
343
344 public node system_use_wifi(SystemUseWifiBlock block)
345 {
346 var c = new const_node(this, intern("System"));
347 var p = new node[0];
348 return new call_node(this, c, intern("useWiFi"), p, null);
349 }
350
351 public node system_get_mrb_path(SystemGetMrbPathBlock block)
352 {
353 var c = new const_node(this, intern("System"));
354 var p = new node[0];
355 return new call_node(this, c, intern("getMrbPath"), p, null);
356 }
357 }
358}
Note: See TracBrowser for help on using the repository browser.