pspp-cvs
[Top][All Lists]
Advanced

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

[Pspp-cvs] Changes to pspp/src/plot-chart.c


From: Ben Pfaff
Subject: [Pspp-cvs] Changes to pspp/src/plot-chart.c
Date: Mon, 13 Jun 2005 02:51:19 -0400

Index: pspp/src/plot-chart.c
diff -u pspp/src/plot-chart.c:1.5 pspp/src/plot-chart.c:1.6
--- pspp/src/plot-chart.c:1.5   Fri Apr 29 01:02:15 2005
+++ pspp/src/plot-chart.c       Mon Jun 13 06:51:13 2005
@@ -52,24 +52,23 @@
 chart_create(void)
 {
   struct chart *chart;
-
   struct outp_driver *d;
 
+  d = outp_drivers (NULL);
+  if (d == NULL)
+    return NULL;
+  
   chart = xmalloc(sizeof(struct chart) );
-
-  for (d = outp_drivers (NULL); d; d = outp_drivers (d))
+  d->class->initialise_chart(d, chart);
+  if (!chart->lp) 
     {
-      assert(d->class->initialise_chart);
-      d->class->initialise_chart(d, chart);
-      break; /* KLUDGE!! */
+      free (chart);
+      return NULL; 
     }
 
-  if ( ! chart->lp ) 
-    return 0;
-
   if (pl_openpl_r (chart->lp) < 0)      /* open Plotter */
-      return 0;
-
+    return NULL;
+  
   pl_fspace_r (chart->lp, 0.0, 0.0, 1000.0, 1000.0); /* set coordinate system 
*/
   pl_flinewidth_r (chart->lp, 0.25);    /* set line thickness */
   pl_pencolorname_r (chart->lp, "black"); 
@@ -77,8 +76,6 @@
   pl_erase_r (chart->lp);               /* erase graphics display */
   pl_filltype_r(chart->lp,0);
 
-
-
   pl_savestate_r(chart->lp);
 
   /* Set default chartetry */
@@ -94,7 +91,6 @@
   chart->font_size = 0;
   strcpy(chart->fill_colour,"red");
 
-
   /* Get default font size */
   if ( !chart->font_size) 
     chart->font_size = pl_fontsize_r(chart->lp, -1);
@@ -105,11 +101,8 @@
           chart->data_right, chart->data_top);
 
   return chart;
-
 }
 
-
-
 /* Draw a tick mark at position
    If label is non zero, then print it at the tick mark
 */
@@ -188,6 +181,7 @@
 chart_submit(struct chart *chart)
 {
   struct som_entity s;
+  struct outp_driver *d;
 
   if ( ! chart ) 
      return ;
@@ -208,8 +202,9 @@
 
   pl_deleteplparams(chart->pl_params);
 
+  d = outp_drivers (NULL);
+  d->class->finalise_chart(d, chart);
   free(chart);
-
 }
 
 




reply via email to

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