Method: HDLRuby::Viz::Node#statement_svg_deep
- Defined in:
- lib/HDLRuby/hruby_viz.rb
#statement_svg_deep(stmnt, no = false) ⇒ Object
Generate recursively the content of a flow from statement +stmnt+, where +no+ tells if there is an else branch.
3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 |
# File 'lib/HDLRuby/hruby_viz.rb', line 3837 def statement_svg_deep(stmnt,no=false) case stmnt.type when :assign res = assign_svg(stmnt) when :seq, :par res = block_svg(stmnt) # And its arrows. stmnt.arrows.each { |x0,y0,x1,y1| res += arrow_svg(x0,y0,x1,y1) } when :if res = if_svg(stmnt, no || stmnt.branches[2]) when :case res = case_svg(stmnt, no || stmnt.branches[3]) when :repeat res = repeat_svg(stmnt) when :wait res = wait_svg(stmnt) when :terminate res = terminate_svg(stmnt) when :print res = print_svg(stmnt) else # The other types are the condition expression, they are # not statements so they are skipped. return "" end # Recurse on the branches. case stmnt.type when :if, :case, :repeat fs = stmnt.type != :case ? 1 : 2 # First statement position. stmnt.branches[fs..-2].each {|b| res += statement_svg_deep(b,true) } res += statement_svg_deep(stmnt.branches[-1],false) when :seq, :par res += statement_svg_deep(stmnt.branches[0]) end # And the successor res += statement_svg_deep(stmnt.successor) if stmnt.successor return res end |