From 3dd0f6ae0d5eb73a2270a243e443c4ae03c2c16e Mon Sep 17 00:00:00 2001 From: John Darrington Date: Sat, 22 Apr 2017 20:20:24 +0200 Subject: [PATCH] Whitespace changes only: Remove trailing whitespace --- lib/gtk-contrib/gtkxpaned.c | 42 ++-- lib/gtk-contrib/gtkxpaned.h | 2 +- lib/linreg/sweep.c | 2 +- lib/tukey/ptukey.c | 6 +- lib/tukey/qtukey.c | 4 +- src/data/attributes.h | 2 +- src/data/case-map.c | 6 +- src/data/case.c | 2 +- src/data/casegrouper.c | 12 +- src/data/casereader-translator.c | 8 +- src/data/casereader.c | 2 +- src/data/data-in.h | 2 +- src/data/dictionary.c | 4 +- src/data/file-handle-def.c | 6 +- src/data/file-name.c | 6 +- src/data/gnumeric-reader.c | 44 ++-- src/data/make-file.c | 12 +- src/data/ods-reader.c | 70 +++--- src/data/ods-reader.h | 2 +- src/data/por-file-writer.c | 4 +- src/data/psql-reader.c | 4 +- src/data/settings.c | 6 +- src/data/spreadsheet-reader.c | 12 +- src/data/sys-file-reader.c | 18 +- src/data/sys-file-writer.c | 6 +- src/data/value-labels.c | 2 +- src/data/variable.c | 24 +- src/language/command.c | 2 +- src/language/data-io/data-list.c | 2 +- src/language/data-io/get-data.c | 10 +- src/language/data-io/list.c | 2 +- src/language/dictionary/apply-dictionary.c | 2 +- src/language/dictionary/attributes.c | 20 +- src/language/dictionary/delete-variables.c | 2 +- src/language/dictionary/split-file.c | 2 +- src/language/dictionary/sys-file-info.c | 28 +-- src/language/expressions/evaluate.c | 2 +- src/language/lexer/lexer.c | 2 +- src/language/lexer/variable-parser.c | 4 +- src/language/stats/autorecode.c | 10 +- src/language/stats/chart-category.h | 2 +- src/language/stats/cochran.c | 14 +- src/language/stats/correlations.c | 30 +-- src/language/stats/crosstabs.q | 6 +- src/language/stats/examine.c | 170 +++++++------- src/language/stats/factor.c | 96 ++++---- src/language/stats/frequencies.c | 70 +++--- src/language/stats/friedman.c | 22 +- src/language/stats/glm.c | 36 +-- src/language/stats/graph.c | 72 +++--- src/language/stats/jonckheere-terpstra.c | 56 ++--- src/language/stats/kruskal-wallis.c | 26 +-- src/language/stats/ks-one-sample.c | 28 +-- src/language/stats/logistic.c | 88 ++++---- src/language/stats/mann-whitney.c | 10 +- src/language/stats/mcnemar.c | 6 +- src/language/stats/means.c | 44 ++-- src/language/stats/median.c | 32 +-- src/language/stats/npar.c | 18 +- src/language/stats/oneway.c | 56 ++--- src/language/stats/quick-cluster.c | 24 +- src/language/stats/rank.c | 10 +- src/language/stats/regression.c | 30 +-- src/language/stats/reliability.c | 4 +- src/language/stats/roc.c | 44 ++-- src/language/stats/runs.c | 10 +- src/language/stats/sort-criteria.c | 6 +- src/language/stats/t-test-indep.c | 8 +- src/language/stats/t-test-paired.c | 8 +- src/language/stats/t-test-parser.c | 10 +- src/language/utilities/include.c | 4 +- src/language/utilities/output.c | 22 +- src/language/utilities/set.q | 4 +- src/language/xforms/recode.c | 12 +- src/libpspp/array.c | 2 +- src/libpspp/hmap.c | 24 +- src/libpspp/hmap.h | 24 +- src/libpspp/hmapx.c | 12 +- src/libpspp/hmapx.h | 24 +- src/libpspp/i18n.c | 4 +- src/libpspp/inflate.c | 8 +- src/libpspp/message.c | 2 +- src/libpspp/str.c | 6 +- src/libpspp/temp-file.c | 2 +- src/libpspp/tower.c | 8 +- src/libpspp/zip-reader.c | 28 +-- src/math/box-whisker.c | 4 +- src/math/categoricals.c | 32 +-- src/math/categoricals.h | 4 +- src/math/chart-geometry.c | 26 +-- src/math/correlation.c | 12 +- src/math/covariance.c | 58 ++--- src/math/covariance.h | 2 +- src/math/histogram.h | 2 +- src/math/interaction.c | 10 +- src/math/levene.c | 10 +- src/math/linreg.c | 28 +-- src/math/linreg.h | 2 +- src/output/ascii.c | 4 +- src/output/cairo-chart.c | 12 +- src/output/cairo.c | 2 +- src/output/charts/barchart-cairo.c | 12 +- src/output/charts/barchart.c | 34 +-- src/output/charts/barchart.h | 2 +- src/output/charts/scatterplot-cairo.c | 4 +- src/output/charts/spreadlevel-cairo.c | 2 +- src/output/charts/spreadlevel-plot.c | 4 +- src/output/charts/spreadlevel-plot.h | 4 +- src/output/driver.c | 2 +- src/output/html.c | 4 +- src/output/journal.c | 2 +- src/output/odt.c | 10 +- src/output/render.c | 8 +- src/ui/gui/builder-wrapper.c | 6 +- src/ui/gui/dialog-common.c | 8 +- src/ui/gui/dict-display.h | 2 +- src/ui/gui/help-menu.c | 8 +- src/ui/gui/helper.c | 2 +- src/ui/gui/main.c | 2 +- src/ui/gui/options-dialog.c | 12 +- src/ui/gui/pspp-sheet-private.h | 2 +- src/ui/gui/pspp-sheet-selection.c | 32 +-- src/ui/gui/pspp-sheet-view-column.c | 208 +++++++++--------- src/ui/gui/pspp-sheet-view.c | 202 ++++++++--------- src/ui/gui/pspp-widget-facade.c | 2 +- src/ui/gui/psppire-buttonbox.c | 2 +- src/ui/gui/psppire-cell-renderer-button.c | 6 +- src/ui/gui/psppire-checkbox-treeview.c | 4 +- src/ui/gui/psppire-conf.c | 6 +- src/ui/gui/psppire-data-editor.c | 4 +- src/ui/gui/psppire-data-sheet.c | 24 +- src/ui/gui/psppire-data-sheet.h | 4 +- src/ui/gui/psppire-data-window.c | 112 +++++----- src/ui/gui/psppire-dialog-action-aggregate.c | 24 +- src/ui/gui/psppire-dialog-action-autorecode.c | 24 +- src/ui/gui/psppire-dialog-action-barchart.c | 8 +- src/ui/gui/psppire-dialog-action-binomial.c | 2 +- src/ui/gui/psppire-dialog-action-chisquare.c | 18 +- src/ui/gui/psppire-dialog-action-comments.c | 10 +- src/ui/gui/psppire-dialog-action-count.c | 4 +- src/ui/gui/psppire-dialog-action-crosstabs.c | 30 +-- src/ui/gui/psppire-dialog-action-crosstabs.h | 4 +- .../gui/psppire-dialog-action-descriptives.c | 2 +- src/ui/gui/psppire-dialog-action-examine.c | 4 +- src/ui/gui/psppire-dialog-action-factor.c | 8 +- src/ui/gui/psppire-dialog-action-factor.h | 2 +- .../gui/psppire-dialog-action-frequencies.h | 2 +- .../gui/psppire-dialog-action-indep-samps.c | 18 +- src/ui/gui/psppire-dialog-action-k-related.c | 6 +- src/ui/gui/psppire-dialog-action-logistic.c | 8 +- src/ui/gui/psppire-dialog-action-means.c | 2 +- src/ui/gui/psppire-dialog-action-oneway.c | 2 +- src/ui/gui/psppire-dialog-action-paired.c | 8 +- .../psppire-dialog-action-recode-different.c | 14 +- .../gui/psppire-dialog-action-recode-same.c | 6 +- src/ui/gui/psppire-dialog-action-recode.c | 8 +- src/ui/gui/psppire-dialog-action-recode.h | 2 +- src/ui/gui/psppire-dialog-action-regression.c | 12 +- .../gui/psppire-dialog-action-reliability.c | 2 +- src/ui/gui/psppire-dialog-action-roc.c | 10 +- .../gui/psppire-dialog-action-scatterplot.c | 4 +- src/ui/gui/psppire-dialog-action-select.c | 16 +- src/ui/gui/psppire-dialog-action-select.h | 4 +- src/ui/gui/psppire-dialog-action-sort.c | 2 +- src/ui/gui/psppire-dialog-action-split.c | 2 +- src/ui/gui/psppire-dialog-action-split.h | 10 +- src/ui/gui/psppire-dialog-action-tt1s.c | 2 +- src/ui/gui/psppire-dialog-action-two-sample.c | 4 +- src/ui/gui/psppire-dialog-action-univariate.c | 2 +- src/ui/gui/psppire-dialog-action-var-info.c | 2 +- src/ui/gui/psppire-dialog-action-weight.c | 4 +- src/ui/gui/psppire-dialog-action.c | 10 +- src/ui/gui/psppire-dialog-action.h | 12 +- src/ui/gui/psppire-dialog.c | 8 +- src/ui/gui/psppire-dictview.c | 8 +- src/ui/gui/psppire-encoding-selector.c | 4 +- src/ui/gui/psppire-encoding-selector.h | 4 +- src/ui/gui/psppire-import-assistant.c | 104 ++++----- src/ui/gui/psppire-import-assistant.h | 2 +- src/ui/gui/psppire-means-layer.c | 12 +- src/ui/gui/psppire-output-view.c | 18 +- src/ui/gui/psppire-output-window.c | 24 +- src/ui/gui/psppire-selector.c | 46 ++-- src/ui/gui/psppire-spreadsheet-model.c | 8 +- src/ui/gui/psppire-syntax-window.c | 48 ++-- src/ui/gui/psppire-val-chooser.c | 28 +-- src/ui/gui/psppire-value-entry.c | 2 +- src/ui/gui/psppire-value-entry.h | 4 +- src/ui/gui/psppire-var-sheet.c | 18 +- src/ui/gui/psppire-var-view.c | 20 +- src/ui/gui/psppire-window-base.c | 6 +- src/ui/gui/psppire-window-base.h | 2 +- src/ui/gui/psppire-window-register.c | 2 +- src/ui/gui/psppire-window.c | 8 +- src/ui/gui/psppire.c | 4 +- src/ui/gui/spreadsheet-test.c | 14 +- src/ui/gui/t-test-options.c | 6 +- src/ui/gui/val-labs-dialog.c | 6 +- src/ui/gui/widgets.c | 2 +- src/ui/gui/windows-menu.c | 16 +- src/ui/syntax-gen.c | 2 +- src/ui/terminal/terminal-opts.c | 4 +- src/ui/terminal/terminal-reader.c | 14 +- tests/libpspp/hmap-test.c | 42 ++-- tests/libpspp/hmapx-test.c | 50 ++--- tests/libpspp/zip-test.c | 2 +- tests/math/chart-get-scale-test.c | 8 +- tests/ui/syntax-gen-test.c | 4 +- utilities/pspp-convert.c | 2 +- utilities/pspp-dump-sav.c | 28 +-- 210 files changed, 1729 insertions(+), 1729 deletions(-) diff --git a/lib/gtk-contrib/gtkxpaned.c b/lib/gtk-contrib/gtkxpaned.c index 9be83311f0..4b98059ee3 100644 --- a/lib/gtk-contrib/gtkxpaned.c +++ b/lib/gtk-contrib/gtkxpaned.c @@ -1,5 +1,5 @@ /******************************************************************************* - **3456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 + **3456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 ** 10 20 30 40 50 60 70 80 ** ** library for GtkXPaned-widget, a 2x2 grid-like variation of GtkPaned of gtk+ @@ -529,10 +529,10 @@ gtk_xpaned_class_init (GtkXPanedClass * class) /** * GtkPaned:resize: * - * The "resize" child property determines whether the child expands and + * The "resize" child property determines whether the child expands and * shrinks along with the paned widget. - * - * Since: 2.4 + * + * Since: 2.4 */ gtk_container_class_install_child_property (container_class, CHILD_PROP_RESIZE, @@ -545,10 +545,10 @@ gtk_xpaned_class_init (GtkXPanedClass * class) /** * GtkPaned:shrink: * - * The "shrink" child property determines whether the child can be made + * The "shrink" child property determines whether the child can be made * smaller than its requisition. - * - * Since: 2.4 + * + * Since: 2.4 */ gtk_container_class_install_child_property (container_class, CHILD_PROP_SHRINK, @@ -2014,9 +2014,9 @@ gtk_xpaned_forall (GtkContainer * container, /** * gtk_xpaned_get_position_x: * @paned: a #GtkXPaned widget - * + * * Obtains the x-position of the divider. - * + * * Return value: x-position of the divider **/ gint @@ -2030,9 +2030,9 @@ gtk_xpaned_get_position_x (GtkXPaned * xpaned) /** * gtk_xpaned_get_position_y: * @paned: a #GtkXPaned widget - * + * * Obtains the y-position of the divider. - * + * * Return value: y-position of the divider **/ gint @@ -2048,7 +2048,7 @@ gtk_xpaned_get_position_y (GtkXPaned * xpaned) * @paned: a #GtkXPaned widget * @xposition: pixel x-position of divider, a negative values * of a component mean that the position is unset. - * + * * Sets the x-position of the divider between the four panes. **/ void @@ -2097,7 +2097,7 @@ gtk_xpaned_set_position_x (GtkXPaned * xpaned, gint xposition) * @paned: a #GtkXPaned widget * @yposition: pixel y-position of divider, a negative values * of a component mean that the position is unset. - * + * * Sets the y-position of the divider between the four panes. **/ void @@ -2172,9 +2172,9 @@ gtk_xpaned_fetch_unmaximized_y (GtkXPaned * xpaned) /** * gtk_xpaned_get_top_left_child: * @xpaned: a #GtkXPaned widget - * + * * Obtains the top-left child of the xpaned widget. - * + * * Return value: top-left child, or %NULL if it is not set. * * Since: 2.4 @@ -2190,9 +2190,9 @@ gtk_xpaned_get_top_left_child (GtkXPaned * xpaned) /** * gtk_xpaned_get_top_right_child: * @xpaned: a #GtkXPaned widget - * + * * Obtains the top-right child of the xpaned widget. - * + * * Return value: top-right child, or %NULL if it is not set. * * Since: 2.4 @@ -2208,9 +2208,9 @@ gtk_xpaned_get_top_right_child (GtkXPaned * xpaned) /** * gtk_xpaned_get_bottom_left_child: * @xpaned: a #GtkXPaned widget - * + * * Obtains the bottom-left child of the xpaned widget. - * + * * Return value: bottom-left child, or %NULL if it is not set. * * Since: 2.4 @@ -2226,9 +2226,9 @@ gtk_xpaned_get_bottom_left_child (GtkXPaned * xpaned) /** * gtk_xpaned_get_bottom_right_child: * @xpaned: a #GtkXPaned widget - * + * * Obtains the bottom-right child of the xpaned widget. - * + * * Return value: bottom-right child, or %NULL if it is not set. * * Since: 2.4 diff --git a/lib/gtk-contrib/gtkxpaned.h b/lib/gtk-contrib/gtkxpaned.h index 62d920eb54..bb6b196949 100644 --- a/lib/gtk-contrib/gtkxpaned.h +++ b/lib/gtk-contrib/gtkxpaned.h @@ -1,5 +1,5 @@ /******************************************************************************* -**3456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 +**3456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 ** 10 20 30 40 50 60 70 80 ** ** library for GtkXPaned-widget, a 2x2 grid-like variation of GtkPaned of gtk+ diff --git a/lib/linreg/sweep.c b/lib/linreg/sweep.c index 62dda20070..536fb3b02c 100644 --- a/lib/linreg/sweep.c +++ b/lib/linreg/sweep.c @@ -83,7 +83,7 @@ reg_sweep (gsl_matrix * A, int last_col) assert (last_col < A->size1); gsl_matrix_swap_rows (A, A->size1 - 1, last_col); gsl_matrix_swap_columns (A, A->size1 - 1 , last_col); - + B = gsl_matrix_alloc (A->size1, A->size2); for (k = 0; k < (A->size1 - 1); k++) { diff --git a/lib/tukey/ptukey.c b/lib/tukey/ptukey.c index 9a89104cf9..2af46cf893 100644 --- a/lib/tukey/ptukey.c +++ b/lib/tukey/ptukey.c @@ -59,7 +59,7 @@ * Vol.30, pp.1-15, 1988. */ - + #include @@ -84,13 +84,13 @@ #define ME_PRECISION 8 -static inline double +static inline double pnorm(double x, double mu, double sigma, int lower_tail, int log_p) { assert (lower_tail == 1); assert (log_p == 0); assert (sigma == 1.0); - + return gsl_cdf_gaussian_P (x - mu, sigma); } diff --git a/lib/tukey/qtukey.c b/lib/tukey/qtukey.c index ec14600142..08f8c855d3 100644 --- a/lib/tukey/qtukey.c +++ b/lib/tukey/qtukey.c @@ -192,14 +192,14 @@ double qtukey(double p, double rr, double cc, double df, } /* df must be > 1 ; there must be at least two values */ - /* ^^ + /* ^^ JMD: The comment says 1 but the code says 2. Which is correct? */ assert (df >= 2); assert (rr >= 1); assert (cc >= 2); - + R_Q_P01_boundaries (p, 0, ML_POSINF); diff --git a/src/data/attributes.h b/src/data/attributes.h index a5cebc5bcc..b0712fcc8f 100644 --- a/src/data/attributes.h +++ b/src/data/attributes.h @@ -41,7 +41,7 @@ void attribute_set_value (struct attribute *, size_t index, const char *); void attribute_del_value (struct attribute *, size_t index); size_t attribute_get_n_values (const struct attribute *); -struct attrset +struct attrset { struct hmap map; }; diff --git a/src/data/case-map.c b/src/data/case-map.c index 3cbe24792a..131e407879 100644 --- a/src/data/case-map.c +++ b/src/data/case-map.c @@ -120,7 +120,7 @@ case_map_get_proto (const struct case_map *map) } /* Creates and returns a new casereader whose cases are produced - by reading from SUBREADER and executing the actions of MAP. + by reading from SUBREADER and executing the actions of MAP. The casereader will have as many `union value's as MAP. When the new casereader is destroyed, MAP will be destroyed too. @@ -129,7 +129,7 @@ case_map_get_proto (const struct case_map *map) when the returned casereader is destroyed. */ struct casereader * case_map_create_input_translator (struct case_map *map, - struct casereader *subreader) + struct casereader *subreader) { return casereader_create_translator (subreader, case_map_get_proto (map), @@ -149,7 +149,7 @@ case_map_create_input_translator (struct case_map *map, when the returned casewriter is destroyed. */ struct casewriter * case_map_create_output_translator (struct case_map *map, - struct casewriter *subwriter) + struct casewriter *subwriter) { return casewriter_create_translator (subwriter, case_map_get_proto (map), diff --git a/src/data/case.c b/src/data/case.c index bb6f7c0a8e..fe569de200 100644 --- a/src/data/case.c +++ b/src/data/case.c @@ -405,7 +405,7 @@ case_compare_2dict (const struct ccase *ca, const struct ccase *cb, const union value *va = case_data (ca, *vap); const union value *vb = case_data (cb, *vbp); assert (var_get_width (*vap) == var_get_width (*vbp)); - cmp = value_compare_3way (va, vb, var_get_width (*vap)); + cmp = value_compare_3way (va, vb, var_get_width (*vap)); } return cmp; } diff --git a/src/data/casegrouper.c b/src/data/casegrouper.c index 48560bb6a5..eb8d65deee 100644 --- a/src/data/casegrouper.c +++ b/src/data/casegrouper.c @@ -177,12 +177,12 @@ casegrouper_create_vars (struct casereader *reader, const struct variable *const *vars, size_t var_cnt) { - if (var_cnt > 0) + if (var_cnt > 0) { struct subcase *sc = xmalloc (sizeof *sc); subcase_init_vars (sc, vars, var_cnt); return casegrouper_create_func (reader, casegrouper_vars_same_group, - casegrouper_vars_destroy, sc); + casegrouper_vars_destroy, sc); } else return casegrouper_create_func (reader, NULL, NULL, NULL); @@ -215,12 +215,12 @@ struct casegrouper * casegrouper_create_subcase (struct casereader *reader, const struct subcase *sc) { - if (subcase_get_n_fields (sc) > 0) + if (subcase_get_n_fields (sc) > 0) { struct subcase *sc_copy = xmalloc (sizeof *sc); subcase_clone (sc_copy, sc); return casegrouper_create_func (reader, casegrouper_vars_same_group, - casegrouper_vars_destroy, sc_copy); + casegrouper_vars_destroy, sc_copy); } else return casegrouper_create_func (reader, NULL, NULL, NULL); @@ -240,9 +240,9 @@ static void casegrouper_vars_destroy (void *sc_) { struct subcase *sc = sc_; - if (sc != NULL) + if (sc != NULL) { subcase_destroy (sc); - free (sc); + free (sc); } } diff --git a/src/data/casereader-translator.c b/src/data/casereader-translator.c index 062184691d..f0411d1fa1 100644 --- a/src/data/casereader-translator.c +++ b/src/data/casereader-translator.c @@ -499,7 +499,7 @@ uniquify (const struct ccase *c, void *aux) if ( NULL == next_case) goto end; - + dir = value_compare_3way (case_data (next_case, cdr->key), current_value, key_width); case_unref (next_case); @@ -510,7 +510,7 @@ uniquify (const struct ccase *c, void *aux) cdr->direction = dir; goto end; } - + return false; end: @@ -535,7 +535,7 @@ consolodate_weight (struct ccase *input, void *aux) else { c = case_unshare_and_resize (input, cdr->proto); - case_data_rw_idx (c, caseproto_get_n_widths (cdr->proto) - 1)->f = cdr->prev_cc; + case_data_rw_idx (c, caseproto_get_n_widths (cdr->proto) - 1)->f = cdr->prev_cc; } return c; @@ -556,7 +556,7 @@ uniquify_destroy (void *aux) -/* Returns a new casereader which is based upon INPUT, but which contains a maximum +/* Returns a new casereader which is based upon INPUT, but which contains a maximum of one case for each distinct value of KEY. If WEIGHT is non-null, then the new casereader's values for this variable will be the sum of all values matching KEY. diff --git a/src/data/casereader.c b/src/data/casereader.c index c8050c6cde..41d0ca473a 100644 --- a/src/data/casereader.c +++ b/src/data/casereader.c @@ -107,7 +107,7 @@ casereader_clone (const struct casereader *reader_) { struct casereader *reader = CONST_CAST (struct casereader *, reader_); struct casereader *clone; - if ( reader == NULL ) + if ( reader == NULL ) return NULL; if (reader->class->clone == NULL) diff --git a/src/data/data-in.h b/src/data/data-in.h index 452b1421d7..7434905259 100644 --- a/src/data/data-in.h +++ b/src/data/data-in.h @@ -25,7 +25,7 @@ union value; struct dictionary; char *data_in (struct substring input, const char *input_encoding, - enum fmt_type, + enum fmt_type, union value *output, int width, const char *output_encoding); bool data_in_msg (struct substring input, const char *input_encoding, diff --git a/src/data/dictionary.c b/src/data/dictionary.c index e50397a156..6dd1b99f87 100644 --- a/src/data/dictionary.c +++ b/src/data/dictionary.c @@ -1572,7 +1572,7 @@ dict_unset_mrset_var (struct dictionary *dict, struct variable *var) calling dict_set_attributes for D will also destroy D's attribute set. */ struct attrset * -dict_get_attributes (const struct dictionary *d) +dict_get_attributes (const struct dictionary *d) { return CONST_CAST (struct attrset *, &d->attributes); } @@ -1588,7 +1588,7 @@ dict_set_attributes (struct dictionary *d, const struct attrset *attrs) /* Returns true if D has at least one attribute in its attribute set, false if D's attribute set is empty. */ bool -dict_has_attributes (const struct dictionary *d) +dict_has_attributes (const struct dictionary *d) { return attrset_count (&d->attributes) > 0; } diff --git a/src/data/file-handle-def.c b/src/data/file-handle-def.c index f058a00752..4c4820cb12 100644 --- a/src/data/file-handle-def.c +++ b/src/data/file-handle-def.c @@ -522,7 +522,7 @@ fh_lock (struct file_handle *h, enum fh_referent mask UNUSED, return NULL; } lock->open_cnt++; - + free_key (key); free (key); @@ -709,7 +709,7 @@ fh_get_identity (const struct file_handle *fh) struct file_identity *identity = xmalloc (sizeof *identity); const char *file_name = fh_get_file_name (fh); - + #if !(defined _WIN32 || defined __WIN32__) struct stat s; if (lstat (file_name, &s) == 0) @@ -761,7 +761,7 @@ fh_get_identity (const struct file_handle *fh) size_t bufsize; size_t pathlen = 255; char *cname = NULL; - do + do { bufsize = pathlen; cname = xrealloc (cname, bufsize); diff --git a/src/data/file-name.c b/src/data/file-name.c index 1c47b4751b..afc99a8825 100644 --- a/src/data/file-name.c +++ b/src/data/file-name.c @@ -101,7 +101,7 @@ fn_search_path (const char *base_name, char **path) struct stat temp; if (( (stat (file, &temp) == 0 ) && ( ! S_ISDIR (temp.st_mode) ))) return file; - + free (file); } @@ -199,9 +199,9 @@ fn_open (const struct file_handle *fh, const char *mode) free (ss); return fp; } -#else +#else return fopen (fn, mode); -#endif +#endif } /* Counterpart to fn_open that closes file F with name FN; returns 0 diff --git a/src/data/gnumeric-reader.c b/src/data/gnumeric-reader.c index abbbceb727..0ef8e4e14e 100644 --- a/src/data/gnumeric-reader.c +++ b/src/data/gnumeric-reader.c @@ -147,7 +147,7 @@ struct sheet_detail int maxrow; }; -struct state_data +struct state_data { /* The libxml reader for this instance */ xmlTextReaderPtr xtr; @@ -183,7 +183,7 @@ struct gnumeric_reader int stop_col; int start_row; int stop_row; - + struct sheet_detail *sheets; const xmlChar *target_sheet; @@ -231,7 +231,7 @@ gnumeric_get_sheet_name (struct spreadsheet *s, int n) struct gnumeric_reader *gr = (struct gnumeric_reader *) s; assert (n < s->n_sheets); - return gr->sheets[n].name; + return gr->sheets[n].name; } @@ -244,12 +244,12 @@ gnumeric_get_sheet_range (struct spreadsheet *s, int n) { int ret; struct gnumeric_reader *gr = (struct gnumeric_reader *) s; - + assert (n < s->n_sheets); - while ( + while ( (gr->sheets[n].stop_col == -1) - && + && (1 == (ret = xmlTextReaderRead (gr->msd.xtr))) ) { @@ -277,7 +277,7 @@ gnm_file_casereader_destroy (struct casereader *reader UNUSED, void *r_) if (r->first_case && ! r->used_first_case ) case_unref (r->first_case); - if (r->proto) + if (r->proto) caseproto_unref (r->proto); gnumeric_unref (&r->spreadsheet); @@ -511,13 +511,13 @@ convert_xml_string_to_value (struct ccase *c, const struct variable *var, v, var_get_width (var), "UTF-8"); - + if (m) { char buf [FMT_STRING_LEN_MAX + 1]; char *cell = create_cell_ref (col, row); - - msg (MW, _("Cannot convert the value in the spreadsheet cell %s to format (%s): %s"), + + msg (MW, _("Cannot convert the value in the spreadsheet cell %s to format (%s): %s"), cell, fmt_to_string (fmt, buf), m); free (cell); } @@ -539,7 +539,7 @@ gnumeric_error_handler (void *ctx, const char *mesg, UNUSED xmlParserSeverities sev, xmlTextReaderLocatorPtr loc) { struct gnumeric_reader *r = ctx; - + msg (MW, _("There was a problem whilst reading the %s file `%s' (near line %d): `%s'"), "Gnumeric", r->spreadsheet.file_name, @@ -549,7 +549,7 @@ gnumeric_error_handler (void *ctx, const char *mesg, static struct gnumeric_reader * gnumeric_reopen (struct gnumeric_reader *r, const char *filename, bool show_errors) -{ +{ int ret = -1; struct state_data *sd; @@ -593,8 +593,8 @@ gnumeric_reopen (struct gnumeric_reader *r, const char *filename, bool show_erro { sd = &r->rsd; } - - if (show_errors) + + if (show_errors) xmlTextReaderSetErrorHandler (xtr, gnumeric_error_handler, r); r->target_sheet = NULL; @@ -633,7 +633,7 @@ gnumeric_reopen (struct gnumeric_reader *r, const char *filename, bool show_erro if ( XML_CHAR_ENCODING_UTF8 != xce) { - /* I have been told that ALL gnumeric files are UTF8 encoded. If that is correct, this + /* I have been told that ALL gnumeric files are UTF8 encoded. If that is correct, this can never happen. */ msg (MW, _("The gnumeric file `%s' is encoded as %s instead of the usual UTF-8 encoding. " "Any non-ascii characters will be incorrectly imported."), @@ -749,13 +749,13 @@ gnumeric_make_reader (struct spreadsheet *spreadsheet, process_node (r, &r->rsd); - if ( r->rsd.row > r->start_row ) + if ( r->rsd.row > r->start_row ) { xmlChar *attr = xmlTextReaderGetAttribute (r->rsd.xtr, _xml ("ValueType")); - + r->vtype = _xmlchar_to_int (attr); - + xmlFree (attr); break; } @@ -869,9 +869,9 @@ gnumeric_make_reader (struct spreadsheet *spreadsheet, continue; var = dict_get_var (r->dict, x++); - + convert_xml_string_to_value (r->first_case, var, - var_spec[i].first_value, + var_spec[i].first_value, var_spec[i].first_type, r->rsd.col + i - 1, r->rsd.row - 1); @@ -884,7 +884,7 @@ gnumeric_make_reader (struct spreadsheet *spreadsheet, } free (var_spec); - + return casereader_create_sequential (NULL, @@ -964,7 +964,7 @@ gnm_file_casereader_read (struct casereader *reader UNUSED, void *r_) const int idx = r->rsd.col - r->start_col; const struct variable *var = dict_get_var (r->dict, idx); - convert_xml_string_to_value (c, var, value, r->vtype, + convert_xml_string_to_value (c, var, value, r->vtype, r->rsd.col, r->rsd.row); xmlFree (value); diff --git a/src/data/make-file.c b/src/data/make-file.c index 3cbf00623d..78875746f2 100644 --- a/src/data/make-file.c +++ b/src/data/make-file.c @@ -148,7 +148,7 @@ Trename (TCHAR const *src, TCHAR const *dst) return -1; } -TCHAR * +TCHAR * convert_to_filename_encoding (const char *s, size_t len, const char *current_encoding) { const char *enc = current_encoding; @@ -166,10 +166,10 @@ convert_to_filename_encoding (const char *s, size_t len, const char *current_enc #define Topen open #define Tstat stat -TCHAR * +TCHAR * convert_to_filename_encoding (const char *s, size_t len UNUSED, const char *current_encoding UNUSED) { - /* Non-windows systems don't care about the encoding. + /* Non-windows systems don't care about the encoding. The string is copied here, to be consistent with the w32 case. */ return xstrdup (s); } @@ -186,7 +186,7 @@ struct replace_file char *tmp_name_verbatim; const char *file_name_verbatim; }; - + static struct ll_list all_files = LL_INITIALIZER (all_files); static void free_replace_file (struct replace_file *); @@ -214,7 +214,7 @@ replace_file_start (const struct file_handle *fh, const char *mode, fd = Topen (Tfile_name, O_WRONLY); if (fd < 0) { - saved_errno = errno; + saved_errno = errno; msg (ME, _("Opening %s for writing: %s."), file_name, strerror (saved_errno)); free (Tfile_name); @@ -225,7 +225,7 @@ replace_file_start (const struct file_handle *fh, const char *mode, *fp = fdopen (fd, mode); if (*fp == NULL) { - saved_errno = errno; + saved_errno = errno; msg (ME, _("Opening stream for %s: %s."), file_name, strerror (saved_errno)); close (fd); diff --git a/src/data/ods-reader.c b/src/data/ods-reader.c index eabdc8f551..736985ea8b 100644 --- a/src/data/ods-reader.c +++ b/src/data/ods-reader.c @@ -155,7 +155,7 @@ struct ods_reader int target_sheet_index; xmlChar *target_sheet_name; - + /* State data for the meta data */ struct state_data msd; @@ -215,7 +215,7 @@ reading_target_sheet (const struct ods_reader *r, const struct state_data *msd) if ( 0 == xmlStrcmp (r->target_sheet_name, msd->current_sheet_name)) return true; } - + if (r->target_sheet_index == msd->current_sheet + 1) return true; @@ -234,7 +234,7 @@ ods_get_sheet_name (struct spreadsheet *s, int n) assert (n < s->n_sheets); - while ( + while ( (r->n_allocated_sheets <= n) || or->state != STATE_SPREADSHEET ) @@ -254,12 +254,12 @@ ods_get_sheet_range (struct spreadsheet *s, int n) { struct ods_reader *r = (struct ods_reader *) s; struct state_data *or = &r->msd; - + assert (n < s->n_sheets); - while ( + while ( (r->n_allocated_sheets <= n) - || (r->sheets[n].stop_row == -1) + || (r->sheets[n].stop_row == -1) || or->state != STATE_SPREADSHEET ) { @@ -333,7 +333,7 @@ process_node (struct ods_reader *or, struct state_data *r) break; case STATE_SPREADSHEET: if (0 == xmlStrcasecmp (name, _xml("table:table")) - && + && (XML_READER_TYPE_ELEMENT == r->node_type)) { xmlFree (r->current_sheet_name); @@ -364,24 +364,24 @@ process_node (struct ods_reader *or, struct state_data *r) } break; case STATE_TABLE: - if (0 == xmlStrcasecmp (name, _xml("table:table-row")) && + if (0 == xmlStrcasecmp (name, _xml("table:table-row")) && (XML_READER_TYPE_ELEMENT == r->node_type)) { xmlChar *value = xmlTextReaderGetAttribute (r->xtr, _xml ("table:number-rows-repeated")); - + int row_span = value ? _xmlchar_to_int (value) : 1; r->row += row_span; r->col = 0; - + if (! xmlTextReaderIsEmptyElement (r->xtr)) r->state = STATE_ROW; xmlFree (value); } - else if (0 == xmlStrcasecmp (name, _xml("table:table")) && + else if (0 == xmlStrcasecmp (name, _xml("table:table")) && (XML_READER_TYPE_END_ELEMENT == r->node_type)) { r->state = STATE_SPREADSHEET; @@ -389,13 +389,13 @@ process_node (struct ods_reader *or, struct state_data *r) break; case STATE_ROW: if ( (0 == xmlStrcasecmp (name, _xml ("table:table-cell"))) - && + && (XML_READER_TYPE_ELEMENT == r->node_type)) { xmlChar *value = xmlTextReaderGetAttribute (r->xtr, _xml ("table:number-columns-repeated")); - + r->col_span = value ? _xmlchar_to_int (value) : 1; r->col += r->col_span; @@ -435,7 +435,7 @@ process_node (struct ods_reader *or, struct state_data *r) if (or->sheets[r->current_sheet].start_row == -1) or->sheets[r->current_sheet].start_row = r->row - 1; - if ( + if ( (or->sheets[r->current_sheet].start_col == -1) || (or->sheets[r->current_sheet].start_col >= r->col - 1) @@ -458,8 +458,8 @@ process_node (struct ods_reader *or, struct state_data *r) xmlFree (name); } -/* - A struct containing the parameters of a cell's value +/* + A struct containing the parameters of a cell's value parsed from the xml */ struct xml_value @@ -541,7 +541,7 @@ convert_xml_to_value (struct ccase *c, const struct variable *var, char buf [FMT_STRING_LEN_MAX + 1]; char *cell = create_cell_ref (col, row); - msg (MW, _("Cannot convert the value in the spreadsheet cell %s to format (%s): %s"), + msg (MW, _("Cannot convert the value in the spreadsheet cell %s to format (%s): %s"), cell, fmt_to_string (fmt, buf), m); free (cell); } @@ -578,12 +578,12 @@ get_sheet_count (struct zip_reader *zreader) int s = _xmlchar_to_int (attr); xmlFreeTextReader (mxtr); xmlFree (name); - xmlFree (attr); + xmlFree (attr); return s; } - xmlFree (attr); + xmlFree (attr); } - xmlFree (name); + xmlFree (name); } xmlFreeTextReader (mxtr); @@ -595,7 +595,7 @@ ods_error_handler (void *ctx, const char *mesg, UNUSED xmlParserSeverities sev, xmlTextReaderLocatorPtr loc) { struct ods_reader *r = ctx; - + msg (MW, _("There was a problem whilst reading the %s file `%s' (near line %d): `%s'"), "ODF", r->spreadsheet.file_name, @@ -624,7 +624,7 @@ init_reader (struct ods_reader *r, bool report_errors) r->spreadsheet.type = SPREADSHEET_ODS; - if (report_errors) + if (report_errors) xmlTextReaderSetErrorHandler (xtr, ods_error_handler, r); return xtr; @@ -637,7 +637,7 @@ ods_probe (const char *filename, bool report_errors) { int sheet_count; struct ods_reader *r = xzalloc (sizeof *r); - xmlTextReaderPtr xtr; + xmlTextReaderPtr xtr; struct zip_reader *zr; ds_init_empty (&r->zip_errs); @@ -688,7 +688,7 @@ ods_probe (const char *filename, bool report_errors) } struct casereader * -ods_make_reader (struct spreadsheet *spreadsheet, +ods_make_reader (struct spreadsheet *spreadsheet, const struct spreadsheet_read_options *opts) { intf ret = 0; @@ -744,7 +744,7 @@ ods_make_reader (struct spreadsheet *spreadsheet, r->target_sheet_index = opts->sheet_index; /* Advance to the start of the cells for the target sheet */ - while ( ! reading_target_sheet (r, &r->rsd) + while ( ! reading_target_sheet (r, &r->rsd) || r->rsd.state != STATE_ROW || r->rsd.row <= r->start_row ) { if (1 != (ret = xmlTextReaderRead (r->rsd.xtr))) @@ -780,7 +780,7 @@ ods_make_reader (struct spreadsheet *spreadsheet, if (r->stop_col != -1 && idx > r->stop_col - r->start_col) continue; - if (r->rsd.state == STATE_CELL_CONTENT + if (r->rsd.state == STATE_CELL_CONTENT && XML_READER_TYPE_TEXT == r->rsd.node_type) { @@ -792,7 +792,7 @@ ods_make_reader (struct spreadsheet *spreadsheet, /* xrealloc (unlike realloc) doesn't initialise its memory to 0 */ memset (var_spec + n_var_specs, - 0, + 0, (idx - n_var_specs + 1) * sizeof (*var_spec)); n_var_specs = idx + 1; } @@ -842,7 +842,7 @@ ods_make_reader (struct spreadsheet *spreadsheet, { var_spec = xrealloc (var_spec, sizeof (*var_spec) * (idx + 1)); memset (var_spec + n_var_specs, - 0, + 0, (idx - n_var_specs + 1) * sizeof (*var_spec)); var_spec [idx].name = NULL; @@ -935,7 +935,7 @@ ods_make_reader (struct spreadsheet *spreadsheet, &ods_file_casereader_class, r); error: - + for ( i = 0 ; i < n_var_specs ; ++i ) { free (var_spec[i].firstval.type); @@ -971,7 +971,7 @@ ods_file_casereader_read (struct casereader *reader UNUSED, void *r_) /* Advance to the start of a row. (If there is one) */ - while (r->rsd.state != STATE_ROW + while (r->rsd.state != STATE_ROW && 1 == xmlTextReaderRead (r->rsd.xtr) ) { @@ -979,7 +979,7 @@ ods_file_casereader_read (struct casereader *reader UNUSED, void *r_) } - if ( ! reading_target_sheet (r, &r->rsd) + if ( ! reading_target_sheet (r, &r->rsd) || r->rsd.state < STATE_TABLE || (r->stop_row != -1 && r->rsd.row > r->stop_row + 1) ) @@ -989,7 +989,7 @@ ods_file_casereader_read (struct casereader *reader UNUSED, void *r_) c = case_create (r->proto); case_set_missing (c); - + while (1 == xmlTextReaderRead (r->rsd.xtr)) { process_node (r, &r->rsd); @@ -1004,13 +1004,13 @@ ods_file_casereader_read (struct casereader *reader UNUSED, void *r_) val_string = xmlTextReaderGetAttribute (r->rsd.xtr, _xml ("office:value")); } - if (r->rsd.state == STATE_CELL_CONTENT && + if (r->rsd.state == STATE_CELL_CONTENT && r->rsd.node_type == XML_READER_TYPE_TEXT) { int col; struct xml_value *xmv = xzalloc (sizeof *xmv); xmv->text = xmlTextReaderValue (r->rsd.xtr); - xmv->value = val_string; + xmv->value = val_string; val_string = NULL; xmv->type = type; type = NULL; @@ -1041,7 +1041,7 @@ ods_file_casereader_read (struct casereader *reader UNUSED, void *r_) xmlFree (type); xmlFree (val_string); - + return c; } #endif diff --git a/src/data/ods-reader.h b/src/data/ods-reader.h index f31304d224..e5751d3e08 100644 --- a/src/data/ods-reader.h +++ b/src/data/ods-reader.h @@ -28,7 +28,7 @@ char * ods_get_sheet_range (struct spreadsheet *s, int n); struct spreadsheet *ods_probe (const char *filename, bool report_errors); -struct casereader * ods_make_reader (struct spreadsheet *spreadsheet, +struct casereader * ods_make_reader (struct spreadsheet *spreadsheet, const struct spreadsheet_read_options *opts); void ods_unref (struct spreadsheet *s); diff --git a/src/data/por-file-writer.c b/src/data/por-file-writer.c index 053b054f6b..4b25d38f31 100644 --- a/src/data/por-file-writer.c +++ b/src/data/por-file-writer.c @@ -327,12 +327,12 @@ write_variables (struct pfm_writer *w, struct dictionary *dict) short_names_assign (dict); - if (dict_get_weight (dict) != NULL) + if (dict_get_weight (dict) != NULL) { buf_write (w, "6", 1); write_string (w, var_get_short_name (dict_get_weight (dict), 0)); } - + buf_write (w, "4", 1); write_int (w, dict_get_var_cnt (dict)); diff --git a/src/data/psql-reader.c b/src/data/psql-reader.c index a8eb91ef7c..d28085f1f4 100644 --- a/src/data/psql-reader.c +++ b/src/data/psql-reader.c @@ -376,11 +376,11 @@ psql_open_reader (struct psql_read_info *info, struct dictionary **dict) int width = 0; int length ; - /* If there are no data then make a finger in the air + /* If there are no data then make a finger in the air guess at the contents */ if ( n_tuples > 0 ) length = PQgetlength (qres, 0, i); - else + else length = PSQL_DEFAULT_WIDTH; switch (type) diff --git a/src/data/settings.c b/src/data/settings.c index 5c4e6899b9..114200cf06 100644 --- a/src/data/settings.c +++ b/src/data/settings.c @@ -374,9 +374,9 @@ settings_get_max_messages (enum msg_severity severity) /* Sets the maximum number of messages to show of the given SEVERITY before aborting to MAX. (The value for MSG_S_WARNING is interpreted as maximum - number of warnings and errors combined.) In addition, in the case of + number of warnings and errors combined.) In addition, in the case of warnings the special value of zero indicates that no warnings are to be - issued. + issued. */ void settings_set_max_messages (enum msg_severity severity, int max) @@ -707,7 +707,7 @@ settings_get_output_routing (enum settings_output_type type) return the_settings.output_routing[type] | SETTINGS_DEVICE_UNFILTERED; } -enum settings_value_style +enum settings_value_style settings_get_value_style (void) { return the_settings.value_output_style; diff --git a/src/data/spreadsheet-reader.c b/src/data/spreadsheet-reader.c index b83dc34602..86dfe48c0c 100644 --- a/src/data/spreadsheet-reader.c +++ b/src/data/spreadsheet-reader.c @@ -41,13 +41,13 @@ static const bool GNM_READING_SUPPORTED = true; static const bool GNM_READING_SUPPORTED = false; #endif -void +void spreadsheet_ref (struct spreadsheet *s) { s->ref_cnt++; } -void +void spreadsheet_unref (struct spreadsheet *s) { switch (s->type) @@ -68,7 +68,7 @@ spreadsheet_unref (struct spreadsheet *s) } -struct casereader * +struct casereader * spreadsheet_make_reader (struct spreadsheet *s, const struct spreadsheet_read_options *opts) { @@ -83,7 +83,7 @@ spreadsheet_make_reader (struct spreadsheet *s, return NULL; } -const char * +const char * spreadsheet_get_sheet_name (struct spreadsheet *s, int n) { if (ODF_READING_SUPPORTED) @@ -98,7 +98,7 @@ spreadsheet_get_sheet_name (struct spreadsheet *s, int n) } -char * +char * spreadsheet_get_sheet_range (struct spreadsheet *s, int n) { if (ODF_READING_SUPPORTED) @@ -174,7 +174,7 @@ int_to_ps26 (int i) while (i > lower + base - 1) { lower += base; - base *= RADIX; + base *= RADIX; assert (base > 0); exp++; } diff --git a/src/data/sys-file-reader.c b/src/data/sys-file-reader.c index a2c0830ce6..b49ccf7856 100644 --- a/src/data/sys-file-reader.c +++ b/src/data/sys-file-reader.c @@ -2308,20 +2308,20 @@ parse_attributes (struct sfm_reader *r, struct text_record *text, text_warn (r, text, _("Error parsing attribute value %s[%d]."), key, index); break; - } + } length = strlen (value); - if (length >= 2 && value[0] == '\'' && value[length - 1] == '\'') + if (length >= 2 && value[0] == '\'' && value[length - 1] == '\'') { value[length - 1] = '\0'; - attribute_add_value (attr, value + 1); + attribute_add_value (attr, value + 1); } - else + else { text_warn (r, text, _("Attribute value %s[%d] is not quoted: %s."), key, index, value); - attribute_add_value (attr, value); + attribute_add_value (attr, value); } /* Was this the last value for this attribute? */ @@ -2995,7 +2995,7 @@ read_variable_to_value_pair (struct sfm_reader *r, struct dictionary *dict, { if (!text_read_short_name (r, dict, text, ss_cstr ("="), var)) return false; - + *value = text_get_token (text, ss_buffer ("\t\0", 2), NULL); if (*value == NULL) return false; @@ -3051,7 +3051,7 @@ static void text_warn (struct sfm_reader *r, struct text_record *text, const char *format, ...) { - if (text->n_warnings++ < MAX_TEXT_WARNINGS) + if (text->n_warnings++ < MAX_TEXT_WARNINGS) { va_list args; @@ -3142,8 +3142,8 @@ text_match (struct text_record *text, char c) { if (text->pos >= text->buffer.length) return false; - - if (text->buffer.string[text->pos] == c) + + if (text->buffer.string[text->pos] == c) { text->pos++; return true; diff --git a/src/data/sys-file-writer.c b/src/data/sys-file-writer.c index 3350a34485..7f0c8c056a 100644 --- a/src/data/sys-file-writer.c +++ b/src/data/sys-file-writer.c @@ -715,14 +715,14 @@ put_attrset (struct string *string, const struct attrset *attrs) struct attrset_iterator i; for (attr = attrset_first (attrs, &i); attr != NULL; - attr = attrset_next (attrs, &i)) + attr = attrset_next (attrs, &i)) { size_t n_values = attribute_get_n_values (attr); size_t j; ds_put_cstr (string, attribute_get_name (attr)); ds_put_byte (string, '('); - for (j = 0; j < n_values; j++) + for (j = 0; j < n_values; j++) ds_put_format (string, "'%s'\n", attribute_get_value (attr, j)); ds_put_byte (string, ')'); } @@ -787,7 +787,7 @@ write_variable_attributes (struct sfm_writer *w, const struct dictionary *d) size_t i; for (i = 0; i < n_vars; i++) - { + { struct variable *v = dict_get_var (d, i); struct attrset attrs; diff --git a/src/data/value-labels.c b/src/data/value-labels.c index c405961f29..1080cdff1d 100644 --- a/src/data/value-labels.c +++ b/src/data/value-labels.c @@ -364,7 +364,7 @@ val_labs_equal (const struct val_labs *a, const struct val_labs *b) if (val_labs_count (a) != val_labs_count (b)) return false; - + if (a == NULL || b == NULL) return true; diff --git a/src/data/variable.c b/src/data/variable.c index 6a00d014a1..3e3c72a6bb 100644 --- a/src/data/variable.c +++ b/src/data/variable.c @@ -461,7 +461,7 @@ var_set_value_labels (struct variable *v, const struct val_labs *vls) { struct variable *ov = var_clone (v); var_set_value_labels_quiet (v, vls); - dict_var_changed (v, VAR_TRAIT_LABEL, ov); + dict_var_changed (v, VAR_TRAIT_LABEL, ov); } @@ -544,7 +544,7 @@ var_append_value_name (const struct variable *v, const union value *value, case SETTINGS_VAL_STYLE_VALUES: append_value (v, value, str); break; - + case SETTINGS_VAL_STYLE_LABELS: if (name == NULL) append_value (v, value, str); @@ -1115,7 +1115,7 @@ var_must_leave (const struct variable *v) all if it hasn't been saved to or read from a system or portable file. */ size_t -var_get_short_name_cnt (const struct variable *var) +var_get_short_name_cnt (const struct variable *var) { return var->short_name_cnt; } @@ -1144,14 +1144,14 @@ var_set_short_name (struct variable *var, size_t idx, const char *short_name) assert (short_name == NULL || id_is_plausible (short_name, false)); /* Clear old short name numbered IDX, if any. */ - if (idx < var->short_name_cnt) + if (idx < var->short_name_cnt) { free (var->short_names[idx]); - var->short_names[idx] = NULL; + var->short_names[idx] = NULL; } /* Install new short name for IDX. */ - if (short_name != NULL) + if (short_name != NULL) { if (idx >= var->short_name_cnt) { @@ -1210,14 +1210,14 @@ var_get_case_index (const struct variable *v) V, or calling var_set_attributes() on V, will also destroy its attribute set. */ struct attrset * -var_get_attributes (const struct variable *v) +var_get_attributes (const struct variable *v) { return CONST_CAST (struct attrset *, &v->attributes); } /* Replaces variable V's attributes set by a copy of ATTRS. */ static void -var_set_attributes_quiet (struct variable *v, const struct attrset *attrs) +var_set_attributes_quiet (struct variable *v, const struct attrset *attrs) { attrset_destroy (&v->attributes); attrset_clone (&v->attributes, attrs); @@ -1225,7 +1225,7 @@ var_set_attributes_quiet (struct variable *v, const struct attrset *attrs) /* Replaces variable V's attributes set by a copy of ATTRS. */ void -var_set_attributes (struct variable *v, const struct attrset *attrs) +var_set_attributes (struct variable *v, const struct attrset *attrs) { struct variable *ov = var_clone (v); var_set_attributes_quiet (v, attrs); @@ -1317,8 +1317,8 @@ var_clear_vardict (struct variable *v) /* Returns zero, if W is a missing value for WV or if it is less than zero. Typically used to force a numerical value into a valid weight. - - As a side effect, this function will emit a warning if the value + + As a side effect, this function will emit a warning if the value WARN_ON_INVALID points to a bool which is TRUE. That bool will be then set to FALSE. */ @@ -1327,7 +1327,7 @@ var_force_valid_weight (const struct variable *wv, double w, bool *warn_on_inval { if (w < 0.0 || (wv && var_is_num_missing (wv, w, MV_ANY))) w = 0.0; - + if (w == 0.0 && warn_on_invalid != NULL && *warn_on_invalid) { *warn_on_invalid = false; diff --git a/src/language/command.c b/src/language/command.c index 7887591131..8f955b3e49 100644 --- a/src/language/command.c +++ b/src/language/command.c @@ -413,7 +413,7 @@ report_state_mismatch (const struct command *command, enum cmd_state state) command->name, "FILE TYPE"); break; case S_INPUT_PROGRAM | S_FILE_TYPE: - msg (SE, _("%s is allowed only inside %s or inside %s."), command->name, + msg (SE, _("%s is allowed only inside %s or inside %s."), command->name, "INPUT PROGRAM", "FILE TYPE"); break; diff --git a/src/language/data-io/data-list.c b/src/language/data-io/data-list.c index 31f51bca3c..461289bc60 100644 --- a/src/language/data-io/data-list.c +++ b/src/language/data-io/data-list.c @@ -122,7 +122,7 @@ cmd_data_list (struct lexer *lexer, struct dataset *ds) lex_match (lexer, T_LPAREN); if (!lex_force_int (lexer)) goto error; - + int records = lex_integer (lexer); if (records < 0) { diff --git a/src/language/data-io/get-data.c b/src/language/data-io/get-data.c index 061fde1c03..e34b86bc1a 100644 --- a/src/language/data-io/get-data.c +++ b/src/language/data-io/get-data.c @@ -59,7 +59,7 @@ cmd_get_data (struct lexer *lexer, struct dataset *ds) { char *tok = NULL; struct spreadsheet_read_options opts; - + opts.sheet_name = NULL; opts.sheet_index = -1; opts.cell_range = NULL; @@ -79,7 +79,7 @@ cmd_get_data (struct lexer *lexer, struct dataset *ds) if (s) tok = strdup (s); - + if (lex_match_id (lexer, "TXT")) { free (tok); @@ -90,7 +90,7 @@ cmd_get_data (struct lexer *lexer, struct dataset *ds) free (tok); return parse_get_psql (lexer, ds); } - else if (lex_match_id (lexer, "GNM") || + else if (lex_match_id (lexer, "GNM") || lex_match_id (lexer, "ODS")) { char *filename = NULL; @@ -218,7 +218,7 @@ parse_get_psql (struct lexer *lexer, struct dataset *ds) } static bool -parse_spreadsheet (struct lexer *lexer, char **filename, +parse_spreadsheet (struct lexer *lexer, char **filename, struct spreadsheet_read_options *opts) { opts->sheet_index = 1; @@ -688,7 +688,7 @@ parse_get_txt (struct lexer *lexer, struct dataset *ds) } -static void +static void destroy_spreadsheet_read_info (struct spreadsheet_read_options *opts) { free (opts->cell_range); diff --git a/src/language/data-io/list.c b/src/language/data-io/list.c index 79ba5280b1..55ccc4d2da 100644 --- a/src/language/data-io/list.c +++ b/src/language/data-io/list.c @@ -214,7 +214,7 @@ cmd_list (struct lexer *lexer, struct dataset *ds) return CMD_FAILURE; } } - + /* Verify arguments. */ if (cmd.first > cmd.last) diff --git a/src/language/dictionary/apply-dictionary.c b/src/language/dictionary/apply-dictionary.c index f419febcb4..8a6434a3d7 100644 --- a/src/language/dictionary/apply-dictionary.c +++ b/src/language/dictionary/apply-dictionary.c @@ -102,7 +102,7 @@ cmd_apply_dictionary (struct lexer *lexer, struct dataset *ds) var_set_write_format (t, var_get_write_format (s)); } - if (var_has_attributes (s)) + if (var_has_attributes (s)) var_set_attributes (t, var_get_attributes (s)); } diff --git a/src/language/dictionary/attributes.c b/src/language/dictionary/attributes.c index fc9cc9a5d2..2f1d6906b9 100644 --- a/src/language/dictionary/attributes.c +++ b/src/language/dictionary/attributes.c @@ -52,7 +52,7 @@ cmd_variable_attribute (struct lexer *lexer, struct dataset *ds) struct dictionary *dict = dataset_dict (ds); const char *dict_encoding = dict_get_encoding (dict); - do + do { struct variable **vars; struct attrset **sets; @@ -120,7 +120,7 @@ error: static bool add_attribute (struct lexer *lexer, const char *dict_encoding, - struct attrset **sets, size_t n) + struct attrset **sets, size_t n) { const char *value; size_t index, i; @@ -139,10 +139,10 @@ add_attribute (struct lexer *lexer, const char *dict_encoding, for (i = 0; i < n; i++) { struct attribute *attr = attrset_lookup (sets[i], name); - if (attr == NULL) + if (attr == NULL) { attr = attribute_create (name); - attrset_add (sets[i], attr); + attrset_add (sets[i], attr); } attribute_set_value (attr, index ? index - 1 : 0, value); } @@ -154,7 +154,7 @@ add_attribute (struct lexer *lexer, const char *dict_encoding, static bool delete_attribute (struct lexer *lexer, const char *dict_encoding, - struct attrset **sets, size_t n) + struct attrset **sets, size_t n) { size_t index, i; char *name; @@ -163,7 +163,7 @@ delete_attribute (struct lexer *lexer, const char *dict_encoding, if (name == NULL) return false; - for (i = 0; i < n; i++) + for (i = 0; i < n; i++) { struct attrset *set = sets[i]; if (index == 0) @@ -171,11 +171,11 @@ delete_attribute (struct lexer *lexer, const char *dict_encoding, else { struct attribute *attr = attrset_lookup (set, name); - if (attr != NULL) + if (attr != NULL) { attribute_del_value (attr, index - 1); if (attribute_get_n_values (attr) == 0) - attrset_delete (set, name); + attrset_delete (set, name); } } } @@ -186,10 +186,10 @@ delete_attribute (struct lexer *lexer, const char *dict_encoding, static enum cmd_result parse_attributes (struct lexer *lexer, const char *dict_encoding, - struct attrset **sets, size_t n) + struct attrset **sets, size_t n) { enum { UNKNOWN, ADD, DELETE } command = UNKNOWN; - do + do { if (lex_match_phrase (lexer, "ATTRIBUTE=")) command = ADD; diff --git a/src/language/dictionary/delete-variables.c b/src/language/dictionary/delete-variables.c index 770ca3f3e1..bf6006a86c 100644 --- a/src/language/dictionary/delete-variables.c +++ b/src/language/dictionary/delete-variables.c @@ -38,7 +38,7 @@ cmd_delete_variables (struct lexer *lexer, struct dataset *ds) if (proc_make_temporary_transformations_permanent (ds)) msg (SE, _("%s may not be used after %s. " - "Temporary transformations will be made permanent."), + "Temporary transformations will be made permanent."), "DELETE VARIABLES", "TEMPORARY"); if (!parse_variables (lexer, dataset_dict (ds), &vars, &var_cnt, PV_NONE)) diff --git a/src/language/dictionary/split-file.c b/src/language/dictionary/split-file.c index 28e6860e07..34949c5d15 100644 --- a/src/language/dictionary/split-file.c +++ b/src/language/dictionary/split-file.c @@ -97,7 +97,7 @@ output_split_file_values (const struct dataset *ds, const struct ccase *c) tab_text_format (t, 1, i + 1, 0, "%.*s", print->w, s); free (s); - + val_lab = var_lookup_value_label (v, case_data (c, v)); if (val_lab) tab_text (t, 2, i + 1, TAB_LEFT, val_lab); diff --git a/src/language/dictionary/sys-file-info.c b/src/language/dictionary/sys-file-info.c index 92ade932ef..82a6fea780 100644 --- a/src/language/dictionary/sys-file-info.c +++ b/src/language/dictionary/sys-file-info.c @@ -56,7 +56,7 @@ #define _(msgid) gettext (msgid) /* Information to include in displaying a dictionary. */ -enum +enum { DF_DICT_INDEX = 1 << 0, DF_FORMATS = 1 << 1, @@ -154,7 +154,7 @@ cmd_sysfile_info (struct lexer *lexer, struct dataset *ds UNUSED) fh_unref (h); pool_destroy (pool); free (encoding); - + return CMD_SUCCESS; } @@ -307,19 +307,19 @@ cmd_display (struct lexer *lexer, struct dataset *ds) display_vectors (dataset_dict(ds), sorted); return CMD_SUCCESS; } - else if (lex_match_id (lexer, "SCRATCH")) + else if (lex_match_id (lexer, "SCRATCH")) { dict_get_vars (dataset_dict (ds), &vl, &n, DC_ORDINARY); flags = 0; } - else + else { - struct subcommand + struct subcommand { const char *name; int flags; }; - static const struct subcommand subcommands[] = + static const struct subcommand subcommands[] = { {"@ATTRIBUTES", DF_ATTRIBUTES | DF_AT_ATTRIBUTES}, {"ATTRIBUTES", DF_ATTRIBUTES}, @@ -359,7 +359,7 @@ cmd_display (struct lexer *lexer, struct dataset *ds) dict_get_vars (dict, &vl, &n, 0); } - if (n > 0) + if (n > 0) { sort (vl, n, sizeof *vl, (sorted @@ -438,7 +438,7 @@ display_variables (const struct variable **vl, size_t n, int flags) tab_headers (t, 0, 0, 1, 0); tab_hline (t, TAL_2, 0, nc - 1, 1); tab_text (t, 0, 0, TAB_LEFT | TAT_TITLE, _("Variable")); - if (flags & ~DF_DICT_INDEX) + if (flags & ~DF_DICT_INDEX) tab_text (t, 1, 0, TAB_LEFT | TAT_TITLE, (flags & ~(DF_DICT_INDEX | DF_VARIABLE_LABELS) ? _("Description") : _("Label"))); @@ -454,21 +454,21 @@ display_variables (const struct variable **vl, size_t n, int flags) } static bool -is_at_name (const char *name) +is_at_name (const char *name) { return name[0] == '@' || (name[0] == '$' && name[1] == '@'); } static size_t -count_attributes (const struct attrset *set, int flags) +count_attributes (const struct attrset *set, int flags) { struct attrset_iterator i; struct attribute *attr; size_t n_attrs; - + n_attrs = 0; for (attr = attrset_first (set, &i); attr != NULL; - attr = attrset_next (set, &i)) + attr = attrset_next (set, &i)) if (flags & DF_AT_ATTRIBUTES || !is_at_name (attribute_get_name (attr))) n_attrs += attribute_get_n_values (attr); return n_attrs; @@ -519,7 +519,7 @@ describe_attributes (const struct attrset *set, int flags) } static void -display_data_file_attributes (struct attrset *set, int flags) +display_data_file_attributes (struct attrset *set, int flags) { if (count_attributes (set, flags)) table_item_submit (table_item_create (describe_attributes (set, flags), @@ -576,7 +576,7 @@ describe_variable_details (const struct variable *v, int flags) } /* Print/write format, or print and write formats. */ - if (flags & DF_FORMATS) + if (flags & DF_FORMATS) { const struct fmt_spec *print = var_get_print_format (v); const struct fmt_spec *write = var_get_write_format (v); diff --git a/src/language/expressions/evaluate.c b/src/language/expressions/evaluate.c index bd3f46def3..07621a84b8 100644 --- a/src/language/expressions/evaluate.c +++ b/src/language/expressions/evaluate.c @@ -181,7 +181,7 @@ cmd_debug_evaluate (struct lexer *lexer, struct dataset *dsother UNUSED) else break; } - + if (!lex_force_match (lexer, T_SLASH)) goto done; diff --git a/src/language/lexer/lexer.c b/src/language/lexer/lexer.c index 08d35d8c00..5c61c8def4 100644 --- a/src/language/lexer/lexer.c +++ b/src/language/lexer/lexer.c @@ -613,7 +613,7 @@ lex_force_match (struct lexer *lexer, enum token_type type) } else lex_error_expecting (lexer, token_type_to_name (type), NULL_SENTINEL); - + return false; } } diff --git a/src/language/lexer/variable-parser.c b/src/language/lexer/variable-parser.c index 390b98dae3..d160b6f979 100644 --- a/src/language/lexer/variable-parser.c +++ b/src/language/lexer/variable-parser.c @@ -635,7 +635,7 @@ parse_mixed_vars (struct lexer *lexer, const struct dictionary *dict, } if (*nnames == 0) goto fail; - + return true; fail: @@ -924,7 +924,7 @@ parse_internal_interaction (struct lexer *lexer, const struct dictionary *dict, *iact = NULL; return false; } - + assert (v); if ( *iact == NULL) diff --git a/src/language/stats/autorecode.c b/src/language/stats/autorecode.c index d3c5864c22..f6ea462416 100644 --- a/src/language/stats/autorecode.c +++ b/src/language/stats/autorecode.c @@ -257,7 +257,7 @@ cmd_autorecode (struct lexer *lexer, struct dataset *ds) item = find_arc_item (spec, value, hash); if ( (item == NULL) - && + && ( arc->blank_valid || val_type_from_width (spec->width) == VAL_NUMERIC || ! value_is_blank (value, width, dict)) @@ -312,7 +312,7 @@ cmd_autorecode (struct lexer *lexer, struct dataset *ds) value_init (&to_val, 0); items[j]->to = direction == ASCENDING ? j + 1 : n_items - j; - + to_val.f = items[j]->to; /* Add value labels to the destination variable which indicate @@ -326,7 +326,7 @@ cmd_autorecode (struct lexer *lexer, struct dataset *ds) } else recoded_value = c_xasprintf ("%.*g", DBL_DIG + 1, from->f); - + /* Remove trailing whitespace */ len = strlen (recoded_value); while (len > 0 && recoded_value[len - 1] == ' ') @@ -382,7 +382,7 @@ arc_free (struct autorecode_pgm *arc) for (i = 0; i < arc->n_specs; i++) { struct arc_spec *spec = &arc->specs[i]; - + if (--spec->items->refcnt == 0) { hmap_destroy (&spec->items->ht); @@ -395,7 +395,7 @@ arc_free (struct autorecode_pgm *arc) hmap_destroy (&arc->global_items->ht); free (arc->global_items); } - + free (arc->specs); free (arc); } diff --git a/src/language/stats/chart-category.h b/src/language/stats/chart-category.h index afe88b9ac5..8693920444 100644 --- a/src/language/stats/chart-category.h +++ b/src/language/stats/chart-category.h @@ -5,7 +5,7 @@ struct ag_func { const char *name; const char *description; - + int arity; bool cumulative; double (*pre) (void); diff --git a/src/language/stats/cochran.c b/src/language/stats/cochran.c index 4274a583de..cea9a054bb 100644 --- a/src/language/stats/cochran.c +++ b/src/language/stats/cochran.c @@ -115,7 +115,7 @@ cochran_execute (const struct dataset *ds, rowsq += pow2 (case_hits); } casereader_destroy (input); - + { double c_l = 0; double c_l2 = 0; @@ -130,7 +130,7 @@ cochran_execute (const struct dataset *ds, ch.q *= ct->n_vars - 1; ch.q /= ct->n_vars * c_l - rowsq; - + ch.df = ct->n_vars - 1; } @@ -233,17 +233,17 @@ show_sig_box (const struct cochran *ch) tab_hline (table, TAL_2, 0, tab_nc (table) -1, column_headers); tab_vline (table, TAL_2, row_headers, 0, tab_nr (table) - 1); - tab_double (table, 1, column_headers, + tab_double (table, 1, column_headers, 0, ch->cc, NULL, RC_WEIGHT); - tab_double (table, 1, column_headers + 1, + tab_double (table, 1, column_headers + 1, 0, ch->q, NULL, RC_OTHER); - tab_double (table, 1, column_headers + 2, + tab_double (table, 1, column_headers + 2, 0, ch->df, NULL, RC_INTEGER); - tab_double (table, 1, column_headers + 3, - 0, gsl_cdf_chisq_Q (ch->q, ch->df), + tab_double (table, 1, column_headers + 3, + 0, gsl_cdf_chisq_Q (ch->q, ch->df), NULL, RC_PVALUE); tab_submit (table); diff --git a/src/language/stats/correlations.c b/src/language/stats/correlations.c index ebfea2583e..e2d158dacb 100644 --- a/src/language/stats/correlations.c +++ b/src/language/stats/correlations.c @@ -145,10 +145,10 @@ output_descriptives (const struct corr *corr, const gsl_matrix *means, case 3: x = gsl_matrix_get (ns, r, 0); break; - default: + default: NOT_REACHED (); }; - + tab_double (t, c, r + heading_rows, 0, x, NULL, RC_OTHER); } } @@ -214,11 +214,11 @@ output_correlation (const struct corr *corr, const struct corr_opts *opts, /* Row Headers */ for (r = 0 ; r < corr->n_vars1 ; ++r) { - tab_text (t, 0, 1 + r * rows_per_variable, TAB_LEFT | TAT_TITLE, + tab_text (t, 0, 1 + r * rows_per_variable, TAB_LEFT | TAT_TITLE, var_to_string (corr->vars[r])); tab_text (t, 1, 1 + r * rows_per_variable, TAB_LEFT | TAT_TITLE, _("Pearson Correlation")); - tab_text (t, 1, 2 + r * rows_per_variable, TAB_LEFT | TAT_TITLE, + tab_text (t, 1, 2 + r * rows_per_variable, TAB_LEFT | TAT_TITLE, (opts->tails == 2) ? _("Sig. (2-tailed)") : _("Sig. (1-tailed)")); if (opts->statistics & STATS_XPROD) @@ -238,7 +238,7 @@ output_correlation (const struct corr *corr, const struct corr_opts *opts, { const struct variable *v = corr->n_vars_total > corr->n_vars1 ? corr->vars[corr->n_vars1 + c] : corr->vars[c]; - tab_text (t, heading_columns + c, 0, TAB_LEFT | TAT_TITLE, var_to_string (v)); + tab_text (t, heading_columns + c, 0, TAB_LEFT | TAT_TITLE, var_to_string (v)); } for (r = 0 ; r < corr->n_vars1 ; ++r) @@ -246,9 +246,9 @@ output_correlation (const struct corr *corr, const struct corr_opts *opts, const int row = r * rows_per_variable + heading_rows; for (c = 0 ; c < matrix_cols ; ++c) { - unsigned char flags = 0; - const int col_index = corr->n_vars_total > corr->n_vars1 ? - corr->n_vars1 + c : + unsigned char flags = 0; + const int col_index = corr->n_vars_total > corr->n_vars1 ? + corr->n_vars1 + c : c; double pearson = gsl_matrix_get (cm, r, col_index); double w = gsl_matrix_get (samples, r, col_index); @@ -262,7 +262,7 @@ output_correlation (const struct corr *corr, const struct corr_opts *opts, if ( opts->sig && col_index != r && sig < 0.05) flags = TAB_EMPH; - + tab_double (t, c + heading_columns, row, flags, pearson, NULL, RC_OTHER); if (opts->statistics & STATS_XPROD) @@ -303,21 +303,21 @@ run_corr (struct casereader *r, const struct corr_opts *opts, const struct corr covariance_accumulate_pass2 (cov, c); } casereader_destroy (rc); - + cov_matrix = covariance_calculate (cov); if (! cov_matrix) { msg (SE, _("The data for the chosen variables are all missing or empty.")); goto error; } - + samples_matrix = covariance_moments (cov, MOMENT_NONE); var_matrix = covariance_moments (cov, MOMENT_VARIANCE); mean_matrix = covariance_moments (cov, MOMENT_MEAN); corr_matrix = correlation_from_covariance (cov_matrix, var_matrix); - if ( opts->statistics & STATS_DESCRIPTIVES) + if ( opts->statistics & STATS_DESCRIPTIVES) output_descriptives (corr, mean_matrix, var_matrix, samples_matrix); output_correlation (corr, opts, corr_matrix, @@ -414,7 +414,7 @@ cmd_correlation (struct lexer *lexer, struct dataset *ds) opts.statistics = STATS_ALL; lex_get (lexer); } - else + else { lex_error (lexer, NULL); goto error; @@ -432,8 +432,8 @@ cmd_correlation (struct lexer *lexer, struct dataset *ds) corr = xrealloc (corr, sizeof (*corr) * (n_corrs + 1)); corr[n_corrs].n_vars_total = corr[n_corrs].n_vars1 = 0; - - if ( ! parse_variables_const (lexer, dict, &corr[n_corrs].vars, + + if ( ! parse_variables_const (lexer, dict, &corr[n_corrs].vars, &corr[n_corrs].n_vars_total, PV_NUMERIC)) { diff --git a/src/language/stats/crosstabs.q b/src/language/stats/crosstabs.q index 6e87c0260b..08a182a456 100644 --- a/src/language/stats/crosstabs.q +++ b/src/language/stats/crosstabs.q @@ -427,7 +427,7 @@ crs_custom_tables (struct lexer *lexer, struct dataset *ds, } nx *= by_nvar[n_by]; n_by++; - + if (!lex_match (lexer, T_BY)) { if (n_by < 2) @@ -759,7 +759,7 @@ postcalc (struct crosstabs_proc *proc) } } if (proc->barchart) - chart_item_submit + chart_item_submit (barchart_create (pt->vars, pt->n_vars, _("Count"), false, pt->entries, pt->n_entries)); } @@ -2672,7 +2672,7 @@ calc_symmetric (struct crosstabs_proc *proc, struct pivot_table *pt, + sum_rici * sum_rici - pt->total * sum_riciri_ci) / (pt->total * (pow2 (pt->total) - sum_rici) * (pow2 (pt->total) - sum_rici))); - + ase[8] = sqrt (pt->total * (((sum_fii * (pt->total - sum_fii)) / pow2 (pow2 (pt->total) - sum_rici)) + ((2. * (pt->total - sum_fii) diff --git a/src/language/stats/examine.c b/src/language/stats/examine.c index cfe380d5b5..b8c518c60b 100644 --- a/src/language/stats/examine.c +++ b/src/language/stats/examine.c @@ -1,7 +1,7 @@ /* PSPP - a program for statistical analysis. Copyright (C) 2012, 2013, 2016 Free Software Foundation, Inc. - + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or @@ -11,7 +11,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -66,7 +66,7 @@ #define _(msgid) gettext (msgid) #define N_(msgid) msgid -static void +static void append_value_name (const struct variable *var, const union value *val, struct string *str) { var_append_value_name (var, val, str); @@ -127,7 +127,7 @@ struct examine enum pc_alg pc_alg; double *ptiles; size_t n_percentiles; - + bool npplot; bool histogramplot; bool boxplot; @@ -165,7 +165,7 @@ struct exploratory_stats struct extremity *minima; struct extremity *maxima; - /* + /* Minimum should alway equal mimima[0].val. Likewise, maximum should alway equal maxima[0].val. This redundancy exists as an optimisation effort. @@ -224,7 +224,7 @@ previous_value_record (const struct interaction *iact, const struct ccase *c, co const struct variable *ivar = iact->vars[ivar_idx]; const int width = var_get_width (ivar); const union value *val = case_data (c, ivar); - + if (prev_val[ivar_idx]) if (! value_equal (prev_val[ivar_idx], val, width)) { @@ -237,7 +237,7 @@ previous_value_record (const struct interaction *iact, const struct ccase *c, co { const struct variable *ivar = iact->vars[ivar_idx]; const union value *val = case_data (c, ivar); - + prev_val[ivar_idx] = val; } return diff_idx; @@ -273,7 +273,7 @@ show_boxplot_grouped (const struct examine *cmd, int iact_idx) } else ds_put_format (&title, _("Boxplot of %s"), var_to_string (cmd->dep_vars[v])); - + for (grp = 0; grp < n_cats; ++grp) { const struct exploratory_stats *es = @@ -285,7 +285,7 @@ show_boxplot_grouped (const struct examine *cmd, int iact_idx) if ( y_max < es[v].maximum) y_max = es[v].maximum; } - + boxplot = boxplot_create (y_min, y_max, ds_cstr (&title)); ds_destroy (&title); @@ -324,7 +324,7 @@ show_boxplot_grouped (const struct examine *cmd, int iact_idx) ds_destroy (&label); } - + boxplot_submit (boxplot); } } @@ -372,7 +372,7 @@ show_boxplot_variabled (const struct examine *cmd, int iact_idx) { const struct variable *ivar = iact->vars[ivar_idx]; const union value *val = case_data (c, ivar); - + ds_put_cstr (&label, var_to_string (ivar)); ds_put_cstr (&label, " = "); append_value_name (ivar, val, &label); @@ -394,7 +394,7 @@ show_boxplot_variabled (const struct examine *cmd, int iact_idx) struct exploratory_stats *es = categoricals_get_user_data_by_category_real (cmd->cats, iact_idx, grp); - boxplot_add_box (boxplot, es[v].box_whisker, + boxplot_add_box (boxplot, es[v].box_whisker, var_to_string (cmd->dep_vars[v])); es[v].box_whisker = NULL; } @@ -430,7 +430,7 @@ show_npplot (const struct examine *cmd, int iact_idx) categoricals_get_user_data_by_category_real (cmd->cats, iact_idx, grp); struct string label; - ds_init_cstr (&label, + ds_init_cstr (&label, var_to_string (cmd->dep_vars[v])); if ( iact->n_vars > 0) @@ -440,16 +440,16 @@ show_npplot (const struct examine *cmd, int iact_idx) { const struct variable *ivar = iact->vars[ivar_idx]; const union value *val = case_data (c, ivar); - + ds_put_cstr (&label, var_to_string (ivar)); ds_put_cstr (&label, " = "); append_value_name (ivar, val, &label); ds_put_cstr (&label, "; "); - + } ds_put_cstr (&label, ")"); } - + np = es[v].np; reader = casewriter_make_reader (np->writer); np->writer = NULL; @@ -493,7 +493,7 @@ show_spreadlevel (const struct examine *cmd, int iact_idx) struct chart_item *sl; struct string label; - ds_init_cstr (&label, + ds_init_cstr (&label, var_to_string (cmd->dep_vars[v])); if (iact->n_vars > 0) @@ -502,7 +502,7 @@ show_spreadlevel (const struct examine *cmd, int iact_idx) interaction_to_string (iact, &label); ds_put_cstr (&label, ")"); } - + sl = spreadlevel_plot_create (ds_cstr (&label), cmd->sl_power); for (grp = 0; grp < n_cats; ++grp) @@ -520,7 +520,7 @@ show_spreadlevel (const struct examine *cmd, int iact_idx) if (sl == NULL) msg (MW, _("Not creating spreadlevel chart for %s"), ds_cstr (&label)); - else + else chart_item_submit (sl); ds_destroy (&label); @@ -555,7 +555,7 @@ show_histogram (const struct examine *cmd, int iact_idx) if (es[v].histogram == NULL) continue; - ds_init_cstr (&label, + ds_init_cstr (&label, var_to_string (cmd->dep_vars[v])); if ( iact->n_vars > 0) @@ -565,12 +565,12 @@ show_histogram (const struct examine *cmd, int iact_idx) { const struct variable *ivar = iact->vars[ivar_idx]; const union value *val = case_data (c, ivar); - + ds_put_cstr (&label, var_to_string (ivar)); ds_put_cstr (&label, " = "); append_value_name (ivar, val, &label); ds_put_cstr (&label, "; "); - + } ds_put_cstr (&label, ")"); } @@ -583,7 +583,7 @@ show_histogram (const struct examine *cmd, int iact_idx) ds_cstr (&label), n, mean, sqrt (var), false)); - + ds_destroy (&label); } } @@ -661,7 +661,7 @@ percentiles_report (const struct examine *cmd, int iact_idx) int ivar_idx; if ( v > 0 ) tab_hline (t, TAL_1, 0, nc - 1, heading_rows + v * rows_per_var); - + tab_text (t, 0, heading_rows + v * rows_per_var, TAT_TITLE | TAB_LEFT, @@ -691,18 +691,18 @@ percentiles_report (const struct examine *cmd, int iact_idx) if (( diff_idx != -1 && diff_idx <= ivar_idx) || i == 0) - { + { struct string str; ds_init_empty (&str); append_value_name (ivar, val, &str); - + tab_text (t, 1 + ivar_idx, heading_rows + v * rows_per_var + i * rows_per_cat, TAT_TITLE | TAB_LEFT, ds_cstr (&str) ); - + ds_destroy (&str); } } @@ -714,7 +714,7 @@ percentiles_report (const struct examine *cmd, int iact_idx) ); } - tab_text (t, heading_columns - 1, + tab_text (t, heading_columns - 1, heading_rows + v * rows_per_var + i * rows_per_cat, TAT_TITLE | TAB_LEFT, gettext (ptile_alg_desc [cmd->pc_alg])); @@ -723,15 +723,15 @@ percentiles_report (const struct examine *cmd, int iact_idx) for (p = 0; p < cmd->n_percentiles; ++p) { - tab_double (t, heading_columns + p, + tab_double (t, heading_columns + p, heading_rows + v * rows_per_var + i * rows_per_cat, 0, percentile_calculate (es->percentiles[p], cmd->pc_alg), NULL, RC_OTHER); - + if (cmd->ptiles[p] == 25.0) { - tab_double (t, heading_columns + p, + tab_double (t, heading_columns + p, heading_rows + v * rows_per_var + i * rows_per_cat + 1, 0, hinges[0], @@ -739,7 +739,7 @@ percentiles_report (const struct examine *cmd, int iact_idx) } else if (cmd->ptiles[p] == 50.0) { - tab_double (t, heading_columns + p, + tab_double (t, heading_columns + p, heading_rows + v * rows_per_var + i * rows_per_cat + 1, 0, hinges[1], @@ -747,7 +747,7 @@ percentiles_report (const struct examine *cmd, int iact_idx) } else if (cmd->ptiles[p] == 75.0) { - tab_double (t, heading_columns + p, + tab_double (t, heading_columns + p, heading_rows + v * rows_per_var + i * rows_per_cat + 1, 0, hinges[2], @@ -756,11 +756,11 @@ percentiles_report (const struct examine *cmd, int iact_idx) } - tab_text (t, heading_columns - 1, + tab_text (t, heading_columns - 1, heading_rows + v * rows_per_var + i * rows_per_cat + 1, TAT_TITLE | TAB_LEFT, _("Tukey's Hinges")); - + } free (prev_vals); @@ -826,7 +826,7 @@ descriptives_report (const struct examine *cmd, int iact_idx) int ivar_idx; if ( v > 0 ) tab_hline (t, TAL_1, 0, nc - 1, heading_rows + v * rows_per_var); - + tab_text (t, 0, heading_rows + v * rows_per_var, TAT_TITLE | TAB_LEFT, @@ -860,18 +860,18 @@ descriptives_report (const struct examine *cmd, int iact_idx) if (( diff_idx != -1 && diff_idx <= ivar_idx) || i == 0) - { + { struct string str; ds_init_empty (&str); append_value_name (ivar, val, &str); - + tab_text (t, 1 + ivar_idx, heading_rows + v * rows_per_var + i * rows_per_cat, TAT_TITLE | TAB_LEFT, ds_cstr (&str) ); - + ds_destroy (&str); } } @@ -907,7 +907,7 @@ descriptives_report (const struct examine *cmd, int iact_idx) _("%g%% Confidence Interval for Mean"), cmd->conf * 100.0 ); - + tab_text (t, 1 + iact->n_vars + 1, heading_rows + v * rows_per_var + i * rows_per_cat + 1, @@ -954,7 +954,7 @@ descriptives_report (const struct examine *cmd, int iact_idx) TAB_LEFT, _("Median") ); - + tab_double (t, 1 + iact->n_vars + 2, heading_rows + v * rows_per_var + i * rows_per_cat + 4, @@ -997,7 +997,7 @@ descriptives_report (const struct examine *cmd, int iact_idx) tab_double (t, 1 + iact->n_vars + 2, heading_rows + v * rows_per_var + i * rows_per_cat + 7, - 0, + 0, es->minima[0].val, NULL, RC_OTHER); @@ -1011,7 +1011,7 @@ descriptives_report (const struct examine *cmd, int iact_idx) tab_double (t, 1 + iact->n_vars + 2, heading_rows + v * rows_per_var + i * rows_per_cat + 8, - 0, + 0, es->maxima[0].val, NULL, RC_OTHER); @@ -1025,7 +1025,7 @@ descriptives_report (const struct examine *cmd, int iact_idx) tab_double (t, 1 + iact->n_vars + 2, heading_rows + v * rows_per_var + i * rows_per_cat + 9, - 0, + 0, es->maxima[0].val - es->minima[0].val, NULL, RC_OTHER); @@ -1041,7 +1041,7 @@ descriptives_report (const struct examine *cmd, int iact_idx) 1 + iact->n_vars + 2, heading_rows + v * rows_per_var + i * rows_per_cat + 10, 0, - percentile_calculate (es->quartiles[2], cmd->pc_alg) - + percentile_calculate (es->quartiles[2], cmd->pc_alg) - percentile_calculate (es->quartiles[0], cmd->pc_alg), NULL, RC_OTHER); @@ -1124,7 +1124,7 @@ extremes_report (const struct examine *cmd, int iact_idx) tab_vline (t, TAL_2, heading_columns, 0, nr - 1); - if ( cmd->id_var ) + if ( cmd->id_var ) tab_text (t, heading_columns, 0, TAB_CENTER | TAT_TITLE, var_to_string (cmd->id_var)); else @@ -1150,7 +1150,7 @@ extremes_report (const struct examine *cmd, int iact_idx) int ivar_idx; if ( v > 0 ) tab_hline (t, TAL_1, 0, nc - 1, heading_rows + v * rows_per_var); - + tab_text (t, 0, heading_rows + v * rows_per_var, TAT_TITLE, @@ -1177,18 +1177,18 @@ extremes_report (const struct examine *cmd, int iact_idx) if (( diff_idx != -1 && diff_idx <= ivar_idx) || i == 0) - { + { struct string str; ds_init_empty (&str); append_value_name (ivar, val, &str); - + tab_text (t, 1 + ivar_idx, heading_rows + v * rows_per_var + i * rows_per_cat, TAT_TITLE | TAB_LEFT, ds_cstr (&str) ); - + ds_destroy (&str); } } @@ -1199,7 +1199,7 @@ extremes_report (const struct examine *cmd, int iact_idx) heading_rows + v * rows_per_var + i * rows_per_cat ); } - + tab_text (t, heading_columns - 2, heading_rows + v * rows_per_var + i * rows_per_cat, @@ -1235,7 +1235,7 @@ extremes_report (const struct examine *cmd, int iact_idx) &es->maxima[e].identity, cmd->id_var, NULL); - else + else tab_double (t, heading_columns, heading_rows + v * rows_per_var + i * rows_per_cat + e, @@ -1249,7 +1249,7 @@ extremes_report (const struct examine *cmd, int iact_idx) 0, es->maxima[e].val, var_get_print_format (cmd->dep_vars[v]), RC_OTHER); - + tab_double (t, heading_columns - 1, @@ -1331,7 +1331,7 @@ summary_report (const struct examine *cmd, int iact_idx) TAB_CENTER | TAT_TITLE, _("Valid")); tab_joint_text (t, - heading_columns + 2, 1, + heading_columns + 2, 1, heading_columns + 3, 1, TAB_CENTER | TAT_TITLE, _("Missing")); @@ -1396,17 +1396,17 @@ summary_report (const struct examine *cmd, int iact_idx) if (( diff_idx != -1 && diff_idx <= ivar_idx) || i == 0) - { + { struct string str; ds_init_empty (&str); append_value_name (ivar, val, &str); - + tab_text (t, 1 + ivar_idx, heading_rows + n_cats * v + i, TAT_TITLE | TAB_LEFT, ds_cstr (&str) ); - + ds_destroy (&str); } } @@ -1414,10 +1414,10 @@ summary_report (const struct examine *cmd, int iact_idx) es = categoricals_get_user_data_by_category_real (cmd->cats, iact_idx, i); - - + + total = es[v].missing + es[v].non_missing; - tab_double (t, + tab_double (t, heading_columns + 0, heading_rows + n_cats * v + i, 0, @@ -1425,7 +1425,7 @@ summary_report (const struct examine *cmd, int iact_idx) NULL, RC_WEIGHT); - tab_text_format (t, + tab_text_format (t, heading_columns + 1, heading_rows + n_cats * v + i, 0, @@ -1434,21 +1434,21 @@ summary_report (const struct examine *cmd, int iact_idx) ); - tab_double (t, + tab_double (t, heading_columns + 2, heading_rows + n_cats * v + i, 0, es[v].missing, NULL, RC_WEIGHT); - tab_text_format (t, + tab_text_format (t, heading_columns + 3, heading_rows + n_cats * v + i, 0, "%g%%", 100.0 * es[v].missing / total ); - tab_double (t, + tab_double (t, heading_columns + 4, heading_rows + n_cats * v + i, 0, @@ -1456,7 +1456,7 @@ summary_report (const struct examine *cmd, int iact_idx) NULL, RC_WEIGHT); /* This can only be 100% can't it? */ - tab_text_format (t, + tab_text_format (t, heading_columns + 5, heading_rows + n_cats * v + i, 0, @@ -1479,7 +1479,7 @@ parse_interaction (struct lexer *lexer, struct examine *ex) { const struct variable *v = NULL; struct interaction *iact = NULL; - + if ( lex_match_variable (lexer, ex->dict, &v)) { iact = interaction_create (v); @@ -1495,7 +1495,7 @@ parse_interaction (struct lexer *lexer, struct examine *ex) } lex_match (lexer, T_COMMA); } - + return iact; } @@ -1504,7 +1504,7 @@ static void * create_n (const void *aux1, void *aux2 UNUSED) { int v; - + const struct examine *examine = aux1; struct exploratory_stats *es = pool_calloc (examine->pool, examine->n_dep_vars, sizeof (*es)); struct subcase ordering; @@ -1558,7 +1558,7 @@ update_n (const void *aux1, void *aux2 UNUSED, void *user_data, struct ccase *outcase ; const struct variable *var = examine->dep_vars[v]; const double x = case_data (c, var)->f; - + if (var_is_value_missing (var, case_data (c, var), examine->dep_excl)) { es[v].missing += weight; @@ -1584,7 +1584,7 @@ update_n (const void *aux1, void *aux2 UNUSED, void *user_data, case_data_idx (c, examine->id_idx), examine->id_width); case_data_rw_idx (outcase, EX_WT)->f = weight; - + es[v].cc += weight; if (es[v].cmin > weight) @@ -1640,7 +1640,7 @@ calculate_n (const void *aux1, void *aux2 UNUSED, void *user_data) const double val = case_data_idx (c, EX_VAL)->f; double wt = case_data_idx (c, EX_WT)->f; wt = var_force_valid_weight (examine->wv, wt, &warn); - + moments_pass_two (es[v].mom, val, wt); if (es[v].histogram) @@ -1667,7 +1667,7 @@ calculate_n (const void *aux1, void *aux2 UNUSED, void *user_data) { struct extremity *max; - if (x >= examine->calc_extremes) + if (x >= examine->calc_extremes) break; max = &es[v].maxima[x]; @@ -1722,7 +1722,7 @@ calculate_n (const void *aux1, void *aux2 UNUSED, void *user_data) { struct order_stats *os; - es[v].box_whisker = box_whisker_create (es[v].hinges, + es[v].box_whisker = box_whisker_create (es[v].hinges, EX_ID, examine->id_var); os = &es[v].box_whisker->parent; @@ -1737,7 +1737,7 @@ calculate_n (const void *aux1, void *aux2 UNUSED, void *user_data) struct order_stats *os; moments_calculate (es[v].mom, &n, &mean, &var, NULL, NULL); - + es[v].np = np_create (n, mean, var); os = &es[v].np->parent; @@ -1752,7 +1752,7 @@ calculate_n (const void *aux1, void *aux2 UNUSED, void *user_data) static void cleanup_exploratory_stats (struct examine *cmd) -{ +{ int i; for (i = 0; i < cmd->n_iacts; ++i) { @@ -1825,11 +1825,11 @@ run_examine (struct examine *cmd, struct casereader *input) payload.update = update_n; payload.calculate = calculate_n; payload.destroy = NULL; - + cmd->wv = dict_get_weight (cmd->dict); cmd->cats - = categoricals_create (cmd->iacts, cmd->n_iacts, + = categoricals_create (cmd->iacts, cmd->n_iacts, cmd->wv, cmd->dep_excl, cmd->fctr_excl); categoricals_set_payload (cmd->cats, &payload, cmd, NULL); @@ -1923,7 +1923,7 @@ cmd_examine (struct lexer *lexer, struct dataset *ds) examine.id_width = 0; examine.id_var = NULL; examine.boxplot_mode = BP_GROUPS; - + examine.ex_proto = caseproto_create (); examine.pool = pool_create (); @@ -1970,11 +1970,11 @@ cmd_examine (struct lexer *lexer, struct dataset *ds) if (iact) { examine.n_iacts++; - iacts_mem = + iacts_mem = pool_nrealloc (examine.pool, iacts_mem, examine.n_iacts, sizeof (*iacts_mem)); - + iacts_mem[examine.n_iacts - 1] = iact; } } @@ -2041,7 +2041,7 @@ cmd_examine (struct lexer *lexer, struct dataset *ds) while (lex_is_number (lexer)) { double p = lex_number (lexer); - + if ( p <= 0 || p >= 100.0) { lex_error (lexer, @@ -2207,19 +2207,19 @@ cmd_examine (struct lexer *lexer, struct dataset *ds) examine.npplot = true; examine.boxplot = true; } - else + else { lex_error (lexer, NULL); goto error; } lex_match (lexer, T_COMMA); - } + } } else if (lex_match_id (lexer, "CINTERVAL")) { if ( !lex_force_num (lexer)) goto error; - + examine.conf = lex_number (lexer); lex_get (lexer); } @@ -2299,7 +2299,7 @@ cmd_examine (struct lexer *lexer, struct dataset *ds) struct casegrouper *grouper; struct casereader *group; bool ok; - + grouper = casegrouper_create_splits (proc_open (ds), examine.dict); while (casegrouper_get_next_group (grouper, &group)) run_examine (&examine, group); diff --git a/src/language/stats/factor.c b/src/language/stats/factor.c index 38c66cc751..472c340fd7 100644 --- a/src/language/stats/factor.c +++ b/src/language/stats/factor.c @@ -19,8 +19,8 @@ #include #include #include -#include -#include +#include +#include #include #include @@ -87,7 +87,7 @@ enum print_opts PRINT_EXTRACTION = 0x0100, PRINT_INITIAL = 0x0200, PRINT_KMO = 0x0400, - PRINT_REPR = 0x0800, + PRINT_REPR = 0x0800, PRINT_FSCORE = 0x1000 }; @@ -142,7 +142,7 @@ static const rotation_coefficients rotation_coeff[] = { /* return diag (C'C) ^ {-0.5} */ static gsl_matrix * -diag_rcp_sqrt (const gsl_matrix *C) +diag_rcp_sqrt (const gsl_matrix *C) { int j; gsl_matrix *d = gsl_matrix_calloc (C->size1, C->size2); @@ -170,7 +170,7 @@ diag_rcp_sqrt (const gsl_matrix *C) /* return diag ((C'C)^-1) ^ {-0.5} */ static gsl_matrix * -diag_rcp_inv_sqrt (const gsl_matrix *CCinv) +diag_rcp_inv_sqrt (const gsl_matrix *CCinv) { int j; gsl_matrix *r = gsl_matrix_calloc (CCinv->size1, CCinv->size2); @@ -191,7 +191,7 @@ diag_rcp_inv_sqrt (const gsl_matrix *CCinv) -struct cmd_factor +struct cmd_factor { size_t n_vars; const struct variable **vars; @@ -276,7 +276,7 @@ anti_image (const gsl_matrix *m) assert (m->size1 == m->size2); a = gsl_matrix_alloc (m->size1, m->size2); - + for (i = 0; i < m->size1; ++i) { for (j = 0; j < m->size2; ++j) @@ -301,7 +301,7 @@ ssq_od_n (const gsl_matrix *m, int n) assert (m->size1 == m->size2); assert (n < m->size1); - + for (i = 0; i < m->size1; ++i) { if (i == n ) continue; @@ -357,11 +357,11 @@ dump_vector (const gsl_vector *v) #endif -static int +static int n_extracted_factors (const struct cmd_factor *factor, struct idata *idata) { int i; - + /* If there is a cached value, then return that. */ if ( idata->n_extractions != 0) return idata->n_extractions; @@ -373,7 +373,7 @@ n_extracted_factors (const struct cmd_factor *factor, struct idata *idata) idata->n_extractions = factor->n_factors; goto finish; } - + /* Use the MIN_EIGEN setting. */ for (i = 0 ; i < idata->eval->size; ++i) { @@ -408,7 +408,7 @@ struct smr_workspace { /* Copy of the subject */ gsl_matrix *m; - + gsl_matrix *inverse; gsl_permutation *perm; @@ -421,7 +421,7 @@ struct smr_workspace static struct smr_workspace *ws_create (const gsl_matrix *input) { struct smr_workspace *ws = xmalloc (sizeof (*ws)); - + ws->m = gsl_matrix_alloc (input->size1, input->size2); ws->inverse = gsl_matrix_calloc (input->size1 - 1, input->size2 - 1); ws->perm = gsl_permutation_alloc (input->size1 - 1); @@ -444,13 +444,13 @@ ws_destroy (struct smr_workspace *ws) } -/* +/* Return the square of the regression coefficient for VAR regressed against all other variables. */ static double squared_multiple_correlation (const gsl_matrix *corr, int var, struct smr_workspace *ws) { - /* For an explanation of what this is doing, see + /* For an explanation of what this is doing, see http://www.visualstatistics.net/Visual%20Statistics%20Multimedia/multiple_regression_analysis.htm */ @@ -462,7 +462,7 @@ squared_multiple_correlation (const gsl_matrix *corr, int var, struct smr_worksp gsl_matrix_swap_rows (ws->m, 0, var); gsl_matrix_swap_columns (ws->m, 0, var); - rxx = gsl_matrix_submatrix (ws->m, 1, 1, ws->m->size1 - 1, ws->m->size1 - 1); + rxx = gsl_matrix_submatrix (ws->m, 1, 1, ws->m->size1 - 1, ws->m->size1 - 1); gsl_linalg_LU_decomp (&rxx.matrix, ws->perm, &signum); @@ -511,7 +511,7 @@ factor_matrix_workspace_alloc (size_t n, size_t nf) ws->eval = gsl_vector_alloc (n); ws->evec = gsl_matrix_alloc (n, n); ws->r = gsl_matrix_alloc (n, n); - + return ws; } @@ -546,10 +546,10 @@ perm_shift_apply (gsl_permutation *target, const gsl_permutation *p, } -/* +/* Indirectly sort the rows of matrix INPUT, storing the sort order in PERM. The sort criteria are as follows: - + Rows are sorted on the first column, until the absolute value of an element in a subsequent column is greater than that of the first column. Thereafter, rows will be sorted on the second column, @@ -582,7 +582,7 @@ sort_matrix_indirect (const gsl_matrix *input, gsl_permutation *perm) } } - while (column_n < m && row_n < n) + while (column_n < m && row_n < n) { gsl_vector_const_view columni = gsl_matrix_const_column (mat, column_n); gsl_sort_vector_index (p, &columni.vector); @@ -591,7 +591,7 @@ sort_matrix_indirect (const gsl_matrix *input, gsl_permutation *perm) { gsl_vector_view row = gsl_matrix_row (mat, p->data[n - 1 - i]); size_t maxindex = gsl_vector_max_index (&row.vector); - + if ( maxindex > column_n ) break; @@ -609,11 +609,11 @@ sort_matrix_indirect (const gsl_matrix *input, gsl_permutation *perm) gsl_permutation_free (p); gsl_matrix_free (mat); - + assert ( 0 == gsl_permutation_valid (perm)); /* We want the biggest value to be first */ - gsl_permutation_reverse (perm); + gsl_permutation_reverse (perm); } @@ -647,7 +647,7 @@ clone_matrix (const gsl_matrix *m) } -static double +static double initial_sv (const gsl_matrix *fm) { int j, k; @@ -738,7 +738,7 @@ rotate (const struct cmd_factor *cf, const gsl_matrix *unrot, { double jv = gsl_matrix_get (normalised, p, j); double kv = gsl_matrix_get (normalised, p, k); - + double u = jv * jv - kv * kv; double v = 2 * jv * kv; a += u; @@ -787,10 +787,10 @@ rotate (const struct cmd_factor *cf, const gsl_matrix *unrot, gsl_matrix_free (h_sqrt); gsl_matrix_free (normalised); - if (cf->rotation == ROT_PROMAX) + if (cf->rotation == ROT_PROMAX) { /* general purpose m by m matrix, where m is the number of factors */ - gsl_matrix *mm1 = gsl_matrix_calloc (unrot->size2, unrot->size2); + gsl_matrix *mm1 = gsl_matrix_calloc (unrot->size2, unrot->size2); gsl_matrix *mm2 = gsl_matrix_calloc (unrot->size2, unrot->size2); /* general purpose m by p matrix, where p is the number of variables */ @@ -814,7 +814,7 @@ rotate (const struct cmd_factor *cf, const gsl_matrix *unrot, /* Vector of length p containing (indexed by i) \Sum^m_j {\lambda^2_{ij}} */ - gsl_vector *rssq = gsl_vector_calloc (unrot->size1); + gsl_vector *rssq = gsl_vector_calloc (unrot->size1); for (i = 0; i < P->size1; ++i) { @@ -823,9 +823,9 @@ rotate (const struct cmd_factor *cf, const gsl_matrix *unrot, { sum += gsl_matrix_get (result, i, j) * gsl_matrix_get (result, i, j); - + } - + gsl_vector_set (rssq, i, sqrt (sum)); } @@ -898,7 +898,7 @@ rotate (const struct cmd_factor *cf, const gsl_matrix *unrot, gsl_linalg_matmult_mod (mm1, GSL_LINALG_MOD_NONE, C, GSL_LINALG_MOD_TRANSPOSE, factor_correlation_matrix); - + gsl_linalg_matmult_mod (pattern_matrix, GSL_LINALG_MOD_NONE, factor_correlation_matrix, GSL_LINALG_MOD_NONE, pm1); @@ -954,7 +954,7 @@ rotate (const struct cmd_factor *cf, const gsl_matrix *unrot, WS is a pointer to a structure which must have been initialised with factor_matrix_workspace_init. */ static void -iterate_factor_matrix (const gsl_matrix *r, gsl_vector *communalities, gsl_matrix *factors, +iterate_factor_matrix (const gsl_matrix *r, gsl_vector *communalities, gsl_matrix *factors, struct factor_matrix_workspace *ws) { size_t i; @@ -1408,7 +1408,7 @@ cmd_factor (struct lexer *lexer, struct dataset *ds) if ( factor.rotation == ROT_NONE ) factor.print &= ~PRINT_ROTATION; - if ( ! run_factor (ds, &factor)) + if ( ! run_factor (ds, &factor)) goto error; free (factor.vars); @@ -1580,10 +1580,10 @@ show_factor_matrix (const struct cmd_factor *factor, struct idata *idata, const struct tab_table *t = tab_create (nc, nr); - /* + /* if ( factor->extraction == EXTRACTION_PC ) tab_title (t, _("Component Matrix")); - else + else tab_title (t, _("Factor Matrix")); */ @@ -1887,7 +1887,7 @@ show_factor_correlation (const struct cmd_factor * factor, const gsl_matrix *fcm for (i = 0 ; i < fcm->size1; ++i) { for (j = 0 ; j < fcm->size2; ++j) - tab_double (t, heading_columns + i, heading_rows +j, 0, + tab_double (t, heading_columns + i, heading_rows +j, 0, gsl_matrix_get (fcm, i, j), NULL, RC_OTHER); } @@ -2050,12 +2050,12 @@ do_factor (const struct cmd_factor *factor, struct casereader *r) var_matrix = covariance_moments (cov, MOMENT_VARIANCE); mean_matrix = covariance_moments (cov, MOMENT_MEAN); idata->n = covariance_moments (cov, MOMENT_NONE); - + if ( factor->method == METHOD_CORR) { idata->corr = correlation_from_covariance (idata->cov, var_matrix); - + analysis_matrix = idata->corr; } else @@ -2190,7 +2190,7 @@ do_factor (const struct cmd_factor *factor, struct casereader *r) tab_text (t, 1, 3, TAT_TITLE, _("Sig.")); - /* The literature doesn't say what to do for the value of W when + /* The literature doesn't say what to do for the value of W when missing values are involved. The best thing I can think of is to take the mean average. */ w = 0; @@ -2204,7 +2204,7 @@ do_factor (const struct cmd_factor *factor, struct casereader *r) tab_double (t, 2, 1, 0, xsq, NULL, RC_OTHER); tab_double (t, 2, 2, 0, df, NULL, RC_INTEGER); tab_double (t, 2, 3, 0, gsl_cdf_chisq_Q (xsq, df), NULL, RC_PVALUE); - + tab_submit (t); } @@ -2215,7 +2215,7 @@ do_factor (const struct cmd_factor *factor, struct casereader *r) { gsl_matrix *am = matrix_dup (analysis_matrix); gsl_eigen_symmv_workspace *workspace = gsl_eigen_symmv_alloc (factor->n_vars); - + gsl_eigen_symmv (am, idata->eval, idata->evec, workspace); gsl_eigen_symmv_free (workspace); @@ -2234,12 +2234,12 @@ do_factor (const struct cmd_factor *factor, struct casereader *r) if (idata->n_extractions > factor->n_vars) { - msg (MW, - _("The %s criteria result in more factors than variables, which is not meaningful. No analysis will be performed."), + msg (MW, + _("The %s criteria result in more factors than variables, which is not meaningful. No analysis will be performed."), "FACTOR"); goto finish; } - + { gsl_matrix *rotated_factors = NULL; gsl_matrix *pattern_matrix = NULL; @@ -2274,11 +2274,11 @@ do_factor (const struct cmd_factor *factor, struct casereader *r) gsl_vector_memcpy (diff, idata->msr); iterate_factor_matrix (analysis_matrix, idata->msr, factor_matrix, fmw); - + gsl_vector_sub (diff, idata->msr); gsl_vector_minmax (diff, &min, &max); - + if ( fabs (min) < factor->econverge && fabs (max) < factor->econverge) break; } @@ -2315,11 +2315,11 @@ do_factor (const struct cmd_factor *factor, struct casereader *r) pattern_matrix = gsl_matrix_calloc (factor_matrix->size1, factor_matrix->size2); fcm = gsl_matrix_calloc (factor_matrix->size2, factor_matrix->size2); } - + rotate (factor, factor_matrix, extracted_communalities, rotated_factors, rotated_loadings, pattern_matrix, fcm); } - + show_explained_variance (factor, idata, idata->eval, extracted_eigenvalues, rotated_loadings); factor_matrix_workspace_free (fmw); diff --git a/src/language/stats/frequencies.c b/src/language/stats/frequencies.c index 305d4f1d75..3e4455f2b2 100644 --- a/src/language/stats/frequencies.c +++ b/src/language/stats/frequencies.c @@ -1,7 +1,7 @@ /* PSPP - a program for statistical analysis. Copyright (C) 1997-9, 2000, 2007, 2009, 2010, 2011, 2014, 2015 Free Software Foundation, Inc. - + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or @@ -11,7 +11,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -107,7 +107,7 @@ enum FRQ_PERCENT }; -enum sortprops +enum sortprops { FRQ_AFREQ, FRQ_DFREQ, @@ -238,7 +238,7 @@ struct freq_compare_aux static void calc_stats (const struct var_freqs *vf, double d[FRQ_ST_count]); -static void do_piechart(const struct frq_chart *pie, +static void do_piechart(const struct frq_chart *pie, const struct variable *var, const struct freq_tab *frq_tab); @@ -246,7 +246,7 @@ static void do_barchart(const struct frq_chart *bar, const struct variable **var, const struct freq_tab *frq_tab); -static void dump_statistics (const struct frq_proc *frq, +static void dump_statistics (const struct frq_proc *frq, const struct var_freqs *vf, const struct variable *wv); @@ -606,9 +606,9 @@ cmd_frequencies (struct lexer *lexer, struct dataset *ds) frq.vars = NULL; frq.n_vars = 0; - - frq.stats = BIT_INDEX (FRQ_ST_MEAN) - | BIT_INDEX (FRQ_ST_STDDEV) + + frq.stats = BIT_INDEX (FRQ_ST_MEAN) + | BIT_INDEX (FRQ_ST_STDDEV) | BIT_INDEX (FRQ_ST_MINIMUM) | BIT_INDEX (FRQ_ST_MAXIMUM); @@ -652,11 +652,11 @@ cmd_frequencies (struct lexer *lexer, struct dataset *ds) if (lex_match_id (lexer, "STATISTICS")) { - frq.stats = BIT_INDEX (FRQ_ST_MEAN) - | BIT_INDEX (FRQ_ST_STDDEV) + frq.stats = BIT_INDEX (FRQ_ST_MEAN) + | BIT_INDEX (FRQ_ST_STDDEV) | BIT_INDEX (FRQ_ST_MINIMUM) | BIT_INDEX (FRQ_ST_MAXIMUM); - + frq.n_stats = 4; if (lex_match (lexer, T_EQUALS)) @@ -670,8 +670,8 @@ cmd_frequencies (struct lexer *lexer, struct dataset *ds) { if (lex_match_id (lexer, "DEFAULT")) { - frq.stats = BIT_INDEX (FRQ_ST_MEAN) - | BIT_INDEX (FRQ_ST_STDDEV) + frq.stats = BIT_INDEX (FRQ_ST_MEAN) + | BIT_INDEX (FRQ_ST_STDDEV) | BIT_INDEX (FRQ_ST_MINIMUM) | BIT_INDEX (FRQ_ST_MAXIMUM); @@ -773,7 +773,7 @@ cmd_frequencies (struct lexer *lexer, struct dataset *ds) if (lex_force_num (lexer)) { frq.percentiles = - xrealloc (frq.percentiles, + xrealloc (frq.percentiles, (frq.n_percentiles + 1) * sizeof (*frq.percentiles)); frq.percentiles[frq.n_percentiles].p = lex_number (lexer) / 100.0; @@ -850,7 +850,7 @@ cmd_frequencies (struct lexer *lexer, struct dataset *ds) for (i = 0; i < n + 1; ++i) { frq.percentiles = - xrealloc (frq.percentiles, + xrealloc (frq.percentiles, (frq.n_percentiles + 1) * sizeof (*frq.percentiles)); frq.percentiles[frq.n_percentiles].p = @@ -1116,10 +1116,10 @@ cmd_frequencies (struct lexer *lexer, struct dataset *ds) if (frq.stats & BIT_INDEX (FRQ_ST_MEDIAN)) { frq.percentiles = - xrealloc (frq.percentiles, + xrealloc (frq.percentiles, (frq.n_percentiles + 1) * sizeof (*frq.percentiles)); - + frq.percentiles[frq.n_percentiles].p = 0.50; frq.percentiles[frq.n_percentiles].show = true; @@ -1149,24 +1149,24 @@ cmd_frequencies (struct lexer *lexer, struct dataset *ds) msg (SE, _("%s for histogram must be greater than or equal to %s, " "but %s was specified as %.15g and %s as %.15g. " "%s and %s will be ignored."), - "MAX", "MIN", - "MIN", hist->x_min, + "MAX", "MIN", + "MIN", hist->x_min, "MAX", hist->x_max, "MIN", "MAX"); hist->x_min = hist->x_max = SYSMIS; } frq.percentiles = - xrealloc (frq.percentiles, + xrealloc (frq.percentiles, (frq.n_percentiles + 2) * sizeof (*frq.percentiles)); - + frq.percentiles[frq.n_percentiles].p = 0.25; frq.percentiles[frq.n_percentiles].show = false; frq.percentiles[frq.n_percentiles + 1].p = 0.75; frq.percentiles[frq.n_percentiles + 1].show = false; - + frq.n_percentiles+=2; } @@ -1193,8 +1193,8 @@ cmd_frequencies (struct lexer *lexer, struct dataset *ds) { msg (SE, _("%s for pie chart must be greater than or equal to %s, " "but %s was specified as %.15g and %s as %.15g. " - "%s and %s will be ignored."), - "MAX", "MIN", + "%s and %s will be ignored."), + "MAX", "MIN", "MIN", pie->x_min, "MAX", pie->x_max, "MIN", "MAX"); @@ -1207,7 +1207,7 @@ cmd_frequencies (struct lexer *lexer, struct dataset *ds) int i,o; double previous_p = -1; qsort (frq.percentiles, frq.n_percentiles, - sizeof (*frq.percentiles), + sizeof (*frq.percentiles), ptile_3way); frq.n_show_percentiles = 0; @@ -1384,7 +1384,7 @@ pick_cat_counts (const struct frq_chart *catchart, int n_slices = 0; int i; struct freq *slices = xnmalloc (frq_tab->n_valid + frq_tab->n_missing, sizeof *slices); - + for (i = 0; i < frq_tab->n_valid; i++) { const struct freq *f = &frq_tab->valid[i]; @@ -1393,9 +1393,9 @@ pick_cat_counts (const struct frq_chart *catchart, if (f->count < catchart->x_min) continue; - + slices[n_slices] = *f; - + n_slices++; } @@ -1405,11 +1405,11 @@ pick_cat_counts (const struct frq_chart *catchart, { const struct freq *f = &frq_tab->missing[i]; slices[n_slices].count += f->count; - + if (i == 0) slices[n_slices].values[0] = f->values[0]; } - + if (frq_tab->n_missing > 0) n_slices++; } @@ -1432,7 +1432,7 @@ pick_cat_counts_ptr (const struct frq_chart *catchart, int n_slices = 0; int i; struct freq **slices = xnmalloc (frq_tab->n_valid + frq_tab->n_missing, sizeof *slices); - + for (i = 0; i < frq_tab->n_valid; i++) { struct freq *f = &frq_tab->valid[i]; @@ -1441,9 +1441,9 @@ pick_cat_counts_ptr (const struct frq_chart *catchart, if (f->count < catchart->x_min) continue; - + slices[n_slices] = f; - + n_slices++; } @@ -1459,7 +1459,7 @@ pick_cat_counts_ptr (const struct frq_chart *catchart, } slices[n_slices]->count += f->count; - + } } @@ -1497,7 +1497,7 @@ do_barchart(const struct frq_chart *bar, const struct variable **var, struct freq **slices = pick_cat_counts_ptr (bar, frq_tab, &n_slices); chart_item_submit (barchart_create (var, 1, - (bar->y_scale == FRQ_FREQ) ? _("Count") : _("Percent"), + (bar->y_scale == FRQ_FREQ) ? _("Count") : _("Percent"), (bar->y_scale == FRQ_PERCENT), slices, n_slices)); free (slices); diff --git a/src/language/stats/friedman.c b/src/language/stats/friedman.c index 03a3e65e55..8fa49f7d11 100644 --- a/src/language/stats/friedman.c +++ b/src/language/stats/friedman.c @@ -44,7 +44,7 @@ struct friedman const struct dictionary *dict; }; -static void show_ranks_box (const struct one_sample_test *ost, +static void show_ranks_box (const struct one_sample_test *ost, const struct friedman *fr); static void show_sig_box (const struct one_sample_test *ost, @@ -64,7 +64,7 @@ cmp_x (const void *a_, const void *b_) if (a->x < b->x) return -1; - + return (a->x > b->x); } @@ -76,7 +76,7 @@ cmp_posn (const void *a_, const void *b_) if (a->posn < b->posn) return -1; - + return (a->posn > b->posn); } @@ -99,7 +99,7 @@ friedman_execute (const struct dataset *ds, struct friedman_test *ft = UP_CAST (ost, struct friedman_test, parent); bool warn = true; - double sigma_t = 0.0; + double sigma_t = 0.0; struct datum *row = xcalloc (ost->n_vars, sizeof *row); double rsq; struct friedman fr; @@ -257,7 +257,7 @@ static void show_sig_box (const struct one_sample_test *ost, const struct friedman *fr) { const struct friedman_test *ft = UP_CAST (ost, const struct friedman_test, parent); - + int row = 0; const struct variable *weight = dict_get_weight (fr->dict); const struct fmt_spec *wfmt = weight ? var_get_print_format (weight) : &F_8_0; @@ -297,21 +297,21 @@ show_sig_box (const struct one_sample_test *ost, const struct friedman *fr) tab_vline (table, TAL_2, row_headers, 0, tab_nr (table) - 1); row = 0; - tab_double (table, 1, column_headers + row++, + tab_double (table, 1, column_headers + row++, 0, fr->cc, NULL, RC_WEIGHT); if (ft->kendalls_w) - tab_double (table, 1, column_headers + row++, + tab_double (table, 1, column_headers + row++, 0, fr->w, NULL, RC_OTHER); - tab_double (table, 1, column_headers + row++, + tab_double (table, 1, column_headers + row++, 0, fr->chi_sq, NULL, RC_OTHER); - tab_double (table, 1, column_headers + row++, + tab_double (table, 1, column_headers + row++, 0, ost->n_vars - 1, NULL, RC_INTEGER); - tab_double (table, 1, column_headers + row++, - 0, gsl_cdf_chisq_Q (fr->chi_sq, ost->n_vars - 1), + tab_double (table, 1, column_headers + row++, + 0, gsl_cdf_chisq_Q (fr->chi_sq, ost->n_vars - 1), NULL, RC_PVALUE); tab_submit (table); diff --git a/src/language/stats/glm.c b/src/language/stats/glm.c index 9ac3150c0a..2edc8e568e 100644 --- a/src/language/stats/glm.c +++ b/src/language/stats/glm.c @@ -81,7 +81,7 @@ struct glm_workspace struct categoricals *cats; - /* + /* Sums of squares due to different variables. Element 0 is the SSE for the entire model. For i > 0, element i is the SS due to variable i. @@ -230,7 +230,7 @@ cmd_glm (struct lexer *lexer, struct dataset *ds) lex_error (lexer, NULL); goto error; } - + glm.alpha = lex_number (lexer); lex_get (lexer); if ( ! lex_force_match (lexer, T_RPAREN)) @@ -360,11 +360,11 @@ fill_submatrix (const gsl_matrix * cov, gsl_matrix * submatrix, bool *dropped_f) size_t j; size_t n = 0; size_t m = 0; - + for (i = 0; i < cov->size1; i++) { if (not_dropped (i, dropped_f)) - { + { m = 0; for (j = 0; j < cov->size2; j++) { @@ -373,7 +373,7 @@ fill_submatrix (const gsl_matrix * cov, gsl_matrix * submatrix, bool *dropped_f) gsl_matrix_set (submatrix, n, m, gsl_matrix_get (cov, i, j)); m++; - } + } } n++; } @@ -381,7 +381,7 @@ fill_submatrix (const gsl_matrix * cov, gsl_matrix * submatrix, bool *dropped_f) } -/* +/* Type 1 sums of squares. Populate SSQ with the Type 1 sums of squares according to COV */ @@ -410,7 +410,7 @@ ssq_type1 (struct covariance *cov, gsl_vector *ssq, const struct glm_spec *cmd) { gsl_matrix *model_cov = NULL; gsl_matrix *submodel_cov = NULL; - + n_dropped_submodel = n_dropped_model; for (i = cmd->n_dep_vars; i < covariance_dim (cov); i++) { @@ -419,7 +419,7 @@ ssq_type1 (struct covariance *cov, gsl_vector *ssq, const struct glm_spec *cmd) for (i = cmd->n_dep_vars; i < covariance_dim (cov); i++) { - const struct interaction * x = + const struct interaction * x = categoricals_get_interaction_by_subscript (cats, i - cmd->n_dep_vars); if ( x == cmd->interactions [k]) @@ -450,7 +450,7 @@ ssq_type1 (struct covariance *cov, gsl_vector *ssq, const struct glm_spec *cmd) free (submodel_dropped); } -/* +/* Type 2 sums of squares. Populate SSQ with the Type 2 sums of squares according to COV */ @@ -472,7 +472,7 @@ ssq_type2 (struct covariance *cov, gsl_vector *ssq, const struct glm_spec *cmd) size_t n_dropped_submodel = 0; for (i = cmd->n_dep_vars; i < covariance_dim (cov); i++) { - const struct interaction * x = + const struct interaction * x = categoricals_get_interaction_by_subscript (cats, i - cmd->n_dep_vars); model_dropped[i] = false; @@ -513,7 +513,7 @@ ssq_type2 (struct covariance *cov, gsl_vector *ssq, const struct glm_spec *cmd) free (submodel_dropped); } -/* +/* Type 3 sums of squares. Populate SSQ with the Type 2 sums of squares according to COV */ @@ -542,7 +542,7 @@ ssq_type3 (struct covariance *cov, gsl_vector *ssq, const struct glm_spec *cmd) for (i = cmd->n_dep_vars; i < covariance_dim (cov); i++) { - const struct interaction * x = + const struct interaction * x = categoricals_get_interaction_by_subscript (cats, i - cmd->n_dep_vars); model_dropped[i] = false; @@ -596,7 +596,7 @@ run_glm (struct glm_spec *cmd, struct casereader *input, cmd->factor_vars, cmd->n_factor_vars, cmd->exclude, NULL, NULL); - + ws.cats = categoricals_create (cmd->interactions, cmd->n_interactions, cmd->wv, cmd->exclude, MV_ANY); @@ -709,7 +709,7 @@ run_glm (struct glm_spec *cmd, struct casereader *input, taint_destroy (taint); } -static const char *roman[] = +static const char *roman[] = { "", /* The Romans had no concept of zero */ "I", @@ -756,7 +756,7 @@ output_glm (const struct glm_spec *cmd, const struct glm_workspace *ws) /* TRANSLATORS: The parameter is a roman numeral */ tab_text_format (t, 1, 0, TAB_CENTER | TAT_TITLE, - _("Type %s Sum of Squares"), + _("Type %s Sum of Squares"), roman[cmd->ss_type]); tab_text (t, 2, 0, TAB_CENTER | TAT_TITLE, _("df")); tab_text (t, 3, 0, TAB_CENTER | TAT_TITLE, _("Mean Square")); @@ -809,7 +809,7 @@ output_glm (const struct glm_spec *cmd, const struct glm_workspace *ws) ssq_effects += ssq; - if (! cmd->intercept) + if (! cmd->intercept) { df++; ssq += intercept_ssq; @@ -865,7 +865,7 @@ output_glm (const struct glm_spec *cmd, const struct glm_workspace *ws) tab_text (t, 0, r, TAB_LEFT | TAT_TITLE, _("Total")); tab_double (t, 1, r, 0, ws->total_ssq + intercept_ssq, NULL, RC_OTHER); tab_double (t, 2, r, 0, n_total, NULL, RC_WEIGHT); - + r++; } @@ -915,7 +915,7 @@ parse_nested_variable (struct lexer *lexer, struct glm_spec *glm) return false; } - lex_error (lexer, "Nested variables are not yet implemented"); return false; + lex_error (lexer, "Nested variables are not yet implemented"); return false; return true; } diff --git a/src/language/stats/graph.c b/src/language/stats/graph.c index da74afdef4..578efc1e75 100644 --- a/src/language/stats/graph.c +++ b/src/language/stats/graph.c @@ -1,7 +1,7 @@ /* PSPP - a program for statistical analysis. Copyright (C) 2012, 2013, 2015 Free Software Foundation, Inc. - + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or @@ -11,7 +11,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -142,10 +142,10 @@ struct graph enum bar_type bar_type; const struct variable *by_var[2]; size_t n_by_vars; - + struct subcase ordering; /* Ordering for aggregation */ int agr; /* Index into ag_func */ - + /* A caseproto that contains the plot data */ struct caseproto *gr_proto; }; @@ -276,7 +276,7 @@ parse_function (struct lexer *lexer, struct graph *graph) } return true; - + error: lex_error (lexer, NULL); return false; @@ -330,13 +330,13 @@ show_histogr (const struct graph *cmd, struct casereader *input) { struct histogram *histogram; struct ccase *c; - + if (cmd->es[0].cc <= 0) { casereader_destroy (input); return; } - + { /* Sturges Rule */ double bin_width = fabs (cmd->es[0].minimum - cmd->es[0].maximum) @@ -368,7 +368,7 @@ show_histogr (const struct graph *cmd, struct casereader *input) struct string label; - ds_init_cstr (&label, + ds_init_cstr (&label, var_to_string (cmd->dep_vars[0])); moments_calculate (cmd->es[0].mom, &n, &mean, &var, NULL, NULL); @@ -378,14 +378,14 @@ show_histogr (const struct graph *cmd, struct casereader *input) ds_cstr (&label), n, mean, sqrt (var), cmd->normal)); - statistic_destroy (&histogram->parent); + statistic_destroy (&histogram->parent); ds_destroy (&label); } } static void cleanup_exploratory_stats (struct graph *cmd) -{ +{ int v; for (v = 0; v < cmd->n_dep_vars; ++v) @@ -402,7 +402,7 @@ run_barchart (struct graph *cmd, struct casereader *input) struct casereader *group; double ccc = 0.0; - if ( cmd->missing_pw == false) + if ( cmd->missing_pw == false) input = casereader_create_filter_missing (input, cmd->dep_vars, cmd->n_dep_vars, @@ -464,7 +464,7 @@ run_barchart (struct graph *cmd, struct casereader *input) const double x = (cmd->n_dep_vars > 0) ? case_data (c, cmd->dep_vars[0])->f : SYSMIS; cc += weight; - + freqs[n_freqs - 1]->count = ag_func[cmd->agr].calc (freqs[n_freqs - 1]->count, x, weight); } @@ -494,9 +494,9 @@ run_barchart (struct graph *cmd, struct casereader *input) ag_func[cmd->agr].description, var_get_name (cmd->dep_vars[0])); else - ds_put_cstr (&label, + ds_put_cstr (&label, ag_func[cmd->agr].description); - + chart_item_submit (barchart_create (cmd->by_var, cmd->n_by_vars, ds_cstr (&label), false, freqs, n_freqs)); @@ -506,7 +506,7 @@ run_barchart (struct graph *cmd, struct casereader *input) for (int i = 0; i < n_freqs; ++i) free (freqs[i]); - + free (freqs); } @@ -613,14 +613,14 @@ cmd_graph (struct lexer *lexer, struct dataset *ds) struct graph graph; graph.missing_pw = false; - + graph.pool = pool_create (); graph.dep_excl = MV_ANY; graph.fctr_excl = MV_ANY; - + graph.dict = dataset_dict (ds); - + graph.dep_vars = NULL; graph.chart_type = CT_NONE; graph.scatter_type = ST_BIVARIATE; @@ -628,7 +628,7 @@ cmd_graph (struct lexer *lexer, struct dataset *ds) graph.gr_proto = caseproto_create (); subcase_init_empty (&graph.ordering); - + while (lex_token (lexer) != T_ENDCMD) { lex_match (lexer, T_SLASH); @@ -645,7 +645,7 @@ cmd_graph (struct lexer *lexer, struct dataset *ds) { if (!lex_force_match_id (lexer, "NORMAL")) goto error; - + if (!lex_force_match (lexer, T_RPAREN)) goto error; @@ -673,27 +673,27 @@ cmd_graph (struct lexer *lexer, struct dataset *ds) } graph.chart_type = CT_BAR; graph.bar_type = CBT_SIMPLE; - - if (lex_match (lexer, T_LPAREN)) + + if (lex_match (lexer, T_LPAREN)) { if (lex_match_id (lexer, "SIMPLE")) { /* This is the default anyway */ } - else if (lex_match_id (lexer, "GROUPED")) + else if (lex_match_id (lexer, "GROUPED")) { - graph.bar_type = CBT_GROUPED; + graph.bar_type = CBT_GROUPED; goto error; } - else if (lex_match_id (lexer, "STACKED")) + else if (lex_match_id (lexer, "STACKED")) { - graph.bar_type = CBT_STACKED; + graph.bar_type = CBT_STACKED; lex_error (lexer, _("%s is not yet implemented."), "STACKED"); goto error; } - else if (lex_match_id (lexer, "RANGE")) + else if (lex_match_id (lexer, "RANGE")) { - graph.bar_type = CBT_RANGE; + graph.bar_type = CBT_RANGE; lex_error (lexer, _("%s is not yet implemented."), "RANGE"); goto error; } @@ -705,7 +705,7 @@ cmd_graph (struct lexer *lexer, struct dataset *ds) if (!lex_force_match (lexer, T_RPAREN)) goto error; } - + if (!lex_force_match (lexer, T_EQUALS)) goto error; @@ -720,23 +720,23 @@ cmd_graph (struct lexer *lexer, struct dataset *ds) goto error; } graph.chart_type = CT_SCATTERPLOT; - if (lex_match (lexer, T_LPAREN)) + if (lex_match (lexer, T_LPAREN)) { if (lex_match_id (lexer, "BIVARIATE")) { /* This is the default anyway */ } - else if (lex_match_id (lexer, "OVERLAY")) + else if (lex_match_id (lexer, "OVERLAY")) { lex_error (lexer, _("%s is not yet implemented."),"OVERLAY"); goto error; } - else if (lex_match_id (lexer, "MATRIX")) + else if (lex_match_id (lexer, "MATRIX")) { lex_error (lexer, _("%s is not yet implemented."),"MATRIX"); goto error; } - else if (lex_match_id (lexer, "XYZ")) + else if (lex_match_id (lexer, "XYZ")) { lex_error(lexer, _("%s is not yet implemented."),"XYZ"); goto error; @@ -756,7 +756,7 @@ cmd_graph (struct lexer *lexer, struct dataset *ds) &graph.dep_vars, &graph.n_dep_vars, PV_NO_DUPLICATE | PV_NUMERIC)) goto error; - + if (graph.scatter_type == ST_BIVARIATE && graph.n_dep_vars != 1) { lex_error(lexer, _("Only one variable is allowed.")); @@ -776,7 +776,7 @@ cmd_graph (struct lexer *lexer, struct dataset *ds) lex_error (lexer, _("Only one variable is allowed.")); goto error; } - + if (lex_match (lexer, T_BY)) { const struct variable *v = NULL; @@ -898,7 +898,7 @@ cmd_graph (struct lexer *lexer, struct dataset *ds) struct casegrouper *grouper; struct casereader *group; bool ok; - + grouper = casegrouper_create_splits (proc_open (ds), graph.dict); while (casegrouper_get_next_group (grouper, &group)) { diff --git a/src/language/stats/jonckheere-terpstra.c b/src/language/stats/jonckheere-terpstra.c index 86e705d250..d7af2b070e 100644 --- a/src/language/stats/jonckheere-terpstra.c +++ b/src/language/stats/jonckheere-terpstra.c @@ -49,7 +49,7 @@ include_func_bi (const struct ccase *c, void *aux) const struct n_sample_test *nst = aux; const union value *bigger = NULL; const union value *smaller = NULL; - + if (0 > value_compare_3way (&nst->val1, &nst->val2, var_get_width (nst->indep_var))) { bigger = &nst->val2; @@ -60,7 +60,7 @@ include_func_bi (const struct ccase *c, void *aux) smaller = &nst->val2; bigger = &nst->val1; } - + if (0 < value_compare_3way (smaller, case_data (c, nst->indep_var), var_get_width (nst->indep_var))) return false; @@ -74,7 +74,7 @@ struct group_data { /* The total of the caseweights in the group */ double cc; - + /* A casereader containing the group data. This casereader contains just two values: 0: The raw value of the data @@ -106,7 +106,7 @@ u (const struct group_data *grp0, const struct group_data *grp1) { double x1 = case_data_idx (c1, 0)->f; double cc1 = case_data_idx (c1, 1)->f; - + if (x0 > x1) { /* Do nothing */ @@ -141,31 +141,31 @@ u (const struct group_data *grp0, const struct group_data *grp1) typedef double func_f (double e_l); -/* - These 3 functions are used repeatedly in the calculation of the +/* + These 3 functions are used repeatedly in the calculation of the variance of the JT statistic. - Having them explicitly defined makes the variance calculation + Having them explicitly defined makes the variance calculation a lot simpler. */ -static double +static double ff1 (double e) { return e * (e - 1) * (2*e + 5); } -static double +static double ff2 (double e) { return e * (e - 1) * (e - 2); } -static double +static double ff3 (double e) { return e * (e - 1) ; } -static func_f *mff[3] = +static func_f *mff[3] = { ff1, ff2, ff3 }; @@ -181,7 +181,7 @@ static func_f *mff[3] = */ static void variance_calculation (struct casereader *ir, const struct variable *var, - const struct dictionary *dict, + const struct dictionary *dict, func_f **f, double *result, size_t n) { int i; @@ -195,7 +195,7 @@ void variance_calculation (struct casereader *ir, const struct variable *var, r = sort_execute_1var (r, var); r = casereader_create_distinct (r, var, dict_get_weight (dict)); - + for (; (c = casereader_read (r)); case_unref (c)) { double w = case_data_idx (c, w_idx)->f; @@ -231,13 +231,13 @@ jonckheere_terpstra_execute (const struct dataset *ds, bool warn = true; const struct dictionary *dict = dataset_dict (ds); const struct n_sample_test *nst = UP_CAST (test, const struct n_sample_test, parent); - + struct caseproto *proto = caseproto_create (); proto = caseproto_add_width (proto, 0); proto = caseproto_add_width (proto, 0); /* If the independent variable is missing, then we ignore the case */ - input = casereader_create_filter_missing (input, + input = casereader_create_filter_missing (input, &nst->indep_var, 1, exclude, NULL, NULL); @@ -246,7 +246,7 @@ jonckheere_terpstra_execute (const struct dataset *ds, input = casereader_create_filter_weight (input, dict, &warn, NULL); /* Remove all those cases which are outside the range (val1, val2) */ - input = casereader_create_filter_func (input, include_func_bi, NULL, + input = casereader_create_filter_func (input, include_func_bi, NULL, CONST_CAST (struct n_sample_test *, nst), NULL); /* Sort the data by the independent variable */ @@ -271,14 +271,14 @@ jonckheere_terpstra_execute (const struct dataset *ds, /* Get a few values into e_sum - we'll be needing these later */ variance_calculation (vreader, nst->vars[v], dict, mff, e_sum, 3); - + grouper = casegrouper_create_vars (vreader, &nst->indep_var, 1); jt.obs = 0; jt.levels = 0; jt.n = 0; - for (; casegrouper_get_next_group (grouper, &group); + for (; casegrouper_get_next_group (grouper, &group); casereader_destroy (group) ) { struct casewriter *writer = autopaging_writer_create (proto); @@ -390,31 +390,31 @@ show_jt (const struct n_sample_test *nst, const struct jt *jt, const struct vari { double std_jt; - tab_text (table, 0, i + row_headers, TAT_TITLE, + tab_text (table, 0, i + row_headers, TAT_TITLE, var_to_string (nst->vars[i]) ); - tab_double (table, 1, i + row_headers, TAT_TITLE, + tab_double (table, 1, i + row_headers, TAT_TITLE, jt[0].levels, NULL, RC_INTEGER); - - tab_double (table, 2, i + row_headers, TAT_TITLE, + + tab_double (table, 2, i + row_headers, TAT_TITLE, jt[0].n, NULL, RC_WEIGHT); - tab_double (table, 3, i + row_headers, TAT_TITLE, + tab_double (table, 3, i + row_headers, TAT_TITLE, jt[0].obs, NULL, RC_OTHER); - tab_double (table, 4, i + row_headers, TAT_TITLE, + tab_double (table, 4, i + row_headers, TAT_TITLE, jt[0].mean, NULL, RC_OTHER); - tab_double (table, 5, i + row_headers, TAT_TITLE, + tab_double (table, 5, i + row_headers, TAT_TITLE, jt[0].stddev, NULL, RC_OTHER); std_jt = (jt[0].obs - jt[0].mean) / jt[0].stddev; - tab_double (table, 6, i + row_headers, TAT_TITLE, + tab_double (table, 6, i + row_headers, TAT_TITLE, std_jt, NULL, RC_OTHER); - tab_double (table, 7, i + row_headers, TAT_TITLE, + tab_double (table, 7, i + row_headers, TAT_TITLE, 2.0 * ((std_jt > 0) ? gsl_cdf_ugaussian_Q (std_jt) : gsl_cdf_ugaussian_P (std_jt)), NULL, RC_PVALUE); } - + tab_submit (table); } diff --git a/src/language/stats/kruskal-wallis.c b/src/language/stats/kruskal-wallis.c index 65ce7865a3..a9c269efed 100644 --- a/src/language/stats/kruskal-wallis.c +++ b/src/language/stats/kruskal-wallis.c @@ -93,7 +93,7 @@ find_rank_entry (const struct hmap *map, const union value *group, size_t width) if (0 == value_compare_3way (group, &re->group, width)) return re; } - + return re; } @@ -137,7 +137,7 @@ kruskal_wallis_execute (const struct dataset *ds, struct kw *kw = xcalloc (nst->n_vars, sizeof *kw); /* If the independent variable is missing, then we ignore the case */ - input = casereader_create_filter_missing (input, + input = casereader_create_filter_missing (input, &nst->indep_var, 1, exclude, NULL, NULL); @@ -145,7 +145,7 @@ kruskal_wallis_execute (const struct dataset *ds, input = casereader_create_filter_weight (input, dict, &warn, NULL); /* Remove all those cases which are outside the range (val1, val2) */ - input = casereader_create_filter_func (input, include_func, NULL, + input = casereader_create_filter_func (input, include_func, NULL, CONST_CAST (struct n_sample_test *, nst), NULL); proto = casereader_get_proto (input); @@ -167,7 +167,7 @@ kruskal_wallis_execute (const struct dataset *ds, exclude, NULL, NULL); - rr = casereader_create_append_rank (r, + rr = casereader_create_append_rank (r, nst->vars[i], dict_get_weight (dict), &rerr, @@ -178,7 +178,7 @@ kruskal_wallis_execute (const struct dataset *ds, { const union value *group = case_data (c, nst->indep_var); const size_t group_var_width = var_get_width (nst->indep_var); - struct rank_entry *rank = find_rank_entry (&kw[i].map, group, group_var_width); + struct rank_entry *rank = find_rank_entry (&kw[i].map, group, group_var_width); if ( NULL == rank) { @@ -212,14 +212,14 @@ kruskal_wallis_execute (const struct dataset *ds, total_n_groups ++; } kw[i].h *= 12 / (n * ( n + 1)); - kw[i].h -= 3 * (n + 1) ; + kw[i].h -= 3 * (n + 1) ; kw[i].h /= 1 - tiebreaker/ (pow3 (n) - n); } } casereader_destroy (input); - + show_ranks_box (nst, kw, total_n_groups); show_sig_box (nst, kw); @@ -265,7 +265,7 @@ show_ranks_box (const struct n_sample_test *nst, const struct kw *kw, int n_grou tab_box (table, TAL_2, TAL_2, -1, -1, 0, 0, tab_nc (table) - 1, tab_nr (table) - 1 ); - tab_text (table, 1, 0, TAT_TITLE, + tab_text (table, 1, 0, TAT_TITLE, var_to_string (nst->indep_var) ); @@ -286,7 +286,7 @@ show_ranks_box (const struct n_sample_test *nst, const struct kw *kw, int n_grou if (i > 0) tab_hline (table, TAL_1, 0, tab_nc (table) -1, row); - + tab_text (table, 0, row, TAT_TITLE, var_to_string (nst->vars[i])); @@ -308,13 +308,13 @@ show_ranks_box (const struct n_sample_test *nst, const struct kw *kw, int n_grou struct string str; ds_init_empty (&str); - + var_append_value_name (nst->indep_var, &re->group, &str); - + tab_text (table, 1, row, TAB_LEFT, ds_cstr (&str)); tab_double (table, 2, row, TAB_LEFT, re->n, NULL, RC_INTEGER); tab_double (table, 3, row, TAB_LEFT, re->sum_of_ranks / re->n, NULL, RC_OTHER); - + tot += re->n; row++; ds_destroy (&str); @@ -362,7 +362,7 @@ show_sig_box (const struct n_sample_test *nst, const struct kw *kw) for (i = 0 ; i < nst->n_vars; ++i) { const double df = hmap_count (&kw[i].map) - 1; - tab_text (table, column_headers + 1 + i, 0, TAT_TITLE, + tab_text (table, column_headers + 1 + i, 0, TAT_TITLE, var_to_string (nst->vars[i]) ); diff --git a/src/language/stats/ks-one-sample.c b/src/language/stats/ks-one-sample.c index d571693cd8..ea7ac71b7e 100644 --- a/src/language/stats/ks-one-sample.c +++ b/src/language/stats/ks-one-sample.c @@ -93,7 +93,7 @@ theoretical_exponential (const struct ks *ks, double x) } -static const theoreticalfp theoreticalf[4] = +static const theoreticalfp theoreticalf[4] = { theoretical_normal, theoretical_uniform, @@ -101,7 +101,7 @@ static const theoreticalfp theoreticalf[4] = theoretical_exponential }; -/* +/* Return the assymptotic approximation to the significance of Z */ static double @@ -109,7 +109,7 @@ ks_asymp_sig (double z) { if (z < 0.27) return 1; - + if (z >= 3.1) return 0; @@ -166,7 +166,7 @@ ks_one_sample_execute (const struct dataset *ds, { const struct variable *var = ost->vars[v]; const union value *val = case_data (c, var); - + if (var_is_value_missing (var, val, exclude)) continue; @@ -215,7 +215,7 @@ ks_one_sample_execute (const struct dataset *ds, case KS_EXPONENTIAL: if (kst->p[0] != SYSMIS) ks[v].mu = ks[v].sigma = kst->p[0]; - else + else ks[v].mu = ks[v].sigma = ks[v].sum / ks[v].obs_cc; break; default: @@ -236,19 +236,19 @@ ks_one_sample_execute (const struct dataset *ds, cc += weight; empirical = cc / ks[v].obs_cc; - + theoretical = theoreticalf[kst->dist] (&ks[v], val->f); - + d = empirical - theoretical; dp = prev_empirical - theoretical; if (d > 0) - maximize (&ks[v].diff_pos, d); + maximize (&ks[v].diff_pos, d); else minimize (&ks[v].diff_neg, d); if (dp > 0) - maximize (&ks[v].diff_pos, dp); + maximize (&ks[v].diff_pos, dp); else minimize (&ks[v].diff_neg, dp); @@ -297,7 +297,7 @@ show_results (const struct ks *ks, case KS_NORMAL: tab_text (table, 0, 2, TAT_TITLE | TAB_LEFT , _("Normal Parameters")); - + tab_text (table, 1, 2, TAT_TITLE | TAB_LEFT , _("Mean")); tab_text (table, 1, 3, @@ -306,7 +306,7 @@ show_results (const struct ks *ks, case KS_UNIFORM: tab_text (table, 0, 2, TAT_TITLE | TAB_LEFT , _("Uniform Parameters")); - + tab_text (table, 1, 2, TAT_TITLE | TAB_LEFT , _("Minimum")); tab_text (table, 1, 3, @@ -315,14 +315,14 @@ show_results (const struct ks *ks, case KS_POISSON: tab_text (table, 0, 2, TAT_TITLE | TAB_LEFT , _("Poisson Parameters")); - + tab_text (table, 1, 2, TAT_TITLE | TAB_LEFT , _("Lambda")); break; case KS_EXPONENTIAL: tab_text (table, 0, 2, TAT_TITLE | TAB_LEFT , _("Exponential Parameters")); - + tab_text (table, 1, 2, TAT_TITLE | TAB_LEFT , _("Scale")); break; @@ -338,7 +338,7 @@ show_results (const struct ks *ks, double z = 0; const int col = 2 + i; tab_text (table, col, 0, - TAT_TITLE | TAB_CENTER , + TAT_TITLE | TAB_CENTER , var_to_string (kst->parent.vars[i])); switch (kst->dist) diff --git a/src/language/stats/logistic.c b/src/language/stats/logistic.c index f8debbaaa3..b8ebb70cf7 100644 --- a/src/language/stats/logistic.c +++ b/src/language/stats/logistic.c @@ -15,21 +15,21 @@ along with this program. If not, see . */ -/* - References: +/* + References: 1. "Coding Logistic Regression with Newton-Raphson", James McCaffrey http://msdn.microsoft.com/en-us/magazine/jj618304.aspx 2. "SPSS Statistical Algorithms" Chapter LOGISTIC REGRESSION Algorithms - The Newton Raphson method finds successive approximations to $\bf b$ where + The Newton Raphson method finds successive approximations to $\bf b$ where approximation ${\bf b}_t$ is (hopefully) better than the previous ${\bf b}_{t-1}$. $ {\bf b}_t = {\bf b}_{t -1} + ({\bf X}^T{\bf W}_{t-1}{\bf X})^{-1}{\bf X}^T({\bf y} - {\bf \pi}_{t-1})$ where: - $\bf X$ is the $n \times p$ design matrix, $n$ being the number of cases, + $\bf X$ is the $n \times p$ design matrix, $n$ being the number of cases, $p$ the number of parameters, \par $\bf W$ is the diagonal matrix whose diagonal elements are $\hat{\pi}_0(1 - \hat{\pi}_0), \, \hat{\pi}_1(1 - \hat{\pi}_2)\dots \hat{\pi}_{n-1}(1 - \hat{\pi}_{n-1})$ @@ -39,7 +39,7 @@ #include -#include +#include #include #include @@ -146,7 +146,7 @@ struct lr_spec */ struct lr_result { - /* Used to indicate if a pass should flag a warning when + /* Used to indicate if a pass should flag a warning when invalid (ie negative or missing) weight values are encountered */ bool warn_bad_weight; @@ -174,7 +174,7 @@ struct lr_result /* The estimates of the predictor coefficients */ gsl_vector *beta_hat; - /* The predicted classifications: + /* The predicted classifications: True Negative, True Positive, False Negative, False Positive */ double tn, tp, fn, fp; }; @@ -208,7 +208,7 @@ static void output_categories (const struct lr_spec *cmd, const struct lr_result static void output_depvarmap (const struct lr_spec *cmd, const struct lr_result *); -static void output_variables (const struct lr_spec *cmd, +static void output_variables (const struct lr_spec *cmd, const struct lr_result *); static void output_model_summary (const struct lr_result *, @@ -220,13 +220,13 @@ static void case_processing_summary (const struct lr_result *); /* Return the value of case C corresponding to the INDEX'th entry in the model */ static double -predictor_value (const struct ccase *c, - const struct variable **x, size_t n_x, +predictor_value (const struct ccase *c, + const struct variable **x, size_t n_x, const struct categoricals *cats, size_t index) { /* Values of the scalar predictor variables */ - if (index < n_x) + if (index < n_x) return case_data (c, x[index])->f; /* Coded values of categorical predictor variables (or interactions) */ @@ -245,8 +245,8 @@ predictor_value (const struct ccase *c, Return the probability beta_hat (that is the estimator logit(y) ) corresponding to the coefficient estimator for case C */ -static double -pi_hat (const struct lr_spec *cmd, +static double +pi_hat (const struct lr_spec *cmd, const struct lr_result *res, const struct variable **x, size_t n_x, const struct ccase *c) @@ -260,10 +260,10 @@ pi_hat (const struct lr_spec *cmd, pi += gsl_vector_get (res->beta_hat, res->beta_hat->size - 1); n_coeffs--; } - + for (v0 = 0; v0 < n_coeffs; ++v0) { - pi += gsl_vector_get (res->beta_hat, v0) * + pi += gsl_vector_get (res->beta_hat, v0) * predictor_value (c, x, n_x, res->cats, v0); } @@ -276,14 +276,14 @@ pi_hat (const struct lr_spec *cmd, /* Calculates the Hessian matrix X' V X, where: X is the n by N_X matrix comprising the n cases in INPUT - V is a diagonal matrix { (pi_hat_0)(1 - pi_hat_0), (pi_hat_1)(1 - pi_hat_1), ... (pi_hat_{N-1})(1 - pi_hat_{N-1})} + V is a diagonal matrix { (pi_hat_0)(1 - pi_hat_0), (pi_hat_1)(1 - pi_hat_1), ... (pi_hat_{N-1})(1 - pi_hat_{N-1})} (the partial derivative of the predicted values) If ALL predicted values derivatives are close to zero or one, then CONVERGED will be set to true. */ static void -hessian (const struct lr_spec *cmd, +hessian (const struct lr_spec *cmd, struct lr_result *res, struct casereader *input, const struct variable **x, size_t n_x, @@ -330,7 +330,7 @@ hessian (const struct lr_spec *cmd, /* Calculates the value X' (y - pi) - where X is the design model, + where X is the design model, y is the vector of observed independent variables pi is the vector of estimates for y @@ -417,7 +417,7 @@ frq_update (const void *aux1 UNUSED, void *aux2 UNUSED, *freq += weight; } -static void +static void frq_destroy (const void *aux1 UNUSED, void *aux2 UNUSED, void *user_data UNUSED) { free (user_data); @@ -425,7 +425,7 @@ frq_destroy (const void *aux1 UNUSED, void *aux2 UNUSED, void *user_data UNUSED) -/* +/* Makes an initial pass though the data, doing the following: * Checks that the dependent variable is dichotomous, @@ -482,7 +482,7 @@ initial_pass (const struct lr_spec *cmd, struct lr_result *res, struct casereade { missing = true; } - else + else for (v = 0; v < cmd->n_indep_vars; ++v) { const union value *val = case_data (c, cmd->indep_vars[v]); @@ -601,14 +601,14 @@ run_lr (const struct lr_spec *cmd, struct casereader *input, And perform other auxilliary initialisation. */ if (! initial_pass (cmd, &work, input)) goto error; - + for (i = 0; i < cmd->n_cat_predictors; ++i) { if (1 >= categoricals_n_count (work.cats, i)) { struct string str; ds_init_empty (&str); - + interaction_to_string (cmd->cat_predictors[i], &str); msg (ME, _("Category %s does not have at least two distinct values. Logistic regression will not be run."), @@ -645,7 +645,7 @@ run_lr (const struct lr_spec *cmd, struct casereader *input, double min, max; gsl_vector *v ; - + hessian (cmd, &work, input, cmd->predictor_vars, cmd->n_predictor_vars, &converged); @@ -697,7 +697,7 @@ run_lr (const struct lr_spec *cmd, struct casereader *input, - if ( ! converged) + if ( ! converged) msg (MW, _("Estimation terminated at iteration number %d because maximum iterations has been reached"), i ); @@ -711,7 +711,7 @@ run_lr (const struct lr_spec *cmd, struct casereader *input, casereader_destroy (input); gsl_matrix_free (work.hessian); - gsl_vector_free (work.beta_hat); + gsl_vector_free (work.beta_hat); categoricals_destroy (work.cats); return true; @@ -719,7 +719,7 @@ run_lr (const struct lr_spec *cmd, struct casereader *input, error: casereader_destroy (input); gsl_matrix_free (work.hessian); - gsl_vector_free (work.beta_hat); + gsl_vector_free (work.beta_hat); categoricals_destroy (work.cats); return false; @@ -739,10 +739,10 @@ lookup_variable (const struct hmap *map, const struct variable *var, unsigned in { if (vn->var == var) break; - + fprintf (stderr, "Warning: Hash table collision\n"); } - + return vn; } @@ -842,7 +842,7 @@ cmd_logistic (struct lexer *lexer, struct dataset *ds) sizeof (*lr.cat_predictors) * ++lr.n_cat_predictors); lr.cat_predictors[lr.n_cat_predictors - 1] = 0; } - while (parse_design_interaction (lexer, lr.dict, + while (parse_design_interaction (lexer, lr.dict, lr.cat_predictors + lr.n_cat_predictors - 1)); lr.n_cat_predictors--; } @@ -990,7 +990,7 @@ cmd_logistic (struct lexer *lexer, struct dataset *ds) goto error; } cp = lex_number (lexer); - + if (cp < 0 || cp > 1.0) { msg (ME, _("Cut point value must be in the range [0,1]")); @@ -1019,9 +1019,9 @@ cmd_logistic (struct lexer *lexer, struct dataset *ds) } lr.ilogit_cut_point = - log (1/cp - 1); - - /* Copy the predictor variables from the temporary location into the + + /* Copy the predictor variables from the temporary location into the final one, dropping any categorical variables which appear there. FIXME: This is O(NxM). */ @@ -1057,7 +1057,7 @@ cmd_logistic (struct lexer *lexer, struct dataset *ds) { vn = xmalloc (sizeof *vn); vn->var = ivar; - + hmap_insert (&allvars, &vn->node, hash); } @@ -1088,7 +1088,7 @@ cmd_logistic (struct lexer *lexer, struct dataset *ds) free (vn); } hmap_destroy (&allvars); - } + } /* logistical regression for each split group */ @@ -1179,7 +1179,7 @@ output_depvarmap (const struct lr_spec *cmd, const struct lr_result *res) /* Show the Variables in the Equation box */ static void -output_variables (const struct lr_spec *cmd, +output_variables (const struct lr_spec *cmd, const struct lr_result *res) { int row = 0; @@ -1233,7 +1233,7 @@ output_variables (const struct lr_spec *cmd, tab_text (t, 8, row, TAB_CENTER | TAT_TITLE, _("Lower")); tab_text (t, 9, row, TAB_CENTER | TAT_TITLE, _("Upper")); } - + for (row = heading_rows ; row < nr; ++row) { const int idx = row - heading_rows - idx_correction; @@ -1245,7 +1245,7 @@ output_variables (const struct lr_spec *cmd, if (idx < cmd->n_predictor_vars) { - tab_text (t, 1, row, TAB_LEFT | TAT_TITLE, + tab_text (t, 1, row, TAB_LEFT | TAT_TITLE, var_to_string (cmd->predictor_vars[idx])); } else if (i < cmd->n_cat_predictors) @@ -1264,7 +1264,7 @@ output_variables (const struct lr_spec *cmd, /* Calculate the Wald statistic, which is \beta' C^-1 \beta . where \beta is the vector of the coefficient estimates comprising this - categorial variable. and C is the corresponding submatrix of the + categorial variable. and C is the corresponding submatrix of the hessian matrix. */ gsl_matrix_const_view mv = @@ -1499,7 +1499,7 @@ output_categories (const struct lr_spec *cmd, const struct lr_result *res) struct string str; const struct ccase *c = categoricals_get_case_by_category_real (res->cats, v, cat); const double *freq = categoricals_get_user_data_by_category_real (res->cats, v, cat); - + int x; ds_init_empty (&str); @@ -1511,7 +1511,7 @@ output_categories (const struct lr_spec *cmd, const struct lr_result *res) if (x < cat_predictors->n_vars - 1) ds_put_cstr (&str, " "); } - + tab_text (t, 1, heading_rows + r, 0, ds_cstr (&str)); ds_destroy (&str); tab_double (t, 2, heading_rows + r, 0, *freq, NULL, RC_WEIGHT); @@ -1530,7 +1530,7 @@ output_categories (const struct lr_spec *cmd, const struct lr_result *res) } -static void +static void output_classification_table (const struct lr_spec *cmd, const struct lr_result *res) { const struct fmt_spec *wfmt = @@ -1566,7 +1566,7 @@ output_classification_table (const struct lr_spec *cmd, const struct lr_result * tab_joint_text (t, heading_columns, 0, nc - 1, 0, TAB_CENTER | TAT_TITLE, _("Predicted")); - tab_joint_text (t, heading_columns, 1, heading_columns + 1, 1, + tab_joint_text (t, heading_columns, 1, heading_columns + 1, 1, 0, var_to_string (cmd->dep_var) ); tab_joint_text (t, 1, 2, 2, 2, @@ -1606,7 +1606,7 @@ output_classification_table (const struct lr_spec *cmd, const struct lr_result * tab_double (t, heading_columns + 2, 3, 0, 100 * res->tn / (res->tn + res->fp), NULL, RC_OTHER); tab_double (t, heading_columns + 2, 4, 0, 100 * res->tp / (res->tp + res->fn), NULL, RC_OTHER); - tab_double (t, heading_columns + 2, 5, 0, + tab_double (t, heading_columns + 2, 5, 0, 100 * (res->tp + res->tn) / (res->tp + res->tn + res->fp + res->fn), NULL, RC_OTHER); diff --git a/src/language/stats/mann-whitney.c b/src/language/stats/mann-whitney.c index 6fc4775cd2..e117cc366c 100644 --- a/src/language/stats/mann-whitney.c +++ b/src/language/stats/mann-whitney.c @@ -47,7 +47,7 @@ struct mw double u; /* The Mann-Whitney U statistic */ double w; /* The Wilcoxon Rank Sum W statistic */ - double z; + double z; }; static void show_ranks_box (const struct n_sample_test *nst, const struct mw *mw); @@ -72,7 +72,7 @@ belongs_to_test (const struct ccase *c, void *aux) return false; } - + void mann_whitney_execute (const struct dataset *ds, @@ -100,7 +100,7 @@ mann_whitney_execute (const struct dataset *ds, struct ccase *c; const struct variable *var = nst->vars[i]; - struct casereader *reader = + struct casereader *reader = casereader_create_filter_func (casereader_clone (input), belongs_to_test, NULL, @@ -159,7 +159,7 @@ mann_whitney_execute (const struct dataset *ds, denominator -= tiebreaker; denominator *= mwv->n[0] * mwv->n[1]; denominator /= n * (n - 1); - + mwv->z /= sqrt (denominator); } } @@ -292,7 +292,7 @@ show_statistics_box (const struct n_sample_test *nst, const struct mw *mwv, bool tab_text (table, 3, 0, TAT_TITLE | TAB_CENTER, _("Z")); tab_text (table, 4, 0, TAT_TITLE | TAB_CENTER, _("Asymp. Sig. (2-tailed)")); - if (exact) + if (exact) { tab_text (table, 5, 0, TAT_TITLE | TAB_CENTER, _("Exact Sig. (2-tailed)")); tab_text (table, 6, 0, TAT_TITLE | TAB_CENTER, _("Point Probability")); diff --git a/src/language/stats/mcnemar.c b/src/language/stats/mcnemar.c index 56fe088de6..648dc9c3f7 100644 --- a/src/language/stats/mcnemar.c +++ b/src/language/stats/mcnemar.c @@ -31,7 +31,7 @@ #include "libpspp/str.h" #include "output/tab.h" #include "libpspp/message.h" - + #include "gl/minmax.h" #include "gl/xalloc.h" @@ -79,7 +79,7 @@ mcnemar_execute (const struct dataset *ds, const struct two_sample_test *t2s = UP_CAST (test, const struct two_sample_test, parent); struct ccase *c; - + struct casereader *r = input; struct mcnemar *mc = xcalloc (t2s->n_pairs, sizeof *mc); @@ -178,7 +178,7 @@ output_freq_table (variable_pair *vp, ds_init_empty (&val0str); ds_init_empty (&val1str); - + var_append_value_name ((*vp)[0], ¶m->val0, &val0str); var_append_value_name ((*vp)[1], ¶m->val1, &val1str); diff --git a/src/language/stats/means.c b/src/language/stats/means.c index 4d5d83fa92..debb443676 100644 --- a/src/language/stats/means.c +++ b/src/language/stats/means.c @@ -395,7 +395,7 @@ first_get (const struct per_var_data *pvd UNUSED, void *stat) return *f; } -enum +enum { MEANS_MEAN = 0, MEANS_N, @@ -516,11 +516,11 @@ parse_means_table_syntax (struct lexer *lexer, const struct means *cmd, struct m if (lex_match (lexer, T_BY)) { table->n_layers++; - table->layers = - pool_realloc (cmd->pool, table->layers, + table->layers = + pool_realloc (cmd->pool, table->layers, sizeof (*table->layers) * table->n_layers); - if (!parse_variables_const_pool + if (!parse_variables_const_pool (lexer, cmd->pool, cmd->dict, &table->layers[table->n_layers - 1].factor_vars, &table->layers[table->n_layers - 1].n_factor_vars, @@ -532,13 +532,13 @@ parse_means_table_syntax (struct lexer *lexer, const struct means *cmd, struct m /* There is always at least one layer. However the final layer is the total, and not - normally considered by the user as a + normally considered by the user as a layer. */ table->n_layers++; - table->layers = - pool_realloc (cmd->pool, table->layers, + table->layers = + pool_realloc (cmd->pool, table->layers, sizeof (*table->layers) * table->n_layers); table->layers[table->n_layers - 1].factor_vars = NULL; table->layers[table->n_layers - 1].n_factor_vars = 0; @@ -609,7 +609,7 @@ cmd_means (struct lexer *lexer, struct dataset *ds) means.n_tables ++; means.table = pool_realloc (means.pool, means.table, means.n_tables * sizeof (*means.table)); - if (! parse_means_table_syntax (lexer, &means, + if (! parse_means_table_syntax (lexer, &means, &means.table[means.n_tables - 1])) { goto error; @@ -664,7 +664,7 @@ cmd_means (struct lexer *lexer, struct dataset *ds) else if (lex_match_id (lexer, "DEPENDENT")) /* Use the command "/MISSING=DEPENDENT" to - include user-missing values for the categorical variables, + include user-missing values for the categorical variables, while excluding them for the dependent variables. Cases are dropped only when user-missing values @@ -672,7 +672,7 @@ cmd_means (struct lexer *lexer, struct dataset *ds) values for categorical variables are treated according to their face value. - Cases are ALWAYS dropped when System Missing values appear + Cases are ALWAYS dropped when System Missing values appear in the categorical variables. */ { @@ -714,7 +714,7 @@ cmd_means (struct lexer *lexer, struct dataset *ds) means.cells = pool_realloc (means.pool, means.cells, (means.n_cells += 3) * sizeof (*means.cells)); - + means.cells[means.n_cells - 2 - 1] = MEANS_MEAN; means.cells[means.n_cells - 1 - 1] = MEANS_N; means.cells[means.n_cells - 0 - 1] = MEANS_STDDEV; @@ -728,7 +728,7 @@ cmd_means (struct lexer *lexer, struct dataset *ds) means.cells = pool_realloc (means.pool, means.cells, ++means.n_cells * sizeof (*means.cells)); - + means.cells[means.n_cells - 1] = k; break; } @@ -812,9 +812,9 @@ cmd_means (struct lexer *lexer, struct dataset *ds) for (l = 0; l < table->n_layers; ++l) { interaction_destroy (table->interactions[l]); - } + } } - + pool_destroy (means.pool); return CMD_FAILURE; } @@ -851,7 +851,7 @@ struct per_cat_data }; -static void +static void destroy_n (const void *aux1 UNUSED, void *aux2, void *user_data) { struct mtable *table = aux2; @@ -882,7 +882,7 @@ create_n (const void *aux1, void *aux2) struct per_var_data *pp = &pvd[v]; pp->cell_stats = pool_calloc (means->pool, means->n_cells, sizeof *pp->cell_stats); - + for (i = 0; i < means->n_cells; ++i) { @@ -979,7 +979,7 @@ run_means (struct means *cmd, struct casereader *input, payload.update = update_n; payload.calculate = calculate_n; payload.destroy = destroy_n; - + for (t = 0; t < cmd->n_tables; ++t) { struct mtable *table = &cmd->table[t]; @@ -1111,14 +1111,14 @@ output_case_processing_summary (const struct mtable *table) TAB_LEFT | TAT_TITLE, ds_cstr (&str)); - n_total = table->summary[row].missing + + n_total = table->summary[row].missing + table->summary[row].non_missing; tab_double (t, 1, row + heading_rows, 0, table->summary[row].non_missing, NULL, RC_INTEGER); tab_text_format (t, 2, row + heading_rows, - 0, _("%g%%"), + 0, _("%g%%"), table->summary[row].non_missing / (double) n_total * 100.0); @@ -1127,16 +1127,16 @@ output_case_processing_summary (const struct mtable *table) tab_text_format (t, 4, row + heading_rows, - 0, _("%g%%"), + 0, _("%g%%"), table->summary[row].missing / (double) n_total * 100.0); tab_double (t, 5, row + heading_rows, - 0, table->summary[row].missing + + 0, table->summary[row].missing + table->summary[row].non_missing, NULL, RC_INTEGER); tab_text_format (t, 6, row + heading_rows, - 0, _("%g%%"), + 0, _("%g%%"), n_total / (double) n_total * 100.0); diff --git a/src/language/stats/median.c b/src/language/stats/median.c index 20e414259f..49a4bc12e8 100644 --- a/src/language/stats/median.c +++ b/src/language/stats/median.c @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see . + along with this program. If not, see . */ #include @@ -61,12 +61,12 @@ struct results struct val_node **sorted_array; double n; double median; - double chisq; + double chisq; }; -static int +static int val_node_cmp_3way (const void *a_, const void *b_, const void *aux) { const struct variable *indep_var = aux; @@ -76,15 +76,15 @@ val_node_cmp_3way (const void *a_, const void *b_, const void *aux) return value_compare_3way (&(*a)->val, &(*b)->val, var_get_width (indep_var)); } -static void +static void show_frequencies (const struct n_sample_test *nst, const struct results *results, int n_vals, const struct dictionary *); -static void +static void show_test_statistics (const struct n_sample_test *nst, const struct results *results, int, const struct dictionary *); static struct val_node * -find_value (const struct hmap *map, const union value *val, +find_value (const struct hmap *map, const union value *val, const struct variable *var) { struct val_node *foo = NULL; @@ -174,7 +174,7 @@ median_execute (const struct dataset *ds, ptl = percentile_create (0.5, cc); os = &ptl->parent; - + order_stats_accumulate (&os, 1, rr, wvar, @@ -186,7 +186,7 @@ median_execute (const struct dataset *ds, } results[v].median = median; - + for (; (c = casereader_read (r)) != NULL; case_unref (c)) { @@ -222,7 +222,7 @@ median_execute (const struct dataset *ds, int width = var_get_width (nst->indep_var); vn = xzalloc (sizeof *vn); value_clone (&vn->val, indep_val, width); - + hmap_insert (&map, &vn->node, value_hash (indep_val, width, 0)); } else @@ -269,7 +269,7 @@ median_execute (const struct dataset *ds, n_vals = x; hmap_destroy (&map); - sort (results[v].sorted_array, x, sizeof (*results[v].sorted_array), + sort (results[v].sorted_array, x, sizeof (*results[v].sorted_array), val_node_cmp_3way, nst->indep_var); } @@ -298,7 +298,7 @@ median_execute (const struct dataset *ds, -static void +static void show_frequencies (const struct n_sample_test *nst, const struct results *results, int n_vals, const struct dictionary *dict) { const struct variable *weight = dict_get_weight (dict); @@ -311,7 +311,7 @@ show_frequencies (const struct n_sample_test *nst, const struct results *results const int column_headers = 2; const int nc = row_headers + n_vals; const int nr = column_headers + nst->n_vars * 2; - + struct tab_table *table = tab_create (nc, nr); tab_set_format (table, RC_WEIGHT, wfmt); @@ -345,7 +345,7 @@ show_frequencies (const struct n_sample_test *nst, const struct results *results tab_text (table, row_headers + i, 1, TAT_TITLE | TAB_LEFT, ds_cstr (&label)); - + ds_destroy (&label); } @@ -385,7 +385,7 @@ show_frequencies (const struct n_sample_test *nst, const struct results *results } -static void +static void show_test_statistics (const struct n_sample_test *nst, const struct results *results, int n_vals, @@ -400,7 +400,7 @@ show_test_statistics (const struct n_sample_test *nst, const int column_headers = 1; const int nc = row_headers + 5; const int nr = column_headers + nst->n_vars; - + struct tab_table *table = tab_create (nc, nr); tab_set_format (table, RC_WEIGHT, wfmt); @@ -454,6 +454,6 @@ show_test_statistics (const struct n_sample_test *nst, tab_double (table, row_headers + 4, column_headers + v, 0, gsl_cdf_chisq_Q (rs->chisq, df), NULL, RC_PVALUE); } - + tab_submit (table); } diff --git a/src/language/stats/npar.c b/src/language/stats/npar.c index e9e2e61b2f..071a02ee16 100644 --- a/src/language/stats/npar.c +++ b/src/language/stats/npar.c @@ -601,7 +601,7 @@ cmd_npar_tests (struct lexer *lexer, struct dataset *ds) } } - sort (npar_specs.vv, npar_specs.n_vars, sizeof (*npar_specs.vv), + sort (npar_specs.vv, npar_specs.n_vars, sizeof (*npar_specs.vv), compare_var_ptrs_by_name, NULL); if ( cmd.statistics ) @@ -690,13 +690,13 @@ npar_runs (struct lexer *lexer, struct dataset *ds, lex_error (lexer, _("Expecting %s, %s, %s or a number."), "MEAN", "MEDIAN", "MODE"); return 0; } - + if (! lex_force_match (lexer, T_RPAREN)) return 2; - + if (! lex_force_match (lexer, T_EQUALS)) return 2; - + if (!parse_variables_const_pool (lexer, specs->pool, dataset_dict (ds), &tp->vars, &tp->n_vars, PV_NO_SCRATCH | PV_NO_DUPLICATE | PV_NUMERIC)) @@ -719,7 +719,7 @@ static int npar_friedman (struct lexer *lexer, struct dataset *ds, struct npar_specs *specs) { - struct friedman_test *ft = pool_alloc (specs->pool, sizeof (*ft)); + struct friedman_test *ft = pool_alloc (specs->pool, sizeof (*ft)); struct one_sample_test *ost = &ft->parent; struct npar_test *nt = &ost->parent; @@ -750,7 +750,7 @@ static int npar_kendall (struct lexer *lexer, struct dataset *ds, struct npar_specs *specs) { - struct friedman_test *kt = pool_alloc (specs->pool, sizeof (*kt)); + struct friedman_test *kt = pool_alloc (specs->pool, sizeof (*kt)); struct one_sample_test *ost = &kt->parent; struct npar_test *nt = &ost->parent; @@ -782,7 +782,7 @@ static int npar_cochran (struct lexer *lexer, struct dataset *ds, struct npar_specs *specs) { - struct one_sample_test *ft = pool_alloc (specs->pool, sizeof (*ft)); + struct one_sample_test *ft = pool_alloc (specs->pool, sizeof (*ft)); struct npar_test *nt = &ft->parent; nt->execute = cochran_execute; @@ -1414,7 +1414,7 @@ insert_variable_into_map (struct hmapx *var_map, const struct variable *var) size_t hash = hash_pointer (var, 0); struct hmapx_node *node; const struct variable *v = NULL; - + HMAPX_FOR_EACH_WITH_HASH (v, node, hash, var_map) { if ( v == var) @@ -1453,7 +1453,7 @@ two_sample_insert_variables (const struct npar_test *test, } } -static void +static void n_sample_insert_variables (const struct npar_test *test, struct hmapx *var_map) { diff --git a/src/language/stats/oneway.c b/src/language/stats/oneway.c index 791ee86978..858d825319 100644 --- a/src/language/stats/oneway.c +++ b/src/language/stats/oneway.c @@ -93,14 +93,14 @@ enum statistics struct coeff_node { - struct ll ll; - double coeff; + struct ll ll; + double coeff; }; struct contrasts_node { - struct ll ll; + struct ll ll; struct ll_list coefficient_list; }; @@ -164,9 +164,9 @@ df_individual (const struct per_var_ws *pvw UNUSED, const struct moments1 *mom_i double n_j, var_j; double nom,denom; - moments1_calculate (mom_i, &n_i, NULL, &var_i, 0, 0); + moments1_calculate (mom_i, &n_i, NULL, &var_i, 0, 0); moments1_calculate (mom_j, &n_j, NULL, &var_j, 0, 0); - + if ( n_i <= 1.0 || n_j <= 1.0) return SYSMIS; @@ -214,7 +214,7 @@ static double gh_pinv (double std_err UNUSED, double alpha, double df, int k, co double n_j, mean_j, var_j; double m; - moments1_calculate (mom_i, &n_i, &mean_i, &var_i, 0, 0); + moments1_calculate (mom_i, &n_i, &mean_i, &var_i, 0, 0); moments1_calculate (mom_j, &n_j, &mean_j, &var_j, 0, 0); m = sqrt ((var_i/n_i + var_j/n_j) / 2.0); @@ -226,7 +226,7 @@ static double gh_pinv (double std_err UNUSED, double alpha, double df, int k, co } -static double +static double multiple_comparison_sig (double std_err, const struct per_var_ws *pvw, const struct descriptive_data *dd_i, const struct descriptive_data *dd_j, @@ -240,7 +240,7 @@ multiple_comparison_sig (double std_err, return ph->p1f (ts, k - 1, df); } -static double +static double mc_half_range (const struct oneway_spec *cmd, const struct per_var_ws *pvw, double std_err, const struct descriptive_data *dd_i, const struct descriptive_data *dd_j, const struct posthoc *ph) { int k = pvw->n_groups; @@ -298,7 +298,7 @@ static double tukey_test_stat (int k UNUSED, const struct moments1 *mom_i, const double n_i, mean_i, var_i; double n_j, mean_j, var_j; - moments1_calculate (mom_i, &n_i, &mean_i, &var_i, 0, 0); + moments1_calculate (mom_i, &n_i, &mean_i, &var_i, 0, 0); moments1_calculate (mom_j, &n_j, &mean_j, &var_j, 0, 0); ts = (mean_i - mean_j) / std_err; @@ -312,7 +312,7 @@ static double lsd_test_stat (int k UNUSED, const struct moments1 *mom_i, const s double n_i, mean_i, var_i; double n_j, mean_j, var_j; - moments1_calculate (mom_i, &n_i, &mean_i, &var_i, 0, 0); + moments1_calculate (mom_i, &n_i, &mean_i, &var_i, 0, 0); moments1_calculate (mom_j, &n_j, &mean_j, &var_j, 0, 0); return (mean_i - mean_j) / std_err; @@ -324,7 +324,7 @@ static double scheffe_test_stat (int k, const struct moments1 *mom_i, const stru double n_i, mean_i, var_i; double n_j, mean_j, var_j; - moments1_calculate (mom_i, &n_i, &mean_i, &var_i, 0, 0); + moments1_calculate (mom_i, &n_i, &mean_i, &var_i, 0, 0); moments1_calculate (mom_j, &n_j, &mean_j, &var_j, 0, 0); t = (mean_i - mean_j) / std_err; @@ -341,7 +341,7 @@ static double gh_test_stat (int k UNUSED, const struct moments1 *mom_i, const st double n_i, mean_i, var_i; double n_j, mean_j, var_j; - moments1_calculate (mom_i, &n_i, &mean_i, &var_i, 0, 0); + moments1_calculate (mom_i, &n_i, &mean_i, &var_i, 0, 0); moments1_calculate (mom_j, &n_j, &mean_j, &var_j, 0, 0); thing = var_i / n_i + var_j / n_j; @@ -355,7 +355,7 @@ static double gh_test_stat (int k UNUSED, const struct moments1 *mom_i, const st -static const struct posthoc ph_tests [] = +static const struct posthoc ph_tests [] = { { "LSD", N_("LSD"), df_common, lsd_test_stat, lsd_1tailsig, lsd_pinv}, { "TUKEY", N_("Tukey HSD"), df_common, tukey_test_stat, tukey_1tailsig, tukey_pinv}, @@ -393,12 +393,12 @@ destroy_coeff_list (struct contrasts_node *coeff_list) struct coeff_node *cn = NULL; struct coeff_node *cnx = NULL; struct ll_list *cl = &coeff_list->coefficient_list; - + ll_for_each_safe (cn, cnx, struct coeff_node, ll, cl) { free (cn); } - + free (coeff_list); } @@ -420,7 +420,7 @@ oneway_cleanup (struct oneway_spec *cmd) int cmd_oneway (struct lexer *lexer, struct dataset *ds) { - const struct dictionary *dict = dataset_dict (ds); + const struct dictionary *dict = dataset_dict (ds); struct oneway_spec oneway ; oneway.n_vars = 0; oneway.vars = NULL; @@ -435,7 +435,7 @@ cmd_oneway (struct lexer *lexer, struct dataset *ds) ll_init (&oneway.contrast_list); - + if ( lex_match (lexer, T_SLASH)) { if (!lex_force_match_id (lexer, "VARIABLES")) @@ -547,7 +547,7 @@ cmd_oneway (struct lexer *lexer, struct dataset *ds) goto error; } } - + if ( ll_count (coefficient_list) <= 0) goto error; @@ -645,7 +645,7 @@ makeit (const void *aux1, void *aux2 UNUSED) return dd; } -static void +static void killit (const void *aux1 UNUSED, void *aux2 UNUSED, void *user_data) { struct descriptive_data *dd = user_data; @@ -654,7 +654,7 @@ killit (const void *aux1 UNUSED, void *aux2 UNUSED, void *user_data) } -static void +static void updateit (const void *aux1, void *aux2, void *user_data, const struct ccase *c, double weight) { @@ -721,13 +721,13 @@ run_oneway (const struct oneway_spec *cmd, ws.vws[v].cat = categoricals_create (&ws.vws[v].iact, 1, cmd->wv, cmd->exclude, cmd->exclude); - categoricals_set_payload (ws.vws[v].cat, &payload, + categoricals_set_payload (ws.vws[v].cat, &payload, CONST_CAST (struct variable *, cmd->vars[v]), ws.dd_total[v]); ws.vws[v].cov = covariance_2pass_create (1, &cmd->vars[v], - ws.vws[v].cat, + ws.vws[v].cat, cmd->wv, cmd->exclude); ws.vws[v].nl = levene_create (var_get_width (cmd->indep_var), NULL); } @@ -831,7 +831,7 @@ run_oneway (const struct oneway_spec *cmd, if ( ! ok) { - msg (MW, + msg (MW, _("Dependent variable %s has no non-missing values. No analysis for this variable will be done."), var_get_name (cmd->vars[v])); continue; @@ -1017,8 +1017,8 @@ show_anova_table (const struct oneway_spec *cmd, const struct oneway_workspace * /* Degrees of freedom */ tab_double (t, 3, i * 3 + 1, 0, df1, NULL, RC_INTEGER); - tab_double (t, 3, i * 3 + 2, 0, df2, NULL, RC_INTEGER); - tab_double (t, 3, i * 3 + 3, 0, n - 1, NULL, RC_INTEGER); + tab_double (t, 3, i * 3 + 2, 0, df2, NULL, RC_INTEGER); + tab_double (t, 3, i * 3 + 3, 0, n - 1, NULL, RC_INTEGER); /* Mean Squares */ tab_double (t, 4, i * 3 + 1, TAB_RIGHT, msa, NULL, RC_OTHER); @@ -1462,7 +1462,7 @@ show_contrast_tests (const struct oneway_spec *cmd, const struct oneway_workspac double n, mean, variance; const struct descriptive_data *dd = categoricals_get_user_data_by_category (cats, ci); struct coeff_node *cn = ll_data (coeffi, struct coeff_node, ll); - const double coef = cn->coeff; + const double coef = cn->coeff; double winv ; moments1_calculate (dd->mom, &n, &mean, &variance, NULL, NULL); @@ -1624,7 +1624,7 @@ show_comparisons (const struct oneway_spec *cmd, const struct oneway_workspace * int j; struct descriptive_data *dd_i = categoricals_get_user_data_by_category (cat, i); const struct ccase *gcc = categoricals_get_case_by_category (cat, i); - + ds_init_empty (&vstr); var_append_value_name (cmd->indep_var, case_data (gcc, cmd->indep_var), &vstr); @@ -1660,7 +1660,7 @@ show_comparisons (const struct oneway_spec *cmd, const struct oneway_workspace * std_err = sqrt (std_err); tab_double (t, 4, r + rx, 0, std_err, NULL, RC_OTHER); - + tab_double (t, 5, r + rx, 0, 2 * multiple_comparison_sig (std_err, pvw, dd_i, dd_j, ph), NULL, RC_PVALUE); half_range = mc_half_range (cmd, pvw, std_err, dd_i, dd_j, ph); diff --git a/src/language/stats/quick-cluster.c b/src/language/stats/quick-cluster.c index ff008db08a..bd22fd1800 100644 --- a/src/language/stats/quick-cluster.c +++ b/src/language/stats/quick-cluster.c @@ -160,7 +160,7 @@ diff_matrix (const gsl_matrix *m1, const gsl_matrix *m2) -static double +static double matrix_mindist (const gsl_matrix *m, int *mn, int *mm) { int i, j; @@ -201,10 +201,10 @@ dist_from_case (const struct Kmeans *kmeans, const struct ccase *c, const struct const union value *val = case_data (c, qc->vars[j]); if ( var_is_value_missing (qc->vars[j], val, qc->exclude)) NOT_REACHED (); - + dist += pow2 (gsl_matrix_get (kmeans->centers, which, j) - val->f); } - + return dist; } @@ -225,7 +225,7 @@ min_dist_from (const struct Kmeans *kmeans, const struct qc *qc, int which) { dist += pow2 (gsl_matrix_get (kmeans->centers, i, j) - gsl_matrix_get (kmeans->centers, which, j)); } - + if (dist < mindist) { mindist = dist; @@ -290,7 +290,7 @@ kmeans_initial_centers (struct Kmeans *kmeans, const struct casereader *reader, } } else if (dist_from_case (kmeans, c, qc, mp) > min_dist_from (kmeans, qc, mq)) - /* If the distance between C and the second nearest group (MP) is greater than the + /* If the distance between C and the second nearest group (MP) is greater than the smallest distance between the nearest group (MQ) and any other group, then replace MQ with C */ { @@ -408,7 +408,7 @@ kmeans_cluster (struct Kmeans *kmeans, struct casereader *reader, const struct q if ( var_is_value_missing (qc->vars[j], val, qc->exclude)) missing = true; } - + if (missing) continue; @@ -436,7 +436,7 @@ kmeans_cluster (struct Kmeans *kmeans, struct casereader *reader, const struct q double *x = gsl_matrix_ptr (kmeans->updated_centers, group, j); *x += val->f * (qc->wv ? case_data (c, qc->wv)->f : 1.0); } - } + } casereader_destroy (r); } @@ -453,7 +453,7 @@ kmeans_cluster (struct Kmeans *kmeans, struct casereader *reader, const struct q *x /= n + 1; // Plus 1 for the initial centers } } - + gsl_matrix_memcpy (kmeans->centers, kmeans->updated_centers); @@ -466,7 +466,7 @@ kmeans_cluster (struct Kmeans *kmeans, struct casereader *reader, const struct q struct casereader *cs = casereader_clone (reader); for (; (c = casereader_read (cs)) != NULL; case_unref (c)) { - int group = -1; + int group = -1; kmeans_get_nearest_group (kmeans, c, qc, &group, NULL, NULL, NULL); for (j = 0; j < qc->n_vars; ++j) @@ -595,7 +595,7 @@ quick_cluster_show_membership (struct Kmeans *kmeans, const struct casereader *r for (i = 0; (c = casereader_read (cs)) != NULL; i++, case_unref (c)) { - int clust = -1; + int clust = -1; assert (i < kmeans->n); kmeans_get_nearest_group (kmeans, c, qc, &clust, NULL, NULL, NULL); clust = ip->data[clust]; @@ -645,7 +645,7 @@ static void quick_cluster_show_results (struct Kmeans *kmeans, const struct casereader *reader, const struct qc *qc) { kmeans_order_groups (kmeans, qc); /* what does this do? */ - + if( qc->print_initial_clusters ) quick_cluster_show_centers (kmeans, true, qc); quick_cluster_show_centers (kmeans, false, qc); @@ -708,7 +708,7 @@ cmd_quick_cluster (struct lexer *lexer, struct dataset *ds) lex_error (lexer, NULL); goto error; } - } + } } else if (lex_match_id (lexer, "PRINT")) { diff --git a/src/language/stats/rank.c b/src/language/stats/rank.c index 9a9ee74969..ee835e6b6a 100644 --- a/src/language/stats/rank.c +++ b/src/language/stats/rank.c @@ -257,7 +257,7 @@ parse_into (struct lexer *lexer, struct rank *cmd, cmd->rs = pool_realloc (cmd->pool, cmd->rs, sizeof (*cmd->rs) * (cmd->n_rs + 1)); rs = &cmd->rs[cmd->n_rs]; - + if (lex_match_id (lexer, "RANK")) { rs->rfunc = RANK; @@ -290,13 +290,13 @@ parse_into (struct lexer *lexer, struct rank *cmd, { if ( !lex_force_match (lexer, T_LPAREN)) return false; - + if (! lex_force_int (lexer) ) return false; - + cmd->k_ntiles = lex_integer (lexer); lex_get (lexer); - + if ( !lex_force_match (lexer, T_RPAREN)) return false; @@ -638,7 +638,7 @@ create_var_label (struct rank *cmd, const struct variable *src_var, function_name[f], var_get_name (src_var)); pool_label = pool_strdup (cmd->pool, ds_cstr (&label)); - + ds_destroy (&label); return pool_label; diff --git a/src/language/stats/regression.c b/src/language/stats/regression.c index a534a8e8ea..f7ec679a1c 100644 --- a/src/language/stats/regression.c +++ b/src/language/stats/regression.c @@ -84,10 +84,10 @@ struct regression struct regression_workspace { /* The new variables which will be introduced by /SAVE */ - const struct variable **predvars; + const struct variable **predvars; const struct variable **residvars; - /* A reader/writer pair to temporarily hold the + /* A reader/writer pair to temporarily hold the values of the new variables */ struct casewriter *writer; struct casereader *reader; @@ -155,7 +155,7 @@ save_trans_free (void *aux) return true; } -static int +static int save_trans_func (void *aux, struct ccase **c, casenumber x UNUSED) { struct save_trans_data *save_trans_data = aux; @@ -174,7 +174,7 @@ save_trans_func (void *aux, struct ccase **c, casenumber x UNUSED) double pred = case_data_idx (in, ws->extras * k + ws->pred_idx)->f; case_data_rw (*c, ws->predvars[k])->f = pred; } - + if (ws->res_idx != -1) { double resid = case_data_idx (in, ws->extras * k + ws->res_idx)->f; @@ -229,7 +229,7 @@ cmd_regression (struct lexer *lexer, struct dataset *ds) free (regression.dep_vars); regression.n_dep_vars = 0; - + if (!parse_variables_const (lexer, dict, ®ression.dep_vars, ®ression.n_dep_vars, @@ -339,7 +339,7 @@ cmd_regression (struct lexer *lexer, struct dataset *ds) workspace.extras = 0; workspace.res_idx = -1; workspace.pred_idx = -1; - workspace.writer = NULL; + workspace.writer = NULL; workspace.reader = NULL; workspace.residvars = NULL; workspace.predvars = NULL; @@ -413,7 +413,7 @@ cmd_regression (struct lexer *lexer, struct dataset *ds) save_trans_data->ws = xmalloc (sizeof (workspace)); memcpy (save_trans_data->ws, &workspace, sizeof (workspace)); save_trans_data->n_dep_vars = regression.n_dep_vars; - + add_transformation (ds, save_trans_func, save_trans_free, save_trans_data); } @@ -607,10 +607,10 @@ static void subcommand_statistics (const struct regression *cmd, const linreg * c, const gsl_matrix * cm, const struct variable *var) { - if (cmd->stats & STATS_R) + if (cmd->stats & STATS_R) reg_stats_r (c, var); - if (cmd->stats & STATS_ANOVA) + if (cmd->stats & STATS_ANOVA) reg_stats_anova (c, var); if (cmd->stats & STATS_COEFF) @@ -622,7 +622,7 @@ subcommand_statistics (const struct regression *cmd, const linreg * c, const gsl static void -run_regression (const struct regression *cmd, +run_regression (const struct regression *cmd, struct regression_workspace *ws, struct casereader *input) { @@ -706,7 +706,7 @@ run_regression (const struct regression *cmd, if (ws->extras > 0) { struct casereader *r = casereader_clone (reader); - + for (; (c = casereader_read (r)) != NULL; case_unref (c)) { struct ccase *outc = case_create (casewriter_get_proto (ws->writer)); @@ -736,7 +736,7 @@ run_regression (const struct regression *cmd, } free (vals); free (vars); - } + } casewriter_write (ws->writer, outc); } casereader_destroy (r); @@ -831,7 +831,7 @@ reg_stats_coeff (const linreg * c, const gsl_matrix *cov, const struct variable tab_vline (t, TAL_0, 1, 0, 0); - tab_hline (t, TAL_1, 2, 4, 1); + tab_hline (t, TAL_1, 2, 4, 1); tab_joint_text (t, 2, 0, 3, 0, TAB_CENTER | TAT_TITLE, _("Unstandardized Coefficients")); tab_text (t, 2, 1, TAB_CENTER | TAT_TITLE, _("B")); tab_text (t, 3, 1, TAB_CENTER | TAT_TITLE, _("Std. Error")); @@ -851,7 +851,7 @@ reg_stats_coeff (const linreg * c, const gsl_matrix *cov, const struct variable tab_double (t, 8, heading_rows, 0, upper, NULL, RC_OTHER); tab_joint_text_format (t, 7, 0, 8, 0, TAB_CENTER | TAT_TITLE, _("%g%% Confidence Interval for B"), cmd->ci * 100); - tab_hline (t, TAL_1, 7, 8, 1); + tab_hline (t, TAL_1, 7, 8, 1); tab_text (t, 7, 1, TAB_CENTER | TAT_TITLE, _("Lower Bound")); tab_text (t, 8, 1, TAB_CENTER | TAT_TITLE, _("Upper Bound")); } @@ -909,7 +909,7 @@ reg_stats_coeff (const linreg * c, const gsl_matrix *cov, const struct variable { double lower = linreg_coeff (c, j) - tval * std_err ; double upper = linreg_coeff (c, j) + tval * std_err ; - + tab_double (t, 7, this_row, 0, lower, NULL, RC_OTHER); tab_double (t, 8, this_row, 0, upper, NULL, RC_OTHER); } diff --git a/src/language/stats/reliability.c b/src/language/stats/reliability.c index 6af1439f56..560b89f980 100644 --- a/src/language/stats/reliability.c +++ b/src/language/stats/reliability.c @@ -194,7 +194,7 @@ cmd_reliability (struct lexer *lexer, struct dataset *ds) if ( ! lex_force_match (lexer, T_LPAREN)) goto error; - if ( ! lex_force_string (lexer) ) + if ( ! lex_force_string (lexer) ) goto error; ds_assign_substring (&reliability.scale_name, lex_tokss (lexer)); @@ -354,7 +354,7 @@ cmd_reliability (struct lexer *lexer, struct dataset *ds) } - if ( ! run_reliability (ds, &reliability)) + if ( ! run_reliability (ds, &reliability)) goto error; reliability_destroy (&reliability); diff --git a/src/language/stats/roc.c b/src/language/stats/roc.c index 8cae062057..73e00f905b 100644 --- a/src/language/stats/roc.c +++ b/src/language/stats/roc.c @@ -286,7 +286,7 @@ cmd_roc (struct lexer *lexer, struct dataset *ds) } } - if ( ! run_roc (ds, &roc)) + if ( ! run_roc (ds, &roc)) goto error; if ( roc.state_var) @@ -348,10 +348,10 @@ dump_casereader (struct casereader *reader) #endif -/* +/* Return true iff the state variable indicates that C has positive actual state. - As a side effect, this function also accumulates the roc->{pos,neg} and + As a side effect, this function also accumulates the roc->{pos,neg} and roc->{pos,neg}_weighted counts. */ static bool @@ -384,7 +384,7 @@ match_positives (const struct ccase *c, void *aux) #define N_EQ 1 #define N_PRED 2 -/* Some intermediate state for calculating the cutpoints and the +/* Some intermediate state for calculating the cutpoints and the standard error values */ struct roc_state { @@ -394,7 +394,7 @@ struct roc_state double n2; /* total weight of negatives */ /* intermediates for standard error */ - double q1hat; + double q1hat; double q2hat; /* intermediates for cutpoints */ @@ -405,18 +405,18 @@ struct roc_state double max; }; -/* +/* Return a new casereader based upon CUTPOINT_RDR. The number of "positive" cases are placed into the position TRUE_INDEX, and the number of "negative" cases into FALSE_INDEX. - POS_COND and RESULT determine the semantics of what is + POS_COND and RESULT determine the semantics of what is "positive". WEIGHT is the value of a single count. */ static struct casereader * accumulate_counts (struct casereader *input, - double result, double weight, + double result, double weight, bool (*pos_cond) (double, double), int true_index, int false_index) { @@ -469,7 +469,7 @@ static void output_roc (struct roc_state *rs, const struct cmd_roc *roc); CUTPOINT_RDR accordingly. TRUE_INDEX and FALSE_INDEX are the indices which receive these values. POS_COND is the condition defining true and false. - + 3. CC is filled with the cumulative weight of all cases of READER. */ static struct casereader * @@ -477,7 +477,7 @@ process_group (const struct variable *var, struct casereader *reader, bool (*pred) (double, double), const struct dictionary *dict, double *cc, - struct casereader **cutpoint_rdr, + struct casereader **cutpoint_rdr, bool (*pos_cond) (double, double), int true_index, int false_index) @@ -489,7 +489,7 @@ process_group (const struct variable *var, struct casereader *reader, const int weight_idx = w ? var_get_case_index (w) : caseproto_get_n_widths (casereader_get_proto (r1)) - 1; - + struct ccase *c1; struct casereader *rclone = casereader_clone (r1); @@ -500,7 +500,7 @@ process_group (const struct variable *var, struct casereader *reader, proto = caseproto_add_width (proto, 0); proto = caseproto_add_width (proto, 0); - wtr = autopaging_writer_create (proto); + wtr = autopaging_writer_create (proto); *cc = 0; @@ -546,7 +546,7 @@ process_group (const struct variable *var, struct casereader *reader, casereader_destroy (r2); } - + casereader_destroy (r1); casereader_destroy (rclone); @@ -635,7 +635,7 @@ append_cutpoint (struct casewriter *writer, double cutpoint) } -/* +/* Create and initialise the rs[x].cutpoint_rdr casereaders. That is, the readers will be created with width 5, ready to take the values (cutpoint, ROC_TP, ROC_FN, ROC_TN, ROC_FP), and the reader will be populated with its final number of cases. @@ -676,7 +676,7 @@ prepare_cutpoints (struct cmd_roc *roc, struct roc_state *rs, struct casereader { for (i = 0 ; i < roc->n_vars; ++i) { - const union value *v = case_data (c, roc->vars[i]); + const union value *v = case_data (c, roc->vars[i]); const double result = v->f; if ( mv_is_value_missing (var_get_missing_values (roc->vars[i]), v, roc->exclude)) @@ -742,7 +742,7 @@ do_roc (struct cmd_roc *roc, struct casereader *reader, struct dictionary *dict) /* Separate the positive actual state cases from the negative ones */ - positives = + positives = casereader_create_filter_func (input, match_positives, NULL, @@ -750,7 +750,7 @@ do_roc (struct cmd_roc *roc, struct casereader *reader, struct dictionary *dict) neg_wtr); n_proto = caseproto_create (); - + n_proto = caseproto_add_width (n_proto, 0); n_proto = caseproto_add_width (n_proto, 0); n_proto = caseproto_add_width (n_proto, 0); @@ -849,7 +849,7 @@ do_roc (struct cmd_roc *roc, struct casereader *reader, struct dictionary *dict) n_pos_gt = prev_pos_gt; case_data_rw_idx (nc, N_POS_GT)->f = n_pos_gt; } - + casewriter_write (w, nc); prev_pos_gt = n_pos_gt; } @@ -874,7 +874,7 @@ do_roc (struct cmd_roc *roc, struct casereader *reader, struct dictionary *dict) n_neg_lt = prev_neg_lt; case_data_rw_idx (nc, N_NEG_LT)->f = n_neg_lt; } - + casewriter_write (w, nc); prev_neg_lt = n_neg_lt; } @@ -928,8 +928,8 @@ do_roc (struct cmd_roc *roc, struct casereader *reader, struct dictionary *dict) casereader_destroy (r); case_unref (prev_case); - rs[i].auc /= rs[i].n1 * rs[i].n2; - if ( roc->invert ) + rs[i].auc /= rs[i].n1 * rs[i].n2; + if ( roc->invert ) rs[i].auc = 1 - rs[i].auc; if ( roc->bi_neg_exp ) @@ -953,7 +953,7 @@ do_roc (struct cmd_roc *roc, struct casereader *reader, struct dictionary *dict) subcase_destroy (&down_ordering); output_roc (rs, roc); - + for (i = 0 ; i < roc->n_vars; ++i) casereader_destroy (rs[i].cutpoint_rdr); diff --git a/src/language/stats/runs.c b/src/language/stats/runs.c index d8f8279e0e..cd963d3273 100644 --- a/src/language/stats/runs.c +++ b/src/language/stats/runs.c @@ -100,7 +100,7 @@ runs_statistic (const struct run_state *rs) static void show_runs_result (const struct runs_test *, const struct run_state *, const struct dictionary *); -void +void runs_execute (const struct dataset *ds, struct casereader *input, enum mv_class exclude, @@ -132,7 +132,7 @@ runs_execute (const struct dataset *ds, const struct variable *var = otp->vars[v]; reader = sort_execute_1var (reader, var); - + grouper = casegrouper_create_vars (reader, &var, 1); last_cc = SYSMIS; while (casegrouper_get_next_group (grouper, &group)) @@ -206,7 +206,7 @@ runs_execute (const struct dataset *ds, median = percentile_create (0.5, cc); os = &median->parent; - + order_stats_accumulate (&os, 1, reader, weight, @@ -337,7 +337,7 @@ show_runs_result (const struct runs_test *rt, const struct run_state *rs, const double z = runs_statistic (run); - tab_text (table, row_headers + i, 0, + tab_text (table, row_headers + i, 0, TAT_TITLE | TAB_CENTER , var_to_string (otp->vars[i])); @@ -346,7 +346,7 @@ show_runs_result (const struct runs_test *rt, const struct run_state *rs, const tab_double (table, row_headers +i, 2, 0, run->nn, NULL, RC_WEIGHT); - + tab_double (table, row_headers +i, 3, 0, run->np, NULL, RC_WEIGHT); diff --git a/src/language/stats/sort-criteria.c b/src/language/stats/sort-criteria.c index a8c1ff13d2..0556f93b68 100644 --- a/src/language/stats/sort-criteria.c +++ b/src/language/stats/sort-criteria.c @@ -44,7 +44,7 @@ parse_sort_criteria (struct lexer *lexer, const struct dictionary *dict, const struct variable **local_vars = NULL; size_t var_cnt = 0; - if (vars == NULL) + if (vars == NULL) vars = &local_vars; *vars = NULL; @@ -82,12 +82,12 @@ parse_sort_criteria (struct lexer *lexer, const struct dictionary *dict, else direction = SC_ASCEND; - for (i = prev_var_cnt; i < var_cnt; i++) + for (i = prev_var_cnt; i < var_cnt; i++) { const struct variable *var = (*vars)[i]; if (!subcase_add_var (ordering, var, direction)) msg (SW, _("Variable %s specified twice in sort criteria."), - var_get_name (var)); + var_get_name (var)); } } while (lex_token (lexer) == T_ID diff --git a/src/language/stats/t-test-indep.c b/src/language/stats/t-test-indep.c index d90a98e94f..a2e0d4d355 100644 --- a/src/language/stats/t-test-indep.c +++ b/src/language/stats/t-test-indep.c @@ -104,7 +104,7 @@ indep_run (struct tt *tt, const struct variable *gvar, double w = dict_get_case_weight (tt->dict, c, NULL); const union value *gv = case_data (c, gvar); - + int grp = which_group (gv, &is); if ( grp < 0) continue; @@ -169,7 +169,7 @@ indep_run (struct tt *tt, const struct variable *gvar, for (v = 0; v < tt->n_vars; ++v) ps[v].lev = levene_calculate (ps[v].nl); - + indep_summary (tt, &is, ps); indep_test (tt, ps); @@ -247,7 +247,7 @@ indep_summary (const struct tt *tt, struct indep_samples *is, const struct pair_ { double cc, mean, sigma; moments_calculate (ps[v].mom[i], &cc, &mean, &sigma, NULL, NULL); - + tab_double (t, 2, v * 2 + i + heading_rows, TAB_RIGHT, cc, NULL, RC_WEIGHT); tab_double (t, 3, v * 2 + i + heading_rows, TAB_RIGHT, mean, NULL, RC_OTHER); tab_double (t, 4, v * 2 + i + heading_rows, TAB_RIGHT, sqrt (sigma), NULL, RC_OTHER); @@ -318,7 +318,7 @@ indep_test (const struct tt *tt, const struct pair_stats *ps) df = cc0 + cc1 - 2.0; tab_double (t, 5, v * 2 + heading_rows, TAB_RIGHT, df, NULL, RC_OTHER); - + pooled_variance = ((cc0 - 1)* sigma0 + (cc1 - 1) * sigma1) / df ; tval = (mean0 - mean1) / sqrt (pooled_variance); diff --git a/src/language/stats/t-test-paired.c b/src/language/stats/t-test-paired.c index 5cf4a9f29e..94e7a8c409 100644 --- a/src/language/stats/t-test-paired.c +++ b/src/language/stats/t-test-paired.c @@ -198,7 +198,7 @@ paired_summary (const struct tt *tt, struct paired_samp *os) /* second var */ moments_calculate (pp->mom1, &cc, &mean, &sigma, NULL, NULL); - tab_text (t, 1, v * 2 + 1 + heading_rows, TAB_LEFT, var_to_string (pp->var1)); + tab_text (t, 1, v * 2 + 1 + heading_rows, TAB_LEFT, var_to_string (pp->var1)); tab_double (t, 3, v * 2 + 1 + heading_rows, TAB_RIGHT, cc, NULL, RC_WEIGHT); tab_double (t, 2, v * 2 + 1 + heading_rows, TAB_RIGHT, mean, NULL, RC_OTHER); tab_double (t, 4, v * 2 + 1 + heading_rows, TAB_RIGHT, sqrt (sigma), NULL, RC_OTHER); @@ -243,7 +243,7 @@ paired_correlations (const struct tt *tt, struct paired_samp *os) tab_text_format (t, 0, v + heading_rows, TAB_LEFT, _("Pair %d"), pp->posn + 1); - tab_text_format (t, 1, v + heading_rows, TAB_LEFT, _("%s & %s"), + tab_text_format (t, 1, v + heading_rows, TAB_LEFT, _("%s & %s"), var_to_string (pp->var0), var_to_string (pp->var1)); @@ -260,7 +260,7 @@ paired_correlations (const struct tt *tt, struct paired_samp *os) corr *= cc0 / (cc0 - 1); tab_double (t, 3, v + heading_rows, TAB_RIGHT, corr, NULL, RC_OTHER); - tab_double (t, 4, v + heading_rows, TAB_RIGHT, + tab_double (t, 4, v + heading_rows, TAB_RIGHT, 2.0 * significance_of_correlation (corr, cc0), NULL, RC_PVALUE); } @@ -326,7 +326,7 @@ paired_test (const struct tt *tt, const struct paired_samp *os) df = cc - 1.0; tab_text_format (t, 0, v + heading_rows, TAB_LEFT, _("Pair %d"), v + 1); - tab_text_format (t, 1, v + heading_rows, TAB_LEFT, _("%s - %s"), + tab_text_format (t, 1, v + heading_rows, TAB_LEFT, _("%s - %s"), var_to_string (pp->var0), var_to_string (pp->var1)); diff --git a/src/language/stats/t-test-parser.c b/src/language/stats/t-test-parser.c index 9a0043aa45..26fc7ba56c 100644 --- a/src/language/stats/t-test-parser.c +++ b/src/language/stats/t-test-parser.c @@ -47,7 +47,7 @@ cmd_t_test (struct lexer *lexer, struct dataset *ds) size_t n_v1 = 0; const struct variable **v2 = NULL; size_t n_v2 = 0; - + size_t n_pairs = 0; vp *pairs = NULL; @@ -94,7 +94,7 @@ cmd_t_test (struct lexer *lexer, struct dataset *ds) if (NULL == (gvar = parse_variable (lexer, dict))) goto parse_failed; - + if (lex_match (lexer, T_LPAREN)) { @@ -180,7 +180,7 @@ cmd_t_test (struct lexer *lexer, struct dataset *ds) n_pairs = n_v1; else n_pairs = n_v1 * n_v2; - + pairs = xcalloc (n_pairs, sizeof *pairs); if ( with) @@ -193,7 +193,7 @@ cmd_t_test (struct lexer *lexer, struct dataset *ds) vp *pair = &pairs[i]; (*pair)[0] = v1[i]; (*pair)[1] = v2[i]; - } + } } else { @@ -286,7 +286,7 @@ cmd_t_test (struct lexer *lexer, struct dataset *ds) goto parse_failed; } } - else + else { lex_error (lexer, NULL); goto parse_failed; diff --git a/src/language/utilities/include.c b/src/language/utilities/include.c index 473f675130..ecb33b2767 100644 --- a/src/language/utilities/include.c +++ b/src/language/utilities/include.c @@ -61,10 +61,10 @@ do_insert (struct lexer *lexer, struct dataset *ds, enum variant variant) if (!lex_force_string_or_id (lexer)) return CMD_FAILURE; - relative_name = utf8_to_filename (lex_tokcstr (lexer)); + relative_name = utf8_to_filename (lex_tokcstr (lexer)); if (NULL == relative_name) return CMD_FAILURE; - + filename = include_path_search (relative_name); free (relative_name); diff --git a/src/language/utilities/output.c b/src/language/utilities/output.c index 45aa638743..a2e630d791 100644 --- a/src/language/utilities/output.c +++ b/src/language/utilities/output.c @@ -42,7 +42,7 @@ struct thing extern struct fmt_spec ugly [n_RC]; -static const struct thing things[] = +static const struct thing things[] = { {"SIGNIFICANCE", RC_PVALUE}, {"COUNT" ,RC_WEIGHT} @@ -67,7 +67,7 @@ cmd_output (struct lexer *lexer, struct dataset *ds UNUSED) int j, i; struct output_spec *output_specs = NULL; int n_os = 0; - + if (!lex_force_match_id (lexer, "MODIFY")) { lex_error (lexer, NULL); @@ -94,18 +94,18 @@ cmd_output (struct lexer *lexer, struct dataset *ds UNUSED) os->n_rc = 0; os->rc = NULL; bool format = false; - - while (lex_token (lexer) != T_SLASH && + + while (lex_token (lexer) != T_SLASH && lex_token (lexer) != T_ENDCMD) { if (lex_match_id (lexer, "SELECT")) { if (! lex_force_match (lexer, T_EQUALS)) goto error; - + if (! lex_force_match (lexer, T_LBRACK)) goto error; - + while (lex_token (lexer) != T_RBRACK && lex_token (lexer) != T_ENDCMD) { @@ -130,7 +130,7 @@ cmd_output (struct lexer *lexer, struct dataset *ds UNUSED) } else if (lex_match_id (lexer, "FORMAT")) { - struct fmt_spec fmt; + struct fmt_spec fmt; char type[FMT_TYPE_LEN_MAX + 1]; int width = -1; int decimals = -1; @@ -161,7 +161,7 @@ cmd_output (struct lexer *lexer, struct dataset *ds UNUSED) os->fmt = fmt; format = true; } - else + else { lex_error (lexer, NULL); goto error; @@ -170,10 +170,10 @@ cmd_output (struct lexer *lexer, struct dataset *ds UNUSED) if (!format) goto error; } - else + else { lex_error (lexer, NULL); - goto error; + goto error; } } @@ -185,7 +185,7 @@ cmd_output (struct lexer *lexer, struct dataset *ds UNUSED) ugly [output_specs[i].rc[j]] = output_specs[i].fmt; } } - + for (j = 0; j < n_os; ++j) free (output_specs[j].rc); free (output_specs); diff --git a/src/language/utilities/set.q b/src/language/utilities/set.q index f640bcbd65..710bc2f44e 100644 --- a/src/language/utilities/set.q +++ b/src/language/utilities/set.q @@ -567,7 +567,7 @@ stc_custom_format (struct lexer *lexer, struct dataset *ds UNUSED, struct cmd_se if (!fmt_check_output (&fmt)) return 0; - + if (fmt_is_string (fmt.type)) { char str[FMT_STRING_LEN_MAX + 1]; @@ -906,7 +906,7 @@ show_current_directory (const struct dataset *ds UNUSED) { len <<= 1; buf = xrealloc (buf, len); - } + } while (NULL == (wd = getcwd (buf, len))); return wd; diff --git a/src/language/xforms/recode.c b/src/language/xforms/recode.c index 275408de90..361b5a64f8 100644 --- a/src/language/xforms/recode.c +++ b/src/language/xforms/recode.c @@ -328,7 +328,7 @@ parse_map_in (struct lexer *lexer, struct map_in *in, struct pool *pool, set_map_in_generic (in, MAP_MISSING); else if (!lex_force_string (lexer)) return false; - else + else { set_map_in_str (in, pool, lex_tokss (lexer), max_src_width, dict_encoding); @@ -412,10 +412,10 @@ parse_map_out (struct lexer *lexer, struct pool *pool, struct map_out *out) set_map_out_str (out, pool, lex_tokss (lexer)); lex_get (lexer); } - else if (lex_match_id (lexer, "COPY")) + else if (lex_match_id (lexer, "COPY")) { out->copy_input = true; - out->width = 0; + out->width = 0; } else { @@ -541,7 +541,7 @@ enlarge_dst_widths (struct recode_trns *trns) const struct variable *narrow_var = NULL; int min_dst_width = INT_MAX; trns->max_dst_width = 0; - + for (i = 0; i < trns->var_cnt; i++) { const struct variable *v = trns->dst_vars[i]; @@ -562,12 +562,12 @@ enlarge_dst_widths (struct recode_trns *trns) { if (out->width > min_dst_width) { - msg (ME, + msg (ME, _("Cannot recode because the variable %s would require a width of %d bytes or greater, but it has a width of only %d bytes."), var_get_name (narrow_var), out->width, min_dst_width); return false; } - + value_resize_pool (trns->pool, &out->value, out->width, trns->max_dst_width); } diff --git a/src/libpspp/array.c b/src/libpspp/array.c index a0ac943af6..9114582c28 100644 --- a/src/libpspp/array.c +++ b/src/libpspp/array.c @@ -80,7 +80,7 @@ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see + License along with the GNU C Library. If not, see . */ #include diff --git a/src/libpspp/hmap.c b/src/libpspp/hmap.c index 4436f8dfca..471ff61f6e 100644 --- a/src/libpspp/hmap.c +++ b/src/libpspp/hmap.c @@ -70,9 +70,9 @@ hmap_clear (struct hmap *map) should iterate through the map and free the data items before destroying it. */ void -hmap_destroy (struct hmap *map) +hmap_destroy (struct hmap *map) { - if (map != NULL && map->buckets != &map->one) + if (map != NULL && map->buckets != &map->one) free (map->buckets); } @@ -83,7 +83,7 @@ hmap_destroy (struct hmap *map) NEW_MASK must be a power of 2 minus 1 (including 0), that is, its value in binary must be all 1-bits. */ static void -hmap_rehash (struct hmap *map, size_t new_mask) +hmap_rehash (struct hmap *map, size_t new_mask) { struct hmap_node **new_buckets; struct hmap_node *node, *next; @@ -91,12 +91,12 @@ hmap_rehash (struct hmap *map, size_t new_mask) assert ((new_mask & (new_mask + 1)) == 0); if (new_mask) new_buckets = xcalloc (new_mask + 1, sizeof *new_buckets); - else + else { new_buckets = &map->one; new_buckets[0] = NULL; } - + if (map->count > 0) { for (node = hmap_first (map); node != NULL; node = next) @@ -106,7 +106,7 @@ hmap_rehash (struct hmap *map, size_t new_mask) next = hmap_next (map, node); node->next = *new_bucket; *new_bucket = node; - } + } } if (map->buckets != &map->one) free (map->buckets); @@ -128,11 +128,11 @@ hmap_reserve (struct hmap *map, size_t capacity) store its current number of elements, allocating a new set of buckets and rehashing if that would save space. */ void -hmap_shrink (struct hmap *map) +hmap_shrink (struct hmap *map) { size_t new_mask = capacity_to_mask (map->count); - if (new_mask < map->mask) - hmap_rehash (map, new_mask); + if (new_mask < map->mask) + hmap_rehash (map, new_mask); } /* Moves NODE around in MAP to compensate for its hash value @@ -146,7 +146,7 @@ hmap_shrink (struct hmap *map) void hmap_changed (struct hmap *map, struct hmap_node *node, size_t new_hash) { - if ((new_hash ^ node->hash) & map->mask) + if ((new_hash ^ node->hash) & map->mask) { hmap_delete (map, node); hmap_insert_fast (map, node, new_hash); @@ -172,7 +172,7 @@ hmap_changed (struct hmap *map, struct hmap_node *node, size_t new_hash) this function runs in constant time. */ void hmap_moved (struct hmap *map, - struct hmap_node *node, const struct hmap_node *old) + struct hmap_node *node, const struct hmap_node *old) { struct hmap_node **p = &map->buckets[node->hash & map->mask]; while (*p != old) @@ -185,7 +185,7 @@ hmap_moved (struct hmap *map, a bit-mask suitable for use as the "mask" member of struct hmap, that is, a power of 2 minus 1 (including 0). */ static size_t -capacity_to_mask (size_t capacity) +capacity_to_mask (size_t capacity) { /* Calculate the minimum mask necesary to support the given capacity. */ diff --git a/src/libpspp/hmap.h b/src/libpspp/hmap.h index 3f2858a8a8..c1004d380c 100644 --- a/src/libpspp/hmap.h +++ b/src/libpspp/hmap.h @@ -59,7 +59,7 @@ hmap_init (&map); or, alternatively: struct hmap map = HMAP_INITIALIZER (map); - + Each node in the hash table, presumably a structure type, must include a struct hmap_node member. Here's an example: struct foo @@ -273,7 +273,7 @@ static inline size_t hmap_mask_to_capacity__ (size_t mask); /* Returns the hash value associated with NODE. */ static inline size_t -hmap_node_hash (const struct hmap_node *node) +hmap_node_hash (const struct hmap_node *node) { return node->hash; } @@ -333,7 +333,7 @@ hmap_first_with_hash (const struct hmap *map, size_t hash) interface to this particular function that is often more convenient. */ static inline struct hmap_node * -hmap_next_with_hash (const struct hmap_node *node) +hmap_next_with_hash (const struct hmap_node *node) { return hmap_find_hash__ (node->next, node->hash); } @@ -372,7 +372,7 @@ hmap_insert (struct hmap *map, struct hmap_node *node, size_t hash) then the client must check for duplicates itself before inserting the new node. */ static inline void -hmap_insert_fast (struct hmap *map, struct hmap_node *node, size_t hash) +hmap_insert_fast (struct hmap *map, struct hmap_node *node, size_t hash) { struct hmap_node **bucket = &map->buckets[hash & map->mask]; node->hash = hash; @@ -476,7 +476,7 @@ hmap_delete (struct hmap *map, struct hmap_node *node) The HMAP_FIRST macro is an interface to this particular function that is often more convenient. */ static inline struct hmap_node * -hmap_first (const struct hmap *map) +hmap_first (const struct hmap *map) { return hmap_first_nonempty_bucket__ (map, 0); } @@ -504,7 +504,7 @@ hmap_first (const struct hmap *map) The HMAP_NEXT macro is an interface to this particular function that is often more convenient. */ static inline struct hmap_node * -hmap_next (const struct hmap *map, const struct hmap_node *node) +hmap_next (const struct hmap *map, const struct hmap_node *node) { return (node->next != NULL ? node->next @@ -521,7 +521,7 @@ hmap_is_empty (const struct hmap *map) /* Returns the number of data items currently in MAP. */ static inline size_t -hmap_count (const struct hmap *map) +hmap_count (const struct hmap *map) { return map->count; } @@ -535,7 +535,7 @@ hmap_count (const struct hmap *map) capacity. However, inserting many more elements than the map's capacity will degrade search performance. */ static inline size_t -hmap_capacity (const struct hmap *map) +hmap_capacity (const struct hmap *map) { return hmap_mask_to_capacity__ (map->mask); } @@ -545,9 +545,9 @@ hmap_capacity (const struct hmap *map) /* Returns the first node at or after NODE in NODE's chain that has hash value HASH. */ static inline struct hmap_node * -hmap_find_hash__ (struct hmap_node *node, size_t hash) +hmap_find_hash__ (struct hmap_node *node, size_t hash) { - for (; node != NULL; node = node->next) + for (; node != NULL; node = node->next) if (node->hash == hash) break; return node; @@ -572,7 +572,7 @@ hmap_first_nonempty_bucket__ (const struct hmap *map, size_t start) MASK must be a power of 2 minus 1 (including 0), that is, its value in binary must be all 1-bits. */ static inline size_t -hmap_mask_to_capacity__ (size_t mask) +hmap_mask_to_capacity__ (size_t mask) { return (mask + 1) * 2; } @@ -581,7 +581,7 @@ hmap_mask_to_capacity__ (size_t mask) argument more than once). */ static inline void * hmap_nullable_data__ (struct hmap_node *node, size_t member_offset) -{ +{ return node != NULL ? (char *) node - member_offset : NULL; } diff --git a/src/libpspp/hmapx.c b/src/libpspp/hmapx.c index ca5900c282..aab7629d74 100644 --- a/src/libpspp/hmapx.c +++ b/src/libpspp/hmapx.c @@ -28,9 +28,9 @@ items should be freed, then it should be done by iterating through MAP's contents before destroying MAP. */ void -hmapx_destroy (struct hmapx *map) +hmapx_destroy (struct hmapx *map) { - if (map != NULL) + if (map != NULL) { if (!(hmapx_is_empty (map))) { @@ -38,7 +38,7 @@ hmapx_destroy (struct hmapx *map) for (node = hmapx_first (map); node != NULL; node = next) { next = hmapx_next (map, node); - free (node); + free (node); } } hmap_destroy (&map->hmap); @@ -62,7 +62,7 @@ hmapx_clear (struct hmapx *map) /* Allocates and returns a new hmapx_node with DATA as its data item. */ static struct hmapx_node * -make_hmapx_node (void *data) +make_hmapx_node (void *data) { struct hmapx_node *node = xmalloc (sizeof *node); node->data = data; @@ -84,7 +84,7 @@ make_hmapx_node (void *data) then the client must check for duplicates itself before inserting the new item. */ struct hmapx_node * -hmapx_insert (struct hmapx *map, void *data, size_t hash) +hmapx_insert (struct hmapx *map, void *data, size_t hash) { struct hmapx_node *node = make_hmapx_node (data); hmap_insert (&map->hmap, &node->hmap_node, hash); @@ -105,7 +105,7 @@ hmapx_insert (struct hmapx *map, void *data, size_t hash) then the client must check for duplicates itself before inserting the new node. */ struct hmapx_node * -hmapx_insert_fast (struct hmapx *map, void *data, size_t hash) +hmapx_insert_fast (struct hmapx *map, void *data, size_t hash) { struct hmapx_node *node = make_hmapx_node (data); hmap_insert_fast (&map->hmap, &node->hmap_node, hash); diff --git a/src/libpspp/hmapx.h b/src/libpspp/hmapx.h index 345836192a..9d9a1051c1 100644 --- a/src/libpspp/hmapx.h +++ b/src/libpspp/hmapx.h @@ -204,7 +204,7 @@ static inline void hmapx_move (struct hmapx_node *, void *); These macros automatically use hmapx_node_data() to obtain the data elements that encapsulate hmap nodes, which often saves typing and can make code easier to read. Refer to the large - comment near the top of this file for an example. + comment near the top of this file for an example. These macros evaluate their arguments many times. */ #define HMAPX_FOR_EACH(DATA, NODE, HMAPX) \ @@ -238,7 +238,7 @@ hmapx_node_hash (const struct hmapx_node *node) /* Initializes MAP as a new hash map that is initially empty. */ static inline void -hmapx_init (struct hmapx *map) +hmapx_init (struct hmapx *map) { hmap_init (&map->hmap); } @@ -263,7 +263,7 @@ hmapx_reserve (struct hmapx *map, size_t capacity) store its current number of elements, allocating a new set of buckets and rehashing if that would save space. */ static inline void -hmapx_shrink (struct hmapx *map) +hmapx_shrink (struct hmapx *map) { hmap_shrink (&map->hmap); } @@ -291,7 +291,7 @@ hmapx_shrink (struct hmapx *map) macros provide convenient ways to iterate over all the nodes with a given hash. */ static inline struct hmapx_node * -hmapx_first_with_hash (struct hmapx *map, size_t hash) +hmapx_first_with_hash (struct hmapx *map, size_t hash) { return HMAP_FIRST_WITH_HASH (struct hmapx_node, hmap_node, &map->hmap, hash); } @@ -319,7 +319,7 @@ hmapx_first_with_hash (struct hmapx *map, size_t hash) macros provide convenient ways to iterate over all the nodes with a given hash. */ static inline struct hmapx_node * -hmapx_next_with_hash (struct hmapx_node *node) +hmapx_next_with_hash (struct hmapx_node *node) { return HMAP_NEXT_WITH_HASH (node, struct hmapx_node, hmap_node); } @@ -346,7 +346,7 @@ hmapx_next_with_hash (struct hmapx_node *node) hmapx_delete() does not change NODE's hash value reported by hmapx_node_hash(). */ static inline void -hmapx_delete (struct hmapx *map, struct hmapx_node *node) +hmapx_delete (struct hmapx *map, struct hmapx_node *node) { hmap_delete (&map->hmap, &node->hmap_node); free (node); @@ -374,7 +374,7 @@ hmapx_delete (struct hmapx *map, struct hmapx_node *node) convenient ways to iterate over all the nodes in a hash map. */ static inline struct hmapx_node * -hmapx_first (const struct hmapx *map) +hmapx_first (const struct hmapx *map) { return HMAP_FIRST (struct hmapx_node, hmap_node, &map->hmap); } @@ -401,7 +401,7 @@ hmapx_first (const struct hmapx *map) convenient ways to iterate over all the nodes in a hash map. */ static inline struct hmapx_node * -hmapx_next (const struct hmapx *map, const struct hmapx_node *node) +hmapx_next (const struct hmapx *map, const struct hmapx_node *node) { return HMAP_NEXT (node, struct hmapx_node, hmap_node, &map->hmap); } @@ -416,7 +416,7 @@ hmapx_is_empty (const struct hmapx *map) /* Returns the number of data items currently in MAP. */ static inline size_t -hmapx_count (const struct hmapx *map) +hmapx_count (const struct hmapx *map) { return hmap_count (&map->hmap); } @@ -430,7 +430,7 @@ hmapx_count (const struct hmapx *map) capacity. However, inserting many more elements than the map's capacity will degrade search performance. */ static inline size_t -hmapx_capacity (const struct hmapx *map) +hmapx_capacity (const struct hmapx *map) { return hmap_capacity (&map->hmap); } @@ -445,7 +445,7 @@ hmapx_capacity (const struct hmapx *map) value. */ static inline void hmapx_change (struct hmapx *map, - struct hmapx_node *node, void *data, size_t new_hash) + struct hmapx_node *node, void *data, size_t new_hash) { hmapx_move (node, data); hmapx_changed (map, node, new_hash); @@ -460,7 +460,7 @@ hmapx_change (struct hmapx *map, case), then the client must check for duplicates before changing NODE's value. */ static inline void -hmapx_changed (struct hmapx *map, struct hmapx_node *node, size_t new_hash) +hmapx_changed (struct hmapx *map, struct hmapx_node *node, size_t new_hash) { hmap_changed (&map->hmap, &node->hmap_node, new_hash); } diff --git a/src/libpspp/i18n.c b/src/libpspp/i18n.c index 55b2d67fab..380a96ae88 100644 --- a/src/libpspp/i18n.c +++ b/src/libpspp/i18n.c @@ -120,7 +120,7 @@ create_iconv (const char* tocode, const char* fromcode) free (soutbuf); iconv_close (bconv); } - + hmapx_insert (&map, converter, hash); return converter; @@ -242,7 +242,7 @@ try_recode (struct converter *cvtr, char fallbackchar, for (i = 0 ; i < null_bytes ; ++i) *out++ = '\0'; - + return out - 1 - out_; } diff --git a/src/libpspp/inflate.c b/src/libpspp/inflate.c index afe64a6390..9cdc11e6b2 100644 --- a/src/libpspp/inflate.c +++ b/src/libpspp/inflate.c @@ -60,8 +60,8 @@ inflate_init (struct zip_member *zm) { int r; struct inflator *inf = xzalloc (sizeof *inf); - - uint16_t flg = 0 ; + + uint16_t flg = 0 ; uint16_t cmf = 0x8; /* Always 8 for inflate */ const uint16_t cinfo = 7; /* log_2(Window size) - 8 */ @@ -116,7 +116,7 @@ inflate_read (struct zip_member *zm, void *buf, size_t n) } bytes_to_read = zm->comp_size - inf->ucomp_bytes_read; - + if (bytes_to_read == 0) return 0; @@ -138,7 +138,7 @@ inflate_read (struct zip_member *zm, void *buf, size_t n) { return n - inf->zss.avail_out; } - + ds_put_format (zm->errs, _("Error inflating: %s"), zError (r)); return -1; diff --git a/src/libpspp/message.c b/src/libpspp/message.c index 0597588784..b4214920f4 100644 --- a/src/libpspp/message.c +++ b/src/libpspp/message.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2006, 2009, 2010, + Copyright (C) 1997-9, 2000, 2006, 2009, 2010, 2011, 2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/src/libpspp/str.c b/src/libpspp/str.c index 3fa2fbe9a7..5aa7e41594 100644 --- a/src/libpspp/str.c +++ b/src/libpspp/str.c @@ -189,7 +189,7 @@ buf_copy_rpad (char *dst, size_t dst_size, void str_copy_rpad (char *dst, size_t dst_size, const char *src) { - if (dst_size > 0) + if (dst_size > 0) { size_t src_len = strlen (src); if (src_len < dst_size - 1) @@ -1523,7 +1523,7 @@ ds_put_c_format (struct string *st, const char *format, ...) } -/* Formats FORMAT as a printf string, using fmt_func (a snprintf like function) +/* Formats FORMAT as a printf string, using fmt_func (a snprintf like function) and appends the result to ST. */ static void ds_put_vformat_int (struct string *st, const char *format, va_list args_, @@ -1575,7 +1575,7 @@ ds_put_vformat (struct string *st, const char *format, va_list args_) ds_put_vformat_int (st, format, args_, vsnprintf); } -/* Formats FORMAT as a printf string, as if in the C locale, +/* Formats FORMAT as a printf string, as if in the C locale, and appends the result to ST. */ void ds_put_c_vformat (struct string *st, const char *format, va_list args_) diff --git a/src/libpspp/temp-file.c b/src/libpspp/temp-file.c index d121cb9e2e..839b99e757 100644 --- a/src/libpspp/temp-file.c +++ b/src/libpspp/temp-file.c @@ -125,7 +125,7 @@ close_temp_file (FILE *file) struct hmapx_node *node = hmapx_first_with_hash (&map, hash_pointer (file, 0)); char *fn = node->data; fclose_temp (file); - cleanup_temp_file (temp_dir, fn); + cleanup_temp_file (temp_dir, fn); hmapx_delete (&map, node); free (fn); } diff --git a/src/libpspp/tower.c b/src/libpspp/tower.c index bdaaffbca3..c7c36ab16d 100644 --- a/src/libpspp/tower.c +++ b/src/libpspp/tower.c @@ -50,10 +50,10 @@ tower_node_get_level (const struct tower_node *node) { const struct abt_node *p = &node->abt_node; unsigned long level = get_subtree_size (p->down[0]); - while (p->up != NULL) + while (p->up != NULL) { if (p == p->up->down[1]) - level += (get_subtree_size (p->up->down[0]) + level += (get_subtree_size (p->up->down[0]) + abt_to_tower_node (p->up)->size); p = p->up; } @@ -72,7 +72,7 @@ tower_node_get_index (const struct tower_node *node) { const struct abt_node *p = &node->abt_node; unsigned long index = get_subtree_count (p->down[0]); - while (p->up != NULL) + while (p->up != NULL) { if (p == p->up->down[1]) index += get_subtree_count (p->up->down[0]) + 1; @@ -233,7 +233,7 @@ tower_lookup (const struct tower *t_, less than the number of nodes in T (as returned by tower_count). */ struct tower_node * -tower_get (const struct tower *t_, unsigned long int index) +tower_get (const struct tower *t_, unsigned long int index) { struct tower *t = CONST_CAST (struct tower *, t_); struct abt_node *p; diff --git a/src/libpspp/zip-reader.c b/src/libpspp/zip-reader.c index 00758c5faa..69ef4fb918 100644 --- a/src/libpspp/zip-reader.c +++ b/src/libpspp/zip-reader.c @@ -63,7 +63,7 @@ stored_finish (struct zip_member *zm UNUSED) } -static struct decompressor decompressors[n_COMPRESSION] = +static struct decompressor decompressors[n_COMPRESSION] = { {stored_init, stored_read, stored_finish}, {inflate_init, inflate_read, inflate_finish} @@ -120,7 +120,7 @@ void zip_reader_destroy (struct zip_reader *zr) { int i; - if (zr == NULL) + if (zr == NULL) return; fclose (zr->fr); @@ -154,7 +154,7 @@ static bool get_bytes (FILE *f, void *x, size_t n) WARN_UNUSED_RESULT; /* Read N bytes from F, storing the result in X */ static bool -get_bytes (FILE *f, void *x, size_t n) +get_bytes (FILE *f, void *x, size_t n) { return (n == fread (x, 1, n, f)); } @@ -208,7 +208,7 @@ check_magic (FILE *f, uint32_t expected, struct string *err) if ((expected != magic)) { ds_put_format (err, - _("Corrupt file at 0x%llx: Expected %"PRIx32"; got %"PRIx32), + _("Corrupt file at 0x%llx: Expected %"PRIx32"; got %"PRIx32), (long long int) ftello (f) - sizeof (uint32_t), expected, magic); return false; @@ -244,7 +244,7 @@ zip_member_read (struct zip_member *zm, void *buf, size_t bytes) /* Read a local file header from ZR and add it to ZR's internal array. Returns a pointer to the member read. This pointer belongs to ZR. - If the caller wishes to control it, she should ref it with + If the caller wishes to control it, she should ref it with zip_member_ref. */ static struct zip_member * @@ -254,7 +254,7 @@ zip_header_read_next (struct zip_reader *zr) uint16_t v, nlen, extralen; uint16_t gp, time, date; - + uint16_t clen, diskstart, iattr; uint32_t eattr; uint16_t comp_type; @@ -289,7 +289,7 @@ zip_header_read_next (struct zip_reader *zr) if (! get_bytes (zr->fr, zm->name, nlen)) return NULL; skip_bytes (zr->fr, extralen); - + zr->members[zr->nm++] = zm; zm->fp = fopen (zr->filename, "rb"); @@ -354,7 +354,7 @@ zip_reader_create (const char *filename, struct string *errs) free (zr); return NULL; } - + if (! get_u16 (zr->fr, &disknum)) return NULL; if (! get_u16 (zr->fr, &disknum)) return NULL; @@ -390,7 +390,7 @@ zip_member_open (struct zip_reader *zr, const char *member) uint16_t v, nlen, extra_len; uint16_t gp, comp_type, time, date; uint32_t ucomp_size, comp_size; - + uint32_t crc; bool new_member = false; char *name = NULL; @@ -415,7 +415,7 @@ zip_member_open (struct zip_reader *zr, const char *member) else zm = NULL; } - + if ( zm == NULL) return NULL; @@ -463,7 +463,7 @@ zip_member_open (struct zip_reader *zr, const char *member) free (name); zm->bytes_unread = zm->ucomp_size; - + if ( !new_member) decompressors[zm->compression].finish (zm); @@ -515,7 +515,7 @@ find_eocd (FILE *fp, off_t *off) const uint32_t magic = MAGIC_EOCD; bool found = false; - /* The magic cannot be more than 22 bytes from the end of the file, + /* The magic cannot be more than 22 bytes from the end of the file, because that is the minimum length of the EndOfCentralDirectory record. */ @@ -525,7 +525,7 @@ find_eocd (FILE *fp, off_t *off) } start = ftello (fp); stop = start + sizeof (magic); - do + do { found = probe_magic (fp, magic, start, stop, off); /* FIXME: For extra confidence lookup the directory start record here*/ @@ -572,7 +572,7 @@ probe_magic (FILE *fp, uint32_t magic, off_t start, off_t stop, off_t *off) state++; else state = 0; - + if ( state == 4) { *off = ftello (fp) - 4; diff --git a/src/math/box-whisker.c b/src/math/box-whisker.c index c30be218fd..f9581be087 100644 --- a/src/math/box-whisker.c +++ b/src/math/box-whisker.c @@ -80,7 +80,7 @@ acc (struct statistic *s, const struct ccase *cx, if (y > bw->whiskers[1]) bw->whiskers[1] = y; - + return; } @@ -136,7 +136,7 @@ box_whisker_outliers (const struct box_whisker *bw) TH are the tukey hinges of the dataset. - id_idx is the index into the casereader which will be used to label + id_idx is the index into the casereader which will be used to label outliers. id_var is the variable from which that label came, or NULL */ diff --git a/src/math/categoricals.c b/src/math/categoricals.c index 8bd6683e2c..2227d4bb20 100644 --- a/src/math/categoricals.c +++ b/src/math/categoricals.c @@ -66,7 +66,7 @@ lookup_value (const struct hmap *map, const union value *val, unsigned int hash, if (value_equal (&vn->val, val, width)) break; } - + return vn; } @@ -103,10 +103,10 @@ lookup_variable (const struct hmap *map, const struct variable *var, unsigned in { if (vn->var == var) break; - + fprintf (stderr, "%s:%d Warning: Hash table collision\n", __FILE__, __LINE__); } - + return vn; } @@ -125,9 +125,9 @@ struct interact_params int n_cats; /* An array of integers df_n * df_{n-1} * df_{n-2} ... - These are the products of the degrees of freedom for the current + These are the products of the degrees of freedom for the current variable and all preceeding variables */ - int *df_prod; + int *df_prod; double *enc_sum; @@ -345,7 +345,7 @@ lookup_case (const struct hmap *map, const struct interaction *iact, const struc return iv; } -bool +bool categoricals_sane (const struct categoricals *cat) { return cat->sane; @@ -357,7 +357,7 @@ categoricals_create (struct interaction *const*inter, size_t n_inter, { size_t i; struct categoricals *cat = xmalloc (sizeof *cat); - + cat->n_iap = n_inter; cat->wv = wv; cat->n_cats_total = 0; @@ -430,14 +430,14 @@ categoricals_update (struct categoricals *cat, const struct ccase *c) if (valn == NULL) { valn = pool_malloc (cat->pool, sizeof *valn); - valn->index = -1; + valn->index = -1; vn->n_vals++; value_init (&valn->val, width); value_copy (&valn->val, val, width); hmap_insert (&vn->valmap, &valn->node, hash); } } - + for (i = 0 ; i < cat->n_iap; ++i) { const struct interaction *iact = cat->iap[i].iact; @@ -459,7 +459,7 @@ categoricals_update (struct categoricals *cat, const struct ccase *c) hmap_insert (&cat->iap[i].ivmap, &node->node, hash); - if (cat->payload) + if (cat->payload) { node->user_data = cat->payload->create (cat->aux1, cat->aux2); } @@ -551,7 +551,7 @@ categoricals_done (const struct categoricals *cat_) cat->iap[i].df_prod = iact->n_vars ? xcalloc (iact->n_vars, sizeof (int)) : NULL; cat->iap[i].n_cats = 1; - + for (v = 0 ; v < iact->n_vars; ++v) { int x; @@ -575,12 +575,12 @@ categoricals_done (const struct categoricals *cat_) x = 0; HMAP_FOR_EACH (valnd, struct value_node, node, &vn->valmap) { - /* Note: This loop is probably superfluous, it could be done in the + /* Note: This loop is probably superfluous, it could be done in the update stage (at the expense of a realloc) */ array[x++] = valnd; } - sort (array, vn->n_vals, sizeof (*array), + sort (array, vn->n_vals, sizeof (*array), compare_value_node_3way, vn); for (x = 0; x < vn->n_vals; ++x) @@ -773,7 +773,7 @@ categoricals_get_code_for_case (const struct categoricals *cat, int subscript, bin = -1.0; else if ( valn->index != index ) bin = 0; - + result *= bin; } @@ -791,7 +791,7 @@ categoricals_get_dummy_code_for_case (const struct categoricals *cat, int subscr } /* Returns unity if the value in case C at SUBSCRIPT is equal to the category - for that subscript. + for that subscript. Else if it is the last category, return -1. Otherwise return 0. */ @@ -811,7 +811,7 @@ categoricals_get_n_variables (const struct categoricals *cat) } -/* Return a case containing the set of values corresponding to +/* Return a case containing the set of values corresponding to the Nth Category of the IACTth interaction */ const struct ccase * categoricals_get_case_by_category_real (const struct categoricals *cat, int iact, int n) diff --git a/src/math/categoricals.h b/src/math/categoricals.h index fbb45aadb7..adb169cc23 100644 --- a/src/math/categoricals.h +++ b/src/math/categoricals.h @@ -73,7 +73,7 @@ bool categoricals_sane (const struct categoricals *cat); /* The *_by_subscript functions use the short map. - Their intended use is by covariance matrix routines, where normally 1 less than + Their intended use is by covariance matrix routines, where normally 1 less than the total number of distinct values of each categorical variable should be considered. */ @@ -89,7 +89,7 @@ categoricals_get_dummy_code_for_case (const struct categoricals *cat, int subscr const struct ccase *c); /* Returns unity if the value in case C at SUBSCRIPT is equal to the category - for that subscript. + for that subscript. Else if it is the last category, return -1. Otherwise return 0. */ diff --git a/src/math/chart-geometry.c b/src/math/chart-geometry.c index cf377a70e2..7029ddd737 100644 --- a/src/math/chart-geometry.c +++ b/src/math/chart-geometry.c @@ -31,17 +31,17 @@ static const double standard_tick[] = {1, 2, 5, 10}; -/* +/* Find a set {LOWER, INTERVAL, N_TICKS} such that: LOWER <= LOWDBL, LOWER + INTERVAL > LOWDBL, - + LOWER + N_TICKS * INTERVAL < HIGHDBL LOWER + (N_TICKS + 1) * INTERVAL >= HIGHDBL INTERVAL = X * 10^N - where: N is integer + where: N is integer and X is an element of {1, 2, 5} In other words: @@ -90,10 +90,10 @@ chart_get_scale (double high, double low, } } -/* +/* Generate a format string which can be passed to printf like functions, - which will produce a string in scientific notation representing a real - number. N_DECIMALS is the number of decimal places EXPONENT is the + which will produce a string in scientific notation representing a real + number. N_DECIMALS is the number of decimal places EXPONENT is the value of the exponent. */ static inline char * @@ -101,21 +101,21 @@ gen_pango_markup_scientific_format_string (int n_decimals, int exponent) { /* TRANSLATORS: This is a format string which, when presented to printf like functions, will create a pango markup string to - display real number in scientific notation. - - In its untranslated form, it will display similar to "1.23 x 10^4". You + display real number in scientific notation. + + In its untranslated form, it will display similar to "1.23 x 10^4". You can leave it untranslated if this is how scientific notation is usually presented in your language. - + Some locales (such as German) prefer the centered dot rather than the multiplication sign between the mantissa an exponent. In which case, you can change "#215;" to "#8901;" or other unicode code - point as appropriate. + point as appropriate. The . in this string does not and should not be changed, since - that is taken care of by the stdc library. + that is taken care of by the stdc library. - For information on Pango markup, see + For information on Pango markup, see http://developer.gnome.org/pango/stable/PangoMarkupFormat.html For tables of unicode code points, see http://unicode.org/charts diff --git a/src/math/correlation.c b/src/math/correlation.c index e7ebd1f52d..f5bba52379 100644 --- a/src/math/correlation.c +++ b/src/math/correlation.c @@ -39,7 +39,7 @@ significance_of_correlation (double rho, double w) t = sqrt (t); t *= rho; - + if (t > 0) return gsl_cdf_tdist_Q (t, w - 2); else @@ -51,20 +51,20 @@ correlation_from_covariance (const gsl_matrix *cv, const gsl_matrix *v) { size_t i, j; gsl_matrix *corr = gsl_matrix_calloc (cv->size1, cv->size2); - + for (i = 0 ; i < cv->size1; ++i) { for (j = 0 ; j < cv->size2; ++j) { double rho = gsl_matrix_get (cv, i, j); - + rho /= sqrt (gsl_matrix_get (v, i, j)) - * + * sqrt (gsl_matrix_get (v, j, i)); - + gsl_matrix_set (corr, i, j, rho); } } - + return corr; } diff --git a/src/math/covariance.c b/src/math/covariance.c index 3ec90efbba..a8c71dc0b3 100644 --- a/src/math/covariance.c +++ b/src/math/covariance.c @@ -62,7 +62,7 @@ resize_matrix (gsl_matrix *in, size_t new_size) gsl_matrix_set (out, i, j, x); } } - + gsl_matrix_free (in); return out; @@ -97,7 +97,7 @@ struct covariance double *cm; int n_cm; - /* 1 for single pass algorithm; + /* 1 for single pass algorithm; 2 for double pass algorithm */ short passes; @@ -105,8 +105,8 @@ struct covariance /* 0 : No pass has been made 1 : First pass has been started - 2 : Second pass has been - + 2 : Second pass has been + IE: How many passes have been (partially) made. */ short state; @@ -146,7 +146,7 @@ covariance_1pass_create (size_t n_vars, const struct variable *const *vars, cov->passes = 1; cov->state = 0; cov->pass_one_first_case_seen = cov->pass_two_first_case_seen = false; - + cov->vars = vars; cov->wv = weight; @@ -154,7 +154,7 @@ covariance_1pass_create (size_t n_vars, const struct variable *const *vars, cov->dim = n_vars; cov->moments = xmalloc (sizeof *cov->moments * n_MOMENTS); - + for (i = 0; i < n_MOMENTS; ++i) cov->moments[i] = gsl_matrix_calloc (n_vars, n_vars); @@ -186,7 +186,7 @@ covariance_2pass_create (size_t n_vars, const struct variable *const *vars, cov->passes = 2; cov->state = 0; cov->pass_one_first_case_seen = cov->pass_two_first_case_seen = false; - + cov->vars = vars; cov->wv = wv; @@ -194,7 +194,7 @@ covariance_2pass_create (size_t n_vars, const struct variable *const *vars, cov->dim = n_vars; cov->moments = xmalloc (sizeof *cov->moments * n_MOMENTS); - + for (i = 0; i < n_MOMENTS; ++i) cov->moments[i] = gsl_matrix_calloc (n_vars, n_vars); @@ -209,7 +209,7 @@ covariance_2pass_create (size_t n_vars, const struct variable *const *vars, return cov; } -/* Return an integer, which can be used to index +/* Return an integer, which can be used to index into COV->cm, to obtain the I, J th element of the covariance matrix. If COV->cm does not contain that element, then a negative value @@ -221,7 +221,7 @@ cm_idx (const struct covariance *cov, int i, int j) int as; const int n2j = cov->dim - 2 - j; const int nj = cov->dim - 2 ; - + assert (i >= 0); assert (j < cov->dim); @@ -231,11 +231,11 @@ cm_idx (const struct covariance *cov, int i, int j) if (j >= cov->dim - 1) return -1; - if ( i <= j) + if ( i <= j) return -1 ; as = nj * (nj + 1) ; - as -= n2j * (n2j + 1) ; + as -= n2j * (n2j + 1) ; as /= 2; return i - 1 + as; @@ -243,14 +243,14 @@ cm_idx (const struct covariance *cov, int i, int j) /* - Returns true iff the variable corresponding to the Ith element of the covariance matrix + Returns true iff the variable corresponding to the Ith element of the covariance matrix has a missing value for case C */ static bool is_missing (const struct covariance *cov, int i, const struct ccase *c) { const struct variable *var = i < cov->n_vars ? - cov->vars[i] : + cov->vars[i] : categoricals_get_interaction_by_subscript (cov->categoricals, i - cov->n_vars)->vars[0]; const union value *val = case_data (c, var); @@ -354,7 +354,7 @@ covariance_accumulate_pass2 (struct covariance *cov, const struct ccase *c) categoricals_done (cov->categoricals); cov->dim = cov->n_vars; - + if (cov->categoricals) cov->dim += categoricals_df_total (cov->categoricals); @@ -431,9 +431,9 @@ covariance_accumulate_pass2 (struct covariance *cov, const struct ccase *c) *x += s; } - ss = + ss = (v1 - gsl_matrix_get (cov->moments[MOMENT_MEAN], i, j)) - * + * (v2 - gsl_matrix_get (cov->moments[MOMENT_MEAN], i, j)) * weight ; @@ -503,7 +503,7 @@ covariance_accumulate (struct covariance *cov, const struct ccase *c) } -/* +/* Allocate and return a gsl_matrix containing the covariances of the data. */ @@ -590,13 +590,13 @@ covariance_calculate_single_pass (struct covariance *cov) for (i = j + 1 ; i < cov->dim; ++i) { double *x = &cov->cm [cm_idx (cov, i, j)]; - + *x /= gsl_matrix_get (cov->moments[0], i, j); *x -= - gsl_matrix_get (cov->moments[MOMENT_MEAN], i, j) + gsl_matrix_get (cov->moments[MOMENT_MEAN], i, j) * - gsl_matrix_get (cov->moments[MOMENT_MEAN], j, i); + gsl_matrix_get (cov->moments[MOMENT_MEAN], j, i); } } @@ -618,10 +618,10 @@ covariance_calculate (struct covariance *cov) switch (cov->passes) { case 1: - return covariance_calculate_single_pass (cov); + return covariance_calculate_single_pass (cov); break; case 2: - return covariance_calculate_double_pass (cov); + return covariance_calculate_double_pass (cov); break; default: NOT_REACHED (); @@ -656,11 +656,11 @@ covariance_calculate_single_pass_unnormalized (struct covariance *cov) for (i = j + 1 ; i < cov->dim; ++i) { double *x = &cov->cm [cm_idx (cov, i, j)]; - + *x -= - gsl_matrix_get (cov->moments[MOMENT_MEAN], i, j) + gsl_matrix_get (cov->moments[MOMENT_MEAN], i, j) * - gsl_matrix_get (cov->moments[MOMENT_MEAN], j, i) + gsl_matrix_get (cov->moments[MOMENT_MEAN], j, i) / gsl_matrix_get (cov->moments[MOMENT_NONE], i, j); } } @@ -685,10 +685,10 @@ covariance_calculate_unnormalized (struct covariance *cov) switch (cov->passes) { case 1: - cov->unnormalised = covariance_calculate_single_pass_unnormalized (cov); + cov->unnormalised = covariance_calculate_single_pass_unnormalized (cov); break; case 2: - cov->unnormalised = covariance_calculate_double_pass_unnormalized (cov); + cov->unnormalised = covariance_calculate_double_pass_unnormalized (cov); break; default: NOT_REACHED (); @@ -755,7 +755,7 @@ covariance_dump_enc_header (const struct covariance *cov, int length) tab_title (t, "Covariance Encoding"); - tab_box (t, + tab_box (t, TAL_2, TAL_2, 0, 0, 0, 0, tab_nc (t) - 1, tab_nr (t) - 1); diff --git a/src/math/covariance.h b/src/math/covariance.h index 2aee9f18b9..a52cfced31 100644 --- a/src/math/covariance.h +++ b/src/math/covariance.h @@ -27,7 +27,7 @@ struct variable; struct ccase ; struct categoricals; -struct covariance * covariance_1pass_create (size_t n_vars, const struct variable *const *vars, +struct covariance * covariance_1pass_create (size_t n_vars, const struct variable *const *vars, const struct variable *wv, enum mv_class excl); struct covariance * diff --git a/src/math/histogram.h b/src/math/histogram.h index 9dc818c479..89d4f5e869 100644 --- a/src/math/histogram.h +++ b/src/math/histogram.h @@ -30,7 +30,7 @@ struct histogram gsl_histogram *gsl_hist; }; -/* +/* Prepare a histogram for data which lies in the range [min, max) bin_width is a nominal figure only. It is a hint about what might be an good approximate bin width, but the implementation will adjust it diff --git a/src/math/interaction.c b/src/math/interaction.c index a36755b541..ee5b2bf034 100644 --- a/src/math/interaction.c +++ b/src/math/interaction.c @@ -34,10 +34,10 @@ Interaction is commutative. That means, that from a mathematical point of view, the order of the variables is irrelevant. However, for display - purposes, and for matching with an interaction's value the order is + purposes, and for matching with an interaction's value the order is pertinent. - - Therefore, when using these functions, make sure the orders of variables + + Therefore, when using these functions, make sure the orders of variables and values match when appropriate. */ @@ -106,7 +106,7 @@ interaction_is_proper_subset (const struct interaction *x, const struct interact } /* - Do the variables in X->VARS constitute a + Do the variables in X->VARS constitute a subset (proper or otherwise) of the variables in Y->VARS? */ bool @@ -132,7 +132,7 @@ interaction_is_subset (const struct interaction *x, const struct interaction *y) } } - /* If ALL the members of X were also found in Y, then this must be a subset */ + /* If ALL the members of X were also found in Y, then this must be a subset */ if (n >= x->n_vars) return true; diff --git a/src/math/levene.c b/src/math/levene.c index 098fcc5a1b..0175ceb70d 100644 --- a/src/math/levene.c +++ b/src/math/levene.c @@ -134,12 +134,12 @@ levene_create (int indep_width, const union value *cutpoint) /* Data accumulation. First pass */ -void +void levene_pass_one (struct levene *nl, double value, double weight, const union value *gv) { struct lev *lev = find_group (nl, gv); - if ( nl->pass == 0 ) + if ( nl->pass == 0 ) { nl->pass = 1; } @@ -160,7 +160,7 @@ levene_pass_one (struct levene *nl, double value, double weight, const union val } /* Data accumulation. Second pass */ -void +void levene_pass_two (struct levene *nl, double value, double weight, const union value *gv) { struct lev *lev = NULL; @@ -186,7 +186,7 @@ levene_pass_two (struct levene *nl, double value, double weight, const union val } /* Data accumulation. Third pass */ -void +void levene_pass_three (struct levene *nl, double value, double weight, const union value *gv) { double z; @@ -244,7 +244,7 @@ levene_calculate (struct levene *nl) } numerator *= nn - hmap_count (&nl->hmap); - + return numerator / nl->denominator; } diff --git a/src/math/linreg.c b/src/math/linreg.c index 43f4033510..98816243e7 100644 --- a/src/math/linreg.c +++ b/src/math/linreg.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2005, 2010, 2011 Free Software Foundation, Inc. + Copyright (C) 2005, 2010, 2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -137,7 +137,7 @@ post_sweep_computations (linreg *l, gsl_matrix *sw) size_t i; size_t j; int rc; - + assert (sw != NULL); assert (l != NULL); @@ -157,7 +157,7 @@ post_sweep_computations (linreg *l, gsl_matrix *sw) Get the covariance matrix of the parameter estimates. Only the upper triangle is necessary. */ - + /* The loops below do not compute the entries related to the estimated intercept. @@ -176,7 +176,7 @@ post_sweep_computations (linreg *l, gsl_matrix *sw) xm = gsl_matrix_calloc (1, l->n_indeps); for (i = 0; i < xm->size2; i++) { - gsl_matrix_set (xm, 0, i, + gsl_matrix_set (xm, 0, i, linreg_get_indep_variable_mean (l, i)); } rc = gsl_blas_dsymm (CblasRight, CblasUpper, l->mse, @@ -191,7 +191,7 @@ post_sweep_computations (linreg *l, gsl_matrix *sw) * linreg_get_indep_variable_mean (l, i - 1); } gsl_matrix_set (l->cov, 0, 0, tmp); - + l->intercept = m; } else @@ -200,7 +200,7 @@ post_sweep_computations (linreg *l, gsl_matrix *sw) __FILE__, __LINE__, gsl_strerror (rc)); exit (rc); } -} +} /* Predict the value of the dependent variable with the new set of @@ -327,19 +327,19 @@ linreg_fit_qr (const gsl_matrix *cov, linreg *l) /* Covariances related to the intercept. */ intercept_variance += linreg_mse (l) / linreg_n_obs (l); - gsl_matrix_set (l->cov, 0, 0, intercept_variance); + gsl_matrix_set (l->cov, 0, 0, intercept_variance); for (i = 0; i < q->size1; i++) { for (j = 0; j < q->size2; j++) { - intcpt_coef -= gsl_matrix_get (q, i, j) + intcpt_coef -= gsl_matrix_get (q, i, j) * linreg_get_indep_variable_mean (l, j); } gsl_matrix_set (l->cov, 0, i + 1, intcpt_coef); gsl_matrix_set (l->cov, i + 1, 0, intcpt_coef); intcpt_coef = 0.0; } - + gsl_matrix_free (q); gsl_matrix_free (r); gsl_vector_free (xty); @@ -367,7 +367,7 @@ linreg_fit (const gsl_matrix *cov, linreg *l) params = gsl_matrix_calloc (cov->size1, cov->size2); gsl_matrix_memcpy (params, cov); reg_sweep (params, l->dependent_column); - post_sweep_computations (l, params); + post_sweep_computations (l, params); gsl_matrix_free (params); } else if (l->method == LINREG_QR) @@ -393,7 +393,7 @@ linreg_cov (const linreg *c) return c->cov; } -double +double linreg_coeff (const linreg *c, size_t i) { return (c->coeff[i]); @@ -405,7 +405,7 @@ linreg_indep_var (const linreg *c, size_t i) return (c->indep_vars[i]); } -size_t +size_t linreg_n_coeffs (const linreg *c) { return c->n_coeffs; @@ -434,7 +434,7 @@ double linreg_sst (const linreg *c) return c->sst; } -double +double linreg_dfmodel ( const linreg *c) { return c->dfm; @@ -446,7 +446,7 @@ linreg_set_depvar_mean (linreg *c, double x) c->depvar_mean = x; } -double +double linreg_get_depvar_mean (const linreg *c) { return c->depvar_mean; diff --git a/src/math/linreg.h b/src/math/linreg.h index b08f7d0e43..49e54c13c7 100644 --- a/src/math/linreg.h +++ b/src/math/linreg.h @@ -146,7 +146,7 @@ typedef struct linreg_struct linreg; -linreg *linreg_alloc (const struct variable *, const struct variable **, +linreg *linreg_alloc (const struct variable *, const struct variable **, double, size_t); void linreg_unref (linreg *); diff --git a/src/output/ascii.c b/src/output/ascii.c index 66e0c4e0a6..d7ec317d70 100644 --- a/src/output/ascii.c +++ b/src/output/ascii.c @@ -134,7 +134,7 @@ make_box_index (int left, int right, int top, int bottom) start_side = right; end_side = left; } - + return ((end_side * RENDER_N_LINES + bottom) * RENDER_N_LINES + start_side) * RENDER_N_LINES + top; } @@ -500,7 +500,7 @@ ascii_submit (struct output_driver *driver, file_name = xr_draw_png_chart (chart_item, a->chart_file_name, a->chart_cnt++, - &a->fg, + &a->fg, &a->bg); if (file_name != NULL) { diff --git a/src/output/cairo-chart.c b/src/output/cairo-chart.c index f3accda3fb..802aa07bd2 100644 --- a/src/output/cairo-chart.c +++ b/src/output/cairo-chart.c @@ -99,8 +99,8 @@ pango_layout_get_baseline (PangoLayout *layout) } #endif -/* - These colours come from: +/* + These colours come from: http://tango.freedesktop.org/static/cvs/tango-art-tools/palettes/Tango-Palette.gpl */ const struct xrchart_colour data_colour[XRCHART_N_COLOURS] = { @@ -309,7 +309,7 @@ draw_tick_internal (cairo_t *cr, const struct xrchart_geometry *geom, if (orientation == SCALE_ABSCISSA) { - if ( rotated) + if ( rotated) xrchart_label_rotate (cr, 'l', 'c', geom->font_size, s, -G_PI_4); else xrchart_label (cr, 'c', 't', geom->font_size, s); @@ -385,10 +385,10 @@ xrchart_write_scale (cairo_t *cr, struct xrchart_geometry *geom, tick_format_string = chart_get_ticks_format (lower, interval, ticks, &tickscale); upper = lower + interval * (ticks+1); - + geom->axis[orient].max = upper; geom->axis[orient].min = lower; - + geom->axis[orient].scale = (fabs (geom->axis[orient].data_max - geom->axis[orient].data_min) / fabs (geom->axis[orient].max - geom->axis[orient].min)); @@ -406,7 +406,7 @@ xrchart_write_scale (cairo_t *cr, struct xrchart_geometry *geom, tickoversize = width > 0.9 * ((double)(geom->axis[SCALE_ABSCISSA].data_max - geom->axis[SCALE_ABSCISSA].data_min))/(ticks+1); } - + double pos = lower; for (s = 0 ; s <= ticks; ++s) diff --git a/src/output/cairo.c b/src/output/cairo.c index c7188af0b6..045490992e 100644 --- a/src/output/cairo.c +++ b/src/output/cairo.c @@ -1308,7 +1308,7 @@ xr_rendering_create_text (struct xr_driver *xr, const char *text, cairo_t *cr) return r; } -void +void xr_rendering_apply_options (struct xr_rendering *xr, struct string_map *o) { if (is_table_item (xr->item)) diff --git a/src/output/charts/barchart-cairo.c b/src/output/charts/barchart-cairo.c index c3cc2f3ca1..ce97cdea6c 100644 --- a/src/output/charts/barchart-cairo.c +++ b/src/output/charts/barchart-cairo.c @@ -43,10 +43,10 @@ abscissa_label (const struct barchart *bc, cairo_t *cr, size_t hash = value_hash (prev, bc->widths[0], 0); HMAP_FOR_EACH_WITH_HASH (foo, struct category, node, hash, &bc->primaries) { - if (value_equal (&foo->val, prev, bc->widths[0])) + if (value_equal (&foo->val, prev, bc->widths[0])) break; } - + draw_tick (cr, geom, SCALE_ABSCISSA, false, x_pos - (width * n_last_cat) / 2.0, "%s", ds_cstr (&foo->label)); @@ -82,7 +82,7 @@ xrchart_draw_barchart (const struct chart_item *chart_item, cairo_t *cr, { const int blob_size = 13; const int height = blob_size * (hmap_count (&bc->secondaries) * 2); - + cairo_rectangle (cr, geom->axis[SCALE_ABSCISSA].data_max + 10, geom->axis[SCALE_ORDINATE].data_max - height, @@ -95,10 +95,10 @@ xrchart_draw_barchart (const struct chart_item *chart_item, cairo_t *cr, { const struct category *foo = bc->ss[i]; - cairo_move_to (cr, + cairo_move_to (cr, geom->axis[SCALE_ABSCISSA].data_max + (1.5 * blob_size) + 20, geom->axis[SCALE_ORDINATE].data_max - ypos); - + xrchart_label (cr, 'l', 'b', geom->font_size, ds_cstr (&foo->label)); cairo_rectangle (cr, @@ -114,7 +114,7 @@ xrchart_draw_barchart (const struct chart_item *chart_item, cairo_t *cr, cairo_fill_preserve (cr); cairo_restore (cr); - + cairo_stroke (cr); ypos += blob_size * 2; diff --git a/src/output/charts/barchart.c b/src/output/charts/barchart.c index aca03ee8c4..cf88d66561 100644 --- a/src/output/charts/barchart.c +++ b/src/output/charts/barchart.c @@ -75,9 +75,9 @@ compare_freq_2level_ptr_3way (const void *a_, const void *b_, const void *bc_) /* Creates and returns a chart that will render a barchart with - the given TITLE and the N_CATS described in CATS. + the given TITLE and the N_CATS described in CATS. - VAR is an array containing the categorical variables, and N_VAR + VAR is an array containing the categorical variables, and N_VAR the number of them. N_VAR must be exactly 1 or 2. CATS are the counts of the values of those variables. N_CATS is the @@ -85,7 +85,7 @@ compare_freq_2level_ptr_3way (const void *a_, const void *b_, const void *bc_) */ struct chart_item * barchart_create (const struct variable **var, int n_vars, - const char *ylabel, bool percent, + const char *ylabel, bool percent, struct freq *const *cats, int n_cats) { struct barchart *bar; @@ -113,7 +113,7 @@ barchart_create (const struct variable **var, int n_vars, int idx = 0; hmap_init (&bar->primaries); - /* + /* Iterate the categories and create a hash table of the primary categories. We need to do this to find out how many there are and to cache the labels. */ @@ -133,7 +133,7 @@ barchart_create (const struct variable **var, int n_vars, } } - if (!flag) + if (!flag) { struct category *s = xzalloc (sizeof *s); s->idx = idx++; @@ -170,8 +170,8 @@ barchart_create (const struct variable **var, int n_vars, break; } } - - if (!flag) + + if (!flag) { struct category *s = xzalloc (sizeof *s); s->idx = idx++; @@ -192,7 +192,7 @@ barchart_create (const struct variable **var, int n_vars, sort (bar->ss, n_category, sizeof *bar->ss, compare_category_3way, bar); } - + /* Deep copy. Not necessary for cmd line, but essential for the GUI, since an expose callback will access these structs which may not @@ -208,7 +208,7 @@ barchart_create (const struct variable **var, int n_vars, struct hmap level2table; hmap_init (&level2table); int x = 0; - + for (i = 0; i < n_cats; i++) { struct freq *c = cats[i]; @@ -222,23 +222,23 @@ barchart_create (const struct variable **var, int n_vars, { foo->count += c->count; bar->total_count += c->count; - + if (foo->count > bar->largest) bar->largest = foo->count; - + flag = true; break; } } - - if (!flag) + + if (!flag) { - struct freq *aggregated_freq = freq_clone (c, n_vars, bar->widths); + struct freq *aggregated_freq = freq_clone (c, n_vars, bar->widths); hmap_insert (&level2table, &aggregated_freq->node, hash); - + if (c->count > bar->largest) bar->largest = aggregated_freq->count; - + bar->total_count += c->count; bar->cats[x++] = aggregated_freq; } @@ -287,7 +287,7 @@ barchart_destroy (struct chart_item *chart_item) { freq_destroy (bar->cats[i], bar->n_vars, bar->widths); } - + free (bar->cats); free (bar->ylabel); free (bar->ss); diff --git a/src/output/charts/barchart.h b/src/output/charts/barchart.h index b8b2122cb9..d43e379b9f 100644 --- a/src/output/charts/barchart.h +++ b/src/output/charts/barchart.h @@ -71,7 +71,7 @@ struct barchart struct hmap secondaries; - /* A array of pointers to the members of the above hmap, + /* A array of pointers to the members of the above hmap, sorted by VAL */ struct category **ss; }; diff --git a/src/output/charts/scatterplot-cairo.c b/src/output/charts/scatterplot-cairo.c index 211d2d60dc..86e54c6e5a 100644 --- a/src/output/charts/scatterplot-cairo.c +++ b/src/output/charts/scatterplot-cairo.c @@ -46,7 +46,7 @@ xrchart_draw_scatterplot (const struct chart_item *chart_item, cairo_t *cr, int byvar_width = 0; int i = 0; const struct xrchart_colour *colour; - + if (spc->byvar) byvar_width = var_get_width (spc->byvar); @@ -97,7 +97,7 @@ xrchart_draw_scatterplot (const struct chart_item *chart_item, cairo_t *cr, colour->red / 255.0, colour->green / 255.0, colour->blue / 255.0); - + xrchart_datum (cr, geom, 0, case_data_idx (c, SP_IDX_X)->f, case_data_idx (c, SP_IDX_Y)->f); diff --git a/src/output/charts/spreadlevel-cairo.c b/src/output/charts/spreadlevel-cairo.c index 13b7a7a3b5..389a487b01 100644 --- a/src/output/charts/spreadlevel-cairo.c +++ b/src/output/charts/spreadlevel-cairo.c @@ -37,7 +37,7 @@ xrchart_draw_spreadlevel (const struct chart_item *chart_item, cairo_t *cr, xrchart_write_title (cr, geom, _("Spread vs. Level Plot of %s"), name); xrchart_write_xlabel (cr, geom, _("Level")); xrchart_write_ylabel (cr, geom, _("Spread")); - + xrchart_write_xscale (cr, geom, sl->x_lower, sl->x_upper); xrchart_write_yscale (cr, geom, sl->y_lower, sl->y_upper); diff --git a/src/output/charts/spreadlevel-plot.c b/src/output/charts/spreadlevel-plot.c index d5b6e3d01a..44e2c658a9 100644 --- a/src/output/charts/spreadlevel-plot.c +++ b/src/output/charts/spreadlevel-plot.c @@ -44,11 +44,11 @@ spreadlevel_plot_create (const char *label, double tx_pwr) sl->n_data = 0; sl->data = NULL; - + return &sl->chart_item; } -void +void spreadlevel_plot_add (struct chart_item *ci, double spread, double level) { struct spreadlevel_plot_chart *sl = to_spreadlevel_plot_chart (ci); diff --git a/src/output/charts/spreadlevel-plot.h b/src/output/charts/spreadlevel-plot.h index 550ccb9893..b7c8c354a1 100644 --- a/src/output/charts/spreadlevel-plot.h +++ b/src/output/charts/spreadlevel-plot.h @@ -19,7 +19,7 @@ #include "output/chart-item.h" -struct datum +struct datum { double x; double y; @@ -105,4 +105,4 @@ spreadlevel_plot_chart_submit (struct spreadlevel_plot_chart *instance) chart_item_submit (&instance->chart_item); } -#endif +#endif diff --git a/src/output/driver.c b/src/output/driver.c index 81ef6690e5..afb5084fa1 100644 --- a/src/output/driver.c +++ b/src/output/driver.c @@ -378,7 +378,7 @@ output_driver_create (struct string_map *options) device_string, "terminal", "listing"); device_type = default_device_type (file_name); } - + struct file_handle *fh = fh_create_file (NULL, file_name, NULL, fh_default_properties ()); driver = f->create (fh, device_type, options); diff --git a/src/output/html.c b/src/output/html.c index fd6d40d106..38b89719a4 100644 --- a/src/output/html.c +++ b/src/output/html.c @@ -51,7 +51,7 @@ struct html_driver #ifdef HAVE_CAIRO struct xr_color fg; struct xr_color bg; -#endif +#endif struct file_handle *handle; char *chart_file_name; @@ -495,7 +495,7 @@ html_output_table (struct html_driver *html, const struct table_item *item) { /* Cell borders. */ n_borders = 0; - + top = table_get_rule (t, TABLE_VERT, x, y); if (top > TAL_GAP) put_border (html->file, n_borders++, top, "top"); diff --git a/src/output/journal.c b/src/output/journal.c index 84d0cd9222..d4ad5a75fb 100644 --- a/src/output/journal.c +++ b/src/output/journal.c @@ -146,7 +146,7 @@ journal_init (void) SETTINGS_DEVICE_UNFILTERED); journal.file = NULL; journal.command_name = NULL; - + /* Register journal driver. */ output_driver_register (&journal.driver); diff --git a/src/output/odt.c b/src/output/odt.c index 521e5b877f..065ef379a6 100644 --- a/src/output/odt.c +++ b/src/output/odt.c @@ -149,7 +149,7 @@ write_style_data (struct odt_driver *odt) _xml ("urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0") ); xmlTextWriterWriteAttribute (w, _xml ("office:version"), _xml ("1.1")); - + xmlTextWriterStartElement (w, _xml ("office:styles")); @@ -385,7 +385,7 @@ odt_destroy (struct output_driver *driver) zip_writer_close (odt->zip); } - + free (odt->file_name); free (odt->command_name); free (odt); @@ -474,7 +474,7 @@ write_table (struct odt_driver *odt, const struct table_item *item) /* Start table */ xmlTextWriterStartElement (odt->content_wtr, _xml("table:table")); - xmlTextWriterWriteFormatAttribute (odt->content_wtr, _xml("table:name"), + xmlTextWriterWriteFormatAttribute (odt->content_wtr, _xml("table:name"), "TABLE-%d", odt->table_num++); @@ -487,7 +487,7 @@ write_table (struct odt_driver *odt, const struct table_item *item) /* Deal with row headers */ if ( table_ht (tab) > 0) xmlTextWriterStartElement (odt->content_wtr, _xml("table:table-header-rows")); - + /* Write all the rows */ for (r = 0 ; r < table_nr (tab); ++r) @@ -556,7 +556,7 @@ write_table (struct odt_driver *odt, const struct table_item *item) table_cell_free (&cell); } - + xmlTextWriterEndElement (odt->content_wtr); /* row */ if ( table_ht (tab) > 0 && r == table_ht (tab) - 1) diff --git a/src/output/render.c b/src/output/render.c index 88b4db16a6..11830a3e8e 100644 --- a/src/output/render.c +++ b/src/output/render.c @@ -913,7 +913,7 @@ render_page_unref (struct render_page *page) hmap_destroy (&page->overflows); table_unref (page->table); - + for (i = 0; i < TABLE_N_AXES; ++i) { free (page->join_crossing[i]); @@ -969,9 +969,9 @@ is_rule (int z) bool render_direction_rtl (void) { - /* TRANSLATORS: Do not translate this string. If the script of your language - reads from right to left (eg Persian, Arabic, Hebrew etc), then replace - this string with "output-direction-rtl". Otherwise either leave it + /* TRANSLATORS: Do not translate this string. If the script of your language + reads from right to left (eg Persian, Arabic, Hebrew etc), then replace + this string with "output-direction-rtl". Otherwise either leave it untranslated or copy it verbatim. */ const char *dir = _("output-direction-ltr"); if ( 0 == strcmp ("output-direction-rtl", dir)) diff --git a/src/ui/gui/builder-wrapper.c b/src/ui/gui/builder-wrapper.c index a00d796889..94b1b365de 100644 --- a/src/ui/gui/builder-wrapper.c +++ b/src/ui/gui/builder-wrapper.c @@ -37,7 +37,7 @@ builder_new_real (const gchar *name) } -GtkBuilder * +GtkBuilder * builder_new_x (const gchar *obj_name) { GtkBuilder *b; @@ -66,7 +66,7 @@ get_object_assert (GtkBuilder *builder, const gchar *name, GType type) g_critical ("Object `%s' could not be found\n", name); else if ( ! g_type_is_a (G_OBJECT_TYPE (o), type)) { - g_critical ("Object `%s' was expected to have type %s, but in fact has type %s", + g_critical ("Object `%s' was expected to have type %s, but in fact has type %s", name, g_type_name (type), G_OBJECT_TYPE_NAME (o)); } @@ -78,7 +78,7 @@ GtkWidget * get_widget_assert (GtkBuilder *builder, const gchar *name) { GtkWidget *w = GTK_WIDGET (get_object_assert (builder, name, GTK_TYPE_WIDGET)); - + g_object_set (w, "name", name, NULL); return w; diff --git a/src/ui/gui/dialog-common.c b/src/ui/gui/dialog-common.c index 0d32904d14..cdd6ac667a 100644 --- a/src/ui/gui/dialog-common.c +++ b/src/ui/gui/dialog-common.c @@ -24,8 +24,8 @@ #include "helper.h" -/* - If m is not a base TreeModel type (ie, is a filter or sorter) then +/* + If m is not a base TreeModel type (ie, is a filter or sorter) then convert OP to a TreePath for the base and return it. The return value must be freed by the caller. */ @@ -36,7 +36,7 @@ get_base_tree_path (GtkTreeModel *m, GtkTreePath *op) while ( ! PSPPIRE_IS_DICT (m)) { GtkTreePath *oldp = p; - + if (GTK_IS_TREE_MODEL_FILTER (m)) { p = gtk_tree_model_filter_convert_path_to_child_path (GTK_TREE_MODEL_FILTER (m), oldp); @@ -51,7 +51,7 @@ get_base_tree_path (GtkTreeModel *m, GtkTreePath *op) { g_error ("Unexpected model type: %s", G_OBJECT_TYPE_NAME (m)); } - + gtk_tree_path_free (oldp); } diff --git a/src/ui/gui/dict-display.h b/src/ui/gui/dict-display.h index 0a079bcd25..04ec09d107 100644 --- a/src/ui/gui/dict-display.h +++ b/src/ui/gui/dict-display.h @@ -19,7 +19,7 @@ dictionary in GTK widgets. */ -#ifndef DICT_DISPLAY +#ifndef DICT_DISPLAY #define DICT_DISPLAY 1 #include diff --git a/src/ui/gui/help-menu.c b/src/ui/gui/help-menu.c index b5b38757c3..30bbc7522b 100644 --- a/src/ui/gui/help-menu.c +++ b/src/ui/gui/help-menu.c @@ -72,7 +72,7 @@ about_new (GtkMenuItem *mmm, GtkWindow *parent) gtk_about_dialog_set_copyright (GTK_ABOUT_DIALOG (about), "Free Software Foundation"); - gtk_about_dialog_set_translator_credits + gtk_about_dialog_set_translator_credits ( GTK_ABOUT_DIALOG (about), /* TRANSLATORS: Do not translate this string. Instead, put the names of the people @@ -232,7 +232,7 @@ create_help_menu (GtkWindow *toplevel) GtkWidget *help_ref = gtk_menu_item_new_with_mnemonic (_("_Reference Manual")); GtkAccelGroup *accel_group = gtk_accel_group_new (); - + gtk_window_add_accel_group (toplevel, accel_group); gtk_widget_add_accelerator (help_ref, @@ -245,10 +245,10 @@ create_help_menu (GtkWindow *toplevel) g_signal_connect (help_about, "activate", G_CALLBACK (about_new), toplevel); g_signal_connect (help_ref, "activate", G_CALLBACK (reference_manual), NULL); - + g_object_set (menuitem, "submenu", menu, NULL); gtk_widget_show_all (menuitem); - + return menuitem; } diff --git a/src/ui/gui/helper.c b/src/ui/gui/helper.c index 72620187ab..c7cfaebe8d 100644 --- a/src/ui/gui/helper.c +++ b/src/ui/gui/helper.c @@ -289,7 +289,7 @@ clone_list_store (const GtkListStore *src) -static gboolean +static gboolean on_delete (GtkWindow *window, GdkEvent *e, GtkWindow **addr) { *addr = NULL; diff --git a/src/ui/gui/main.c b/src/ui/gui/main.c index 9733e54d75..157a0dc8f4 100644 --- a/src/ui/gui/main.c +++ b/src/ui/gui/main.c @@ -161,7 +161,7 @@ on_local_options (GApplication * application, start_time = g_get_monotonic_time (); } - + return -1; } diff --git a/src/ui/gui/options-dialog.c b/src/ui/gui/options-dialog.c index e2c2894039..c500480602 100644 --- a/src/ui/gui/options-dialog.c +++ b/src/ui/gui/options-dialog.c @@ -90,7 +90,7 @@ options_dialog (PsppireDataWindow *de) fd.maximize = get_widget_assert (fd.xml, "checkbutton-maximize"); fd.alert = get_widget_assert (fd.xml, "checkbutton-alert"); fd.raise = get_widget_assert (fd.xml, "checkbutton-raise"); - + gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de)); fd.conf = psppire_conf_new (); @@ -129,20 +129,20 @@ options_dialog (PsppireDataWindow *de) &status)) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fd.maximize), status); } - + { gboolean status = true; psppire_conf_get_boolean (fd.conf, "OutputWindowAction", "alert", &status); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fd.alert), status); } - + { gboolean status; if (psppire_conf_get_boolean (fd.conf, "OutputWindowAction", "raise", &status)) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fd.raise), status); } - + const int result = psppire_dialog_run (PSPPIRE_DIALOG (dialog)); if (result == GTK_RESPONSE_OK) @@ -165,7 +165,7 @@ options_dialog (PsppireDataWindow *de) { sort_order = PSPP_OPTIONS_VAR_ORDER_UNSORTED; } - + psppire_conf_set_enum (fd.conf, "VariableLists", "sort-order", PSPP_TYPE_OPTIONS_VAR_ORDER, @@ -174,7 +174,7 @@ options_dialog (PsppireDataWindow *de) psppire_conf_set_boolean (fd.conf, "OutputWindowAction", "maximize", gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (fd.maximize))); - + psppire_conf_set_boolean (fd.conf, "OutputWindowAction", "raise", gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (fd.raise))); diff --git a/src/ui/gui/pspp-sheet-private.h b/src/ui/gui/pspp-sheet-private.h index a19c7c5b78..e01fd47d21 100644 --- a/src/ui/gui/pspp-sheet-private.h +++ b/src/ui/gui/pspp-sheet-private.h @@ -263,7 +263,7 @@ struct _PsppSheetViewPrivate guint enable_search : 1; guint disable_popdown : 1; guint search_custom_entry_set : 1; - + guint hover_selection : 1; guint imcontext_changed : 1; diff --git a/src/ui/gui/pspp-sheet-selection.c b/src/ui/gui/pspp-sheet-selection.c index 13c69c0ed6..98089147f9 100644 --- a/src/ui/gui/pspp-sheet-selection.c +++ b/src/ui/gui/pspp-sheet-selection.c @@ -238,9 +238,9 @@ pspp_sheet_selection_get_mode (PsppSheetSelection *selection) /** * pspp_sheet_selection_get_tree_view: * @selection: A #PsppSheetSelection - * + * * Returns the tree view associated with @selection. - * + * * Return value: A #PsppSheetView **/ PsppSheetView * @@ -402,7 +402,7 @@ pspp_sheet_selection_get_selected_rows (PsppSheetSelection *selection, * Returns the number of rows that have been selected in @tree. * * Return value: The number of rows selected. - * + * * Since: 2.2 **/ gint @@ -501,7 +501,7 @@ pspp_sheet_selection_selected_foreach (PsppSheetSelection *selection, G_CALLBACK (model_changed), &stop); changed_id = g_signal_connect_swapped (selection->tree_view, "notify::model", - G_CALLBACK (model_changed), + G_CALLBACK (model_changed), &stop); RANGE_TOWER_FOR_EACH (node, start, selection->tree_view->priv->selected) @@ -557,7 +557,7 @@ pspp_sheet_selection_select_path (PsppSheetSelection *selection, path, &node); - if (node < 0 || pspp_sheet_view_node_is_selected (selection->tree_view, node)) + if (node < 0 || pspp_sheet_view_node_is_selected (selection->tree_view, node)) return; if (selection->type == PSPP_SHEET_SELECTION_MULTIPLE || @@ -592,7 +592,7 @@ pspp_sheet_selection_unselect_path (PsppSheetSelection *selection, path, &node); - if (node < 0 || !pspp_sheet_view_node_is_selected (selection->tree_view, node)) + if (node < 0 || !pspp_sheet_view_node_is_selected (selection->tree_view, node)) return; _pspp_sheet_selection_internal_select_node (selection, @@ -663,10 +663,10 @@ pspp_sheet_selection_unselect_iter (PsppSheetSelection *selection, * pspp_sheet_selection_path_is_selected: * @selection: A #PsppSheetSelection. * @path: A #GtkTreePath to check selection on. - * + * * Returns %TRUE if the row pointed to by @path is currently selected. If @path * does not point to a valid location, %FALSE is returned - * + * * Return value: %TRUE if @path is selected. **/ gboolean @@ -686,7 +686,7 @@ pspp_sheet_selection_path_is_selected (PsppSheetSelection *selection, path, &node); - if (node < 0 || !pspp_sheet_view_node_is_selected (selection->tree_view, node)) + if (node < 0 || !pspp_sheet_view_node_is_selected (selection->tree_view, node)) return FALSE; return TRUE; @@ -696,9 +696,9 @@ pspp_sheet_selection_path_is_selected (PsppSheetSelection *selection, * pspp_sheet_selection_iter_is_selected: * @selection: A #PsppSheetSelection * @iter: A valid #GtkTreeIter - * + * * Returns %TRUE if the row at @iter is currently selected. - * + * * Return value: %TRUE, if @iter is selected **/ gboolean @@ -839,7 +839,7 @@ pspp_sheet_selection_unselect_all (PsppSheetSelection *selection) if (selection->tree_view->priv->row_count == 0 || selection->tree_view->priv->model == NULL) return; - + if (pspp_sheet_selection_real_unselect_all (selection)) g_signal_emit (selection, tree_selection_signals[CHANGED], 0); } @@ -1126,14 +1126,14 @@ _pspp_sheet_selection_internal_select_node (PsppSheetSelection *selection, gtk_tree_path_free (anchor_path); if (dirty) - g_signal_emit (selection, tree_selection_signals[CHANGED], 0); + g_signal_emit (selection, tree_selection_signals[CHANGED], 0); } -void +void _pspp_sheet_selection_emit_changed (PsppSheetSelection *selection) { - g_signal_emit (selection, tree_selection_signals[CHANGED], 0); + g_signal_emit (selection, tree_selection_signals[CHANGED], 0); } /* NOTE: Any {un,}selection ever done _MUST_ be done through this function! @@ -1153,7 +1153,7 @@ pspp_sheet_selection_real_select_node (PsppSheetSelection *selection, pspp_sheet_view_node_unselect (selection->tree_view, node); _pspp_sheet_view_queue_draw_node (selection->tree_view, node, NULL); - + return TRUE; } diff --git a/src/ui/gui/pspp-sheet-view-column.c b/src/ui/gui/pspp-sheet-view-column.c index e7a70d0893..cd3fae3c6e 100644 --- a/src/ui/gui/pspp-sheet-view-column.c +++ b/src/ui/gui/pspp-sheet-view-column.c @@ -208,7 +208,7 @@ pspp_sheet_view_column_class_init (PsppSheetViewColumnClass *class) object_class->finalize = pspp_sheet_view_column_finalize; object_class->set_property = pspp_sheet_view_column_set_property; object_class->get_property = pspp_sheet_view_column_get_property; - + tree_column_signals[CLICKED] = g_signal_new ("clicked", G_OBJECT_CLASS_TYPE (object_class), @@ -254,7 +254,7 @@ pspp_sheet_view_column_class_init (PsppSheetViewColumnClass *class) P_("Whether to display the column"), TRUE, GTK_PARAM_READWRITE)); - + g_object_class_install_property (object_class, PROP_RESIZABLE, g_param_spec_boolean ("resizable", @@ -262,7 +262,7 @@ pspp_sheet_view_column_class_init (PsppSheetViewColumnClass *class) P_("Column is user-resizable"), FALSE, GTK_PARAM_READWRITE)); - + g_object_class_install_property (object_class, PROP_WIDTH, g_param_spec_int ("width", @@ -281,7 +281,7 @@ pspp_sheet_view_column_class_init (PsppSheetViewColumnClass *class) G_MAXINT, 0, GTK_PARAM_READWRITE)); - + g_object_class_install_property (object_class, PROP_FIXED_WIDTH, g_param_spec_int ("fixed-width", @@ -319,7 +319,7 @@ pspp_sheet_view_column_class_init (PsppSheetViewColumnClass *class) P_("Title to appear in column header"), "", GTK_PARAM_READWRITE)); - + g_object_class_install_property (object_class, PROP_EXPAND, g_param_spec_boolean ("expand", @@ -327,7 +327,7 @@ pspp_sheet_view_column_class_init (PsppSheetViewColumnClass *class) P_("Column gets share of extra width allocated to the widget"), FALSE, GTK_PARAM_READWRITE)); - + g_object_class_install_property (object_class, PROP_CLICKABLE, g_param_spec_boolean ("clickable", @@ -335,7 +335,7 @@ pspp_sheet_view_column_class_init (PsppSheetViewColumnClass *class) P_("Whether the header can be clicked"), FALSE, GTK_PARAM_READWRITE)); - + g_object_class_install_property (object_class, PROP_WIDGET, @@ -628,7 +628,7 @@ pspp_sheet_view_column_set_property (GObject *object, pspp_sheet_view_column_set_sort_order (tree_column, g_value_get_enum (value)); break; - + case PROP_SORT_COLUMN_ID: pspp_sheet_view_column_set_sort_column_id (tree_column, g_value_get_int (value)); @@ -751,7 +751,7 @@ pspp_sheet_view_column_get_property (GObject *object, g_value_set_enum (value, pspp_sheet_view_column_get_sort_order (tree_column)); break; - + case PROP_SORT_COLUMN_ID: g_value_set_int (value, pspp_sheet_view_column_get_sort_column_id (tree_column)); @@ -854,7 +854,7 @@ pspp_sheet_view_column_cell_layout_clear (GtkCellLayout *cell_layout) pspp_sheet_view_column_cell_layout_clear_attributes (cell_layout, info->cell); g_object_unref (info->cell); g_free (info); - column->cell_list = g_list_delete_link (column->cell_list, + column->cell_list = g_list_delete_link (column->cell_list, column->cell_list); } } @@ -1065,7 +1065,7 @@ pspp_sheet_view_column_create_button (PsppSheetViewColumn *tree_column) gtk_box_pack_start (GTK_BOX (hbox), tree_column->bin, TRUE, TRUE, 0); - + gtk_container_add (GTK_CONTAINER (tree_column->bin), child); gtk_container_add (GTK_CONTAINER (tree_column->button), hbox); @@ -1074,7 +1074,7 @@ pspp_sheet_view_column_create_button (PsppSheetViewColumn *tree_column) pspp_sheet_view_column_update_button (tree_column); } -void +void pspp_sheet_view_column_update_button (PsppSheetViewColumn *tree_column) { gint sort_column_id = -1; @@ -1094,7 +1094,7 @@ pspp_sheet_view_column_update_button (PsppSheetViewColumn *tree_column) tree_column->tree_view && gtk_widget_get_realized (tree_column->tree_view)) pspp_sheet_view_column_create_button (tree_column); - + if (! tree_column->button) return; @@ -1105,7 +1105,7 @@ pspp_sheet_view_column_update_button (PsppSheetViewColumn *tree_column) g_object_set (alignment, "halign", tree_column->halign, "valign", GTK_ALIGN_CENTER, NULL); - + if (tree_column->child) { if (current_child != tree_column->child) @@ -1116,7 +1116,7 @@ pspp_sheet_view_column_update_button (PsppSheetViewColumn *tree_column) tree_column->child); } } - else + else { if (current_child == NULL) { @@ -1219,7 +1219,7 @@ pspp_sheet_view_column_button_event (GtkWidget *widget, if (event->type == GDK_BUTTON_RELEASE || event->type == GDK_LEAVE_NOTIFY) column->maybe_reordered = FALSE; - + if (event->type == GDK_MOTION_NOTIFY && column->maybe_reordered && (gtk_drag_check_threshold (widget, @@ -1489,7 +1489,7 @@ pspp_sheet_view_column_setup_sort_column_id_callback (PsppSheetViewColumn *tree_ g_signal_connect (model, "sort-column-changed", G_CALLBACK (pspp_sheet_view_model_sort_column_changed), tree_column); - + if (gtk_tree_sortable_get_sort_column_id (GTK_TREE_SORTABLE (model), &real_sort_column_id, &real_order) && @@ -1498,7 +1498,7 @@ pspp_sheet_view_column_setup_sort_column_id_callback (PsppSheetViewColumn *tree_ pspp_sheet_view_column_set_sort_indicator (tree_column, TRUE); pspp_sheet_view_column_set_sort_order (tree_column, real_order); } - else + else { pspp_sheet_view_column_set_sort_indicator (tree_column, FALSE); } @@ -1703,9 +1703,9 @@ _pspp_sheet_view_column_get_cell_at_pos (PsppSheetViewColumn *column, /** * pspp_sheet_view_column_new: - * + * * Creates a new #PsppSheetViewColumn. - * + * * Return value: A newly created #PsppSheetViewColumn. **/ PsppSheetViewColumn * @@ -1723,7 +1723,7 @@ pspp_sheet_view_column_new (void) * @title: The title to set the header to. * @cell: The #GtkCellRenderer. * @Varargs: A %NULL-terminated list of attributes. - * + * * Creates a new #PsppSheetViewColumn with a number of default values. This is * equivalent to calling pspp_sheet_view_column_set_title(), * pspp_sheet_view_column_pack_start(), and @@ -1736,7 +1736,7 @@ pspp_sheet_view_column_new (void) * { * PsppSheetViewColumn *column; * GtkCellRenderer *renderer = gtk_cell_renderer_text_new (); - * + * * column = pspp_sheet_view_column_new_with_attributes ("Title", * renderer, * "text", TEXT_COLUMN, @@ -1744,7 +1744,7 @@ pspp_sheet_view_column_new (void) * NULL); * } * ]| - * + * * Return value: A newly created #PsppSheetViewColumn. **/ PsppSheetViewColumn * @@ -1782,7 +1782,7 @@ pspp_sheet_view_column_get_cell_info (PsppSheetViewColumn *tree_column, /** * pspp_sheet_view_column_pack_start: * @tree_column: A #PsppSheetViewColumn. - * @cell: The #GtkCellRenderer. + * @cell: The #GtkCellRenderer. * @expand: %TRUE if @cell is to be given extra space allocated to @tree_column. * * Packs the @cell into the beginning of the column. If @expand is %FALSE, then @@ -1800,7 +1800,7 @@ pspp_sheet_view_column_pack_start (PsppSheetViewColumn *tree_column, /** * pspp_sheet_view_column_pack_end: * @tree_column: A #PsppSheetViewColumn. - * @cell: The #GtkCellRenderer. + * @cell: The #GtkCellRenderer. * @expand: %TRUE if @cell is to be given extra space allocated to @tree_column. * * Adds the @cell to end of the column. If @expand is %FALSE, then the @cell @@ -1818,7 +1818,7 @@ pspp_sheet_view_column_pack_end (PsppSheetViewColumn *tree_column, /** * pspp_sheet_view_column_clear: * @tree_column: A #PsppSheetViewColumn - * + * * Unsets all the mappings on all renderers on the @tree_column. **/ void @@ -1868,7 +1868,7 @@ pspp_sheet_view_column_get_cell_renderers (PsppSheetViewColumn *tree_column) * @cell_renderer: the #GtkCellRenderer to set attributes on * @attribute: An attribute on the renderer * @column: The column position on the model to get the attribute from. - * + * * Adds an attribute mapping to the list in @tree_column. The @column is the * column of the model to get a value from, and the @attribute is the * parameter on @cell_renderer to be set from the value. So for example @@ -1897,7 +1897,7 @@ pspp_sheet_view_column_set_attributesv (PsppSheetViewColumn *tree_column, attribute = va_arg (args, gchar *); pspp_sheet_view_column_clear_attributes (tree_column, cell_renderer); - + while (attribute != NULL) { column = va_arg (args, gint); @@ -1911,7 +1911,7 @@ pspp_sheet_view_column_set_attributesv (PsppSheetViewColumn *tree_column, * @tree_column: A #PsppSheetViewColumn. * @cell_renderer: the #GtkCellRenderer we're setting the attributes of * @Varargs: A %NULL-terminated list of attributes. - * + * * Sets the attributes in the list as the attributes of @tree_column. * The attributes should be in attribute/column order, as in * pspp_sheet_view_column_add_attribute(). All existing attributes @@ -1938,10 +1938,10 @@ pspp_sheet_view_column_set_attributes (PsppSheetViewColumn *tree_column, * pspp_sheet_view_column_set_cell_data_func: * @tree_column: A #PsppSheetViewColumn * @cell_renderer: A #GtkCellRenderer - * @func: The #PsppSheetViewColumnFunc to use. + * @func: The #PsppSheetViewColumnFunc to use. * @func_data: The user data for @func. * @destroy: The destroy notification for @func_data - * + * * Sets the #PsppSheetViewColumnFunc to use for the column. This * function is used instead of the standard attributes mapping for * setting the column value, and should set the value of @tree_column's @@ -1966,7 +1966,7 @@ pspp_sheet_view_column_set_cell_data_func (PsppSheetViewColumn *tree_column, * pspp_sheet_view_column_clear_attributes: * @tree_column: a #PsppSheetViewColumn * @cell_renderer: a #GtkCellRenderer to clear the attribute mapping on. - * + * * Clears all existing attributes previously set with * pspp_sheet_view_column_set_attributes(). **/ @@ -1982,7 +1982,7 @@ pspp_sheet_view_column_clear_attributes (PsppSheetViewColumn *tree_column, * pspp_sheet_view_column_set_spacing: * @tree_column: A #PsppSheetViewColumn. * @spacing: distance between cell renderers in pixels. - * + * * Sets the spacing field of @tree_column, which is the number of pixels to * place between cell renderers packed into it. **/ @@ -2004,9 +2004,9 @@ pspp_sheet_view_column_set_spacing (PsppSheetViewColumn *tree_column, /** * pspp_sheet_view_column_get_spacing: * @tree_column: A #PsppSheetViewColumn. - * + * * Returns the spacing of @tree_column. - * + * * Return value: the spacing of @tree_column. **/ gint @@ -2023,7 +2023,7 @@ pspp_sheet_view_column_get_spacing (PsppSheetViewColumn *tree_column) * pspp_sheet_view_column_set_visible: * @tree_column: A #PsppSheetViewColumn. * @visible: %TRUE if the @tree_column is visible. - * + * * Sets the visibility of @tree_column. **/ void @@ -2033,7 +2033,7 @@ pspp_sheet_view_column_set_visible (PsppSheetViewColumn *tree_column, g_return_if_fail (PSPP_IS_SHEET_VIEW_COLUMN (tree_column)); visible = !! visible; - + if (tree_column->visible == visible) return; @@ -2049,9 +2049,9 @@ pspp_sheet_view_column_set_visible (PsppSheetViewColumn *tree_column, /** * pspp_sheet_view_column_get_visible: * @tree_column: A #PsppSheetViewColumn. - * + * * Returns %TRUE if @tree_column is visible. - * + * * Return value: whether the column is visible or not. If it is visible, then * the tree will show the column. **/ @@ -2067,7 +2067,7 @@ pspp_sheet_view_column_get_visible (PsppSheetViewColumn *tree_column) * pspp_sheet_view_column_set_resizable: * @tree_column: A #PsppSheetViewColumn * @resizable: %TRUE, if the column can be resized - * + * * If @resizable is %TRUE, then the user can explicitly resize the column by * grabbing the outer edge of the column button. **/ @@ -2092,9 +2092,9 @@ pspp_sheet_view_column_set_resizable (PsppSheetViewColumn *tree_column, /** * pspp_sheet_view_column_get_resizable: * @tree_column: A #PsppSheetViewColumn - * + * * Returns %TRUE if the @tree_column can be resized by the end user. - * + * * Return value: %TRUE, if the @tree_column can be resized. **/ gboolean @@ -2109,9 +2109,9 @@ pspp_sheet_view_column_get_resizable (PsppSheetViewColumn *tree_column) /** * pspp_sheet_view_column_get_width: * @tree_column: A #PsppSheetViewColumn. - * + * * Returns the current size of @tree_column in pixels. - * + * * Return value: The current width of @tree_column. **/ gint @@ -2126,7 +2126,7 @@ pspp_sheet_view_column_get_width (PsppSheetViewColumn *tree_column) * pspp_sheet_view_column_set_fixed_width: * @tree_column: A #PsppSheetViewColumn. * @fixed_width: The size to set @tree_column to. Must be greater than 0. - * + * * Sets the size of the column in pixels. The size of the column is clamped to * the min/max width for the column. Please note that the min/max width of the * column doesn't actually affect the "fixed_width" property of the widget, just @@ -2154,10 +2154,10 @@ pspp_sheet_view_column_set_fixed_width (PsppSheetViewColumn *tree_column, /** * pspp_sheet_view_column_get_fixed_width: * @tree_column: a #PsppSheetViewColumn - * + * * Gets the fixed width of the column. This value is only meaning may not be * the actual width of the column on the screen, just what is requested. - * + * * Return value: the fixed width of the column **/ gint @@ -2172,7 +2172,7 @@ pspp_sheet_view_column_get_fixed_width (PsppSheetViewColumn *tree_column) * pspp_sheet_view_column_set_min_width: * @tree_column: A #PsppSheetViewColumn. * @min_width: The minimum width of the column in pixels, or -1. - * + * * Sets the minimum width of the @tree_column. If @min_width is -1, then the * minimum width is unset. **/ @@ -2208,10 +2208,10 @@ pspp_sheet_view_column_set_min_width (PsppSheetViewColumn *tree_column, /** * pspp_sheet_view_column_get_min_width: * @tree_column: A #PsppSheetViewColumn. - * + * * Returns the minimum width in pixels of the @tree_column, or -1 if no minimum * width is set. - * + * * Return value: The minimum width of the @tree_column. **/ gint @@ -2226,7 +2226,7 @@ pspp_sheet_view_column_get_min_width (PsppSheetViewColumn *tree_column) * pspp_sheet_view_column_set_max_width: * @tree_column: A #PsppSheetViewColumn. * @max_width: The maximum width of the column in pixels, or -1. - * + * * Sets the maximum width of the @tree_column. If @max_width is -1, then the * maximum width is unset. Note, the column can actually be wider than max * width if it's the last column in a view. In this case, the column expands to @@ -2264,10 +2264,10 @@ pspp_sheet_view_column_set_max_width (PsppSheetViewColumn *tree_column, /** * pspp_sheet_view_column_get_max_width: * @tree_column: A #PsppSheetViewColumn. - * + * * Returns the maximum width in pixels of the @tree_column, or -1 if no maximum * width is set. - * + * * Return value: The maximum width of the @tree_column. **/ gint @@ -2281,7 +2281,7 @@ pspp_sheet_view_column_get_max_width (PsppSheetViewColumn *tree_column) /** * pspp_sheet_view_column_clicked: * @tree_column: a #PsppSheetViewColumn - * + * * Emits the "clicked" signal on the column. This function will only work if * @tree_column is clickable. **/ @@ -2300,7 +2300,7 @@ pspp_sheet_view_column_clicked (PsppSheetViewColumn *tree_column) * pspp_sheet_view_column_set_title: * @tree_column: A #PsppSheetViewColumn. * @title: The title of the @tree_column. - * + * * Sets the title of the @tree_column. If a custom widget has been set, then * this value is ignored. **/ @@ -2309,7 +2309,7 @@ pspp_sheet_view_column_set_title (PsppSheetViewColumn *tree_column, const gchar *title) { gchar *new_title; - + g_return_if_fail (PSPP_IS_SHEET_VIEW_COLUMN (tree_column)); new_title = g_strdup (title); @@ -2323,9 +2323,9 @@ pspp_sheet_view_column_set_title (PsppSheetViewColumn *tree_column, /** * pspp_sheet_view_column_get_title: * @tree_column: A #PsppSheetViewColumn. - * + * * Returns the title of the widget. - * + * * Return value: the title of the column. This string should not be * modified or freed. **/ @@ -2341,7 +2341,7 @@ pspp_sheet_view_column_get_title (PsppSheetViewColumn *tree_column) * pspp_sheet_view_column_set_expand: * @tree_column: A #PsppSheetViewColumn * @expand: %TRUE if the column should take available extra space, %FALSE if not - * + * * Sets the column to take available extra space. This space is shared equally * amongst all columns that have the expand set to %TRUE. If no column has this * option set, then the last column gets all extra space. By default, every @@ -2380,9 +2380,9 @@ pspp_sheet_view_column_set_expand (PsppSheetViewColumn *tree_column, /** * pspp_sheet_view_column_get_expand: * @tree_column: a #PsppSheetViewColumn - * + * * Return %TRUE if the column expands to take any available space. - * + * * Return value: %TRUE, if the column expands * * Since: 2.4 @@ -2399,7 +2399,7 @@ pspp_sheet_view_column_get_expand (PsppSheetViewColumn *tree_column) * pspp_sheet_view_column_set_clickable: * @tree_column: A #PsppSheetViewColumn. * @clickable: %TRUE if the header is active. - * + * * Sets the header to be active if @active is %TRUE. When the header is active, * then it can take keyboard focus, and can be clicked. **/ @@ -2421,9 +2421,9 @@ pspp_sheet_view_column_set_clickable (PsppSheetViewColumn *tree_column, /** * pspp_sheet_view_column_get_clickable: * @tree_column: a #PsppSheetViewColumn - * + * * Returns %TRUE if the user can click on the header for the column. - * + * * Return value: %TRUE if user can click the column header. **/ gboolean @@ -2452,7 +2452,7 @@ pspp_sheet_view_column_set_widget (PsppSheetViewColumn *tree_column, if (widget) g_object_ref_sink (widget); - if (tree_column->child) + if (tree_column->child) g_object_unref (tree_column->child); tree_column->child = widget; @@ -2463,10 +2463,10 @@ pspp_sheet_view_column_set_widget (PsppSheetViewColumn *tree_column, /** * pspp_sheet_view_column_get_widget: * @tree_column: A #PsppSheetViewColumn. - * + * * Returns the #GtkWidget in the button on the column header. If a custom * widget has not been set then %NULL is returned. - * + * * Return value: The #GtkWidget in the column header, or %NULL **/ GtkWidget * @@ -2481,7 +2481,7 @@ pspp_sheet_view_column_get_widget (PsppSheetViewColumn *tree_column) * pspp_sheet_view_column_set_alignment: * @tree_column: A #PsppSheetViewColumn. * @xalign: The alignment, which is between [0.0 and 1.0] inclusive. - * + * * Sets the alignment of the title or custom widget inside the column header. * The alignment determines its location inside the button. **/ @@ -2503,9 +2503,9 @@ pspp_sheet_view_column_set_alignment (PsppSheetViewColumn *tree_column, /** * pspp_sheet_view_column_get_alignment: * @tree_column: A #PsppSheetViewColumn. - * + * * Returns the current x alignment of @tree_column. - * + * * Return value: The current alignent of @tree_column. **/ GtkAlign @@ -2521,7 +2521,7 @@ pspp_sheet_view_column_get_alignment (PsppSheetViewColumn *tree_column) * pspp_sheet_view_column_set_reorderable: * @tree_column: A #PsppSheetViewColumn * @reorderable: %TRUE, if the column can be reordered. - * + * * If @reorderable is %TRUE, then the column can be reordered by the end user * dragging the header. **/ @@ -2546,9 +2546,9 @@ pspp_sheet_view_column_set_reorderable (PsppSheetViewColumn *tree_column, /** * pspp_sheet_view_column_get_reorderable: * @tree_column: A #PsppSheetViewColumn - * + * * Returns %TRUE if the @tree_column can be reordered by the user. - * + * * Return value: %TRUE if the @tree_column can be reordered by the user. **/ gboolean @@ -2768,7 +2768,7 @@ pspp_sheet_view_column_get_tabbable (PsppSheetViewColumn *tree_column) * @tree_column: a #PsppSheetViewColumn * @sort_column_id: The @sort_column_id of the model to sort on. * - * Sets the logical @sort_column_id that this column sorts on when this column + * Sets the logical @sort_column_id that this column sorts on when this column * is selected for sorting. Doing so makes the column header clickable. **/ void @@ -2847,7 +2847,7 @@ pspp_sheet_view_column_get_sort_column_id (PsppSheetViewColumn *tree_column) * the header button indicating the column is sorted. Call * pspp_sheet_view_column_set_sort_order() to change the direction of * the arrow. - * + * **/ void pspp_sheet_view_column_set_sort_indicator (PsppSheetViewColumn *tree_column, @@ -2868,9 +2868,9 @@ pspp_sheet_view_column_set_sort_indicator (PsppSheetViewColumn *tree_column, /** * pspp_sheet_view_column_get_sort_indicator: * @tree_column: a #PsppSheetViewColumn - * + * * Gets the value set by pspp_sheet_view_column_set_sort_indicator(). - * + * * Return value: whether the sort indicator arrow is displayed **/ gboolean @@ -2886,16 +2886,16 @@ pspp_sheet_view_column_get_sort_indicator (PsppSheetViewColumn *tree_column * @tree_column: a #PsppSheetViewColumn * @order: sort order that the sort indicator should indicate * - * Changes the appearance of the sort indicator. - * + * Changes the appearance of the sort indicator. + * * This does not actually sort the model. Use * pspp_sheet_view_column_set_sort_column_id() if you want automatic sorting * support. This function is primarily for custom sorting behavior, and should * be used in conjunction with gtk_tree_sortable_set_sort_column() to do - * that. For custom models, the mechanism will vary. - * + * that. For custom models, the mechanism will vary. + * * The sort indicator changes direction to indicate normal sort or reverse sort. - * Note that you must have the sort indicator enabled to see anything when + * Note that you must have the sort indicator enabled to see anything when * calling this function; see pspp_sheet_view_column_set_sort_indicator(). **/ void @@ -2915,9 +2915,9 @@ pspp_sheet_view_column_set_sort_order (PsppSheetViewColumn *tree_column /** * pspp_sheet_view_column_get_sort_order: * @tree_column: a #PsppSheetViewColumn - * + * * Gets the value set by pspp_sheet_view_column_set_sort_order(). - * + * * Return value: the sort order the sort indicator is indicating **/ GtkSortType @@ -2933,7 +2933,7 @@ pspp_sheet_view_column_get_sort_order (PsppSheetViewColumn *tree_column * @tree_column: A #PsppSheetViewColumn. * @tree_model: The #GtkTreeModel to to get the cell renderers attributes from. * @iter: The #GtkTreeIter to to get the cell renderer's attributes from. - * + * * Sets the cell renderer based on the @tree_model and @iter. That is, for * every attribute mapping in @tree_column, it will get a value from the set * column on the @iter, and use that value to set the attribute on the cell @@ -2987,7 +2987,7 @@ pspp_sheet_view_column_cell_set_cell_data (PsppSheetViewColumn *tree_column, * @y_offset: (allow-none): location to return y offset of a cell relative to @cell_area, or %NULL * @width: (allow-none): location to return width needed to render a cell, or %NULL * @height: (allow-none): location to return height needed to render a cell, or %NULL - * + * * Obtains the width and height needed to render the column. This is used * primarily by the #PsppSheetView. **/ @@ -3011,7 +3011,7 @@ pspp_sheet_view_column_cell_get_size (PsppSheetViewColumn *tree_column, * width = 0; gtk_widget_style_get (tree_column->tree_view, "focus-line-width", &focus_line_width, NULL); - + for (list = tree_column->cell_list; list; list = list->next) { PsppSheetViewColumnCellInfo *info = (PsppSheetViewColumnCellInfo *) list->data; @@ -3184,7 +3184,7 @@ pspp_sheet_view_column_cell_process_action (PsppSheetViewColumn *tree_column, if (real_cell_area.x - focus_line_width + info->real_width > cell_area->x + cell_area->width) { info->real_width = cell_area->x + cell_area->width - real_cell_area.x; - } + } if (real_cell_area.x > cell_area->x + cell_area->width) break; @@ -3204,7 +3204,7 @@ pspp_sheet_view_column_cell_process_action (PsppSheetViewColumn *tree_column, rtl_cell_area = real_cell_area; rtl_background_area = real_background_area; - + if (rtl) { rtl_cell_area.x = cell_area->x + cell_area->width - (real_cell_area.x - cell_area->x) - real_cell_area.width; @@ -3322,7 +3322,7 @@ pspp_sheet_view_column_cell_process_action (PsppSheetViewColumn *tree_column, g_return_val_if_fail (GTK_IS_CELL_EDITABLE (*editable_widget), FALSE); info->in_editing_mode = TRUE; pspp_sheet_view_column_focus_cell (tree_column, info->cell); - + flags &= ~GTK_CELL_RENDERER_FOCUSED; return TRUE; @@ -3362,7 +3362,7 @@ pspp_sheet_view_column_cell_process_action (PsppSheetViewColumn *tree_column, if (real_cell_area.x - focus_line_width + info->real_width > cell_area->x + cell_area->width) { info->real_width = cell_area->x + cell_area->width - real_cell_area.x; - } + } if (real_cell_area.x > cell_area->x + cell_area->width) break; @@ -3535,7 +3535,7 @@ pspp_sheet_view_column_cell_process_action (PsppSheetViewColumn *tree_column, * @background_area: entire cell area (including tree expanders and maybe padding on the sides) * @cell_area: area normally rendered by a cell renderer * @flags: flags that affect rendering - * + * * Renders the cell contained by #tree_column. This is used primarily by the * #PsppSheetView. **/ @@ -3857,7 +3857,7 @@ _pspp_sheet_view_column_cell_draw_focus (PsppSheetViewColumn *tree_column, { gint focus_line_width; GtkStateType cell_state; - + g_return_if_fail (PSPP_IS_SHEET_VIEW_COLUMN (tree_column)); gtk_widget_style_get (GTK_WIDGET (tree_column->tree_view), "focus-line-width", &focus_line_width, NULL); @@ -3876,7 +3876,7 @@ _pspp_sheet_view_column_cell_draw_focus (PsppSheetViewColumn *tree_column, cell_area->y - focus_line_width, cell_area->width + 2 * focus_line_width, cell_area->height + 2 * focus_line_width); -#endif +#endif } else { @@ -3909,11 +3909,11 @@ _pspp_sheet_view_column_cell_draw_focus (PsppSheetViewColumn *tree_column, /** * pspp_sheet_view_column_cell_is_visible: * @tree_column: A #PsppSheetViewColumn - * + * * Returns %TRUE if any of the cells packed into the @tree_column are visible. * For this to be meaningful, you must first initialize the cells with * pspp_sheet_view_column_cell_set_cell_data() - * + * * Return value: %TRUE, if any of the cells packed into the @tree_column are currently visible **/ gboolean @@ -4042,17 +4042,17 @@ _pspp_sheet_view_column_get_neighbor_sizes (PsppSheetViewColumn *column, l = r = 0; - list = pspp_sheet_view_column_cell_first (column); + list = pspp_sheet_view_column_cell_first (column); while (list) { info = (PsppSheetViewColumnCellInfo *)list->data; - + list = pspp_sheet_view_column_cell_next (column, list); if (info->cell == cell) break; - + if (gtk_cell_renderer_get_visible (info->cell)) l += info->real_width + column->spacing; } @@ -4060,7 +4060,7 @@ _pspp_sheet_view_column_get_neighbor_sizes (PsppSheetViewColumn *column, while (list) { info = (PsppSheetViewColumnCellInfo *)list->data; - + list = pspp_sheet_view_column_cell_next (column, list); if (gtk_cell_renderer_get_visible (info->cell)) @@ -4086,7 +4086,7 @@ _pspp_sheet_view_column_get_neighbor_sizes (PsppSheetViewColumn *column, * Obtains the horizontal position and size of a cell in a column. If the * cell is not found in the column, @start_pos and @width are not changed and * %FALSE is returned. - * + * * Return value: %TRUE if @cell belongs to @tree_column. */ gboolean @@ -4204,7 +4204,7 @@ attributes_text_element (GMarkupParseContext *context, glong l; gchar *endptr; gchar *string; - + if (!parser_data->attr_name) return; @@ -4213,7 +4213,7 @@ attributes_text_element (GMarkupParseContext *context, l = strtol (string, &endptr, 0); if (errno || endptr == string) { - g_set_error (error, + g_set_error (error, GTK_BUILDER_ERROR, GTK_BUILDER_ERROR_INVALID_VALUE, "Could not parse integer `%s'", @@ -4286,7 +4286,7 @@ _cell_layout_buildable_add_child (GtkBuildable *buildable, const gchar *type) { GtkCellLayoutIface *iface; - + g_return_if_fail (GTK_IS_CELL_LAYOUT (buildable)); g_return_if_fail (GTK_IS_CELL_RENDERER (child)); diff --git a/src/ui/gui/pspp-sheet-view.c b/src/ui/gui/pspp-sheet-view.c index 3499c24298..e06ed49a0a 100644 --- a/src/ui/gui/pspp-sheet-view.c +++ b/src/ui/gui/pspp-sheet-view.c @@ -615,10 +615,10 @@ pspp_sheet_view_class_init (PsppSheetViewClass *class) /** * PsppSheetView:hover-selection: - * + * * Enables of disables the hover selection mode of @tree_view. * Hover selection makes the selected row follow the pointer. - * Currently, this works only for the selection modes + * Currently, this works only for the selection modes * %PSPP_SHEET_SELECTION_SINGLE and %PSPP_SHEET_SELECTION_BROWSE. * * This mode is primarily intended for treeviews in popups, e.g. @@ -778,12 +778,12 @@ pspp_sheet_view_class_init (PsppSheetViewClass *class) * @column: the #PsppSheetViewColumn in which the activation occurred * * The "row-activated" signal is emitted when the method - * pspp_sheet_view_row_activated() is called or the user double clicks - * a treeview row. It is also emitted when a non-editable row is - * selected and one of the keys: Space, Shift+Space, Return or + * pspp_sheet_view_row_activated() is called or the user double clicks + * a treeview row. It is also emitted when a non-editable row is + * selected and one of the keys: Space, Shift+Space, Return or * Enter is pressed. - * - * For selection handling refer to the tree + * + * For selection handling refer to the tree * widget conceptual overview as well as #PsppSheetSelection. */ tree_view_signals[ROW_ACTIVATED] = @@ -799,8 +799,8 @@ pspp_sheet_view_class_init (PsppSheetViewClass *class) /** * PsppSheetView::columns-changed: - * @tree_view: the object on which the signal is emitted - * + * @tree_view: the object on which the signal is emitted + * * The number of columns of the treeview has changed. */ tree_view_signals[COLUMNS_CHANGED] = @@ -815,7 +815,7 @@ pspp_sheet_view_class_init (PsppSheetViewClass *class) /** * PsppSheetView::cursor-changed: * @tree_view: the object on which the signal is emitted - * + * * The position of the cursor (focused cell) has changed. */ tree_view_signals[CURSOR_CHANGED] = @@ -1061,9 +1061,9 @@ pspp_sheet_view_init (PsppSheetView *tree_view) tree_view->priv->search_equal_func = pspp_sheet_view_search_equal_func; tree_view->priv->search_custom_entry_set = FALSE; tree_view->priv->typeselect_flush_timeout = 0; - tree_view->priv->init_hadjust_value = TRUE; + tree_view->priv->init_hadjust_value = TRUE; tree_view->priv->width = 0; - + tree_view->priv->hover_selection = FALSE; tree_view->priv->rubber_banding_enable = FALSE; @@ -1563,7 +1563,7 @@ pspp_sheet_view_realize (GtkWidget *widget) /* Need to call those here, since they create GCs */ pspp_sheet_view_set_grid_lines (tree_view, tree_view->priv->grid_lines); - install_presize_handler (tree_view); + install_presize_handler (tree_view); } static void @@ -1610,7 +1610,7 @@ pspp_sheet_view_unrealize (GtkWidget *widget) g_source_remove (priv->typeselect_flush_timeout); priv->typeselect_flush_timeout = 0; } - + for (list = priv->columns; list; list = list->next) _pspp_sheet_view_column_unrealize_button (PSPP_SHEET_VIEW_COLUMN (list->data)); @@ -1684,12 +1684,12 @@ pspp_sheet_view_update_size (PsppSheetView *tree_view) if (tree_view->priv->model == NULL) { tree_view->priv->width = 0; - tree_view->priv->prev_width = 0; + tree_view->priv->prev_width = 0; tree_view->priv->height = 0; return; } - tree_view->priv->prev_width = tree_view->priv->width; + tree_view->priv->prev_width = tree_view->priv->width; tree_view->priv->width = 0; /* keep this in sync with size_allocate below */ @@ -1727,7 +1727,7 @@ pspp_sheet_view_size_request (GtkWidget *widget, PsppSheetView *tree_view = PSPP_SHEET_VIEW (widget); GList *tmp_list; - /* we validate some rows initially just to make sure we have some size. + /* we validate some rows initially just to make sure we have some size. * In practice, with a lot of static lists, this should get a good width. */ initialize_fixed_height_mode (tree_view); @@ -1781,11 +1781,11 @@ invalidate_column (PsppSheetView *tree_view, invalid_rect.y = 0; invalid_rect.width = column->width; invalid_rect.height = allocation.height; - + gdk_window_invalidate_rect (gtk_widget_get_window (widget), &invalid_rect, TRUE); break; } - + column_offset += tmpcolumn->width; } } @@ -1900,9 +1900,9 @@ pspp_sheet_view_size_allocate_columns (GtkWidget *widget, else extra_per_column = 0; - for (list = (rtl ? last_column : first_column); + for (list = (rtl ? last_column : first_column); list != (rtl ? first_column->prev : last_column->next); - list = (rtl ? list->prev : list->next)) + list = (rtl ? list->prev : list->next)) { gint real_requested_width = 0; gint old_width; @@ -2009,7 +2009,7 @@ pspp_sheet_view_size_allocate (GtkWidget *widget, if (allocation->width != old_allocation.width) width_changed = TRUE; - if (gtk_widget_get_direction(widget) == GTK_TEXT_DIR_RTL) + if (gtk_widget_get_direction(widget) == GTK_TEXT_DIR_RTL) allocation->x += allocation->width - tree_view->priv->width ; gtk_widget_set_allocation (widget, allocation); @@ -2025,7 +2025,7 @@ pspp_sheet_view_size_allocate (GtkWidget *widget, gtk_adjustment_set_lower (tree_view->priv->hadjustment, 0); gtk_adjustment_set_upper (tree_view->priv->hadjustment, MAX (gtk_adjustment_get_page_size (tree_view->priv->hadjustment), tree_view->priv->width)); - if (gtk_widget_get_direction(widget) == GTK_TEXT_DIR_RTL) + if (gtk_widget_get_direction(widget) == GTK_TEXT_DIR_RTL) { if (allocation->width < tree_view->priv->width) { @@ -2071,7 +2071,7 @@ pspp_sheet_view_size_allocate (GtkWidget *widget, pspp_sheet_view_top_row_to_dy (tree_view); else pspp_sheet_view_dy_to_top_row (tree_view); - + if (gtk_widget_get_realized (widget)) { gdk_window_move_resize (gtk_widget_get_window (widget), @@ -2836,7 +2836,7 @@ prelight_or_select (PsppSheetView *tree_view, gint y) { PsppSheetSelectionMode mode = pspp_sheet_selection_get_mode (tree_view->priv->selection); - + if (tree_view->priv->hover_selection && (mode == PSPP_SHEET_SELECTION_SINGLE || mode == PSPP_SHEET_SELECTION_BROWSE) && !(tree_view->priv->edited_column && @@ -2847,7 +2847,7 @@ prelight_or_select (PsppSheetView *tree_view, if (!pspp_sheet_view_node_is_selected (tree_view, node)) { GtkTreePath *path; - + path = _pspp_sheet_view_find_path (tree_view, node); pspp_sheet_selection_select_path (tree_view->priv->selection, path); if (pspp_sheet_view_node_is_selected (tree_view, node)) @@ -3071,7 +3071,7 @@ pspp_sheet_view_motion_drag_column (GtkWidget *widget, x = CLAMP (x + (gint)event->x - column->drag_x, 0, MAX (tree_view->priv->width, allocation.width) - column->allocation.width); gdk_window_move (tree_view->priv->drag_window, x, y); - + /* autoscroll, if needed */ pspp_sheet_view_horizontal_autoscroll (tree_view); /* Update the current reorder position and arrow; */ @@ -3339,7 +3339,7 @@ pspp_sheet_view_update_rubber_band (PsppSheetView *tree_view) invalid_region = cairo_region_create_rectangle (&old_area); cairo_region_union_rectangle (invalid_region, &new_area); - gdk_rectangle_intersect (GDK_RECTANGLE_PTR (&old_area), + gdk_rectangle_intersect (GDK_RECTANGLE_PTR (&old_area), GDK_RECTANGLE_PTR (&new_area), GDK_RECTANGLE_PTR (&common)); if (common.width > 2 && common.height > 2) { @@ -3358,7 +3358,7 @@ pspp_sheet_view_update_rubber_band (PsppSheetView *tree_view) } #if GTK_MAJOR_VERSION == 3 - gdk_window_invalidate_region (tree_view->priv->bin_window, invalid_region, TRUE); + gdk_window_invalidate_region (tree_view->priv->bin_window, invalid_region, TRUE); #else { cairo_rectangle_int_t extents; @@ -3600,7 +3600,7 @@ pspp_sheet_view_draw_bin (GtkWidget *widget, GdkRectangle exposed_rect; gdk_cairo_get_clip_rectangle (cr, &exposed_rect); - + Zarea.x = 0; Zarea.y = 0; Zarea.height = allocation.height; @@ -3628,10 +3628,10 @@ pspp_sheet_view_draw_bin (GtkWidget *widget, if (new_y < 0) new_y = 0; y_offset = -pspp_sheet_view_find_offset (tree_view, new_y, &node); - bin_window_width = + bin_window_width = gdk_window_get_width (tree_view->priv->bin_window); - bin_window_height = + bin_window_height = gdk_window_get_height (tree_view->priv->bin_window); @@ -3657,7 +3657,7 @@ pspp_sheet_view_draw_bin (GtkWidget *widget, &iter, path); gtk_tree_path_free (path); - + cursor_path = NULL; drag_dest_path = NULL; @@ -3683,7 +3683,7 @@ pspp_sheet_view_draw_bin (GtkWidget *widget, if (draw_vgrid_lines || draw_hgrid_lines) gtk_widget_style_get (widget, "grid-line-width", &grid_line_width, NULL); - + n_visible_columns = 0; for (list = tree_view->priv->columns; list; list = list->next) { @@ -4486,7 +4486,7 @@ pspp_sheet_view_key_press (GtkWidget *widget, ((GdkEventKey *) new_event)->window = g_object_ref (gtk_widget_get_window (tree_view->priv->search_window)); gtk_widget_realize (tree_view->priv->search_window); - popup_menu_id = g_signal_connect (tree_view->priv->search_entry, + popup_menu_id = g_signal_connect (tree_view->priv->search_entry, "popup-menu", G_CALLBACK (gtk_true), NULL); @@ -4504,7 +4504,7 @@ pspp_sheet_view_key_press (GtkWidget *widget, gdk_event_free (new_event); gtk_widget_hide (tree_view->priv->search_window); - g_signal_handler_disconnect (tree_view->priv->search_entry, + g_signal_handler_disconnect (tree_view->priv->search_entry, popup_menu_id); /* We check to make sure that the entry tried to handle the text, and that @@ -4693,7 +4693,7 @@ validate_row (PsppSheetView *tree_view, "wide-separators", &wide_separators, "separator-height", &separator_height, NULL); - + draw_vgrid_lines = tree_view->priv->grid_lines == PSPP_SHEET_VIEW_GRID_LINES_VERTICAL || tree_view->priv->grid_lines == PSPP_SHEET_VIEW_GRID_LINES_BOTH; @@ -5008,7 +5008,7 @@ do_presize_handler (PsppSheetView *tree_view) gtk_adjustment_changed (tree_view->priv->hadjustment); gtk_adjustment_changed (tree_view->priv->vadjustment); gtk_widget_queue_resize (GTK_WIDGET (tree_view)); - + return FALSE; } @@ -5016,7 +5016,7 @@ static gboolean presize_handler_callback (gpointer data) { do_presize_handler (PSPP_SHEET_VIEW (data)); - + return FALSE; } @@ -6608,7 +6608,7 @@ pspp_sheet_view_put (PsppSheetView *tree_view, PsppSheetViewColumn *column) { PsppSheetViewChild *child; - + g_return_if_fail (PSPP_IS_SHEET_VIEW (tree_view)); g_return_if_fail (GTK_IS_WIDGET (child_widget)); @@ -6626,7 +6626,7 @@ pspp_sheet_view_put (PsppSheetView *tree_view, if (gtk_widget_get_realized (GTK_WIDGET (tree_view))) gtk_widget_set_parent_window (child->widget, tree_view->priv->bin_window); - + gtk_widget_set_parent (child_widget, GTK_WIDGET (tree_view)); } @@ -6675,7 +6675,7 @@ pspp_sheet_view_row_changed (GtkTreeModel *model, if (gtk_widget_get_realized (GTK_WIDGET (tree_view))) pspp_sheet_view_node_queue_redraw (tree_view, node); } - + if (free_path) gtk_tree_path_free (path); } @@ -7003,7 +7003,7 @@ pspp_sheet_view_add_move_binding (GtkBindingSet *binding_set, GtkMovementStep step, gint count) { - + gtk_binding_entry_add_signal (binding_set, keyval, modmask, "move-cursor", 2, G_TYPE_ENUM, step, @@ -7094,7 +7094,7 @@ pspp_sheet_view_set_column_drag_info (PsppSheetView *tree_view, /* We know there are always 2 slots possbile, as you can always return column. */ /* If that's all there is, return */ - if (tree_view->priv->column_drag_info->next == NULL || + if (tree_view->priv->column_drag_info->next == NULL || (tree_view->priv->column_drag_info->next->next == NULL && ((PsppSheetViewColumnReorder *)tree_view->priv->column_drag_info->data)->right_column == column && ((PsppSheetViewColumnReorder *)tree_view->priv->column_drag_info->next->data)->left_column == column)) @@ -7192,7 +7192,7 @@ _pspp_sheet_view_column_start_drag (PsppSheetView *tree_view, send_event->button.axes = NULL; send_event->button.state = 0; send_event->button.button = 1; - send_event->button.device = + send_event->button.device = gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (display)); send_event->button.x_root = 0; @@ -8003,7 +8003,7 @@ pspp_sheet_view_real_select_cursor_row (PsppSheetView *tree_view, if (!(mode & PSPP_SHEET_SELECT_MODE_EXTEND)) pspp_sheet_view_row_activated (tree_view, cursor_path, tree_view->priv->focus_column); - + gtk_tree_path_free (cursor_path); return TRUE; @@ -8076,7 +8076,7 @@ send_focus_change (GtkWidget *widget, fevent->focus_change.type = GDK_FOCUS_CHANGE; fevent->focus_change.window = g_object_ref (gtk_widget_get_window (widget)); fevent->focus_change.in = in; - + gtk_widget_send_focus_change (widget, fevent); gdk_event_free (fevent); } @@ -8104,7 +8104,7 @@ pspp_sheet_view_ensure_interactive_directory (PsppSheetView *tree_view) gtk_window_set_screen (GTK_WINDOW (tree_view->priv->search_window), screen); return; } - + tree_view->priv->search_window = gtk_window_new (GTK_WINDOW_POPUP); gtk_window_set_screen (GTK_WINDOW (tree_view->priv->search_window), screen); @@ -8155,7 +8155,7 @@ pspp_sheet_view_ensure_interactive_directory (PsppSheetView *tree_view) } /* Pops up the interactive search entry. If keybinding is TRUE then the user - * started this by typing the start_interactive_search keybinding. Otherwise, it came from + * started this by typing the start_interactive_search keybinding. Otherwise, it came from */ static gboolean pspp_sheet_view_real_start_interactive_search (PsppSheetView *tree_view, @@ -8168,7 +8168,7 @@ pspp_sheet_view_real_start_interactive_search (PsppSheetView *tree_view, GList *list; gboolean found_focus = FALSE; GtkWidgetClass *entry_parent_class; - + if (!tree_view->priv->enable_search && !keybinding) return FALSE; @@ -8193,7 +8193,7 @@ pspp_sheet_view_real_start_interactive_search (PsppSheetView *tree_view, break; } } - + if (gtk_widget_has_focus (GTK_WIDGET (tree_view))) found_focus = TRUE; @@ -8264,7 +8264,7 @@ pspp_sheet_view_new_column_width (PsppSheetView *tree_view, rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL); column = g_list_nth (tree_view->priv->columns, i)->data; width = rtl ? (column->allocation.x + column->allocation.width - *x) : (*x - column->allocation.x); - + /* Clamp down the value */ if (column->min_width == -1) width = MAX (column->button_request, width); @@ -8274,11 +8274,11 @@ pspp_sheet_view_new_column_width (PsppSheetView *tree_view, width = MIN (width, column->max_width); *x = rtl ? (column->allocation.x + column->allocation.width - width) : (column->allocation.x + width); - + return width; } -void +void pspp_sheet_view_column_update_button (PsppSheetViewColumn *tree_column); /* Callbacks */ @@ -8713,7 +8713,7 @@ pspp_sheet_view_set_headers_visible (PsppSheetView *tree_view, gdk_window_get_position (tree_view->priv->bin_window, &x, &y); if (headers_visible) { - gdk_window_move_resize (tree_view->priv->bin_window, x, y + TREE_VIEW_HEADER_HEIGHT (tree_view), + gdk_window_move_resize (tree_view->priv->bin_window, x, y + TREE_VIEW_HEADER_HEIGHT (tree_view), tree_view->priv->width, allocation.height - + TREE_VIEW_HEADER_HEIGHT (tree_view)); if (gtk_widget_get_mapped (GTK_WIDGET (tree_view))) @@ -8803,11 +8803,11 @@ pspp_sheet_view_set_headers_clickable (PsppSheetView *tree_view, * * Since: 2.10 **/ -gboolean +gboolean pspp_sheet_view_get_headers_clickable (PsppSheetView *tree_view) { GList *list; - + g_return_val_if_fail (PSPP_IS_SHEET_VIEW (tree_view), FALSE); for (list = tree_view->priv->columns; list; list = list->next) @@ -8941,7 +8941,7 @@ pspp_sheet_view_remove_column (PsppSheetView *tree_view, } if (tree_view->priv->n_columns == 0 && - pspp_sheet_view_get_headers_visible (tree_view) && + pspp_sheet_view_get_headers_visible (tree_view) && tree_view->priv->header_window) gdk_window_hide (tree_view->priv->header_window); @@ -9581,11 +9581,11 @@ pspp_sheet_view_get_cursor (PsppSheetView *tree_view, * * Sets the current keyboard focus to be at @path, and selects it. This is * useful when you want to focus the user's attention on a particular row. If - * @focus_column is not %NULL, then focus is given to the column specified by - * it. Additionally, if @focus_column is specified, and @start_editing is - * %TRUE, then editing should be started in the specified cell. - * This function is often followed by @gtk_widget_grab_focus (@tree_view) - * in order to give keyboard focus to the widget. Please note that editing + * @focus_column is not %NULL, then focus is given to the column specified by + * it. Additionally, if @focus_column is specified, and @start_editing is + * %TRUE, then editing should be started in the specified cell. + * This function is often followed by @gtk_widget_grab_focus (@tree_view) + * in order to give keyboard focus to the widget. Please note that editing * can only happen when the widget is realized. * * If @path is invalid for @model, the current cursor (if any) will be unset @@ -9680,11 +9680,11 @@ pspp_sheet_view_set_cursor_on_cell (PsppSheetView *tree_view, /** * pspp_sheet_view_get_bin_window: * @tree_view: A #PsppSheetView - * + * * Returns the window that @tree_view renders to. This is used primarily to * compare to event->window to confirm that the event on * @tree_view is on the right window. - * + * * Return value: A #GdkWindow, or %NULL when @tree_view hasn't been realized yet **/ GdkWindow * @@ -9800,7 +9800,7 @@ pspp_sheet_view_get_path_at_pos (PsppSheetView *tree_view, { if (column) *column = last_column; - + if (cell_x) *cell_x = last_column->width + remaining_x; } @@ -10334,7 +10334,7 @@ pspp_sheet_view_get_visible_range (PsppSheetView *tree_view, { int node; gboolean retval; - + g_return_val_if_fail (PSPP_IS_SHEET_VIEW (tree_view), FALSE); if (!tree_view->priv->row_count) @@ -10427,7 +10427,7 @@ pspp_sheet_view_enable_model_drag_source (PsppSheetView *tree_view, * @n_targets: the number of items in @targets * @actions: the bitmask of possible actions for a drag from this * widget - * + * * Turns @tree_view into a drop destination for automatic DND. Calling * this method sets #PsppSheetView:reorderable to %FALSE. **/ @@ -10481,7 +10481,7 @@ pspp_sheet_view_unset_rows_drag_source (PsppSheetView *tree_view) if (!di->dest_set && !di->source_set) remove_info (tree_view); } - + unset_reorderable (tree_view); } @@ -10522,7 +10522,7 @@ pspp_sheet_view_unset_rows_drag_dest (PsppSheetView *tree_view) * @tree_view: a #PsppSheetView * @path: (allow-none): The path of the row to highlight, or %NULL. * @pos: Specifies whether to drop before, after or into the row - * + * * Sets the row that is highlighted for feedback. **/ void @@ -10599,7 +10599,7 @@ pspp_sheet_view_set_drag_dest_row (PsppSheetView *tree_view, * @tree_view: a #PsppSheetView * @path: (allow-none): Return location for the path of the highlighted row, or %NULL. * @pos: (allow-none): Return location for the drop position, or %NULL - * + * * Gets information about the row that is highlighted for feedback. **/ void @@ -10633,12 +10633,12 @@ pspp_sheet_view_get_drag_dest_row (PsppSheetView *tree_view, * @drag_y: the position to determine the destination row for * @path: (allow-none): Return location for the path of the highlighted row, or %NULL. * @pos: (allow-none): Return location for the drop position, or %NULL - * + * * Determines the destination row for a given position. @drag_x and * @drag_y are expected to be in widget coordinates. This function is only * meaningful if @tree_view is realized. Therefore this function will always * return %FALSE if @tree_view is not realized or does not have a model. - * + * * Return value: whether there is a row at the given position, %TRUE if this * is indeed the case. **/ @@ -10767,8 +10767,8 @@ pspp_sheet_view_set_destroy_count_func (PsppSheetView *tree_view, * * If @enable_search is set, then the user can type in text to search through * the tree interactively (this is sometimes called "typeahead find"). - * - * Note that even if this is %FALSE, the user can still initiate a search + * + * Note that even if this is %FALSE, the user can still initiate a search * using the "start-interactive-search" key binding. */ void @@ -10778,7 +10778,7 @@ pspp_sheet_view_set_enable_search (PsppSheetView *tree_view, g_return_if_fail (PSPP_IS_SHEET_VIEW (tree_view)); enable_search = !!enable_search; - + if (tree_view->priv->enable_search != enable_search) { tree_view->priv->enable_search = enable_search; @@ -10790,7 +10790,7 @@ pspp_sheet_view_set_enable_search (PsppSheetView *tree_view, * pspp_sheet_view_get_enable_search: * @tree_view: A #PsppSheetView * - * Returns whether or not the tree allows to start interactive searching + * Returns whether or not the tree allows to start interactive searching * by typing in text. * * Return value: whether or not to let the user search interactively @@ -10826,13 +10826,13 @@ pspp_sheet_view_get_search_column (PsppSheetView *tree_view) * @column: the column of the model to search in, or -1 to disable searching * * Sets @column as the column where the interactive search code should - * search in for the current model. - * + * search in for the current model. + * * If the search column is set, users can use the "start-interactive-search" * key binding to bring up search popup. The enable-search property controls * whether simply typing text will also start an interactive search. * - * Note that @column refers to a column of the current model. The search + * Note that @column refers to a column of the current model. The search * column is reset to -1 when the model is changed. */ void @@ -10972,7 +10972,7 @@ pspp_sheet_view_set_search_entry (PsppSheetView *tree_view, G_CALLBACK (pspp_sheet_view_search_init), tree_view); } - + g_signal_connect (tree_view->priv->search_entry, "key-press-event", G_CALLBACK (pspp_sheet_view_search_key_press_event), tree_view); @@ -11053,7 +11053,7 @@ pspp_sheet_view_search_dialog_hide (GtkWidget *search_dialog, g_source_remove (tree_view->priv->typeselect_flush_timeout); tree_view->priv->typeselect_flush_timeout = 0; } - + if (gtk_widget_get_visible (search_dialog)) { /* send focus-in event */ @@ -11134,12 +11134,12 @@ pspp_sheet_view_search_activate (GtkEntry *entry, if (gtk_tree_row_reference_valid (tree_view->priv->cursor)) { path = gtk_tree_row_reference_get_path (tree_view->priv->cursor); - + _pspp_sheet_view_find_node (tree_view, path, &node); - + if (node >= 0 && pspp_sheet_view_node_is_selected (tree_view, node)) pspp_sheet_view_row_activated (tree_view, path, tree_view->priv->focus_column); - + gtk_tree_path_free (path); } } @@ -11545,7 +11545,7 @@ pspp_sheet_view_remove_widget (GtkCellEditable *cell_editable, tree_view); gtk_container_remove (GTK_CONTAINER (tree_view), - GTK_WIDGET (cell_editable)); + GTK_WIDGET (cell_editable)); /* FIXME should only redraw a single node */ gtk_widget_queue_draw (GTK_WIDGET (tree_view)); @@ -11926,12 +11926,12 @@ pspp_sheet_view_stop_editing (PsppSheetView *tree_view, * * Enables of disables the hover selection mode of @tree_view. * Hover selection makes the selected row follow the pointer. - * Currently, this works only for the selection modes + * Currently, this works only for the selection modes * %PSPP_SHEET_SELECTION_SINGLE and %PSPP_SHEET_SELECTION_BROWSE. - * + * * Since: 2.6 **/ -void +void pspp_sheet_view_set_hover_selection (PsppSheetView *tree_view, gboolean hover) { @@ -11948,14 +11948,14 @@ pspp_sheet_view_set_hover_selection (PsppSheetView *tree_view, /** * pspp_sheet_view_get_hover_selection: * @tree_view: a #PsppSheetView - * + * * Returns whether hover selection mode is turned on for @tree_view. - * + * * Return value: %TRUE if @tree_view is in hover selection mode * - * Since: 2.6 + * Since: 2.6 **/ -gboolean +gboolean pspp_sheet_view_get_hover_selection (PsppSheetView *tree_view) { return tree_view->priv->hover_selection; @@ -11969,7 +11969,7 @@ pspp_sheet_view_get_hover_selection (PsppSheetView *tree_view) * Enables or disables rubber banding in @tree_view. If the selection mode is * #PSPP_SHEET_SELECTION_MULTIPLE or #PSPP_SHEET_SELECTION_RECTANGLE, rubber * banding will allow the user to select multiple rows by dragging the mouse. - * + * * Since: 2.10 **/ void @@ -11989,12 +11989,12 @@ pspp_sheet_view_set_rubber_banding (PsppSheetView *tree_view, /** * pspp_sheet_view_get_rubber_banding: * @tree_view: a #PsppSheetView - * + * * Returns whether rubber banding is turned on for @tree_view. If the * selection mode is #PSPP_SHEET_SELECTION_MULTIPLE or * #PSPP_SHEET_SELECTION_RECTANGLE, rubber banding will allow the user to * select multiple rows by dragging the mouse. - * + * * Return value: %TRUE if rubber banding in @tree_view is enabled. * * Since: 2.10 @@ -12008,7 +12008,7 @@ pspp_sheet_view_get_rubber_banding (PsppSheetView *tree_view) /** * pspp_sheet_view_is_rubber_banding_active: * @tree_view: a #PsppSheetView - * + * * Returns whether a rubber banding operation is currently being done * in @tree_view. * @@ -12103,11 +12103,11 @@ pspp_sheet_view_set_grid_lines (PsppSheetView *tree_view, old_grid_lines = priv->grid_lines; priv->grid_lines = grid_lines; - + if (old_grid_lines != grid_lines) { gtk_widget_queue_draw (GTK_WIDGET (tree_view)); - + g_object_notify (G_OBJECT (tree_view), "enable-grid-lines"); } } @@ -12489,11 +12489,11 @@ _gtk_boolean_handled_accumulator (GSignalInvocationHint *ihint, { gboolean continue_emission; gboolean signal_handled; - + signal_handled = g_value_get_boolean (handler_return); g_value_set_boolean (return_accu, signal_handled); continue_emission = !signal_handled; - + return continue_emission; } diff --git a/src/ui/gui/pspp-widget-facade.c b/src/ui/gui/pspp-widget-facade.c index f6406f5043..a95040bdf7 100644 --- a/src/ui/gui/pspp-widget-facade.c +++ b/src/ui/gui/pspp-widget-facade.c @@ -349,7 +349,7 @@ facade_button_render (GtkWidget *base, get_layout_location (base, &label_area, layout, xpad, ypad, xalign, yalign, &x, &y); - gtk_paint_layout (label_style, cr, state_type, FALSE, + gtk_paint_layout (label_style, cr, state_type, FALSE, base, "label", x, y, layout); g_object_unref (layout); diff --git a/src/ui/gui/psppire-buttonbox.c b/src/ui/gui/psppire-buttonbox.c index 12d474559d..87989cf12b 100644 --- a/src/ui/gui/psppire-buttonbox.c +++ b/src/ui/gui/psppire-buttonbox.c @@ -419,7 +419,7 @@ psppire_button_flags_get_type (void) { PSPPIRE_BUTTON_PASTE_MASK, "PSPPIRE_BUTTON_PASTE_MASK", "Accept dialog and paste syntax" }, { 0, NULL, NULL } }; - + ftype = g_flags_register_static (g_intern_static_string ("PsppireButtonFlags"), values); diff --git a/src/ui/gui/psppire-cell-renderer-button.c b/src/ui/gui/psppire-cell-renderer-button.c index 62a781ff5f..e801cc6bf3 100644 --- a/src/ui/gui/psppire-cell-renderer-button.c +++ b/src/ui/gui/psppire-cell-renderer-button.c @@ -191,7 +191,7 @@ psppire_cell_renderer_button_render (GtkCellRenderer *cell, GtkStateType state_type; PsppireCellRendererButton *button = PSPPIRE_CELL_RENDERER_BUTTON (cell); gfloat xalign, yalign; - + if (!button->editable || ! gtk_cell_renderer_get_sensitive (cell)) state_type = GTK_STATE_INSENSITIVE; else if (flags & GTK_CELL_RENDERER_SELECTED) @@ -226,7 +226,7 @@ psppire_cell_renderer_button_render (GtkCellRenderer *cell, { cairo_set_line_width (cr, 1.0); cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE); - cairo_move_to (cr, + cairo_move_to (cr, cell_area->x, cell_area->y + cell_area->height); @@ -548,7 +548,7 @@ psppire_cell_renderer_button_dispose (GObject *obj) if (button->dispose_has_run) return; - + button->dispose_has_run = TRUE; /* When called with NULL, as we are doing here, update_style_cache diff --git a/src/ui/gui/psppire-checkbox-treeview.c b/src/ui/gui/psppire-checkbox-treeview.c index 04f49d3747..3e144d5bec 100644 --- a/src/ui/gui/psppire-checkbox-treeview.c +++ b/src/ui/gui/psppire-checkbox-treeview.c @@ -15,7 +15,7 @@ along with this program. If not, see . */ -/* +/* This module provides a subclass of GtkTreeView, designed for dialogs which need lists of annotated checkbox items. The object contains the necessary model and renderers, which means that @@ -118,7 +118,7 @@ static void psppire_checkbox_treeview_init (PsppireCheckboxTreeview *cbtv) { cbtv->list = GTK_TREE_MODEL (gtk_list_store_new (N_CHECKBOX_COLUMNS, - G_TYPE_STRING, + G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_STRING)); diff --git a/src/ui/gui/psppire-conf.c b/src/ui/gui/psppire-conf.c index ed8077db2d..d0b082cbe3 100644 --- a/src/ui/gui/psppire-conf.c +++ b/src/ui/gui/psppire-conf.c @@ -96,7 +96,7 @@ static void conf_write (PsppireConf *conf) { if ( conf->idle == 0) - conf->idle = g_idle_add_full (G_PRIORITY_LOW, + conf->idle = g_idle_add_full (G_PRIORITY_LOW, (GSourceFunc) flush_conf, conf, NULL); } @@ -351,12 +351,12 @@ psppire_conf_set_enum (PsppireConf *conf, { GEnumClass *ec = g_type_class_ref (enum_type); GEnumValue *ev = g_enum_get_value (ec, value); - + g_key_file_set_string (conf->keyfile, base, name, ev->value_nick); g_type_class_unref (ec); - + conf_write (conf); } diff --git a/src/ui/gui/psppire-data-editor.c b/src/ui/gui/psppire-data-editor.c index 85fa58b331..ab3a5f0668 100644 --- a/src/ui/gui/psppire-data-editor.c +++ b/src/ui/gui/psppire-data-editor.c @@ -684,7 +684,7 @@ psppire_data_editor_init (PsppireDataEditor *de) GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (de)); gtk_style_context_add_class (context, "psppire-data-editor"); - + de->font = NULL; de->old_vbox_widget = NULL; @@ -845,7 +845,7 @@ psppire_data_editor_split_window (PsppireDataEditor *de, gboolean split) de->old_vbox_widget = de->datasheet_vbox_widget; g_object_ref (de->old_vbox_widget); /* FIXME: old_vbox_widget needs to be unreffed in dispose. - (currently it seems to provoke an error if I do that. + (currently it seems to provoke an error if I do that. I don't know why. */ gtk_container_remove (GTK_CONTAINER (de->vbox), de->datasheet_vbox_widget); diff --git a/src/ui/gui/psppire-data-sheet.c b/src/ui/gui/psppire-data-sheet.c index b4e3d5f3d6..962fa1ef2b 100644 --- a/src/ui/gui/psppire-data-sheet.c +++ b/src/ui/gui/psppire-data-sheet.c @@ -1344,7 +1344,7 @@ psppire_data_sheet_class_init (PsppireDataSheetClass *class) TRUE, G_PARAM_READWRITE)); - + g_object_class_install_property ( gobject_class, PROP_MAY_DELETE_VARS, @@ -1360,7 +1360,7 @@ do_row_popup_menu (GtkWidget *widget, guint button, guint32 time) { PsppireDataSheet *data_sheet = PSPPIRE_DATA_SHEET (widget); - + gtk_menu_popup (GTK_MENU (data_sheet->row_popup_menu), NULL, NULL, NULL, NULL, button, time); } @@ -1437,7 +1437,7 @@ on_selection_changed (PsppSheetSelection *selection, GtkWidget *top = gtk_widget_get_toplevel (GTK_WIDGET (data_sheet)); if (! PSPPIRE_IS_DATA_WINDOW (top)) return; - + PsppireDataWindow *dw = PSPPIRE_DATA_WINDOW (top); gint n_selected_rows = pspp_sheet_selection_count_selected_rows (selection); @@ -1594,7 +1594,7 @@ psppire_data_sheet_edit_clear_variables (PsppireDataSheet *data_sheet) PsppireDict *dict = data_sheet->data_store->dict; GList *iter; GList *list = pspp_sheet_selection_get_selected_columns (selection); - + if (list == NULL) return; list = g_list_reverse (list); @@ -1667,10 +1667,10 @@ psppire_data_sheet_init (PsppireDataSheet *obj) g_signal_connect_swapped (clear_cases, "activate", G_CALLBACK (psppire_data_sheet_edit_clear_cases), obj); g_signal_connect_swapped (insert_case, "activate", G_CALLBACK (psppire_data_sheet_insert_case), obj); - + gtk_widget_show_all (obj->row_popup_menu); } - + { obj->column_popup_menu = gtk_menu_new (); int i = 0; @@ -1685,19 +1685,19 @@ psppire_data_sheet_init (PsppireDataSheet *obj) g_signal_connect_swapped (obj->pu_sort_up, "activate", G_CALLBACK (on_sort_up), obj); g_signal_connect_swapped (obj->pu_sort_down, "activate", G_CALLBACK (on_sort_down), obj); - + gtk_menu_attach (GTK_MENU (obj->column_popup_menu), insert_variable, 0, 1, i, i + 1); ++i; gtk_menu_attach (GTK_MENU (obj->column_popup_menu), clear_variables, 0, 1, i, i + 1); ++i; gtk_menu_attach (GTK_MENU (obj->column_popup_menu), gtk_separator_menu_item_new (), 0, 1, i, i + 1); ++i; - + gtk_menu_attach (GTK_MENU (obj->column_popup_menu), obj->pu_sort_up, 0, 1, i, i + 1); ++i; gtk_menu_attach (GTK_MENU (obj->column_popup_menu), obj->pu_sort_down, 0, 1, i, i + 1); ++i; gtk_widget_show_all (obj->column_popup_menu); } - + g_signal_connect (obj, "notify::model", G_CALLBACK (psppire_data_sheet_model_changed), NULL); @@ -1710,7 +1710,7 @@ psppire_data_sheet_init (PsppireDataSheet *obj) G_CALLBACK (on_query_tooltip), NULL); g_signal_connect (obj, "button-press-event", G_CALLBACK (on_button_pressed), NULL); - + g_signal_connect (obj, "popup-menu", G_CALLBACK (on_popup_menu), NULL); g_signal_connect (pspp_sheet_view_get_selection (sheet_view), @@ -2307,7 +2307,7 @@ psppire_data_sheet_update_clip_actions (PsppireDataSheet *data_sheet) GtkWidget *top = gtk_widget_get_toplevel (GTK_WIDGET (data_sheet)); if (! PSPPIRE_IS_DATA_WINDOW (top)) return; - + PsppireDataWindow *dw = PSPPIRE_DATA_WINDOW (top); gboolean enable = psppire_data_sheet_get_selected_range (data_sheet, &rows, &cols); @@ -2462,7 +2462,7 @@ on_owner_change (GtkClipboard *clip, GdkEventOwnerChange *event, gpointer data) GtkWidget *top = gtk_widget_get_toplevel (GTK_WIDGET (data_sheet)); if (! PSPPIRE_IS_DATA_WINDOW (top)) return; - + PsppireDataWindow *dw = PSPPIRE_DATA_WINDOW (top); gtk_clipboard_request_targets (clip, diff --git a/src/ui/gui/psppire-data-sheet.h b/src/ui/gui/psppire-data-sheet.h index 0a7cc18e37..3870a92099 100644 --- a/src/ui/gui/psppire-data-sheet.h +++ b/src/ui/gui/psppire-data-sheet.h @@ -63,12 +63,12 @@ struct _PsppireDataSheet GtkWidget *column_popup_menu; GtkWidget *row_popup_menu; - + GtkWidget *pu_sort_up; GtkWidget *pu_sort_down; }; -struct _PsppireDataSheetClass +struct _PsppireDataSheetClass { PsppSheetViewClass parent_class; }; diff --git a/src/ui/gui/psppire-data-window.c b/src/ui/gui/psppire-data-window.c index c9f87d7f67..99c0c6ac69 100644 --- a/src/ui/gui/psppire-data-window.c +++ b/src/ui/gui/psppire-data-window.c @@ -203,7 +203,7 @@ transformation_change_callback (bool transformations_pending, "transform-pending"); g_simple_action_set_enabled (G_SIMPLE_ACTION (action), - transformations_pending); + transformations_pending); } if ( transformations_pending) @@ -382,15 +382,15 @@ load_file (PsppireWindow *de, const gchar *file_name, const char *encoding, { gchar *utf8_file_name; struct string filename; - + utf8_file_name = g_filename_to_utf8 (file_name, -1, NULL, NULL, NULL); if (NULL == utf8_file_name) return FALSE; - ds_init_empty (&filename); + ds_init_empty (&filename); syntax_gen_string (&filename, ss_cstr (utf8_file_name)); - + g_free (utf8_file_name); if (encoding && encoding[0]) @@ -415,7 +415,7 @@ load_file (PsppireWindow *de, const gchar *file_name, const char *encoding, mime_type = "application/x-spss-por"; else if (name_has_sav_suffix (file_name)) mime_type = "application/x-spss-sav"; - + add_most_recent (file_name, mime_type, encoding); } @@ -704,7 +704,7 @@ static void status_bar_activate (GAction *action, GVariant *param, PsppireDataWindow *de) { GtkWidget *statusbar = get_widget_assert (de->builder, "status-bar"); - + GVariant *state = g_action_get_state (action); const gboolean visible = g_variant_get_boolean (state); g_action_change_state (action, g_variant_new_boolean (!visible)); @@ -746,7 +746,7 @@ on_switch_page (GtkNotebook *notebook, GtkWidget *page, guint pn, gpointer ud) gtk_widget_show (GTK_WIDGET (de->mi_clear_cases)); break; - + case 1: g_action_change_state (action, g_variant_new_string ("VARS")); gtk_widget_hide (GTK_WIDGET (de->ti_insert_case)); @@ -758,9 +758,9 @@ on_switch_page (GtkNotebook *notebook, GtkWidget *page, guint pn, gpointer ud) gtk_widget_hide (GTK_WIDGET (de->mi_find)); gtk_widget_hide (GTK_WIDGET (de->mi_find_separator)); gtk_widget_hide (GTK_WIDGET (de->mi_clear_cases)); - + break; - } + } } @@ -790,7 +790,7 @@ fonts_activate (PsppireDataWindow *de) GtkWidget *dialog = gtk_font_chooser_dialog_new (NULL, GTK_WINDOW (toplevel)); GtkStyleContext *style = gtk_widget_get_style_context (GTK_WIDGET(de->data_editor)); const PangoFontDescription *current_font ; - + gtk_style_context_get (style, GTK_STATE_FLAG_NORMAL, "font", ¤t_font, NULL); gtk_font_chooser_set_font_desc (GTK_FONT_CHOOSER (dialog), current_font); @@ -822,7 +822,7 @@ value_labels_activate (GAction *action, GVariant *param, PsppireDataWindow *de GVariant *new_state = g_action_get_state (action); labels_active = g_variant_get_boolean (new_state); g_object_set (de->data_editor, "value-labels", labels_active, NULL); - + gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (de->ti_value_labels_button), labels_active); } @@ -917,7 +917,7 @@ on_recent_files_select (GtkMenuShell *menushell, gpointer user_data) free (encoding); - if ( psppire_window_load (PSPPIRE_WINDOW (se), file, encoding, NULL) ) + if ( psppire_window_load (PSPPIRE_WINDOW (se), file, encoding, NULL) ) gtk_widget_show (se); else gtk_widget_destroy (se); @@ -967,14 +967,14 @@ file_import (PsppireDataWindow *dw) GtkWidget *w = psppire_import_assistant_new (GTK_WINDOW (dw)); PsppireImportAssistant *asst = PSPPIRE_IMPORT_ASSISTANT (w); gtk_widget_show_all (w); - + asst->main_loop = g_main_loop_new (NULL, TRUE); g_main_loop_run (asst->main_loop); g_main_loop_unref (asst->main_loop); if (!asst->file_name) goto end; - + switch (asst->response) { case GTK_RESPONSE_APPLY: @@ -990,8 +990,8 @@ file_import (PsppireDataWindow *dw) default: break; } - - end: + + end: gtk_widget_destroy (GTK_WIDGET (asst)); } @@ -1003,7 +1003,7 @@ connect_dialog_action (GType type, PsppireDataWindow *de) GAction *act = g_object_new (type, "top-level", de, NULL); - + g_action_map_add_action (G_ACTION_MAP (de), act); } @@ -1017,7 +1017,7 @@ static void connect_action_to_menuitem (GActionMap *map, const gchar *action_name, GtkWidget *w, const gchar *accel) { GAction *a = g_action_map_lookup_action (map, action_name); - + if (NULL == a) g_error ("Action \"%s\" not found in map", action_name); @@ -1044,13 +1044,13 @@ connect_action_to_menuitem (GActionMap *map, const gchar *action_name, GtkWidget detailed_action_name = g_strdup_printf ("win.%s", action_name); else if (GTK_IS_APPLICATION (map)) detailed_action_name = g_strdup_printf ("app.%s", action_name); - + gtk_application_set_accels_for_action (app, detailed_action_name, accels); free (detailed_action_name); } - + g_signal_connect_swapped (w, "activate", G_CALLBACK (g_action_activate_null), a); } @@ -1171,23 +1171,23 @@ create_file_menu (PsppireDataWindow *dw) GtkWidget *new_menu = gtk_menu_new (); g_object_set (new, "submenu", new_menu, NULL); - + GtkWidget *syntax = gtk_menu_item_new_with_mnemonic (_("_Syntax")); connect_action_to_menuitem (G_ACTION_MAP (g_application_get_default ()), "new-syntax", syntax, 0); - + GtkWidget *data = gtk_menu_item_new_with_mnemonic (_("_Data")); connect_action_to_menuitem (G_ACTION_MAP (g_application_get_default ()), "new-data", data, 0); gtk_menu_attach (GTK_MENU (new_menu), syntax, 0, 1, 0, 1); gtk_menu_attach (GTK_MENU (new_menu), data, 0, 1, 1, 2); } - + GtkWidget *open = gtk_menu_item_new_with_mnemonic (_("_Open")); connect_action_to_menuitem (G_ACTION_MAP (dw), "open", open, "O"); - + GtkWidget *import = gtk_menu_item_new_with_mnemonic (_("_Import Data...")); connect_action_to_menuitem (G_ACTION_MAP (dw), "file-import", import, 0); - + gtk_menu_attach (GTK_MENU (menu), open, 0, 1, 1, 2); gtk_menu_attach (GTK_MENU (menu), import, 0, 1, 2, 3); @@ -1195,14 +1195,14 @@ create_file_menu (PsppireDataWindow *dw) GtkWidget *save = gtk_menu_item_new_with_mnemonic (_("_Save...")); connect_action_to_menuitem (G_ACTION_MAP (dw), "save", save, "S"); - + GtkWidget *save_as = gtk_menu_item_new_with_mnemonic (_("Save _As...")); connect_action_to_menuitem (G_ACTION_MAP (dw), "save-as", save_as, "S"); - + GtkWidget *rename_dataset = gtk_menu_item_new_with_mnemonic (_("_Rename Dataset...")); connect_action_to_menuitem (G_ACTION_MAP (dw), "rename-dataset", rename_dataset, 0); - + gtk_menu_attach (GTK_MENU (menu), save, 0, 1, 4, 5); gtk_menu_attach (GTK_MENU (menu), save_as, 0, 1, 5, 6); gtk_menu_attach (GTK_MENU (menu), rename_dataset, 0, 1, 6, 7); @@ -1216,7 +1216,7 @@ create_file_menu (PsppireDataWindow *dw) GtkWidget *dd_menu = gtk_menu_new (); g_object_set (display_data, "submenu", dd_menu, NULL); - + GtkWidget *working_file = gtk_menu_item_new_with_mnemonic (_("Working File")); connect_action_to_menuitem (G_ACTION_MAP (dw), "info-working", working_file, 0); GtkWidget *external_file = gtk_menu_item_new_with_mnemonic (_("_External File...")); @@ -1225,7 +1225,7 @@ create_file_menu (PsppireDataWindow *dw) gtk_menu_attach (GTK_MENU (dd_menu), working_file, 0, 1, 0, 1); gtk_menu_attach (GTK_MENU (dd_menu), external_file, 0, 1, 1, 2); } - + gtk_menu_attach (GTK_MENU (menu), gtk_separator_menu_item_new (), 0, 1, 9, 10); { @@ -1240,13 +1240,13 @@ create_file_menu (PsppireDataWindow *dw) gtk_menu_attach (GTK_MENU (menu), mi_data, 0, 1, 10, 11); gtk_menu_attach (GTK_MENU (menu), mi_files, 0, 1, 11, 12); - + g_object_set (menu_data, "show-tips", TRUE, NULL); g_object_set (menu_files, "show-tips", TRUE, NULL); g_object_set (mi_data, "submenu", menu_data, NULL); g_object_set (mi_files, "submenu", menu_files, NULL); - + { GtkRecentFilter *filter = gtk_recent_filter_new (); @@ -1283,10 +1283,10 @@ create_file_menu (PsppireDataWindow *dw) connect_action_to_menuitem (G_ACTION_MAP (g_application_get_default ()), "quit", quit, "Q"); } - + g_object_set (menuitem, "submenu", menu, NULL); gtk_widget_show_all (menuitem); - + return menuitem; } @@ -1313,13 +1313,13 @@ create_edit_menu (PsppireDataWindow *dw) GAction *a = g_action_map_lookup_action (G_ACTION_MAP (dw), "PsppireDialogActionVarInfo"); g_assert (a); g_signal_connect_swapped (go_to_variable, "activate", G_CALLBACK (psppire_dialog_action_activate_null), a); - + gtk_menu_attach (GTK_MENU (menu), go_to_variable, 0, 1, i, i + 1); ++i; gtk_menu_attach (GTK_MENU (menu), dw->mi_go_to_case, 0, 1, i, i + 1); ++i; { GtkAccelGroup *ag = gtk_accel_group_new (); - + dw->mi_edit_separator = gtk_separator_menu_item_new (); gtk_menu_attach (GTK_MENU (menu), dw->mi_edit_separator, 0, 1, i, i + 1); ++i; @@ -1330,13 +1330,13 @@ create_edit_menu (PsppireDataWindow *dw) gtk_window_add_accel_group (GTK_WINDOW (dw), ag); gtk_widget_add_accelerator (dw->mi_cut, "activate", ag, 'X', GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); - + dw->mi_copy = gtk_menu_item_new_with_mnemonic (_("_Copy")); gtk_menu_attach (GTK_MENU (menu), dw->mi_copy, 0, 1, i, i + 1); ++i; g_signal_connect_swapped (dw->mi_copy, "activate", G_CALLBACK (on_copy), dw); gtk_widget_add_accelerator (dw->mi_copy, "activate", ag, 'C', GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); - + dw->mi_paste = gtk_menu_item_new_with_mnemonic (_("_Paste")); gtk_menu_attach (GTK_MENU (menu), dw->mi_paste, 0, 1, i, i + 1); ++i; g_signal_connect_swapped (dw->mi_paste, "activate", G_CALLBACK (on_paste), dw); @@ -1346,16 +1346,16 @@ create_edit_menu (PsppireDataWindow *dw) dw->mi_clear_variables = gtk_menu_item_new_with_mnemonic (_("Clear _Variables")); gtk_menu_attach (GTK_MENU (menu), dw->mi_clear_variables, 0, 1, i, i + 1); ++i; g_signal_connect_swapped (dw->mi_clear_variables, "activate", G_CALLBACK (on_clear_variables), dw); - + dw->mi_clear_cases = gtk_menu_item_new_with_mnemonic (_("Cl_ear Cases")); gtk_menu_attach (GTK_MENU (menu), dw->mi_clear_cases, 0, 1, i, i + 1); ++i; g_signal_connect_swapped (dw->mi_clear_cases, "activate", G_CALLBACK (on_clear_cases), dw); } - + { dw->mi_find_separator = gtk_separator_menu_item_new (); gtk_menu_attach (GTK_MENU (menu), dw->mi_find_separator, 0, 1, i, i + 1); ++i; - + dw->mi_find = gtk_menu_item_new_with_mnemonic (_("_Find...")); g_signal_connect_swapped (dw->mi_find, "activate", G_CALLBACK (find_dialog), dw); gtk_menu_attach (GTK_MENU (menu), dw->mi_find, 0, 1, i, i + 1); ++i; @@ -1367,11 +1367,11 @@ create_edit_menu (PsppireDataWindow *dw) G_CALLBACK (options_dialog), dw); gtk_menu_attach (GTK_MENU (menu), dw->mi_options, 0, 1, i, i + 1); ++i; } - + g_object_set (menuitem, "submenu", menu, NULL); - + gtk_widget_show_all (menuitem); - + return menuitem; } @@ -1406,7 +1406,7 @@ psppire_data_window_finish_init (PsppireDataWindow *de, de->data_editor = PSPPIRE_DATA_EDITOR (psppire_data_editor_new (de->dict, de->data_store)); - + g_signal_connect (de, "realize", G_CALLBACK (set_data_page), de); @@ -1455,7 +1455,7 @@ psppire_data_window_finish_init (PsppireDataWindow *de, connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_FLIP, de); connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_AGGREGATE, de); connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_WEIGHT, de); - + connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_COMPUTE, de); connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_COUNT, de); connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_AUTORECODE, de); @@ -1464,7 +1464,7 @@ psppire_data_window_finish_init (PsppireDataWindow *de, connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_RECODE_SAME, de); connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_RECODE_DIFFERENT, de); - + connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_DESCRIPTIVES, de); connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_FREQUENCIES, de); connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_EXAMINE, de); @@ -1485,7 +1485,7 @@ psppire_data_window_finish_init (PsppireDataWindow *de, connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_REGRESSION, de); connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_LOGISTIC, de); connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_ROC, de); - + connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_COMMENTS, de); connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_VAR_INFO, de); @@ -1505,7 +1505,7 @@ psppire_data_window_finish_init (PsppireDataWindow *de, g_signal_connect_swapped (file_import_action, "activate", G_CALLBACK (file_import), de); g_action_map_add_action (G_ACTION_MAP (de), G_ACTION (file_import_action)); } - + { GSimpleAction *save = g_simple_action_new ("save", NULL); g_signal_connect_swapped (save, "activate", G_CALLBACK (psppire_window_save), de); @@ -1554,7 +1554,7 @@ psppire_data_window_finish_init (PsppireDataWindow *de, g_action_map_add_action (G_ACTION_MAP (de), G_ACTION (act_gridlines)); } - + { GSimpleAction *act_view_data = g_simple_action_new_stateful ("view_dv", G_VARIANT_TYPE_STRING, g_variant_new_string ("DATA")); @@ -1610,7 +1610,7 @@ psppire_data_window_finish_init (PsppireDataWindow *de, g_signal_connect_swapped (find, "activate", G_CALLBACK (find_dialog), de); g_action_map_add_action (G_ACTION_MAP (de), G_ACTION (find)); } - + { int idx = 0; { @@ -1644,12 +1644,12 @@ psppire_data_window_finish_init (PsppireDataWindow *de, { de->ti_jump_to_case = gtk_tool_button_new (NULL, "Jump to Case"); - + GAction *a = g_action_map_lookup_action (G_ACTION_MAP (de), "jump-to-case"); g_assert (a); g_signal_connect_swapped (de->ti_jump_to_case, "clicked", G_CALLBACK (g_action_activate_null), a); - + gtk_toolbar_insert (GTK_TOOLBAR (hb), de->ti_jump_to_case, idx++); gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (de->ti_jump_to_case), "edit-go-to-case"); gtk_widget_set_tooltip_text (GTK_WIDGET (de->ti_jump_to_case), _("Jump to a case in the data sheet")); @@ -1663,7 +1663,7 @@ psppire_data_window_finish_init (PsppireDataWindow *de, g_signal_connect_swapped (de->ti_find, "clicked", G_CALLBACK (g_action_activate_null), a); - + gtk_toolbar_insert (GTK_TOOLBAR (hb), de->ti_find, idx++); gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (de->ti_find), "edit-find"); gtk_widget_set_tooltip_text (GTK_WIDGET (de->ti_find), _("Search for values in the data")); @@ -1880,7 +1880,7 @@ psppire_data_window_new (struct dataset *ds) GApplication *app = g_application_get_default (); gtk_application_add_window (GTK_APPLICATION (app), GTK_WINDOW (dw)); - + return dw; } @@ -1952,7 +1952,7 @@ create_data_window (void) GtkWidget *w = psppire_data_window_new (NULL); gtk_widget_show (w); - + return GTK_WINDOW (w); } diff --git a/src/ui/gui/psppire-dialog-action-aggregate.c b/src/ui/gui/psppire-dialog-action-aggregate.c index 66dda9edcd..ac667ef822 100644 --- a/src/ui/gui/psppire-dialog-action-aggregate.c +++ b/src/ui/gui/psppire-dialog-action-aggregate.c @@ -136,7 +136,7 @@ dialog_state_valid (gpointer user_data) return FALSE; liststore = GTK_TREE_MODEL (PSPPIRE_ACR (agg->summary_acr)->list_store); - + if ( ! gtk_tree_model_get_iter_first (liststore, &iter)) return FALSE; @@ -194,12 +194,12 @@ render_summary (GtkTreeViewColumn *tree_column, gpointer data) { PsppireDialogActionAggregate *agg = data; - + GString *string = g_string_new (""); append_summary_spec (agg, iter, string); - + g_object_set (cell, "text", string->str, NULL); g_string_free (string, TRUE); @@ -216,7 +216,7 @@ choose_filename (PsppireDialogActionAggregate *fd) _("Cancel"), GTK_RESPONSE_CANCEL, _("Save"), GTK_RESPONSE_ACCEPT, NULL); - + g_object_set (dialog, "local-only", FALSE, NULL); gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE); @@ -287,7 +287,7 @@ populate_combo_model (GtkComboBox *cb) } -enum +enum { SUMMARY_COL_VARNAME = 0, SUMMARY_COL_VARLABEL, @@ -416,7 +416,7 @@ on_acr_change (const PsppireDialogActionAggregate *agg, GtkTreeView *tv) double arg1, arg2; gchar *text1 = g_strdup (""); gchar *text2 = g_strdup (""); - + GtkTreeIter iter; GtkTreeModel *model = gtk_tree_view_get_model (tv); GtkTreeSelection *sel = gtk_tree_view_get_selection (tv); @@ -434,7 +434,7 @@ on_acr_change (const PsppireDialogActionAggregate *agg, GtkTreeView *tv) gtk_entry_set_text (GTK_ENTRY (agg->summary_var_name_entry), varname); gtk_entry_set_text (GTK_ENTRY (agg->summary_var_label_entry), label); gtk_entry_set_text (GTK_ENTRY (agg->summary_sv_entry), srcvar); - + text1 = c_xasprintf ("%.*g", DBL_DIG + 1, arg1); text2 = c_xasprintf ("%.*g", DBL_DIG + 1, arg2); } @@ -504,7 +504,7 @@ psppire_dialog_action_aggregate_activate (PsppireDialogAction *a) GtkWidget *break_selector = get_widget_assert (xml, "break-selector"); act->pane = get_widget_assert (xml, "hbox1"); - + act->break_variables = get_widget_assert (xml, "psppire-var-view1"); act->filename_radiobutton = get_widget_assert (xml, "filename-radiobutton"); act->filename_button = get_widget_assert (xml, "filename-button"); @@ -541,7 +541,7 @@ psppire_dialog_action_aggregate_activate (PsppireDialogAction *a) GtkListStore *list = gtk_list_store_new (6, G_TYPE_STRING, G_TYPE_STRING, - G_TYPE_INT, + G_TYPE_INT, G_TYPE_STRING, G_TYPE_DOUBLE, G_TYPE_DOUBLE); @@ -567,7 +567,7 @@ psppire_dialog_action_aggregate_activate (PsppireDialogAction *a) g_signal_connect_swapped (PSPPIRE_ACR (act->summary_acr)->tv, "cursor-changed", G_CALLBACK (on_acr_change), act); } - + g_signal_connect_swapped (act->summary_var_name_entry, "changed", G_CALLBACK (update_acr), act); g_signal_connect_swapped (act->function_combo, "changed", G_CALLBACK (update_acr), act); g_signal_connect_swapped (act->summary_sv_entry, "changed", G_CALLBACK (update_acr), act); @@ -658,14 +658,14 @@ append_summary_spec (const PsppireDialogActionAggregate *agg, GtkTreeIter *iter, g_string_append (string, ds_cstr (&ss)); ds_destroy (&ss); } - + g_string_append_printf (string, " = %s", funcname); if ( has_src_vars != AGR_SV_NO) { struct string dss; ds_init_cstr (&dss, " ("); - + ds_put_cstr (&dss, srcvar); if ( arity > 0) diff --git a/src/ui/gui/psppire-dialog-action-autorecode.c b/src/ui/gui/psppire-dialog-action-autorecode.c index 505ff30261..ad36dd0bc4 100644 --- a/src/ui/gui/psppire-dialog-action-autorecode.c +++ b/src/ui/gui/psppire-dialog-action-autorecode.c @@ -40,13 +40,13 @@ static gboolean dialog_state_valid (gpointer pda) { PsppireDialogActionAutorecode *rd = PSPPIRE_DIALOG_ACTION_AUTORECODE (pda); - + GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (rd->var_view)); const gint n_vars = gtk_tree_model_iter_n_children (model, NULL); if (n_vars == 0) return FALSE; - + if (g_hash_table_size (rd->varmap) != n_vars) return FALSE; @@ -73,7 +73,7 @@ refresh (PsppireDialogAction *pda) gtk_list_store_clear (GTK_LIST_STORE (target_list)); - + } /* Name-Label pair */ @@ -115,7 +115,7 @@ static char * generate_syntax (const PsppireDialogAction *act) { PsppireDialogActionAutorecode *rd = PSPPIRE_DIALOG_ACTION_AUTORECODE (act); - + GHashTableIter iter; gpointer key, value; gchar *text; @@ -125,7 +125,7 @@ generate_syntax (const PsppireDialogAction *act) g_string_append (string, "\n\tVARIABLES ="); g_hash_table_iter_init (&iter, rd->varmap); - while (g_hash_table_iter_next (&iter, &key, &value)) + while (g_hash_table_iter_next (&iter, &key, &value)) { struct variable *var = key; g_string_append (string, " "); @@ -135,7 +135,7 @@ generate_syntax (const PsppireDialogAction *act) g_string_append (string, " INTO"); g_hash_table_iter_init (&iter, rd->varmap); - while (g_hash_table_iter_next (&iter, &key, &value)) + while (g_hash_table_iter_next (&iter, &key, &value)) { struct nlp *nlp = value; g_string_append (string, " "); @@ -213,10 +213,10 @@ on_entry_change (PsppireDialogActionAutorecode *rd) gpointer key, value; g_hash_table_iter_init (&iter, rd->varmap); - while (g_hash_table_iter_next (&iter, &key, &value)) + while (g_hash_table_iter_next (&iter, &key, &value)) { struct nlp *nlp = value; - + if ( 0 == strcmp (nlp->name, text)) { valid = FALSE; @@ -252,7 +252,7 @@ on_selection_change (GtkTreeSelection *selection, gpointer data) GtkTreeIter iter; gtk_widget_set_sensitive (rd->new_name_entry, TRUE); - gtk_widget_set_sensitive (rd->change_button, TRUE); + gtk_widget_set_sensitive (rd->change_button, TRUE); ok = gtk_tree_model_get_iter (model, &iter, (GtkTreePath*) rows->data); @@ -292,10 +292,10 @@ render_new_var_name (GtkTreeViewColumn *tree_column, PsppireDialogActionAutorecode *rd = PSPPIRE_DIALOG_ACTION_AUTORECODE (data); - + struct variable *var = NULL; - gtk_tree_model_get (tree_model, iter, + gtk_tree_model_get (tree_model, iter, 0, &var, -1); @@ -376,7 +376,7 @@ psppire_dialog_action_autorecode_activate (PsppireDialogAction *a) } } - + psppire_dialog_action_set_refresh (pda, refresh); psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid); diff --git a/src/ui/gui/psppire-dialog-action-barchart.c b/src/ui/gui/psppire-dialog-action-barchart.c index ee85831b64..adbd8b956b 100644 --- a/src/ui/gui/psppire-dialog-action-barchart.c +++ b/src/ui/gui/psppire-dialog-action-barchart.c @@ -67,7 +67,7 @@ refresh (PsppireDialogAction *rd_) This ensures that the signal handler gets called. */ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rd->button_summary_func), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rd->button_freq_func[0]), TRUE); - + gtk_widget_set_sensitive (rd->combobox, FALSE); gtk_combo_box_set_active (GTK_COMBO_BOX (rd->combobox), 0); @@ -137,13 +137,13 @@ psppire_dialog_action_barchart_activate (PsppireDialogAction *a) act->button_freq_func[1] = get_widget_assert (xml, "radiobutton-percent"); act->button_freq_func[2] = get_widget_assert (xml, "radiobutton-cum-count"); act->button_freq_func[3] = get_widget_assert (xml, "radiobutton-cum-percent"); - + act->button_summary_func = get_widget_assert (xml, "radiobutton3"); act->summary_variables = get_widget_assert (xml, "hbox1"); act->combobox = get_widget_assert (xml, "combobox1"); populate_combo_model (GTK_COMBO_BOX(act->combobox)); - + g_signal_connect_swapped (act->button_summary_func, "toggled", G_CALLBACK (on_summary_toggle), act); @@ -216,7 +216,7 @@ generate_syntax (const PsppireDialogAction *a) g_string_append (string, " BY "); g_string_append (string, var_name_cluster); } - + g_string_append (string, ".\n"); text = string->str; diff --git a/src/ui/gui/psppire-dialog-action-binomial.c b/src/ui/gui/psppire-dialog-action-binomial.c index cafed134a2..6ca3905c3a 100644 --- a/src/ui/gui/psppire-dialog-action-binomial.c +++ b/src/ui/gui/psppire-dialog-action-binomial.c @@ -53,7 +53,7 @@ get_proportion (PsppireDialogActionBinomial *act, double *prop) if (endptr == text) return FALSE; - return TRUE; + return TRUE; } static gboolean diff --git a/src/ui/gui/psppire-dialog-action-chisquare.c b/src/ui/gui/psppire-dialog-action-chisquare.c index 3a45e4a714..a8dc856b77 100644 --- a/src/ui/gui/psppire-dialog-action-chisquare.c +++ b/src/ui/gui/psppire-dialog-action-chisquare.c @@ -51,8 +51,8 @@ generate_syntax (const PsppireDialogAction *act) if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (scd->range_button))) { ds_put_cstr (&dss, "("); - - ds_put_cstr (&dss, + + ds_put_cstr (&dss, gtk_entry_get_text (GTK_ENTRY (scd->value_lower))); ds_put_cstr (&dss, ", "); @@ -72,7 +72,7 @@ generate_syntax (const PsppireDialogAction *act) ds_put_cstr (&dss, "\n\t"); ds_put_cstr (&dss, "/EXPECTED = "); - + for (ok = gtk_tree_model_get_iter_first (GTK_TREE_MODEL(ls), &iter); ok; @@ -165,17 +165,17 @@ psppire_dialog_action_chisquare_activate (PsppireDialogAction *a) psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid); psppire_dialog_action_set_refresh (pda, refresh); - g_signal_connect (act->range_button, "toggled", - G_CALLBACK (set_sensitivity_from_toggle), + g_signal_connect (act->range_button, "toggled", + G_CALLBACK (set_sensitivity_from_toggle), range_table); - g_signal_connect (act->values_button, "toggled", - G_CALLBACK (set_sensitivity_from_toggle), + g_signal_connect (act->values_button, "toggled", + G_CALLBACK (set_sensitivity_from_toggle), values_acr); - g_signal_connect (act->values_button, "toggled", - G_CALLBACK (set_sensitivity_from_toggle), + g_signal_connect (act->values_button, "toggled", + G_CALLBACK (set_sensitivity_from_toggle), expected_value_entry); psppire_acr_set_entry (PSPPIRE_ACR (values_acr), diff --git a/src/ui/gui/psppire-dialog-action-comments.c b/src/ui/gui/psppire-dialog-action-comments.c index bbb0a9dfda..dcbe4ddaca 100644 --- a/src/ui/gui/psppire-dialog-action-comments.c +++ b/src/ui/gui/psppire-dialog-action-comments.c @@ -188,13 +188,13 @@ psppire_dialog_action_comments_activate (PsppireDialogAction *pda) act->check = get_widget_assert (xml, "comments-checkbutton1"); g_signal_connect_swapped (pda->dialog, "show", G_CALLBACK (retrieve_comments), pda); - + { PangoContext * context ; PangoLayout * layout ; PangoRectangle rect; - + /* Since we're going to truncate lines to 80 chars, we need a monospaced font otherwise it'll look silly */ PangoFontDescription *font_desc = @@ -222,7 +222,7 @@ psppire_dialog_action_comments_activate (PsppireDialogAction *pda) GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); g_object_unref (cssp); } - + /* And let's just make sure that a complete line fits into the widget's width */ context = gtk_widget_create_pango_context (act->textview); @@ -242,7 +242,7 @@ psppire_dialog_action_comments_activate (PsppireDialogAction *pda) pango_font_description_free (font_desc); } - + g_signal_connect (buffer, "mark-set", G_CALLBACK (set_column_number), label); @@ -252,7 +252,7 @@ psppire_dialog_action_comments_activate (PsppireDialogAction *pda) gtk_text_buffer_get_iter_at_offset (buffer, &iter, 0); gtk_text_buffer_place_cursor (buffer, &iter); } - + psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid); psppire_dialog_action_set_refresh (pda, refresh); } diff --git a/src/ui/gui/psppire-dialog-action-count.c b/src/ui/gui/psppire-dialog-action-count.c index 337e38a01c..8f9a9281ef 100644 --- a/src/ui/gui/psppire-dialog-action-count.c +++ b/src/ui/gui/psppire-dialog-action-count.c @@ -51,7 +51,7 @@ generate_syntax (const PsppireDialogAction *act) gboolean ok; GtkTreeIter iter; struct string dds; - + ds_init_empty (&dds); ds_put_cstr (&dds, "\nCOUNT "); @@ -230,7 +230,7 @@ set_value (gint col, GValue *val, gpointer data) PsppireDialogActionCount *cnt = PSPPIRE_DIALOG_ACTION_COUNT (data); PsppireValChooser *vc = PSPPIRE_VAL_CHOOSER (cnt->chooser); struct old_value ov; - + g_assert (col == 0); psppire_val_chooser_get_status (vc, &ov); diff --git a/src/ui/gui/psppire-dialog-action-crosstabs.c b/src/ui/gui/psppire-dialog-action-crosstabs.c index 97bdc46ba4..8c1891d918 100644 --- a/src/ui/gui/psppire-dialog-action-crosstabs.c +++ b/src/ui/gui/psppire-dialog-action-crosstabs.c @@ -51,7 +51,7 @@ dialog_state_valid (gpointer data) GtkTreeIter notused; - return (gtk_tree_model_get_iter_first (row_vars, ¬used) + return (gtk_tree_model_get_iter_first (row_vars, ¬used) && gtk_tree_model_get_iter_first (col_vars, ¬used)); } @@ -62,7 +62,7 @@ refresh (PsppireDialogAction *rd_) GtkTreeModel *liststore = gtk_tree_view_get_model (GTK_TREE_VIEW (cd->dest_rows)); gtk_list_store_clear (GTK_LIST_STORE (liststore)); - + liststore = gtk_tree_view_get_model (GTK_TREE_VIEW (cd->dest_cols)); gtk_list_store_clear (GTK_LIST_STORE (liststore)); } @@ -159,7 +159,7 @@ on_format_clicked (PsppireDialogActionCrosstabs *cd) cd->format_options_table = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (cd->table_button)); - cd->format_options_pivot = + cd->format_options_pivot = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (cd->pivot_button)); } } @@ -291,7 +291,7 @@ generate_syntax (const PsppireDialogAction *a) if (cd->format_options_avalue) g_string_append (string, "AVALUE"); - else + else g_string_append (string, "DVALUE"); g_string_append (string, " "); @@ -303,20 +303,20 @@ generate_syntax (const PsppireDialogAction *a) if (cd->format_options_pivot) g_string_append (string, "PIVOT"); - else + else g_string_append (string, "NOPIVOT"); selected = 0; - for (i = 0, ok = gtk_tree_model_get_iter_first (cd->stat, &iter); ok; + for (i = 0, ok = gtk_tree_model_get_iter_first (cd->stat, &iter); ok; i++, ok = gtk_tree_model_iter_next (cd->stat, &iter)) { gboolean toggled; gtk_tree_model_get (cd->stat, &iter, - CHECKBOX_COLUMN_SELECTED, &toggled, -1); - if (toggled) - selected |= 1u << i; - else + CHECKBOX_COLUMN_SELECTED, &toggled, -1); + if (toggled) + selected |= 1u << i; + else selected &= ~(1u << i); } @@ -337,15 +337,15 @@ generate_syntax (const PsppireDialogAction *a) } selected = 0; - for (i = 0, ok = gtk_tree_model_get_iter_first (cd->cell, &iter); ok; + for (i = 0, ok = gtk_tree_model_get_iter_first (cd->cell, &iter); ok; i++, ok = gtk_tree_model_iter_next (cd->cell, &iter)) { gboolean toggled; gtk_tree_model_get (cd->cell, &iter, - CHECKBOX_COLUMN_SELECTED, &toggled, -1); - if (toggled) - selected |= 1u << i; - else + CHECKBOX_COLUMN_SELECTED, &toggled, -1); + if (toggled) + selected |= 1u << i; + else selected &= ~(1u << i); } diff --git a/src/ui/gui/psppire-dialog-action-crosstabs.h b/src/ui/gui/psppire-dialog-action-crosstabs.h index a286e0f828..ac287057b7 100644 --- a/src/ui/gui/psppire-dialog-action-crosstabs.h +++ b/src/ui/gui/psppire-dialog-action-crosstabs.h @@ -20,7 +20,7 @@ #include "psppire-dialog-action.h" -/* +/* This module provides a subclass of GtkTreeView, designed for dialogs which need lists of annotated checkbox items. The object contains the necessary model and renderers, which means that @@ -71,7 +71,7 @@ struct _PsppireDialogActionCrosstabs GtkWidget *col_vars; GtkWidget *row_vars; - GtkWidget *dest_rows; + GtkWidget *dest_rows; GtkWidget *dest_cols ; GtkWidget *format_button ; GtkWidget *stat_button ; diff --git a/src/ui/gui/psppire-dialog-action-descriptives.c b/src/ui/gui/psppire-dialog-action-descriptives.c index 325596307e..1acaaaecc6 100644 --- a/src/ui/gui/psppire-dialog-action-descriptives.c +++ b/src/ui/gui/psppire-dialog-action-descriptives.c @@ -221,7 +221,7 @@ psppire_dialog_action_descriptives_activate (PsppireDialogAction *a) "predicate", var_is_numeric, NULL); act->stat_vars = GTK_TREE_VIEW (act->variables); - + act->include_user_missing = GTK_TOGGLE_BUTTON (get_widget_assert (xml, "include_user_missing")); act->exclude_missing_listwise = diff --git a/src/ui/gui/psppire-dialog-action-examine.c b/src/ui/gui/psppire-dialog-action-examine.c index 02a073cfba..8a643820ea 100644 --- a/src/ui/gui/psppire-dialog-action-examine.c +++ b/src/ui/gui/psppire-dialog-action-examine.c @@ -240,7 +240,7 @@ psppire_dialog_action_examine_activate (PsppireDialogAction *a) act->stats_dialog = get_widget_assert (xml, "statistics-dialog"); act->descriptives_button = get_widget_assert (xml, "descriptives-button"); - act->extremes_button = get_widget_assert (xml, "extremes-button"); + act->extremes_button = get_widget_assert (xml, "extremes-button"); act->percentiles_button = get_widget_assert (xml, "percentiles-button"); act->opts_dialog = get_widget_assert (xml, "options-dialog"); @@ -258,7 +258,7 @@ psppire_dialog_action_examine_activate (PsppireDialogAction *a) g_signal_connect_swapped (opts_button, "clicked", G_CALLBACK (run_opts_dialog), act); - + g_list_free (list); } diff --git a/src/ui/gui/psppire-dialog-action-factor.c b/src/ui/gui/psppire-dialog-action-factor.c index a417cc2d67..1debfc674a 100644 --- a/src/ui/gui/psppire-dialog-action-factor.c +++ b/src/ui/gui/psppire-dialog-action-factor.c @@ -38,7 +38,7 @@ static void psppire_dialog_action_factor_class_init (PsppireDialogActionFac G_DEFINE_TYPE (PsppireDialogActionFactor, psppire_dialog_action_factor, PSPPIRE_TYPE_DIALOG_ACTION); -static const char *rot_method_syntax[] = +static const char *rot_method_syntax[] = { "NOROTATE", "VARIMAX", @@ -105,7 +105,7 @@ generate_syntax (const PsppireDialogAction *act) ds_put_cstr (&str, "\n\t/PRINT = "); ds_put_cstr (&str, "INITIAL "); - if ( rd->extraction.unrotated ) + if ( rd->extraction.unrotated ) ds_put_cstr (&str, "EXTRACTION "); if ( rd->rotation.rotated_solution ) @@ -133,7 +133,7 @@ load_rotation_parameters (PsppireDialogActionFactor *fd, const struct rotation_p { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fd->display_rotated_solution), p->rotated_solution); - + gtk_spin_button_set_value (GTK_SPIN_BUTTON (fd->rotate_iterations), p->iterations); @@ -184,7 +184,7 @@ load_extraction_parameters (PsppireDialogActionFactor *fd, const struct extracti gtk_combo_box_set_active (GTK_COMBO_BOX (fd->extraction_combo), 1); else gtk_combo_box_set_active (GTK_COMBO_BOX (fd->extraction_combo), 0); - + } static gboolean diff --git a/src/ui/gui/psppire-dialog-action-factor.h b/src/ui/gui/psppire-dialog-action-factor.h index 432a717863..8e4fe867d6 100644 --- a/src/ui/gui/psppire-dialog-action-factor.h +++ b/src/ui/gui/psppire-dialog-action-factor.h @@ -74,7 +74,7 @@ struct extraction_parameters gint n_factors; gint n_iterations; - gboolean explicit_nfactors; + gboolean explicit_nfactors; gboolean covariance; gboolean scree; diff --git a/src/ui/gui/psppire-dialog-action-frequencies.h b/src/ui/gui/psppire-dialog-action-frequencies.h index a06eee3e0d..9f6c122e4d 100644 --- a/src/ui/gui/psppire-dialog-action-frequencies.h +++ b/src/ui/gui/psppire-dialog-action-frequencies.h @@ -100,7 +100,7 @@ struct _PsppireDialogActionFrequencies GtkWidget * avalue; GtkWidget * dvalue; GtkWidget * afreq; - GtkWidget * dfreq; + GtkWidget * dfreq; GtkWidget *tables_dialog; diff --git a/src/ui/gui/psppire-dialog-action-indep-samps.c b/src/ui/gui/psppire-dialog-action-indep-samps.c index de0d373be9..b13c444c5b 100644 --- a/src/ui/gui/psppire-dialog-action-indep-samps.c +++ b/src/ui/gui/psppire-dialog-action-indep-samps.c @@ -96,7 +96,7 @@ value_entry_contains_invalid (PsppireValueEntry *ve, const struct variable *var) { gboolean result = FALSE; - if (var) + if (var) { union value val; const int width = var_get_width (var); @@ -157,9 +157,9 @@ run_define_groups (PsppireDialogActionIndepSamps *act) PsppireDialogAction *da = PSPPIRE_DIALOG_ACTION (act); GtkWidget *parent1 = gtk_widget_get_parent (act->dg_table1); GtkWidget *parent2 = gtk_widget_get_parent (act->dg_table2); - + g_return_if_fail (act->grp_var); - + if (parent1) gtk_container_remove (GTK_CONTAINER (parent1), act->dg_table1); @@ -307,7 +307,7 @@ psppire_dialog_action_indep_samps_activate (PsppireDialogAction *a) g_hash_table_insert (thing, a, xml); } - pda->dialog = get_widget_assert (xml,"independent-samples-dialog"); + pda->dialog = get_widget_assert (xml,"independent-samples-dialog"); pda->source = get_widget_assert (xml, "indep-samples-treeview1"); act->define_groups_button = get_widget_assert (xml, "define-groups-button"); act->options_button = get_widget_assert (xml, "indep-samples-options-button"); @@ -376,16 +376,16 @@ generate_syntax (const PsppireDialogAction *a) g_string_append (str, "("); { - const union value *val = + const union value *val = (act->group_defn == GROUPS_VALUES) ? &act->grp_val[0] : &act->cut_point; - struct string strx; + struct string strx; ds_init_empty (&strx); syntax_gen_value (&strx, val, var_get_width (act->grp_var), var_get_print_format (act->grp_var)); - + g_string_append (str, ds_cstr (&strx)); ds_destroy (&strx); } @@ -397,10 +397,10 @@ generate_syntax (const PsppireDialogAction *a) { struct string strx; ds_init_empty (&strx); - + syntax_gen_value (&strx, &act->grp_val[1], var_get_width (act->grp_var), var_get_print_format (act->grp_var)); - + g_string_append (str, ds_cstr (&strx)); ds_destroy (&strx); } diff --git a/src/ui/gui/psppire-dialog-action-k-related.c b/src/ui/gui/psppire-dialog-action-k-related.c index e8760fc4ba..87c34c1665 100644 --- a/src/ui/gui/psppire-dialog-action-k-related.c +++ b/src/ui/gui/psppire-dialog-action-k-related.c @@ -78,11 +78,11 @@ dialog_state_valid (gpointer data) return FALSE; /* At least one checkbutton must be active */ - if ( + if ( ! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (krd->friedman)) - && + && ! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (krd->kendal)) - && + && ! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (krd->cochran)) ) return FALSE; diff --git a/src/ui/gui/psppire-dialog-action-logistic.c b/src/ui/gui/psppire-dialog-action-logistic.c index dcff91278a..e4887352ca 100644 --- a/src/ui/gui/psppire-dialog-action-logistic.c +++ b/src/ui/gui/psppire-dialog-action-logistic.c @@ -79,14 +79,14 @@ on_opts_clicked (PsppireDialogActionLogistic *act) gtk_spin_button_set_value (GTK_SPIN_BUTTON (act->cut_point_entry), act->cut_point); gtk_spin_button_set_value (GTK_SPIN_BUTTON (act->iterations_entry), act->max_iterations); - + ret = psppire_dialog_run (PSPPIRE_DIALOG (act->opts_dialog)); if ( ret == PSPPIRE_RESPONSE_CONTINUE ) { act->conf = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(act->conf_checkbox)); act->conf_level = gtk_spin_button_get_value (GTK_SPIN_BUTTON (act->conf_entry)); - + act->constant = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(act->const_checkbox)); act->cut_point = gtk_spin_button_get_value (GTK_SPIN_BUTTON (act->cut_point_entry)); @@ -134,7 +134,7 @@ psppire_dialog_action_logistic_activate (PsppireDialogAction *a) G_CALLBACK (on_opts_clicked), act); g_signal_connect (act->conf_checkbox, "toggled", - G_CALLBACK (set_sensitivity_from_toggle), + G_CALLBACK (set_sensitivity_from_toggle), act->conf_entry); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(act->conf_checkbox), TRUE); @@ -209,7 +209,7 @@ generate_syntax (const PsppireDialogAction *a) g_string_append_printf (strx, "\n\t/PRINT = CI(%g)", rd->conf_level); } - if (rd->constant) + if (rd->constant) g_string_append (strx, "\n\t/NOORIGIN"); else g_string_append (strx, "\n\t/ORIGIN"); diff --git a/src/ui/gui/psppire-dialog-action-means.c b/src/ui/gui/psppire-dialog-action-means.c index 0093016150..ee45e84854 100644 --- a/src/ui/gui/psppire-dialog-action-means.c +++ b/src/ui/gui/psppire-dialog-action-means.c @@ -109,7 +109,7 @@ psppire_dialog_action_means_activate (PsppireDialogAction *a) gtk_container_add (GTK_CONTAINER (vb), act->layer); gtk_widget_show (act->layer); } - + GtkWidget *selector = get_widget_assert (xml, "layer-selector"); pda->dialog = get_widget_assert (xml, "means-dialog"); diff --git a/src/ui/gui/psppire-dialog-action-oneway.c b/src/ui/gui/psppire-dialog-action-oneway.c index d82ce27c31..81a632d9ea 100644 --- a/src/ui/gui/psppire-dialog-action-oneway.c +++ b/src/ui/gui/psppire-dialog-action-oneway.c @@ -248,7 +248,7 @@ psppire_dialog_action_oneway_activate (PsppireDialogAction *a) act->homogeneity = get_widget_assert (xml, "checkbutton2"); act->contrasts_dialog = get_widget_assert (xml, "contrasts-dialog"); - + act->next = get_widget_assert (xml, "next-button"); act->prev = get_widget_assert (xml, "prev-button"); act->ctotal = get_widget_assert (xml, "entry2"); diff --git a/src/ui/gui/psppire-dialog-action-paired.c b/src/ui/gui/psppire-dialog-action-paired.c index 31ff2844cf..e0102b1405 100644 --- a/src/ui/gui/psppire-dialog-action-paired.c +++ b/src/ui/gui/psppire-dialog-action-paired.c @@ -58,7 +58,7 @@ dialog_state_valid (gpointer data) if (v == NULL) return FALSE; - + /* if ( NULL == pd->valid) */ /* return TRUE; */ @@ -161,7 +161,7 @@ psppire_dialog_action_paired_activate (PsppireDialogAction *a) { xml = builder_new ("paired-samples.ui"); g_hash_table_insert (thing, a, xml); - + GtkWidget *selector = get_widget_assert (xml, "psppire-selector3"); GtkWidget *bb = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL); GtkWidget *button = gtk_button_new_with_mnemonic (_("O_ptions...")); @@ -183,7 +183,7 @@ psppire_dialog_action_paired_activate (PsppireDialogAction *a) gtk_box_pack_start (GTK_BOX (bb), button, TRUE, TRUE, 5); gtk_box_pack_start (GTK_BOX (box), bb, FALSE, FALSE, 5); gtk_widget_show_all (box); - + psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid); psppire_dialog_action_set_refresh (pda, refresh); @@ -196,7 +196,7 @@ psppire_dialog_action_paired_activate (PsppireDialogAction *a) select_as_pair_member, act); } - + } static void diff --git a/src/ui/gui/psppire-dialog-action-recode-different.c b/src/ui/gui/psppire-dialog-action-recode-different.c index d8556cac41..9a41596d3b 100644 --- a/src/ui/gui/psppire-dialog-action-recode-different.c +++ b/src/ui/gui/psppire-dialog-action-recode-different.c @@ -41,7 +41,7 @@ difx_variable_treeview_is_populated (PsppireDialogActionRecode *rd) { PsppireDialogActionRecodeDifferent *rdd = PSPPIRE_DIALOG_ACTION_RECODE_DIFFERENT (rd); GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (rd->variable_treeview)); - + if (g_hash_table_size (rdd->varmap) != gtk_tree_model_iter_n_children (model, NULL) ) return FALSE; @@ -57,7 +57,7 @@ dialog_state_valid (gpointer data) { PsppireDialogActionRecode *rd = data; GtkTreeIter not_used; - + if ( ! rd->value_map ) return FALSE; @@ -155,7 +155,7 @@ render_new_var_name (GtkTreeViewColumn *tree_column, struct variable *var = NULL; - gtk_tree_model_get (tree_model, iter, + gtk_tree_model_get (tree_model, iter, 0, &var, -1); @@ -243,7 +243,7 @@ on_selection_change (GtkTreeSelection *selection, gpointer data) g_return_if_fail (ok); gtk_tree_model_get (model, &iter, - 0, &var, + 0, &var, -1); nlp = g_hash_table_lookup (rdd->varmap, var); @@ -327,7 +327,7 @@ psppire_dialog_action_recode_different_activate (PsppireDialogAction *a) _("Recode into Different Variables: Old and New Values ")); gtk_widget_show (act->output_variable_box); - + g_signal_connect_swapped (act->old_and_new_dialog, "show", G_CALLBACK (on_old_new_show), act); @@ -346,7 +346,7 @@ append_into_clause (const PsppireDialogActionRecode *rd, struct string *dds) GtkTreeIter iter; ds_put_cstr (dds, "\n\tINTO "); gboolean ok; - + for (ok = psppire_var_view_get_iter_first (PSPPIRE_VAR_VIEW (rd->variable_treeview), &iter); ok; ok = psppire_var_view_get_iter_next (PSPPIRE_VAR_VIEW (rd->variable_treeview), &iter)) @@ -355,7 +355,7 @@ append_into_clause (const PsppireDialogActionRecode *rd, struct string *dds) const struct variable *var = psppire_var_view_get_variable (PSPPIRE_VAR_VIEW (rd->variable_treeview), 0, &iter); nlp = g_hash_table_lookup (rdd->varmap, var); - + ds_put_cstr (dds, nlp->name); ds_put_cstr (dds, " "); } diff --git a/src/ui/gui/psppire-dialog-action-recode-same.c b/src/ui/gui/psppire-dialog-action-recode-same.c index d55745fbf9..f0e31c795e 100644 --- a/src/ui/gui/psppire-dialog-action-recode-same.c +++ b/src/ui/gui/psppire-dialog-action-recode-same.c @@ -58,7 +58,7 @@ dialog_state_valid (gpointer data) { PsppireDialogActionRecode *rd = data; GtkTreeIter not_used; - + if ( ! rd->value_map ) return FALSE; @@ -106,7 +106,7 @@ psppire_dialog_action_recode_same_activate (PsppireDialogAction *a) gtk_window_set_title (GTK_WINDOW (pda->dialog), _("Recode into Same Variables")); - + g_signal_connect_swapped (act->old_and_new_dialog, "show", G_CALLBACK (on_old_new_show), act); @@ -114,7 +114,7 @@ psppire_dialog_action_recode_same_activate (PsppireDialogAction *a) _("Recode into Same Variables: Old and New Values")); gtk_widget_hide (act->output_variable_box); - + psppire_dialog_action_set_refresh (pda, refresh); psppire_dialog_action_set_valid_predicate (pda, diff --git a/src/ui/gui/psppire-dialog-action-recode.c b/src/ui/gui/psppire-dialog-action-recode.c index 351b5b3995..7abe51df64 100644 --- a/src/ui/gui/psppire-dialog-action-recode.c +++ b/src/ui/gui/psppire-dialog-action-recode.c @@ -455,7 +455,7 @@ psppire_dialog_action_recode_pre_activate (PsppireDialogActionRecode *act, void pda->dialog = get_widget_assert (xml, "recode-dialog"); pda->source = get_widget_assert (xml, "treeview1"); - + GtkWidget *selector = get_widget_assert (xml, "psppire-selector1"); GtkWidget *oldandnew = get_widget_assert (xml, "button1"); @@ -473,7 +473,7 @@ psppire_dialog_action_recode_pre_activate (PsppireDialogActionRecode *act, void if (populate_treeview) populate_treeview (act); - + psppire_selector_set_allow (PSPPIRE_SELECTOR (selector), homogeneous_types); /* Set up the Old & New Values subdialog */ @@ -601,7 +601,7 @@ psppire_dialog_action_recode_generate_syntax (const PsppireDialogAction *act, ds_init_empty (&dds); append_string_decls (rd, &dds); - + ds_put_cstr (&dds, "\nRECODE "); psppire_var_view_append_names_str (PSPPIRE_VAR_VIEW (rd->variable_treeview), 0, &dds); @@ -647,7 +647,7 @@ psppire_dialog_action_recode_generate_syntax (const PsppireDialogAction *act, ds_put_cstr (&dds, "."); append_new_value_labels (rd, &dds); - + ds_put_cstr (&dds, "\nEXECUTE.\n"); diff --git a/src/ui/gui/psppire-dialog-action-recode.h b/src/ui/gui/psppire-dialog-action-recode.h index f46c34aaa6..8b67e425d9 100644 --- a/src/ui/gui/psppire-dialog-action-recode.h +++ b/src/ui/gui/psppire-dialog-action-recode.h @@ -90,7 +90,7 @@ struct _PsppireDialogActionRecode GtkWidget *change_button; GtkWidget *output_variable_box; - + GtkWidget *string_button; GtkWidget *width_entry; }; diff --git a/src/ui/gui/psppire-dialog-action-regression.c b/src/ui/gui/psppire-dialog-action-regression.c index 183301d02f..0cfadb1401 100644 --- a/src/ui/gui/psppire-dialog-action-regression.c +++ b/src/ui/gui/psppire-dialog-action-regression.c @@ -211,17 +211,17 @@ generate_syntax (const PsppireDialogAction *a) g_string_append (string, "\n\t/DEPENDENT="); psppire_var_view_append_names (PSPPIRE_VAR_VIEW (rd->dep_vars), 0, string); g_string_append (string, "\n\t/METHOD=ENTER"); - + selected = 0; - for (i = 0, ok = gtk_tree_model_get_iter_first (model, &iter); ok; + for (i = 0, ok = gtk_tree_model_get_iter_first (model, &iter); ok; i++, ok = gtk_tree_model_iter_next (model, &iter)) { gboolean toggled; gtk_tree_model_get (model, &iter, - CHECKBOX_COLUMN_SELECTED, &toggled, -1); - if (toggled) - selected |= 1u << i; - else + CHECKBOX_COLUMN_SELECTED, &toggled, -1); + if (toggled) + selected |= 1u << i; + else selected &= ~(1u << i); } diff --git a/src/ui/gui/psppire-dialog-action-reliability.c b/src/ui/gui/psppire-dialog-action-reliability.c index 11d1eeefc1..0ee1af8e61 100644 --- a/src/ui/gui/psppire-dialog-action-reliability.c +++ b/src/ui/gui/psppire-dialog-action-reliability.c @@ -29,7 +29,7 @@ static void psppire_dialog_action_reliability_class_init (PsppireDialogActi G_DEFINE_TYPE (PsppireDialogActionReliability, psppire_dialog_action_reliability, PSPPIRE_TYPE_DIALOG_ACTION); -enum +enum { ALPHA = 0, SPLIT = 1 diff --git a/src/ui/gui/psppire-dialog-action-roc.c b/src/ui/gui/psppire-dialog-action-roc.c index 9f44f7ad44..694effb7b8 100644 --- a/src/ui/gui/psppire-dialog-action-roc.c +++ b/src/ui/gui/psppire-dialog-action-roc.c @@ -62,10 +62,10 @@ dialog_state_valid (gpointer data) value_init (&val, width); result = psppire_value_entry_get_value (PSPPIRE_VALUE_ENTRY (rd->state_value), &val, width); - + if (var_is_value_missing (var, &val, MV_SYSTEM)) result = FALSE; - + value_destroy (&val, width); return result; @@ -80,7 +80,7 @@ on_curve_button_toggle (GtkCheckButton *curve, PsppireDialogActionRoc *rd) g_object_set (rd->reference, "inconsistent", TRUE, NULL); g_object_set (rd->reference, "sensitive", FALSE, NULL); } - else + else { g_object_set (rd->reference, "inconsistent", FALSE, NULL); g_object_set (rd->reference, "sensitive", TRUE, NULL); @@ -192,10 +192,10 @@ generate_syntax (const PsppireDialogAction *a) { struct string str; ds_init_empty (&str); - + syntax_gen_value (&str, &val, var_get_width (var), var_get_print_format (var)); - + g_string_append (string, ds_cstr (&str)); ds_destroy (&str); } diff --git a/src/ui/gui/psppire-dialog-action-scatterplot.c b/src/ui/gui/psppire-dialog-action-scatterplot.c index fa5d6233f7..891dbf019b 100644 --- a/src/ui/gui/psppire-dialog-action-scatterplot.c +++ b/src/ui/gui/psppire-dialog-action-scatterplot.c @@ -47,7 +47,7 @@ generate_syntax (const PsppireDialogAction *act) ds_init_cstr (&dss, "GRAPH SCATTERPLOT(BIVARIATE) = "); ds_put_cstr (&dss, gtk_entry_get_text (GTK_ENTRY (ow->x_axis))); - + ds_put_cstr (&dss, " WITH "); ds_put_cstr (&dss, gtk_entry_get_text (GTK_ENTRY (ow->y_axis))); @@ -75,7 +75,7 @@ dialog_state_valid (gpointer data) if ( 0 == strcmp ("", yvar)) return FALSE; - + return TRUE; } diff --git a/src/ui/gui/psppire-dialog-action-select.c b/src/ui/gui/psppire-dialog-action-select.c index 37451876ab..a524de63d9 100644 --- a/src/ui/gui/psppire-dialog-action-select.c +++ b/src/ui/gui/psppire-dialog-action-select.c @@ -152,7 +152,7 @@ sample_subdialog (GtkButton *b, gpointer data) g_signal_connect (scd->spin_sample_size, "value-changed", G_CALLBACK (sample_consistent), scd); g_signal_connect (scd->spin_sample_limit, "value-changed", G_CALLBACK (sample_consistent), scd); - + gtk_widget_show (scd->hbox2); gtk_widget_set_sensitive (scd->hbox2, FALSE); @@ -272,10 +272,10 @@ psppire_dialog_action_select_activate (PsppireDialogAction *a) pda->dialog = get_widget_assert (xml, "select-cases-dialog"); pda->source = get_widget_assert (xml, "select-cases-treeview"); - g_object_set (pda->source, + g_object_set (pda->source, "selection-mode", GTK_SELECTION_SINGLE, NULL); - + act->entry = get_widget_assert (xml, "filter-variable-entry"); GtkWidget *selector = get_widget_assert (xml, "psppire-selector-filter"); @@ -426,7 +426,7 @@ generate_syntax_filter (const PsppireDialogAction *a) filter, ranvar); ds_put_cstr (&dss, "EXECUTE.\n"); - + ds_put_c_format (&dss, "COMPUTE %s = $CASENUM.\n", @@ -486,7 +486,7 @@ generate_syntax_delete (const PsppireDialogAction *a) (GTK_TOGGLE_BUTTON (scd->radiobutton_sample))) { ds_put_cstr (&dss, "SAMPLE "); - + if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (scd->percent))) { const double percentage = @@ -499,10 +499,10 @@ generate_syntax_delete (const PsppireDialogAction *a) gtk_spin_button_get_value (GTK_SPIN_BUTTON (scd->spin_sample_size)); const gint from_n_cases = gtk_spin_button_get_value (GTK_SPIN_BUTTON (scd->spin_sample_limit)); - + ds_put_c_format (&dss, "%d FROM %d .", n_cases, from_n_cases); } - + } else if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (scd->radiobutton_range))) @@ -544,7 +544,7 @@ generate_syntax (const PsppireDialogAction *a) { return g_strdup ("FILTER OFF.\n"); } - + /* Are we filtering or deleting ? */ if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (scd->radiobutton_delete))) { diff --git a/src/ui/gui/psppire-dialog-action-select.h b/src/ui/gui/psppire-dialog-action-select.h index 96f587bd57..331a6972f7 100644 --- a/src/ui/gui/psppire-dialog-action-select.h +++ b/src/ui/gui/psppire-dialog-action-select.h @@ -66,8 +66,8 @@ struct _PsppireDialogActionSelect GtkWidget *hbox2; GtkWidget *rsample_dialog; - GtkWidget *percent ; - GtkWidget *sample_n_cases ; + GtkWidget *percent ; + GtkWidget *sample_n_cases ; GtkWidget *table ; GtkWidget *l0 ; GtkWidget *l1 ; diff --git a/src/ui/gui/psppire-dialog-action-sort.c b/src/ui/gui/psppire-dialog-action-sort.c index 2a0be711a7..ecfffe536b 100644 --- a/src/ui/gui/psppire-dialog-action-sort.c +++ b/src/ui/gui/psppire-dialog-action-sort.c @@ -105,7 +105,7 @@ psppire_dialog_action_sort_activate (PsppireDialogAction *a) pda->dialog = get_widget_assert (xml, "sort-cases-dialog"); pda->source = get_widget_assert (xml, "sort-cases-treeview1"); - + act->variables = get_widget_assert (xml, "sort-cases-treeview2"); act->ascending = get_widget_assert (xml, "sort-cases-radiobutton0"); diff --git a/src/ui/gui/psppire-dialog-action-split.c b/src/ui/gui/psppire-dialog-action-split.c index bebc599aed..410b2d106f 100644 --- a/src/ui/gui/psppire-dialog-action-split.c +++ b/src/ui/gui/psppire-dialog-action-split.c @@ -164,7 +164,7 @@ psppire_dialog_action_split_activate (PsppireDialogAction *pda) g_signal_connect (act->off, "toggled", G_CALLBACK (on_off_toggled), pda); g_signal_connect_swapped (pda->dialog, "show", G_CALLBACK (refresh), pda); } - + psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid); psppire_dialog_action_set_refresh (pda, refresh); diff --git a/src/ui/gui/psppire-dialog-action-split.h b/src/ui/gui/psppire-dialog-action-split.h index 05cca2bbb7..468ff6129c 100644 --- a/src/ui/gui/psppire-dialog-action-split.h +++ b/src/ui/gui/psppire-dialog-action-split.h @@ -64,13 +64,13 @@ struct _PsppireDialogActionSplit GtkWidget *selector; - GtkWidget *dest ; - GtkWidget *source ; + GtkWidget *dest ; + GtkWidget *source ; - GtkWidget *sort ; - GtkWidget *layered ; + GtkWidget *sort ; + GtkWidget *layered ; - GtkWidget *off ; + GtkWidget *off ; }; diff --git a/src/ui/gui/psppire-dialog-action-tt1s.c b/src/ui/gui/psppire-dialog-action-tt1s.c index d3ac045273..f9d8bfa608 100644 --- a/src/ui/gui/psppire-dialog-action-tt1s.c +++ b/src/ui/gui/psppire-dialog-action-tt1s.c @@ -121,7 +121,7 @@ psppire_dialog_action_tt1s_activate (PsppireDialogAction *a) pda->dialog = get_widget_assert (xml, "t-test-one-sample-dialog"); pda->source = get_widget_assert (xml, "one-sample-t-test-treeview2"); - g_object_set (pda->source, + g_object_set (pda->source, "predicate", var_is_numeric, NULL); act->vars_treeview = get_widget_assert (xml, "one-sample-t-test-treeview1"); diff --git a/src/ui/gui/psppire-dialog-action-two-sample.c b/src/ui/gui/psppire-dialog-action-two-sample.c index f450efb369..1d8d92ca50 100644 --- a/src/ui/gui/psppire-dialog-action-two-sample.c +++ b/src/ui/gui/psppire-dialog-action-two-sample.c @@ -68,7 +68,7 @@ dialog_state_valid (gpointer data) if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (pd->nts[NT_MCNEMAR].button))) return TRUE; - + return FALSE; } @@ -228,7 +228,7 @@ psppire_dialog_action_two_sample_activate (PsppireDialogAction *a) psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector), select_as_pair_member, act); - + } static void diff --git a/src/ui/gui/psppire-dialog-action-univariate.c b/src/ui/gui/psppire-dialog-action-univariate.c index aa833dd332..6b6d41dd38 100644 --- a/src/ui/gui/psppire-dialog-action-univariate.c +++ b/src/ui/gui/psppire-dialog-action-univariate.c @@ -38,7 +38,7 @@ generate_syntax (const PsppireDialogAction *act) GString *str = g_string_new ("GLM "); g_string_append (str, gtk_entry_get_text (GTK_ENTRY (uvd->dep_entry))); - + g_string_append (str, " BY "); psppire_var_view_append_names (PSPPIRE_VAR_VIEW (uvd->factor_list), 0, str); diff --git a/src/ui/gui/psppire-dialog-action-var-info.c b/src/ui/gui/psppire-dialog-action-var-info.c index 59c9dabd47..b4fa39e4ac 100644 --- a/src/ui/gui/psppire-dialog-action-var-info.c +++ b/src/ui/gui/psppire-dialog-action-var-info.c @@ -181,7 +181,7 @@ psppire_dialog_action_var_info_activate (PsppireDialogAction *a) act->output = psppire_output_view_new (GTK_LAYOUT (get_widget_assert (xml, "layout1")), NULL); - + pda->dialog = get_widget_assert (xml, "variable-info-dialog"); pda->source = get_widget_assert (xml, "treeview2"); diff --git a/src/ui/gui/psppire-dialog-action-weight.c b/src/ui/gui/psppire-dialog-action-weight.c index 79f7254c55..ec604ec97c 100644 --- a/src/ui/gui/psppire-dialog-action-weight.c +++ b/src/ui/gui/psppire-dialog-action-weight.c @@ -148,11 +148,11 @@ psppire_dialog_action_weight_activate (PsppireDialogAction *pda) "selection-mode", GTK_SELECTION_SINGLE, "predicate", var_is_numeric, NULL); - + psppire_selector_set_filter_func (PSPPIRE_SELECTOR (selector), is_currently_in_entry); } - + psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid); psppire_dialog_action_set_refresh (pda, refresh); diff --git a/src/ui/gui/psppire-dialog-action.c b/src/ui/gui/psppire-dialog-action.c index ab04cae302..70a5a9d4aa 100644 --- a/src/ui/gui/psppire-dialog-action.c +++ b/src/ui/gui/psppire-dialog-action.c @@ -188,14 +188,14 @@ on_destroy_dataset (GObject *w) { GHashTable *t = g_object_get_data (w, "thing-table"); GSList *dl = g_object_get_data (w, "widget-list"); - + g_slist_free_full (dl, (GDestroyNotify) gtk_widget_destroy); g_hash_table_unref (t); } /* Each toplevel widget - that is the data window, which generally has a 1-1 association with a dataset - has an associated GHashTable. - + This GHashTable is keyed by the address of a PsppireDialogAction, and its values are user determined pointers (typically a GtkBuilder*). @@ -309,7 +309,7 @@ psppire_dialog_action_init (PsppireDialogAction *act) } void -psppire_dialog_action_set_valid_predicate (PsppireDialogAction *act, +psppire_dialog_action_set_valid_predicate (PsppireDialogAction *act, ContentsAreValid dialog_state_valid) { psppire_dialog_set_valid_predicate (PSPPIRE_DIALOG (act->dialog), @@ -317,14 +317,14 @@ psppire_dialog_action_set_valid_predicate (PsppireDialogAction *act, } void -psppire_dialog_action_set_refresh (PsppireDialogAction *pda, +psppire_dialog_action_set_refresh (PsppireDialogAction *pda, PsppireDialogActionRefresh refresh) { g_signal_connect_swapped (pda->dialog, "refresh", G_CALLBACK (refresh), pda); } -void +void psppire_dialog_action_set_activation (gpointer class, activation activate) { PSPPIRE_DIALOG_ACTION_CLASS (class)->activate = (void (*)(PsppireDialogAction *, GVariant *)) activate; diff --git a/src/ui/gui/psppire-dialog-action.h b/src/ui/gui/psppire-dialog-action.h index 6abe81419c..1d613e1b6f 100644 --- a/src/ui/gui/psppire-dialog-action.h +++ b/src/ui/gui/psppire-dialog-action.h @@ -14,13 +14,13 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -/* +/* This is a an abstract base class, which implements GAction. It's purpose is to abstract the way in which dialog boxes behave. - That is, this action will fire whenever a dialog box is to be + That is, this action will fire whenever a dialog box is to be popped up. - - Additionally, most dialog boxes generate syntax to + + Additionally, most dialog boxes generate syntax to be run by the pspp back-end. This provides an abstraction to do that. The programmer needs only to provide the function to generate the syntax. This base class looks after the rest. @@ -91,10 +91,10 @@ GType psppire_dialog_action_get_type (void) ; typedef void (*PsppireDialogActionRefresh) (PsppireDialogAction *) ; -void psppire_dialog_action_set_refresh (PsppireDialogAction *pda, +void psppire_dialog_action_set_refresh (PsppireDialogAction *pda, PsppireDialogActionRefresh refresh); -void psppire_dialog_action_set_valid_predicate (PsppireDialogAction *act, +void psppire_dialog_action_set_valid_predicate (PsppireDialogAction *act, ContentsAreValid dialog_state_valid); typedef void (*activation) (PsppireDialogAction *); diff --git a/src/ui/gui/psppire-dialog.c b/src/ui/gui/psppire-dialog.c index 918cae0ec1..4fcda9a0b6 100644 --- a/src/ui/gui/psppire-dialog.c +++ b/src/ui/gui/psppire-dialog.c @@ -152,8 +152,8 @@ psppire_dialog_class_init (PsppireDialogClass *class) GParamSpec *sliding_spec ; GParamSpec *help_page_spec ; - help_page_spec = - g_param_spec_string ("help-page", + help_page_spec = + g_param_spec_string ("help-page", "Help Page", "The section of the manual to load when the Help button is clicked", NULL, @@ -334,7 +334,7 @@ connect_notify_signal (GtkWidget *w, gpointer data) g_signal_connect_swapped (w, "de-selected", G_CALLBACK (psppire_dialog_notify_change), dialog); - + psppire_selector_update_subjects (PSPPIRE_SELECTOR (w)); } @@ -385,7 +385,7 @@ connect_notify_signal (GtkWidget *w, gpointer data) dialog); } - + g_signal_connect_swapped (selection, "changed", G_CALLBACK (psppire_dialog_notify_change), dialog); diff --git a/src/ui/gui/psppire-dictview.c b/src/ui/gui/psppire-dictview.c index 37361455f8..7893dcf34d 100644 --- a/src/ui/gui/psppire-dictview.c +++ b/src/ui/gui/psppire-dictview.c @@ -194,7 +194,7 @@ set_model (PsppireDictView *dict_view) dict_view->sorted_model = gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL (dict_view->dict)); gtk_tree_sortable_set_default_sort_func (GTK_TREE_SORTABLE (dict_view->sorted_model), default_sort, dict_view, 0); - gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (dict_view->sorted_model), + gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (dict_view->sorted_model), GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, GTK_SORT_ASCENDING); if ( dict_view->predicate ) @@ -534,9 +534,9 @@ toggle_label_preference (GtkCheckMenuItem *checkbox, gpointer data) if (gtk_check_menu_item_get_inconsistent (checkbox)) gtk_check_menu_item_set_active (checkbox, !global_setting); - + gtk_check_menu_item_set_inconsistent (checkbox, FALSE); - + gtk_widget_queue_draw (GTK_WIDGET (dv)); } @@ -642,7 +642,7 @@ psppire_dict_view_init (PsppireDictView *dict_view) dict_view->override_button = item; gtk_check_menu_item_set_inconsistent (GTK_CHECK_MENU_ITEM (item), TRUE); - + g_signal_connect (item, "toggled", G_CALLBACK (toggle_label_preference), dict_view); diff --git a/src/ui/gui/psppire-encoding-selector.c b/src/ui/gui/psppire-encoding-selector.c index 536f3a5952..73cac22095 100644 --- a/src/ui/gui/psppire-encoding-selector.c +++ b/src/ui/gui/psppire-encoding-selector.c @@ -183,8 +183,8 @@ psppire_encoding_selector_new (const char *default_encoding, return hbox; } -/* - Return a string describing the currently selected encoding. +/* + Return a string describing the currently selected encoding. The caller should free this string when no longer required. */ gchar * diff --git a/src/ui/gui/psppire-encoding-selector.h b/src/ui/gui/psppire-encoding-selector.h index adf359f697..4d6e4eaffa 100644 --- a/src/ui/gui/psppire-encoding-selector.h +++ b/src/ui/gui/psppire-encoding-selector.h @@ -22,8 +22,8 @@ GtkWidget *psppire_encoding_selector_new (const char *default_encoding, gboolean allow_auto); -/* - Return a string describing the currently selected encoding. +/* + Return a string describing the currently selected encoding. The caller should free this string when no longer required. */ gchar *psppire_encoding_selector_get_encoding (GtkWidget *selector); diff --git a/src/ui/gui/psppire-import-assistant.c b/src/ui/gui/psppire-import-assistant.c index 00589e4964..5f8793186b 100644 --- a/src/ui/gui/psppire-import-assistant.c +++ b/src/ui/gui/psppire-import-assistant.c @@ -152,7 +152,7 @@ psppire_import_assistant_finalize (GObject *object) // clear_fields (ia); destroy_columns (ia); - + ds_destroy (&ia->separators); ds_destroy (&ia->quotes); @@ -402,7 +402,7 @@ on_reset (GtkButton *button, PsppireImportAssistant *ia) gint pn = gtk_assistant_get_current_page (GTK_ASSISTANT (ia)); { GtkWidget *page = gtk_assistant_get_nth_page (GTK_ASSISTANT (ia), pn); - + page_func *on_reset = g_object_get_data (G_OBJECT (page), "on-reset"); if (on_reset) @@ -458,7 +458,7 @@ on_prepare (GtkAssistant *assistant, GtkWidget *page, PsppireImportAssistant *ia if (on_entering) on_entering (ia, new_page); } - + ia->current_page = pn; } @@ -536,7 +536,7 @@ process_file (PsppireImportAssistant *ia) ia->file_name); return FALSE; } - + ds_init_empty (&input); for (ia->line_cnt = 0; ia->line_cnt < MAX_PREVIEW_LINES; ia->line_cnt++) { @@ -572,7 +572,7 @@ process_file (PsppireImportAssistant *ia) destroy_file (ia); return FALSE; } - + /* Estimate the number of lines in the file. */ if (ia->line_cnt < MAX_PREVIEW_LINES) { @@ -669,9 +669,9 @@ set_model_on_treeview (PsppireImportAssistant *ia, GtkWidget *tree_view, size_t g_object_set_data (G_OBJECT (model), "lines", &ia->lines + first_line); g_object_set_data (G_OBJECT (model), "first-line", GINT_TO_POINTER (first_line)); - + pspp_sheet_view_set_model (PSPP_SHEET_VIEW (tree_view), model); - + g_object_unref (model); } @@ -692,7 +692,7 @@ add_page_to_assistant (PsppireImportAssistant *ia, GtkWidget *page, GtkAssistantPageType type, const gchar *); -static void +static void on_sheet_combo_changed (GtkComboBox *cb, PsppireImportAssistant *ia) { GtkTreeIter iter; @@ -715,7 +715,7 @@ prepare_sheet_spec_page (PsppireImportAssistant *ia) GtkWidget *sheet_entry = get_widget_assert (builder, "sheet-entry"); GtkWidget *readnames_checkbox = get_widget_assert (builder, "readnames-checkbox"); - gtk_combo_box_set_model (GTK_COMBO_BOX (sheet_entry), + gtk_combo_box_set_model (GTK_COMBO_BOX (sheet_entry), psppire_spreadsheet_model_new (ia->spreadsheet)); gtk_combo_box_set_active (GTK_COMBO_BOX (sheet_entry), 0); @@ -731,7 +731,7 @@ sheet_spec_page_create (PsppireImportAssistant *ia) { GtkBuilder *builder = ia->builder; GtkWidget *page = get_widget_assert (builder, "Spreadsheet-Importer"); - + GtkWidget *combo_box = get_widget_assert (builder, "sheet-entry"); GtkCellRenderer *renderer = gtk_cell_renderer_text_new (); gtk_cell_layout_clear (GTK_CELL_LAYOUT (combo_box)); @@ -749,7 +749,7 @@ sheet_spec_page_create (PsppireImportAssistant *ia) } -static void +static void on_chosen (PsppireImportAssistant *ia, GtkWidget *page) { GtkFileChooser *fc = GTK_FILE_CHOOSER (page); @@ -764,10 +764,10 @@ on_chosen (PsppireImportAssistant *ia, GtkWidget *page) if (f && !g_file_test (f, G_FILE_TEST_IS_DIR)) { gtk_assistant_set_page_complete (GTK_ASSISTANT(ia), GTK_WIDGET (fc), TRUE); - + if (ia->spreadsheet) spreadsheet_unref (ia->spreadsheet); - + ia->spreadsheet = gnumeric_probe (f, FALSE); if (!ia->spreadsheet) @@ -783,16 +783,16 @@ on_chosen (PsppireImportAssistant *ia, GtkWidget *page) { sheet_spec_page_create (ia); } - + formats_page_create (ia); } - g_free (f); + g_free (f); } /* This has to be done on a map signal callback, because GtkFileChooserWidget resets everything when it is mapped. */ -static void +static void on_map (PsppireImportAssistant *ia, GtkWidget *page) { GtkFileChooser *fc = GTK_FILE_CHOOSER (page); @@ -853,7 +853,7 @@ chooser_page_create (PsppireImportAssistant *ia) gtk_file_filter_set_name (ia->default_filter, _("All Files")); gtk_file_filter_add_pattern (ia->default_filter, "*"); gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (chooser), ia->default_filter); - + filter = gtk_file_filter_new (); gtk_file_filter_set_name (filter, _("Text Files")); gtk_file_filter_add_mime_type (filter, "text/*"); @@ -914,7 +914,7 @@ psppire_import_assistant_init (PsppireImportAssistant *ia) { ia->builder = builder_new ("text-data-import.ui"); - ia->current_page = -1 ; + ia->current_page = -1 ; ia->column_cnt = 0; ia->columns = NULL; @@ -922,7 +922,7 @@ psppire_import_assistant_init (PsppireImportAssistant *ia) ia->encoding = NULL; ia->spreadsheet = NULL; ia->watch_cursor = 0; - + ia->prop_renderer = gtk_cell_renderer_text_new (); g_object_ref_sink (ia->prop_renderer); ia->fixed_renderer = gtk_cell_renderer_text_new (); @@ -934,10 +934,10 @@ psppire_import_assistant_init (PsppireImportAssistant *ia) g_signal_connect (ia, "prepare", G_CALLBACK (on_prepare), ia); g_signal_connect (ia, "cancel", G_CALLBACK (on_cancel), ia); g_signal_connect (ia, "close", G_CALLBACK (on_close), ia); - + ia->paste_button = gtk_button_new_with_label (_("Paste")); ia->reset_button = gtk_button_new_with_label (_("Reset")); - + gtk_assistant_add_action_widget (GTK_ASSISTANT(ia), ia->paste_button); g_signal_connect (ia->paste_button, "clicked", G_CALLBACK (on_paste), ia); @@ -947,7 +947,7 @@ psppire_import_assistant_init (PsppireImportAssistant *ia) gtk_window_set_title (GTK_WINDOW (ia), _("Importing Delimited Text Data")); - + gtk_window_set_icon_name (GTK_WINDOW (ia), "pspp"); chooser_page_create (ia); @@ -999,7 +999,7 @@ render_line (PsppSheetViewColumn *tree_column, { gint row = empty_list_store_iter_to_row (iter); struct string *lines; - + lines = g_object_get_data (G_OBJECT (tree_model), "lines"); g_return_if_fail (lines != NULL); @@ -1012,7 +1012,7 @@ set_first_line (PsppireImportAssistant *ia) { GtkTreePath *path = gtk_tree_path_new_from_indices (ia->skip_lines, -1); - + set_model_on_treeview (ia, ia->tree_view, 0); pspp_sheet_view_set_cursor (PSPP_SHEET_VIEW (ia->tree_view), @@ -1040,7 +1040,7 @@ create_lines_tree_view (GtkContainer *parent, PsppireImportAssistant *ia) PsppSheetViewColumn *column = pspp_sheet_view_column_new_with_attributes (title, ia->fixed_renderer, (void *) NULL); - + pspp_sheet_view_column_set_cell_data_func (column, ia->fixed_renderer, render_line, NULL, NULL); pspp_sheet_view_column_set_resizable (column, TRUE); @@ -1063,7 +1063,7 @@ create_lines_tree_view (GtkContainer *parent, PsppireImportAssistant *ia) GtkWidget *oldtv = gtk_bin_get_child (GTK_BIN (parent)); if (oldtv) gtk_container_remove (parent, oldtv); - + gtk_container_add (parent, tree_view); gtk_widget_show (tree_view); @@ -1111,7 +1111,7 @@ first_line_page_create (PsppireImportAssistant *ia) GtkWidget *w = get_widget_assert (ia->builder, "FirstLine"); g_object_set_data (G_OBJECT (w), "on-entering", set_first_line); - + add_page_to_assistant (ia, w, GTK_ASSISTANT_PAGE_CONTENT, _("Select the First Line")); @@ -1145,7 +1145,7 @@ intro_on_enter (PsppireImportAssistant *ia) if (ia->line_cnt > MAX_PREVIEW_LINES) ia->line_cnt = MAX_PREVIEW_LINES; - + ds_init_empty (&s); ds_put_cstr (&s, _("This assistant will guide you through the process of " "importing data into PSPP from a text file with one line " @@ -1194,7 +1194,7 @@ intro_on_enter (PsppireImportAssistant *ia) if (w) gtk_container_remove (GTK_CONTAINER (table), w); - + GtkWidget *hbox_n_cases = psppire_scanf_new (_("Only the first %4d cases"), &ia->n_cases_spin); GtkAdjustment *adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (ia->n_cases_spin)); @@ -1299,7 +1299,7 @@ destroy_columns (PsppireImportAssistant *ia) free (col->name); free (col->contents); } - + free (ia->columns); } @@ -1723,7 +1723,7 @@ make_data_column (PsppireImportAssistant *ia, GtkWidget *tree_view, { column = &ia->columns[dict_idx]; name = escape_underscores (column->name); - char_cnt = column->width; + char_cnt = column->width; } else { @@ -1763,7 +1763,7 @@ create_data_tree_view (gboolean input, GtkContainer *parent, GtkWidget *tree_view = make_tree_view (ia); set_model_on_treeview (ia, tree_view, ia->skip_lines); - + pspp_sheet_selection_set_mode (pspp_sheet_view_get_selection (PSPP_SHEET_VIEW (tree_view)), PSPP_SHEET_SELECTION_NONE); @@ -1882,7 +1882,7 @@ separators_page_create (PsppireImportAssistant *ia) g_object_set_data (G_OBJECT (w), "on-entering", prepare_separators_page); g_object_set_data (G_OBJECT (w), "on-reset", prepare_separators_page); - + add_page_to_assistant (ia, w, GTK_ASSISTANT_PAGE_CONTENT, _("Choose Separators")); @@ -1893,7 +1893,7 @@ separators_page_create (PsppireImportAssistant *ia) ia->quote_cb = get_widget_assert (builder, "quote-cb"); set_quote_list (GTK_COMBO_BOX (ia->quote_combo)); - ia->fields_tree_view = NULL; + ia->fields_tree_view = NULL; g_signal_connect (ia->quote_combo, "changed", G_CALLBACK (on_quote_combo_change), ia); @@ -1962,7 +1962,7 @@ prepare_formats_page (PsppireImportAssistant *ia) GtkBin *vars_scroller; GtkWidget *old_var_sheet; - + push_watch_cursor (ia); if (ia->spreadsheet == NULL) @@ -1971,12 +1971,12 @@ prepare_formats_page (PsppireImportAssistant *ia) unsigned long int number = 0; size_t column_idx; - + ia->dict = dict_create (get_default_encoding ()); fg = fmt_guesser_create (); for (column_idx = 0; column_idx < ia->column_cnt; column_idx++) { - struct variable *modified_var = + struct variable *modified_var = (column_idx < ia->modified_var_cnt ? ia->modified_vars[column_idx] : NULL); if (modified_var == NULL) @@ -2034,7 +2034,7 @@ prepare_formats_page (PsppireImportAssistant *ia) gint num = gtk_combo_box_get_active (GTK_COMBO_BOX (combo_box)); struct spreadsheet_read_options sro; - + sro.sheet_name = NULL; sro.cell_range = NULL; sro.sheet_index = num + 1; @@ -2046,7 +2046,7 @@ prepare_formats_page (PsppireImportAssistant *ia) sro.read_names = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (readnames_checkbox)); sro.asw = -1; - + switch (ia->spreadsheet->type) { case SPREADSHEET_ODS: @@ -2084,16 +2084,16 @@ prepare_formats_page (PsppireImportAssistant *ia) { char *ss; const struct variable *var = dict_get_var (ia->dict, col); - + ia->columns[col].contents = xrealloc (ia->columns[col].contents, sizeof (struct substring) * rows); - - ss = data_out (case_data (c, var), dict_get_encoding (ia->dict), + + ss = data_out (case_data (c, var), dict_get_encoding (ia->dict), var_get_print_format (var)); - + ia->columns[col].contents[rows - 1] = ss_cstr (ss); } - + if (rows > MAX_PREVIEW_LINES) { case_unref (c); @@ -2121,7 +2121,7 @@ prepare_formats_page (PsppireImportAssistant *ia) G_CALLBACK (on_variable_change), ia); ia->psppire_dict = psppire_dict; - + /* XXX: PsppireVarStore doesn't hold a reference to psppire_dict for now, but it should. After it does, we should g_object_ref the psppire_dict here, since we also @@ -2162,7 +2162,7 @@ formats_page_create (PsppireImportAssistant *ia) GtkWidget *w = get_widget_assert (builder, "Formats"); g_object_set_data (G_OBJECT (w), "on-entering", prepare_formats_page); g_object_set_data (G_OBJECT (w), "on-reset", reset_formats_page); - + add_page_to_assistant (ia, w, GTK_ASSISTANT_PAGE_CONFIRM, _("Adjust Variable Formats")); @@ -2174,7 +2174,7 @@ formats_page_create (PsppireImportAssistant *ia) -static void +static void separators_append_syntax (const PsppireImportAssistant *ia, struct string *s) { int i; @@ -2204,9 +2204,9 @@ formats_append_syntax (const PsppireImportAssistant *ia, struct string *s) int var_cnt; g_return_if_fail (ia->dict); - + ds_put_cstr (s, " /VARIABLES=\n"); - + var_cnt = dict_get_var_cnt (ia->dict); for (i = 0; i < var_cnt; i++) { @@ -2342,7 +2342,7 @@ sheet_spec_gen_syntax (PsppireImportAssistant *ia) "\n /SHEET=index %d" "\n /READNAMES=%ss", (ia->spreadsheet->type == SPREADSHEET_GNUMERIC) ? "GNM" : "ODS", - ia->file_name, + ia->file_name, sheet_index, read_names ? "ON" : "OFF"); @@ -2361,7 +2361,7 @@ sheet_spec_gen_syntax (PsppireImportAssistant *ia) syntax_gen_pspp (&s, "."); - + return ds_cstr (&s); } @@ -2398,6 +2398,6 @@ psppire_import_assistant_generate_syntax (PsppireImportAssistant *ia) { return sheet_spec_gen_syntax (ia); } - + return ds_cstr (&s); } diff --git a/src/ui/gui/psppire-import-assistant.h b/src/ui/gui/psppire-import-assistant.h index 9d48d893bf..fe8040130d 100644 --- a/src/ui/gui/psppire-import-assistant.h +++ b/src/ui/gui/psppire-import-assistant.h @@ -77,7 +77,7 @@ struct _PsppireImportAssistant GtkFileFilter *default_filter; /* END The chooser page of the assistant. */ - + /* START The introduction page of the assistant. */ GtkWidget *all_cases_button; GtkWidget *n_cases_button; diff --git a/src/ui/gui/psppire-means-layer.c b/src/ui/gui/psppire-means-layer.c index e4fb17ac97..bc8ab84008 100644 --- a/src/ui/gui/psppire-means-layer.c +++ b/src/ui/gui/psppire-means-layer.c @@ -51,7 +51,7 @@ psppire_means_layer_dispose (GObject *obj) } -static void +static void psppire_means_layer_class_init (PsppireMeansLayerClass *class) { GObjectClass *object_class = G_OBJECT_CLASS (class); @@ -79,7 +79,7 @@ add_new_layer (PsppireMeansLayer *ml) GtkTreeModel *tm = gtk_tree_view_get_model (GTK_TREE_VIEW (ml->var_view)); g_ptr_array_add (ml->layer, tm); g_signal_connect_swapped (tm, "row-inserted", G_CALLBACK (refresh_view), ml); - + g_object_ref (tm); } @@ -94,7 +94,7 @@ psppire_means_layer_update (PsppireMeansLayer *ml) l = g_strdup_printf (_("Layer %d of %d"), ml->current_layer + 1, ml->n_layers); - + gtk_label_set_text (GTK_LABEL (ml->label), l); g_free (l); @@ -105,7 +105,7 @@ psppire_means_layer_update (PsppireMeansLayer *ml) GtkTreeModel *tm = g_ptr_array_index (ml->layer, ml->current_layer); g_return_if_fail (GTK_IS_TREE_MODEL (tm)); - + gtk_widget_set_sensitive (ml->forward, gtk_tree_model_get_iter_first (tm, &dummy)); } @@ -156,7 +156,7 @@ psppire_means_layer_clear (PsppireMeansLayer *ml) psppire_means_layer_update (ml); } -static void +static void psppire_means_layer_init (PsppireMeansLayer *ml) { GtkWidget *hbox_upper = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5); @@ -164,7 +164,7 @@ psppire_means_layer_init (PsppireMeansLayer *ml) GtkWidget *sw = gtk_scrolled_window_new (NULL, NULL); gtk_orientable_set_orientation (GTK_ORIENTABLE (ml), GTK_ORIENTATION_VERTICAL); - + ml->dispose_has_run = FALSE; ml->forward = gtk_button_new_with_label (_("Forward")); ml->back = gtk_button_new_with_label (_("Back")); diff --git a/src/ui/gui/psppire-output-view.c b/src/ui/gui/psppire-output-view.c index ce29472e87..2feaf90d62 100644 --- a/src/ui/gui/psppire-output-view.c +++ b/src/ui/gui/psppire-output-view.c @@ -160,7 +160,7 @@ create_xr (struct psppire_output_view *view) cairo_destroy (cr); } -/* Return the horizontal position to place a widget whose +/* Return the horizontal position to place a widget whose width is CHILD_WIDTH */ static gint get_xpos (const struct psppire_output_view *view, gint child_width) @@ -641,18 +641,18 @@ on_realize (GtkWidget *overview, GObject *view) GAction *copy_action = g_action_map_lookup_action (G_ACTION_MAP (toplevel), "copy"); - + GAction *select_all_action = g_action_map_lookup_action (G_ACTION_MAP (toplevel), "select-all"); - g_object_set (copy_action, "enabled", FALSE, NULL); + g_object_set (copy_action, "enabled", FALSE, NULL); g_signal_connect_swapped (select_all_action, "activate", G_CALLBACK (on_select_all), view); g_signal_connect_swapped (copy_action, "activate", G_CALLBACK (on_copy), view); - + g_signal_connect (sel, "changed", G_CALLBACK (on_selection_change), copy_action); } @@ -665,7 +665,7 @@ psppire_output_view_new (GtkLayout *output, GtkTreeView *overview) GtkCellRenderer *renderer; GtkTreeModel *model; - + view = xmalloc (sizeof *view); view->xr = NULL; view->font_height = 0; @@ -789,17 +789,17 @@ static cairo_t * get_cairo_context_from_print_context (GtkPrintContext *context) { cairo_t *cr = gtk_print_context_get_cairo_context (context); - + /* For all platforms except windows, gtk_print_context_get_dpi_[xy] returns 72. Windows returns 600. */ double xres = gtk_print_context_get_dpi_x (context); double yres = gtk_print_context_get_dpi_y (context); - + /* This means that the cairo context now has its dimensions in Points */ cairo_scale (cr, xres / 72.0, yres / 72.0); - + return cr; } @@ -918,7 +918,7 @@ psppire_output_view_print (struct psppire_output_view *view, GtkPrintOperation *print = gtk_print_operation_new (); - if (view->print_settings != NULL) + if (view->print_settings != NULL) gtk_print_operation_set_print_settings (print, view->print_settings); g_signal_connect (print, "begin_print", G_CALLBACK (begin_print), view); diff --git a/src/ui/gui/psppire-output-window.c b/src/ui/gui/psppire-output-window.c index bd5047a7bc..9ebc51d196 100644 --- a/src/ui/gui/psppire-output-window.c +++ b/src/ui/gui/psppire-output-window.c @@ -95,7 +95,7 @@ psppire_output_window_dispose (GObject *obj) { PsppireOutputWindow *window = PSPPIRE_OUTPUT_WINDOW (obj); - if (window->dispose_has_run) + if (window->dispose_has_run) return; window->dispose_has_run = TRUE; @@ -113,7 +113,7 @@ psppire_output_window_class_init (PsppireOutputWindowClass *class) parent_class = g_type_class_peek_parent (class); object_class->dispose = psppire_output_window_dispose; - + object_class->finalize = psppire_output_window_finalize; } @@ -251,7 +251,7 @@ struct file_types const gchar *ext; }; -enum +enum { FT_AUTO = 0, FT_PDF, @@ -284,7 +284,7 @@ on_combo_change (GtkFileChooser *chooser) gboolean sensitive = FALSE; GtkWidget *combo = gtk_file_chooser_get_extra_widget (chooser); - int x = 0; + int x = 0; gchar *fn = gtk_file_chooser_get_filename (chooser); if (combo && gtk_widget_get_realized (combo)) @@ -353,7 +353,7 @@ create_file_type_list (void) int i; GtkTreeIter iter; GtkListStore *list = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING); - + for (i = 0 ; i < n_FT ; ++i) { gtk_list_store_append (list, &iter); @@ -362,7 +362,7 @@ create_file_type_list (void) 1, ft[i].ext, -1); } - + return list; } @@ -374,7 +374,7 @@ psppire_output_window_export (PsppireOutputWindow *window) GtkListStore *list; GtkFileChooser *chooser; - + GtkWidget *dialog = gtk_file_chooser_dialog_new (_("Export Output"), GTK_WINDOW (window), GTK_FILE_CHOOSER_ACTION_SAVE, @@ -448,7 +448,7 @@ psppire_output_window_export (PsppireOutputWindow *window) filename = g_strconcat (filename, ft[file_type].ext, NULL); g_free (of); } - + string_map_init (&options); string_map_insert (&options, "output-file", filename); @@ -505,7 +505,7 @@ psppire_output_window_init (PsppireOutputWindow *window) gtk_container_add (GTK_CONTAINER (window), box); GtkWidget *paned = get_widget_assert (xml, "paned1"); - + window->dispose_has_run = FALSE; window->view = psppire_output_view_new ( @@ -527,7 +527,7 @@ psppire_output_window_init (PsppireOutputWindow *window) gtk_menu_shell_append (GTK_MENU_SHELL (menubar), create_windows_menu (GTK_WINDOW (window))); - + gtk_menu_shell_append (GTK_MENU_SHELL (menubar), create_help_menu (GTK_WINDOW (window))); @@ -543,7 +543,7 @@ psppire_output_window_init (PsppireOutputWindow *window) accels); } - + { GSimpleAction *export = g_simple_action_new ("export", NULL); g_signal_connect_swapped (export, "activate", G_CALLBACK (psppire_output_window_export), window); @@ -565,7 +565,7 @@ psppire_output_window_init (PsppireOutputWindow *window) accels); } - + g_object_unref (xml); g_signal_connect (window, "delete-event", diff --git a/src/ui/gui/psppire-selector.c b/src/ui/gui/psppire-selector.c index 17d1c1fd66..b4c3335d18 100644 --- a/src/ui/gui/psppire-selector.c +++ b/src/ui/gui/psppire-selector.c @@ -111,7 +111,7 @@ psppire_selector_get_type (void) static const GTypeInfo psppire_selector_info = { sizeof (PsppireSelectorClass), - (GBaseInitFunc) NULL, + (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc)psppire_selector_class_init, (GClassFinalizeFunc) NULL, @@ -149,7 +149,7 @@ dump_hash_entry (gpointer key, gpointer value, gpointer obj) } /* This function is for debugging only */ -void +void psppire_selector_show_map (PsppireSelector *obj) { PsppireSelectorClass *class = g_type_class_peek (PSPPIRE_SELECTOR_TYPE); @@ -187,7 +187,7 @@ psppire_selector_dispose (GObject *obj) sel->source_litem = NULL; } - + g_object_unref (sel->dest); g_object_unref (sel->source); @@ -292,14 +292,14 @@ psppire_selector_class_init (PsppireSelectorClass *class) FALSE, G_PARAM_READWRITE); - GParamSpec *source_widget_spec = + GParamSpec *source_widget_spec = g_param_spec_object ("source-widget", "Source Widget", "The widget to be used as the source for this selector", GTK_TYPE_WIDGET, G_PARAM_READWRITE); - GParamSpec *dest_widget_spec = + GParamSpec *dest_widget_spec = g_param_spec_object ("dest-widget", "Destination Widget", "The widget to be used as the destination for this selector", @@ -411,7 +411,7 @@ on_realize (GtkWidget *w) if ( selector->row_activate_id ) g_signal_handler_disconnect (selector->source, selector->row_activate_id); - selector->row_activate_id = + selector->row_activate_id = g_signal_connect (selector->source, "row-activated", G_CALLBACK (on_row_activate), selector); } @@ -420,7 +420,7 @@ on_realize (GtkWidget *w) if ( selector->source_select_id ) g_signal_handler_disconnect (selection, selector->source_select_id); - selector->source_select_id = + selector->source_select_id = g_signal_connect (selection, "changed", G_CALLBACK (on_source_select), selector); } @@ -564,7 +564,7 @@ de_select_selection_tree_view (PsppireSelector *selector) de_select_tree_model (selection, model); } -static void +static void de_select_tree_model (GtkTreeSelection *selection, GtkTreeModel *model) { GList *item; @@ -664,7 +664,7 @@ select_selection (PsppireSelector *selector) g_return_if_fail (selector->select_items); - if (selector->allow_selection && + if (selector->allow_selection && ! selector->allow_selection (selector->source, selector->dest)) return; @@ -795,10 +795,10 @@ set_tree_view_source (PsppireSelector *selector) GList *list = NULL; PsppireSelectorClass *class = g_type_class_peek (PSPPIRE_SELECTOR_TYPE); - + if ( ! (list = g_hash_table_lookup (class->source_hash, selector->source))) { - /* Base case: This widget is currently not the source of + /* Base case: This widget is currently not the source of any selector. Create a hash entry and make this selector the first selector in the list */ @@ -847,14 +847,14 @@ update_model ( if (model && (model == g_object_get_data (G_OBJECT (source), "model-copy"))) return; - if (model != NULL) - { - GtkTreeModel *new_model = gtk_tree_model_filter_new (model, NULL); + if (model != NULL) + { + GtkTreeModel *new_model = gtk_tree_model_filter_new (model, NULL); - g_object_set_data (G_OBJECT (source), "model-copy", new_model); + g_object_set_data (G_OBJECT (source), "model-copy", new_model); gtk_tree_view_set_model (source, new_model); - + gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (new_model), is_source_item_visible, selector, @@ -915,19 +915,19 @@ on_dest_model_changed (PsppireSelector *selector) { GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (selector->dest)); - if (model == NULL) + if (model == NULL) return; g_signal_connect (model, "row-changed", G_CALLBACK (on_dest_data_change), selector); - + g_signal_connect (model, "row-deleted", G_CALLBACK (on_dest_data_delete), selector); g_signal_connect (selector, "destroy", G_CALLBACK (remove_selector_handlers), model); - + if ( selector->selecting ) return; - + refilter (selector); } @@ -1023,8 +1023,8 @@ psppire_selector_update_subjects (PsppireSelector *selector) { set_tree_view_source (selector); - g_signal_connect (selector->source, "notify::model", - G_CALLBACK (update_model), selector); + g_signal_connect (selector->source, "notify::model", + G_CALLBACK (update_model), selector); update_model (GTK_TREE_VIEW (selector->source), 0, selector); } @@ -1058,7 +1058,7 @@ psppire_selector_update_subjects (PsppireSelector *selector) GObjectClass *class = G_OBJECT_GET_CLASS (selector); GType type = G_OBJECT_TYPE (selector->dest); - SelectItemsFunc *func = + SelectItemsFunc *func = g_hash_table_lookup (PSPPIRE_SELECTOR_CLASS (class)->default_selection_funcs, (gpointer) type); if ( func ) diff --git a/src/ui/gui/psppire-spreadsheet-model.c b/src/ui/gui/psppire-spreadsheet-model.c index bd186ca46d..d426b55661 100644 --- a/src/ui/gui/psppire-spreadsheet-model.c +++ b/src/ui/gui/psppire-spreadsheet-model.c @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -/* This file implements a GtkTreeModel. It allows GtkComboBox and +/* This file implements a GtkTreeModel. It allows GtkComboBox and GtkTreeView to display the names and non-empty cell ranges of the sheets aka "Tables" of spreadsheet files. It doesn't take any notice of the spreadsheet data itself. @@ -99,7 +99,7 @@ psppire_spreadsheet_model_set_property (GObject * object, const GValue * value, GParamSpec * pspec) { - PsppireSpreadsheetModel *spreadsheetModel = + PsppireSpreadsheetModel *spreadsheetModel = PSPPIRE_SPREADSHEET_MODEL (object); switch (prop_id) @@ -266,7 +266,7 @@ tree_model_get_value (GtkTreeModel * model, GtkTreeIter * iter, const char *x = spreadsheet_get_sheet_name (spreadsheetModel->spreadsheet, (intptr_t) iter->user_data); - + g_value_set_string (value, x); } break; @@ -352,7 +352,7 @@ tree_model_children (GtkTreeModel *model, GtkTreeIter *iter, GtkTreeIter *parent iter->stamp = spreadsheetModel->stamp; iter->user_data = 0; - + return TRUE; } diff --git a/src/ui/gui/psppire-syntax-window.c b/src/ui/gui/psppire-syntax-window.c index 8750e995b2..2e398ade4a 100644 --- a/src/ui/gui/psppire-syntax-window.c +++ b/src/ui/gui/psppire-syntax-window.c @@ -260,7 +260,7 @@ on_edit_delete (PsppireSyntaxWindow *sw) { GtkTextIter begin, end; GtkTextBuffer *buffer = GTK_TEXT_BUFFER (sw->buffer); - + if ( gtk_text_buffer_get_selection_bounds (buffer, &begin, &end) ) gtk_text_buffer_delete (buffer, &begin, &end); } @@ -353,7 +353,7 @@ static void on_edit_cut (PsppireSyntaxWindow *sw) { GtkTextIter begin, end; - + if ( set_clip (sw, &begin, &end)) gtk_text_buffer_delete (GTK_TEXT_BUFFER (sw->buffer), &begin, &end); } @@ -704,7 +704,7 @@ psppire_syntax_window_init (PsppireSyntaxWindow *window) g_action_map_add_action (G_ACTION_MAP (window), G_ACTION (window->undo_menuitem)); g_action_map_add_action (G_ACTION_MAP (window), G_ACTION (window->redo_menuitem)); - + if (class->lan) window->buffer = gtk_source_buffer_new_with_language (class->lan); else @@ -748,19 +748,19 @@ psppire_syntax_window_init (PsppireSyntaxWindow *window) window->sb = get_widget_assert (xml, "statusbar2"); window->text_context = gtk_statusbar_get_context_id (GTK_STATUSBAR (window->sb), "Text Context"); - g_signal_connect (window->buffer, "changed", + g_signal_connect (window->buffer, "changed", G_CALLBACK (on_text_changed), window); - g_signal_connect (window->buffer, "modified-changed", + g_signal_connect (window->buffer, "modified-changed", G_CALLBACK (on_modified_changed), window); { GSimpleAction *print = g_simple_action_new ("print", NULL); - + g_signal_connect_swapped (print, "activate", G_CALLBACK (psppire_syntax_window_print), window); - + g_action_map_add_action (G_ACTION_MAP (window), G_ACTION (print)); } @@ -777,10 +777,10 @@ psppire_syntax_window_init (PsppireSyntaxWindow *window) undo_redo_update (window); - window->sel_handler = g_signal_connect_swapped (clip_primary, "owner-change", + window->sel_handler = g_signal_connect_swapped (clip_primary, "owner-change", G_CALLBACK (selection_changed), window); - window->ps_handler = g_signal_connect (clip_selection, "owner-change", + window->ps_handler = g_signal_connect (clip_selection, "owner-change", G_CALLBACK (set_paste_sensitivity), window); connect_help (xml); @@ -801,7 +801,7 @@ psppire_syntax_window_init (PsppireSyntaxWindow *window) { GSimpleAction *open = g_simple_action_new ("open", NULL); - + g_action_map_add_action (G_ACTION_MAP (window), G_ACTION (open)); g_signal_connect_swapped (open, @@ -812,9 +812,9 @@ psppire_syntax_window_init (PsppireSyntaxWindow *window) { GSimpleAction *save = g_simple_action_new ("save", NULL); - + g_action_map_add_action (G_ACTION_MAP (window), G_ACTION (save)); - + g_signal_connect_swapped (save, "activate", G_CALLBACK (psppire_window_save), @@ -824,14 +824,14 @@ psppire_syntax_window_init (PsppireSyntaxWindow *window) gtk_application_set_accels_for_action (app, "win.save", accels); - + } { GSimpleAction *save_as = g_simple_action_new ("save_as", NULL); - + g_action_map_add_action (G_ACTION_MAP (window), G_ACTION (save_as)); - + g_signal_connect_swapped (save_as, "activate", G_CALLBACK (psppire_window_save_as), @@ -842,8 +842,8 @@ psppire_syntax_window_init (PsppireSyntaxWindow *window) gtk_application_set_accels_for_action (app, "win.save_as", accels); - - + + } @@ -893,7 +893,7 @@ psppire_syntax_window_init (PsppireSyntaxWindow *window) { GSimpleAction *run_selection = g_simple_action_new ("run-selection", NULL); - + g_signal_connect_swapped (run_selection, "activate", G_CALLBACK (on_run_selection), window); @@ -902,10 +902,10 @@ psppire_syntax_window_init (PsppireSyntaxWindow *window) { GSimpleAction *run_to_end = g_simple_action_new ("run-to-end", NULL); - + g_signal_connect_swapped (run_to_end, "activate", G_CALLBACK (on_run_to_end), window); - + g_action_map_add_action (G_ACTION_MAP (window), G_ACTION (run_to_end)); } @@ -929,7 +929,7 @@ psppire_syntax_window_new (const char *encoding) "description", _("Syntax Editor"), "encoding", encoding, NULL); - + GApplication *app = g_application_get_default (); gtk_application_add_window (GTK_APPLICATION (app), GTK_WINDOW (sw)); @@ -1101,7 +1101,7 @@ paginate (GtkPrintOperation *operation, { gint n_pages = gtk_source_print_compositor_get_n_pages (window->compositor); gtk_print_operation_set_n_pages (operation, n_pages); - + return TRUE; } @@ -1114,7 +1114,7 @@ draw_page (GtkPrintOperation *operation, gint page_nr, PsppireSyntaxWindow *window) { - gtk_source_print_compositor_draw_page (window->compositor, + gtk_source_print_compositor_draw_page (window->compositor, context, page_nr); } @@ -1128,7 +1128,7 @@ psppire_syntax_window_print (PsppireSyntaxWindow *window) GtkPrintOperation *print = gtk_print_operation_new (); - if (window->print_settings != NULL) + if (window->print_settings != NULL) gtk_print_operation_set_print_settings (print, window->print_settings); diff --git a/src/ui/gui/psppire-val-chooser.c b/src/ui/gui/psppire-val-chooser.c index 2ff3f188c7..0dbb3c0b4d 100644 --- a/src/ui/gui/psppire-val-chooser.c +++ b/src/ui/gui/psppire-val-chooser.c @@ -83,7 +83,7 @@ enum }; -enum +enum { VC_VALUE, VC_SYSMIS, @@ -116,7 +116,7 @@ psppire_val_chooser_set_property (GObject *object, gtk_widget_set_sensitive (GTK_WIDGET (vr->rw[VC_SYSMIS].rb), !vr->input_var_is_string); gtk_widget_set_sensitive (GTK_WIDGET (vr->rw[VC_MISSING].rb), !vr->input_var_is_string); gtk_widget_set_sensitive (GTK_WIDGET (vr->rw[VC_RANGE].rb), !vr->input_var_is_string); - gtk_widget_set_sensitive (GTK_WIDGET (vr->rw[VC_LOW_UP].rb), !vr->input_var_is_string); + gtk_widget_set_sensitive (GTK_WIDGET (vr->rw[VC_LOW_UP].rb), !vr->input_var_is_string); gtk_widget_set_sensitive (GTK_WIDGET (vr->rw[VC_HIGH_DOWN].rb), !vr->input_var_is_string); break; default: @@ -252,7 +252,7 @@ static void simple_set (PsppireValChooser *vr, struct old_value *ov, const struc static void lo_up_set (PsppireValChooser *vr, struct old_value *ov, const struct range_widgets *rw) { const gchar *text = gtk_entry_get_text (rw->e1); - + ov->type = OV_LOW_UP; ov->v.range[1] = g_strtod (text, 0); } @@ -261,7 +261,7 @@ static void lo_up_set (PsppireValChooser *vr, struct old_value *ov, const struct static void hi_down_set (PsppireValChooser *vr, struct old_value *ov, const struct range_widgets *rw) { const gchar *text = gtk_entry_get_text (rw->e1); - + ov->type = OV_HIGH_DOWN; ov->v.range[0] = g_strtod (text, 0); } @@ -289,7 +289,7 @@ static void range_set (PsppireValChooser *vr, struct old_value *ov, const struct ov->type = OV_RANGE; ov->v.range[0] = g_strtod (text, 0); - + text = gtk_entry_get_text (rw->e2); ov->v.range[1] = g_strtod (text, 0); } @@ -308,7 +308,7 @@ static GtkWidget * range_entry (struct layout *l, struct range_widgets *rw) "valign", GTK_ALIGN_CENTER, "halign", GTK_ALIGN_START, NULL); - + g_signal_connect (vbox, "notify::sensitive", G_CALLBACK (focus_follows_sensitivity), entrylo); @@ -329,7 +329,7 @@ static GtkWidget * simple_entry (struct layout *l, struct range_widgets *rw) } -static struct layout range_opt[n_VAL_CHOOSER_BUTTONS]= +static struct layout range_opt[n_VAL_CHOOSER_BUTTONS]= { {N_("_Value:"), simple_entry, simple_set }, {N_("_System Missing"), NULL, sysmis_set }, @@ -352,7 +352,7 @@ psppire_val_chooser_init (PsppireValChooser *vr) "margin-start", 5, "margin-end", 5, NULL); - + vr->input_var_is_string = FALSE; for (i = 0; i < n_VAL_CHOOSER_BUTTONS; ++i) @@ -375,14 +375,14 @@ psppire_val_chooser_init (PsppireValChooser *vr) 0, row, 1, 1); gtk_widget_set_hexpand (GTK_WIDGET (vr->rw[i].rb), FALSE); - + /* Attach the labels */ gtk_grid_attach (GTK_GRID (grid), GTK_WIDGET (vr->rw[i].label), 1, row, 1, 1); gtk_widget_set_hexpand (GTK_WIDGET (vr->rw[i].label), TRUE); - + ++row; if (l->fill) @@ -394,7 +394,7 @@ psppire_val_chooser_init (PsppireValChooser *vr) gtk_grid_attach (GTK_GRID (grid), fill, 1, row, 1, 1); gtk_widget_set_hexpand (fill, TRUE); - + ++row; g_signal_connect (vr->rw[i].rb, "toggled", G_CALLBACK (set_sensitivity_from_toggle), fill); @@ -651,14 +651,14 @@ psppire_val_chooser_set_status (PsppireValChooser *vr, const struct old_value *o gtk_toggle_button_set_active (vr->rw[0].rb, TRUE); gtk_entry_set_text (vr->rw[0].e1, ov->v.s); break; - + case OV_NUMERIC: { gchar *str; gtk_toggle_button_set_active (vr->rw[0].rb, TRUE); - + str = num_to_string (ov->v.v); - + gtk_entry_set_text (vr->rw[0].e1, str); g_free (str); } diff --git a/src/ui/gui/psppire-value-entry.c b/src/ui/gui/psppire-value-entry.c index 731b6b3fb1..27c561339b 100644 --- a/src/ui/gui/psppire-value-entry.c +++ b/src/ui/gui/psppire-value-entry.c @@ -145,7 +145,7 @@ on_realize (GtkWidget *w) GtkEntryBuffer *buffer = gtk_entry_get_buffer (entry); gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (w), COL_LABEL); - + g_signal_connect (buffer, "notify::text", G_CALLBACK (psppire_value_entry_text_changed), w); diff --git a/src/ui/gui/psppire-value-entry.h b/src/ui/gui/psppire-value-entry.h index 73fe14c3b9..940de30b27 100644 --- a/src/ui/gui/psppire-value-entry.h +++ b/src/ui/gui/psppire-value-entry.h @@ -50,7 +50,7 @@ struct variable; typedef struct _PsppireValueEntry PsppireValueEntry; typedef struct _PsppireValueEntryClass PsppireValueEntryClass; -struct _PsppireValueEntry +struct _PsppireValueEntry { GtkComboBox parent; @@ -63,7 +63,7 @@ struct _PsppireValueEntry const union value *cur_value; }; -struct _PsppireValueEntryClass +struct _PsppireValueEntryClass { GtkComboBoxClass parent_class; }; diff --git a/src/ui/gui/psppire-var-sheet.c b/src/ui/gui/psppire-var-sheet.c index 35e276cad3..7686b40af4 100644 --- a/src/ui/gui/psppire-var-sheet.c +++ b/src/ui/gui/psppire-var-sheet.c @@ -951,7 +951,7 @@ do_popup_menu (GtkWidget *widget, guint button, guint32 time) gtk_menu_attach (GTK_MENU (menu), clear_variables, 0, 1, i, i + 1); ++i; gtk_widget_show_all (menu); - + gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, button, time); } @@ -1108,7 +1108,7 @@ psppire_var_sheet_dispose (GObject *obj) if (var_sheet->dict) g_object_unref (var_sheet->dict); - + /* These dialogs are not GObjects (although they should be!) But for now, unreffing them only causes a GCritical Error so comment them out for now. (and accept the memory leakage) @@ -1261,7 +1261,7 @@ psppire_var_sheet_clear_variables (PsppireVarSheet *var_sheet) PsppireDict *dict = var_sheet->dict; const struct range_set_node *node; struct range_set *selected = pspp_sheet_selection_get_range_set (selection); - + for (node = range_set_last (selected); node != NULL; node = range_set_prev (selected, node)) { @@ -1290,10 +1290,10 @@ on_selection_changed (PsppSheetSelection *selection, GtkWidget *top = gtk_widget_get_toplevel (GTK_WIDGET (var_sheet)); if (! PSPPIRE_IS_DATA_WINDOW (top)) return; - + PsppireDataWindow *dw = PSPPIRE_DATA_WINDOW (top); gtk_widget_set_sensitive (dw->mi_insert_var, n_selected_rows > 0); - + switch (n_selected_rows) { case 0: @@ -1313,7 +1313,7 @@ on_selection_changed (PsppSheetSelection *selection, break; } - gtk_widget_set_sensitive (dw->mi_clear_variables, var_sheet->may_delete_vars && may_delete); + gtk_widget_set_sensitive (dw->mi_clear_variables, var_sheet->may_delete_vars && may_delete); } void @@ -1409,7 +1409,7 @@ psppire_var_sheet_init (PsppireVarSheet *obj) G_CALLBACK (on_query_var_tooltip), NULL); g_signal_connect (obj, "button-press-event", G_CALLBACK (on_button_pressed), NULL); - + g_signal_connect (obj, "popup-menu", G_CALLBACK (on_popup_menu), NULL); g_signal_connect (pspp_sheet_view_get_selection (sheet_view), @@ -1515,13 +1515,13 @@ psppire_var_sheet_set_dictionary (PsppireVarSheet *var_sheet, if (var_sheet->dict != NULL) { int i; - + for (i = 0; i < PSPPIRE_VAR_SHEET_N_SIGNALS; i++) { if (var_sheet->dict_signals[i]) g_signal_handler_disconnect (var_sheet->dict, var_sheet->dict_signals[i]); - + var_sheet->dict_signals[i] = 0; } diff --git a/src/ui/gui/psppire-var-view.c b/src/ui/gui/psppire-var-view.c index 13db8e60e4..e47b7b61e8 100644 --- a/src/ui/gui/psppire-var-view.c +++ b/src/ui/gui/psppire-var-view.c @@ -102,7 +102,7 @@ psppire_var_view_get_type (void) return psppire_var_view_type; } -void +void psppire_var_view_clear (PsppireVarView *vv) { GtkListStore *l = gtk_list_store_newv (vv->n_cols, vv->cols); @@ -181,28 +181,28 @@ set_renderers (PsppireVarView *var_view) { gint c; var_view->nums = g_malloc (sizeof *var_view->nums * var_view->n_cols); - + for (c = 0 ; c < var_view->n_cols; ++c) { GtkCellRenderer *renderer = gtk_cell_renderer_text_new (); GtkTreeViewColumn *col = gtk_tree_view_column_new (); - + gchar *label = g_strdup_printf (_("Var%d"), c + 1); - + gtk_tree_view_column_set_min_width (col, 100); gtk_tree_view_column_set_sizing (col, GTK_TREE_VIEW_COLUMN_FIXED); gtk_tree_view_column_set_resizable (col, TRUE); gtk_tree_view_column_set_title (col, label); - + g_free (label); - + var_view->nums[c] = c; - + gtk_tree_view_column_pack_start (col, renderer, TRUE); gtk_tree_view_column_set_cell_data_func (col, renderer, display_cell_var_name, &var_view->nums[c], 0); - + gtk_tree_view_append_column (GTK_TREE_VIEW (var_view), col); } } @@ -383,7 +383,7 @@ psppire_var_view_list_names (PsppireVarView *vv, gint column) { GtkTreeIter iter; GSList *list = NULL; - + if ( psppire_var_view_get_iter_first (vv, &iter) ) { do @@ -402,7 +402,7 @@ psppire_var_view_list_names (PsppireVarView *vv, gint column) Append the names of selected variables to STR Returns the number of variables appended. */ -gint +gint psppire_var_view_append_names_str (PsppireVarView *vv, gint column, struct string *str) { gint n_vars = 0; diff --git a/src/ui/gui/psppire-window-base.c b/src/ui/gui/psppire-window-base.c index 78330ec100..7764babc62 100644 --- a/src/ui/gui/psppire-window-base.c +++ b/src/ui/gui/psppire-window-base.c @@ -16,7 +16,7 @@ /* This is an abstract base class upon which all (well almost all) windows in - psppire are based. The exceptions are transient windows such as the + psppire are based. The exceptions are transient windows such as the splash screen and popups. It currently provides the feature where the window's geometry "persists" @@ -88,7 +88,7 @@ configure_event (GtkWidget *wb, GdkEventConfigure *event) return FALSE; } -static void +static void psppire_window_base_class_init (PsppireWindowBaseClass *class) { GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class); @@ -96,7 +96,7 @@ psppire_window_base_class_init (PsppireWindowBaseClass *class) widget_class->realize = realize; } -static void +static void psppire_window_base_init (PsppireWindowBase *window) { } diff --git a/src/ui/gui/psppire-window-base.h b/src/ui/gui/psppire-window-base.h index b818314265..4d5f4a3726 100644 --- a/src/ui/gui/psppire-window-base.h +++ b/src/ui/gui/psppire-window-base.h @@ -16,7 +16,7 @@ /* This is an abstract base class upon which all (well almost all) windows in - psppire are based. The exceptions are transient windows such as the + psppire are based. The exceptions are transient windows such as the splash screen and popups. */ diff --git a/src/ui/gui/psppire-window-register.c b/src/ui/gui/psppire-window-register.c index 75fb6efcd3..6bb2b7cb2f 100644 --- a/src/ui/gui/psppire-window-register.c +++ b/src/ui/gui/psppire-window-register.c @@ -82,7 +82,7 @@ psppire_window_register_construct (GType type, GObjectConstructParam *construct_params) { GObject *object; - + if (!the_instance) { object = G_OBJECT_CLASS (parent_class)->constructor (type, diff --git a/src/ui/gui/psppire-window.c b/src/ui/gui/psppire-window.c index c268256bb0..fa3b250fa5 100644 --- a/src/ui/gui/psppire-window.c +++ b/src/ui/gui/psppire-window.c @@ -112,7 +112,7 @@ psppire_window_set_title (PsppireWindow *window) sscanf (bare_version, "%*d.%d.%*d", &minor); if (minor % 2) g_string_append_printf (title, " - Test version! Please report bugs to %s", PACKAGE_BUGREPORT); - + gtk_window_set_title (GTK_WINDOW (window), title->str); g_string_free (title, TRUE); @@ -320,7 +320,7 @@ insert_menuitem_into_menu (PsppireWindow *window, gpointer key) filename = g_filename_display_name (key); item = gtk_check_menu_item_new_with_label (filename); g_free (filename); - + g_hash_table_insert (window->menuitem_table, key, item); } @@ -340,7 +340,7 @@ static void insert_menuitem (GObject *reg, const gchar *key, gpointer data) { PsppireWindow *window = PSPPIRE_WINDOW (data); - + insert_menuitem_into_menu (window, (gpointer) key); } @@ -563,7 +563,7 @@ psppire_window_model_get_type (void) window_model_type = g_type_register_static (G_TYPE_INTERFACE, "PsppireWindowModel", &window_model_info, 0); - + g_type_interface_add_prerequisite (window_model_type, G_TYPE_OBJECT); } diff --git a/src/ui/gui/psppire.c b/src/ui/gui/psppire.c index ddfdfbcb81..af61eeefc1 100644 --- a/src/ui/gui/psppire.c +++ b/src/ui/gui/psppire.c @@ -175,13 +175,13 @@ GtkWindow * psppire_preload_file (const gchar *file) { const gchar *local_encoding = "UTF-8"; - + struct file_handle *fh = fh_create_file (NULL, file, local_encoding, fh_default_properties ()); const char *filename = fh_get_file_name (fh); - + int retval = any_reader_detect (fh, NULL); GtkWindow *w = NULL; diff --git a/src/ui/gui/spreadsheet-test.c b/src/ui/gui/spreadsheet-test.c index b702270083..da63c0ff4a 100644 --- a/src/ui/gui/spreadsheet-test.c +++ b/src/ui/gui/spreadsheet-test.c @@ -69,7 +69,7 @@ on_clicked (GtkButton *button, struct xxx *stuff) proto = casereader_get_proto (reader); nvals = caseproto_get_n_widths (proto); - + for (; (c = casereader_read (reader)) != NULL; case_unref (c)) { int i; @@ -84,7 +84,7 @@ on_clicked (GtkButton *button, struct xxx *stuff) { char *ss = xzalloc (width + 1); memcpy (ss, value_str (val, width), width); - + printf ("%s ", ss); free (ss); } @@ -95,7 +95,7 @@ on_clicked (GtkButton *button, struct xxx *stuff) casereader_destroy (reader); } -static void +static void print_msg (const struct msg *m, void *aux UNUSED) { fprintf (stderr, "%s\n", m->text); @@ -118,7 +118,7 @@ main (int argc, char *argv[] ) settings_init (); gtk_init (&argc, &argv); - + if ( argc < 2) g_error ("Usage: prog file\n"); @@ -131,7 +131,7 @@ main (int argc, char *argv[] ) if (stuff.sp == NULL) stuff.sp = ods_probe (argv[1], false); - + if (stuff.sp == NULL) { g_error ("%s is neither a gnumeric nor a ods file\n", argv[1]); @@ -145,9 +145,9 @@ main (int argc, char *argv[] ) button = gtk_button_new_with_label ("Test reader"); g_signal_connect (button, "clicked", G_CALLBACK (on_clicked), &stuff); - + gtk_container_set_border_width (GTK_CONTAINER (window), 10); - + stuff.combo_box = gtk_combo_box_new(); { diff --git a/src/ui/gui/t-test-options.c b/src/ui/gui/t-test-options.c index 19dda18caf..1b28eefdb6 100644 --- a/src/ui/gui/t-test-options.c +++ b/src/ui/gui/t-test-options.c @@ -63,9 +63,9 @@ tt_options_dialog_create (GtkWindow *parent) tto->confidence = psppire_scanf_new (_("Con_fidence Interval: %2d %%"), &tto->conf_percent); - - g_object_set (tto->confidence, - "use-underline", TRUE, + + g_object_set (tto->confidence, + "use-underline", TRUE, "mnemonic-widget", psppire_scanf_get_child (PSPPIRE_SCANF (tto->confidence), 0), NULL); diff --git a/src/ui/gui/val-labs-dialog.c b/src/ui/gui/val-labs-dialog.c index bea5273e00..ab56135ccc 100644 --- a/src/ui/gui/val-labs-dialog.c +++ b/src/ui/gui/val-labs-dialog.c @@ -326,7 +326,7 @@ get_selected_tuple (PsppireValLabsDialog *dialog, if (vl != NULL) *label = val_lab_get_escaped_label (vl); } - + return TRUE; } @@ -399,7 +399,7 @@ on_remove (GtkWidget *w, gpointer data) if (! get_selected_tuple (dialog, &value, NULL)) return; - + vl = val_labs_lookup (dialog->labs, &value); if (vl != NULL) val_labs_remove (dialog->labs, vl); @@ -426,7 +426,7 @@ on_select_row (GtkTreeView *treeview, gpointer data) if (! get_selected_tuple (dialog, &value, &label)) return; - + text = value_to_text__ (value, &dialog->format, dialog->encoding); g_signal_handler_block (GTK_ENTRY (dialog->value_entry), diff --git a/src/ui/gui/widgets.c b/src/ui/gui/widgets.c index facae6b1dc..37d13bf972 100644 --- a/src/ui/gui/widgets.c +++ b/src/ui/gui/widgets.c @@ -122,7 +122,7 @@ preregister_actions (void) /* Any custom widgets which are to be used in GtkBuilder ui files - need to be preregistered, otherwise GtkBuilder refuses to + need to be preregistered, otherwise GtkBuilder refuses to acknowledge their existence. */ void preregister_widgets (void) diff --git a/src/ui/gui/windows-menu.c b/src/ui/gui/windows-menu.c index e4c6fa370f..6974bc65be 100644 --- a/src/ui/gui/windows-menu.c +++ b/src/ui/gui/windows-menu.c @@ -47,7 +47,7 @@ reset_check_state (GtkWidget *widget, gpointer ud) if (state == TRUE) gtk_window_present (win); - + /* Prevent the state from actually changing */ g_signal_handlers_block_by_func (widget, reset_check_state, ud); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (widget), !state); @@ -92,9 +92,9 @@ repopulate_windows_menu (GObject *inst, gchar *name, gpointer data) GtkWidget *minimize = gtk_menu_item_new_with_mnemonic (_("_Minimize all Windows")); GtkWidget *split = gtk_check_menu_item_new_with_mnemonic (_("_Split")); - + GtkWidget *sep = gtk_separator_menu_item_new (); - + gtk_menu_attach (GTK_MENU (menu), minimize, 0, 1, 0, 1); if (PSPPIRE_DATA_WINDOW_TYPE == G_OBJECT_TYPE (toplevel) ) @@ -103,17 +103,17 @@ repopulate_windows_menu (GObject *inst, gchar *name, gpointer data) g_signal_connect_swapped (split, "toggled", G_CALLBACK (toggle_split_window), toplevel); } - + gtk_container_add (GTK_CONTAINER (menu), sep); gtk_menu_item_set_submenu (GTK_MENU_ITEM (mi), menu); g_object_set_data (G_OBJECT (menu), "toplevel", toplevel); - + g_hash_table_foreach (reg->name_table, add_menuitem, menu); g_signal_connect (minimize, "activate", G_CALLBACK (min_all), NULL); - + gtk_widget_show_all (GTK_WIDGET (mi)); } @@ -129,11 +129,11 @@ GtkWidget * create_windows_menu (GtkWindow *toplevel) { PsppireWindowRegister *reg = psppire_window_register_new (); - + GtkWidget *menuitem = gtk_menu_item_new_with_mnemonic (_("_Windows")); g_object_set_data (G_OBJECT (menuitem), "toplevel", toplevel); - + g_signal_connect (reg, "removed", G_CALLBACK (repopulate_windows_menu), menuitem); g_signal_connect (reg, "inserted", G_CALLBACK (repopulate_windows_menu), menuitem); diff --git a/src/ui/syntax-gen.c b/src/ui/syntax-gen.c index f14a87a91f..93d52c79c0 100644 --- a/src/ui/syntax-gen.c +++ b/src/ui/syntax-gen.c @@ -298,7 +298,7 @@ syntax_gen_pspp_valist (struct string *output, const char *format, } conv[x++] = directive; conv[x++] = '\0'; - + ds_put_c_format (output, conv, d); break; } diff --git a/src/ui/terminal/terminal-opts.c b/src/ui/terminal/terminal-opts.c index 3362299ce5..4464296498 100644 --- a/src/ui/terminal/terminal-opts.c +++ b/src/ui/terminal/terminal-opts.c @@ -300,7 +300,7 @@ terminal_opts_init (struct argv_parser *ap, return to; } -/* Return true iff the terminal appears to be an xterm with +/* Return true iff the terminal appears to be an xterm with UTF-8 capabilities */ static bool term_is_utf8_xterm (void) @@ -326,7 +326,7 @@ terminal_opts_done (struct terminal_opts *to, int argc, char *argv[]) { string_map_insert (&to->options, "box", "unicode"); } - + string_map_insert (&to->options, "output-file", "-"); string_map_insert (&to->options, "format", "txt"); register_output_driver (to); diff --git a/src/ui/terminal/terminal-reader.c b/src/ui/terminal/terminal-reader.c index 141474a95b..ad3ced4960 100644 --- a/src/ui/terminal/terminal-reader.c +++ b/src/ui/terminal/terminal-reader.c @@ -127,7 +127,7 @@ rl_echo_signal_char (int sig) if (0 == tcgetattr (0, &t)) { cc_t c = t.c_cc[VINTR]; - + if (c >= 0 && c <= 'Z' - 'A') fprintf (rl_outstream, "^%c", 'A' + c - 1); else @@ -138,7 +138,7 @@ rl_echo_signal_char (int sig) fprintf (rl_outstream, "^C"); fflush (rl_outstream); -} +} #endif #endif @@ -256,7 +256,7 @@ static int pfd[2]; static bool sigint_received ; -/* +/* A function similar to getc from stdio. However this one may be interrupted by SIGINT. If that happens it will return EOF and the global variable @@ -310,7 +310,7 @@ interruptible_getc (FILE *fp) #if HAVE_READLINE -static void +static void handler (int sig) { rl_end = 0; @@ -354,7 +354,7 @@ readline_done (void) free (history_file); } -/* Prompt the user for a line of input and return it in LINE. +/* Prompt the user for a line of input and return it in LINE. Returns true if the LINE should be considered valid, false otherwise. */ static bool @@ -454,9 +454,9 @@ readline_read (struct substring *line, enum prompt_style style) fflush (stdout); ds_init_empty (&string); ds_read_line (&string, stdin, SIZE_MAX); - + *line = string.ss; - + return false; } #endif /* !HAVE_READLINE */ diff --git a/tests/libpspp/hmap-test.c b/tests/libpspp/hmap-test.c index c8619a0511..578cebfb14 100644 --- a/tests/libpspp/hmap-test.c +++ b/tests/libpspp/hmap-test.c @@ -285,13 +285,13 @@ random_shuffle (void *array_, size_t cnt, size_t size) typedef size_t hash_function (int data); static size_t -identity_hash (int data) +identity_hash (int data) { return data; } static size_t -constant_hash (int data UNUSED) +constant_hash (int data UNUSED) { return 0x12345678u; } @@ -356,7 +356,7 @@ check_hmap (struct hmap *hmap, const int data[], size_t cnt, count = 0; HMAP_FOR_EACH_WITH_HASH (e, struct element, node, hash (order[i]), hmap) - if (e->data == order[i]) + if (e->data == order[i]) count++; check (count == j - i); @@ -378,7 +378,7 @@ check_hmap (struct hmap *hmap, const int data[], size_t cnt, check (hmap_node_hash (&e->node) == hash (e->data)); for (j = 0; j < left; j++) - if (order[j] == e->data) + if (order[j] == e->data) { order[j] = order[--left]; goto next; @@ -481,19 +481,19 @@ test_insert_any_remove_any (hash_function *hash) } static void -test_insert_any_remove_any_random_hash (void) +test_insert_any_remove_any_random_hash (void) { test_insert_any_remove_any (random_hash); } static void -test_insert_any_remove_any_identity_hash (void) +test_insert_any_remove_any_identity_hash (void) { test_insert_any_remove_any (identity_hash); } static void -test_insert_any_remove_any_constant_hash (void) +test_insert_any_remove_any_constant_hash (void) { test_insert_any_remove_any (constant_hash); } @@ -528,19 +528,19 @@ test_insert_any_remove_same (hash_function *hash) } static void -test_insert_any_remove_same_random_hash (void) +test_insert_any_remove_same_random_hash (void) { test_insert_any_remove_same (random_hash); } static void -test_insert_any_remove_same_identity_hash (void) +test_insert_any_remove_same_identity_hash (void) { test_insert_any_remove_same (identity_hash); } static void -test_insert_any_remove_same_constant_hash (void) +test_insert_any_remove_same_constant_hash (void) { test_insert_any_remove_same (constant_hash); } @@ -634,19 +634,19 @@ test_random_sequence (int max_elems, hash_function *hash) } static void -test_random_sequence_random_hash (void) +test_random_sequence_random_hash (void) { test_random_sequence (64, random_hash); } static void -test_random_sequence_identity_hash (void) +test_random_sequence_identity_hash (void) { test_random_sequence (64, identity_hash); } static void -test_random_sequence_constant_hash (void) +test_random_sequence_constant_hash (void) { test_random_sequence (32, constant_hash); } @@ -676,7 +676,7 @@ test_insert_ordered (int max_elems, hash_function *hash) hmap_insert (&hmap, &elements[i].node, hash (elements[i].data)); check_hmap (&hmap, values, i + 1, hash); - if (hash == identity_hash) + if (hash == identity_hash) { /* Check that every every hash bucket has (almost) the same number of nodes in it. */ @@ -684,7 +684,7 @@ test_insert_ordered (int max_elems, hash_function *hash) int max = INT_MIN; int j; - for (j = 0; j <= hmap.mask; j++) + for (j = 0; j <= hmap.mask; j++) { int count = 0; struct hmap_node *node; @@ -770,19 +770,19 @@ test_moved (int max_elems, hash_function *hash) } static void -test_moved_random_hash (void) +test_moved_random_hash (void) { test_moved (128, random_hash); } static void -test_moved_identity_hash (void) +test_moved_identity_hash (void) { test_moved (128, identity_hash); } static void -test_moved_constant_hash (void) +test_moved_constant_hash (void) { test_moved (32, constant_hash); } @@ -871,7 +871,7 @@ test_changed_constant_hash (void) } static void -test_swap (int max_elems, hash_function *hash) +test_swap (int max_elems, hash_function *hash) { struct element *elements; int *values; @@ -909,7 +909,7 @@ test_swap (int max_elems, hash_function *hash) } static void -test_swap_random_hash (void) +test_swap_random_hash (void) { test_swap (128, random_hash); } @@ -955,7 +955,7 @@ test_clear (void) } static void -test_destroy_null (void) +test_destroy_null (void) { hmap_destroy (NULL); } diff --git a/tests/libpspp/hmapx-test.c b/tests/libpspp/hmapx-test.c index c93a2cd1b1..13a3f4b47f 100644 --- a/tests/libpspp/hmapx-test.c +++ b/tests/libpspp/hmapx-test.c @@ -204,13 +204,13 @@ random_shuffle (void *array_, size_t cnt, size_t size) typedef size_t hash_function (int data); static size_t -identity_hash (int data) +identity_hash (int data) { return data; } static size_t -constant_hash (int data UNUSED) +constant_hash (int data UNUSED) { return 0x12345678u; } @@ -277,8 +277,8 @@ check_hmapx (struct hmapx *hmapx, const int data[], size_t cnt, count = 0; HMAPX_FOR_EACH_WITH_HASH (e, node, hash (order[i]), hmapx) - if (e->data == order[i]) - count++; + if (e->data == order[i]) + count++; check (count == j - i); } @@ -301,7 +301,7 @@ check_hmapx (struct hmapx *hmapx, const int data[], size_t cnt, check (hmapx_node_hash (p) == hash (e->data)); for (j = 0; j < left; j++) - if (order[j] == e->data) + if (order[j] == e->data) { order[j] = order[--left]; goto next; @@ -354,11 +354,11 @@ test_insert_delete (const int insertions[], check_hmapx (&hmapx, insertions, i + 1, hash); /* A series of insertions should not produce a shrinkable hmapx. */ - if (i >= reserve) + if (i >= reserve) { capacity = hmapx_capacity (&hmapx); hmapx_shrink (&hmapx); - check (capacity == hmapx_capacity (&hmapx)); + check (capacity == hmapx_capacity (&hmapx)); } } for (i = 0; i < cnt; i++) @@ -417,19 +417,19 @@ test_insert_any_remove_any (hash_function *hash) } static void -test_insert_any_remove_any_random_hash (void) +test_insert_any_remove_any_random_hash (void) { test_insert_any_remove_any (random_hash); } static void -test_insert_any_remove_any_identity_hash (void) +test_insert_any_remove_any_identity_hash (void) { test_insert_any_remove_any (identity_hash); } static void -test_insert_any_remove_any_constant_hash (void) +test_insert_any_remove_any_constant_hash (void) { test_insert_any_remove_any (constant_hash); } @@ -464,19 +464,19 @@ test_insert_any_remove_same (hash_function *hash) } static void -test_insert_any_remove_same_random_hash (void) +test_insert_any_remove_same_random_hash (void) { test_insert_any_remove_same (random_hash); } static void -test_insert_any_remove_same_identity_hash (void) +test_insert_any_remove_same_identity_hash (void) { test_insert_any_remove_same (identity_hash); } static void -test_insert_any_remove_same_constant_hash (void) +test_insert_any_remove_same_constant_hash (void) { test_insert_any_remove_same (constant_hash); } @@ -570,19 +570,19 @@ test_random_sequence (int max_elems, hash_function *hash) } static void -test_random_sequence_random_hash (void) +test_random_sequence_random_hash (void) { test_random_sequence (64, random_hash); } static void -test_random_sequence_identity_hash (void) +test_random_sequence_identity_hash (void) { test_random_sequence (64, identity_hash); } static void -test_random_sequence_constant_hash (void) +test_random_sequence_constant_hash (void) { test_random_sequence (32, constant_hash); } @@ -609,7 +609,7 @@ test_insert_ordered (int max_elems, hash_function *hash) nodes[i] = hmapx_insert (&hmapx, &elements[i], hash (elements[i].data)); check_hmapx (&hmapx, values, i + 1, hash); - if (hash == identity_hash) + if (hash == identity_hash) { /* Check that every every hash bucket has (almost) the same number of nodes in it. */ @@ -617,7 +617,7 @@ test_insert_ordered (int max_elems, hash_function *hash) int max = INT_MIN; int j; - for (j = 0; j <= hmapx.hmap.mask; j++) + for (j = 0; j <= hmapx.hmap.mask; j++) { int count = 0; struct hmap_node *node; @@ -703,19 +703,19 @@ test_moved (int max_elems, hash_function *hash) } static void -test_moved_random_hash (void) +test_moved_random_hash (void) { test_moved (128, random_hash); } static void -test_moved_identity_hash (void) +test_moved_identity_hash (void) { test_moved (128, identity_hash); } static void -test_moved_constant_hash (void) +test_moved_constant_hash (void) { test_moved (32, constant_hash); } @@ -768,7 +768,7 @@ test_changed (hash_function *hash) /* Change value i to j. */ elements[i].data = j; - hmapx_changed (&hmapx, nodes[i], + hmapx_changed (&hmapx, nodes[i], hash (elements[i].data)); for (k = 0; k < cnt; k++) changed_values[k] = k; @@ -893,7 +893,7 @@ test_change_constant_hash (void) } static void -test_swap (int max_elems, hash_function *hash) +test_swap (int max_elems, hash_function *hash) { struct element *elements; int *values; @@ -926,7 +926,7 @@ test_swap (int max_elems, hash_function *hash) } static void -test_swap_random_hash (void) +test_swap_random_hash (void) { test_swap (128, random_hash); } @@ -970,7 +970,7 @@ test_clear (void) } static void -test_destroy_null (void) +test_destroy_null (void) { hmapx_destroy (NULL); } diff --git a/tests/libpspp/zip-test.c b/tests/libpspp/zip-test.c index eded13e8bf..011d123841 100644 --- a/tests/libpspp/zip-test.c +++ b/tests/libpspp/zip-test.c @@ -105,7 +105,7 @@ main (int argc, char **argv) } zip_reader_destroy (zr); } - else + else exit (1); return 0; diff --git a/tests/math/chart-get-scale-test.c b/tests/math/chart-get-scale-test.c index 6f2ca711d0..ef7b6b0a91 100644 --- a/tests/math/chart-get-scale-test.c +++ b/tests/math/chart-get-scale-test.c @@ -64,7 +64,7 @@ test_range (double low, double high) assert (n_ticks <= 10); #if 0 - printf("%s: high: %lg, low %lg, interval: %lg, nticks: %d\n", + printf("%s: high: %lg, low %lg, interval: %lg, nticks: %d\n", __FUNCTION__, high, low, interval, n_ticks); dump_scale (lower, interval, n_ticks); #endif @@ -78,7 +78,7 @@ test_range (double low, double high) } -int +int main (int argc UNUSED, char **argv UNUSED) { test_range (0, 0); @@ -94,8 +94,8 @@ main (int argc UNUSED, char **argv UNUSED) test_range (-50010, -49999); test_range (0.000100002, 0.000100010); - test_range (102, 50030); - test_range (0.00102, 0.0050030); + test_range (102, 50030); + test_range (0.00102, 0.0050030); return 0; } diff --git a/tests/ui/syntax-gen-test.c b/tests/ui/syntax-gen-test.c index f99b4f44b4..31dd8eb6b9 100644 --- a/tests/ui/syntax-gen-test.c +++ b/tests/ui/syntax-gen-test.c @@ -12,14 +12,14 @@ test_runner (const char *format, ...) va_start (args, format); ds_init_empty (&syntax); - + syntax_gen_pspp_valist (&syntax, format, args); va_end (args); puts (ds_cstr (&syntax)); - ds_destroy (&syntax); + ds_destroy (&syntax); } int diff --git a/utilities/pspp-convert.c b/utilities/pspp-convert.c index b7dd30b6c9..cd760199d3 100644 --- a/utilities/pspp-convert.c +++ b/utilities/pspp-convert.c @@ -166,7 +166,7 @@ main (int argc, char *argv[]) if (! decrypt_file (enc, input_fh, output_fh, password)) goto error; - + goto exit; } diff --git a/utilities/pspp-dump-sav.c b/utilities/pspp-dump-sav.c index c194f23050..f207d8ecbf 100644 --- a/utilities/pspp-dump-sav.c +++ b/utilities/pspp-dump-sav.c @@ -193,7 +193,7 @@ main (int argc, char *argv[]) if (argc - optind > 1) printf ("Reading \"%s\":\n", r.file_name); - + read_header (&r); while ((rec_type = read_int (&r)) != 999) { @@ -237,7 +237,7 @@ main (int argc, char *argv[]) fclose (r.file); } - + return 0; } @@ -935,17 +935,17 @@ read_attributes (struct sfm_reader *r, struct text_record *text, const char *key; int index; - for (;;) + for (;;) { key = text_tokenize (text, '('); if (key == NULL) return true; - + for (index = 1; ; index++) { /* Parse the value. */ const char *value = text_tokenize (text, '\n'); - if (value == NULL) + if (value == NULL) { sys_warn (r, "%s: Error parsing attribute value %s[%d]", variable, key, index); @@ -965,7 +965,7 @@ read_attributes (struct sfm_reader *r, struct text_record *text, } if (text_match (text, '/')) - return true; + return true; } } @@ -995,10 +995,10 @@ read_ncases64 (struct sfm_reader *r, size_t size, size_t count) } static void -read_datafile_attributes (struct sfm_reader *r, size_t size, size_t count) +read_datafile_attributes (struct sfm_reader *r, size_t size, size_t count) { struct text_record *text; - + printf ("%08llx: datafile attributes\n", (long long int) ftello (r->file)); text = open_text_record (r, size * count); read_attributes (r, text, "datafile"); @@ -1187,17 +1187,17 @@ read_unknown_extension (struct sfm_reader *r, size_t size, size_t count) } static void -read_variable_attributes (struct sfm_reader *r, size_t size, size_t count) +read_variable_attributes (struct sfm_reader *r, size_t size, size_t count) { struct text_record *text; - + printf ("%08llx: variable attributes\n", (long long int) ftello (r->file)); text = open_text_record (r, size * count); - for (;;) + for (;;) { const char *variable = text_tokenize (text, ':'); if (variable == NULL || !read_attributes (r, text, variable)) - break; + break; } close_text_record (text); } @@ -1426,9 +1426,9 @@ text_tokenize (struct text_record *text, int delimiter) } static bool -text_match (struct text_record *text, int c) +text_match (struct text_record *text, int c) { - if (text->pos < text->size && text->buffer[text->pos] == c) + if (text->pos < text->size && text->buffer[text->pos] == c) { text->pos++; return true; -- 2.30.2