lignite 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +5 -0
- data/NEWS.md +8 -0
- data/VERSION +1 -1
- data/examples/light-sensor.rb +1 -2
- data/lib/lignite/assembler.rb +48 -14
- data/lib/lignite/body_compiler.rb +71 -5
- data/lib/lignite/direct_commands.rb +3 -1
- data/lib/lignite/ev3_ops.rb +255 -14
- data/lib/lignite/op_compiler.rb +1 -1
- data/lib/lignite/parameter_declarer.rb +108 -0
- data/lib/lignite/rbf_declarer.rb +52 -0
- data/lib/lignite/rbf_object.rb +7 -2
- data/lib/lignite/variables.rb +18 -0
- data/lignite.gemspec +8 -0
- data/spec/assembler_spec.rb +9 -6
- data/spec/data/ColorReadout.rb +1 -1
- data/spec/data/Performance.lms +735 -0
- data/spec/data/Performance.rb +690 -0
- data/spec/data/Performance.rbf +0 -0
- data/spec/data/VernierReadout.rb +1 -1
- data/spec/data/p11.c +36 -0
- data/spec/data/p11.rb +20 -0
- data/spec/data/p11.rbf +0 -0
- data/spec/spec_helper.rb +24 -1
- data/tools/ops_from_yml +1 -1
- metadata +10 -2
Binary file
|
data/spec/data/VernierReadout.rb
CHANGED
@@ -13,7 +13,7 @@ vmthread :MAIN do
|
|
13
13
|
ui_draw(TEXT, FG_COLOR, 0, 50, "Raw 1")
|
14
14
|
ui_draw(SELECT_FONT, NORMAL_FONT)
|
15
15
|
|
16
|
-
input_device(READY_RAW, 0, PORT, 1, 0,
|
16
|
+
input_device(READY_RAW, 0, PORT, 1, 0, :Data1)
|
17
17
|
|
18
18
|
and32(:Data1, 0xFFFF, :Data1)
|
19
19
|
strings(NUMBER_FORMATTED, :Data1, "%-5d", 8, :String)
|
data/spec/data/p11.c
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
/*! \page subparexample1 Calling Subroutine with Parameters
|
2
|
+
*
|
3
|
+
* This program shows how to call byte code subroutine with parameters
|
4
|
+
*
|
5
|
+
* <hr size="1"/>
|
6
|
+
* \verbatim */
|
7
|
+
|
8
|
+
UBYTE prg[] = // p11
|
9
|
+
{ //
|
10
|
+
PROGRAMHeader(0,2,2), // VersionInfo,NumberOfObjects,GlobalBytes
|
11
|
+
VMTHREADHeader(0,2), // OffsetToInstructions,LocalBytes
|
12
|
+
SUBCALLHeader(0,2), // OffsetToInstructions,LocalBytes
|
13
|
+
//
|
14
|
+
// VMTHREAD1
|
15
|
+
// {
|
16
|
+
opMOVE8_8,LC0(1),LV0(0), // LV0 = 1
|
17
|
+
opCALL,LC0(2),LC0(2),LV0(0),LV0(1), // SUBCALL(2,2,LV0,LV1)
|
18
|
+
opUI_WRITE,LC0(VALUE8),LV0(1), // UI_WRITE(VALUE8,LV1)
|
19
|
+
opUI_WRITE,LC0(PUT_STRING),LCS,'\r', // UI_WRITE(PUT_STRING,"\r\n")
|
20
|
+
'\n',0,
|
21
|
+
opUI_FLUSH, // UI_FLUSH
|
22
|
+
opOBJECT_END, // }
|
23
|
+
//
|
24
|
+
2,IN_8,OUT_8, // SUBCALL2(InDATA8,OutDATA8)
|
25
|
+
// {
|
26
|
+
opUI_WRITE,LC0(VALUE8),LV0(0), // UI_WRITE(VALUE8,LV0)
|
27
|
+
opUI_WRITE,LC0(PUT_STRING),LCS,'\r', // UI_WRITE(PUT_STRING,"\r\n")
|
28
|
+
'\n',0,
|
29
|
+
opUI_FLUSH, // UI_FLUSH
|
30
|
+
opMOVE8_8,LV0(0),LV0(1), // LV1 = 2
|
31
|
+
opRETURN, // }
|
32
|
+
opOBJECT_END, //
|
33
|
+
};
|
34
|
+
|
35
|
+
/* \endverbatim \ref subpar "Parameter Encoding"
|
36
|
+
*/
|
data/spec/data/p11.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
vmthread :main do
|
2
|
+
data8 :var1
|
3
|
+
data8 :var2
|
4
|
+
|
5
|
+
move8_8(1, :var1)
|
6
|
+
call(:foo, :var1, :var2)
|
7
|
+
ui_write_value8(:var2)
|
8
|
+
ui_write_put_string("\r\n")
|
9
|
+
ui_flush
|
10
|
+
end
|
11
|
+
|
12
|
+
sub :foo do
|
13
|
+
in8 :par1
|
14
|
+
out8 :par2
|
15
|
+
|
16
|
+
ui_write_value8(:par1)
|
17
|
+
ui_write_put_string("\r\n")
|
18
|
+
ui_flush
|
19
|
+
move8_8(:par1, :par2)
|
20
|
+
end
|
data/spec/data/p11.rbf
ADDED
Binary file
|
data/spec/spec_helper.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
RSpec.configure do |config|
|
3
2
|
config.mock_with :rspec do |mocks|
|
4
3
|
# If you misremember a method name both in code and in tests,
|
@@ -30,3 +29,27 @@ end
|
|
30
29
|
def datadir
|
31
30
|
File.expand_path("../data", __FILE__)
|
32
31
|
end
|
32
|
+
|
33
|
+
# for better displays in rspec failure diffs
|
34
|
+
def rbf_dump(bytestring, offsets: false)
|
35
|
+
lines = bytestring.bytes.map do |n|
|
36
|
+
format("0x%02x %3d %s", n, n, n.chr.inspect)
|
37
|
+
end
|
38
|
+
if offsets
|
39
|
+
lines.each_with_index do |l, i|
|
40
|
+
l.replace("#{i}: #{l}")
|
41
|
+
end
|
42
|
+
end
|
43
|
+
lines.join "\n"
|
44
|
+
end
|
45
|
+
|
46
|
+
def expect_rbf_files_same(actual_rbf, expected_rbf)
|
47
|
+
actual_bytes = File.read(actual_rbf, encoding: Encoding::BINARY)
|
48
|
+
expected_bytes = File.read(expected_rbf, encoding: Encoding::BINARY)
|
49
|
+
|
50
|
+
show_offsets = actual_bytes.bytesize == expected_bytes.bytesize
|
51
|
+
actual_dump = rbf_dump(actual_bytes, offsets: show_offsets)
|
52
|
+
expected_dump = rbf_dump(expected_bytes, offsets: show_offsets)
|
53
|
+
|
54
|
+
expect(actual_dump).to eq(expected_dump)
|
55
|
+
end
|
data/tools/ops_from_yml
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lignite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Vidner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-03-
|
11
|
+
date: 2018-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: libusb
|
@@ -184,6 +184,8 @@ files:
|
|
184
184
|
- lib/lignite/message.rb
|
185
185
|
- lib/lignite/motors.rb
|
186
186
|
- lib/lignite/op_compiler.rb
|
187
|
+
- lib/lignite/parameter_declarer.rb
|
188
|
+
- lib/lignite/rbf_declarer.rb
|
187
189
|
- lib/lignite/rbf_object.rb
|
188
190
|
- lib/lignite/system_commands.rb
|
189
191
|
- lib/lignite/variables.rb
|
@@ -203,6 +205,9 @@ files:
|
|
203
205
|
- spec/data/NoDebug.lms
|
204
206
|
- spec/data/NoDebug.rb
|
205
207
|
- spec/data/NoDebug.rbf
|
208
|
+
- spec/data/Performance.lms
|
209
|
+
- spec/data/Performance.rb
|
210
|
+
- spec/data/Performance.rbf
|
206
211
|
- spec/data/VernierReadout.lms
|
207
212
|
- spec/data/VernierReadout.rb
|
208
213
|
- spec/data/VernierReadout.rbf
|
@@ -212,6 +217,9 @@ files:
|
|
212
217
|
- spec/data/ev3tool_stop.yml
|
213
218
|
- spec/data/ev3tool_upload.yml
|
214
219
|
- spec/data/everstorm.rbf
|
220
|
+
- spec/data/p11.c
|
221
|
+
- spec/data/p11.rb
|
222
|
+
- spec/data/p11.rbf
|
215
223
|
- spec/direct_commands_spec.rb
|
216
224
|
- spec/ev3_tool_spec.rb
|
217
225
|
- spec/spec_helper.rb
|