Home | History | Annotate | Download | only in src
      1 /* VCG description handler for Bison.
      2 
      3    Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc.
      4 
      5    This file is part of Bison, the GNU Compiler Compiler.
      6 
      7    Bison is free software; you can redistribute it and/or modify
      8    it under the terms of the GNU General Public License as published by
      9    the Free Software Foundation; either version 2, or (at your option)
     10    any later version.
     11 
     12    Bison is distributed in the hope that it will be useful,
     13    but WITHOUT ANY WARRANTY; without even the implied warranty of
     14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15    GNU General Public License for more details.
     16 
     17    You should have received a copy of the GNU General Public License
     18    along with Bison; see the file COPYING.  If not, write to
     19    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     20    Boston, MA 02110-1301, USA.  */
     21 
     22 #ifndef VCG_H_
     23 # define VCG_H_
     24 
     25 /* VCG color map. The 32 prime predefined colors. */
     26 enum color
     27 {
     28   white		= 0,
     29   blue,
     30   red,
     31   green		= 3,
     32   yellow,
     33   magenta,
     34   cyan		= 6,
     35   darkgrey,
     36   darkblue,
     37   darkred	= 9,
     38   darkgreen,
     39   darkyellow,
     40   darkmagenta	= 12,
     41   darkcyan,
     42   gold,
     43   lightgrey	= 15,
     44   lightblue,
     45   lightred,
     46   lightgreen	= 18,
     47   lightyellow,
     48   lightmagenta,
     49   lightcyan	= 21,
     50   lilac,
     51   turquoise,
     52   aquamarine	= 24,
     53   khaki,
     54   purple,
     55   yellowgreen	= 27,
     56   pink,
     57   orange,
     58   orchid,
     59   black		= 31
     60 };
     61 
     62 /* VCG textmode. Specify the adjustement of the text within the border of a summary node. */
     63 enum textmode
     64 {
     65   centered,
     66   left_justify,
     67   right_justify
     68 };
     69 
     70 /* VCG shapes. Used for nodes shapes. */
     71 enum shape
     72 {
     73   box,
     74   rhomb,
     75   ellipse,
     76   triangle
     77 };
     78 
     79 /* Structure for colorentries.  */
     80 struct colorentry
     81 {
     82   int color_index;
     83   int red_cp;
     84   int green_cp;
     85   int blue_cp;
     86   struct colorentry *next;
     87 };
     88 
     89 /* Structure to construct lists of classnames. */
     90 struct classname
     91 {
     92   int no; /* Class number */
     93   const char *name; /* Name associated to the class no. */
     94   struct classname *next; /* next name class association. */
     95 };
     96 
     97 /* Structure is in infoname.  */
     98 struct infoname
     99 {
    100   int integer;
    101   char const *chars;
    102   struct infoname *next;
    103 };
    104 
    105 /* VCG decision yes/no. */
    106 enum decision
    107 {
    108   yes,
    109   no
    110 };
    111 
    112 /* VCG graph orientation. */
    113 enum orientation
    114 {
    115   top_to_bottom,
    116   bottom_to_top,
    117   left_to_right,
    118   right_to_left
    119 };
    120 
    121 /* VCG alignment for node alignement. */
    122 enum alignment
    123 {
    124   center,
    125   top,
    126   bottom
    127 };
    128 
    129 /* VCG arrow mode. */
    130 enum arrow_mode
    131 {
    132   fixed,
    133   free_a
    134 };
    135 
    136 /* VCG crossing weight type. */
    137 enum crossing_type
    138 {
    139   bary,
    140   median,
    141   barymedian,
    142   medianbary
    143 };
    144 
    145 /* VCG views. */
    146 enum view
    147 {
    148   normal_view,
    149   cfish,
    150   pfish,
    151   fcfish,
    152   fpfish
    153 };
    154 
    155 /*------------------------------------------------------.
    156 | Node attributs list. structure that describes a node. |
    157 `------------------------------------------------------*/
    158 
    159 struct node
    160 {
    161   /* Title the unique string identifying the node. This attribute is
    162      mandatory. */
    163   const char *title;
    164 
    165   /* Label the text displayed inside the node. If no label is specified
    166      then the title of the node will be used. Note that this text may
    167      contain control characters like NEWLINE that influences the size of
    168      the node. */
    169   const char *label;
    170 
    171   /* loc is the location as x, y position relatively to the system of
    172      coordinates of the graph. Locations are specified in the form
    173      loc: - x: xpos y: ypos "". The locations of nodes are only valid,
    174      if the whole graph is fully specified with locations and no part is
    175      folded. The layout algorithm of the tool calculates appropriate x, y
    176      positions, if at least one node that must be drawn (i.e., is not
    177      hidden by folding or edge classes) does not have fixed specified
    178      locations.
    179      Default is none. */
    180   int locx;
    181   int locy;
    182 
    183   /* vertical order is the level position (rank) of the node. We can also
    184      specify level: int. Level specifications are only valid, if the
    185      layout is calculated, i.e. if at least one node does not have a
    186      fixed location specification. The layout algorithm partitioned all
    187      nodes into levels 0...maxlevel. Nodes at the level 0 are on the
    188      upper corner. The algorithm is able to calculate appropriate levels
    189      for the nodes automatically, if no fixed levels are given.
    190      Specifications of levels are additional constraints, that may be
    191      ignored, if they are in conflict with near edge specifications.
    192      Default values are unspecified. */
    193   int vertical_order;
    194 
    195   /* horizontal order is the horizontal position of the node within a
    196      level. The nodes which are specified with horizontal positions are
    197      ordered according to these positions within the levels. The nodes
    198      which do not have this attribute are inserted into this ordering by
    199      the crossing reduction mechanism. Note that connected components are
    200      handled separately, thus it is not possible to intermix such
    201      components by specifying a horizontal order. If the algorithm for
    202      downward laid out trees is used, the horizontal order influences
    203      only the order of the child nodes at a node, but not the order of
    204      the whole level.
    205      Default is unspecified. */
    206   int horizontal_order;
    207 
    208   /* width, height is the width and height of a node including the border.
    209      If no value (in pixels) is given then width and height are
    210      calculated from the size of the label.
    211      Default are width and height of the label. */
    212   int width;
    213   int height;
    214 
    215   /* shrink, stretch gives the shrinking and stretching factor of the
    216      node. The values of the attributes width, height, borderwidth and
    217      the size of the label text is scaled by ((stretch=shrink) \Lambda
    218      100) percent. Note that the actual scale value is determined by the
    219      scale value of a node relatively to a scale value of the graph,
    220      i.e. if (stretch,shrink) = (2,1) for the graph and (stretch,shrink)
    221      = (2,1) for the node of the graph, then the node is scaled by the
    222      factor 4 compared to the normal size. The scale value can also be
    223      specified by scaling: float.
    224      Default are 1,1. */
    225   int shrink;
    226   int stretch;
    227 
    228   /* folding specifies the default folding of the nodes. The folding k
    229      (with k ? 0) means that the graph part that is reachable via edges
    230      of a class less or equal to k is folded and displayed as one node.
    231      There are commands to unfold such summary nodes, see section 5. If
    232      no folding is specified for a node, then the node may be folded if
    233      it is in the region of another node that starts the folding. If
    234      folding 0 is specified, then the node is never folded. In this case
    235      the folding stops at the predecessors of this node, if it is
    236      reachable from another folding node. The summary node inherits some
    237      attributes from the original node which starts the folding (all
    238      color attributes, textmode and label, but not the location). A
    239      folded region may contain folded regions with smaller folding class
    240      values (nested foldings). If there is more than one node that start
    241      the folding of the same region (this implies that the folding class
    242      values are equal) then the attributes are inherited by one of these
    243      nodes nondeterministically. If foldnode attributes are specified,
    244      then the summary node attributes are inherited from these attributes.
    245      Default is none. */
    246   int folding;
    247 
    248   /* shape specifies the visual appearance of a node: box, rhomb, ellipse,
    249      and triangle. The drawing of ellipses is much slower than the drawing
    250      of the other shapes.
    251      Default is box. */
    252   enum shape shape;
    253 
    254   /* textmode specifies the adjustment of the text within the border of a
    255      node. The possibilities are center, left.justify and right.justify.
    256      Default is center. */
    257   enum textmode textmode;
    258 
    259   /* borderwidth specifies the thickness of the node's border in pixels.
    260      color is the background color of the node. If none is given, the
    261      node is white. For the possibilities, see the attribute color for
    262      graphs.
    263      Default is 2. */
    264   int borderwidth;
    265 
    266   /* node color.
    267      Default is white or transparent, */
    268   enum color color;
    269 
    270   /* textcolor is the color for the label text. bordercolor is the color
    271      of the border. Default color is the textcolor. info1, info2, info3
    272      combines additional text labels with a node or a folded graph. info1,
    273      Default is black. */
    274   enum color textcolor;
    275 
    276   /* info2, info3 can be selected from the menu. The corresponding text
    277      labels can be shown by mouse clicks on nodes.
    278      Default are null strings. */
    280   const char *infos[3];
    281 
    282   /* Node border color.
    283      Default is textcolor. */
    284   enum color bordercolor;
    285 
    286   /* Next node node... */
    287   struct node *next;
    288 };
    289 
    290 /* typedef alias. */
    291 typedef struct node node;
    292 
    293 /*-------------------------------------------------------.
    294 | Edge attributs list. Structure that describes an edge. |
    295 `-------------------------------------------------------*/
    296 
    297 /* VCG Edge type. */
    298 enum edge_type
    299 {
    300   normal_edge,
    301   back_edge,
    302   near_edge,
    303   bent_near_edge
    304 };
    305 
    306 /* Structs enum definitions for edges. */
    307 enum linestyle
    308 {
    309   continuous,
    310   dashed,
    311   dotted,
    312   invisible
    313 };
    314 
    315 enum arrowstyle
    316 {
    317   solid,
    318   line,
    319   none
    320 };
    321 
    322 /* The struct edge itself. */
    323 struct edge
    324 {
    325 
    326   /* Edge type.
    327      Default is normal edge. */
    328   enum edge_type type;
    329 
    330   /* Sourcename is the title of the source node of the edge.
    331      Default: none. */
    332   const char *sourcename; /* Mandatory. */
    333 
    334   /* Targetname is the title of the target node of the edge.
    335      Default: none. */
    336   const char *targetname; /* Mandatory. */
    337 
    338   /* Label specifies the label of the edge. It is drawn if
    339      display.edge.labels is set to yes.
    340      Default: no label. */
    341   const char *label;
    342 
    343   /* Linestyle specifies the style the edge is drawn. Possibilities are:
    344      ffl continuous a solid line is drawn ( -- ) ffl dashed the edge
    345      consists of single dashes ( - - - ) ffl dotted the edge is made of
    346      single dots ( \Delta  \Delta  \Delta  ) ffl invisible the edge is not
    347      drawn. The attributes of its shape (color, thickness) are ignored.
    348      To draw a dashed or dotted line needs more time than solid lines.
    349      Default is continuous. */
    350   enum linestyle linestyle;
    351 
    352   /* Thickness is the thickness of an edge.
    353      Default is 2. */
    354   int thickness;
    355 
    356   /* Class specifies the folding class of the edge. Nodes reachable by
    357      edges of a class less or equal to a constant k specify folding
    358      regions of k. See the node attribute folding and the folding commands.
    359      Default is 1. */
    360   int class;
    361 
    362   /* color is the color of the edge.
    363      Default is black. */
    364   enum color color;
    365 
    366   /* textcolor is the color of the label of the edge. arrowcolor,
    367      backarrowcolor is the color of the arrow head and of the backarrow
    368      head. priority The positions of the nodes are mainly determined by
    369      the incoming and outgoing edges. One can think of rubberbands instead
    370      of edges that pull a node into its position. The priority of an edges
    371      corresponds to the strength of the rubberband.
    372      Default is color. */
    373   enum color textcolor;
    374 
    375   /* Arrow color.
    376      Default is color. */
    377   enum color arrowcolor;
    378 
    379   /* BackArrow color.
    380      Default is color. */
    381   enum color backarrowcolor;
    382 
    383   /* arrowsize, backarrowsize The arrow head is a right-angled, isosceles
    384      triangle and the cathetuses have length arrowsize.
    385      Default is 10. */
    386   int arrowsize;
    387 
    388   /* Backarrow size
    389      Default is 0. */
    390   int backarrowsize;
    391 
    392   /* arrowstyle, backarrowstyle Each edge has two arrow heads: the one
    393      appears at the target node (the normal arrow head), the other appears
    394      at the source node (the backarrow head). Normal edges only have the
    395      normal solid arrow head, while the backarrow head is not drawn, i.e.
    396      it is none. Arrowstyle is the style of the normal arrow head, and
    397      backarrowstyle is the style of the backarrow head. Styles are none,
    398      i.e. no arrow head, solid, and line.
    399      Default is solid. */
    400   enum arrowstyle arrowstyle;
    401 
    402   /* Default is none. */
    403   enum arrowstyle backarrowstyle;
    404 
    405   /* Default is 1. */
    406   int priority;
    407 
    408   /* Anchor. An anchor point describes the vertical position in a node
    409      where an edge goes out. This is useful, if node labels are several
    410      lines long, and outgoing edges are related to label lines. (E.g.,
    411      this allows a nice visualization of structs containing pointers as
    412      fields.).
    413      Default is none. */
    414   int anchor;
    415 
    416   /* Horizontal order is the horizontal position the edge. This is of
    417      interest only if the edge crosses several levels because it specifies
    418      the point where the edge crosses the level. within a level. The nodes
    419      which are specified with horizontal positions are ordered according
    420      to these positions within a level. The horizontal position of a long
    421      edge that crosses the level specifies between which two node of that
    422      level the edge has to be drawn. Other edges which do not have this
    423      attribute are inserted into this ordering by the crossing reduction
    424      mechanism. Note that connected components are handled separately,
    425      thus it is not possible to intermix such components by specifying a
    426      horizontal order.
    427      Default is unspcified. */
    428   int horizontal_order;
    429 
    430   /*
    431   ** Next edge node...
    432   */
    433   struct edge *next;
    434 
    435 };
    436 
    437 /*
    438 ** typedef alias.
    439 */
    440 typedef struct edge edge;
    441 
    442 /*--------------------------------------------------------.
    443 | Graph attributs list. Structure that describes a graph. |
    444 `--------------------------------------------------------*/
    445 
    446 struct graph
    447 {
    448   /* Graph title or name.
    449      Title specifies the name (a string) associated with the graph. The
    450      default name of a subgraph is the name of the outer graph, and the
    451      name of the outmost graph is the name of the specification input
    452      file. The name of a graph is used to identify this graph, e.g., if
    453      we want to express that an edge points to a subgraph. Such edges
    454      point to the root of the graph, i.e. the first node of the graph or
    455      the root of the first subgraph in the graph, if the subgraph is
    456      visualized explicitly.
    457      By default, it's the name of the vcg graph file description. */
    458   const char *title;
    459 
    460   /* Graph label.
    461      Label the text displayed inside the node, when the graph is folded
    462      to a node. If no label is specified then the title of the graph will
    463      be used. Note that this text may contain control characters like
    464      NEWLINE that influences the size of the node.
    465      By default, it takes the title value */
    466   const char *label;
    467 
    468   /* Any informations.
    469      Info1, info2, info3 combines additional text labels with a node or a
    470      folded graph. info1, info2, info3 can be selected from the menu
    471      interactively. The corresponding text labels can be shown by mouse
    472      clicks on nodes.
    473      Default values are empty strings (here NULL pointers) */
    474   const char *infos[3];
    475 
    476   /* Background color and summary node colors
    477      Color specifies the background color for the outermost graph, or the
    478      color of the summary node for subgraphs. Colors are given in the enum
    479      declared above. If more than these default colors are needed, a
    480      color map with maximal 256 entries can be used. The first 32 entries
    481      correspond to the colors just listed. A color of the color map can
    482      selected by the color map index, an integer, for instance red has
    483      index 2, green has index 3, etc.
    484      Default is white for background and white or transparent for summary
    485      nodes. */
    486   enum color color;
    487 
    488   /* Textcolor.
    489      need explanations ???
    490      default is black for summary nodes. */
    491   enum color textcolor;
    492 
    493   /* Bordercolor is the color of the summary node's border. Default color
    494      is the textcolor. width, height are width and height of the
    495      displayed part of the window of the outermost graph in pixels, or
    496      width and height of the summary node of inner subgraphs.
    497      Default is the default of the textcolor. */
    498   enum color bordercolor;
    499 
    500   /* Width, height are width and height of the displayed part of the
    501      window of the outermost graph in pixels, or width and height of the
    502      summary node of inner subgraphs.
    503      Default value is 100. */
    504   int width;
    505   int height;
    506 
    507   /* Specify the thickness if summary node's border in pixels.
    508      default value is 2. */
    509   int borderwidth;
    510 
    511   /* x, y are the x-position and y-position of the graph's window in
    512      pixels, relatively to the root screen, if it is the outermost graph.
    513      The origin of the window is upper, left hand. For inner subgraphs,
    514      it is the position of the folded summary node. The position can also
    515      be specified in the form loc: fx:int y:intg.
    516      The default value is 0. */
    517   int x;
    518   int y;
    519 
    520   /* folding of a subgraph is 1, if the subgraph is fused, and 0, if the
    521      subgraph is visualized explicitly. There are commands to unfold such
    522      summary nodes.
    523      Default value is 0 */
    524   int folding;
    525 
    526   /* Shrink, stretch gives the shrinking and stretching factor for the
    527      graph's representation (default is 1, 1). ((stretch=shrink) \Lambda
    528      100) is the scaling of the graph in percentage, e.g.,
    529      (stretch,shrink) = (1,1) or (2,2) or (3,3) : : : is normal size,
    530      (stretch,shrink) = (1,2) is half size, (stretch,shrink) = (2,1) is
    531      double size. For subgraphs, it is also the scaling factor of the
    532      summary node. The scaling factor can also be specified by scaling:
    533      float (here, scaling 1.0 means normal size). */
    534   int shrink;
    535   int stretch;
    536 
    537   /* textmode specifies the adjustment of the text within the border of a
    538      summary node. The possibilities are center, left.justify and
    539      right.justify.
    540      Default value is center.*/
    541   enum textmode textmode;
    542 
    543   /* Shape can be specified for subgraphs only. It is the shape of the
    544      subgraph summary node that appears if the subgraph is folded: box,
    545      rhomb, ellipse, and triangle. vertical order is the level position
    546      (rank) of the summary node of an inner subgraph, if this subgraph is
    547      folded. We can also specify level: int. The level is only
    548      recognized, if an automatical layout is calculated. horizontal order
    549      is the horizontal position of the summary node within a level. The
    550      nodes which are specified with horizontal positions are ordered
    551      according to these positions within the levels. The nodes which do
    552      not have this attribute are inserted into this ordering by the
    553      crossing reduction mechanism. Note that connected
    554      components are handled separately, thus it is not possible to
    555      intermix such components by specifying a horizontal order. If the
    556      algorithm for downward laid out trees is used, the horizontal order
    557      influences only the order of the child nodes at a node, but not the
    558      order of the whole level.
    559      Default is box, other: rhomb, ellipse, triangle. */
    560   enum shape shape;
    561 
    562   /* Vertical order is the level position (rank) of the summary node of an
    563      inner subgraph, if this subgraph is folded. We can also specify
    564      level: int. The level is only recognized, if an automatical layout is
    565      calculated.  */
    566   int vertical_order;
    567 
    568   /* Horizontal order is the horizontal position of the summary node within
    569      a level. The nodes which are specified with horizontal positions are
    570      ordered according to these positions within the levels. The nodes which
    571      do not have this attribute are inserted into this ordering by the
    572      crossing reduction mechanism. Note that connected components are
    573      handled separately, thus it is not possible to intermix such components
    574      by specifying a horizontal order. If the algorithm for downward laid
    575      out trees is used, the horizontal order influences only the order of
    576      the child nodes at a node, but not the order of the whole level.  */
    577   int horizontal_order;
    578 
    579   /* xmax, ymax specify the maximal size of the virtual window that is
    580      used to display the graph. This is usually larger than the displayed
    581      part, thus the width and height of the displayed part cannot be
    582      greater than xmax and ymax. Only those parts of the graph are drawn
    583      that are inside the virtual window. The virtual window can be moved
    584      over the potential infinite system of coordinates by special
    585      positioning commands.
    586      Defaults are 90 and 90. */
    587   int xmax;
    588   int ymax;
    589 
    590   /* xy-base: specify the upper left corner coordinates of the graph
    591      relatively to the root window.
    592      Defaults are 5, 5. */
    593   int xbase;
    594   int ybase;
    595 
    596   /* xspace, yspace the minimum horizontal and vertical distance between
    597      nodes. xlspace is the horizontal distance between lines at the
    598      points where they cross the levels. (At these points, dummy nodes
    599      are used. In fact, this is the horizontal distance between dummy
    600      nodes.) It is recommended to set xlspace to a larger value, if
    601      splines are used to draw edges, to prevent sharp bendings.
    602      Default are 20 and 70. */
    603   int xspace;
    604   int yspace;
    605 
    606   /* The horizontal space between lines at the point where they cross
    607      the levels.
    608      defaults value is 1/2 xspace (polygone) and 4/5 xspace (splines)*/
    609   int xlspace;
    610 
    611   /* xraster, yraster specifies the raster distance for the position of
    612      the nodes. The center of a node is aligned to this raster. xlraster
    613      is the horizontal raster for the positions of the line control
    614      points (the dummy nodes). It should be a divisor of xraster.
    615      defaults are 1,1. */
    616   int xraster;
    617   int yraster;
    618 
    619   /* xlraster is the horizontal raster for the positions of the line
    620      control points (the dummy nodes). It should be a divisor of xraster.
    621      defaults is 1. */
    622   int xlraster;
    623 
    624   /* hidden specifies the classes of edges that are hidden.
    625      Edges that are within such a class are not laid out nor drawn.
    626      Nodes that are only reachable (forward or backward) by edges of an
    627      hidden class are not drawn. However, nodes that are not reachable
    628      at all are drawn. (But see attribute ignore.singles.) Specification
    629      of classes of hidden edges allows to hide parts of a graph, e.g.,
    630      annotations of a syntax tree. This attribute is only allowed at the
    631      outermost level. More than one settings are possible to specify
    632      exactly the set of classes that are hidden. Note the important
    633      difference between hiding of edges and the edge line style invisible.
    634      Hidden edges are not existent in the layout. Edges with line style
    635      invisible are existent in the layout; they need space and may
    636      produce crossings and influence the layout, but you cannot see
    637      them.
    638      No default value. */
    639   int hidden;
    640 
    641   /* Classname allows to introduce names for the edge classes. The names
    642      are used in the menus. infoname allows to introduce names for the
    643      additional text labels. The names are used in the menus.
    644      defaults are 1,2,3...
    645      By default, no class names. */
    646   struct classname *classname;
    647 
    648   /* Infoname allows to introduce names for the additional text labels.
    649      The names are used in the menus.
    650      Infoname is given by an integer and a string.
    651      The default value is NULL.  */
    652   struct infoname *infoname;
    653 
    654   /* Colorentry allows to fill the color map. A color is a triplet of integer
    655      values for the red/green/blue-part. Each integer is between 0 (off) and
    656      255 (on), e.g., 0 0 0 is black and 255 255 255 is white. For instance
    657      colorentry 75 : 70 130 180 sets the map entry 75 to steel blue. This
    658      color can be used by specifying just the number 75.
    659      Default id NULL.  */
    660   struct colorentry *colorentry;
    661 
    662   /* Layout downfactor, layout upfactor, layout nearfactor The layout
    663      algorithm partitions the set of edges into edges pointing upward,
    664      edges pointing downward, and edges pointing sidewards. The last type
    665      of edges is also called near edges. If the layout.downfactor is
    666      large compared to the layout.upfactor and the layout.nearfactor,
    667      then the positions of the nodes is mainly determined by the edges
    668      pointing downwards. If the layout.upfactor is large compared to the
    669      layout.downfactor and the layout.nearfactor, then the positions of
    670      the nodes is mainly determined by the edges pointing upwards. If the
    671      layout.nearfactor is large, then the positions of the nodes is
    672      mainly determined by the edges pointing sidewards. These attributes
    673      have no effect, if the method for downward laid out trees is used.
    674      Default is normal. */
    675   int layout_downfactor;
    676   int layout_upfactor;
    677   int layout_nearfactor;
    678   /* Layout splinefactor determines the bending at splines. The factor
    679      100 indicates a very sharp bending, a factor 1 indicates a very flat
    680      bending. Useful values are 30 : : : 80. */
    681   int layout_splinefactor;
    682 
    683   /* Late edge labels yes means that the graph is first partitioned and
    684      then, labels are introduced. The default algorithm first creates
    685      labels and then partitions the graph, which yield a more compact
    686      layout, but may have more crossings.
    687      Default is no. */
    688   enum decision late_edge_labels;
    689 
    690   /* Display edge labels yes means display labels and no means don't
    691      display edge labels.
    692      Default vaule is no. */
    693   enum decision display_edge_labels;
    694 
    695   /* Dirty edge labels yes enforces a fast layout of edge labels, which
    696      may very ugly because several labels may be drawn at the same place.
    697      Dirty edge labels cannot be used if splines are used.
    698      Default is no.
    699   */
    700   enum decision dirty_edge_labels;
    701 
    702   /* Finetuning no switches the fine tuning phase of the graph layout
    703      algorithm off, while it is on as default. The fine tuning phase
    704      tries to give all edges the same length.
    705      Default is yes. */
    706   enum decision finetuning;
    707 
    708   /* Ignore singles yes hides all nodes which would appear single and
    709      unconnected from the remaining graph. Such nodes have no edge at all
    710      and are sometimes very ugly. Default is to show all nodes.
    711      Default is no. */
    712   enum decision ignore_singles;
    713 
    714   /* priority phase yes replaces the normal pendulum method by a
    715      specialized method: It forces straight long edges with 90 degree,
    716      just as the straight phase. In fact, the straight phase is a fine
    717      tune phase of the priority method. This phase is also recommended,
    718      if an orthogonal layout is selected (see manhattan.edges).
    719      Default is no. */
    720   enum decision priority_phase;
    721 
    722   /* manhattan edges yes switches the orthogonal layout on. Orthogonal
    723      layout (or manhattan layout) means that all edges consist of line
    724      segments with gradient 0 or 90 degree. Vertical edge segments might
    725      by shared by several edges, while horizontal edge segments are never
    726      shared. This results in very aesthetical layouts just for flowcharts.
    727      If the orthogonal layout is used, then the priority phase and
    728      straight phase should be used. Thus, these both phases are switched
    729      on, too, unless priority layout and straight line tuning are
    730      switched off explicitly.
    731      Default is no. */
    732   enum decision manhattan_edges;
    733 
    734   /* Smanhattan edges yes switches a specialized orthogonal layout on:
    735      Here, all horizontal edge segments between two levels share the same
    736      horizontal line, i.e. not only vertical edge segments are shared,
    737      but horizontal edge segments are shared by several edges, too. This
    738      looks nice for trees but might be too confusing in general, because
    739      the location of an edge might be ambiguously.
    740      Default is no. */
    741   enum decision smanhattan_edges;
    742 
    743   /* Near edges no suppresses near edges and bent near edges in the
    744      graph layout.
    745      Default is yes. */
    746   enum decision near_edges;
    747 
    748   /* Orientation specifies the orientation of the graph: top.to.bottom,
    749      bottom.to.top, left.to.right or right.to.left. Note: the normal
    750      orientation is top.to.bottom. All explanations here are given
    751      relatively to the normal orientation, i.e., e.g., if the orientation
    752      is left to right, the attribute xlspace is not the horizontal but
    753      the vertical distance between lines, etc.
    754      Default is to_to_bottom. */
    755   enum orientation orientation;
    756 
    757   /* Node alignment specified the vertical alignment of nodes at the
    758      horizontal reference line of the levels. If top is specified, the
    759      tops of all nodes of a level have the same y-coordinate; on bottom,
    760      the bottoms have the same y-coordinate, on center the nodes are
    761      centered at the levels.
    762      Default is center. */
    763   enum alignment node_alignment;
    764 
    765   /* Port sharing no suppresses the sharing of ports of edges at the
    766      nodes. Normally, if multiple edges are adjacent to the same node,
    767      and the arrow head of all these edges has the same visual appearance
    768      (color, size, etc.), then these edges may share a port at a node,
    769      i.e. only one arrow head is draw, and all edges are incoming into
    770      this arrow head. This allows to have many edges adjacent to one node
    771      without getting confused by too many arrow heads. If no port sharing
    772      is used, each edge has its own port, i.e. its own place where it is
    773      adjacent to the node.
    774      Default is yes. */
    775   enum decision port_sharing;
    776 
    777   /* Arrow mode fixed (default) should be used, if port sharing is used,
    778      because then, only a fixed set of rotations for the arrow heads are
    779      used. If the arrow mode is free, then each arrow head is rotated
    780      individually to each edge. But this can yield to a black spot, where
    781      nothing is recognizable, if port sharing is used, since all these
    782      qdifferently rotated arrow heads are drawn at the same place. If the
    783      arrow mode is fixed, then the arrow head is rotated only in steps of
    784      45 degree, and only one arrow head occurs at each port.
    785      Default is fixed. */
    786   enum arrow_mode arrow_mode;
    787 
    788   /* Treefactor The algorithm tree for downward laid out trees tries to
    789      produce a medium dense, balanced tree-like layout. If the tree
    790      factor is greater than 0.5, the tree edges are spread, i.e. they
    791      get a larger gradient. This may improve the readability of the tree.
    792      Note: it is not obvious whether spreading results in a more dense or
    793      wide layout. For a tree, there is a tree factor such that the whole
    794      tree is minimal wide.
    795      Default is 0.5. */
    796   float treefactor;
    797 
    798   /* Spreadlevel This parameter only influences the algorithm tree, too.
    799      For large, balanced trees, spreading of the uppermost nodes would
    800      enlarge the width of the tree too much, such that the tree does not
    801      fit anymore in a window. Thus, the spreadlevel specifies the minimal
    802      level (rank) where nodes are spread. Nodes of levels upper than
    803      spreadlevel are not spread.
    804      Default is 1. */
    805   int spreadlevel;
    806 
    807   /* Crossing weight specifies the weight that is used for the crossing
    808      reduction: bary (default), median, barymedian or medianbary. We
    809      cannot give a general recommendation, which is the best method. For
    810      graphs with very large average degree of edges (number of incoming
    811      and outgoing edges at a node), the weight bary is the fastest
    812      method. With the weights barymedian and medianbary, equal weights of
    813      different nodes are not very probable, thus the crossing reduction
    814      phase 2 might be very fast.
    815      Default is bary. */
    816   enum crossing_type crossing_weight;
    817 
    818   /* Crossing phase2 is the most time consuming phase of the crossing
    819      reduction. In this phase, the nodes that happen to have equal
    820      crossing weights are permuted. By specifying no, this phase is
    821      suppressed.
    822      Default is yes. */
    823   enum decision crossing_phase2;
    824 
    825   /* Crossing optimization is a postprocessing phase after the normal
    826      crossing reduction: we try to optimize locally, by exchanging pairs
    827      of nodes to reduce the crossings. Although this phase is not very
    828      time consuming, it can be suppressed by specifying no.
    829      Default is yes. */
    830   enum decision crossing_optimization;
    831 
    832   /* View allows to select the fisheye views. Because
    833      of the fixed size of the window that shows the graph, we normally
    834      can only see a small amount of a large graph. If we shrink the graph
    835      such that it fits into the window, we cannot recognize any detail
    836      anymore. Fisheye views are coordinate transformations: the view onto
    837      the graph is distort, to overcome this usage deficiency. The polar
    838      fisheye is easy to explain: assume a projection of the plane that
    839      contains the graph picture onto a spheric ball. If we now look onto
    840      this ball in 3 D, we have a polar fisheye view. There is a focus
    841      point which is magnified such that we see all details. Parts of the
    842      plane that are far away from the focus point are demagnified very
    843      much. Cartesian fisheye have a similar effect; only the formula for
    844      the coordinate transformation is different. Selecting cfish means
    845      the cartesian fisheye is used which demagnifies such that the whole
    846      graph is visible (self adaptable cartesian fisheye). With fcfish,
    847      the cartesian fisheye shows the region of a fixed radius around the
    848      focus point (fixed radius cartesian fisheye). This region might be
    849      smaller than the whole graph, but the demagnification needed to show
    850      this region in the window is also not so large, thus more details
    851      are recognizable. With pfish the self adaptable polar fisheye is
    852      selected that shows the whole graph, and with fpfish the fixed
    853      radius polar fisheye is selected.
    854      Default is normal view.  */
    855   enum view view;
    856 
    857   /* Edges no suppresses the drawing of edges.
    858      Default is yes. */
    859   enum decision edges;
    860 
    861   /* Nodes no suppresses the drawing of nodes.
    862      Default is yes. */
    863   enum decision nodes;
    864 
    865   /* Splines specifies whether splines are used to draw edges (yes or no).
    866      As default, polygon segments are used to draw edges, because this is
    867      much faster. Note that the spline drawing routine is not fully
    868      validated, and is very slow. Its use is mainly to prepare high
    869      quality PostScript output for very small graphs.
    870      Default is no. */
    871   enum decision splines;
    872 
    873   /* Bmax set the maximal number of iterations that are done for the
    874      reduction of edge bendings.
    875    Default is 100. */
    876   int bmax;
    877 
    878   /* Cmin set the minimal number of iterations that are done for the
    879      crossing reduction with the crossing weights. The normal method
    880      stops if two consecutive checks does not reduce the number of
    881      crossings anymore. However, this increasing of the number of
    882      crossings might be locally, such that after some more iterations,
    883      the crossing number might decrease much more.
    884      Default is 0. */
    885   int cmin;
    886 
    887   /* Cmax set the maximal number of interactions for crossing reduction.
    888      This is helpful for speeding up the layout process.
    889      Default is -1, which represents infinity.  */
    890   int cmax;
    891 
    892   /* Pmin set the minimal number of iterations that is done with the
    893      pendulum method. Similar to the crossing reduction, this method
    894      stops if the `imbalancement weight' does not decreases anymore.
    895      However, the increasing of the imbalancement weight might be locally,
    896      such that after some more iterations, the imbalancement weight might
    897      decrease much more.
    898      Default is 0. */
    899   int pmin;
    900 
    901   /* Pmax set the maximal number of iterations of the pendulum method.
    902      This is helpful for speedup the layout process.
    903      Default is 100. */
    904   int pmax;
    905 
    906   /* Rmin set the minimal number of iterations that is done with the
    907      rubberband method. This is similar as for the pendulum method.
    908      Default is 0. */
    909   int rmin;
    910 
    911   /* Rmax set the maximal number of iterations of the rubberband method.
    912      This is helpful for speedup the layout process.
    913      Default is 100. */
    914   int rmax;
    915 
    916   /* Smax set the maximal number of iterations of the straight line
    917      recognition phase (useful only, if the straight line recognition
    918      phase is switched on, see attribute straight.phase).
    919      Default is 100. */
    920   int smax;
    921 
    922   /* Generic values.
    923    */
    924   node node;
    925   edge edge;
    926 
    927   /* List of nodes declared.
    928      Pointer. */
    929   node *node_list;
    930 
    931   /* List of edges declared.
    932      Pointer. */
    933   edge *edge_list;
    934 
    935 };
    936 
    937 /* Graph typedefs. */
    938 typedef struct graph graph;
    939 
    940 void new_graph (graph *g);
    941 void new_node (node *n);
    942 void new_edge (edge *e);
    943 
    944 void add_node (graph *g, node *n);
    945 void add_edge (graph *g, edge *e);
    946 
    947 void add_colorentry (graph *g, int color_idx, int red_cp,
    948 		     int green_cp, int blue_cp);
    949 void add_classname (graph *g, int val, const char *name);
    950 void add_infoname (graph *g, int val, const char *name);
    951 
    952 void open_node (FILE *fout);
    953 void output_node (node *n, FILE *fout);
    954 void close_node (FILE *fout);
    955 
    956 void open_edge (edge *e, FILE *fout);
    957 void output_edge (edge *e, FILE *fout);
    958 void close_edge (FILE *fout);
    959 
    960 void open_graph (FILE *fout);
    961 void output_graph (graph *g, FILE *fout);
    962 void close_graph (graph *g, FILE *fout);
    963 
    964 #endif /* VCG_H_ */
    965