From: John Darrington Date: Sun, 8 May 2005 00:13:19 +0000 (+0000) Subject: Fixed more gcc 2.95 problems X-Git-Tag: v0.4.0~85 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fa37636e739d1e407ae6b80d65b256eb34567932;p=pspp-builds.git Fixed more gcc 2.95 problems --- diff --git a/po/en_GB.po b/po/en_GB.po index 79372ecd..fa7bbfad 100644 --- a/po/en_GB.po +++ b/po/en_GB.po @@ -6,7 +6,6 @@ msgid "" msgstr "" "Project-Id-Version: PSPP 0.3.1\n" -"Report-Msgid-Bugs-To: pspp-dev@gnu.org\n" "POT-Creation-Date: 2005-05-07 16:45+0800\n" "PO-Revision-Date: 2004-01-23 13:04+0800\n" "Last-Translator: John Darrington \n" @@ -14,6 +13,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=iso-8859-1\n" "Content-Transfer-Encoding: 8bit\n" +"Report-Msgid-Bugs-To: pspp-dev@gnu.org\n" "Plural-Forms: nplurals=2; plural=(n!=1);\n" #: src/aggregate.c:195 diff --git a/src/ChangeLog b/src/ChangeLog index 932fba3e..17c28062 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +Sun May 8 08:08:07 WST 2005 John Darrington + + * barchart.c box-whisker.c cartesian.c piechart.c plot-hist.c: Fixed + more ISO/IEC 9899:1990 conformance issues. + Wed May 4 23:54:02 2005 Ben Pfaff Fix PR 12948. See also new test in diff --git a/src/barchart.c b/src/barchart.c index 86e69b65..5c00d4f5 100644 --- a/src/barchart.c +++ b/src/barchart.c @@ -114,7 +114,6 @@ void draw_barchart(struct chart *ch, const char *title, const char *xlabel, const char *ylabel, enum bar_opts opt) { - double d; int i; @@ -122,11 +121,12 @@ draw_barchart(struct chart *ch, const char *title, double bar_width = interval_size / 1.1 ; + double ordinate_scale = fabs(ch->data_top - ch->data_bottom) / + fabs(y_max - y_min) ; + if ( opt != BAR_STACKED ) bar_width /= SUB_CATAGORIES; - double ordinate_scale = fabs(ch->data_top - ch->data_bottom) / fabs(y_max - y_min) ; - /* Move to data bottom-left */ pl_move_r(ch->lp, ch->data_left, ch->data_bottom); diff --git a/src/box-whisker.c b/src/box-whisker.c index f634c285..73d0866a 100644 --- a/src/box-whisker.c +++ b/src/box-whisker.c @@ -80,9 +80,6 @@ boxplot_draw_boxplot(struct chart *ch, double whisker[2]; int i; - assert(m); - - const double *hinge = m->hinge; struct weighted_value **wvp = m->wvp; const int n_data = m->n_data; @@ -102,6 +99,8 @@ boxplot_draw_boxplot(struct chart *ch, const double box_top = ch->data_bottom + ( hinge[2] - ch->y_min ) * ch->ordinate_scale; + assert(m); + /* Can't really draw a boxplot if there's no data */ if ( n_data == 0 ) return ; @@ -119,7 +118,7 @@ boxplot_draw_boxplot(struct chart *ch, } - + { const double bottom_whisker = ch->data_bottom + ( whisker[0] - ch->y_min ) * ch->ordinate_scale; @@ -181,6 +180,7 @@ boxplot_draw_boxplot(struct chart *ch, pl_fline_r(ch->lp, box_centre, top_whisker, box_centre, box_top); + } /* Draw outliers */ for ( i = 0 ; i < n_data ; ++i ) diff --git a/src/cartesian.c b/src/cartesian.c index e4a5fe13..9dceb304 100644 --- a/src/cartesian.c +++ b/src/cartesian.c @@ -133,24 +133,22 @@ write_legend(struct chart *chart, const char *heading, void chart_datum(struct chart *ch, int dataset UNUSED, double x, double y) { - if ( ! ch ) return ; + { + const double x_pos = + (x - ch->x_min) * ch->abscissa_scale + ch->data_left ; + const double y_pos = + (y - ch->y_min) * ch->ordinate_scale + ch->data_bottom ; - const double x_pos = - (x - ch->x_min) * ch->abscissa_scale + ch->data_left ; - - const double y_pos = - (y - ch->y_min) * ch->ordinate_scale + ch->data_bottom ; - - pl_savestate_r(ch->lp); + pl_savestate_r(ch->lp); - pl_fmarker_r(ch->lp, x_pos, y_pos, 6, 15); - - pl_restorestate_r(ch->lp); + pl_fmarker_r(ch->lp, x_pos, y_pos, 6, 15); + pl_restorestate_r(ch->lp); + } } /* Draw a line with slope SLOPE and intercept INTERCEPT. diff --git a/src/piechart.c b/src/piechart.c index 523809f3..dd889c33 100644 --- a/src/piechart.c +++ b/src/piechart.c @@ -54,9 +54,7 @@ piechart_plot(const char *title, const struct slice *slices, int n_slices) int i; double total_magnetude=0; - struct chart *ch; - - ch = chart_create(); + struct chart *ch = chart_create(); const double left_label = ch->data_left + (ch->data_right - ch->data_left)/10.0; diff --git a/src/plot-hist.c b/src/plot-hist.c index ad867693..85fb3700 100644 --- a/src/plot-hist.c +++ b/src/plot-hist.c @@ -65,43 +65,46 @@ static void hist_draw_bar(struct chart *ch, const gsl_histogram *hist, int bar); static void hist_draw_bar(struct chart *ch, const gsl_histogram *hist, int bar) { - double upper; - double lower; - double height; - if ( !ch ) - return ; - const size_t bins = gsl_histogram_bins(hist); - const double x_pos = (ch->data_right - ch->data_left) * bar / (double) bins ; - const double width = (ch->data_right - ch->data_left) / (double) bins ; + return ; - assert ( 0 == gsl_histogram_get_range(hist, bar, &lower, &upper)); + { + double upper; + double lower; + double height; - assert( upper >= lower); + const size_t bins = gsl_histogram_bins(hist); + const double x_pos = (ch->data_right - ch->data_left) * bar / (double) bins ; + const double width = (ch->data_right - ch->data_left) / (double) bins ; - height = gsl_histogram_get(hist, bar) * - (ch->data_top - ch->data_bottom) / gsl_histogram_max_val(hist); - pl_savestate_r(ch->lp); - pl_move_r(ch->lp,ch->data_left, ch->data_bottom); - pl_fillcolorname_r(ch->lp, ch->fill_colour); - pl_filltype_r(ch->lp,1); + assert ( 0 == gsl_histogram_get_range(hist, bar, &lower, &upper)); + assert( upper >= lower); - pl_fboxrel_r(ch->lp, - x_pos, 0, - x_pos + width, height); + height = gsl_histogram_get(hist, bar) * + (ch->data_top - ch->data_bottom) / gsl_histogram_max_val(hist); - pl_restorestate_r(ch->lp); + pl_savestate_r(ch->lp); + pl_move_r(ch->lp,ch->data_left, ch->data_bottom); + pl_fillcolorname_r(ch->lp, ch->fill_colour); + pl_filltype_r(ch->lp,1); - { - char buf[5]; - snprintf(buf,5,"%g",(upper + lower) / 2.0); - draw_tick(ch, TICK_ABSCISSA, - x_pos + width / 2.0, buf); - } + pl_fboxrel_r(ch->lp, + x_pos, 0, + x_pos + width, height); + + pl_restorestate_r(ch->lp); + + { + char buf[5]; + snprintf(buf,5,"%g",(upper + lower) / 2.0); + draw_tick(ch, TICK_ABSCISSA, + x_pos + width / 2.0, buf); + } + } }