tallakt-plcutil 0.2.4 → 0.2.5

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.
@@ -46,10 +46,15 @@ module PlcUtil
46
46
 
47
47
  def read_pl7_file(io)
48
48
  io.each_line do |l|
49
- mres = l.match(/^%M(W)?(\d+)(:X(\d+))?\t(\S+)\t(\S+)(\t\"?([^\t"]*))?/)
49
+ mres = l.match(/^%M(W|F)?(\d+)(:X(\d+))?\t(\S+)\t(\S+)(\t\"?([^\t"]*))?/)
50
50
  if mres
51
51
  item = OpenStruct.new
52
- item.is_word = mres[1]
52
+ case mres[1]
53
+ when 'W'
54
+ item.is_word = true
55
+ when 'F'
56
+ item.is_float = true
57
+ end
53
58
  item.index = mres[2].to_i
54
59
  item.bit_index = mres[4] && mres[4].to_i
55
60
  item.tagname = mres[5]
@@ -83,6 +88,10 @@ module PlcUtil
83
88
  @intouchfile.new_io_int(tag, data) do |io|
84
89
  io.item_name = '%d S' % (item.index + 400001)
85
90
  end
91
+ elsif item.is_float
92
+ @intouchfile.new_io_real(tag, data) do |io|
93
+ io.item_name = '%d F' % (item.index + 400001)
94
+ end
86
95
  else
87
96
  @intouchfile.new_io_disc(tag, data) do |io|
88
97
  io.item_name = (item.index + 1).to_s
data/lib/plcutil.rb CHANGED
@@ -3,6 +3,6 @@ $:.unshift(File.dirname(__FILE__)) unless
3
3
  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
4
4
 
5
5
  module PlcUtil
6
- VERSION = '0.2.4'
6
+ VERSION = '0.2.5'
7
7
  end
8
8
 
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
4
+ version: 0.2.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: