From: John Darrington Date: Mon, 14 Feb 2005 12:36:01 +0000 (+0000) Subject: Made pspp fail a little more gracefully on drivers where charts are unsupported. X-Git-Tag: v0.4.0~176 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1de3b177aafac15aa57933bda223ae6b6dbc1ed6;p=pspp-builds.git Made pspp fail a little more gracefully on drivers where charts are unsupported. --- diff --git a/src/box-whisker.c b/src/box-whisker.c index 773de809..57930c86 100644 --- a/src/box-whisker.c +++ b/src/box-whisker.c @@ -212,6 +212,9 @@ boxplot_draw_yscale(struct chart *ch , double y_max, double y_min) double y_tick; double d; + if ( !ch ) + return ; + ch->y_max = y_max; ch->y_min = y_min; diff --git a/src/examine.q b/src/examine.q index f92bba1f..96d8210d 100644 --- a/src/examine.q +++ b/src/examine.q @@ -1777,7 +1777,7 @@ box_plot_group(const struct factor *fctr, s); } } - else + else if ( ch ) { const double box_width = (ch->data_right - ch->data_left) / 3.0; const double box_centre = (ch->data_right + ch->data_left) / 2.0; diff --git a/src/plot-chart.c b/src/plot-chart.c index 795e3113..ae90a7e3 100644 --- a/src/plot-chart.c +++ b/src/plot-chart.c @@ -188,7 +188,8 @@ chart_submit(struct chart *chart) { struct som_entity s; - assert(chart); + if ( ! chart ) + return ; pl_restorestate_r(chart->lp); diff --git a/src/postscript.c b/src/postscript.c index 7b1f6e15..ebad2472 100644 --- a/src/postscript.c +++ b/src/postscript.c @@ -2871,6 +2871,28 @@ load_font (struct outp_driver *this, const char *dit) return fe; } + +void ps_chart_initialise(struct outp_class *c UNUSED, + struct chart *ch UNUSED); + +void ps_chart_finalise(struct outp_class *c UNUSED, + struct chart *ch UNUSED); + + +void +ps_chart_initialise(struct outp_class *c UNUSED, struct chart *ch ) +{ + msg(MW, _("Charts are currently unsupported with postscript drivers.")); + ch->lp = 0; +} + +void +ps_chart_finalise(struct outp_class *c UNUSED, struct chart *ch UNUSED) +{ + +} + + /* PostScript driver class. */ struct outp_class postscript_class = { @@ -2911,8 +2933,8 @@ struct outp_class postscript_class = ps_text_metrics, ps_text_draw, - NULL, - NULL + ps_chart_initialise, + ps_chart_finalise }; /* EPSF driver class. FIXME: Probably doesn't work right. */ @@ -2955,8 +2977,9 @@ struct outp_class epsf_class = ps_text_metrics, ps_text_draw, - NULL, - NULL + ps_chart_initialise, + ps_chart_finalise + }; #endif /* NO_POSTSCRIPT */