1 // Péter Diviánszky, 2007
2 // Code extended and adapted by Peter Achten, 2007
4 definition module Graphviz
6 //from StdOverloaded import class ==, class toString
7 from StdOverloaded import class toString
12 // A digraph contains a title and a list of node definitions
14 = Digraph String [GraphAttribute] [NodeDef] (Maybe SelectedItem)
18 digraphTitle :: !Digraph -> String
19 digraphAtts :: !Digraph -> [GraphAttribute]
20 digraphNodes :: !Digraph -> [NodeDef]
21 digraphSelectedItem :: !Digraph -> Maybe SelectedItem
23 // A node definition contains a unique identifier (an integer), a list of node attributes and a list of edge definitions.
24 // An edge definition contains an identifier (the id of the end node and edge attributes).
26 = NodeDef !Int ![NodeState] ![NodeAttribute] [EdgeDef]
28 :== (!Int,![EdgeAttribute])
30 = NStAllEdgesFound !Bool // all edges of this node are known
32 // Convert digraph into list of strings.
33 // The strings are lines of the graphviz representation of the graph.
34 printDigraph :: !Digraph -> [String]
44 | GAtt_clusterrank ClusterMode
45 | GAtt_colorscheme String
48 | GAtt_concentrate Bool
49 | GAtt_defaultdist Real
51 // | GAtt_diredgeconstraints ... PA: ignored, neato only
55 | GAtt_fontcolor Color
56 | GAtt_fontname String
57 | GAtt_fontnames String
58 | GAtt_fontpath String
61 | GAtt_labeljust String
62 | GAtt_labelloc String
64 | GAtt_layers LayerList
65 | GAtt_layersep String
80 | GAtt_ordering String
81 | GAtt_orientation String
82 | GAtt_outputorder OutputMode
85 | GAtt_pagedir PageDir
88 | GAtt_rankdir RankDir
91 | GAtt_remincross Bool
92 | GAtt_resolution Real
97 | GAtt_size Sizef //Pointf // PA++
98 // | GAtt_splines PA: skipped for the time being
99 | GAtt_start StartType
100 | GAtt_stylesheet String
102 | GAtt_truecolor Bool
103 | GAtt_viewport ViewPort
104 | GAtt_voro_margin Real
108 | NAtt_colorscheme String
109 | NAtt_comment String
110 | NAtt_distortion Real
111 | NAtt_fillcolor Color
112 | NAtt_fixedsize Bool
113 | NAtt_fontcolor Color
114 | NAtt_fontname String
119 | NAtt_layer LayerRange
121 | NAtt_nojustify Bool
122 | NAtt_orientation Real
123 | NAtt_peripheries Int
125 // | NAtt_pos ... PA: ignored for the time being
128 | NAtt_samplepoints Int
129 | NAtt_shape NodeShape
130 | NAtt_shapefile String
134 | NAtt_style NodeStyle
136 | NAtt_tooltip String
141 | EAtt_arrowhead ArrowType
142 | EAtt_arrowsize Real
143 | EAtt_arrowtail ArrowType
145 | EAtt_colorscheme String
146 | EAtt_comment String
147 | EAtt_constraint Bool
150 | EAtt_edgeURL String
151 | EAtt_edgehref String
152 | EAtt_edgetarget String
153 | EAtt_edgetooltip String
154 | EAtt_fontcolor Color
155 | EAtt_fontname String
157 | EAtt_headURL String
159 | EAtt_headhref String
160 | EAtt_headlabel String
161 | EAtt_headport PortPos
162 | EAtt_headtarget String
163 | EAtt_headtooltip String
166 | EAtt_labelURL String
167 | EAtt_labelangle Real
168 | EAtt_labeldistance Real
169 | EAtt_labelfloat Bool
170 | EAtt_labelfontcolor Color
171 | EAtt_labelfontname String
172 | EAtt_labelfontsize Real
173 | EAtt_labelhref String
174 | EAtt_labeltarget String
175 | EAtt_labeltooltip String
176 | EAtt_layer LayerRange
182 | EAtt_nojustify Bool
183 // | EAtt_pos PA: ignored for the time being
184 | EAtt_samehead String
185 | EAtt_sametail String
187 | EAtt_style EdgeStyle
188 | EAtt_tailURL String
190 | EAtt_tailhref String
191 | EAtt_taillabel String
192 | EAtt_tailport PortPos
193 | EAtt_tailtarget String
194 | EAtt_tailtooltip String
196 | EAtt_tooltip String
199 = CM_local | CM_global | CM_none
201 = CP_n | CP_ne | CP_e | CP_se | CP_s | CP_sw | CP_w | CP_nw
203 = DotPoint Real Real Bool
211 = LayerRange LayerId [LayerId]
214 | DoubleMargin Real Real
216 = OM_breadthfirst | OM_nodesfirst | OM_edgesfirst
219 | DoublePad Real Real
221 = PD_BL | PD_BR | PD_TL | PD_TR | PD_RB | PD_RT | PD_LB | PD_LT
224 :: PortPos // PA: for now only compass points are supported
227 = RD_TB | RD_LR | RD_BT | RD_RL
229 = RT_same | RT_min | RT_source | RT_max | RT_sink
237 = {llx :: Int,lly :: Int, urx :: Int, ury :: Int}
239 = Sizef Real Real Bool
241 = SS_regular | SS_self | SS_random
243 = { startStyle :: Maybe StartStyle
244 , startSeed :: Maybe Int
250 , vp_xy :: Maybe Pointf
253 pointNode :: [NodeAttribute] // attributes of a point-shaped node
254 hiddenNode :: [NodeAttribute] // attributes of a hidden node
261 | NShape_doublecircle
262 | NShape_doubleoctagon
268 | NShape_invtrapezium
274 | NShape_parallelogram
284 | NShape_tripleoctagon
286 instance toString NodeShape
287 instance == NodeShape
288 derive gEq NodeShape // PK++
299 instance toString NodeStyle
300 instance == NodeStyle
301 derive gEq NodeStyle // PK++
309 instance toString EdgeStyle
310 instance == EdgeStyle
311 derive gEq EdgeStyle // PK++
316 | Color String // X11 1.2 color names; see rgb.txt
318 C_black :== Color "black"
319 C_white :== Color "white"
320 C_gray :== Color "gray"
321 C_red :== Color "red"
322 C_green :== Color "green"
323 C_blue :== Color "blue"
324 C_yellow :== Color "yellow"
326 instance toString Color
328 derive gEq Color // PK++
332 , furthest :: Maybe Arrow
337 , shape :: ArrowShape
352 instance toString ArrowType
353 instance == ArrowType
354 derive gEq ArrowType // PK++
357 // direction of the edge
363 instance toString DirType
365 derive gEq DirType // PK++
369 mkDigraph :: String (KnownAutomaton s i o,s,[s],[s],[SeenTrans s i o],[SeenTrans s i o]) -> Digraph | render, gEq{|*|} s