gv_fsm 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/gv_fsm +26 -4
- data/lib/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74b717895ae52d4a28c56c12944e18db81886463858bd42d9507a6cbb3c1309e
|
4
|
+
data.tar.gz: f929706aace8b53639fdd8e67aa3096be88994c551266d4c7805196144595e26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a807c54fa79bda61a07df1fee06b8dac62d193d92eb7e056a44c56b144fd008f63e983b0ea28e18d1a7008637a5cf5c64dd21a430f5133cb03f8ca62a75af021
|
7
|
+
data.tar.gz: 6c471ada43c67ef29bdf12d7797b8f4d4bd23aa4e37bcc78ff7e56f0c91657c01066bec2ee5ee5d64a8c5ce0ac50845c4a156e7cf5ebc5d2af28413d25be3a40
|
data/bin/gv_fsm
CHANGED
@@ -5,8 +5,15 @@ require 'optparse'
|
|
5
5
|
|
6
6
|
sm = GV_FSM::FSM.new
|
7
7
|
|
8
|
-
options = {}
|
8
|
+
options = {header: true, source: true}
|
9
9
|
OptionParser.new do |parser|
|
10
|
+
parser.banner =<<~EOB
|
11
|
+
Graphviz to Finite State Machine generator
|
12
|
+
Version: #{GV_FSM::VERSION}
|
13
|
+
See also https://github.com/pbosetti/gv_fsm
|
14
|
+
Usage: gv_fsm [options] scheme.dot
|
15
|
+
EOB
|
16
|
+
|
10
17
|
parser.on("-p", "--project PROJECT_NAME",
|
11
18
|
"Set the project name to PROJECT_NAME") do |pn|
|
12
19
|
sm.project_name = pn
|
@@ -19,12 +26,27 @@ OptionParser.new do |parser|
|
|
19
26
|
parser.on("-o", "--output_file NAME", "Use NAME for generated .c and .h files") do |f|
|
20
27
|
sm.cname = f
|
21
28
|
end
|
29
|
+
|
30
|
+
parser.on("-h", "--header-only", "Only generate header file") do
|
31
|
+
options[:source] = false
|
32
|
+
end
|
33
|
+
|
34
|
+
parser.on("-s", "--source-only", "Only generate source file") do
|
35
|
+
options[:header] = false
|
36
|
+
end
|
37
|
+
|
22
38
|
end.parse!
|
23
39
|
|
24
40
|
raise ArgumentError, "I need the path to a Graphviz file!" unless ARGV[0]
|
25
41
|
raise ArgumentError, "#{ARGV[0]} does not look like a Graphviz file!" unless File.extname(ARGV[0]) == ".dot"
|
26
42
|
|
27
43
|
sm.parse(ARGV[0])
|
28
|
-
sm.
|
29
|
-
|
30
|
-
|
44
|
+
puts "Parsed #{sm.dotfile}.\nGenerating C stub for states: #{sm.states_list.join(", ")}."
|
45
|
+
if options[:header] then
|
46
|
+
sm.generate_h
|
47
|
+
puts "Generated header #{sm.cname}.h"
|
48
|
+
end
|
49
|
+
if options[:source] then
|
50
|
+
sm.generate_c
|
51
|
+
puts "Generated source #{sm.cname}.c"
|
52
|
+
end
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gv_fsm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paolo Bosetti
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-08-
|
11
|
+
date: 2020-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-graphviz
|