]> git.saurik.com Git - bison.git/commitdiff
* src/vcg.c: Include `xalloc.h'.
authorMarc Autret <autret_m@epita.fr>
Mon, 27 Aug 2001 12:02:47 +0000 (12:02 +0000)
committerMarc Autret <autret_m@epita.fr>
Mon, 27 Aug 2001 12:02:47 +0000 (12:02 +0000)
(add_colorentry): New.
(add_classname): New.
(add_infoname): New.
* src/vcg.h: Add new prototypes.

ChangeLog
src/vcg.c
src/vcg.h

index a71456f6e3a507aa3c020ccdbcfa39188202e94e..00e5e40ec9b922a53dfc64994bdb91a84467e483 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2001-08-27  Marc Autret  <autret_m@epita.fr>
+
+       * src/vcg.c: Include `xalloc.h'.
+       (add_colorentry): New.
+       (add_classname): New.
+       (add_infoname): New.
+       * src/vcg.h: Add new prototypes.
+
 2001-08-27  Akim Demaille  <akim@epita.fr>
 
        * Makefile.maint: Sync. again with CVS Autoconf.
 2001-08-27  Akim Demaille  <akim@epita.fr>
 
        * Makefile.maint: Sync. again with CVS Autoconf.
index b5ed817b4add5afb399cdcd98083099a58f1b936..aa3590469d425578e763dce23ef959d135bb5f8e 100644 (file)
--- a/src/vcg.c
+++ b/src/vcg.c
@@ -19,6 +19,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include "system.h"
    Boston, MA 02111-1307, USA.  */
 
 #include "system.h"
+#include "xalloc.h"
 #include "vcg.h"
 #include "vcg_defaults.h"
 
 #include "vcg.h"
 #include "vcg_defaults.h"
 
@@ -425,6 +426,46 @@ add_edge (graph_t *graph, edge_t *edge)
   graph->edge_list = edge;
 }
 
   graph->edge_list = edge;
 }
 
+void
+add_classname (graph_t *g, int val, char *name)
+{
+  struct classname_s *classname;
+  
+  classname = XMALLOC (struct classname_s, 1);
+  classname->no = val;
+  classname->name = name;
+  classname->next = g->classname;
+  g->classname = classname;
+}
+
+void
+add_infoname (graph_t *g, int integer, char *string)
+{
+  struct infoname_s *infoname;
+  
+  infoname = XMALLOC (struct infoname_s, 1);
+  infoname->integer = integer;
+  infoname->string = string;
+  infoname->next = g->infoname;
+  g->infoname = infoname;
+}
+
+/* Build a colorentry struct and add it to the list.  */
+void
+add_colorentry (graph_t *g, int color_idx, int red_cp, 
+               int green_cp, int blue_cp)
+{
+  struct colorentry_s *ce;
+  
+  ce = XMALLOC (struct colorentry_s, 1);
+  ce->color_index = color_idx;
+  ce->red_cp = red_cp;
+  ce->green_cp = green_cp;
+  ce->blue_cp = blue_cp;
+  ce->next = g->colorentry;
+  g->colorentry = ce;
+}
+
 /*-------------------------------------.
 | Open and close functions (formatted) |
 `-------------------------------------*/
 /*-------------------------------------.
 | Open and close functions (formatted) |
 `-------------------------------------*/
@@ -480,6 +521,7 @@ close_graph(graph_t *graph, struct obstack *os)
 {
   obstack_1grow (os, '\n');
 
 {
   obstack_1grow (os, '\n');
 
+  /* FIXME: Unallocate nodes and edges if required.  */
   {
     node_t *node;
 
   {
     node_t *node;
 
@@ -702,7 +744,9 @@ output_graph (graph_t *graph, struct obstack *os)
 
   if (graph->hidden != G_HIDDEN)
     obstack_fgrow1 (os, "\thidden:\t%d\n", graph->hidden);
 
   if (graph->hidden != G_HIDDEN)
     obstack_fgrow1 (os, "\thidden:\t%d\n", graph->hidden);
-
+  
+  /* FIXME: Unallocate struct list if required.  
+     Maybe with a little function.  */
   if (graph->classname != G_CLASSNAME)
     {
       struct classname_s *ite;
   if (graph->classname != G_CLASSNAME)
     {
       struct classname_s *ite;
index 2df5e4e443b90066e6e62908535c7551126e7912..1a583a460c4925c7bebb7ed196e0bbb3ffcc47e7 100644 (file)
--- a/src/vcg.h
+++ b/src/vcg.h
@@ -999,6 +999,11 @@ void new_edge PARAMS ((edge_t *edge));
 void add_node PARAMS ((graph_t *graph, node_t *node));
 void add_edge PARAMS ((graph_t *graph, edge_t *edge));
 
 void add_node PARAMS ((graph_t *graph, node_t *node));
 void add_edge PARAMS ((graph_t *graph, edge_t *edge));
 
+void add_colorentry PARAMS ((graph_t *g, int color_idx, int red_cp, 
+                            int green_cp, int blue_cp));
+void add_classname PARAMS ((graph_t *g, int val, char *name));
+void add_infoname PARAMS ((graph_t *g, int val, char *name));
+
 void open_node PARAMS ((struct obstack *os));
 void output_node PARAMS ((node_t *node, struct obstack *os));
 void close_node PARAMS ((struct obstack *os));
 void open_node PARAMS ((struct obstack *os));
 void output_node PARAMS ((node_t *node, struct obstack *os));
 void close_node PARAMS ((struct obstack *os));