bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI: [bison-1_29-branch] vcg-constructors.patch


From: marc-alexandre autret
Subject: FYI: [bison-1_29-branch] vcg-constructors.patch
Date: Mon, 27 Aug 2001 14:04:47 +0000 (GMT)

Hi, 

VCG.
New little functions to simplify
the graph parameters building.


Index: ChangeLog
===================================================================
RCS file: /cvsroot/bison/bison/ChangeLog,v
retrieving revision 1.173.2.13
diff -u -r1.173.2.13 ChangeLog
--- ChangeLog   2001/08/27 10:44:39     1.173.2.13
+++ ChangeLog   2001/08/27 12:01:46
@@ -1,3 +1,11 @@
+2001-08-27  Marc Autret  <address@hidden>
+
+       * 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  <address@hidden>
 
        * Makefile.maint: Sync. again with CVS Autoconf.
Index: src/vcg.c
===================================================================
RCS file: /cvsroot/bison/bison/src/vcg.c,v
retrieving revision 1.5.2.2
diff -u -r1.5.2.2 vcg.c
--- src/vcg.c   2001/08/26 23:48:50     1.5.2.2
+++ src/vcg.c   2001/08/27 12:01:48
@@ -19,6 +19,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include "system.h"
+#include "xalloc.h"
 #include "vcg.h"
 #include "vcg_defaults.h"
 
@@ -425,6 +426,46 @@
   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) |
 `-------------------------------------*/
@@ -480,6 +521,7 @@
 {
   obstack_1grow (os, '\n');
 
+  /* FIXME: Unallocate nodes and edges if required.  */
   {
     node_t *node;
 
@@ -702,7 +744,9 @@
 
   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;
Index: src/vcg.h
===================================================================
RCS file: /cvsroot/bison/bison/src/vcg.h,v
retrieving revision 1.3.2.1
diff -u -r1.3.2.1 vcg.h
--- src/vcg.h   2001/08/26 23:48:50     1.3.2.1
+++ src/vcg.h   2001/08/27 12:01:51
@@ -999,6 +999,11 @@
 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));


-- 
Autret Marc (address@hidden)
Eleve Ingenieur en Informatique.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]