X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fplot-chart.c;h=bfe38c8192f105da9453c6dc7c7b5f79296568f5;hb=d7b5d9144738a5a8989d45a01f4e458a78b68c0b;hp=f0119b55d4657c075418f65827fbde8d7eaa26a8;hpb=05e356b2a3087e819ef3b5388e29c822f41502e1;p=pspp diff --git a/src/plot-chart.c b/src/plot-chart.c index f0119b55d4..bfe38c8192 100644 --- a/src/plot-chart.c +++ b/src/plot-chart.c @@ -14,8 +14,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ #include #include @@ -52,24 +52,23 @@ struct chart * chart_create(void) { struct chart *chart; - struct outp_driver *d; - chart = xmalloc(sizeof(struct chart) ); - - for (d = outp_drivers (NULL); d; d = outp_drivers (d)) + d = outp_drivers (NULL); + if (d == NULL) + return NULL; + + chart = xmalloc (sizeof *chart); + 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 @@ chart_create(void) 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_create(void) 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_create(void) 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 @@ void chart_submit(struct chart *chart) { struct som_entity s; + struct outp_driver *d; if ( ! chart ) return ; @@ -208,8 +202,9 @@ chart_submit(struct chart *chart) pl_deleteplparams(chart->pl_params); + d = outp_drivers (NULL); + d->class->finalise_chart(d, chart); free(chart); - }