X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fplot-chart.c;h=bfe38c8192f105da9453c6dc7c7b5f79296568f5;hb=ab1b102eacc82ee2b51dd9b998317e77a8f74b9f;hp=c38a562218652594d7780f5a4a4a898e081293ee;hpb=4fdeb2145d081ff1b84e3f6c99f9d1c048c0d64a;p=pspp-builds.git diff --git a/src/plot-chart.c b/src/plot-chart.c index c38a5622..bfe38c81 100644 --- a/src/plot-chart.c +++ b/src/plot-chart.c @@ -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); - }