g.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. /* The structures according to graph description language
  2. This program is free software: you can redistribute it and/or modify
  3. it under the terms of the GNU General Public License as published by
  4. the Free Software Foundation, either version 3 of the License, or
  5. (at your option) any later version.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. GNU General Public License for more details.
  10. You should have received a copy of the GNU General Public License
  11. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  12. #ifndef G_H
  13. #define G_H
  14. #include <assert.h>
  15. typedef struct g_node g_node;
  16. typedef struct g_edge g_edge;
  17. typedef struct g_graph g_graph;
  18. enum gdl_node_attr
  19. {
  20. G_NODE_ATTR_bordercolor,
  21. G_NODE_ATTR_borderwidth,
  22. G_NODE_ATTR_color,
  23. G_NODE_ATTR_horizontal_order,
  24. G_NODE_ATTR_label,
  25. G_NODE_ATTR_title,
  26. G_NODE_ATTR_vertical_order,
  27. G_NODE_ATTR_MAX
  28. };
  29. struct g_node
  30. {
  31. char *bordercolor;
  32. int borderwidth;
  33. char *color;
  34. int horizontal_order;
  35. char *label;
  36. char *title;
  37. int vertical_order;
  38. /* The value is 1 if the attribute is set. */
  39. int set_p[G_NODE_ATTR_MAX];
  40. g_node *next;
  41. /* The graph who it belongs to. */
  42. g_graph *parent;
  43. };
  44. typedef enum
  45. {
  46. G_EDGE,
  47. G_BACKEDGE,
  48. } g_edge_type;
  49. enum g_edge_attr
  50. {
  51. G_EDGE_ATTR_label,
  52. G_EDGE_ATTR_linestyle,
  53. G_EDGE_ATTR_sourcename,
  54. G_EDGE_ATTR_targetname,
  55. G_EDGE_ATTR_thickness,
  56. G_EDGE_ATTR_MAX
  57. };
  58. struct g_edge
  59. {
  60. char *label;
  61. char *linestyle;
  62. char *sourcename;
  63. char *targetname;
  64. int thickness;
  65. /* The value is 1 if the attribute is set. */
  66. int set_p[G_EDGE_ATTR_MAX];
  67. g_edge_type type;
  68. g_edge *next;
  69. };
  70. enum g_graph_attr
  71. {
  72. G_GRAPH_ATTR_color,
  73. G_GRAPH_ATTR_colorentry,
  74. G_GRAPH_ATTR_folding,
  75. G_GRAPH_ATTR_label,
  76. G_GRAPH_ATTR_layout_algorithm,
  77. G_GRAPH_ATTR_near_edges,
  78. G_GRAPH_ATTR_node_alignment,
  79. G_GRAPH_ATTR_orientation,
  80. G_GRAPH_ATTR_port_sharing,
  81. G_GRAPH_ATTR_shape,
  82. G_GRAPH_ATTR_splines,
  83. G_GRAPH_ATTR_title,
  84. G_GRAPH_ATTR_vertical_order,
  85. G_GRAPH_ATTR_xspace,
  86. G_GRAPH_ATTR_yspace,
  87. G_GRAPH_ATTR_node_borderwidth,
  88. G_GRAPH_ATTR_node_color,
  89. G_GRAPH_ATTR_node_shape,
  90. G_GRAPH_ATTR_node_textcolor,
  91. G_GRAPH_ATTR_edge_color,
  92. G_GRAPH_ATTR_edge_thickness,
  93. G_GRAPH_ATTR_MAX
  94. };
  95. struct g_graph
  96. {
  97. char *color;
  98. int colorentry[256][3];
  99. int folding;
  100. char *label;
  101. char *layout_algorithm;
  102. char *near_edges;
  103. char *node_alignment;
  104. char *orientation;
  105. char *port_sharing;
  106. char *shape;
  107. char *splines;
  108. char *title;
  109. int vertical_order;
  110. int xspace;
  111. int yspace;
  112. int node_borderwidth;
  113. char *node_color;
  114. char *node_shape;
  115. char *node_textcolor;
  116. char *edge_color;
  117. int edge_thickness;
  118. /* The value is 1 if the attribute is set. */
  119. int set_p[G_GRAPH_ATTR_MAX];
  120. int colorentry_set_p[256];
  121. /* nodes or subgraphs */
  122. int node_num;
  123. int subgraph_num;
  124. int edge_num;
  125. g_node *node;
  126. g_node *last_node;
  127. g_graph *subgraph;
  128. g_graph *last_subgraph;
  129. g_edge *edge;
  130. g_edge *last_edge;
  131. g_graph *next;
  132. /* The graph who it belongs to. */
  133. g_graph *parent;
  134. };
  135. /* Free the GRAPH. */
  136. extern void
  137. g_free_graph (g_graph *graph);
  138. /* Dump GRAPH into the file. */
  139. extern void
  140. g_dump_graph (FILE *fout, g_graph *graph);
  141. /* Create a graph for a given TITLE. */
  142. extern g_graph *
  143. g_new_graph (char *title);
  144. #endif
  145. /* end */