automotive-ecu 0.3.1 → 0.3.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.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4ad47ed36e2d54205a5c804187b85e2f2a7b91d73f2fc1bc548f691a87804c88
|
|
4
|
+
data.tar.gz: 2ab14530309248995b479e9dc4010bf61a83f767efd62ddf9b739686791aaae5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: de3516033d423a95b0c813f3e22eed22a0195fbbf5c4d7b2dc6f3604d897d59bd4b7bc46f0b527651fa5f3c1ffecec4cc3642e3f1482033b0104154088abdb44
|
|
7
|
+
data.tar.gz: ebaf253e55c358547cb63ad4024a8bf0e90c6bb7a529b5ab30a9117593436aacd15d546bd226a5cf7a02156edfe2193c94e67f51e59fc9545c6b9688cd35b45b
|
|
@@ -48,12 +48,12 @@ class Ecu
|
|
|
48
48
|
|
|
49
49
|
return if @scan.eos?
|
|
50
50
|
|
|
51
|
-
case @scan.
|
|
52
|
-
when
|
|
53
|
-
when
|
|
54
|
-
when
|
|
55
|
-
when
|
|
56
|
-
when
|
|
51
|
+
case @doc.getbyte(@scan.pos)
|
|
52
|
+
when 10, 13 then @scan.skip(NEWLINE) && :NEWLINE # \n \r
|
|
53
|
+
when 34 then @scan.skip(QUOTED_TEXT) && :QUOTED_TEXT # "
|
|
54
|
+
when 42 then @scan.skip(COMMENT) && :COMMENT # *
|
|
55
|
+
when 64 then @scan.skip(DIMENSIONS_SEP) && :DIMENSIONS_SEP # @
|
|
56
|
+
when 43, 45, 46, 48..57 # + - . 0-9
|
|
57
57
|
if @scan.skip(FLOAT) then :FLOAT
|
|
58
58
|
elsif @scan.skip(INT) then :INT
|
|
59
59
|
else @scan.getch; :UNKNOWN_CHAR
|
|
@@ -158,10 +158,8 @@ class Ecu
|
|
|
158
158
|
|
|
159
159
|
def finish_label
|
|
160
160
|
next_state(:POST_HEADER) do
|
|
161
|
-
@properties
|
|
162
|
-
|
|
163
|
-
.then { @constructor.new(**_1) }
|
|
164
|
-
.tap { reset_label! }
|
|
161
|
+
@properties.delete(:displayname)
|
|
162
|
+
@constructor.new(**@properties).tap { reset_label! }
|
|
165
163
|
end
|
|
166
164
|
end
|
|
167
165
|
|
|
@@ -186,7 +184,12 @@ class Ecu
|
|
|
186
184
|
next_state(newstate) do
|
|
187
185
|
@key = KEY_MAPPING[key]
|
|
188
186
|
@is_ary = ARY_PROPERTIES.include?(@key)
|
|
189
|
-
|
|
187
|
+
if @is_ary
|
|
188
|
+
@properties[@key] ||= []
|
|
189
|
+
@value = @properties[@key] # alias: append_property writes directly to target
|
|
190
|
+
else
|
|
191
|
+
@value = nil
|
|
192
|
+
end
|
|
190
193
|
end
|
|
191
194
|
end
|
|
192
195
|
|
|
@@ -202,15 +205,10 @@ class Ecu
|
|
|
202
205
|
|
|
203
206
|
def finish_property
|
|
204
207
|
next_state(:LABEL_CONTENT) do
|
|
205
|
-
if @properties
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
fail "Multiple property lines not allowed for #{@key}"
|
|
210
|
-
end
|
|
211
|
-
else
|
|
212
|
-
@properties[@key] = @value
|
|
213
|
-
end
|
|
208
|
+
next if @is_ary # values already in @properties[@key] via @value alias
|
|
209
|
+
|
|
210
|
+
fail "Multiple property lines not allowed for #{@key}" if @properties.key?(@key)
|
|
211
|
+
@properties[@key] = @value
|
|
214
212
|
end
|
|
215
213
|
end
|
|
216
214
|
|
|
@@ -7,10 +7,11 @@ class Ecu
|
|
|
7
7
|
str << " LANGNAME #{description.enquote}\n" if description
|
|
8
8
|
str << " FUNKTION #{function}\n" if function
|
|
9
9
|
str << " EINHEIT_W #{unit.enquote}\n" if unit
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
if value.is_a?(Numeric)
|
|
11
|
+
str << " WERT " << value.to_s << "\n"
|
|
12
|
+
else
|
|
13
|
+
str << " TEXT " << value.enquote << "\n"
|
|
14
|
+
end
|
|
14
15
|
str << "END\n"
|
|
15
16
|
end
|
|
16
17
|
end
|
|
@@ -29,21 +29,23 @@ class Ecu
|
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
def to_dcm(indented=false)
|
|
32
|
-
|
|
32
|
+
buf = String.new
|
|
33
33
|
|
|
34
34
|
unless headers.empty?
|
|
35
|
-
|
|
35
|
+
headers.each { buf << "* " << _1 << "\n" }
|
|
36
|
+
buf << "\n"
|
|
36
37
|
end
|
|
37
38
|
|
|
38
|
-
|
|
39
|
+
buf << DCM_HEADER << "\n"
|
|
39
40
|
|
|
40
41
|
unless subheaders.empty?
|
|
41
|
-
|
|
42
|
+
buf << "\n"
|
|
43
|
+
subheaders.each { buf << "* " << _1 << "\n" }
|
|
42
44
|
end
|
|
43
45
|
|
|
44
|
-
|
|
46
|
+
each { buf << "\n" << _1.to_dcm(indented) }
|
|
45
47
|
|
|
46
|
-
|
|
48
|
+
buf
|
|
47
49
|
end
|
|
48
50
|
end
|
|
49
51
|
end
|
data/lib/ecu/version.rb
CHANGED