tallakt-plcutil 0.2.7 → 0.2.9
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.
- data/bin/symlist +36 -0
- data/lib/plcutil.rb +1 -1
- metadata +3 -1
data/bin/symlist
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require 'dbf'
|
|
4
|
+
|
|
5
|
+
symlists_file = ARGV.shift
|
|
6
|
+
|
|
7
|
+
raise "Please specify the name of the project's SYMLISTS.DBF file as parameter" unless symlists_file && symlists_file.match(/SYMLISTS[.]DBF/i)
|
|
8
|
+
|
|
9
|
+
class Tag
|
|
10
|
+
attr_reader :name, :address, :comment, :type
|
|
11
|
+
|
|
12
|
+
def initialize(n, t, a, c)
|
|
13
|
+
@name, @type, @address, @comment = n, t, a, c
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
symlists = DBF::Table.new symlists_file
|
|
18
|
+
files = symlists.map {|record| [record['_UNAME'], record['_DBPATH']] unless record['_DELETED'] }.compact
|
|
19
|
+
|
|
20
|
+
tags = []
|
|
21
|
+
files.each do |uname, dbpath|
|
|
22
|
+
fn = File.join(File.dirname(symlists_file), dbpath, 'SYMLIST.DBF')
|
|
23
|
+
symlist = DBF::Table.new fn
|
|
24
|
+
symlist.each do |rec|
|
|
25
|
+
tags << Tag.new(rec['_SKZ'], rec['_DATATYP'], rec['_OPIEC'], rec['_COMMENT'])
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
tags.each do |t|
|
|
30
|
+
typ = if t.type == t.address
|
|
31
|
+
''
|
|
32
|
+
else
|
|
33
|
+
t.type
|
|
34
|
+
end
|
|
35
|
+
puts '%-24s%-12s%-13s%s' % [t.name, typ, t.address, t.comment]
|
|
36
|
+
end
|
data/lib/plcutil.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: tallakt-plcutil
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.9
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -82,6 +82,7 @@ executables:
|
|
|
82
82
|
- intouchpp
|
|
83
83
|
- pl7tointouch
|
|
84
84
|
- awlls
|
|
85
|
+
- symlist
|
|
85
86
|
extensions: []
|
|
86
87
|
extra_rdoc_files:
|
|
87
88
|
- LICENSE
|
|
@@ -110,6 +111,7 @@ files:
|
|
|
110
111
|
- bin/intouchpp
|
|
111
112
|
- bin/pl7tointouch
|
|
112
113
|
- bin/s7tointouch
|
|
114
|
+
- bin/symlist
|
|
113
115
|
- test/input_files/step7_v5.4/00000001.AWL
|
|
114
116
|
- test/input_files/step7_v5.4/S7_pro2.zip
|
|
115
117
|
- test/input_files/step7_v5.4/SYMLIST.DBF
|