automotive-ecu 0.1.0
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 +7 -0
- data/bin/bundle +114 -0
- data/bin/coderay +29 -0
- data/bin/console +14 -0
- data/bin/htmldiff +29 -0
- data/bin/irb +29 -0
- data/bin/ldiff +29 -0
- data/bin/pry +29 -0
- data/bin/rake +29 -0
- data/bin/rspec +29 -0
- data/bin/setup +8 -0
- data/lib/core_ext.rb +69 -0
- data/lib/ecu/combined_list.rb +25 -0
- data/lib/ecu/combined_list_comparison.rb +50 -0
- data/lib/ecu/interfaces/a2l/label_list.rb +18 -0
- data/lib/ecu/interfaces/a2l/signal_list.rb +15 -0
- data/lib/ecu/interfaces/dbc/signal_list.rb +12 -0
- data/lib/ecu/interfaces/dcm/buffer.rb +39 -0
- data/lib/ecu/interfaces/dcm/festkennfeld.rb +9 -0
- data/lib/ecu/interfaces/dcm/festkennlinie.rb +9 -0
- data/lib/ecu/interfaces/dcm/festwert.rb +20 -0
- data/lib/ecu/interfaces/dcm/festwerteblock.rb +26 -0
- data/lib/ecu/interfaces/dcm/functions.rb +13 -0
- data/lib/ecu/interfaces/dcm/gruppenkennfeld.rb +9 -0
- data/lib/ecu/interfaces/dcm/gruppenkennlinie.rb +9 -0
- data/lib/ecu/interfaces/dcm/kennfeld.rb +32 -0
- data/lib/ecu/interfaces/dcm/kennlinie.rb +25 -0
- data/lib/ecu/interfaces/dcm/label.rb +25 -0
- data/lib/ecu/interfaces/dcm/label_list.rb +94 -0
- data/lib/ecu/interfaces/dcm/malformed_dcm_error.rb +34 -0
- data/lib/ecu/interfaces/dcm/property_parser.rb +51 -0
- data/lib/ecu/interfaces/dcm/stuetzstellenverteilung.rb +20 -0
- data/lib/ecu/interfaces/lab/combined_list.rb +32 -0
- data/lib/ecu/interfaces/lab/lab_parser.rb +61 -0
- data/lib/ecu/interfaces/lab/label.rb +21 -0
- data/lib/ecu/interfaces/lab/label_list.rb +29 -0
- data/lib/ecu/interfaces/lab/signal.rb +15 -0
- data/lib/ecu/interfaces/lab/signal_list.rb +29 -0
- data/lib/ecu/interfaces/mfile/festwert.rb +10 -0
- data/lib/ecu/interfaces/mfile/festwerteblock.rb +12 -0
- data/lib/ecu/interfaces/mfile/kennfeld.rb +12 -0
- data/lib/ecu/interfaces/mfile/kennlinie.rb +7 -0
- data/lib/ecu/interfaces/mfile/label_list.rb +13 -0
- data/lib/ecu/interfaces/mfile/stuetzstellenverteilung.rb +7 -0
- data/lib/ecu/labels/festwert.rb +58 -0
- data/lib/ecu/labels/festwerteblock.rb +80 -0
- data/lib/ecu/labels/interpolator.rb +55 -0
- data/lib/ecu/labels/kennfeld.rb +107 -0
- data/lib/ecu/labels/kennlinie.rb +84 -0
- data/lib/ecu/labels/label.rb +82 -0
- data/lib/ecu/labels/label_list.rb +137 -0
- data/lib/ecu/labels/label_list_comparison.rb +65 -0
- data/lib/ecu/labels/stuetzstellenverteilung.rb +65 -0
- data/lib/ecu/labels/value_comparison.rb +37 -0
- data/lib/ecu/labels/value_printer.rb +49 -0
- data/lib/ecu/labels.rb +2 -0
- data/lib/ecu/signals/signal.rb +73 -0
- data/lib/ecu/signals/signal_list.rb +68 -0
- data/lib/ecu/signals/signal_list_comparison.rb +52 -0
- data/lib/ecu/signals.rb +2 -0
- data/lib/ecu/version.rb +3 -0
- data/lib/ecu.rb +59 -0
- metadata +161 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: f3139f297c357d29c6be36cc632e0cbebf76a3c76e736643c167f5cfe7dc76bf
|
|
4
|
+
data.tar.gz: 3323e14ffcd10a81a12ef769b082cf9f7564b1270531577668e1c7245d8c15c3
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: fa1e976d1554572d6d5cf99c3dad4b962f6e6a25fc125186cebf0fd0c9bafe090cd5ca160dc54871a472ec5ddb1a7136f0fd8d28b11e5678abd71c8e8a301e46
|
|
7
|
+
data.tar.gz: 020715725ac80d08fe8171d1af0f93b80dec3541fcd96272c1a77400f8de88fcae6ad54233c44e00214cfc7bbd96137d8ad0cccf27d3c756516f053f5f525486
|
data/bin/bundle
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
#
|
|
5
|
+
# This file was generated by Bundler.
|
|
6
|
+
#
|
|
7
|
+
# The application 'bundle' is installed as part of a gem, and
|
|
8
|
+
# this file is here to facilitate running it.
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
require "rubygems"
|
|
12
|
+
|
|
13
|
+
m = Module.new do
|
|
14
|
+
module_function
|
|
15
|
+
|
|
16
|
+
def invoked_as_script?
|
|
17
|
+
File.expand_path($0) == File.expand_path(__FILE__)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def env_var_version
|
|
21
|
+
ENV["BUNDLER_VERSION"]
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def cli_arg_version
|
|
25
|
+
return unless invoked_as_script? # don't want to hijack other binstubs
|
|
26
|
+
return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
|
|
27
|
+
bundler_version = nil
|
|
28
|
+
update_index = nil
|
|
29
|
+
ARGV.each_with_index do |a, i|
|
|
30
|
+
if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
|
|
31
|
+
bundler_version = a
|
|
32
|
+
end
|
|
33
|
+
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
|
|
34
|
+
bundler_version = $1
|
|
35
|
+
update_index = i
|
|
36
|
+
end
|
|
37
|
+
bundler_version
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def gemfile
|
|
41
|
+
gemfile = ENV["BUNDLE_GEMFILE"]
|
|
42
|
+
return gemfile if gemfile && !gemfile.empty?
|
|
43
|
+
|
|
44
|
+
File.expand_path("../../gems.rb", __FILE__)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def lockfile
|
|
48
|
+
lockfile =
|
|
49
|
+
case File.basename(gemfile)
|
|
50
|
+
when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
|
|
51
|
+
else "#{gemfile}.lock"
|
|
52
|
+
end
|
|
53
|
+
File.expand_path(lockfile)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def lockfile_version
|
|
57
|
+
return unless File.file?(lockfile)
|
|
58
|
+
lockfile_contents = File.read(lockfile)
|
|
59
|
+
return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
|
|
60
|
+
Regexp.last_match(1)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def bundler_version
|
|
64
|
+
@bundler_version ||=
|
|
65
|
+
env_var_version || cli_arg_version ||
|
|
66
|
+
lockfile_version
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def bundler_requirement
|
|
70
|
+
return "#{Gem::Requirement.default}.a" unless bundler_version
|
|
71
|
+
|
|
72
|
+
bundler_gem_version = Gem::Version.new(bundler_version)
|
|
73
|
+
|
|
74
|
+
requirement = bundler_gem_version.approximate_recommendation
|
|
75
|
+
|
|
76
|
+
return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0")
|
|
77
|
+
|
|
78
|
+
requirement += ".a" if bundler_gem_version.prerelease?
|
|
79
|
+
|
|
80
|
+
requirement
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def load_bundler!
|
|
84
|
+
ENV["BUNDLE_GEMFILE"] ||= gemfile
|
|
85
|
+
|
|
86
|
+
activate_bundler
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def activate_bundler
|
|
90
|
+
gem_error = activation_error_handling do
|
|
91
|
+
gem "bundler", bundler_requirement
|
|
92
|
+
end
|
|
93
|
+
return if gem_error.nil?
|
|
94
|
+
require_error = activation_error_handling do
|
|
95
|
+
require "bundler/version"
|
|
96
|
+
end
|
|
97
|
+
return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
|
|
98
|
+
warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
|
|
99
|
+
exit 42
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def activation_error_handling
|
|
103
|
+
yield
|
|
104
|
+
nil
|
|
105
|
+
rescue StandardError, LoadError => e
|
|
106
|
+
e
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
m.load_bundler!
|
|
111
|
+
|
|
112
|
+
if m.invoked_as_script?
|
|
113
|
+
load Gem.bin_path("bundler", "bundle")
|
|
114
|
+
end
|
data/bin/coderay
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
#
|
|
5
|
+
# This file was generated by Bundler.
|
|
6
|
+
#
|
|
7
|
+
# The application 'coderay' is installed as part of a gem, and
|
|
8
|
+
# this file is here to facilitate running it.
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
require "pathname"
|
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../gems.rb",
|
|
13
|
+
Pathname.new(__FILE__).realpath)
|
|
14
|
+
|
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
|
16
|
+
|
|
17
|
+
if File.file?(bundle_binstub)
|
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
|
19
|
+
load(bundle_binstub)
|
|
20
|
+
else
|
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
require "rubygems"
|
|
27
|
+
require "bundler/setup"
|
|
28
|
+
|
|
29
|
+
load Gem.bin_path("coderay", "coderay")
|
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "ecu"
|
|
5
|
+
|
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
+
|
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
+
# require "pry"
|
|
11
|
+
# Pry.start
|
|
12
|
+
|
|
13
|
+
require "irb"
|
|
14
|
+
IRB.start
|
data/bin/htmldiff
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
#
|
|
5
|
+
# This file was generated by Bundler.
|
|
6
|
+
#
|
|
7
|
+
# The application 'htmldiff' is installed as part of a gem, and
|
|
8
|
+
# this file is here to facilitate running it.
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
require "pathname"
|
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../gems.rb",
|
|
13
|
+
Pathname.new(__FILE__).realpath)
|
|
14
|
+
|
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
|
16
|
+
|
|
17
|
+
if File.file?(bundle_binstub)
|
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
|
19
|
+
load(bundle_binstub)
|
|
20
|
+
else
|
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
require "rubygems"
|
|
27
|
+
require "bundler/setup"
|
|
28
|
+
|
|
29
|
+
load Gem.bin_path("diff-lcs", "htmldiff")
|
data/bin/irb
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
#
|
|
5
|
+
# This file was generated by Bundler.
|
|
6
|
+
#
|
|
7
|
+
# The application 'irb' is installed as part of a gem, and
|
|
8
|
+
# this file is here to facilitate running it.
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
require "pathname"
|
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../gems.rb",
|
|
13
|
+
Pathname.new(__FILE__).realpath)
|
|
14
|
+
|
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
|
16
|
+
|
|
17
|
+
if File.file?(bundle_binstub)
|
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
|
19
|
+
load(bundle_binstub)
|
|
20
|
+
else
|
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
require "rubygems"
|
|
27
|
+
require "bundler/setup"
|
|
28
|
+
|
|
29
|
+
load Gem.bin_path("irb", "irb")
|
data/bin/ldiff
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
#
|
|
5
|
+
# This file was generated by Bundler.
|
|
6
|
+
#
|
|
7
|
+
# The application 'ldiff' is installed as part of a gem, and
|
|
8
|
+
# this file is here to facilitate running it.
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
require "pathname"
|
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../gems.rb",
|
|
13
|
+
Pathname.new(__FILE__).realpath)
|
|
14
|
+
|
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
|
16
|
+
|
|
17
|
+
if File.file?(bundle_binstub)
|
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
|
19
|
+
load(bundle_binstub)
|
|
20
|
+
else
|
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
require "rubygems"
|
|
27
|
+
require "bundler/setup"
|
|
28
|
+
|
|
29
|
+
load Gem.bin_path("diff-lcs", "ldiff")
|
data/bin/pry
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
#
|
|
5
|
+
# This file was generated by Bundler.
|
|
6
|
+
#
|
|
7
|
+
# The application 'pry' is installed as part of a gem, and
|
|
8
|
+
# this file is here to facilitate running it.
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
require "pathname"
|
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../gems.rb",
|
|
13
|
+
Pathname.new(__FILE__).realpath)
|
|
14
|
+
|
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
|
16
|
+
|
|
17
|
+
if File.file?(bundle_binstub)
|
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
|
19
|
+
load(bundle_binstub)
|
|
20
|
+
else
|
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
require "rubygems"
|
|
27
|
+
require "bundler/setup"
|
|
28
|
+
|
|
29
|
+
load Gem.bin_path("pry", "pry")
|
data/bin/rake
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
#
|
|
5
|
+
# This file was generated by Bundler.
|
|
6
|
+
#
|
|
7
|
+
# The application 'rake' is installed as part of a gem, and
|
|
8
|
+
# this file is here to facilitate running it.
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
require "pathname"
|
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../gems.rb",
|
|
13
|
+
Pathname.new(__FILE__).realpath)
|
|
14
|
+
|
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
|
16
|
+
|
|
17
|
+
if File.file?(bundle_binstub)
|
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
|
19
|
+
load(bundle_binstub)
|
|
20
|
+
else
|
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
require "rubygems"
|
|
27
|
+
require "bundler/setup"
|
|
28
|
+
|
|
29
|
+
load Gem.bin_path("rake", "rake")
|
data/bin/rspec
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
#
|
|
5
|
+
# This file was generated by Bundler.
|
|
6
|
+
#
|
|
7
|
+
# The application 'rspec' is installed as part of a gem, and
|
|
8
|
+
# this file is here to facilitate running it.
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
require "pathname"
|
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../gems.rb",
|
|
13
|
+
Pathname.new(__FILE__).realpath)
|
|
14
|
+
|
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
|
16
|
+
|
|
17
|
+
if File.file?(bundle_binstub)
|
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
|
19
|
+
load(bundle_binstub)
|
|
20
|
+
else
|
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
require "rubygems"
|
|
27
|
+
require "bundler/setup"
|
|
28
|
+
|
|
29
|
+
load Gem.bin_path("rspec-core", "rspec")
|
data/bin/setup
ADDED
data/lib/core_ext.rb
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
class String
|
|
2
|
+
BLANK_RE = /\A[[:space:]]*\z/
|
|
3
|
+
|
|
4
|
+
def blank?
|
|
5
|
+
empty? || BLANK_RE === self || self == "\u001A"
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def indent(spaces = 2)
|
|
9
|
+
lines.map { |line| " " * spaces + line }.join
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def inline_dcm
|
|
13
|
+
"KONSERVIERUNG_FORMAT 2.0\n\n" + self
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def enquote
|
|
17
|
+
"\"#{to_s}\""
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def to_si
|
|
21
|
+
[self].pack("H*").unpack("l>").first
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def delete_surrounding(char)
|
|
25
|
+
self.delete_prefix(char).delete_suffix(char)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def to_regexp(ignorecase: false, multiline: false, extended: false)
|
|
29
|
+
options = 0
|
|
30
|
+
options = options | Regexp::EXTENDED if extended
|
|
31
|
+
options = options | Regexp::IGNORECASE if ignorecase
|
|
32
|
+
options = options | Regexp::MULTILINE if multiline
|
|
33
|
+
Regexp.new(self, options)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
class Regexp
|
|
38
|
+
def extract_captures(str)
|
|
39
|
+
data = match(str)
|
|
40
|
+
return {} if data.nil?
|
|
41
|
+
data.named_captures.symbolize_keys
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
class Array
|
|
46
|
+
def avg
|
|
47
|
+
empty? ? nil : sum.to_f / count
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
class Hash
|
|
52
|
+
def symbolize_keys
|
|
53
|
+
self.map { |k, v| [k.to_sym, v] }.to_h
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
class File
|
|
58
|
+
def self.read_encoded(filepath)
|
|
59
|
+
read(filepath).encode('UTF-8', 'ISO-8859-1', invalid: :replace, undef: :replace, replace: '')
|
|
60
|
+
#read(filepath)
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
class Range
|
|
65
|
+
def overlaps?(other)
|
|
66
|
+
max >= other.min && min <= other.min ||
|
|
67
|
+
other.max >= min && other.min <= min
|
|
68
|
+
end
|
|
69
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
require_relative "labels/label_list"
|
|
2
|
+
require_relative "signals/signal_list"
|
|
3
|
+
require_relative "combined_list_comparison"
|
|
4
|
+
require_relative "interfaces/lab/combined_list"
|
|
5
|
+
|
|
6
|
+
class Ecu
|
|
7
|
+
class CombinedList
|
|
8
|
+
|
|
9
|
+
def initialize(signals=SignalList.new, labels=LabelList.new, headers=[], subheaders=[])
|
|
10
|
+
@signals = signals
|
|
11
|
+
@labels = labels
|
|
12
|
+
@headers = headers
|
|
13
|
+
@subheaders = subheaders
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
attr_accessor :signals, :labels, :headers, :subheaders
|
|
17
|
+
|
|
18
|
+
def to_s
|
|
19
|
+
"<CombinedList: #{signals.count} signals, #{labels.count} labels}>"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def inspect; to_s end
|
|
23
|
+
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
require_relative "signals/signal_list_comparison"
|
|
2
|
+
require_relative "labels/label_list_comparison"
|
|
3
|
+
require_relative "combined_list"
|
|
4
|
+
|
|
5
|
+
class Ecu
|
|
6
|
+
class CombinedListComparison
|
|
7
|
+
|
|
8
|
+
def initialize(left, right)
|
|
9
|
+
|
|
10
|
+
# TODO: This could/should be more leaniant and convert
|
|
11
|
+
# {Signal/Label}Lists on the fly to allow for comparison
|
|
12
|
+
|
|
13
|
+
unless left.is_a?(CombinedList) && right.is_a?(CombinedList)
|
|
14
|
+
fail "Can only merge CombinedList (left: #{left.class}, right: #{right.class})!"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
@signal_comparison = SignalListComparison.new(left.signals, right.signals)
|
|
18
|
+
@label_comparison = LabelListComparison.new(left.labels, right.labels)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def names(spec)
|
|
22
|
+
signal_comparison.names(spec) + label_comparison.names(spec)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def left_exclusive
|
|
26
|
+
signal_comparison.left_exclusive + label_comparison.left_exclusive
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def right_exclusive
|
|
30
|
+
signal_comparison.right_exclusive + label_comparison.right_exclusive
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def differences
|
|
34
|
+
signal_comparison.differences + label_comparison.differences
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def merge(priority: :right)
|
|
38
|
+
CombinedList.new \
|
|
39
|
+
signal_comparison.merge(priority: priority),
|
|
40
|
+
label_comparison.merge(priority: priority),
|
|
41
|
+
signal_comparison.headers, # Both should merge headers the same
|
|
42
|
+
signal_comparison.subheaders # way, so it doesn't matter
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
private
|
|
46
|
+
|
|
47
|
+
attr_reader :signal_comparison, :label_comparison
|
|
48
|
+
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require_relative "../../../core_ext"
|
|
2
|
+
|
|
3
|
+
class Ecu
|
|
4
|
+
class LabelList
|
|
5
|
+
A2LREGEXP = %r{/begin CHARACTERISTIC\s+([\S]+)\s+"([^"]*)"}
|
|
6
|
+
|
|
7
|
+
def self.from_a2l(str)
|
|
8
|
+
str.gsub!(%r{/\*.*?\*/}, "")
|
|
9
|
+
labels = str.scan(A2LREGEXP).map do |name, description|
|
|
10
|
+
# Ugly hack: Create dummy Festwert until better parsing
|
|
11
|
+
# is implemented
|
|
12
|
+
Ecu::Festwert.new(name: name, description: description, value: 0)
|
|
13
|
+
end
|
|
14
|
+
new(labels)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require_relative "../../../core_ext"
|
|
2
|
+
|
|
3
|
+
class Ecu
|
|
4
|
+
class SignalList
|
|
5
|
+
A2LREGEXP = %r{/begin MEASUREMENT\s+([\S]+)\s+"([^"]*)"}
|
|
6
|
+
|
|
7
|
+
def self.from_a2l(str)
|
|
8
|
+
str.gsub!(%r{/\*.*?\*/}, "")
|
|
9
|
+
signals = str.scan(A2LREGEXP).map do |name, description|
|
|
10
|
+
Ecu::Signal.new(name: name, description: description)
|
|
11
|
+
end
|
|
12
|
+
new(signals)
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
class Ecu
|
|
3
|
+
class SignalList
|
|
4
|
+
DBCREGEXP = / SG_ ([A-Z_0-9]+) : .*/
|
|
5
|
+
|
|
6
|
+
def self.from_dbc(file_path)
|
|
7
|
+
new(File.open(file_path, "rb").read.scan(DBCREGEXP).map do |name|
|
|
8
|
+
Ecu::Signal.new(name: name.first)
|
|
9
|
+
end.reject { |signal| signal.name =~ /TA|TPCI/ })
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
class DcmBuffer
|
|
2
|
+
attr_reader :buffer, :header, :constructor
|
|
3
|
+
def initialize
|
|
4
|
+
@constructor = nil
|
|
5
|
+
@header = :pre
|
|
6
|
+
@buffer = []
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def start!(constructor, buffer)
|
|
10
|
+
fail "Nested parameter" unless self.buffer.empty?
|
|
11
|
+
fail "Missing DCM header" if self.header == :pre
|
|
12
|
+
|
|
13
|
+
@header = :done
|
|
14
|
+
@constructor = constructor
|
|
15
|
+
@buffer = buffer
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def finish!(line)
|
|
19
|
+
fail "Unexpected END" if constructor.nil?
|
|
20
|
+
append!(line)
|
|
21
|
+
|
|
22
|
+
constructor.from_dcm(buffer).tap { reset! }
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def reset!
|
|
26
|
+
@constructor = nil
|
|
27
|
+
@buffer = []
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def header_seen!
|
|
31
|
+
@header = :after
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def append!(line)
|
|
35
|
+
fail "No label started" if constructor.nil?
|
|
36
|
+
|
|
37
|
+
@buffer << line
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
class Ecu
|
|
2
|
+
class Festwert < Label
|
|
3
|
+
def self.dcm_header
|
|
4
|
+
%r{FESTWERT\s+(?<name>[A-Za-z0-9\._]+)}
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def to_dcm
|
|
8
|
+
"#{type.upcase} #{name}\n".tap do |str|
|
|
9
|
+
str << " LANGNAME #{description.enquote}\n" if description
|
|
10
|
+
str << " FUNKTION #{function}\n" if function
|
|
11
|
+
str << " EINHEIT_W #{unit.enquote}\n" if unit
|
|
12
|
+
str << case value
|
|
13
|
+
when Numeric then " WERT #{value}\n"
|
|
14
|
+
when String then " TEXT #{value.enquote}\n"
|
|
15
|
+
end
|
|
16
|
+
str << "END\n"
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
require_relative "../../../core_ext"
|
|
2
|
+
|
|
3
|
+
class Ecu
|
|
4
|
+
class Festwerteblock < Label
|
|
5
|
+
def self.dcm_header
|
|
6
|
+
%r{FESTWERTEBLOCK\s+(?<name>[A-Za-z0-9\._]+)\s+(?<xdim>\d+)(?:\s+@\s+(?<ydim>\d+))?}
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def to_dcm
|
|
10
|
+
"FESTWERTEBLOCK #{name} #{xdim}".tap do |str|
|
|
11
|
+
str << " @ #{ydim}" if ydim != 1
|
|
12
|
+
str << "\n"
|
|
13
|
+
str << " LANGNAME #{description.enquote}\n" if description
|
|
14
|
+
str << " FUNKTION #{function}\n" if function
|
|
15
|
+
str << " EINHEIT_W #{unit.enquote}\n" if unit
|
|
16
|
+
value.each do |row|
|
|
17
|
+
str << case row.first
|
|
18
|
+
when Numeric then " WERT #{row.join(" ")}\n"
|
|
19
|
+
when String then " TEXT #{row.map(&:enquote).join(" ")}\n"
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
str << "END\n"
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|