Open chuckremes opened 13 years ago
Hello Chuck,
I ran your code and I concur. The output doesn't seem to draw the superstates correctly. That said, the dot graph generation was a contribution that I patched in and I don't know whole lot about dot graph format. If you'd like to submit a patch, I'd more than happily include it.
Micah
On Jun 13, 2011, at 2:04 PM, chuckremes wrote:
I have a statemachine defined with a superstate that contains a state and another superstate. The nested superstate also includes two more states.
However, the DOT output doesn't look correct to me at all. I'm including my definition here so you can reproduce it.
require 'rubygems' require 'statemachine' require 'statemachine/generate/util' require 'statemachine/generate/src_builder' require 'statemachine/generate/dot_graph/dot_graph_statemachine' class Startup attr_accessor :statemachine def do_init() end end connection_machine = Statemachine.build do startstate :operational superstate :operational do # we don't set a context within this builder block, so using :starting # as the startstate causes an error; it immediately transitions to :starting # and tries to run #on_init which doesn't exist anyplace yet (no context) startstate :waiting event :startup, :starting event :data_error, :error_mode state :starting do on_entry :do_init event :started, :connected end # starting and not connected yet superstate :connected do startstate :gateway_down state :gateway_down do event :dc_down, :gateway_down event :dc_up, :gateway_down event :gw_down, :gateway_down event :gw_up, :gateway_up end state :gateway_up do on_entry :enable_order_modification on_exit :disable_orders event :dc_down, :gateway_up, :disable_order_entry event :dc_up, :gateway_up, :enable_order_entry end end # superstate connected end # superstate operational trans :error_mode, :operate, :operational_H, Proc.new { puts "exiting error mode" } end startup = Startup.new connection_machine.context = startup #connection_machine.tracer = STDOUT connection_machine.to_dot(:output => 'dot')
Reply to this email directly or view it on GitHub: https://github.com/slagyr/statemachine/issues/4
Alas, I don't know much about graphviz dotfiles myself. I did a 'git blame' against the source and it only shows you as the committer.
Looking at digraphs to confirm that the machine is laid out correctly is quite handy. A picture really is worth a thousand words. Any chance you could put me in touch with the person who originally developed this functionality?
Hmmm... I must have used git wrong. The patch was made by Scott Pfister who is cc'd. Hello Scott!
Micah
On Jun 13, 2011, at 2:32 PM, chuckremes wrote:
Alas, I don't know much about graphviz dotfiles myself. I did a 'git blame' against the source and it only shows you as the committer.
Looking at digraphs to confirm that the machine is laid out correctly is quite handy. A picture really is worth a thousand words. Any chance you could put me in touch with the person who originally developed this functionality?
Reply to this email directly or view it on GitHub: https://github.com/slagyr/statemachine/issues/4#issuecomment-1361240
I have a statemachine defined with a superstate that contains a state and another superstate. The nested superstate also includes two more states.
However, the DOT output doesn't look correct to me at all. I'm including my definition here so you can reproduce it.