Merge commit 'origin/master' into charset
authorJohn Darrington <john@darrington.wattle.id.au>
Wed, 8 Apr 2009 01:14:57 +0000 (09:14 +0800)
committerJohn Darrington <john@darrington.wattle.id.au>
Wed, 8 Apr 2009 01:14:57 +0000 (09:14 +0800)
Conflicts:

src/ui/gui/psppire-data-editor.c

77 files changed:
Smake
doc/statistics.texi
glade/automake.mk
glade/dictview.c [new file with mode: 0644]
glade/psppire.xml
lib/gtk-contrib/psppire-sheet.c
lib/gtk-contrib/psppire-sheet.h
src/data/format.c
src/data/format.h
src/data/make-file.c
src/data/por-file-writer.c
src/data/psql-reader.c
src/language/stats/binomial.c
src/language/stats/chisquare.c
src/language/stats/crosstabs.q
src/language/stats/descriptives.c
src/language/stats/examine.q
src/language/stats/frequencies.q
src/language/stats/npar-summary.c
src/language/stats/npar-summary.h
src/language/stats/npar.q
src/language/stats/oneway.q
src/language/stats/regression.q
src/language/stats/reliability.q
src/language/stats/t-test.q
src/language/stats/wilcoxon.c
src/math/covariance-matrix.c
src/output/charts/barchart.c
src/output/charts/piechart.c
src/output/charts/plot-chart.c
src/output/charts/plot-chart.h
src/output/table.c
src/output/table.h
src/ui/gui/automake.mk
src/ui/gui/data-editor.glade
src/ui/gui/psppire-data-editor.c
src/ui/gui/psppire-data-editor.h
src/ui/gui/psppire-data-window.c
src/ui/gui/psppire-dictview.c
src/ui/gui/psppire-var-sheet.c
src/ui/gui/regression-dialog.c
src/ui/gui/reliability-dialog.c [new file with mode: 0644]
src/ui/gui/reliability-dialog.h [new file with mode: 0644]
src/ui/gui/reliability.glade [new file with mode: 0644]
src/ui/gui/sheet/automake.mk
src/ui/gui/sheet/psppire-axis-impl.c [deleted file]
src/ui/gui/sheet/psppire-axis-impl.h [deleted file]
src/ui/gui/sheet/psppire-axis.c
src/ui/gui/sheet/psppire-axis.h
src/ui/gui/var-sheet-dialogs.glade
tests/automake.mk
tests/bugs/multipass.sh
tests/bugs/piechart.sh [new file with mode: 0755]
tests/bugs/t-test-alpha.sh
tests/bugs/t-test-alpha3.sh
tests/bugs/temp-freq.sh
tests/command/examine-extremes.sh
tests/command/examine.sh
tests/command/get-data-psql.sh
tests/command/import-export.sh
tests/command/npar-binomial.sh
tests/command/npar-chisquare.sh
tests/command/npar-wilcoxon.sh
tests/command/oneway.sh
tests/command/regression-qr.sh
tests/command/regression.sh
tests/command/reliability.sh
tests/command/t-test-1-indep-val.sh
tests/command/t-test-1s.sh
tests/command/t-test-pairs.sh
tests/command/trimmed-mean.sh
tests/command/weight.sh
tests/stats/descript-basic.sh
tests/stats/descript-mean-bug.sh
tests/stats/descript-missing.sh
tests/stats/percentiles-compatible.sh
tests/stats/percentiles-enhanced.sh

diff --git a/Smake b/Smake
index 84537ef08561f7011d846e256f095e487106e3b1..4c8d83bc3bdae38f08560b305bb7a754a1220f42 100644 (file)
--- a/Smake
+++ b/Smake
@@ -16,6 +16,7 @@ GNULIB_MODULES = \
        environ \
        exit \
        fatal-signal \
+       fcntl \
        fpieee \
        fprintf-posix \
        full-read \
index 311f5d7ad98d7588256cf835b58d0e56a2727eda..985560604b02b52b02440dcd39a36bd1b773c118 100644 (file)
@@ -566,7 +566,7 @@ values.
 If more than two distinct, non-missing values for a variable
 under test are encountered then an error occurs.
 
-If the test proportion is equal to 0.5, then a one tailed test is
+If the test proportion is equal to 0.5, then a two tailed test is
 reported.   For any other test proportion, a one tailed test is
 reported.   
 For one tailed tests, if the test proportion is less than
index 59a88668b8de2ab666734aa46a33dc46fa89398c..8e51e1f720244b9e96c4eca5233f5aadf29f11a1 100644 (file)
@@ -14,6 +14,7 @@ libglade_psppire_la_SOURCES = \
        glade/bbox.c \
        glade/selector.c \
        glade/acr.c \
+       glade/dictview.c \
        src/ui/gui/psppire-conf.c \
        src/ui/gui/psppire-acr.c \
        src/ui/gui/psppire-buttonbox.c \
@@ -21,6 +22,7 @@ libglade_psppire_la_SOURCES = \
        src/ui/gui/psppire-vbuttonbox.c \
        src/ui/gui/psppire-dialog.c \
        src/ui/gui/psppire-keypad.c \
+       src/ui/gui/psppire-dictview.c \
        src/ui/gui/psppire-selector.c
 
 dist_catalog_DATA = \
diff --git a/glade/dictview.c b/glade/dictview.c
new file mode 100644 (file)
index 0000000..5d23b06
--- /dev/null
@@ -0,0 +1,82 @@
+#include <config.h>
+
+#include <glib.h>
+#include <gtk/gtk.h>
+#include "psppire-dictview.h"
+
+#include <gladeui/glade.h>
+
+
+GType
+psppire_dict_get_type ()
+{
+  return 0;
+}
+
+
+
+void
+glade_psppire_dictview_post_create (GladeWidgetAdaptor *adaptor,
+                                   GObject            *object,
+                                   GladeCreateReason   reason)
+{
+  GladeWidget *widget ;
+
+  PsppireDictView *dictview = PSPPIRE_DICT_VIEW (object);
+
+  g_return_if_fail (PSPPIRE_IS_DICT_VIEW (dictview));
+
+  widget = glade_widget_get_from_gobject (GTK_WIDGET (dictview));
+  if (!widget)
+    return;
+
+  if (reason == GLADE_CREATE_USER)
+    {
+      /* HIG complient border-width defaults on dictviews */
+      glade_widget_property_set (widget, "border-width", 5);
+    }
+}
+
+
+GtkWidget *
+glade_psppire_dictview_get_internal_child (GladeWidgetAdaptor  *adaptor,
+                                        PsppireDictView       *dictview,
+                                        const gchar         *name)
+{
+#if DEBUGGING
+  g_print ("%s\n", __FUNCTION__);
+#endif
+  return GTK_WIDGET (dictview);
+}
+
+
+
+void
+glade_psppire_dictview_set_property (GladeWidgetAdaptor *adaptor,
+                                    GObject            *object,
+                                    const gchar        *id,
+                                    const GValue       *value)
+{
+#if DEBUGGING
+  g_print ("%s(%p) Type=\"%s\" Id=\"%s\"\n", __FUNCTION__, object,
+          G_OBJECT_TYPE_NAME( object ),
+          id);
+#endif
+
+  GWA_GET_CLASS (GTK_TYPE_WINDOW)->set_property (adaptor, object,
+                                                id, value);
+}
+
+
+GList *
+glade_psppire_dictview_get_children (GladeWidgetAdaptor  *adaptor,
+                                    PsppireDictView  *dv)
+{
+  GList *list = NULL;
+
+  g_return_val_if_fail (PSPPIRE_IS_DICT_VIEW (dv), NULL);
+
+  list = glade_util_container_get_all_children (GTK_CONTAINER (dv));
+
+  return list;
+}
index e2dc4b7661da6061a75c0f3f1a59517c77539085..50a0366186ea4da876516362fec16840196e5e63 100644 (file)
 
     </glade-widget-class>
 
+
+
+    <glade-widget-class name="PsppireDictView" generic-name="psppire-dictview" title="Dictionary Treeview">
+
+      <post-create-function>glade_psppire_dictview_post_create</post-create-function>
+      <get-children-function>glade_psppire_dictview_get_children</get-children-function>
+      <get-internal-child-function>glade_psppire_dictview_get_internal_child</get-internal-child-function>
+
+
+    <properties>
+      <property id="child"                disabled="True" />
+      <property id="homogeneous"          disabled="True" />
+      <property id="visible" ignore="True" default="True" />
+    </properties>
+
+    </glade-widget-class>
+
+
   </glade-widget-classes>
  
 
   <glade-widget-class-ref name="PsppireDialog"/>
   <glade-widget-class-ref name="PsppireHButtonBox"/>
   <glade-widget-class-ref name="PsppireVButtonBox"/>
-  <glade-widget-class-ref name="PsppireKeypad"/>
+  <glade-widget-class-ref name="PsppireDictView"/>
   <glade-widget-class-ref name="PsppireSelector"/>
+  <glade-widget-class-ref name="PsppireKeypad"/>
   <glade-widget-class-ref name="PsppireAcr"/>
  </glade-widget-group>
 
index ad1cf78a7fd973d1af993e32696e59813b5f69f3..33e7b47a0cce90cf7121ab275a78c965d3b66d0a 100644 (file)
@@ -1,5 +1,5 @@
 /*
-   Copyright (C) 2006, 2008 Free Software Foundation
+   Copyright (C) 2006, 2008, 2009 Free Software Foundation
 
    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
@@ -69,7 +69,9 @@
 #include "psppire-sheet.h"
 #include <ui/gui/psppire-marshal.h>
 #include <ui/gui/sheet/psppire-sheetmodel.h>
+#include <ui/gui/sheet/psppire-axis.h>
 #include <libpspp/misc.h>
+
 #include <math.h>
 
 /* sheet flags */
@@ -697,6 +699,7 @@ enum
     PROP_0,
     PROP_VAXIS,
     PROP_HAXIS,
+    PROP_CELL_PADDING,
     PROP_MODEL
   };
 
@@ -756,6 +759,7 @@ psppire_sheet_set_vertical_axis (PsppireSheet *sheet, PsppireAxis *a)
     g_object_ref (sheet->vaxis);
 }
 
+static const GtkBorder default_cell_padding = { 3, 3, 2, 2 };
 
 static void
 psppire_sheet_set_property (GObject         *object,
@@ -768,11 +772,37 @@ psppire_sheet_set_property (GObject         *object,
 
   switch (prop_id)
     {
+    case PROP_CELL_PADDING:
+      if ( sheet->cell_padding)
+       g_boxed_free (GTK_TYPE_BORDER, sheet->cell_padding);
+
+      sheet->cell_padding = g_value_dup_boxed (value);
+
+     if (NULL == sheet->cell_padding)
+       sheet->cell_padding = g_boxed_copy (GTK_TYPE_BORDER,
+                                          &default_cell_padding);
+
+     if (sheet->vaxis)
+       g_object_set (sheet->vaxis, "padding",
+                    sheet->cell_padding->top + sheet->cell_padding->bottom,
+                    NULL);
+
+     if (sheet->haxis)
+       g_object_set (sheet->haxis, "padding",
+                    sheet->cell_padding->left + sheet->cell_padding->right,
+                    NULL);
+      break;
     case PROP_VAXIS:
       psppire_sheet_set_vertical_axis (sheet, g_value_get_pointer (value));
+      g_object_set (sheet->vaxis, "padding",
+                   sheet->cell_padding->top + sheet->cell_padding->bottom,
+                   NULL);
       break;
     case PROP_HAXIS:
       psppire_sheet_set_horizontal_axis (sheet, g_value_get_pointer (value));
+      g_object_set (sheet->haxis, "padding",
+                   sheet->cell_padding->left + sheet->cell_padding->right,
+                   NULL);
       break;
     case PROP_MODEL:
       psppire_sheet_set_model (sheet, g_value_get_pointer (value));
@@ -793,6 +823,9 @@ psppire_sheet_get_property (GObject         *object,
 
   switch (prop_id)
     {
+    case PROP_CELL_PADDING:
+      g_value_set_boxed (value, sheet->cell_padding);
+      break;
     case PROP_VAXIS:
       g_value_set_pointer (value, sheet->vaxis);
       break;
@@ -817,6 +850,7 @@ psppire_sheet_class_init (PsppireSheetClass *klass)
   GParamSpec *haxis_spec ;
   GParamSpec *vaxis_spec ;
   GParamSpec *model_spec ;
+  GParamSpec *cell_padding_spec ;
 
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
   GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
@@ -1018,6 +1052,12 @@ psppire_sheet_class_init (PsppireSheetClass *klass)
   object_class->dispose = psppire_sheet_dispose;
   object_class->finalize = psppire_sheet_finalize;
 
+  cell_padding_spec =
+    g_param_spec_boxed ("cell-padding",
+                       "Cell Padding",
+                       "The space between a cell's contents and its border",
+                       GTK_TYPE_BORDER,
+                       G_PARAM_CONSTRUCT | G_PARAM_READABLE | G_PARAM_WRITABLE);
 
   vaxis_spec =
     g_param_spec_pointer ("vertical-axis",
@@ -1049,6 +1089,10 @@ psppire_sheet_class_init (PsppireSheetClass *klass)
                                    PROP_HAXIS,
                                    haxis_spec);
 
+  g_object_class_install_property (object_class,
+                                   PROP_CELL_PADDING,
+                                   cell_padding_spec);
+
   g_object_class_install_property (object_class,
                                    PROP_MODEL,
                                    model_spec);
@@ -1752,6 +1796,9 @@ psppire_sheet_dispose  (GObject *object)
 
   sheet->dispose_has_run = TRUE;
 
+  if ( sheet->cell_padding)
+    g_boxed_free (GTK_TYPE_BORDER, sheet->cell_padding);
+
   if (sheet->model) g_object_unref (sheet->model);
   if (sheet->vaxis) g_object_unref (sheet->vaxis);
   if (sheet->haxis) g_object_unref (sheet->haxis);
@@ -2173,6 +2220,19 @@ psppire_sheet_cell_draw (PsppireSheet *sheet, gint row, gint col)
   if ( !pango_font_description_get_size_is_absolute (font_desc))
     font_height /= PANGO_SCALE;
 
+
+  if ( sheet->cell_padding )
+    {
+      area.x += sheet->cell_padding->left;
+      area.width -= sheet->cell_padding->right
+       + sheet->cell_padding->left;
+
+      area.y += sheet->cell_padding->top;
+      area.height -= sheet->cell_padding->bottom
+       +
+       sheet->cell_padding->top;
+    }
+
   /* Centre the text vertically */
   area.y += (area.height - font_height) / 2.0;
 
@@ -5219,7 +5279,9 @@ set_column_width (PsppireSheet *sheet,
   if ( width <= 0)
     return;
 
-  psppire_axis_resize (sheet->haxis, column, width);
+  psppire_axis_resize (sheet->haxis, column,
+                      width - sheet->cell_padding->left -
+                      sheet->cell_padding->right);
 
   if (GTK_WIDGET_REALIZED (GTK_WIDGET (sheet)))
     {
@@ -5244,7 +5306,9 @@ set_row_height (PsppireSheet *sheet,
   if (height <= 0)
     return;
 
-  psppire_axis_resize (sheet->vaxis, row, height);
+  psppire_axis_resize (sheet->vaxis, row,
+                      height - sheet->cell_padding->top -
+                      sheet->cell_padding->bottom);
 
   if (GTK_WIDGET_REALIZED (GTK_WIDGET (sheet)) )
     {
index 8e83765cbcfb63494a429978d64162f10f45870c..27c2ed549b2d993cebc916c7573fe7896be3d2b2 100644 (file)
@@ -139,6 +139,9 @@ struct _PsppireSheet
   /* selected range */
   PsppireSheetRange range;
 
+  /* The space between a cell's contents and its border */
+  GtkBorder *cell_padding;
+
   /* the scrolling window and its height and width to
    * make things a little speedier */
   GdkWindow *sheet_window;
index ecf4148752a49368f001def194604d8796389d89..aa8723482840dfb05a53057987a5d564d896c59d 100644 (file)
@@ -978,3 +978,5 @@ get_fmt_desc (enum fmt_type type)
   assert (is_fmt_type (type));
   return &formats[type];
 }
+
+const struct fmt_spec F_8_0 = {FMT_F, 8, 0};
index 15d13ef958d4e2c42b3a12c443bada7b0a946cf8..049ffc6fdc9f7d903af41dad566521f24d287d41 100644 (file)
@@ -164,4 +164,6 @@ int fmt_grouping_char (const struct fmt_number_style *, enum fmt_type);
 
 void fmt_set_decimal (struct fmt_number_style *, char);
 
+extern const struct fmt_spec F_8_0 ;
+
 #endif /* data/format.h */
index 807adc50d9d112de7b47459f0a06a98a4786651f..2162741a78e416324d07578f49e5d75f5da4a95e 100644 (file)
@@ -185,7 +185,7 @@ replace_file_start (const char *file_name, const char *mode,
         }
 
       /* Create file by that name. */
-      fd = open (rf->tmp_name, O_WRONLY | O_CREAT | O_EXCL, permissions);
+      fd = open (rf->tmp_name, O_WRONLY | O_CREAT | O_EXCL | O_BINARY, permissions);
       if (fd >= 0)
         break;
       if (errno != EEXIST)
index 773969302ebcb9ddc3b06fea93aa1da6c66c313c..8de293c5eafb2904d065db08f7779c9980f4e805 100644 (file)
@@ -215,7 +215,8 @@ write_float (struct pfm_writer *w, double d)
   char buffer[64];
   format_trig_double (d, floor (d) == d ? DBL_DIG : w->digits, buffer);
   buf_write (w, buffer, strlen (buffer));
-  buf_write (w, "/", 1);
+  if (d != SYSMIS)
+    buf_write (w, "/", 1);
 }
 
 /* Write N to the portable file as an integer field. */
index f2d5ff282272f48e821c4826d9d60f5158f6bfca..85e777a991b9218bfbf2c5f17555a9972093bd5e 100644 (file)
@@ -452,6 +452,10 @@ psql_open_reader (struct psql_read_info *info, struct dictionary **dict)
          break;
        }
 
+      if ( width == 0 && fmt_is_string (fmt.type))
+       fmt.w = width = MAX_SHORT_STRING;
+
+
       var = create_var (r, &fmt, width, PQfname (qres, i), i);
       if ( type == NUMERICOID && n_tuples > 0)
        {
index b62b4dce1375a11c11030ca299de2284141261b9..f4344b76e86010603e10e0af33a12e8f717632af 100644 (file)
@@ -18,6 +18,7 @@
 #include <libpspp/compiler.h>
 #include <output/table.h>
 
+#include <data/format.h>
 #include <data/case.h>
 #include <data/casereader.h>
 #include <data/dictionary.h>
@@ -114,22 +115,32 @@ do_binomial (const struct dictionary *dict,
          if (var_is_value_missing (var, value, exclude))
            continue;
 
-         if ( NULL == cat1[v].value )
+         if (bst->cutpoint != SYSMIS)
            {
-             cat1[v].value = value_dup (value, width);
-             cat1[v].count = w;
+             if ( compare_values_short (cat1[v].value, value, var) >= 0 )
+                 cat1[v].count  += w;
+             else
+                 cat2[v].count += w;
            }
-         else if ( 0 == compare_values_short (cat1[v].value, value, var))
-           cat1[v].count += w;
-         else if ( NULL == cat2[v].value )
+         else
            {
-             cat2[v].value = value_dup (value, width);
-             cat2[v].count = w;
+             if ( NULL == cat1[v].value )
+               {
+                 cat1[v].value = value_dup (value, width);
+                 cat1[v].count = w;
+               }
+             else if ( 0 == compare_values_short (cat1[v].value, value, var))
+               cat1[v].count += w;
+             else if ( NULL == cat2[v].value )
+               {
+                 cat2[v].value = value_dup (value, width);
+                 cat2[v].count = w;
+               }
+             else if ( 0 == compare_values_short (cat2[v].value, value, var))
+               cat2[v].count += w;
+             else if ( bst->category1 == SYSMIS)
+               msg (ME, _("Variable %s is not dichotomous"), var_get_name (var));
            }
-         else if ( 0 == compare_values_short (cat2[v].value, value, var))
-           cat2[v].count += w;
-         else if ( bst->category1 == SYSMIS)
-           msg (ME, _("Variable %s is not dichotomous"), var_get_name (var));
        }
 
       case_unref (c);
@@ -148,15 +159,24 @@ binomial_execute (const struct dataset *ds,
                  double timer UNUSED)
 {
   int v;
+  const struct dictionary *dict = dataset_dict (ds);
   const struct binomial_test *bst = (const struct binomial_test *) test;
   const struct one_sample_test *ost = (const struct one_sample_test*) test;
 
   struct freq_mutable *cat1 = xzalloc (sizeof (*cat1) * ost->n_vars);
   struct freq_mutable *cat2 = xzalloc (sizeof (*cat1) * ost->n_vars);
 
-  assert ((bst->category1 == SYSMIS) == (bst->category2 == SYSMIS) );
+  assert ((bst->category1 == SYSMIS) == (bst->category2 == SYSMIS) || bst->cutpoint != SYSMIS);
 
-  if ( bst->category1 != SYSMIS )
+  if ( bst->cutpoint != SYSMIS )
+    {
+      int i;
+      union value v;
+      v.f = bst->cutpoint;
+      for (i = 0; i < ost->n_vars; i++)
+       cat1[i].value = value_dup (&v, 0);
+    }
+  else  if ( bst->category1 != SYSMIS )
     {
       int i;
       union value v;
@@ -174,8 +194,12 @@ binomial_execute (const struct dataset *ds,
        cat2[i].value = value_dup (&v, 0);
     }
 
-  if (do_binomial (dataset_dict(ds), input, bst, cat1, cat2, exclude))
+  if (do_binomial (dict, input, bst, cat1, cat2, exclude))
     {
+      const struct variable *wvar = dict_get_weight (dict);
+      const struct fmt_spec *wfmt = wvar ?
+       var_get_print_format (wvar) : & F_8_0;
+
       struct tab_table *table = tab_create (7, ost->n_vars * 3 + 1, 0);
 
       tab_dim (table, tab_natural_dimensions);
@@ -197,8 +221,15 @@ binomial_execute (const struct dataset *ds,
          ds_init_empty (&catstr1);
          ds_init_empty (&catstr2);
 
-         var_append_value_name (var, cat1[v].value, &catstr1);
-         var_append_value_name (var, cat2[v].value, &catstr2);
+         if ( bst->cutpoint != SYSMIS)
+           {
+             ds_put_format (&catstr1, "<= %g", bst->cutpoint);
+           }
+         else
+           {
+             var_append_value_name (var, cat1[v].value, &catstr1);
+             var_append_value_name (var, cat2[v].value, &catstr2);
+           }
 
           tab_hline (table, TAL_1, 0, tab_nc (table) -1, 1 + v * 3);
 
@@ -209,30 +240,31 @@ binomial_execute (const struct dataset *ds,
           tab_text (table, 1, 3 + v * 3, TAB_LEFT, _("Total"));
 
           /* Test Prop */
-          tab_float (table, 5, 1 + v * 3, TAB_NONE, bst->p, 8, 3);
+          tab_double (table, 5, 1 + v * 3, TAB_NONE, bst->p, NULL);
 
           /* Category labels */
           tab_text (table, 2, 1 + v * 3, TAB_NONE, ds_cstr (&catstr1));
          tab_text (table, 2, 2 + v * 3, TAB_NONE, ds_cstr (&catstr2));
 
           /* Observed N */
-          tab_float (table, 3, 1 + v * 3, TAB_NONE, cat1[v].count, 8, 0);
-          tab_float (table, 3, 2 + v * 3, TAB_NONE, cat2[v].count, 8, 0);
+          tab_double (table, 3, 1 + v * 3, TAB_NONE, cat1[v].count, wfmt);
+          tab_double (table, 3, 2 + v * 3, TAB_NONE, cat2[v].count, wfmt);
 
           n_total = cat1[v].count + cat2[v].count;
-          tab_float (table, 3, 3 + v * 3, TAB_NONE, n_total, 8, 0);
+          tab_double (table, 3, 3 + v * 3, TAB_NONE, n_total, wfmt);
 
           /* Observed Proportions */
-          tab_float (table, 4, 1 + v * 3, TAB_NONE,
-                     cat1[v].count / n_total, 8, 3);
-          tab_float (table, 4, 2 + v * 3, TAB_NONE,
-                     cat2[v].count / n_total, 8, 3);
-          tab_float (table, 4, 3 + v * 3, TAB_NONE,
-                     (cat1[v].count + cat2[v].count) / n_total, 8, 2);
+          tab_double (table, 4, 1 + v * 3, TAB_NONE,
+                     cat1[v].count / n_total, NULL);
+          tab_double (table, 4, 2 + v * 3, TAB_NONE,
+                     cat2[v].count / n_total, NULL);
+
+          tab_double (table, 4, 3 + v * 3, TAB_NONE,
+                     (cat1[v].count + cat2[v].count) / n_total, NULL);
 
           /* Significance */
           sig = calculate_binomial (cat1[v].count, cat2[v].count, bst->p);
-          tab_float (table, 6, 1 + v * 3, TAB_NONE, sig, 8, 3);
+          tab_double (table, 6, 1 + v * 3, TAB_NONE, sig, NULL);
 
          ds_destroy (&catstr1);
          ds_destroy (&catstr2);
index 19496d7ead9016de96949f5502abfdc6f7576eea..6cb7fc0b192ee2bfce5e50a620a26bd466a3ee6e 100644 (file)
@@ -21,6 +21,7 @@
 #include <stdlib.h>
 #include <math.h>
 
+#include <data/format.h>
 #include <data/case.h>
 #include <data/casereader.h>
 #include <data/dictionary.h>
@@ -269,8 +270,8 @@ create_combo_frequency_table (const struct chisquare_test *test)
     }
 
   for ( i = test->lo ; i <= test->hi ; ++i )
-    tab_float (table, 0, 2 + i - test->lo,
-              TAB_LEFT, 1 + i - test->lo, 8, 0);
+    tab_fixed (table, 0, 2 + i - test->lo,
+               TAB_LEFT, 1 + i - test->lo, 8, 0);
 
   tab_headers (table, 1, 0, 2, 0);
 
@@ -330,6 +331,9 @@ chisquare_execute (const struct dataset *ds,
   struct chisquare_test *cst = (struct chisquare_test *) test;
   int n_cells = 0;
   double total_expected = 0.0;
+  const struct variable *wvar = dict_get_weight (dict);
+  const struct fmt_spec *wfmt = wvar ?
+    var_get_print_format (wvar) : & F_8_0;
 
   double *df = xzalloc (sizeof (*df) * ost->n_vars);
   double *xsq = xzalloc (sizeof (*df) * ost->n_vars);
@@ -378,28 +382,28 @@ chisquare_execute (const struct dataset *ds,
 
 
              /* The observed N */
-             tab_float (freq_table, 1, i + 1, TAB_NONE,
-                        ff[i]->count, 8, 0);
+             tab_double (freq_table, 1, i + 1, TAB_NONE,
+                        ff[i]->count, wfmt);
 
              if ( cst->n_expected > 0 )
                exp = cst->expected[i] * total_obs / total_expected ;
              else
                exp = total_obs / (double) n_cells;
 
-             tab_float (freq_table, 2, i + 1, TAB_NONE,
-                        exp, 8, 2);
+             tab_double (freq_table, 2, i + 1, TAB_NONE,
+                        exp, NULL);
 
              /* The residual */
-             tab_float (freq_table, 3, i + 1, TAB_NONE,
-                        ff[i]->count - exp, 8, 2);
+             tab_double (freq_table, 3, i + 1, TAB_NONE,
+                        ff[i]->count - exp, NULL);
 
              xsq[v] += (ff[i]->count - exp) * (ff[i]->count - exp) / exp;
            }
 
          df[v] = n_cells - 1.0;
 
-         tab_float (freq_table, 1, i + 1, TAB_NONE,
-                    total_obs, 8, 0);
+         tab_double (freq_table, 1, i + 1, TAB_NONE,
+                    total_obs, wfmt);
 
          tab_submit (freq_table);
 
@@ -450,8 +454,8 @@ chisquare_execute (const struct dataset *ds,
              ds_destroy (&str);
 
              /* The observed N */
-             tab_float (freq_table, v * 4 + 2, i + 2 , TAB_NONE,
-                        ff[i]->count, 8, 0);
+             tab_double (freq_table, v * 4 + 2, i + 2 , TAB_NONE,
+                        ff[i]->count, wfmt);
 
              if ( cst->n_expected > 0 )
                exp = cst->expected[i] * total_obs / total_expected ;
@@ -459,19 +463,19 @@ chisquare_execute (const struct dataset *ds,
                exp = total_obs / (double) hsh_count (freq_hash);
 
              /* The expected N */
-             tab_float (freq_table, v * 4 + 3, i + 2 , TAB_NONE,
-                        exp, 8, 2);
+             tab_double (freq_table, v * 4 + 3, i + 2 , TAB_NONE,
+                        exp, NULL);
 
              /* The residual */
-             tab_float (freq_table, v * 4 + 4, i + 2 , TAB_NONE,
-                        ff[i]->count - exp, 8, 2);
+             tab_double (freq_table, v * 4 + 4, i + 2 , TAB_NONE,
+                        ff[i]->count - exp, NULL);
 
              xsq[v] += (ff[i]->count - exp) * (ff[i]->count - exp) / exp;
            }
 
 
-         tab_float (freq_table, v * 4 + 2, tab_nr (freq_table) - 1, TAB_NONE,
-                    total_obs, 8, 0);
+         tab_double (freq_table, v * 4 + 2, tab_nr (freq_table) - 1, TAB_NONE,
+                    total_obs, wfmt);
 
          df[v] = n_cells - 1.0;
 
@@ -494,11 +498,11 @@ chisquare_execute (const struct dataset *ds,
 
           tab_text (stats_table, 1 + v, 0, TAB_CENTER, var_get_name (var));
 
-          tab_float (stats_table, 1 + v, 1, TAB_NONE, xsq[v], 8,3);
-          tab_float (stats_table, 1 + v, 2, TAB_NONE, df[v], 8,0);
+          tab_double (stats_table, 1 + v, 1, TAB_NONE, xsq[v], NULL);
+          tab_fixed (stats_table, 1 + v, 2, TAB_NONE, df[v], 8, 0);
 
-          tab_float (stats_table, 1 + v, 3, TAB_NONE,
-                     gsl_cdf_chisq_Q (xsq[v], df[v]), 8,3);
+          tab_double (stats_table, 1 + v, 3, TAB_NONE,
+                     gsl_cdf_chisq_Q (xsq[v], df[v]), NULL);
         }
       tab_submit (stats_table);
     }
index 68d11e307e0ff41584d1ffae0ef4abd6d8c9ff74..309b27fc3c51cb136ae5f9d012e5d538625ade5d 100644 (file)
@@ -179,7 +179,8 @@ static int internal_cmd_crosstabs (struct lexer *lexer, struct dataset *ds);
 static void precalc (struct casereader *, const struct dataset *);
 static void calc_general (const struct ccase *, const struct dataset *);
 static void calc_integer (const struct ccase *, const struct dataset *);
-static void postcalc (void);
+static void postcalc (const struct dataset *);
+
 static void submit (struct tab_table *);
 
 static void format_short (char *s, const struct fmt_spec *fp,
@@ -318,7 +319,7 @@ internal_cmd_crosstabs (struct lexer *lexer, struct dataset *ds)
         }
       casereader_destroy (group);
 
-      postcalc ();
+      postcalc (ds);
     }
   ok = casegrouper_destroy (grouper);
   ok = proc_commit (ds) && ok;
@@ -789,12 +790,13 @@ static void enum_var_values (struct table_entry **entries, int entry_cnt,
                              int var_idx,
                              union value **values, int *value_cnt);
 static void output_pivot_table (struct table_entry **, struct table_entry **,
+                               const struct dictionary *,
                                double **, double **, double **,
                                int *, int *, int *);
-static void make_summary_table (void);
+static void make_summary_table (const struct dictionary *);
 
 static void
-postcalc (void)
+postcalc (const struct dataset *ds)
 {
   if (mode == GENERAL)
     {
@@ -802,7 +804,7 @@ postcalc (void)
       sorted_tab = (struct table_entry **) hsh_sort (gen_tab);
     }
 
-  make_summary_table ();
+  make_summary_table (dataset_dict (ds));
 
   /* Identify all the individual crosstabulation tables, and deal with
      them. */
@@ -819,7 +821,8 @@ postcalc (void)
        if (pe == NULL)
          break;
 
-       output_pivot_table (pb, pe, &mat, &row_tot, &col_tot,
+       output_pivot_table (pb, pe, dataset_dict (ds),
+                           &mat, &row_tot, &col_tot,
                            &maxrows, &maxcols, &maxcells);
 
        pb = pe;
@@ -842,11 +845,13 @@ postcalc (void)
     }
 }
 
-static void insert_summary (struct tab_table *, int tab_index, double valid);
+static void insert_summary (struct tab_table *, int tab_index,
+                           const struct dictionary *,
+                           double valid);
 
 /* Output a table summarizing the cases processed. */
 static void
-make_summary_table (void)
+make_summary_table (const struct dictionary *dict)
 {
   struct tab_table *summary;
 
@@ -885,7 +890,7 @@ make_summary_table (void)
        break;
 
       while (cur_tab < (*pb)->table)
-       insert_summary (summary, cur_tab++, 0.);
+       insert_summary (summary, cur_tab++, dict, 0.);
 
       if (mode == GENERAL)
        for (valid = 0.; pb < pe; pb++)
@@ -906,13 +911,13 @@ make_summary_table (void)
                valid += *data++;
            }
        }
-      insert_summary (summary, cur_tab++, valid);
+      insert_summary (summary, cur_tab++, dict, valid);
 
       pb = pe;
     }
 
   while (cur_tab < nxtab)
-    insert_summary (summary, cur_tab++, 0.);
+    insert_summary (summary, cur_tab++, dict, 0.);
 
   submit (summary);
 }
@@ -920,10 +925,15 @@ make_summary_table (void)
 /* Inserts a line into T describing the crosstabulation at index
    TAB_INDEX, which has VALID valid observations. */
 static void
-insert_summary (struct tab_table *t, int tab_index, double valid)
+insert_summary (struct tab_table *t, int tab_index,
+               const struct dictionary *dict,
+               double valid)
 {
   struct crosstab *x = xtab[tab_index];
 
+  const struct variable *wv = dict_get_weight (dict);
+  const struct fmt_spec *wfmt = wv ? var_get_print_format (wv) : & F_8_0;
+
   tab_hline (t, TAL_1, 0, 6, 0);
 
   /* Crosstabulation name. */
@@ -956,7 +966,7 @@ insert_summary (struct tab_table *t, int tab_index, double valid)
 
     for (i = 0; i < 3; i++)
       {
-       tab_float (t, i * 2 + 1, 0, TAB_RIGHT, n[i], 8, 0);
+       tab_double (t, i * 2 + 1, 0, TAB_RIGHT, n[i], wfmt);
        tab_text (t, i * 2 + 2, 0, TAB_RIGHT | TAT_PRINTF, "%.1f%%",
                  n[i] / n[2] * 100.);
       }
@@ -1005,9 +1015,9 @@ static double W;          /* Grand total. */
 static void display_dimensions (struct tab_table *, int first_difference,
                                struct table_entry *);
 static void display_crosstabulation (void);
-static void display_chisq (void);
-static void display_symmetric (void);
-static void display_risk (void);
+static void display_chisq (const struct dictionary *);
+static void display_symmetric (const struct dictionary *);
+static void display_risk (const struct dictionary *);
 static void display_directional (void);
 static void crosstabs_dim (struct tab_table *, struct outp_driver *);
 static void table_value_missing (struct tab_table *table, int c, int r,
@@ -1020,6 +1030,7 @@ static void delete_missing (void);
    hold *MAXROWS entries. */
 static void
 output_pivot_table (struct table_entry **pb, struct table_entry **pe,
+                   const struct dictionary *dict,
                    double **matp, double **row_totp, double **col_totp,
                    int *maxrows, int *maxcols, int *maxcells)
 {
@@ -1426,11 +1437,11 @@ output_pivot_table (struct table_entry **pb, struct table_entry **pe,
       if (cmd.miss == CRS_REPORT)
        delete_missing ();
       if (chisq)
-       display_chisq ();
+       display_chisq (dict);
       if (sym)
-       display_symmetric ();
+       display_symmetric (dict);
       if (risk)
-       display_risk ();
+       display_risk (dict);
       if (direct)
        display_directional ();
 
@@ -1970,8 +1981,11 @@ static void calc_chisq (double[N_CHISQ], int[N_CHISQ], double *, double *);
 
 /* Display chi-square statistics. */
 static void
-display_chisq (void)
+display_chisq (const struct dictionary *dict)
 {
+  const struct variable *wv = dict_get_weight (dict);
+  const struct fmt_spec *wfmt = wv ? var_get_print_format (wv) : & F_8_0;
+
   static const char *chisq_stats[N_CHISQ] =
     {
       N_("Pearson Chi-Square"),
@@ -2001,22 +2015,22 @@ display_chisq (void)
       tab_text (chisq, 0, 0, TAB_LEFT, gettext (chisq_stats[i]));
       if (i != 2)
        {
-         tab_float (chisq, 1, 0, TAB_RIGHT, chisq_v[i], 8, 3);
-         tab_float (chisq, 2, 0, TAB_RIGHT, df[i], 8, 0);
-         tab_float (chisq, 3, 0, TAB_RIGHT,
-                    gsl_cdf_chisq_Q (chisq_v[i], df[i]), 8, 3);
+         tab_double (chisq, 1, 0, TAB_RIGHT, chisq_v[i], NULL);
+         tab_double (chisq, 2, 0, TAB_RIGHT, df[i], wfmt);
+         tab_double (chisq, 3, 0, TAB_RIGHT,
+                    gsl_cdf_chisq_Q (chisq_v[i], df[i]), NULL);
        }
       else
        {
          chisq_fisher = 1;
-         tab_float (chisq, 4, 0, TAB_RIGHT, fisher2, 8, 3);
-         tab_float (chisq, 5, 0, TAB_RIGHT, fisher1, 8, 3);
+         tab_double (chisq, 4, 0, TAB_RIGHT, fisher2, NULL);
+         tab_double (chisq, 5, 0, TAB_RIGHT, fisher1, NULL);
        }
       tab_next_row (chisq);
     }
 
   tab_text (chisq, 0, 0, TAB_LEFT, _("N of Valid Cases"));
-  tab_float (chisq, 1, 0, TAB_RIGHT, W, 8, 0);
+  tab_double (chisq, 1, 0, TAB_RIGHT, W, wfmt);
   tab_next_row (chisq);
 
   tab_offset (chisq, 0, -1);
@@ -2027,8 +2041,11 @@ static int calc_symmetric (double[N_SYMMETRIC], double[N_SYMMETRIC],
 
 /* Display symmetric measures. */
 static void
-display_symmetric (void)
+display_symmetric (const struct dictionary *dict)
 {
+  const struct variable *wv = dict_get_weight (dict);
+  const struct fmt_spec *wfmt = wv ? var_get_print_format (wv) : & F_8_0;
+
   static const char *categories[] =
     {
       N_("Nominal by Nominal"),
@@ -2076,17 +2093,17 @@ display_symmetric (void)
        }
 
       tab_text (sym, 1, 0, TAB_LEFT, gettext (stats[i]));
-      tab_float (sym, 2, 0, TAB_RIGHT, sym_v[i], 8, 3);
+      tab_double (sym, 2, 0, TAB_RIGHT, sym_v[i], NULL);
       if (sym_ase[i] != SYSMIS)
-       tab_float (sym, 3, 0, TAB_RIGHT, sym_ase[i], 8, 3);
+       tab_double (sym, 3, 0, TAB_RIGHT, sym_ase[i], NULL);
       if (sym_t[i] != SYSMIS)
-       tab_float (sym, 4, 0, TAB_RIGHT, sym_t[i], 8, 3);
-      /*tab_float (sym, 5, 0, TAB_RIGHT, normal_sig (sym_v[i]), 8, 3);*/
+       tab_double (sym, 4, 0, TAB_RIGHT, sym_t[i], NULL);
+      /*tab_double (sym, 5, 0, TAB_RIGHT, normal_sig (sym_v[i]), NULL);*/
       tab_next_row (sym);
     }
 
   tab_text (sym, 0, 0, TAB_LEFT, _("N of Valid Cases"));
-  tab_float (sym, 2, 0, TAB_RIGHT, W, 8, 0);
+  tab_double (sym, 2, 0, TAB_RIGHT, W, wfmt);
   tab_next_row (sym);
 
   tab_offset (sym, 0, -1);
@@ -2096,8 +2113,11 @@ static int calc_risk (double[], double[], double[], union value *);
 
 /* Display risk estimate. */
 static void
-display_risk (void)
+display_risk (const struct dictionary *dict)
 {
+  const struct variable *wv = dict_get_weight (dict);
+  const struct fmt_spec *wfmt = wv ? var_get_print_format (wv) : & F_8_0;
+
   char buf[256];
   double risk_v[3], lower[3], upper[3];
   union value c[2];
@@ -2138,14 +2158,14 @@ display_risk (void)
        }
 
       tab_text (risk, 0, 0, TAB_LEFT, buf);
-      tab_float (risk, 1, 0, TAB_RIGHT, risk_v[i], 8, 3);
-      tab_float (risk, 2, 0, TAB_RIGHT, lower[i], 8, 3);
-      tab_float (risk, 3, 0, TAB_RIGHT, upper[i], 8, 3);
+      tab_double (risk, 1, 0, TAB_RIGHT, risk_v[i], NULL);
+      tab_double (risk, 2, 0, TAB_RIGHT, lower[i],  NULL);
+      tab_double (risk, 3, 0, TAB_RIGHT, upper[i],  NULL);
       tab_next_row (risk);
     }
 
   tab_text (risk, 0, 0, TAB_LEFT, _("N of Valid Cases"));
-  tab_float (risk, 1, 0, TAB_RIGHT, W, 8, 0);
+  tab_double (risk, 1, 0, TAB_RIGHT, W, wfmt);
   tab_next_row (risk);
 
   tab_offset (risk, 0, -1);
@@ -2258,12 +2278,12 @@ display_directional (void)
            }
       }
 
-      tab_float (direct, 3, 0, TAB_RIGHT, direct_v[i], 8, 3);
+      tab_double (direct, 3, 0, TAB_RIGHT, direct_v[i], NULL);
       if (direct_ase[i] != SYSMIS)
-       tab_float (direct, 4, 0, TAB_RIGHT, direct_ase[i], 8, 3);
+       tab_double (direct, 4, 0, TAB_RIGHT, direct_ase[i], NULL);
       if (direct_t[i] != SYSMIS)
-       tab_float (direct, 5, 0, TAB_RIGHT, direct_t[i], 8, 3);
-      /*tab_float (direct, 6, 0, TAB_RIGHT, normal_sig (direct_v[i]), 8, 3);*/
+       tab_double (direct, 5, 0, TAB_RIGHT, direct_t[i], NULL);
+      /*tab_double (direct, 6, 0, TAB_RIGHT, normal_sig (direct_v[i]), NULL);*/
       tab_next_row (direct);
     }
 
index 68b19300f6921f80410b7cef01ebe51ab2239876..23bb1aa8e0fcc9ce329bccde237da98c178af1df 100644 (file)
@@ -908,9 +908,10 @@ display (struct dsc_proc *dsc)
       tab_text (t, nc++, i + 1, TAT_PRINTF, "%g", dv->valid);
       if (dsc->format == DSC_SERIAL)
        tab_text (t, nc++, i + 1, TAT_PRINTF, "%g", dv->missing);
+
       for (j = 0; j < DSC_N_STATS; j++)
        if (dsc->show_stats & (1ul << j))
-         tab_float (t, nc++, i + 1, TAB_NONE, dv->stats[j], 10, 3);
+         tab_double (t, nc++, i + 1, TAB_NONE, dv->stats[j], NULL);
     }
 
   tab_title (t, _("Valid cases = %g; cases with missing value(s) = %g."),
index 2649968b31485b105f6a80f3119ab39bdc851eea..51f2832052e57461e628b96353c4d16b3101f6d4 100644 (file)
@@ -207,6 +207,7 @@ static int examine_parse_independent_vars (struct lexer *lexer,
 
 /* Output functions */
 static void show_summary (const struct variable **dependent_var, int n_dep_var,
+                         const struct dictionary *dict,
                          const struct xfactor *f);
 
 
@@ -231,7 +232,7 @@ static void show_extremes (const struct variable **dependent_var,
 static void run_examine (struct cmd_examine *, struct casereader *,
                          struct dataset *);
 
-static void output_examine (void);
+static void output_examine (const struct dictionary *dict);
 
 
 void factor_calc (const struct ccase *c, int case_no,
@@ -628,11 +629,11 @@ show_boxplot_variables (const struct variable **dependent_var,
 
 /* Show all the appropriate tables */
 static void
-output_examine (void)
+output_examine (const struct dictionary *dict)
 {
   struct ll *ll;
 
-  show_summary (dependent_vars, n_dependent_vars, &level0_factor);
+  show_summary (dependent_vars, n_dependent_vars, dict, &level0_factor);
 
   if ( cmd.a_statistics[XMN_ST_EXTREME] )
     show_extremes (dependent_vars, n_dependent_vars, &level0_factor);
@@ -659,7 +660,7 @@ output_examine (void)
        ll != ll_null (&factor_list); ll = ll_next (ll))
     {
       struct xfactor *factor = ll_data (ll, struct xfactor, ll);
-      show_summary (dependent_vars, n_dependent_vars, factor);
+      show_summary (dependent_vars, n_dependent_vars, dict, factor);
 
       if ( cmd.a_statistics[XMN_ST_EXTREME] )
        show_extremes (dependent_vars, n_dependent_vars, factor);
@@ -1180,7 +1181,7 @@ run_examine (struct cmd_examine *cmd, struct casereader *input,
 
   casereader_destroy (input);
 
-  output_examine ();
+  output_examine (dict);
 
   factor_destroy (&level0_factor);
 
@@ -1200,8 +1201,12 @@ run_examine (struct cmd_examine *cmd, struct casereader *input,
 
 static void
 show_summary (const struct variable **dependent_var, int n_dep_var,
+             const struct dictionary *dict,
              const struct xfactor *fctr)
 {
+  const struct variable *wv = dict_get_weight (dict);
+  const struct fmt_spec *wfmt = wv ? var_get_print_format (wv) : & F_8_0;
+
   static const char *subtitle[]=
     {
       N_("Valid"),
@@ -1393,10 +1398,10 @@ show_summary (const struct variable **dependent_var, int n_dep_var,
          result->metrics[v].se_mean = sqrt (result->metrics[v].variance / n) ;
 
          /* Total Valid */
-         tab_float (tbl, heading_columns,
+         tab_double (tbl, heading_columns,
                     heading_rows + j + v * ll_count (&fctr->result_list),
                     TAB_LEFT,
-                    n, 8, 0);
+                    n, wfmt);
 
          tab_text (tbl, heading_columns + 1,
                    heading_rows + j + v * ll_count (&fctr->result_list),
@@ -1404,11 +1409,11 @@ show_summary (const struct variable **dependent_var, int n_dep_var,
                    "%g%%", n * 100.0 / result->metrics[v].n);
 
          /* Total Missing */
-         tab_float (tbl, heading_columns + 2,
+         tab_double (tbl, heading_columns + 2,
                     heading_rows + j + v * ll_count (&fctr->result_list),
                     TAB_LEFT,
                     result->metrics[v].n - n,
-                    8, 0);
+                    wfmt);
 
          tab_text (tbl, heading_columns + 3,
                    heading_rows + j + v * ll_count (&fctr->result_list),
@@ -1418,11 +1423,11 @@ show_summary (const struct variable **dependent_var, int n_dep_var,
                    );
 
          /* Total Valid + Missing */
-         tab_float (tbl, heading_columns + 4,
+         tab_double (tbl, heading_columns + 4,
                     heading_rows + j + v * ll_count (&fctr->result_list),
                     TAB_LEFT,
                     result->metrics[v].n,
-                    8, 0);
+                    wfmt);
 
          tab_text (tbl, heading_columns + 5,
                    heading_rows + j + v * ll_count (&fctr->result_list),
@@ -1621,93 +1626,93 @@ show_descriptives (const struct variable **dependent_var,
 
          /* Now the statistics ... */
 
-         tab_float (tbl, n_cols - 2,
+         tab_double (tbl, n_cols - 2,
                    heading_rows + row_var_start + i * DESCRIPTIVE_ROWS,
                     TAB_CENTER,
                     result->metrics[v].mean,
-                    8, 2);
+                    NULL);
 
-         tab_float (tbl, n_cols - 1,
+         tab_double (tbl, n_cols - 1,
                    heading_rows + row_var_start + i * DESCRIPTIVE_ROWS,
                     TAB_CENTER,
                     result->metrics[v].se_mean,
-                    8, 3);
+                    NULL);
 
 
-         tab_float (tbl, n_cols - 2,
+         tab_double (tbl, n_cols - 2,
                     heading_rows + row_var_start + 1 + i * DESCRIPTIVE_ROWS,
                     TAB_CENTER,
                     result->metrics[v].mean - t *
                      result->metrics[v].se_mean,
-                    8, 3);
+                    NULL);
 
-         tab_float (tbl, n_cols - 2,
+         tab_double (tbl, n_cols - 2,
                     heading_rows + row_var_start + 2 + i * DESCRIPTIVE_ROWS,
                     TAB_CENTER,
                     result->metrics[v].mean + t *
                      result->metrics[v].se_mean,
-                    8, 3);
+                    NULL);
 
 
-         tab_float (tbl, n_cols - 2,
+         tab_double (tbl, n_cols - 2,
                     heading_rows + row_var_start + 3 + i * DESCRIPTIVE_ROWS,
                     TAB_CENTER,
                     trimmed_mean_calculate ((struct trimmed_mean *) result->metrics[v].trimmed_mean),
-                    8, 2);
+                    NULL);
 
 
-         tab_float (tbl, n_cols - 2,
+         tab_double (tbl, n_cols - 2,
                     heading_rows + row_var_start + 4 + i * DESCRIPTIVE_ROWS,
                     TAB_CENTER,
                     percentile_calculate (result->metrics[v].quartiles[1], percentile_algorithm),
-                    8, 2);
+                    NULL);
 
 
-         tab_float (tbl, n_cols - 2,
+         tab_double (tbl, n_cols - 2,
                     heading_rows + row_var_start + 5 + i * DESCRIPTIVE_ROWS,
                     TAB_CENTER,
                     result->metrics[v].variance,
-                    8, 3);
+                    NULL);
 
-         tab_float (tbl, n_cols - 2,
+         tab_double (tbl, n_cols - 2,
                     heading_rows + row_var_start + 6 + i * DESCRIPTIVE_ROWS,
                     TAB_CENTER,
                     sqrt (result->metrics[v].variance),
-                    8, 3);
+                    NULL);
 
-         tab_float (tbl, n_cols - 2,
+         tab_double (tbl, n_cols - 2,
                     heading_rows + row_var_start + 10 + i * DESCRIPTIVE_ROWS,
                     TAB_CENTER,
                     percentile_calculate (result->metrics[v].quartiles[2],
                                           percentile_algorithm) -
                     percentile_calculate (result->metrics[v].quartiles[0],
                                           percentile_algorithm),
-                    8, 2);
+                    NULL);
 
 
-         tab_float (tbl, n_cols - 2,
+         tab_double (tbl, n_cols - 2,
                     heading_rows + row_var_start + 11 + i * DESCRIPTIVE_ROWS,
                     TAB_CENTER,
                     result->metrics[v].skewness,
-                    8, 3);
+                    NULL);
 
-         tab_float (tbl, n_cols - 2,
+         tab_double (tbl, n_cols - 2,
                     heading_rows + row_var_start + 12 + i * DESCRIPTIVE_ROWS,
                     TAB_CENTER,
                     result->metrics[v].kurtosis,
-                    8, 3);
+                    NULL);
 
-         tab_float (tbl, n_cols - 1,
+         tab_double (tbl, n_cols - 1,
                     heading_rows + row_var_start + 11 + i * DESCRIPTIVE_ROWS,
                     TAB_CENTER,
                     calc_seskew (result->metrics[v].n),
-                    8, 3);
+                    NULL);
 
-         tab_float (tbl, n_cols - 1,
+         tab_double (tbl, n_cols - 1,
                     heading_rows + row_var_start + 12 + i * DESCRIPTIVE_ROWS,
                     TAB_CENTER,
                     calc_sekurt (result->metrics[v].n),
-                    8, 3);
+                    NULL);
 
          {
            struct extremum *minimum, *maximum ;
@@ -1718,23 +1723,23 @@ show_descriptives (const struct variable **dependent_var,
            maximum = ll_data (max_ll, struct extremum, ll);
            minimum = ll_data (min_ll, struct extremum, ll);
 
-           tab_float (tbl, n_cols - 2,
+           tab_double (tbl, n_cols - 2,
                       heading_rows + row_var_start + 7 + i * DESCRIPTIVE_ROWS,
                       TAB_CENTER,
                       minimum->value,
-                      8, 3);
+                      NULL);
 
-           tab_float (tbl, n_cols - 2,
+           tab_double (tbl, n_cols - 2,
                       heading_rows + row_var_start + 8 + i * DESCRIPTIVE_ROWS,
                       TAB_CENTER,
                       maximum->value,
-                      8, 3);
+                      NULL);
 
-           tab_float (tbl, n_cols - 2,
+           tab_double (tbl, n_cols - 2,
                       heading_rows + row_var_start + 9 + i * DESCRIPTIVE_ROWS,
                       TAB_CENTER,
                       maximum->value - minimum->value,
-                      8, 3);
+                      NULL);
          }
        }
     }
@@ -1861,18 +1866,19 @@ show_extremes (const struct variable **dependent_var,
 
              while (weight-- > 0 && e < cmd.st_n)
                {
-                 tab_float (tbl, n_cols - 1,
+                 tab_double (tbl, n_cols - 1,
                             heading_rows + row_var_start + row_result_start + cmd.st_n + e,
                             TAB_RIGHT,
                             minimum->value,
-                            8, 2);
+                            NULL);
 
 
-                 tab_float (tbl, n_cols - 2,
-                            heading_rows + row_var_start + row_result_start + cmd.st_n + e,
+                 tab_fixed (tbl, n_cols - 2,
+                            heading_rows + row_var_start +
+                            row_result_start + cmd.st_n + e,
                             TAB_RIGHT,
                             minimum->location,
-                            8, 0);
+                            10, 0);
                  ++e;
                }
 
@@ -1888,18 +1894,20 @@ show_extremes (const struct variable **dependent_var,
 
              while (weight-- > 0 && e < cmd.st_n)
                {
-                 tab_float (tbl, n_cols - 1,
-                            heading_rows + row_var_start + row_result_start + e,
+                 tab_double (tbl, n_cols - 1,
+                            heading_rows + row_var_start +
+                             row_result_start + e,
                             TAB_RIGHT,
                             maximum->value,
-                            8, 2);
+                            NULL);
 
 
-                 tab_float (tbl, n_cols - 2,
-                            heading_rows + row_var_start + row_result_start + e,
+                 tab_fixed (tbl, n_cols - 2,
+                            heading_rows + row_var_start +
+                            row_result_start + e,
                             TAB_RIGHT,
                             maximum->location,
-                            8, 0);
+                            10, 0);
                  ++e;
                }
 
@@ -2076,12 +2084,12 @@ show_percentiles (const struct variable **dependent_var,
          for (j = 0; j < n_percentiles; ++j)
            {
              double hinge = SYSMIS;
-             tab_float (tbl, n_cols - n_percentiles + j,
+             tab_double (tbl, n_cols - n_percentiles + j,
                         heading_rows + row_var_start + i * PERCENTILE_ROWS,
                         TAB_CENTER,
                         percentile_calculate (result->metrics[v].ptl[j],
                                               percentile_algorithm),
-                        8, 2
+                        NULL
                         );
 
              if ( result->metrics[v].ptl[j]->ptile == 0.5)
@@ -2092,11 +2100,11 @@ show_percentiles (const struct variable **dependent_var,
                hinge = hinges[2];
 
              if ( hinge != SYSMIS)
-               tab_float (tbl, n_cols - n_percentiles + j,
+               tab_double (tbl, n_cols - n_percentiles + j,
                           heading_rows + row_var_start + 1 + i * PERCENTILE_ROWS,
                           TAB_CENTER,
                           hinge,
-                          8, 2
+                          NULL
                           );
 
            }
index cd370be821c8db73f2d88da8350613a7ea8c07b0..25866a417acd109d1c715dec892bdef27294f2f5 100644 (file)
@@ -251,12 +251,12 @@ static void calc_stats (const struct variable *v, double d[frq_n_stats]);
 
 static void precalc (struct casereader *, struct dataset *);
 static void calc (const struct ccase *, const struct dataset *);
-static void postcalc (void);
+static void postcalc (const struct dataset *);
 
 static void postprocess_freq_tab (const struct variable *);
-static void dump_full (const struct variable *);
-static void dump_condensed (const struct variable *);
-static void dump_statistics (const struct variable *, int show_varname);
+static void dump_full ( const struct variable *, const struct variable *);
+static void dump_condensed (const struct variable *, const struct variable *);
+static void dump_statistics (const struct variable *, bool show_varname, const struct variable *);
 static void cleanup_freq_tab (const struct variable *);
 
 static hsh_compare_func compare_value_numeric_a, compare_value_alpha_a;
@@ -381,7 +381,7 @@ internal_cmd_frequencies (struct lexer *lexer, struct dataset *ds)
       precalc (group, ds);
       for (; (c = casereader_read (group)) != NULL; case_unref (c))
         calc (c, ds);
-      postcalc ();
+      postcalc (ds);
     }
   ok = casegrouper_destroy (grouper);
   ok = proc_commit (ds) && ok;
@@ -560,8 +560,10 @@ precalc (struct casereader *input, struct dataset *ds)
 /* Finishes up with the variables after frequencies have been
    calculated.  Displays statistics, percentiles, ... */
 static void
-postcalc (void)
+postcalc (const struct dataset *ds)
 {
+  const struct dictionary *dict = dataset_dict (ds);
+  const struct variable *wv = dict_get_weight (dict);
   size_t i;
 
   for (i = 0; i < n_variables; i++)
@@ -581,16 +583,16 @@ postcalc (void)
        switch (cmd.cond)
          {
          case FRQ_CONDENSE:
-           dump_condensed (v);
+           dump_condensed (v, wv);
            break;
          case FRQ_STANDARD:
-           dump_full (v);
+           dump_full (v, wv);
            break;
          case FRQ_ONEPAGE:
            if (n_categories > cmd.onepage_limit)
-             dump_condensed (v);
+             dump_condensed (v, wv);
            else
-             dump_full (v);
+             dump_full (v, wv);
            break;
          default:
             NOT_REACHED ();
@@ -600,7 +602,7 @@ postcalc (void)
 
       /* Statistics. */
       if (n_stats)
-       dump_statistics (v, !dumped_freq_tab);
+       dump_statistics (v, !dumped_freq_tab, wv);
 
 
 
@@ -1030,8 +1032,9 @@ full_dim (struct tab_table *t, struct outp_driver *d)
 
 /* Displays a full frequency table for variable V. */
 static void
-dump_full (const struct variable *v)
+dump_full (const struct variable *v, const struct variable *wv)
 {
+  const struct fmt_spec *wfmt = wv ? var_get_print_format (wv) : &F_8_0;
   int n_categories;
   struct var_freqs *vf;
   struct freq_tab *ft;
@@ -1100,10 +1103,10 @@ dump_full (const struct variable *v)
        }
 
       tab_value (t, 0 + lab, r, TAB_NONE, f->value, &vf->print);
-      tab_float (t, 1 + lab, r, TAB_NONE, f->count, 8, 0);
-      tab_float (t, 2 + lab, r, TAB_NONE, percent, 5, 1);
-      tab_float (t, 3 + lab, r, TAB_NONE, valid_percent, 5, 1);
-      tab_float (t, 4 + lab, r, TAB_NONE, cum_total, 5, 1);
+      tab_double (t, 1 + lab, r, TAB_NONE, f->count, wfmt);
+      tab_double (t, 2 + lab, r, TAB_NONE, percent, NULL);
+      tab_double (t, 3 + lab, r, TAB_NONE, valid_percent, NULL);
+      tab_double (t, 4 + lab, r, TAB_NONE, cum_total, NULL);
       r++;
     }
   for (; f < &ft->valid[n_categories]; f++)
@@ -1118,9 +1121,9 @@ dump_full (const struct variable *v)
        }
 
       tab_value (t, 0 + lab, r, TAB_NONE, f->value, &vf->print);
-      tab_float (t, 1 + lab, r, TAB_NONE, f->count, 8, 0);
-      tab_float (t, 2 + lab, r, TAB_NONE,
-                    f->count / ft->total_cases * 100.0, 5, 1);
+      tab_double (t, 1 + lab, r, TAB_NONE, f->count, wfmt);
+      tab_double (t, 2 + lab, r, TAB_NONE,
+                    f->count / ft->total_cases * 100.0, NULL);
       tab_text (t, 3 + lab, r, TAB_NONE, _("Missing"));
       r++;
     }
@@ -1132,9 +1135,9 @@ dump_full (const struct variable *v)
   tab_hline (t, TAL_2, 0, 4 + lab, r);
   tab_joint_text (t, 0, r, 0 + lab, r, TAB_RIGHT | TAT_TITLE, _("Total"));
   tab_vline (t, TAL_0, 1, r, r);
-  tab_float (t, 1 + lab, r, TAB_NONE, cum_freq, 8, 0);
-  tab_float (t, 2 + lab, r, TAB_NONE, 100.0, 5, 1);
-  tab_float (t, 3 + lab, r, TAB_NONE, 100.0, 5, 1);
+  tab_double (t, 1 + lab, r, TAB_NONE, cum_freq, wfmt);
+  tab_fixed (t, 2 + lab, r, TAB_NONE, 100.0, 5, 1);
+  tab_fixed (t, 3 + lab, r, TAB_NONE, 100.0, 5, 1);
 
   tab_title (t, "%s", var_to_string (v));
   tab_submit (t);
@@ -1161,8 +1164,9 @@ condensed_dim (struct tab_table *t, struct outp_driver *d)
 
 /* Display condensed frequency table for variable V. */
 static void
-dump_condensed (const struct variable *v)
+dump_condensed (const struct variable *v, const struct variable *wv)
 {
+  const struct fmt_spec *wfmt = wv ? var_get_print_format (wv) : &F_8_0;
   int n_categories;
   struct var_freqs *vf;
   struct freq_tab *ft;
@@ -1193,17 +1197,17 @@ dump_condensed (const struct variable *v)
       cum_total += f->count / ft->valid_cases * 100.0;
 
       tab_value (t, 0, r, TAB_NONE, f->value, &vf->print);
-      tab_float (t, 1, r, TAB_NONE, f->count, 8, 0);
-      tab_float (t, 2, r, TAB_NONE, percent, 3, 0);
-      tab_float (t, 3, r, TAB_NONE, cum_total, 3, 0);
+      tab_double (t, 1, r, TAB_NONE, f->count, wfmt);
+      tab_double (t, 2, r, TAB_NONE, percent, NULL);
+      tab_double (t, 3, r, TAB_NONE, cum_total, NULL);
       r++;
     }
   for (; f < &ft->valid[n_categories]; f++)
     {
       tab_value (t, 0, r, TAB_NONE, f->value, &vf->print);
-      tab_float (t, 1, r, TAB_NONE, f->count, 8, 0);
-      tab_float (t, 2, r, TAB_NONE,
-                f->count / ft->total_cases * 100.0, 3, 0);
+      tab_double (t, 1, r, TAB_NONE, f->count, wfmt);
+      tab_double (t, 2, r, TAB_NONE,
+                f->count / ft->total_cases * 100.0, NULL);
       r++;
     }
 
@@ -1360,8 +1364,10 @@ calc_stats (const struct variable *v, double d[frq_n_stats])
 
 /* Displays a table of all the statistics requested for variable V. */
 static void
-dump_statistics (const struct variable *v, int show_varname)
+dump_statistics (const struct variable *v, bool show_varname,
+                const struct variable *wv)
 {
+  const struct fmt_spec *wfmt = wv ? var_get_print_format (wv) : &F_8_0;
   struct freq_tab *ft;
   double stat_value[frq_n_stats];
   struct tab_table *t;
@@ -1394,7 +1400,7 @@ dump_statistics (const struct variable *v, int show_varname)
       {
        tab_text (t, 0, r, TAB_LEFT | TAT_TITLE,
                      gettext (st_name[i].s10));
-       tab_float (t, 2, r, TAB_NONE, stat_value[i], 11, 3);
+       tab_double (t, 2, r, TAB_NONE, stat_value[i], NULL);
        r++;
       }
 
@@ -1402,9 +1408,8 @@ dump_statistics (const struct variable *v, int show_varname)
   tab_text (t, 1, 0, TAB_LEFT | TAT_TITLE, _("Valid"));
   tab_text (t, 1, 1, TAB_LEFT | TAT_TITLE, _("Missing"));
 
-  tab_float(t, 2, 0, TAB_NONE, ft->valid_cases, 11, 0);
-  tab_float(t, 2, 1, TAB_NONE, ft->total_cases - ft->valid_cases, 11, 0);
-
+  tab_double (t, 2, 0, TAB_NONE, ft->valid_cases, wfmt);
+  tab_double (t, 2, 1, TAB_NONE, ft->total_cases - ft->valid_cases, wfmt);
 
   for (i = 0; i < n_percentiles; i++, r++)
     {
@@ -1416,9 +1421,9 @@ dump_statistics (const struct variable *v, int show_varname)
       if (percentiles[i].p == 0.5)
         tab_text (t, 1, r, TAB_LEFT, _("50 (Median)"));
       else
-        tab_float (t, 1, r, TAB_LEFT, percentiles[i].p * 100, 3, 0);
-      tab_float (t, 2, r, TAB_NONE, percentiles[i].value, 11, 3);
-
+        tab_fixed (t, 1, r, TAB_LEFT, percentiles[i].p * 100, 3, 0);
+      tab_double (t, 2, r, TAB_NONE, percentiles[i].value,
+                 var_get_print_format (v));
     }
 
   tab_columns (t, SOM_COL_DOWN, 1);
index 04c83e1a0ed694456d3518e5c9ccad30101a2abb..3ad3a5bb1554194cca7160be6b9b87fd4200e7dd 100644 (file)
@@ -15,6 +15,8 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
 #include <config.h>
+
+#include <data/format.h>
 #include <output/table.h>
 #include <data/casereader.h>
 #include <libpspp/hash.h>
@@ -84,6 +86,11 @@ npar_summary_calc_descriptives (struct descriptives *desc,
 }
 
 
+void
+do_summary_box (const struct descriptives *desc,
+               const struct variable *const *vv,
+               int n_vars);
+
 
 void
 do_summary_box (const struct descriptives *desc,
@@ -97,7 +104,6 @@ do_summary_box (const struct descriptives *desc,
   int columns = 1 ;
   struct tab_table *table ;
 
-
   if ( desc ) columns += 5;
   if ( quartiles ) columns += 3;
 
@@ -152,15 +158,19 @@ do_summary_box (const struct descriptives *desc,
       col++;
     }
 
+
   for ( v = 0 ; v < n_vars ; ++v )
     {
-      tab_text (table, 0, 2 + v, TAT_NONE, var_to_string (vv[v]));
+      const struct variable *var = vv[v];
+      const struct fmt_spec *fmt = var_get_print_format (var);
+
+      tab_text (table, 0, 2 + v, TAT_NONE, var_to_string (var));
 
-      tab_float (table, 1, 2 + v, TAT_NONE, desc[v].n, 8, 0);
-      tab_float (table, 2, 2 + v, TAT_NONE, desc[v].mean, 8, 3);
-      tab_float (table, 3, 2 + v, TAT_NONE, desc[v].std_dev, 8, 3);
-      tab_float (table, 4, 2 + v, TAT_NONE, desc[v].min, 8, 3);
-      tab_float (table, 5, 2 + v, TAT_NONE, desc[v].max, 8, 3);
+      tab_double (table, 1, 2 + v, TAT_NONE, desc[v].n, fmt);
+      tab_double (table, 2, 2 + v, TAT_NONE, desc[v].mean, fmt);
+      tab_double (table, 3, 2 + v, TAT_NONE, desc[v].std_dev, fmt);
+      tab_double (table, 4, 2 + v, TAT_NONE, desc[v].min, fmt);
+      tab_double (table, 5, 2 + v, TAT_NONE, desc[v].max, fmt);
     }
 
 
index 6cf6367cbee02d7ac267a2396f0794ef8bd9e84e..0e52b8023355cf81c6f76ec73451d1b10c489231 100644 (file)
@@ -37,11 +37,4 @@ void npar_summary_calc_descriptives (struct descriptives *desc,
                                     int n_vars,
                                      enum mv_class filter);
 
-
-void do_summary_box (const struct descriptives *desc,
-                    const struct variable *const *vv,
-                    int n_vars);
-
-
-
 #endif
index 34e03677dc9bc145568a910c05a1ea83a063d4e5..4caa112aefe8895555add598c773518078f5415d 100644 (file)
@@ -356,27 +356,24 @@ npar_custom_binomial (struct lexer *lexer, struct dataset *ds,
            {
              lex_force_num (lexer);
              btp->category1 = lex_number (lexer);
-             lex_get (lexer);
-             if ( ! lex_force_match (lexer, ',')) return 2;
-             if ( ! lex_force_num (lexer) ) return 2;
-             btp->category2 = lex_number (lexer);
-             lex_get (lexer);
+             lex_get (lexer);
+             if ( lex_match (lexer, ','))
+               {
+                 if ( ! lex_force_num (lexer) ) return 2;
+                 btp->category2 = lex_number (lexer);
+                 lex_get (lexer);
+               }
+             else
+               {
+                 btp->cutpoint = btp->category1;
+               }
+
              lex_force_match (lexer, ')');
            }
        }
       else
        return 2;
     }
-  else
-    {
-      if ( lex_match (lexer, '(') )
-       {
-         lex_force_num (lexer);
-         btp->cutpoint = lex_number (lexer);
-         lex_get (lexer);
-         lex_force_match (lexer, ')');
-       }
-    }
 
   specs->n_tests++;
   specs->test = pool_realloc (specs->pool,
index be57eb24d5fbf6ac9830f5582655bd1028f89f30..40107f77c877205af42c9555ac1c329f29b39d47 100644 (file)
@@ -43,6 +43,7 @@
 #include <output/manager.h>
 #include <output/table.h>
 #include "sort-criteria.h"
+#include <data/format.h>
 
 #include "xalloc.h"
 
@@ -88,9 +89,9 @@ static void run_oneway (struct cmd_oneway *, struct casereader *,
 
 
 /* Routines to show the output tables */
-static void show_anova_table (void);
-static void show_descriptives (void);
-static void show_homogeneity (void);
+static void show_anova_table(void);
+static void show_descriptives (const struct dictionary *dict);
+static void show_homogeneity(void);
 
 static void show_contrast_coeffs (short *);
 static void show_contrast_tests (short *);
@@ -100,7 +101,7 @@ enum stat_table_t {STAT_DESC = 1, STAT_HOMO = 2};
 
 static enum stat_table_t stat_tables;
 
-void output_oneway (void);
+static void output_oneway (const struct dictionary *dict);
 
 
 int
@@ -148,8 +149,8 @@ cmd_oneway (struct lexer *lexer, struct dataset *ds)
 }
 
 
-void
-output_oneway (void)
+static void
+output_oneway (const struct dictionary *dict)
 {
   size_t i;
   short *bad_contrast;
@@ -180,7 +181,7 @@ output_oneway (void)
     }
 
   if ( stat_tables & STAT_DESC )
-    show_descriptives ();
+    show_descriptives (dict);
 
   if ( stat_tables & STAT_HOMO )
     show_homogeneity ();
@@ -317,28 +318,28 @@ show_anova_table (void)
 
 
        /* Sums of Squares */
-       tab_float (t, 2, i * 3 + 1, 0, ssa, 10, 2);
-       tab_float (t, 2, i * 3 + 3, 0, sst, 10, 2);
-       tab_float (t, 2, i * 3 + 2, 0, sst - ssa, 10, 2);
+       tab_double (t, 2, i * 3 + 1, 0, ssa, NULL);
+       tab_double (t, 2, i * 3 + 3, 0, sst, NULL);
+       tab_double (t, 2, i * 3 + 2, 0, sst - ssa, NULL);
 
 
        /* Degrees of freedom */
-       tab_float (t, 3, i * 3 + 1, 0, df1, 4, 0);
-       tab_float (t, 3, i * 3 + 2, 0, df2, 4, 0);
-       tab_float (t, 3, i * 3 + 3, 0, totals->n - 1, 4, 0);
+       tab_fixed (t, 3, i * 3 + 1, 0, df1, 4, 0);
+       tab_fixed (t, 3, i * 3 + 2, 0, df2, 4, 0);
+       tab_fixed (t, 3, i * 3 + 3, 0, totals->n - 1, 4, 0);
 
        /* Mean Squares */
-       tab_float (t, 4, i * 3 + 1, TAB_RIGHT, msa, 8, 3);
-       tab_float (t, 4, i * 3 + 2, TAB_RIGHT, gp->mse, 8, 3);
+       tab_double (t, 4, i * 3 + 1, TAB_RIGHT, msa, NULL);
+       tab_double (t, 4, i * 3 + 2, TAB_RIGHT, gp->mse, NULL);
 
        {
-         const double F = msa/gp->mse;
+         const double F = msa / gp->mse ;
 
          /* The F value */
-         tab_float (t, 5, i * 3 + 1, 0,  F, 8, 3);
+         tab_double (t, 5, i * 3 + 1, 0,  F, NULL);
 
          /* The significance */
-         tab_float (t, 6, i * 3 + 1, 0, gsl_cdf_fdist_Q (F, df1, df2), 8, 3);
+         tab_double (t, 6, i * 3 + 1, 0, gsl_cdf_fdist_Q (F, df1, df2), NULL);
        }
       }
     }
@@ -351,16 +352,18 @@ show_anova_table (void)
 
 /* Show the descriptives table */
 static void
-show_descriptives (void)
+show_descriptives (const struct dictionary *dict)
 {
   size_t v;
-  int n_cols =10;
+  int n_cols = 10;
   struct tab_table *t;
   int row;
 
   const double confidence = 0.95;
   const double q = (1.0 - confidence) / 2.0;
 
+  const struct variable *wv = dict_get_weight (dict);
+  const struct fmt_spec *wfmt = wv ? var_get_print_format (wv) : & F_8_0;
 
   int n_rows = 2;
 
@@ -416,6 +419,7 @@ show_descriptives (void)
       struct group_statistics *totals = &gp->ugs;
 
       const char *s = var_to_string (vars[v]);
+      const struct fmt_spec *fmt = var_get_print_format (vars[v]);
 
       struct group_statistics *const *gs_array =
        (struct group_statistics *const *) hsh_sort (gp->group_hash);
@@ -441,57 +445,59 @@ show_descriptives (void)
 
          /* Now fill in the numbers ... */
 
-         tab_float (t, 2, row + count, 0, gs->n, 8, 0);
+         tab_fixed (t, 2, row + count, 0, gs->n, 8, 0);
 
-         tab_float (t, 3, row + count, 0, gs->mean, 8, 2);
+         tab_double (t, 3, row + count, 0, gs->mean, NULL);
 
-         tab_float (t, 4, row + count, 0, gs->std_dev, 8, 2);
+         tab_double (t, 4, row + count, 0, gs->std_dev, NULL);
 
-         std_error = gs->std_dev/sqrt (gs->n);
-         tab_float (t, 5, row + count, 0,
-                    std_error, 8, 2);
+         std_error = gs->std_dev / sqrt (gs->n) ;
+         tab_double (t, 5, row + count, 0,
+                    std_error, NULL);
 
          /* Now the confidence interval */
 
          T = gsl_cdf_tdist_Qinv (q, gs->n - 1);
 
-         tab_float (t, 6, row + count, 0,
-                    gs->mean - T * std_error, 8, 2);
+         tab_double (t, 6, row + count, 0,
+                   gs->mean - T * std_error, NULL);
 
-         tab_float (t, 7, row + count, 0,
-                    gs->mean + T * std_error, 8, 2);
+         tab_double (t, 7, row + count, 0,
+                   gs->mean + T * std_error, NULL);
 
          /* Min and Max */
-         tab_float (t, 8, row + count, 0,  gs->minimum, 8, 2);
-         tab_float (t, 9, row + count, 0,  gs->maximum, 8, 2);
+
+         tab_double (t, 8, row + count, 0,  gs->minimum, fmt);
+         tab_double (t, 9, row + count, 0,  gs->maximum, fmt);
        }
 
       tab_text (t, 1, row + count,
                TAB_LEFT | TAT_TITLE, _("Total"));
 
-      tab_float (t, 2, row + count, 0, totals->n, 8, 0);
+      tab_double (t, 2, row + count, 0, totals->n, wfmt);
 
-      tab_float (t, 3, row + count, 0, totals->mean, 8, 2);
+      tab_double (t, 3, row + count, 0, totals->mean, NULL);
 
-      tab_float (t, 4, row + count, 0, totals->std_dev, 8, 2);
+      tab_double (t, 4, row + count, 0, totals->std_dev, NULL);
 
-      std_error = totals->std_dev/sqrt (totals->n);
+      std_error = totals->std_dev / sqrt (totals->n) ;
 
-      tab_float (t, 5, row + count, 0, std_error, 8, 2);
+      tab_double (t, 5, row + count, 0, std_error, NULL);
 
       /* Now the confidence interval */
 
       T = gsl_cdf_tdist_Qinv (q, totals->n - 1);
 
-      tab_float (t, 6, row + count, 0,
-                totals->mean - T * std_error, 8, 2);
+      tab_double (t, 6, row + count, 0,
+                 totals->mean - T * std_error, NULL);
 
-      tab_float (t, 7, row + count, 0,
-                totals->mean + T * std_error, 8, 2);
+      tab_double (t, 7, row + count, 0,
+                 totals->mean + T * std_error, NULL);
 
       /* Min and Max */
-      tab_float (t, 8, row + count, 0,  totals->minimum, 8, 2);
-      tab_float (t, 9, row + count, 0,  totals->maximum, 8, 2);
+
+      tab_double (t, 8, row + count, 0,  totals->minimum, fmt);
+      tab_double (t, 9, row + count, 0,  totals->maximum, fmt);
 
       row += gp->n_groups + 1;
     }
@@ -547,12 +553,12 @@ show_homogeneity (void)
       tab_text (t, 0, v + 1, TAB_LEFT | TAT_TITLE, s);
 
       F = gp->levene;
-      tab_float (t, 1, v + 1, TAB_RIGHT, F, 8, 3);
-      tab_float (t, 2, v + 1, TAB_RIGHT, df1, 8, 0);
-      tab_float (t, 3, v + 1, TAB_RIGHT, df2, 8, 0);
+      tab_double (t, 1, v + 1, TAB_RIGHT, F, NULL);
+      tab_fixed (t, 2, v + 1, TAB_RIGHT, df1, 8, 0);
+      tab_fixed (t, 3, v + 1, TAB_RIGHT, df2, 8, 0);
 
       /* Now the significance */
-      tab_float (t, 4, v + 1, TAB_RIGHT, gsl_cdf_fdist_Q (F, df1, df2), 8, 3);
+      tab_double (t, 4, v + 1, TAB_RIGHT,gsl_cdf_fdist_Q (F, df1, df2), NULL);
     }
 
   tab_submit (t);
@@ -763,74 +769,69 @@ show_contrast_tests (short *bad_contrast)
            }
          sec_vneq = sqrt (sec_vneq);
 
-         df_numerator = pow2(df_numerator);
+         df_numerator = pow2 (df_numerator);
 
-         tab_float (t,  3, (v * lines_per_variable) + i + 1,
-                    TAB_RIGHT, contrast_value, 8, 2);
+         tab_double (t,  3, (v * lines_per_variable) + i + 1,
+                    TAB_RIGHT, contrast_value, NULL);
 
-         tab_float (t,  3, (v * lines_per_variable) + i + 1 +
+         tab_double (t,  3, (v * lines_per_variable) + i + 1 +
                     cmd.sbc_contrast,
-                    TAB_RIGHT, contrast_value, 8, 2);
+                    TAB_RIGHT, contrast_value, NULL);
 
          std_error_contrast = sqrt (grp_data->mse * coef_msq);
 
          /* Std. Error */
-         tab_float (t,  4, (v * lines_per_variable) + i + 1,
+         tab_double (t,  4, (v * lines_per_variable) + i + 1,
                     TAB_RIGHT, std_error_contrast,
-                    8, 3);
+                    NULL);
 
          T = fabs (contrast_value / std_error_contrast);
 
          /* T Statistic */
 
-         tab_float (t,  5, (v * lines_per_variable) + i + 1,
+         tab_double (t,  5, (v * lines_per_variable) + i + 1,
                     TAB_RIGHT, T,
-                    8, 3);
+                    NULL);
 
          df = grp_data->ugs.n - grp_data->n_groups;
 
          /* Degrees of Freedom */
-         tab_float (t,  6, (v * lines_per_variable) + i + 1,
+         tab_fixed (t,  6, (v * lines_per_variable) + i + 1,
                     TAB_RIGHT,  df,
                     8, 0);
 
 
          /* Significance TWO TAILED !!*/
-         tab_float (t,  7, (v * lines_per_variable) + i + 1,
+         tab_double (t,  7, (v * lines_per_variable) + i + 1,
                     TAB_RIGHT,  2 * gsl_cdf_tdist_Q (T, df),
-                    8, 3);
-
+                    NULL);
 
          /* Now for the Variances NOT Equal case */
 
          /* Std. Error */
-         tab_float (t,  4,
+         tab_double (t,  4,
                     (v * lines_per_variable) + i + 1 + cmd.sbc_contrast,
                     TAB_RIGHT, sec_vneq,
-                    8, 3);
-
+                    NULL);
 
          T = contrast_value / sec_vneq;
-         tab_float (t,  5,
+         tab_double (t,  5,
                     (v * lines_per_variable) + i + 1 + cmd.sbc_contrast,
                     TAB_RIGHT, T,
-                    8, 3);
-
+                    NULL);
 
          df = df_numerator / df_denominator;
 
-         tab_float (t,  6,
+         tab_double (t,  6,
                     (v * lines_per_variable) + i + 1 + cmd.sbc_contrast,
                     TAB_RIGHT, df,
-                    8, 3);
+                    NULL);
 
          /* The Significance */
 
-         tab_float (t, 7, (v * lines_per_variable) + i + 1 + cmd.sbc_contrast,
-                    TAB_RIGHT,  2 * gsl_cdf_tdist_Q (T, df),
-                    8, 3);
-
-
+         tab_double (t, 7, (v * lines_per_variable) + i + 1 + cmd.sbc_contrast,
+                    TAB_RIGHT,  2 * gsl_cdf_tdist_Q (T,df),
+                    NULL);
        }
 
       if ( v > 0 )
@@ -838,7 +839,6 @@ show_contrast_tests (short *bad_contrast)
     }
 
   tab_submit (t);
-
 }
 
 
@@ -1004,7 +1004,8 @@ run_oneway (struct cmd_oneway *cmd,
   ostensible_number_of_groups = hsh_count (global_group_hash);
 
   if (!taint_has_tainted_successor (taint))
-    output_oneway ();
+    output_oneway (dict);
+
   taint_destroy (taint);
 }
 
index 68db454d40edfbc38316884903f893227fd9bc0b..13cc4f69f7224450b2c384e05f78618c5f3dd573 100644 (file)
@@ -160,10 +160,10 @@ reg_stats_r (pspp_linreg_cache * c)
   tab_text (t, 2, 0, TAB_CENTER | TAT_TITLE, _("R Square"));
   tab_text (t, 3, 0, TAB_CENTER | TAT_TITLE, _("Adjusted R Square"));
   tab_text (t, 4, 0, TAB_CENTER | TAT_TITLE, _("Std. Error of the Estimate"));
-  tab_float (t, 1, 1, TAB_RIGHT, sqrt (rsq), 10, 2);
-  tab_float (t, 2, 1, TAB_RIGHT, rsq, 10, 2);
-  tab_float (t, 3, 1, TAB_RIGHT, adjrsq, 10, 2);
-  tab_float (t, 4, 1, TAB_RIGHT, std_error, 10, 2);
+  tab_double (t, 1, 1, TAB_RIGHT, sqrt (rsq), NULL);
+  tab_double (t, 2, 1, TAB_RIGHT, rsq, NULL);
+  tab_double (t, 3, 1, TAB_RIGHT, adjrsq, NULL);
+  tab_double (t, 4, 1, TAB_RIGHT, std_error, NULL);
   tab_title (t, _("Model Summary"));
   tab_submit (t);
 }
@@ -205,14 +205,14 @@ reg_stats_coeff (pspp_linreg_cache * c)
   tab_text (t, 5, 0, TAB_CENTER | TAT_TITLE, _("t"));
   tab_text (t, 6, 0, TAB_CENTER | TAT_TITLE, _("Significance"));
   tab_text (t, 1, 1, TAB_LEFT | TAT_TITLE, _("(Constant)"));
-  tab_float (t, 2, 1, 0, c->intercept, 10, 2);
+  tab_double (t, 2, 1, 0, c->intercept, NULL);
   std_err = sqrt (gsl_matrix_get (c->cov, 0, 0));
-  tab_float (t, 3, 1, 0, std_err, 10, 2);
-  tab_float (t, 4, 1, 0, 0.0, 10, 2);
+  tab_double (t, 3, 1, 0, std_err, NULL);
+  tab_double (t, 4, 1, 0, 0.0, NULL);
   t_stat = c->intercept / std_err;
-  tab_float (t, 5, 1, 0, t_stat, 10, 2);
+  tab_double (t, 5, 1, 0, t_stat, NULL);
   pval = 2 * gsl_cdf_tdist_Q (fabs (t_stat), 1.0);
-  tab_float (t, 6, 1, 0, pval, 10, 2);
+  tab_double (t, 6, 1, 0, pval, NULL);
   for (j = 0; j < c->n_coeffs; j++)
     {
       struct string tstr;
@@ -240,32 +240,32 @@ reg_stats_coeff (pspp_linreg_cache * c)
       /*
          Regression coefficients.
        */
-      tab_float (t, 2, this_row, 0, c->coeff[j]->estimate, 10, 2);
+      tab_double (t, 2, this_row, 0, c->coeff[j]->estimate, NULL);
       /*
          Standard error of the coefficients.
        */
       std_err = sqrt (gsl_matrix_get (c->cov, j + 1, j + 1));
-      tab_float (t, 3, this_row, 0, std_err, 10, 2);
+      tab_double (t, 3, this_row, 0, std_err, NULL);
       /*
          Standardized coefficient, i.e., regression coefficient
          if all variables had unit variance.
        */
       beta = pspp_coeff_get_sd (c->coeff[j]);
       beta *= c->coeff[j]->estimate / c->depvar_std;
-      tab_float (t, 4, this_row, 0, beta, 10, 2);
+      tab_double (t, 4, this_row, 0, beta, NULL);
 
       /*
          Test statistic for H0: coefficient is 0.
        */
       t_stat = c->coeff[j]->estimate / std_err;
-      tab_float (t, 5, this_row, 0, t_stat, 10, 2);
+      tab_double (t, 5, this_row, 0, t_stat, NULL);
       /*
          P values for the test statistic above.
        */
       pval =
        2 * gsl_cdf_tdist_Q (fabs (t_stat),
                             (double) (c->n_obs - c->n_coeffs));
-      tab_float (t, 6, this_row, 0, pval, 10, 2);
+      tab_double (t, 6, this_row, 0, pval, NULL);
       ds_destroy (&tstr);
     }
   tab_title (t, _("Coefficients"));
@@ -309,9 +309,9 @@ reg_stats_anova (pspp_linreg_cache * c)
   tab_text (t, 1, 3, TAB_LEFT | TAT_TITLE, _("Total"));
 
   /* Sums of Squares */
-  tab_float (t, 2, 1, 0, c->ssm, 10, 2);
-  tab_float (t, 2, 3, 0, c->sst, 10, 2);
-  tab_float (t, 2, 2, 0, c->sse, 10, 2);
+  tab_double (t, 2, 1, 0, c->ssm, NULL);
+  tab_double (t, 2, 3, 0, c->sst, NULL);
+  tab_double (t, 2, 2, 0, c->sse, NULL);
 
 
   /* Degrees of freedom */
@@ -320,12 +320,12 @@ reg_stats_anova (pspp_linreg_cache * c)
   tab_text (t, 3, 3, TAB_RIGHT | TAT_PRINTF, "%g", c->dft);
 
   /* Mean Squares */
-  tab_float (t, 4, 1, TAB_RIGHT, msm, 8, 3);
-  tab_float (t, 4, 2, TAB_RIGHT, mse, 8, 3);
+  tab_double (t, 4, 1, TAB_RIGHT, msm, NULL);
+  tab_double (t, 4, 2, TAB_RIGHT, mse, NULL);
 
-  tab_float (t, 5, 1, 0, F, 8, 3);
+  tab_double (t, 5, 1, 0, F, NULL);
 
-  tab_float (t, 6, 1, 0, pval, 8, 3);
+  tab_double (t, 6, 1, 0, pval, NULL);
 
   tab_title (t, _("ANOVA"));
   tab_submit (t);
@@ -398,8 +398,8 @@ reg_stats_bcov (pspp_linreg_cache * c)
        {
          col = (i <= k) ? k : i;
          row = (i <= k) ? i : k;
-         tab_float (t, k + 2, i, TAB_CENTER,
-                    gsl_matrix_get (c->cov, row, col), 8, 3);
+         tab_double (t, k + 2, i, TAB_CENTER,
+                    gsl_matrix_get (c->cov, row, col), NULL);
        }
     }
   tab_title (t, _("Coefficient Correlations"));
index 25aff211dd739b8d63f8af886a565cadafdde11d..0e7f91a02629776213b18938045cd0a0dfb7afdd 100644 (file)
@@ -100,6 +100,7 @@ enum model
 
 struct reliability
 {
+  const struct dictionary *dict;
   const struct variable **variables;
   int n_variables;
   enum mv_class exclude;
@@ -142,7 +143,7 @@ cmd_reliability (struct lexer *lexer, struct dataset *ds)
   struct casereader *group;
   struct cmd_reliability cmd;
 
-  struct reliability rel = {
+  struct reliability rel = {NULL,
     NULL, 0, MV_ANY, NULL, 0, -1,
     DS_EMPTY_INITIALIZER,
     MODEL_ALPHA, 0};
@@ -154,6 +155,7 @@ cmd_reliability (struct lexer *lexer, struct dataset *ds)
       goto done;
     }
 
+  rel.dict = dataset_dict (ds);
   rel.variables = cmd.v_variables;
   rel.n_variables = cmd.n_variables;
   rel.exclude = MV_ANY;
@@ -296,10 +298,11 @@ append_sum (const struct ccase *c, casenumber n UNUSED, void *aux)
 };
 
 
-static void case_processing_summary (casenumber n_valid, casenumber n_missing);
+static void case_processing_summary (casenumber n_valid, casenumber n_missing, 
+                                    const struct dictionary *dict);
 
 static void
-run_reliability (struct casereader *input, struct dataset *ds UNUSED,
+run_reliability (struct casereader *input, struct dataset *ds,
                 struct reliability *rel)
 {
   int i;
@@ -388,7 +391,7 @@ run_reliability (struct casereader *input, struct dataset *ds UNUSED,
   }
 
 
-  case_processing_summary (n_valid, n_missing);
+  case_processing_summary (n_valid, n_missing, dataset_dict (ds));
 }
 
 
@@ -404,7 +407,7 @@ struct reliability_output_table
   int n_rows;
   int heading_cols;
   int heading_rows;
-  void (*populate)(struct tab_table *, const struct reliability *);
+  void (*populate) (struct tab_table *, const struct reliability *);
 };
 
 static struct reliability_output_table rol[2] =
@@ -514,14 +517,14 @@ reliability_summary_total (const struct reliability *rel)
 
       moments1_calculate (s->total, &weight, &mean, &var, 0, 0);
 
-      tab_float (tbl, 1, heading_rows + i, TAB_RIGHT,
-                mean, 8, 3);
+      tab_double (tbl, 1, heading_rows + i, TAB_RIGHT,
+                mean, NULL);
 
-      tab_float (tbl, 2, heading_rows + i, TAB_RIGHT,
-                s->variance_of_sums, 8, 3);
+      tab_double (tbl, 2, heading_rows + i, TAB_RIGHT,
+                s->variance_of_sums, NULL);
 
-      tab_float (tbl, 4, heading_rows + i, TAB_RIGHT,
-                s->alpha, 8, 3);
+      tab_double (tbl, 4, heading_rows + i, TAB_RIGHT,
+                s->alpha, NULL);
 
 
       moments1_calculate (rel->sc[0].m[i], &weight, &mean, &var, 0,0);
@@ -531,8 +534,8 @@ reliability_summary_total (const struct reliability *rel)
       item_to_total_r = (cov - var) / (sqrt(var) * sqrt (s->variance_of_sums));
 
 
-      tab_float (tbl, 3, heading_rows + i, TAB_RIGHT,
-                item_to_total_r, 8, 3);
+      tab_double (tbl, 3, heading_rows + i, TAB_RIGHT,
+                item_to_total_r, NULL);
     }
 
 
@@ -544,6 +547,9 @@ static void
 reliability_statistics_model_alpha (struct tab_table *tbl,
                                    const struct reliability *rel)
 {
+  const struct variable *wv = dict_get_weight (rel->dict);
+  const struct fmt_spec *wfmt = wv ? var_get_print_format (wv) : & F_8_0;
+
   const struct cronbach *s = &rel->sc[0];
 
   tab_text (tbl, 0, 0, TAB_CENTER | TAT_TITLE,
@@ -552,9 +558,9 @@ reliability_statistics_model_alpha (struct tab_table *tbl,
   tab_text (tbl, 1, 0, TAB_CENTER | TAT_TITLE,
                _("N of items"));
 
-  tab_float (tbl, 0, 1, TAB_RIGHT, s->alpha, 8, 3);
+  tab_double (tbl, 0, 1, TAB_RIGHT, s->alpha, NULL);
 
-  tab_float (tbl, 1, 1, TAB_RIGHT, s->n_items, 8, 0);
+  tab_double (tbl, 1, 1, TAB_RIGHT, s->n_items, wfmt);
 }
 
 
@@ -562,6 +568,9 @@ static void
 reliability_statistics_model_split (struct tab_table *tbl,
                                    const struct reliability *rel)
 {
+  const struct variable *wv = dict_get_weight (rel->dict);
+  const struct fmt_spec *wfmt = wv ? var_get_print_format (wv) : & F_8_0;
+
   tab_text (tbl, 0, 0, TAB_LEFT,
            _("Cronbach's Alpha"));
 
@@ -609,14 +618,14 @@ reliability_statistics_model_split (struct tab_table *tbl,
 
 
 
-  tab_float (tbl, 3, 0, TAB_RIGHT, rel->sc[1].alpha, 8, 3);
-  tab_float (tbl, 3, 2, TAB_RIGHT, rel->sc[2].alpha, 8, 3);
+  tab_double (tbl, 3, 0, TAB_RIGHT, rel->sc[1].alpha, NULL);
+  tab_double (tbl, 3, 2, TAB_RIGHT, rel->sc[2].alpha, NULL);
 
-  tab_float (tbl, 3, 1, TAB_RIGHT, rel->sc[1].n_items, 8, 0);
-  tab_float (tbl, 3, 3, TAB_RIGHT, rel->sc[2].n_items, 8, 0);
+  tab_double (tbl, 3, 1, TAB_RIGHT, rel->sc[1].n_items, wfmt);
+  tab_double (tbl, 3, 3, TAB_RIGHT, rel->sc[2].n_items, wfmt);
 
-  tab_float (tbl, 3, 4, TAB_RIGHT,
-            rel->sc[1].n_items + rel->sc[2].n_items, 8, 0);
+  tab_double (tbl, 3, 4, TAB_RIGHT,
+            rel->sc[1].n_items + rel->sc[2].n_items, wfmt);
 
   {
     /* R is the correlation between the two parts */
@@ -635,12 +644,12 @@ reliability_statistics_model_split (struct tab_table *tbl,
     r /= sqrt (rel->sc[2].variance_of_sums);
     r /= 2.0;
 
-    tab_float (tbl, 3, 5, TAB_RIGHT, r, 8, 3);
+    tab_double (tbl, 3, 5, TAB_RIGHT, r, NULL);
 
     /* Equal length Spearman-Brown Coefficient */
-    tab_float (tbl, 3, 6, TAB_RIGHT, 2 * r / (1.0 + r), 8, 3);
+    tab_double (tbl, 3, 6, TAB_RIGHT, 2 * r / (1.0 + r), NULL);
 
-    tab_float (tbl, 3, 8, TAB_RIGHT, g, 8, 3);
+    tab_double (tbl, 3, 8, TAB_RIGHT, g, NULL);
 
     tmp = (1.0 - r*r) * rel->sc[1].n_items * rel->sc[2].n_items /
       pow2 (rel->sc[0].n_items);
@@ -649,16 +658,19 @@ reliability_statistics_model_split (struct tab_table *tbl,
     uly -= pow2 (r);
     uly /= 2 * tmp;
 
-    tab_float (tbl, 3, 7, TAB_RIGHT, uly, 8, 3);
-
+    tab_double (tbl, 3, 7, TAB_RIGHT, uly, NULL);
   }
 }
 
 
 
 static void
-case_processing_summary (casenumber n_valid, casenumber n_missing)
+case_processing_summary (casenumber n_valid, casenumber n_missing,
+                        const struct dictionary *dict)
 {
+  const struct variable *wv = dict_get_weight (dict);
+  const struct fmt_spec *wfmt = wv ? var_get_print_format (wv) : & F_8_0;
+
   casenumber total;
   int n_cols = 4;
   int n_rows = 4;
@@ -712,28 +724,28 @@ case_processing_summary (casenumber n_valid, casenumber n_missing)
 
   total = n_missing + n_valid;
 
-  tab_float (tbl, 2, heading_rows, TAB_RIGHT,
-            n_valid, 8, 0);
+  tab_double (tbl, 2, heading_rows, TAB_RIGHT,
+            n_valid, wfmt);
 
 
-  tab_float (tbl, 2, heading_rows + 1, TAB_RIGHT,
-            n_missing, 8, 0);
+  tab_double (tbl, 2, heading_rows + 1, TAB_RIGHT,
+            n_missing, wfmt);
 
 
-  tab_float (tbl, 2, heading_rows + 2, TAB_RIGHT,
-            total, 8, 0);
+  tab_double (tbl, 2, heading_rows + 2, TAB_RIGHT,
+            total, wfmt);
 
 
-  tab_float (tbl, 3, heading_rows, TAB_RIGHT,
-            100 * n_valid / (double) total, 8, 1);
+  tab_double (tbl, 3, heading_rows, TAB_RIGHT,
+            100 * n_valid / (double) total, NULL);
 
 
-  tab_float (tbl, 3, heading_rows + 1, TAB_RIGHT,
-            100 * n_missing / (double) total, 8, 1);
+  tab_double (tbl, 3, heading_rows + 1, TAB_RIGHT,
+            100 * n_missing / (double) total, NULL);
 
 
-  tab_float (tbl, 3, heading_rows + 2, TAB_RIGHT,
-            100 * total / (double) total, 8, 1);
+  tab_double (tbl, 3, heading_rows + 2, TAB_RIGHT,
+            100 * total / (double) total, NULL);
 
 
   tab_submit (tbl);
index bc6023c72ebfaf7e08785ecc09dfa9a6b96c7669..5f5fc56f021d1ba60d125a8b23561b6dae79031b 100644 (file)
@@ -43,6 +43,7 @@
 #include <math/levene.h>
 #include <output/manager.h>
 #include <output/table.h>
+#include <data/format.h>
 
 #include "xalloc.h"
 
@@ -152,7 +153,8 @@ static int parse_value (struct lexer *lexer, union value * v, enum val_type);
 /* Structures and Functions for the Statistics Summary Box */
 struct ssbox;
 typedef void populate_ssbox_func (struct ssbox *ssb,
-                                           struct cmd_t_test *cmd);
+                                 const struct dictionary *,
+                                 struct cmd_t_test *cmd);
 typedef void finalize_ssbox_func (struct ssbox *ssb);
 
 struct ssbox
@@ -168,21 +170,23 @@ struct ssbox
 void ssbox_create (struct ssbox *ssb,   struct cmd_t_test *cmd, int mode);
 
 /* Populate a ssbox according to cmd */
-void ssbox_populate (struct ssbox *ssb, struct cmd_t_test *cmd);
+void ssbox_populate (struct ssbox *ssb, const struct dictionary *dict,
+                    struct cmd_t_test *cmd);
 
 /* Submit and destroy a ssbox */
 void ssbox_finalize (struct ssbox *ssb);
 
 /* A function to create, populate and submit the Paired Samples Correlation
    box */
-void pscbox (void);
+static void pscbox (const struct dictionary *);
 
 
 /* Structures and Functions for the Test Results Box */
 struct trbox;
 
 typedef void populate_trbox_func (struct trbox *trb,
-                                struct cmd_t_test *cmd);
+                                 const struct dictionary *dict,
+                                 struct cmd_t_test *cmd);
 typedef void finalize_trbox_func (struct trbox *trb);
 
 struct trbox {
@@ -195,7 +199,8 @@ struct trbox {
 void trbox_create (struct trbox *trb,   struct cmd_t_test *cmd, int mode);
 
 /* Populate a ssbox according to cmd */
-void trbox_populate (struct trbox *trb, struct cmd_t_test *cmd);
+static void trbox_populate (struct trbox *trb, const struct dictionary *dict,
+                    struct cmd_t_test *cmd);
 
 /* Submit and destroy a ssbox */
 void trbox_finalize (struct trbox *trb);
@@ -637,9 +642,10 @@ ssbox_create (struct ssbox *ssb, struct cmd_t_test *cmd, int mode)
 
 /* Despatcher for the populate method */
 void
-ssbox_populate (struct ssbox *ssb,struct cmd_t_test *cmd)
+ssbox_populate (struct ssbox *ssb, const struct dictionary *dict,
+               struct cmd_t_test *cmd)
 {
-  ssb->populate (ssb,cmd);
+  ssb->populate (ssb, dict, cmd);
 }
 
 
@@ -675,7 +681,8 @@ ssbox_base_init (struct ssbox *this, int cols,int rows)
 }
 
 void  ssbox_one_sample_populate (struct ssbox *ssb,
-                             struct cmd_t_test *cmd);
+                                const struct dictionary *,
+                                struct cmd_t_test *cmd);
 
 /* Initialize the one_sample ssbox */
 void
@@ -696,8 +703,9 @@ ssbox_one_sample_init (struct ssbox *this,
   tab_text (this->t, 4, 0, TAB_CENTER | TAT_TITLE, _ ("SE. Mean"));
 }
 
-void ssbox_independent_samples_populate (struct ssbox *ssb,
-                                       struct cmd_t_test *cmd);
+static void ssbox_independent_samples_populate (struct ssbox *ssb,
+                                               const struct dictionary *,
+                                               struct cmd_t_test *cmd);
 
 /* Initialize the independent samples ssbox */
 void
@@ -721,12 +729,16 @@ ssbox_independent_samples_init (struct ssbox *this,
 
 
 /* Populate the ssbox for independent samples */
-void
+static void
 ssbox_independent_samples_populate (struct ssbox *ssb,
-                             struct cmd_t_test *cmd)
+                                   const struct dictionary *dict,
+                                   struct cmd_t_test *cmd)
 {
   int i;
 
+  const struct variable *wv = dict_get_weight (dict);
+  const struct fmt_spec *wfmt = wv ? var_get_print_format (wv) : &F_8_0;
+
   char *val_lab[2] = {NULL, NULL};
   double indep_value[2];
 
@@ -818,10 +830,10 @@ ssbox_independent_samples_populate (struct ssbox *ssb,
          gs = hsh_find (grp_hash, (void *) &search_val);
          assert (gs);
 
-         tab_float (ssb->t, 2 ,i*2+count+1, TAB_RIGHT, gs->n, 10, 0);
-         tab_float (ssb->t, 3 ,i*2+count+1, TAB_RIGHT, gs->mean, 8, 2);
-         tab_float (ssb->t, 4 ,i*2+count+1, TAB_RIGHT, gs->std_dev, 8, 3);
-         tab_float (ssb->t, 5 ,i*2+count+1, TAB_RIGHT, gs->se_mean, 8, 3);
+         tab_double (ssb->t, 2, i*2+count+1, TAB_RIGHT, gs->n, wfmt);
+         tab_double (ssb->t, 3, i*2+count+1, TAB_RIGHT, gs->mean, NULL);
+         tab_double (ssb->t, 4, i*2+count+1, TAB_RIGHT, gs->std_dev, NULL);
+         tab_double (ssb->t, 5, i*2+count+1, TAB_RIGHT, gs->se_mean, NULL);
        }
     }
   free (val_lab[0]);
@@ -829,8 +841,9 @@ ssbox_independent_samples_populate (struct ssbox *ssb,
 }
 
 
-void ssbox_paired_populate (struct ssbox *ssb,
-                          struct cmd_t_test *cmd);
+static void ssbox_paired_populate (struct ssbox *ssb,
+                                  const struct dictionary *dict,
+                                  struct cmd_t_test *cmd);
 
 /* Initialize the paired values ssbox */
 void
@@ -855,10 +868,14 @@ ssbox_paired_init (struct ssbox *this, struct cmd_t_test *cmd UNUSED)
 
 /* Populate the ssbox for paired values */
 void
-ssbox_paired_populate (struct ssbox *ssb,struct cmd_t_test *cmd UNUSED)
+ssbox_paired_populate (struct ssbox *ssb, const struct dictionary *dict,
+                      struct cmd_t_test *cmd UNUSED)
 {
   int i;
 
+  const struct variable *wv = dict_get_weight (dict);
+  const struct fmt_spec *wfmt = wv ? var_get_print_format (wv) : &F_8_0;
+
   assert (ssb->t);
 
   for (i=0; i < n_pairs; ++i)
@@ -879,10 +896,11 @@ ssbox_paired_populate (struct ssbox *ssb,struct cmd_t_test *cmd UNUSED)
                     var_get_name (pairs[i].v[j]));
 
          /* Values */
-         tab_float (ssb->t,2, i*2+j+1, TAB_RIGHT, pairs[i].mean[j], 8, 2);
-         tab_float (ssb->t,3, i*2+j+1, TAB_RIGHT, pairs[i].n, 10, 0);
-         tab_float (ssb->t,4, i*2+j+1, TAB_RIGHT, pairs[i].std_dev[j], 8, 3);
-         tab_float (ssb->t,5, i*2+j+1, TAB_RIGHT, pairs[i].std_dev[j]/sqrt (pairs[i].n), 8, 3);
+         tab_double (ssb->t,2, i*2+j+1, TAB_RIGHT, pairs[i].mean[j], NULL);
+         tab_double (ssb->t,3, i*2+j+1, TAB_RIGHT, pairs[i].n, wfmt);
+         tab_double (ssb->t,4, i*2+j+1, TAB_RIGHT, pairs[i].std_dev[j], NULL);
+         tab_double (ssb->t,5, i*2+j+1, TAB_RIGHT,
+                     pairs[i].std_dev[j]/sqrt (pairs[i].n), NULL);
 
        }
     }
@@ -890,10 +908,14 @@ ssbox_paired_populate (struct ssbox *ssb,struct cmd_t_test *cmd UNUSED)
 
 /* Populate the one sample ssbox */
 void
-ssbox_one_sample_populate (struct ssbox *ssb, struct cmd_t_test *cmd)
+ssbox_one_sample_populate (struct ssbox *ssb, const struct dictionary *dict,
+                          struct cmd_t_test *cmd)
 {
   int i;
 
+  const struct variable *wv = dict_get_weight (dict);
+  const struct fmt_spec *wfmt = wv ? var_get_print_format (wv) : &F_8_0;
+
   assert (ssb->t);
 
   for (i=0; i < cmd->n_variables; ++i)
@@ -901,12 +923,11 @@ ssbox_one_sample_populate (struct ssbox *ssb, struct cmd_t_test *cmd)
       struct group_statistics *gs = &group_proc_get (cmd->v_variables[i])->ugs;
 
       tab_text (ssb->t, 0, i+1, TAB_LEFT, var_get_name (cmd->v_variables[i]));
-      tab_float (ssb->t,1, i+1, TAB_RIGHT, gs->n, 10, 0);
-      tab_float (ssb->t,2, i+1, TAB_RIGHT, gs->mean, 8, 2);
-      tab_float (ssb->t,3, i+1, TAB_RIGHT, gs->std_dev, 8, 2);
-      tab_float (ssb->t,4, i+1, TAB_RIGHT, gs->se_mean, 8, 3);
+      tab_double (ssb->t,1, i+1, TAB_RIGHT, gs->n, wfmt);
+      tab_double (ssb->t,2, i+1, TAB_RIGHT, gs->mean, NULL);
+      tab_double (ssb->t,3, i+1, TAB_RIGHT, gs->std_dev, NULL);
+      tab_double (ssb->t,4, i+1, TAB_RIGHT, gs->se_mean, NULL);
     }
-
 }
 
 
@@ -919,20 +940,23 @@ void trbox_base_finalize (struct trbox *trb);
 void trbox_independent_samples_init (struct trbox *trb,
                                    struct cmd_t_test *cmd );
 
-void trbox_independent_samples_populate (struct trbox *trb,
-                                       struct cmd_t_test *cmd);
+static void trbox_independent_samples_populate (struct trbox *trb,
+                                        const struct dictionary *dict,
+                                        struct cmd_t_test *cmd);
 
 void trbox_one_sample_init (struct trbox *self,
                      struct cmd_t_test *cmd );
 
-void trbox_one_sample_populate (struct trbox *trb,
-                              struct cmd_t_test *cmd);
+static void trbox_one_sample_populate (struct trbox *trb,
+                               const struct dictionary *,
+                               struct cmd_t_test *cmd);
 
 void trbox_paired_init (struct trbox *self,
                       struct cmd_t_test *cmd );
 
-void trbox_paired_populate (struct trbox *trb,
-                     struct cmd_t_test *cmd);
+static void trbox_paired_populate (struct trbox *trb,
+                                  const struct dictionary *,
+                                  struct cmd_t_test *cmd);
 
 
 
@@ -958,10 +982,11 @@ trbox_create (struct trbox *trb,
 }
 
 /* Populate a trbox according to cmd */
-void
-trbox_populate (struct trbox *trb, struct cmd_t_test *cmd)
+static void
+trbox_populate (struct trbox *trb, const struct dictionary *dict,
+               struct cmd_t_test *cmd)
 {
-  trb->populate (trb,cmd);
+  trb->populate (trb, dict, cmd);
 }
 
 /* Submit and destroy a trbox */
@@ -1012,9 +1037,10 @@ trbox_independent_samples_init (struct trbox *self,
 }
 
 /* Populate the independent samples trbox */
-void
+static void
 trbox_independent_samples_populate (struct trbox *self,
-                                  struct cmd_t_test *cmd )
+                                   const struct dictionary *dict UNUSED,
+                                   struct cmd_t_test *cmd)
 {
   int i;
 
@@ -1064,16 +1090,16 @@ trbox_independent_samples_populate (struct trbox *self,
       tab_text (self->t, 1, i*2+3, TAB_LEFT, _ ("Equal variances assumed"));
 
 
-      tab_float (self->t, 2, i*2+3, TAB_CENTER, grp_data->levene, 8,3);
+      tab_double (self->t, 2, i*2+3, TAB_CENTER, grp_data->levene, NULL);
 
       /* Now work out the significance of the Levene test */
       df1 = 1; df2 = grp_data->ugs.n - 2;
       q = gsl_cdf_fdist_Q (grp_data->levene, df1, df2);
 
-      tab_float (self->t, 3, i*2+3, TAB_CENTER, q, 8,3 );
+      tab_double (self->t, 3, i*2+3, TAB_CENTER, q, NULL);
 
       df = gs0->n + gs1->n - 2.0 ;
-      tab_float (self->t, 5, i*2+3, TAB_RIGHT, df, 10, 0);
+      tab_double (self->t, 5, i*2+3, TAB_RIGHT, df, NULL);
 
       pooled_variance = ( (gs0->n )*pow2 (gs0->s_std_dev)
                          +
@@ -1083,30 +1109,30 @@ trbox_independent_samples_populate (struct trbox *self,
       t = (gs0->mean - gs1->mean) / sqrt (pooled_variance) ;
       t /= sqrt ((gs0->n + gs1->n)/ (gs0->n*gs1->n));
 
-      tab_float (self->t, 4, i*2+3, TAB_RIGHT, t, 8, 3);
+      tab_double (self->t, 4, i*2+3, TAB_RIGHT, t, NULL);
 
       p = gsl_cdf_tdist_P (t, df);
       q = gsl_cdf_tdist_Q (t, df);
 
-      tab_float (self->t, 6, i*2+3, TAB_RIGHT, 2.0* (t>0?q:p) , 8, 3);
+      tab_double (self->t, 6, i*2+3, TAB_RIGHT, 2.0* (t>0?q:p), NULL);
 
       mean_diff = gs0->mean - gs1->mean;
-      tab_float (self->t, 7, i*2+3, TAB_RIGHT, mean_diff, 8, 3);
+      tab_double (self->t, 7, i*2+3, TAB_RIGHT, mean_diff, NULL);
 
 
       std_err_diff = sqrt ( pow2 (gs0->se_mean) + pow2 (gs1->se_mean));
-      tab_float (self->t, 8, i*2+3, TAB_RIGHT, std_err_diff, 8, 3);
+      tab_double (self->t, 8, i*2+3, TAB_RIGHT, std_err_diff, NULL);
 
 
       /* Now work out the confidence interval */
       q = (1 - cmd->criteria)/2.0;  /* 2-tailed test */
 
       t = gsl_cdf_tdist_Qinv (q,df);
-      tab_float (self->t, 9, i*2+3, TAB_RIGHT,
-               mean_diff - t * std_err_diff, 8, 3);
+      tab_double (self->t, 9, i*2+3, TAB_RIGHT,
+               mean_diff - t * std_err_diff, NULL);
 
-      tab_float (self->t, 10, i*2+3, TAB_RIGHT,
-               mean_diff + t * std_err_diff, 8, 3);
+      tab_double (self->t, 10, i*2+3, TAB_RIGHT,
+               mean_diff + t * std_err_diff, NULL);
 
 
       {
@@ -1120,7 +1146,7 @@ trbox_independent_samples_populate (struct trbox *self,
         (pow2 (gs1->s_std_dev)/ (gs1->n -1) );
 
       t = mean_diff / sqrt (se2) ;
-      tab_float (self->t, 4, i*2+3+1, TAB_RIGHT, t, 8, 3);
+      tab_double (self->t, 4, i*2+3+1, TAB_RIGHT, t, NULL);
 
       df = pow2 (se2) / (
                       (pow2 (pow2 (gs0->s_std_dev)/ (gs0->n - 1 ))
@@ -1131,30 +1157,30 @@ trbox_independent_samples_populate (struct trbox *self,
                        / (gs1->n -1 )
                        )
                       ) ;
-      tab_float (self->t, 5, i*2+3+1, TAB_RIGHT, df, 8, 3);
+
+      tab_double (self->t, 5, i*2+3+1, TAB_RIGHT, df, NULL);
 
       p = gsl_cdf_tdist_P (t, df);
       q = gsl_cdf_tdist_Q (t, df);
 
-      tab_float (self->t, 6, i*2+3+1, TAB_RIGHT, 2.0* (t>0?q:p) , 8, 3);
+      tab_double (self->t, 6, i*2+3+1, TAB_RIGHT, 2.0* (t>0?q:p), NULL);
 
       /* Now work out the confidence interval */
       q = (1 - cmd->criteria)/2.0;  /* 2-tailed test */
 
       t = gsl_cdf_tdist_Qinv (q, df);
 
-      tab_float (self->t, 7, i*2+3+1, TAB_RIGHT, mean_diff, 8, 3);
-
+      tab_double (self->t, 7, i*2+3+1, TAB_RIGHT, mean_diff, NULL);
 
-      tab_float (self->t, 8, i*2+3+1, TAB_RIGHT, std_err_diff, 8, 3);
 
+      tab_double (self->t, 8, i*2+3+1, TAB_RIGHT, std_err_diff, NULL);
 
-      tab_float (self->t, 9, i*2+3+1, TAB_RIGHT,
-               mean_diff - t * std_err_diff, 8, 3);
 
-      tab_float (self->t, 10, i*2+3+1, TAB_RIGHT,
-               mean_diff + t * std_err_diff, 8, 3);
+      tab_double (self->t, 9, i*2+3+1, TAB_RIGHT,
+               mean_diff - t * std_err_diff, NULL);
 
+      tab_double (self->t, 10, i*2+3+1, TAB_RIGHT,
+               mean_diff + t * std_err_diff, NULL);
       }
     }
 }
@@ -1195,12 +1221,16 @@ trbox_paired_init (struct trbox *self,
 }
 
 /* Populate the paired samples trbox */
-void
+static void
 trbox_paired_populate (struct trbox *trb,
-                             struct cmd_t_test *cmd UNUSED)
+                      const struct dictionary *dict,
+                      struct cmd_t_test *cmd UNUSED)
 {
   int i;
 
+  const struct variable *wv = dict_get_weight (dict);
+  const struct fmt_spec *wfmt = wv ? var_get_print_format (wv) : &F_8_0;
+
   for (i=0; i < n_pairs; ++i)
     {
       double p,q;
@@ -1216,42 +1246,42 @@ trbox_paired_populate (struct trbox *trb,
                var_get_name (pairs[i].v[0]),
                 var_get_name (pairs[i].v[1]));
 
-      tab_float (trb->t, 2, i+3, TAB_RIGHT, pairs[i].mean_diff, 8, 4);
+      tab_double (trb->t, 2, i+3, TAB_RIGHT, pairs[i].mean_diff, NULL);
 
-      tab_float (trb->t, 3, i+3, TAB_RIGHT, pairs[i].std_dev_diff, 8, 5);
+      tab_double (trb->t, 3, i+3, TAB_RIGHT, pairs[i].std_dev_diff, NULL);
 
       /* SE Mean */
       se_mean = pairs[i].std_dev_diff / sqrt (n) ;
-      tab_float (trb->t, 4, i+3, TAB_RIGHT, se_mean, 8,5 );
+      tab_double (trb->t, 4, i+3, TAB_RIGHT, se_mean, NULL);
 
       /* Now work out the confidence interval */
       q = (1 - cmd->criteria)/2.0;  /* 2-tailed test */
 
       t = gsl_cdf_tdist_Qinv (q, df);
 
-      tab_float (trb->t, 5, i+3, TAB_RIGHT,
-               pairs[i].mean_diff - t * se_mean , 8, 4);
+      tab_double (trb->t, 5, i+3, TAB_RIGHT,
+               pairs[i].mean_diff - t * se_mean , NULL);
 
-      tab_float (trb->t, 6, i+3, TAB_RIGHT,
-               pairs[i].mean_diff + t * se_mean , 8, 4);
+      tab_double (trb->t, 6, i+3, TAB_RIGHT,
+               pairs[i].mean_diff + t * se_mean , NULL);
 
       t = (pairs[i].mean[0] - pairs[i].mean[1])
        / sqrt (
-                ( pow2 (pairs[i].s_std_dev[0]) + pow2 (pairs[i].s_std_dev[1]) -
+               ( pow2 (pairs[i].s_std_dev[0]) + pow2 (pairs[i].s_std_dev[1]) -
                  2 * pairs[i].correlation *
                  pairs[i].s_std_dev[0] * pairs[i].s_std_dev[1] )
                / (n - 1)
                );
 
-      tab_float (trb->t, 7, i+3, TAB_RIGHT, t , 8,3 );
+      tab_double (trb->t, 7, i+3, TAB_RIGHT, t, NULL);
 
       /* Degrees of freedom */
-      tab_float (trb->t, 8, i+3, TAB_RIGHT, df , 10, 0 );
+      tab_double (trb->t, 8, i+3, TAB_RIGHT, df, wfmt);
 
       p = gsl_cdf_tdist_P (t,df);
       q = gsl_cdf_tdist_P (t,df);
 
-      tab_float (trb->t, 9, i+3, TAB_RIGHT, 2.0* (t>0?q:p) , 8, 3);
+      tab_double (trb->t, 9, i+3, TAB_RIGHT, 2.0* (t>0?q:p), NULL);
 
     }
 }
@@ -1293,11 +1323,16 @@ trbox_one_sample_init (struct trbox *self, struct cmd_t_test *cmd )
 
 
 /* Populate the one sample trbox */
-void
-trbox_one_sample_populate (struct trbox *trb, struct cmd_t_test *cmd)
+static void
+trbox_one_sample_populate (struct trbox *trb,
+                          const struct dictionary *dict,
+                          struct cmd_t_test *cmd)
 {
   int i;
 
+  const struct variable *wv = dict_get_weight (dict);
+  const struct fmt_spec *wfmt = wv ? var_get_print_format (wv) : &F_8_0;
+
   assert (trb->t);
 
   for (i=0; i < cmd->n_variables; ++i)
@@ -1312,31 +1347,31 @@ trbox_one_sample_populate (struct trbox *trb, struct cmd_t_test *cmd)
 
       t = (gs->mean - cmd->n_testval[0] ) * sqrt (gs->n) / gs->std_dev ;
 
-      tab_float (trb->t, 1, i+3, TAB_RIGHT, t, 8,3);
+      tab_double (trb->t, 1, i+3, TAB_RIGHT, t, NULL);
 
       /* degrees of freedom */
       df = gs->n - 1;
 
-      tab_float (trb->t, 2, i+3, TAB_RIGHT, df, 8,0);
+      tab_double (trb->t, 2, i+3, TAB_RIGHT, df, wfmt);
 
       p = gsl_cdf_tdist_P (t, df);
       q = gsl_cdf_tdist_Q (t, df);
 
       /* Multiply by 2 to get 2-tailed significance, makeing sure we've got
         the correct tail*/
-      tab_float (trb->t, 3, i+3, TAB_RIGHT, 2.0* (t>0?q:p), 8,3);
+      tab_double (trb->t, 3, i+3, TAB_RIGHT, 2.0* (t>0?q:p), NULL);
 
-      tab_float (trb->t, 4, i+3, TAB_RIGHT, gs->mean_diff, 8,3);
+      tab_double (trb->t, 4, i+3, TAB_RIGHT, gs->mean_diff, NULL);
 
 
       q = (1 - cmd->criteria)/2.0;  /* 2-tailed test */
       t = gsl_cdf_tdist_Qinv (q, df);
 
-      tab_float (trb->t, 5, i+3, TAB_RIGHT,
-                gs->mean_diff - t * gs->se_mean, 8,4);
+      tab_double (trb->t, 5, i+3, TAB_RIGHT,
+                gs->mean_diff - t * gs->se_mean, NULL);
 
-      tab_float (trb->t, 6, i+3, TAB_RIGHT,
-                gs->mean_diff + t * gs->se_mean, 8,4);
+      tab_double (trb->t, 6, i+3, TAB_RIGHT,
+                gs->mean_diff + t * gs->se_mean, NULL);
     }
 }
 
@@ -1364,11 +1399,14 @@ trbox_base_finalize (struct trbox *trb)
 
 
 /* Create , populate and submit the Paired Samples Correlation box */
-void
-pscbox (void)
+static void
+pscbox (const struct dictionary *dict)
 {
-  const int rows=1+n_pairs;
-  const int cols=5;
+  const struct variable *wv = dict_get_weight (dict);
+  const struct fmt_spec *wfmt = wv ? var_get_print_format (wv) : &F_8_0;
+
+  const int rows = 1 + n_pairs;
+  const int cols = 5;
   int i;
 
   struct tab_table *table;
@@ -1410,13 +1448,13 @@ pscbox (void)
 
 
       /* row data */
-      tab_float (table, 2, i+1, TAB_RIGHT, pairs[i].n, 4, 0);
-      tab_float (table, 3, i+1, TAB_RIGHT, pairs[i].correlation, 8, 3);
+      tab_double (table, 2, i+1, TAB_RIGHT, pairs[i].n, wfmt);
+      tab_double (table, 3, i+1, TAB_RIGHT, pairs[i].correlation, NULL);
 
       p = gsl_cdf_tdist_P (correlation_t, df);
       q = gsl_cdf_tdist_Q (correlation_t, df);
 
-      tab_float (table, 4, i+1, TAB_RIGHT, 2.0* (correlation_t>0?q:p), 8, 3);
+      tab_double (table, 4, i+1, TAB_RIGHT, 2.0* (correlation_t>0?q:p), NULL);
     }
 
   tab_submit (table);
@@ -1860,14 +1898,14 @@ calculate (struct cmd_t_test *cmd,
   if (!taint_has_tainted_successor (taint))
     {
       ssbox_create (&stat_summary_box,cmd,mode);
-      ssbox_populate (&stat_summary_box,cmd);
+      ssbox_populate (&stat_summary_box, dict, cmd);
       ssbox_finalize (&stat_summary_box);
 
       if ( mode == T_PAIRED )
-        pscbox ();
+        pscbox (dict);
 
-      trbox_create (&test_results_box,cmd,mode);
-      trbox_populate (&test_results_box,cmd);
+      trbox_create (&test_results_box, cmd, mode);
+      trbox_populate (&test_results_box, dict, cmd);
       trbox_finalize (&test_results_box);
     }
 
index 1bdcc06dc252851f93c7172a13c35fdfaba62367..c0329f6c01e5277e33304377d7ed07c56f99dca5 100644 (file)
@@ -33,6 +33,7 @@
 #include <unistd.h>
 #include <signal.h>
 #include <libpspp/assertion.h>
+#include <data/format.h>
 
 static double
 append_difference (const struct ccase *c, casenumber n UNUSED, void *aux)
@@ -43,7 +44,8 @@ append_difference (const struct ccase *c, casenumber n UNUSED, void *aux)
 }
 
 static void show_ranks_box (const struct wilcoxon_state *,
-                           const struct two_sample_test *);
+                           const struct two_sample_test *,
+                           const struct dictionary *);
 
 static void show_tests_box (const struct wilcoxon_state *,
                            const struct two_sample_test *,
@@ -179,7 +181,7 @@ wilcoxon_execute (const struct dataset *ds,
 
   var_destroy (weightx);
 
-  show_ranks_box (ws, t2s);
+  show_ranks_box (ws, t2s, dict);
   show_tests_box (ws, t2s, exact, timer);
 
   for (i = 0 ; i < t2s->n_pairs; ++i )
@@ -198,9 +200,15 @@ wilcoxon_execute (const struct dataset *ds,
 #define _(msgid) gettext (msgid)
 
 static void
-show_ranks_box (const struct wilcoxon_state *ws, const struct two_sample_test *t2s)
+show_ranks_box (const struct wilcoxon_state *ws,
+               const struct two_sample_test *t2s,
+               const struct dictionary *dict)
 {
   size_t i;
+
+  const struct variable *wv = dict_get_weight (dict);
+  const struct fmt_spec *wfmt = wv ? var_get_print_format (wv) : & F_8_0;
+
   struct tab_table *table = tab_create (5, 1 + 4 * t2s->n_pairs, 0);
 
   tab_dim (table, tab_natural_dimensions);
@@ -245,24 +253,24 @@ show_ranks_box (const struct wilcoxon_state *ws, const struct two_sample_test *t
 
 
       /* N */
-      tab_float (table, 2, 1 + i * 4, TAB_RIGHT, ws[i].negatives.n, 8, 0);
-      tab_float (table, 2, 2 + i * 4, TAB_RIGHT, ws[i].positives.n, 8, 0);
-      tab_float (table, 2, 3 + i * 4, TAB_RIGHT, ws[i].n_zeros, 8, 0);
+      tab_double (table, 2, 1 + i * 4, TAB_RIGHT, ws[i].negatives.n, wfmt);
+      tab_double (table, 2, 2 + i * 4, TAB_RIGHT, ws[i].positives.n, wfmt);
+      tab_double (table, 2, 3 + i * 4, TAB_RIGHT, ws[i].n_zeros, wfmt);
 
-      tab_float (table, 2, 4 + i * 4, TAB_RIGHT,
-                ws[i].n_zeros + ws[i].positives.n + ws[i].negatives.n, 8, 0);
+      tab_double (table, 2, 4 + i * 4, TAB_RIGHT,
+                ws[i].n_zeros + ws[i].positives.n + ws[i].negatives.n, wfmt);
 
       /* Sums */
-      tab_float (table, 4, 1 + i * 4, TAB_RIGHT, ws[i].negatives.sum, 8, 2);
-      tab_float (table, 4, 2 + i * 4, TAB_RIGHT, ws[i].positives.sum, 8, 2);
+      tab_double (table, 4, 1 + i * 4, TAB_RIGHT, ws[i].negatives.sum, NULL);
+      tab_double (table, 4, 2 + i * 4, TAB_RIGHT, ws[i].positives.sum, NULL);
 
 
       /* Means */
-      tab_float (table, 3, 1 + i * 4, TAB_RIGHT,
-                ws[i].negatives.sum / (double) ws[i].negatives.n, 8, 2);
+      tab_double (table, 3, 1 + i * 4, TAB_RIGHT,
+                ws[i].negatives.sum / (double) ws[i].negatives.n, NULL);
 
-      tab_float (table, 3, 2 + i * 4, TAB_RIGHT,
-                ws[i].positives.sum / (double) ws[i].positives.n, 8, 2);
+      tab_double (table, 3, 2 + i * 4, TAB_RIGHT,
+                ws[i].positives.sum / (double) ws[i].positives.n, NULL);
 
     }
 
@@ -332,11 +340,11 @@ show_tests_box (const struct wilcoxon_state *ws,
 
       z /= sqrt (n * (n + 1) * (2*n + 1)/24.0 - ws[i].tiebreaker / 48.0);
 
-      tab_float (table, 1 + i, 1, TAB_RIGHT, z, 8, 3);
+      tab_double (table, 1 + i, 1, TAB_RIGHT, z, NULL);
 
-      tab_float (table, 1 + i, 2, TAB_RIGHT,
+      tab_double (table, 1 + i, 2, TAB_RIGHT,
                 2.0 * gsl_cdf_ugaussian_P (z),
-                8, 3);
+                NULL);
 
       if (exact)
        {
@@ -347,8 +355,8 @@ show_tests_box (const struct wilcoxon_state *ws,
            }
          else
            {
-             tab_float (table, 1 + i, 3, TAB_RIGHT, p, 8, 3);
-             tab_float (table, 1 + i, 4, TAB_RIGHT, p / 2.0, 8, 3);
+             tab_double (table, 1 + i, 3, TAB_RIGHT, p, NULL);
+             tab_double (table, 1 + i, 4, TAB_RIGHT, p / 2.0, NULL);
            }
        }
     }
index bb17d99aa9c616d49aa1f7d3f3f62201d3508710..95895eaeaca3c8337da4e55da49dc7f78f624419 100644 (file)
@@ -148,7 +148,25 @@ covariance_matrix_init (size_t n_variables,
 
   return result;
 }
-
+static size_t 
+get_n_rows (size_t n_variables, size_t *v_variables[])
+{
+  size_t i;
+  size_t result = 0;
+  for (i = 0; i < n_variables; i++)
+    {
+      if (var_is_numeric (v_variables[i]))
+       {
+         result++;
+       }
+      else if (var_is_alpha (v_variables[i]))
+       {
+         size_t n_categories = cat_get_n_categories (v_variables[i]);
+         result += n_categories - 1;
+       }
+    }
+  return result;
+}
 /*
   The covariances are stored in a DESIGN_MATRIX structure.
  */
@@ -156,8 +174,8 @@ struct design_matrix *
 covariance_matrix_create (size_t n_variables,
                          const struct variable *v_variables[])
 {
-  return design_matrix_create (n_variables, v_variables,
-                              (size_t) n_variables);
+  size_t n_rows = get_n_rows (n_variables, v_variables);
+  return design_matrix_create (n_variables, v_variables, n_rows);
 }
 
 static void
index 7869d5d6bd4355f71f8e82ee917f43edd95edb19..88a1d741ddf9199f08404d49096de62dada0a373 100644 (file)
@@ -148,7 +148,7 @@ draw_barchart(struct chart *ch, const char *title,
        {
 
          pl_savestate_r(ch->lp);
-         pl_fillcolorname_r(ch->lp,data_colour[sc]);
+         pl_fillcolorname_r(ch->lp,data_colour[sc % N_CHART_COLOURS]);
 
          switch ( opt )
            {
index c4dc0e67a8b36a0d390e9247e8ec3fc5c886e74c..4eeb10ca63af06f70f764477cd0865401c34a8c0 100644 (file)
@@ -96,7 +96,7 @@ piechart_plot(const char *title, const struct slice *slices, int n_slices)
       draw_segment(ch,
                   centre_x, centre_y, radius,
                   angle, segment_angle,
-                  data_colour[i]);
+                  data_colour[i % N_CHART_COLOURS]);
 
       /* Now add the labels */
       if ( label_x < centre_x )
index 88aa58b06803a4c65a7f1f52a021acf116f111c9..3b4f1b377a12a624ceb929d00c617bb4bd581f30 100644 (file)
 
 #include "xalloc.h"
 
-const char *const data_colour[] = {
-  "brown",
-  "red",
-  "orange",
-  "yellow",
-  "green",
-  "blue",
-  "violet",
-  "grey",
-  "pink"
-};
+const char *const data_colour[N_CHART_COLOURS] =
+  {
+    "brown",
+    "red",
+    "orange",
+    "yellow",
+    "green",
+    "blue",
+    "violet",
+    "grey",
+    "pink"
+  };
 
 
 
index dae1cc07a1adcb30dd81f58b48eaec53d1874292..4a1dc10538d2567b630cca096886c8ca8e5011cd 100644 (file)
 #ifndef PLOT_CHART_H
 #define PLOT_CHART_H
 
-
+#define N_CHART_COLOURS 9
 extern const char *const data_colour[];
 
-enum tick_orientation {
-  TICK_ABSCISSA=0,
-  TICK_ORDINATE
-};
+enum tick_orientation
+  {
+    TICK_ABSCISSA=0,
+    TICK_ORDINATE
+  };
 
 
 /* Draw a tick mark at position
index 92f79541d6fbddad4e02b3a6a69961c5bf7da43a..5c8dc6f7ea8767feb23785617cba912e0529a0ed 100644 (file)
@@ -34,6 +34,8 @@
 #include <libpspp/misc.h>
 #include <libpspp/pool.h>
 
+#include <data/settings.h>
+
 #include "minmax.h"
 #include "xalloc.h"
 
@@ -543,7 +545,7 @@ tab_value (struct tab_table *table, int c, int r, unsigned char opt,
 /* Sets cell (C,R) in TABLE, with options OPT, to have value VAL
    with NDEC decimal places. */
 void
-tab_float (struct tab_table *table, int c, int r, unsigned char opt,
+tab_fixed (struct tab_table *table, int c, int r, unsigned char opt,
           double val, int w, int d)
 {
   char *contents;
@@ -566,7 +568,7 @@ tab_float (struct tab_table *table, int c, int r, unsigned char opt,
       || c + table->col_ofs >= table->nc
       || r + table->row_ofs >= table->nr)
     {
-      printf ("tab_float(): bad cell (%d+%d=%d,%d+%d=%d) in table size "
+      printf ("tab_fixed(): bad cell (%d+%d=%d,%d+%d=%d) in table size "
              "(%d,%d)\n",
              c, table->col_ofs, c + table->col_ofs,
              r, table->row_ofs, r + table->row_ofs,
@@ -589,6 +591,61 @@ tab_float (struct tab_table *table, int c, int r, unsigned char opt,
   memcpy (contents, cp, f.w);
 }
 
+/* Sets cell (C,R) in TABLE, with options OPT, to have value VAL as
+   formatted by FMT.
+   If FMT is null, then the default print format will be used.
+*/
+void
+tab_double (struct tab_table *table, int c, int r, unsigned char opt,
+          double val, const struct fmt_spec *fmt)
+{
+  int w;
+  char *contents;
+  char buf[40], *cp;
+
+  union value double_value;
+
+  assert (table != NULL);
+
+  assert (c >= 0);
+  assert (c < table->nc);
+  assert (r >= 0);
+  assert (r < table->nr);
+
+  if ( fmt == NULL)
+    fmt = settings_get_format ();
+
+  fmt_check_output (fmt);
+
+#if DEBUGGING
+  if (c + table->col_ofs < 0 || r + table->row_ofs < 0
+      || c + table->col_ofs >= table->nc
+      || r + table->row_ofs >= table->nr)
+    {
+      printf ("tab_double(): bad cell (%d+%d=%d,%d+%d=%d) in table size "
+             "(%d,%d)\n",
+             c, table->col_ofs, c + table->col_ofs,
+             r, table->row_ofs, r + table->row_ofs,
+             table->nc, table->nr);
+      return;
+    }
+#endif
+
+  double_value.f = val;
+  data_out (&double_value, fmt, buf);
+
+  cp = buf;
+  while (isspace ((unsigned char) *cp) && cp < &buf[fmt->w])
+    cp++;
+  w = fmt->w - (cp - buf);
+
+  contents = pool_alloc (table->container, w);
+  table->cc[c + r * table->cf] = ss_buffer (contents, w);
+  table->ct[c + r * table->cf] = opt;
+  memcpy (contents, cp, w);
+}
+
+
 /* Sets cell (C,R) in TABLE, with options OPT, to have text value
    TEXT. */
 void
@@ -712,7 +769,7 @@ tab_raw (struct tab_table *table, int c, int r, unsigned opt,
       || c + table->col_ofs >= table->nc
       || r + table->row_ofs >= table->nr)
     {
-      printf ("tab_float(): bad cell (%d+%d=%d,%d+%d=%d) in table size "
+      printf ("tab_raw(): bad cell (%d+%d=%d,%d+%d=%d) in table size "
              "(%d,%d)\n",
              c, table->col_ofs, c + table->col_ofs,
              r, table->row_ofs, r + table->row_ofs,
index d0958cefe3e6fcec7ccf4a192903717acb598677..829410edfd3db644930a18233f9a3a939a8413c9 100644 (file)
@@ -155,8 +155,13 @@ struct fmt_spec;
 union value;
 void tab_value (struct tab_table *, int c, int r, unsigned char opt,
                const union value *, const struct fmt_spec *);
-void tab_float (struct tab_table *, int c, int r, unsigned char opt,
+
+void tab_fixed (struct tab_table *, int c, int r, unsigned char opt,
                double v, int w, int d);
+
+void tab_double (struct tab_table *, int c, int r, unsigned char opt,
+               double v, const struct fmt_spec *);
+
 void tab_text (struct tab_table *, int c, int r, unsigned opt,
               const char *, ...)
      PRINTF_FORMAT (5, 6);
index 11106640d66db78c5e685b112048da79042eae88..cd7c34e6cac90d8df925cbd1331a74e204c301dd 100644 (file)
@@ -69,6 +69,7 @@ nodist_src_ui_gui_psppire_DATA = \
        $(top_builddir)/src/ui/gui/rank.ui \
        $(top_builddir)/src/ui/gui/recode.ui \
        $(top_builddir)/src/ui/gui/regression.ui \
+       $(top_builddir)/src/ui/gui/reliability.ui \
        $(top_builddir)/src/ui/gui/syntax-editor.ui \
        $(top_builddir)/src/ui/gui/text-data-import.ui \
        $(top_builddir)/src/ui/gui/t-test.ui \
@@ -178,6 +179,8 @@ src_ui_gui_psppire_SOURCES = \
        src/ui/gui/recode-dialog.h \
        src/ui/gui/regression-dialog.c \
        src/ui/gui/regression-dialog.h \
+       src/ui/gui/reliability-dialog.c \
+       src/ui/gui/reliability-dialog.h \
        src/ui/gui/select-cases-dialog.c \
        src/ui/gui/select-cases-dialog.h \
        src/ui/gui/sort-cases-dialog.c \
@@ -224,6 +227,7 @@ src_ui_gui_psppire_SOURCES = \
        src/ui/gui/rank.glade \
        src/ui/gui/recode.glade \
        src/ui/gui/regression.glade \
+       src/ui/gui/reliability.glade \
        src/ui/gui/syntax-editor.glade \
        src/ui/gui/text-data-import.glade \
        src/ui/gui/t-test.glade \
index bcc28f50688d8e849e8b57912b9222558340eae6..06776248738df3cbea663edeca39e2934b910037 100644 (file)
               </widget>
             </child>
             <child>
-              <widget class="GtkMenuItem" id="bivariate-correlation">
+              <widget class="GtkMenuItem" id="reliability">
                 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                <property name="label" translatable="yes">Bivariate _Correlation</property>
+                <property name="label" translatable="yes">Re_liability</property>
                 <property name="use_underline">True</property>
               </widget>
             </child>
index 1070f5c2871caef36db153d9b48aca7667497ad3..9d15ceb94fe53c628b90e3f48ce15e415b0e253d 100644 (file)
@@ -23,8 +23,8 @@
 
 #include <language/syntax-string-source.h>
 #include "psppire-data-store.h"
-#include <ui/gui/sheet/psppire-axis-impl.h>
 #include <libpspp/i18n.h>
+#include <ui/gui/sheet/psppire-axis.h>
 #include "helper.h"
 
 #include <gtk-contrib/gtkxpaned.h>
@@ -221,8 +221,8 @@ new_data_callback (PsppireDataStore *ds, gpointer data)
 
   for (i = 0; i < 2; ++i)
     {
-      psppire_axis_impl_clear (de->vaxis[i]);
-      psppire_axis_impl_append_n (de->vaxis[i], n_cases, DEFAULT_ROW_HEIGHT);
+      psppire_axis_clear (de->vaxis[i]);
+      psppire_axis_append_n (de->vaxis[i], n_cases, DEFAULT_ROW_HEIGHT);
     }
 }
 
@@ -233,7 +233,7 @@ case_inserted_callback (PsppireDataStore *ds, gint before, gpointer data)
   PsppireDataEditor *de = PSPPIRE_DATA_EDITOR (data);
 
   for (i = 0; i < 2; ++i)
-    psppire_axis_impl_insert (de->vaxis[i], before, DEFAULT_ROW_HEIGHT);
+    psppire_axis_insert (de->vaxis[i], before, DEFAULT_ROW_HEIGHT);
 }
 
 
@@ -244,7 +244,7 @@ cases_deleted_callback (PsppireDataStore *ds, gint first, gint n_cases, gpointer
   PsppireDataEditor *de = PSPPIRE_DATA_EDITOR (data);
 
   for (i = 0; i < 2; ++i)
-    psppire_axis_impl_delete (de->vaxis[0], first, n_cases);
+    psppire_axis_delete (de->vaxis[0], first, n_cases);
 }
 
 
@@ -289,22 +289,22 @@ new_variables_callback (PsppireDict *dict, gpointer data)
   PsppireDataEditor *de = PSPPIRE_DATA_EDITOR (data);
   gint m_width = width_of_m (GTK_WIDGET (de));
 
-  PsppireAxisImpl *vaxis;
+  PsppireAxis *vaxis;
   g_object_get (de->var_sheet, "vertical-axis", &vaxis, NULL);
 
-  psppire_axis_impl_clear (vaxis);
-  psppire_axis_impl_append_n (vaxis, 1 + psppire_dict_get_var_cnt (dict), DEFAULT_ROW_HEIGHT);
+  psppire_axis_clear (vaxis);
+  psppire_axis_append_n (vaxis, 1 + psppire_dict_get_var_cnt (dict), DEFAULT_ROW_HEIGHT);
 
   g_signal_connect_swapped (de->haxis, "resize-unit",
                            G_CALLBACK (rewidth_variable), de);
 
-  psppire_axis_impl_clear (de->haxis);
+  psppire_axis_clear (de->haxis);
 
   for (v = 0 ; v < psppire_dict_get_var_cnt (dict); ++v)
     {
       const struct variable *var = psppire_dict_get_variable (dict, v);
 
-      psppire_axis_impl_append (de->haxis, m_width * var_get_display_width (var));
+      psppire_axis_append (de->haxis, m_width * var_get_display_width (var));
     }
 }
 
@@ -315,16 +315,16 @@ insert_variable_callback (PsppireDict *dict, gint x, gpointer data)
 
   gint m_width  = width_of_m (GTK_WIDGET (de));
 
-  PsppireAxisImpl *var_vaxis;
+  PsppireAxis *var_vaxis;
 
   const struct variable *var = psppire_dict_get_variable (dict, x);
 
   g_object_get (de->var_sheet, "vertical-axis", &var_vaxis, NULL);
 
-  psppire_axis_impl_insert (var_vaxis, x, DEFAULT_ROW_HEIGHT);
+  psppire_axis_insert (var_vaxis, x, DEFAULT_ROW_HEIGHT);
 
 
-  psppire_axis_impl_insert (de->haxis, x, m_width * var_get_display_width (var));
+  psppire_axis_insert (de->haxis, x, m_width * var_get_display_width (var));
 }
 
 
@@ -334,12 +334,12 @@ delete_variable_callback (PsppireDict *dict, gint posn,
 {
   PsppireDataEditor *de = PSPPIRE_DATA_EDITOR (data);
 
-  PsppireAxisImpl *var_vaxis;
+  PsppireAxis *var_vaxis;
   g_object_get (de->var_sheet, "vertical-axis", &var_vaxis, NULL);
 
-  psppire_axis_impl_delete (var_vaxis, posn, 1);
+  psppire_axis_delete (var_vaxis, posn, 1);
 
-  psppire_axis_impl_delete (de->haxis, posn, 1);
+  psppire_axis_delete (de->haxis, posn, 1);
 }
 
 
@@ -357,7 +357,7 @@ rewidth_variable_callback (PsppireDict *dict, gint posn, gpointer data)
   if ( var_width < 1 )
     var_width = 1;
 
-  psppire_axis_impl_resize (de->haxis, posn, m_width * var_width);
+  psppire_axis_resize (de->haxis, posn, m_width * var_width);
 }
 
 
@@ -825,8 +825,8 @@ on_map (GtkWidget *w)
 static void
 init_sheet (PsppireDataEditor *de, int i,
            GtkAdjustment *hadj, GtkAdjustment *vadj,
-           PsppireAxisImpl *vaxis,
-           PsppireAxisImpl *haxis
+           PsppireAxis *vaxis,
+           PsppireAxis *haxis
            )
 {
   de->sheet_bin[i] = gtk_scrolled_window_new (hadj, vadj);
@@ -862,12 +862,12 @@ init_data_sheet (PsppireDataEditor *de)
   GtkAdjustment *vadj1, *hadj1;
   GtkWidget *sheet ;
 
-  de->vaxis[0] = psppire_axis_impl_new ();
-  de->vaxis[1] = psppire_axis_impl_new ();
+  de->vaxis[0] = psppire_axis_new ();
+  de->vaxis[1] = psppire_axis_new ();
 
   /* There's only one horizontal axis, since the
      column widths are parameters of the variables */
-  de->haxis = psppire_axis_impl_new ();
+  de->haxis = psppire_axis_new ();
 
   de->split = TRUE;
   de->paned = gtk_xpaned_new ();
index ee95a03c46f4c5189147582fccc94d251ee5745b..b5b3f3600a5d490f17bcf606788ec4bee5e738cb 100644 (file)
@@ -22,7 +22,7 @@
 #include <glib-object.h>
 #include <gtk/gtknotebook.h>
 
-#include <ui/gui/sheet/psppire-axis-impl.h>
+#include <ui/gui/sheet/psppire-axis.h>
 #include "psppire-var-store.h"
 #include "psppire-data-store.h"
 
@@ -59,11 +59,11 @@ struct _PsppireDataEditor
   GtkWidget *paned;
   gboolean split;
 
-  PsppireAxisImpl *vaxis[2];
+  PsppireAxis *vaxis[2];
 
   /* There's only one horizontal axis, since the
      column widths are parameters of the variables */
-  PsppireAxisImpl *haxis;
+  PsppireAxis *haxis;
 };
 
 
index ef9e0b6eeaa034f528ad998828244e856e2cd20e..52ec0d49b25db95eedcdff6f2924e9b7196e75dd 100644 (file)
@@ -54,6 +54,7 @@
 #include "frequencies-dialog.h"
 #include "examine-dialog.h"
 #include "regression-dialog.h"
+#include "reliability-dialog.h"
 #include "oneway-anova-dialog.h"
 #include "t-test-independent-samples-dialog.h"
 #include "t-test-one-sample.h"
@@ -1661,7 +1662,22 @@ psppire_data_window_init (PsppireDataWindow *de)
                      G_CALLBACK (regression_dialog), de);
   }
 
-  { 
+  {
+    GtkAction *invoke_reliability_dialog =
+      resolve_action (de->builder, "reliability", NULL);
+
+    g_object_set (invoke_reliability_dialog,
+                 "tooltip", _("Reliability Analysis"),
+                 "stock-id", "pspp-reliability",
+                 NULL
+                 );
+
+    g_signal_connect (invoke_reliability_dialog, "activate",
+                     G_CALLBACK (reliability_dialog), de);
+  }
+
+
+  {
     GtkUIManager *uim = GTK_UI_MANAGER (get_object_assert (de->builder, "uimanager1", GTK_TYPE_UI_MANAGER));
 
     GtkWidget *recent_data =
index 37539694b138c109fbe6692628e3009dd62e35e9..f63ea0ba6fe578367d492fc2ff724487695d9034 100644 (file)
@@ -523,7 +523,10 @@ psppire_dict_view_init (PsppireDictView *dict_view)
 
   gtk_tree_view_append_column (GTK_TREE_VIEW (dict_view), col);
 
-  g_object_set (dict_view, "has-tooltip", TRUE, NULL);
+  g_object_set (dict_view,
+               "has-tooltip", TRUE,
+               "headers-visible", FALSE,
+               NULL);
 
   g_signal_connect (dict_view, "query-tooltip",
                    G_CALLBACK (set_tooltip_for_variable), NULL);
index b742f3b7c69d7431ab2789fb5b7fcbc1f366586a..94b88050a135d2d90fcb6a313fa7181cc2dbd60f 100644 (file)
@@ -16,7 +16,7 @@
 
 #include <config.h>
 #include "psppire-var-sheet.h"
-#include <ui/gui/sheet/psppire-axis-impl.h>
+#include <ui/gui/sheet/psppire-axis.h>
 
 #include "helper.h"
 
@@ -551,13 +551,13 @@ GtkWidget*
 psppire_var_sheet_new (void)
 {
   gint i;
-  PsppireAxisImpl *ha = psppire_axis_impl_new ();
-  PsppireAxisImpl *va = psppire_axis_impl_new ();
+  PsppireAxis *ha = psppire_axis_new ();
+  PsppireAxis *va = psppire_axis_new ();
 
   GtkWidget *w = g_object_new (psppire_var_sheet_get_type (), NULL);
 
   for (i = 0 ; i < 10 ; ++i)
-    psppire_axis_impl_append (ha, column_def[i].width);
+    psppire_axis_append (ha, column_def[i].width);
 
   g_object_set (va,
                "default-size", 25,
index 7b6ce6cc8631dfc890aca58890d2184be6714bcb..b42dffe50b06b1583a91f38766aeafcb3bc36880 100644 (file)
@@ -214,7 +214,7 @@ dialog_state_valid (gpointer data)
 
   GtkTreeIter notused;
 
-  return (gtk_tree_model_get_iter_first (dep_vars, &notused) 
+  return (gtk_tree_model_get_iter_first (dep_vars, &notused)
     && gtk_tree_model_get_iter_first (indep_vars, &notused));
 }
 
diff --git a/src/ui/gui/reliability-dialog.c b/src/ui/gui/reliability-dialog.c
new file mode 100644 (file)
index 0000000..4d01573
--- /dev/null
@@ -0,0 +1,228 @@
+/* PSPPIRE - a graphical user interface for PSPP.
+   Copyright (C) 2009  Free Software Foundation
+
+   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
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   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 <http://www.gnu.org/licenses/>. */
+
+#include <config.h>
+
+#include "dialog-common.h"
+#include <language/syntax-string-source.h>
+#include "reliability-dialog.h"
+#include "psppire-selector.h"
+#include "psppire-dictview.h"
+#include "psppire-dialog.h"
+
+#include "psppire-data-window.h"
+
+#include "helper.h"
+
+#include <gtk/gtk.h>
+
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
+#define N_(msgid) msgid
+
+
+struct reliability
+{
+  PsppireDict *dict;
+  GtkWidget *model_combo;
+  GtkWidget *variables;
+  GtkWidget *split_point_hbox;
+  GtkWidget *split_spinbutton;
+};
+
+
+static char * generate_syntax (const struct reliability *rd);
+
+
+static void
+on_vars_changed (struct reliability *rd)
+{
+  GtkTreeModel *tm =
+    gtk_tree_view_get_model (GTK_TREE_VIEW (rd->variables));
+
+  gint n_vars = gtk_tree_model_iter_n_children (tm, NULL);
+
+  gint current_value =
+    gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (rd->split_spinbutton));
+
+  gint new_value = current_value;
+
+  gtk_spin_button_set_range (GTK_SPIN_BUTTON (rd->split_spinbutton),
+                            0, n_vars - 1);
+
+  if ( current_value > n_vars - 1)
+    new_value = n_vars - 1;
+
+  gtk_spin_button_set_value (GTK_SPIN_BUTTON (rd->split_spinbutton),
+                            new_value);
+}
+
+static void
+on_method_change (struct reliability *rd)
+{
+  gtk_widget_set_sensitive (rd->split_point_hbox,
+                           ( 1 == gtk_combo_box_get_active (GTK_COMBO_BOX (rd->model_combo))));
+
+}
+
+static void
+refresh (PsppireDialog *dialog, struct reliability *rd)
+{
+  GtkTreeModel *liststore =
+    gtk_tree_view_get_model (GTK_TREE_VIEW (rd->variables));
+  gtk_list_store_clear (GTK_LIST_STORE (liststore));
+
+  gtk_combo_box_set_active (GTK_COMBO_BOX (rd->model_combo), 0);
+
+  gtk_spin_button_set_value (GTK_SPIN_BUTTON (rd->split_spinbutton), 0);
+
+  gtk_spin_button_set_range (GTK_SPIN_BUTTON (rd->split_spinbutton),
+                            0, 0);
+}
+
+
+static gboolean
+dialog_state_valid (gpointer data)
+{
+  struct reliability *rd = data;
+
+  GtkTreeModel *liststore =
+    gtk_tree_view_get_model (GTK_TREE_VIEW (rd->variables));
+
+  return (2 <= gtk_tree_model_iter_n_children (liststore, NULL));
+}
+
+
+/* Pops up the Reliability dialog box */
+void
+reliability_dialog (GObject *o, gpointer data)
+{
+  struct reliability rd;
+  gint response;
+
+  GtkBuilder *xml = builder_new ("reliability.ui");
+  PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
+  PsppireVarStore *vs;
+
+  GtkWidget *dialog = get_widget_assert   (xml, "reliability-dialog");
+  GtkWidget *source = get_widget_assert   (xml, "dict-view");
+
+  GtkWidget *selector = get_widget_assert (xml, "psppire-selector1");
+
+  rd.split_point_hbox = get_widget_assert (xml, "split-point-hbox");
+
+  rd.variables = get_widget_assert   (xml, "treeview2");
+
+  rd.model_combo = get_widget_assert   (xml, "combobox1");
+  rd.split_spinbutton = get_widget_assert (xml, "spinbutton1");
+
+  g_signal_connect_swapped (rd.model_combo, "changed",
+                           G_CALLBACK (on_method_change), &rd);
+
+  g_object_get (de->data_editor, "var-store", &vs, NULL);
+
+  gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de));
+
+  g_object_set (source, "dictionary", vs->dict, NULL);
+
+  rd.dict = vs->dict;
+
+  set_dest_model (GTK_TREE_VIEW (rd.variables), vs->dict);
+
+  psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector),
+                                source,
+                                rd.variables,
+                                insert_source_row_into_tree_view,
+                                NULL,
+                                NULL);
+
+  {
+    GtkTreeModel *tm =
+      gtk_tree_view_get_model (GTK_TREE_VIEW (rd.variables));
+
+
+    g_signal_connect_swapped (tm, "row-inserted",
+                     G_CALLBACK (on_vars_changed), &rd);
+
+    g_signal_connect_swapped (tm, "row-deleted",
+                     G_CALLBACK (on_vars_changed), &rd);
+  }
+
+  g_signal_connect (dialog, "refresh", G_CALLBACK (refresh),  &rd);
+
+  psppire_dialog_set_valid_predicate (PSPPIRE_DIALOG (dialog),
+                                     dialog_state_valid, &rd);
+
+  response = psppire_dialog_run (PSPPIRE_DIALOG (dialog));
+
+
+  switch (response)
+    {
+    case GTK_RESPONSE_OK:
+      {
+       gchar *syntax = generate_syntax (&rd);
+
+       struct getl_interface *sss = create_syntax_string_source (syntax);
+       execute_syntax (sss);
+
+       g_free (syntax);
+      }
+      break;
+    case PSPPIRE_RESPONSE_PASTE:
+      {
+       gchar *syntax = generate_syntax (&rd);
+        paste_syntax_in_new_window (syntax);
+
+       g_free (syntax);
+      }
+      break;
+    default:
+      break;
+    }
+
+  g_object_unref (xml);
+}
+
+
+\f
+
+static char *
+generate_syntax (const struct reliability *rd)
+{
+  gchar *text;
+  GString *string = g_string_new ("RELIABILITY");
+
+  g_string_append (string, "\n\t/VARIABLES=");
+  append_variable_names (string, rd->dict, GTK_TREE_VIEW (rd->variables), 0);
+
+
+  g_string_append (string, "\n\t/MODEL=");
+
+  if ( 0 == gtk_combo_box_get_active (GTK_COMBO_BOX (rd->model_combo)))
+    g_string_append (string, "ALPHA");
+  else
+    g_string_append_printf (string, "SPLIT (%d)",
+                           gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (rd->split_spinbutton))
+                           );
+
+  g_string_append (string, ".\n");
+
+  text = string->str;
+
+  g_string_free (string, FALSE);
+
+  return text;
+}
diff --git a/src/ui/gui/reliability-dialog.h b/src/ui/gui/reliability-dialog.h
new file mode 100644 (file)
index 0000000..5e8bfbf
--- /dev/null
@@ -0,0 +1,25 @@
+/* PSPPIRE - a graphical user interface for PSPP.
+   Copyright (C) 2009  Free Software Foundation
+
+   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
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   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 <http://www.gnu.org/licenses/>. */
+
+#ifndef __RELIABILITY_DIALOG_H
+#define __RELIABILITY_DIALOG_H
+
+
+#include <gtk/gtk.h>
+
+void reliability_dialog (GObject *o, gpointer data);
+
+#endif
diff --git a/src/ui/gui/reliability.glade b/src/ui/gui/reliability.glade
new file mode 100644 (file)
index 0000000..fd10686
--- /dev/null
@@ -0,0 +1,184 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
+<!--Generated with glade3 3.4.5 on Fri Apr  3 12:11:45 2009 -->
+<glade-interface>
+  <requires lib="psppire"/>
+  <widget class="PsppireDialog" id="reliability-dialog">
+    <property name="title" translatable="yes">Reliability Analysis</property>
+    <property name="modal">True</property>
+    <child internal-child="hbox">
+      <widget class="GtkHBox" id="dialog-hbox1">
+        <property name="visible">True</property>
+        <child>
+          <widget class="GtkVBox" id="vbox1">
+            <property name="visible">True</property>
+            <property name="spacing">12</property>
+            <child>
+              <widget class="GtkHBox" id="hbox1">
+                <property name="visible">True</property>
+                <child>
+                  <widget class="GtkScrolledWindow" id="scrolledwindow1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+                    <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+                    <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
+                    <child>
+                      <widget class="PsppireDictView" id="dict-view">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="has_tooltip">True</property>
+                        <property name="border_width">5</property>
+                        <property name="headers_visible">False</property>
+                      </widget>
+                    </child>
+                  </widget>
+                </child>
+                <child>
+                  <widget class="GtkAlignment" id="alignment2">
+                    <property name="visible">True</property>
+                    <property name="xscale">0</property>
+                    <property name="yscale">0</property>
+                    <child>
+                      <widget class="PsppireSelector" id="psppire-selector1">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                        <property name="no_show_all">True</property>
+                        <property name="border_width">5</property>
+                        <property name="response_id">0</property>
+                      </widget>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkFrame" id="frame1">
+                    <property name="visible">True</property>
+                    <property name="label_xalign">0</property>
+                    <property name="shadow_type">GTK_SHADOW_NONE</property>
+                    <child>
+                      <widget class="GtkAlignment" id="alignment1">
+                        <property name="visible">True</property>
+                        <property name="left_padding">12</property>
+                        <child>
+                          <widget class="GtkScrolledWindow" id="scrolledwindow2">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+                            <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+                            <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
+                            <child>
+                              <widget class="GtkTreeView" id="treeview2">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="headers_visible">False</property>
+                              </widget>
+                            </child>
+                          </widget>
+                        </child>
+                      </widget>
+                    </child>
+                    <child>
+                      <widget class="GtkLabel" id="label1">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">_Items:</property>
+                        <property name="use_markup">True</property>
+                        <property name="use_underline">True</property>
+                      </widget>
+                      <packing>
+                        <property name="type">label_item</property>
+                      </packing>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="position">2</property>
+                  </packing>
+                </child>
+              </widget>
+            </child>
+            <child>
+              <widget class="GtkHBox" id="hbox2">
+                <property name="visible">True</property>
+                <child>
+                  <widget class="GtkLabel" id="">
+                    <property name="visible">True</property>
+                    <property name="xalign">1</property>
+                    <property name="label" translatable="yes">Model:   </property>
+                    <property name="justify">GTK_JUSTIFY_RIGHT</property>
+                  </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkComboBox" id="combobox1">
+                    <property name="visible">True</property>
+                    <property name="items" translatable="yes">Alpha
+Split</property>
+                  </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkHBox" id="split-point-hbox">
+                <property name="visible">True</property>
+                <property name="sensitive">False</property>
+                <property name="spacing">5</property>
+                <child>
+                  <widget class="GtkLabel" id="label2">
+                    <property name="visible">True</property>
+                    <property name="label" translatable="yes">Variables in first split:</property>
+                  </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkSpinButton" id="spinbutton1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="adjustment">0 0 100 1 10 10</property>
+                  </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+          </widget>
+        </child>
+        <child>
+          <widget class="PsppireVButtonBox" id="psppire-vbuttonbox1">
+            <property name="visible">True</property>
+            <property name="border_width">5</property>
+          </widget>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="pack_type">GTK_PACK_END</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </widget>
+    </child>
+  </widget>
+</glade-interface>
index 640f02e09a0c8c4391a18989ffe5d396750f23f0..b95de451a1cc03380e1dc38a9b864bc393650bb7 100644 (file)
@@ -7,8 +7,6 @@ src_ui_gui_sheet_libsheet_la_CFLAGS = $(GTK_CFLAGS)
 src_ui_gui_sheet_libsheet_la_SOURCES = \
        src/ui/gui/sheet/psppire-axis.c \
        src/ui/gui/sheet/psppire-axis.h \
-       src/ui/gui/sheet/psppire-axis-impl.c \
-       src/ui/gui/sheet/psppire-axis-impl.h \
        src/ui/gui/sheet/psppire-sheetmodel.c \
        src/ui/gui/sheet/psppire-sheetmodel.h
 
diff --git a/src/ui/gui/sheet/psppire-axis-impl.c b/src/ui/gui/sheet/psppire-axis-impl.c
deleted file mode 100644 (file)
index d129786..0000000
+++ /dev/null
@@ -1,470 +0,0 @@
-/* PSPPIRE - a graphical user interface for PSPP.
-   Copyright (C) 2008  Free Software Foundation
-
-   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
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   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 <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <libpspp/tower.h>
-#include <libpspp/pool.h>
-#include "psppire-axis-impl.h"
-#include <math.h>
-
-
-/* --- prototypes --- */
-static void psppire_axis_impl_class_init (PsppireAxisImplClass *class);
-static void psppire_axis_impl_init     (PsppireAxisImpl                *axis);
-static void psppire_axis_impl_finalize   (GObject              *object);
-
-
-/* --- variables --- */
-static GObjectClass     *parent_class = NULL;
-
-
-struct axis_node
-{
-  struct tower_node pixel_node;
-  struct tower_node unit_node;
-};
-
-void
-psppire_axis_impl_dump (const PsppireAxisImpl *a)
-{
-  struct tower_node *n = tower_first (&a->unit_tower);
-
-  g_debug ("Axis %p", a);
-  while (n)
-    {
-      const struct axis_node *an = tower_data (n, struct axis_node, unit_node);
-      const struct tower_node *pn = &an->pixel_node;
-      g_debug ("%ld units of height %g",
-              n->size, pn->size / (gdouble) n->size);
-
-      n =  tower_next (&a->unit_tower, n);
-    }
-  g_debug ("\n");
-}
-
-static gint
-unit_at_pixel (const PsppireAxis *axis, glong pixel)
-{
-  PsppireAxisImpl *a = PSPPIRE_AXIS_IMPL (axis);
-
-  unsigned long int start;
-  struct tower_node *n;
-  struct axis_node *an;
-  gdouble fraction;
-
-  g_return_val_if_fail (pixel >= 0, -1);
-
-  n = tower_lookup (&a->pixel_tower, pixel, &start);
-  an = tower_data (n, struct axis_node, pixel_node);
-
-  fraction = (pixel - start) / (gdouble) tower_node_get_size (&an->pixel_node);
-
-  return  tower_node_get_level (&an->unit_node)
-    + fraction * tower_node_get_size (&an->unit_node);
-}
-
-
-static gint
-unit_count (const PsppireAxis *axis)
-{
-  PsppireAxisImpl *a = PSPPIRE_AXIS_IMPL (axis);
-
-  return tower_height (&a->unit_tower);
-}
-
-
-/* Returns the pixel at the start of UNIT */
-static glong
-start_pixel (const PsppireAxis *axis, gint unit)
-{
-  gdouble fraction;
-  PsppireAxisImpl *a = PSPPIRE_AXIS_IMPL (axis);
-  struct tower_node *n ;
-  struct axis_node *an;
-
-  unsigned long int start;
-
-  if ( unit < 0)
-    return -1;
-
-  if ( unit >= unit_count (axis))
-    return -1;
-
-  n = tower_lookup (&a->unit_tower, unit, &start);
-
-  an = tower_data (n, struct axis_node, unit_node);
-
-  fraction = (unit - start) / (gdouble) tower_node_get_size (&an->unit_node);
-
-  return  tower_node_get_level (&an->pixel_node) +
-    nearbyint (fraction * tower_node_get_size (&an->pixel_node));
-}
-
-
-static gint
-unit_size (const PsppireAxis *axis, gint unit)
-{
-  PsppireAxisImpl *a = PSPPIRE_AXIS_IMPL (axis);
-  struct tower_node *n ;
-  struct axis_node *an;
-
-  unsigned long int start;
-
-  if ( unit < 0)
-    return 0;
-
-  if ( unit >= unit_count (axis))
-    return 0;
-
-  n = tower_lookup (&a->unit_tower, unit, &start);
-
-  an = tower_data (n, struct axis_node, unit_node);
-
-  return nearbyint (tower_node_get_size (&an->pixel_node)
-                    / (gdouble) tower_node_get_size (&an->unit_node));
-}
-
-
-static glong
-total_size (const PsppireAxis *axis)
-{
-  PsppireAxisImpl *a = PSPPIRE_AXIS_IMPL (axis);
-
-  return tower_height (&a->pixel_tower);
-}
-
-
-static void resize (PsppireAxis *axis, gint posn, glong size);
-
-
-
-static void
-psppire_impl_iface_init (PsppireAxisIface *iface)
-{
-  iface->unit_size = unit_size;
-  iface->unit_count = unit_count;
-  iface->start_pixel = start_pixel;
-  iface->unit_at_pixel = unit_at_pixel;
-  iface->total_size = total_size;
-  iface->resize = resize;
-}
-
-/* --- functions --- */
-/**
- * psppire_axis_impl_get_type:
- * @returns: the type ID for accelerator groups.
- */
-GType
-psppire_axis_impl_get_type (void)
-{
-  static GType object_type = 0;
-
-  if (!object_type)
-    {
-      static const GTypeInfo object_info = {
-       sizeof (PsppireAxisImplClass),
-       (GBaseInitFunc) NULL,
-       (GBaseFinalizeFunc) NULL,
-       (GClassInitFunc) psppire_axis_impl_class_init,
-       NULL,   /* class_finalize */
-       NULL,   /* class_data */
-       sizeof (PsppireAxisImpl),
-       0,      /* n_preallocs */
-       (GInstanceInitFunc) psppire_axis_impl_init,
-      };
-
-      static const GInterfaceInfo interface_info =
-      {
-       (GInterfaceInitFunc) psppire_impl_iface_init,
-       NULL,
-       NULL
-      };
-
-      object_type = g_type_register_static (G_TYPE_PSPPIRE_AXIS,
-                                           "PsppireAxisImpl",
-                                           &object_info, 0);
-
-      g_type_add_interface_static (object_type,
-                                  PSPPIRE_TYPE_AXIS_IFACE,
-                                  &interface_info);
-    }
-
-  return object_type;
-}
-
-static void
-psppire_axis_impl_class_init (PsppireAxisImplClass *class)
-{
-  GObjectClass *object_class = G_OBJECT_CLASS (class);
-  parent_class = g_type_class_peek_parent (class);
-
-  object_class->finalize = psppire_axis_impl_finalize;
-}
-
-
-static void
-psppire_axis_impl_init (PsppireAxisImpl *axis)
-{
-  tower_init (&axis->pixel_tower);
-  tower_init (&axis->unit_tower);
-
-  axis->pool = pool_create ();
-}
-
-
-static void
-psppire_axis_impl_finalize (GObject *object)
-{
-  PsppireAxisImpl *a = PSPPIRE_AXIS_IMPL (object);
-  pool_destroy (a->pool);
-
-  G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-/**
- * psppire_axis_impl_new:
- * @returns: a new #PsppireAxisImpl object
- *
- * Creates a new #PsppireAxisImpl.
- */
-PsppireAxisImpl*
-psppire_axis_impl_new (void)
-{
-  return g_object_new (G_TYPE_PSPPIRE_AXIS_IMPL, NULL);
-}
-
-
-\f
-
-void
-psppire_axis_impl_append (PsppireAxisImpl *a, gint size)
-{
-  psppire_axis_impl_append_n (a, 1, size);
-}
-
-
-void
-psppire_axis_impl_append_n (PsppireAxisImpl *a, gint n_units, gint size)
-{
-  struct axis_node *node;
-
-  if  (n_units == 0)
-    return;
-
-  node = pool_malloc (a->pool, sizeof *node);
-
-  tower_insert (&a->unit_tower, n_units, &node->unit_node, NULL);
-  tower_insert (&a->pixel_tower, size * n_units, &node->pixel_node, NULL);
-}
-
-
-/* Split the node of both towers at POSN */
-static void
-split (PsppireAxisImpl *a, gint posn)
-{
-  unsigned long int existing_unit_size;
-  unsigned long int existing_pixel_size;
-  unsigned long int start;
-  gdouble fraction;
-  struct axis_node *new_node ;
-  struct tower_node *n;
-  struct axis_node *existing_node;
-
-  g_return_if_fail (posn <= tower_height (&a->unit_tower));
-
-  /* Nothing needs to be done */
-  if ( posn == 0 || posn  == tower_height (&a->unit_tower))
-    return;
-
-  n = tower_lookup (&a->unit_tower, posn, &start);
-
-  existing_node = tower_data (n, struct axis_node, unit_node);
-
-  /* Nothing needs to be done, if the range element is already split here */
-  if ( posn - start == 0)
-    return;
-
-  existing_unit_size = tower_node_get_size (&existing_node->unit_node);
-  existing_pixel_size = tower_node_get_size (&existing_node->pixel_node);
-
-  fraction = (posn - start) / (gdouble) existing_unit_size;
-
-  new_node = pool_malloc (a->pool, sizeof (*new_node));
-
-  tower_resize (&a->unit_tower, &existing_node->unit_node, posn - start);
-
-  tower_resize (&a->pixel_tower, &existing_node->pixel_node,
-               nearbyintf (fraction * existing_pixel_size));
-
-  tower_insert (&a->unit_tower,
-               existing_unit_size - (posn - start),
-               &new_node->unit_node,
-               tower_next (&a->unit_tower, &existing_node->unit_node));
-
-
-  tower_insert (&a->pixel_tower,
-               nearbyintf (existing_pixel_size * (1 - fraction)),
-               &new_node->pixel_node,
-               tower_next (&a->pixel_tower, &existing_node->pixel_node));
-}
-
-
-/* Insert a new unit of size SIZE before POSN */
-void
-psppire_axis_impl_insert (PsppireAxisImpl *a, gint posn, gint size)
-{
-  struct axis_node *before = NULL;
-  struct axis_node *new_node;
-
-  g_return_if_fail ( posn >= 0);
-  g_return_if_fail ( posn <= tower_height (&a->unit_tower));
-
-  if ( posn < tower_height (&a->unit_tower))
-    {
-      unsigned long int start = 0;
-      struct tower_node *n;
-
-      split (a, posn);
-
-      n = tower_lookup (&a->unit_tower, posn, &start);
-      g_assert (posn == start);
-
-      before = tower_data (n, struct axis_node, unit_node);
-    }
-
-  new_node = pool_malloc (a->pool, sizeof (*new_node));
-
-  tower_insert (&a->unit_tower,
-               1,
-               &new_node->unit_node,
-               before ? &before->unit_node : NULL);
-
-  tower_insert (&a->pixel_tower,
-               size,
-               &new_node->pixel_node,
-               before ? &before->pixel_node : NULL);
-}
-
-
-/* Make the element at POSN singular.
-   Return a pointer to the node for this element */
-static struct axis_node *
-make_single (PsppireAxisImpl *a, gint posn)
-{
-  unsigned long int start;
-  struct tower_node *n;
-
-  g_return_val_if_fail (posn < tower_height (&a->unit_tower), NULL);
-
-  n = tower_lookup (&a->unit_tower, posn, &start);
-
-  if ( 1 != tower_node_get_size (n))
-    {
-      split (a, posn + 1);
-      n = tower_lookup (&a->unit_tower, posn, &start);
-
-      if ( 1 != tower_node_get_size (n))
-       {
-         split (a, posn);
-         n = tower_lookup (&a->unit_tower, posn, &start);
-       }
-    }
-
-  g_assert (1 == tower_node_get_size (n));
-
-  return tower_data (n, struct axis_node, unit_node);
-}
-
-
-static void
-resize (PsppireAxis *axis, gint posn, glong size)
-{
-  PsppireAxisImpl *a = PSPPIRE_AXIS_IMPL (axis);
-
-  struct axis_node *an;
-  g_return_if_fail (posn >= 0);
-  g_return_if_fail (size > 0);
-
-  /* Silently ignore this request if the position is greater than the number of
-     units in the axis */
-  if (posn >= tower_height (&a->unit_tower))
-    return ;
-
-  an = make_single (a, posn);
-
-  tower_resize (&a->pixel_tower, &an->pixel_node, size);
-}
-
-
-void
-psppire_axis_impl_resize (PsppireAxisImpl *a, gint posn, gint size)
-{
-  resize (PSPPIRE_AXIS (a), posn, size);
-}
-
-
-
-
-void
-psppire_axis_impl_clear (PsppireAxisImpl *a)
-{
-  pool_destroy (a->pool);
-  a->pool = pool_create ();
-
-  tower_init (&a->pixel_tower);
-  tower_init (&a->unit_tower);
-}
-
-
-
-void
-psppire_axis_impl_delete (PsppireAxisImpl *a, gint first, gint n_units)
-{
-  gint units_to_delete = n_units;
-  unsigned long int start;
-  struct tower_node *unit_node ;
-  g_return_if_fail (first + n_units <= tower_height (&a->unit_tower));
-
-  split (a, first);
-  split (a, first + n_units);
-
-  unit_node = tower_lookup (&a->unit_tower, first, &start);
-  g_assert (start == first);
-
-  while (units_to_delete > 0)
-    {
-      struct tower_node *next_unit_node;
-      struct axis_node *an = tower_data (unit_node,
-                                        struct axis_node, unit_node);
-
-      g_assert (unit_node == &an->unit_node);
-      g_assert (unit_node->size <= n_units);
-
-      units_to_delete -= unit_node->size;
-
-      next_unit_node = tower_next (&a->unit_tower, unit_node);
-
-      tower_delete (&a->unit_tower, unit_node);
-      tower_delete (&a->pixel_tower, &an->pixel_node);
-
-      pool_free (a->pool, an);
-
-      unit_node = next_unit_node;
-    }
-}
diff --git a/src/ui/gui/sheet/psppire-axis-impl.h b/src/ui/gui/sheet/psppire-axis-impl.h
deleted file mode 100644 (file)
index 84193ae..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-/* PSPPIRE - a graphical user interface for PSPP.
-   Copyright (C) 2008  Free Software Foundation
-
-   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
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   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 <http://www.gnu.org/licenses/>. */
-
-
-#ifndef PSPPIRE_AXIS_IMPL_H__
-#define PSPPIRE_AXIS_IMPL_H__
-
-
-#include <glib-object.h>
-#include <glib.h>
-
-#include "psppire-axis.h"
-#include <libpspp/tower.h>
-
-G_BEGIN_DECLS
-
-
-/* --- type macros --- */
-#define G_TYPE_PSPPIRE_AXIS_IMPL              (psppire_axis_impl_get_type ())
-#define PSPPIRE_AXIS_IMPL(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), G_TYPE_PSPPIRE_AXIS_IMPL, PsppireAxisImpl))
-#define PSPPIRE_AXIS_IMPL_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), G_TYPE_PSPPIRE_AXIS_IMPL, PsppireAxisImplClass))
-#define PSPPIRE_IS_AXIS_IMPL(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), G_TYPE_PSPPIRE_AXIS_IMPL))
-#define PSPPIRE_IS_AXIS_IMPL_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), G_TYPE_PSPPIRE_AXIS_IMPL))
-#define PSPPIRE_AXIS_IMPL_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), G_TYPE_PSPPIRE_AXIS_IMPL, PsppireAxisImplClass))
-
-
-
-/* --- typedefs & structures --- */
-typedef struct _PsppireAxisImpl           PsppireAxisImpl;
-typedef struct _PsppireAxisImplClass PsppireAxisImplClass;
-
-struct pool;
-
-struct _PsppireAxisImpl
-{
-  PsppireAxis  parent;
-
-  struct tower pixel_tower;
-  struct tower unit_tower;
-
-  struct pool *pool;
-};
-
-struct _PsppireAxisImplClass
-{
-  PsppireAxisClass parent_class;
-};
-
-GType          psppire_axis_impl_get_type (void);
-
-PsppireAxisImpl*   psppire_axis_impl_new (void);
-
-\f
-/* Interface between axis and model */
-
-
-
-void psppire_axis_impl_insert (PsppireAxisImpl *a, gint posn, gint size);
-
-void psppire_axis_impl_append (PsppireAxisImpl *a, gint size);
-
-
-void psppire_axis_impl_append_n (PsppireAxisImpl *a, gint n_units, gint size);
-
-void psppire_axis_impl_resize (PsppireAxisImpl *a, gint posn, gint size);
-
-void psppire_axis_impl_clear (PsppireAxisImpl *);
-
-
-void psppire_axis_impl_delete (PsppireAxisImpl *, gint first, gint n_cases);
-
-
-
-G_END_DECLS
-
-#endif /* PSPPIRE_AXIS_IMPL_H__ */
index 3aeea7c48c7ae15998af438323480733d4703e25..e229c9489f265fc84f2323084d7f1d8e6d260010 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPPIRE - a graphical user interface for PSPP.
-   Copyright (C) 2008  Free Software Foundation
+   Copyright (C) 2008, 2009  Free Software Foundation
 
    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
 #include <string.h>
 #include <stdlib.h>
 
+#include <ui/gui/psppire-marshal.h>
 #include <libpspp/tower.h>
 #include <libpspp/pool.h>
-#include <libpspp/misc.h>
 #include "psppire-axis.h"
-#include <ui/gui/psppire-marshal.h>
-#include <gtk/gtk.h>
-
+#include <math.h>
+#include <libpspp/misc.h>
 
 
 /* Signals */
@@ -36,58 +35,212 @@ enum
 
 static guint signals[n_signals] ;
 
+/* --- prototypes --- */
+static void psppire_axis_class_init (PsppireAxisClass  *class);
+static void psppire_axis_init  (PsppireAxis            *axis);
+static void psppire_axis_finalize   (GObject           *object);
 
-#define PSPPIRE_AXIS_GET_IFACE(obj) \
-  (G_TYPE_INSTANCE_GET_INTERFACE ((obj), PSPPIRE_TYPE_AXIS_IFACE, PsppireAxisIface))
 
-GType
-psppire_axis_iface_get_type (void)
+/* --- variables --- */
+static GObjectClass     *parent_class = NULL;
+
+
+struct axis_node
+{
+  struct tower_node pixel_node;
+  struct tower_node unit_node;
+};
+
+void
+psppire_axis_dump (const PsppireAxis *a)
 {
-  static GType psppire_axis_iface_type = 0;
+  struct tower_node *n = tower_first (&a->unit_tower);
 
-  if (! psppire_axis_iface_type)
+  g_debug ("Axis %p", a);
+  while (n)
     {
-      static const GTypeInfo psppire_axis_iface_info =
-      {
-        sizeof (PsppireAxisIface), /* class_size */
-       NULL,           /* base init */
-       NULL,           /* base_finalize */
-       NULL,
-       NULL,           /* class_finalize */
-       NULL,           /* class_data */
-       0,
-       0,              /* n_preallocs */
-       NULL
-      };
+      const struct axis_node *an = tower_data (n, struct axis_node, unit_node);
+      const struct tower_node *pn = &an->pixel_node;
+      g_debug ("%ld units of height %g",
+              n->size, pn->size / (gdouble) n->size);
 
-      psppire_axis_iface_type =
-       g_type_register_static (G_TYPE_INTERFACE, "PsppireAxisIface",
-                               &psppire_axis_iface_info, 0);
+      n =  tower_next (&a->unit_tower, n);
     }
+  g_debug ("\n");
+}
+
+/* Increment the size of every unit by INC.
+   Note that INC is signed. So if INC is negative,
+   then size will end up smaller.
+*/
+static void
+axis_increment (PsppireAxis *axis, gint inc)
+{
+  struct tower_node *n = tower_first (&axis->pixel_tower);
 
-  return psppire_axis_iface_type;
+  while (n)
+    {
+      struct axis_node *an = tower_data (n, struct axis_node, pixel_node);
+      struct tower_node *pn = &an->pixel_node;
+      const gint existing_size = tower_node_get_size (pn);
+
+      tower_resize (&axis->pixel_tower, pn, existing_size + inc *
+                   tower_node_get_size (&an->unit_node));
+
+      n = tower_next (&axis->pixel_tower, n);
+    }
 }
 
-G_DEFINE_ABSTRACT_TYPE(PsppireAxis, psppire_axis, G_TYPE_OBJECT);
 
+/* Return the unit covered by PIXEL */
+gint
+psppire_axis_unit_at_pixel (const PsppireAxis *a, glong pixel)
+{
+  unsigned long int start;
+  struct tower_node *n;
+  struct axis_node *an;
+  gdouble fraction;
 
+  glong size = tower_height (&a->pixel_tower);
 
-/* --- prototypes --- */
-static void psppire_axis_class_init (PsppireAxisClass  *class);
-static void psppire_axis_init  (PsppireAxis            *axis);
-static void psppire_axis_finalize   (GObject           *object);
+  g_return_val_if_fail (pixel >= 0, -1);
 
+  if (pixel >= size)
+    {
+      gint n_items = tower_height (&a->unit_tower);
+      glong extra = pixel - size;
 
-/* --- variables --- */
-static GObjectClass     *parent_class = NULL;
+      return n_items - 1 + DIV_RND_UP (extra,  a->default_size);
+    }
+
+
+  n = tower_lookup (&a->pixel_tower, pixel, &start);
+  an = tower_data (n, struct axis_node, pixel_node);
+
+  fraction = (pixel - start) / (gdouble) tower_node_get_size (&an->pixel_node);
+
+  return  tower_node_get_level (&an->unit_node)
+    + fraction * tower_node_get_size (&an->unit_node);
+}
+
+
+gint
+psppire_axis_unit_count (const PsppireAxis *a)
+{
+  glong filler = 0;
+  glong actual_size;
+
+  actual_size = tower_height (&a->pixel_tower);
+
+  if ( actual_size < a->min_extent )
+    filler = DIV_RND_UP (a->min_extent - actual_size, a->default_size);
+
+  return tower_height (&a->unit_tower) + filler;
+}
+
+
+/* Return the starting pixel of UNIT */
+glong
+psppire_axis_start_pixel (const PsppireAxis *a, gint unit)
+{
+  gdouble fraction;
+  struct tower_node *n ;
+  struct axis_node *an;
+
+  unsigned long int start;
+
+  gint the_count, size ;
+
+  the_count =  tower_height (&a->unit_tower);
+  size = tower_height (&a->pixel_tower);
+
+  if ( unit >= the_count)
+    {
+      return  size + (unit - the_count) * a->default_size;
+    }
+
+  if ( unit < 0)
+    return -1;
+
+  if ( unit >= tower_height (&a->unit_tower))
+    return -1;
+
+  n = tower_lookup (&a->unit_tower, unit, &start);
+
+  an = tower_data (n, struct axis_node, unit_node);
+
+  fraction = (unit - start) / (gdouble) tower_node_get_size (&an->unit_node);
+
+  return  tower_node_get_level (&an->pixel_node) +
+    nearbyint (fraction * tower_node_get_size (&an->pixel_node));
+}
+
+gint
+psppire_axis_unit_size (const PsppireAxis *axis, gint unit)
+{
+  struct tower_node *n ;
+  struct axis_node *an;
+
+  unsigned long int start;
+
+  if  (unit >= tower_height (&axis->unit_tower))
+    return axis->default_size;
+
+  if ( unit < 0)
+    return 0;
+
+  if ( unit >= tower_height (&axis->unit_tower))
+    return 0;
+
+  n = tower_lookup (&axis->unit_tower, unit, &start);
+
+  an = tower_data (n, struct axis_node, unit_node);
+
+  return nearbyint (tower_node_get_size (&an->pixel_node)
+                    / (gdouble) tower_node_get_size (&an->unit_node));
+}
+
+
+
+/* --- functions --- */
+/**
+ * psppire_axis_get_type:
+ * @returns: the type ID for accelerator groups.
+ */
+GType
+psppire_axis_get_type (void)
+{
+  static GType object_type = 0;
+
+  if (!object_type)
+    {
+      static const GTypeInfo object_info = {
+       sizeof (PsppireAxisClass),
+       (GBaseInitFunc) NULL,
+       (GBaseFinalizeFunc) NULL,
+       (GClassInitFunc) psppire_axis_class_init,
+       NULL,   /* class_finalize */
+       NULL,   /* class_data */
+       sizeof (PsppireAxis),
+       0,      /* n_preallocs */
+       (GInstanceInitFunc) psppire_axis_init,
+      };
+
+      object_type = g_type_register_static (G_TYPE_OBJECT,
+                                           "PsppireAxis",
+                                           &object_info, 0);
 
+    }
 
+  return object_type;
+}
 
 enum
   {
     PROP_0,
     PROP_MIN_EXTENT,
-    PROP_DEFAULT_SIZE
+    PROP_DEFAULT_SIZE,
+    PROP_PADDING
   };
 
 
@@ -101,6 +254,9 @@ psppire_axis_get_property (GObject         *object,
 
   switch (prop_id)
     {
+    case PROP_PADDING:
+      g_value_set_int (value, axis->padding);
+      break;
     case PROP_MIN_EXTENT:
       g_value_set_long (value, axis->min_extent);
       break;
@@ -124,6 +280,13 @@ psppire_axis_set_property (GObject         *object,
 
   switch (prop_id)
     {
+    case PROP_PADDING:
+      {
+       const gint old_value = axis->padding;
+       axis->padding = g_value_get_int (value);
+       axis_increment (axis, axis->padding - old_value);
+      }
+      break;
     case PROP_MIN_EXTENT:
       axis->min_extent = g_value_get_long (value);
       break;
@@ -136,16 +299,22 @@ psppire_axis_set_property (GObject         *object,
     };
 }
 
+
 static void
 psppire_axis_class_init (PsppireAxisClass *class)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (class);
+
+  GParamSpec *padding_spec;
   GParamSpec *min_extent_spec;
   GParamSpec *default_size_spec;
 
+  parent_class = g_type_class_peek_parent (class);
+
   object_class->set_property = psppire_axis_set_property;
   object_class->get_property = psppire_axis_get_property;
 
+
   min_extent_spec =
     g_param_spec_long ("minimum-extent",
                       "Minimum Extent",
@@ -172,9 +341,19 @@ psppire_axis_class_init (PsppireAxisClass *class)
                                    PROP_DEFAULT_SIZE,
                                    default_size_spec);
 
-  parent_class = g_type_class_peek_parent (class);
+  padding_spec =
+    g_param_spec_int ("padding",
+                     "Padding",
+                     "Extra space implicitly added to each unit",
+                     0, G_MAXINT,
+                     0,
+                     G_PARAM_CONSTRUCT | G_PARAM_WRITABLE | G_PARAM_READABLE );
+
+
+  g_object_class_install_property (object_class,
+                                   PROP_PADDING,
+                                   padding_spec);
 
-  object_class->finalize = psppire_axis_finalize;
 
 
   signals[RESIZE_UNIT] =
@@ -189,113 +368,267 @@ psppire_axis_class_init (PsppireAxisClass *class)
                  G_TYPE_INT,
                  G_TYPE_LONG
                  );
+
+
+  object_class->finalize = psppire_axis_finalize;
 }
 
 
 static void
 psppire_axis_init (PsppireAxis *axis)
 {
+  tower_init (&axis->pixel_tower);
+  tower_init (&axis->unit_tower);
+
+  axis->pool = pool_create ();
+  axis->padding = 0;
 }
 
 
 static void
 psppire_axis_finalize (GObject *object)
 {
+  PsppireAxis *a = PSPPIRE_AXIS (object);
+  pool_destroy (a->pool);
+
   G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
-gint
-psppire_axis_unit_size (const PsppireAxis *a, gint unit)
+/**
+ * psppire_axis_new:
+ * @returns: a new #PsppireAxis object
+ *
+ * Creates a new #PsppireAxis.
+ */
+PsppireAxis*
+psppire_axis_new (void)
+{
+  return g_object_new (G_TYPE_PSPPIRE_AXIS, NULL);
+}
+
+
+\f
+
+void
+psppire_axis_append (PsppireAxis *a, gint size)
 {
-  g_return_val_if_fail (PSPPIRE_IS_AXIS (a), -1);
+  psppire_axis_append_n (a, 1, size);
+}
+
 
-  g_return_val_if_fail (PSPPIRE_AXIS_GET_IFACE (a)->unit_size, -1);
+/* Append N_UNITS of size SIZE to A.
+   The value of the "padding" property will be added to SIZE
+   unit before appending.
+*/
+void
+psppire_axis_append_n (PsppireAxis *a, gint n_units, gint size)
+{
+  struct axis_node *node;
 
+  if  (n_units == 0)
+    return;
 
-  if  (unit >= PSPPIRE_AXIS_GET_IFACE (a)->unit_count(a))
-    return a->default_size;
+  node = pool_malloc (a->pool, sizeof *node);
 
-  return PSPPIRE_AXIS_GET_IFACE (a)->unit_size (a, unit);
+  tower_insert (&a->unit_tower, n_units, &node->unit_node, NULL);
+  tower_insert (&a->pixel_tower, (size + a->padding) * n_units,
+    &node->pixel_node, NULL);
 }
 
-gint
-psppire_axis_unit_count (const PsppireAxis *a)
+
+/* Split the node of both towers at POSN */
+static void
+split (PsppireAxis *a, gint posn)
 {
-  glong padding = 0;
-  glong actual_size;
+  unsigned long int existing_unit_size;
+  unsigned long int existing_pixel_size;
+  unsigned long int start;
+  gdouble fraction;
+  struct axis_node *new_node ;
+  struct tower_node *n;
+  struct axis_node *existing_node;
 
-  g_return_val_if_fail (PSPPIRE_IS_AXIS (a), -1);
-  g_return_val_if_fail (PSPPIRE_AXIS_GET_IFACE (a)->unit_count, -1);
+  g_return_if_fail (posn <= tower_height (&a->unit_tower));
 
-  actual_size = PSPPIRE_AXIS_GET_IFACE (a)->total_size (a);
+  /* Nothing needs to be done */
+  if ( posn == 0 || posn  == tower_height (&a->unit_tower))
+    return;
 
-  if ( actual_size < a->min_extent )
-    padding = DIV_RND_UP (a->min_extent - actual_size, a->default_size);
+  n = tower_lookup (&a->unit_tower, posn, &start);
+
+  existing_node = tower_data (n, struct axis_node, unit_node);
+
+  /* Nothing needs to be done, if the range element is already split here */
+  if ( posn - start == 0)
+    return;
+
+  existing_unit_size = tower_node_get_size (&existing_node->unit_node);
+  existing_pixel_size = tower_node_get_size (&existing_node->pixel_node);
+
+  fraction = (posn - start) / (gdouble) existing_unit_size;
+
+  new_node = pool_malloc (a->pool, sizeof (*new_node));
+
+  tower_resize (&a->unit_tower, &existing_node->unit_node, posn - start);
 
-  return PSPPIRE_AXIS_GET_IFACE (a)->unit_count (a) + padding;
+  tower_resize (&a->pixel_tower, &existing_node->pixel_node,
+               nearbyintf (fraction * existing_pixel_size));
+
+  tower_insert (&a->unit_tower,
+               existing_unit_size - (posn - start),
+               &new_node->unit_node,
+               tower_next (&a->unit_tower, &existing_node->unit_node));
+
+
+  tower_insert (&a->pixel_tower,
+               nearbyintf (existing_pixel_size * (1 - fraction)),
+               &new_node->pixel_node,
+               tower_next (&a->pixel_tower, &existing_node->pixel_node));
 }
 
 
-/* Return the starting pixel of UNIT */
-glong
-psppire_axis_start_pixel (const PsppireAxis *a, gint unit)
+/* Insert a new unit of size SIZE before POSN.
+   The value of the "padding" property will be added to SIZE before
+   the unit is inserted.
+ */
+void
+psppire_axis_insert (PsppireAxis *a, gint posn, gint size)
 {
-  gint the_count, total_size ;
-  g_return_val_if_fail (PSPPIRE_IS_AXIS (a), -1);
+  struct axis_node *before = NULL;
+  struct axis_node *new_node;
 
-  the_count =  PSPPIRE_AXIS_GET_IFACE (a)->unit_count (a);
-  total_size = PSPPIRE_AXIS_GET_IFACE (a)->total_size (a);
+  g_return_if_fail ( posn >= 0);
+  g_return_if_fail ( posn <= tower_height (&a->unit_tower));
 
-  if ( unit >= the_count)
+  if ( posn < tower_height (&a->unit_tower))
     {
-      return  total_size + (unit - the_count) * a->default_size;
+      unsigned long int start = 0;
+      struct tower_node *n;
+
+      split (a, posn);
+
+      n = tower_lookup (&a->unit_tower, posn, &start);
+      g_assert (posn == start);
+
+      before = tower_data (n, struct axis_node, unit_node);
     }
 
-  return PSPPIRE_AXIS_GET_IFACE (a)->start_pixel (a, unit);
-}
+  new_node = pool_malloc (a->pool, sizeof (*new_node));
 
+  tower_insert (&a->unit_tower,
+               1,
+               &new_node->unit_node,
+               before ? &before->unit_node : NULL);
 
-/* Return the unit covered by PIXEL */
-gint
-psppire_axis_unit_at_pixel (const PsppireAxis *a, glong pixel)
-{
-  glong total_size;
+  tower_insert (&a->pixel_tower,
+               size + a->padding,
+               &new_node->pixel_node,
+               before ? &before->pixel_node : NULL);
+}
 
-  g_return_val_if_fail (PSPPIRE_IS_AXIS (a), -1);
 
-  g_return_val_if_fail (PSPPIRE_AXIS_GET_IFACE (a), -1);
+/* Make the element at POSN singular.
+   Return a pointer to the node for this element */
+static struct axis_node *
+make_single (PsppireAxis *a, gint posn)
+{
+  unsigned long int start;
+  struct tower_node *n;
 
-  g_return_val_if_fail (PSPPIRE_AXIS_GET_IFACE (a)->unit_at_pixel, -1);
+  g_return_val_if_fail (posn < tower_height (&a->unit_tower), NULL);
 
-  total_size = PSPPIRE_AXIS_GET_IFACE (a)->total_size (a);
+  n = tower_lookup (&a->unit_tower, posn, &start);
 
-  if (pixel >= total_size)
+  if ( 1 != tower_node_get_size (n))
     {
-      gint n_items = PSPPIRE_AXIS_GET_IFACE (a)->unit_count (a);
-      glong extra = pixel - total_size;
-
-      return n_items - 1 + DIV_RND_UP (extra,  a->default_size);
+      split (a, posn + 1);
+      n = tower_lookup (&a->unit_tower, posn, &start);
+
+      if ( 1 != tower_node_get_size (n))
+       {
+         split (a, posn);
+         n = tower_lookup (&a->unit_tower, posn, &start);
+       }
     }
 
-  return PSPPIRE_AXIS_GET_IFACE (a)->unit_at_pixel (a, pixel);
+  g_assert (1 == tower_node_get_size (n));
+
+  return tower_data (n, struct axis_node, unit_node);
 }
 
 
-/* Set UNIT to size SIZE */
+/*
+  Set the size of the unit at POSN to be SIZE plus the
+  current value of "padding"
+ */
 void
-psppire_axis_resize (PsppireAxis *a, gint unit, glong size)
+psppire_axis_resize (PsppireAxis *axis, gint posn, glong size)
 {
-  g_return_if_fail (PSPPIRE_IS_AXIS (a));
+  struct axis_node *an;
+  g_return_if_fail (posn >= 0);
+  g_return_if_fail (size > 0);
 
-  g_return_if_fail (PSPPIRE_AXIS_GET_IFACE (a));
+  /* Silently ignore this request if the position is greater than the number of
+     units in the axis */
+  if (posn >= tower_height (&axis->unit_tower))
+    return ;
 
-  g_return_if_fail (size > 0);
+  an = make_single (axis, posn);
 
-  if (PSPPIRE_AXIS_GET_IFACE (a)->resize)
-    PSPPIRE_AXIS_GET_IFACE (a)->resize (a, unit, size);
+  tower_resize (&axis->pixel_tower, &an->pixel_node, size + axis->padding);
 
+  g_signal_emit (axis, signals[RESIZE_UNIT], 0, posn, size + axis->padding);
+}
 
-  g_signal_emit (a, signals [RESIZE_UNIT], 0, unit, size);
+
+
+
+
+
+void
+psppire_axis_clear (PsppireAxis *a)
+{
+  pool_destroy (a->pool);
+  a->pool = pool_create ();
+
+  tower_init (&a->pixel_tower);
+  tower_init (&a->unit_tower);
 }
 
 
+
+void
+psppire_axis_delete (PsppireAxis *a, gint first, gint n_units)
+{
+  gint units_to_delete = n_units;
+  unsigned long int start;
+  struct tower_node *unit_node ;
+  g_return_if_fail (first + n_units <= tower_height (&a->unit_tower));
+
+  split (a, first);
+  split (a, first + n_units);
+
+  unit_node = tower_lookup (&a->unit_tower, first, &start);
+  g_assert (start == first);
+
+  while (units_to_delete > 0)
+    {
+      struct tower_node *next_unit_node;
+      struct axis_node *an = tower_data (unit_node,
+                                        struct axis_node, unit_node);
+
+      g_assert (unit_node == &an->unit_node);
+      g_assert (unit_node->size <= n_units);
+
+      units_to_delete -= unit_node->size;
+
+      next_unit_node = tower_next (&a->unit_tower, unit_node);
+
+      tower_delete (&a->unit_tower, unit_node);
+      tower_delete (&a->pixel_tower, &an->pixel_node);
+
+      pool_free (a->pool, an);
+
+      unit_node = next_unit_node;
+    }
+}
index 3836ecf05175eda01a0e31374003c5f4a4d163eb..50a6a39dc2e7687f3fb6740d4a5b768c2c9d4a7d 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPPIRE - a graphical user interface for PSPP.
-   Copyright (C) 2008  Free Software Foundation
+   Copyright (C) 2008, 2009  Free Software Foundation
 
    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
 
 #include <glib-object.h>
 #include <glib.h>
+#include <libpspp/tower.h>
 
 G_BEGIN_DECLS
 
 
-
 /* --- type macros --- */
 #define G_TYPE_PSPPIRE_AXIS              (psppire_axis_get_type ())
 #define PSPPIRE_AXIS(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), G_TYPE_PSPPIRE_AXIS, PsppireAxis))
@@ -35,16 +35,25 @@ G_BEGIN_DECLS
 #define PSPPIRE_AXIS_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), G_TYPE_PSPPIRE_AXIS, PsppireAxisClass))
 
 
+
 /* --- typedefs & structures --- */
 typedef struct _PsppireAxis       PsppireAxis;
 typedef struct _PsppireAxisClass PsppireAxisClass;
 
+struct pool;
+
 struct _PsppireAxis
 {
-  GObject             parent;
+  GObject  parent;
+
+  struct tower pixel_tower;
+  struct tower unit_tower;
+
+  struct pool *pool;
 
   glong min_extent;
   gint default_size;
+  gint padding;
 };
 
 struct _PsppireAxisClass
@@ -52,52 +61,31 @@ struct _PsppireAxisClass
   GObjectClass parent_class;
 };
 
-
 GType          psppire_axis_get_type (void);
 
+PsppireAxis*   psppire_axis_new (void);
 
 \f
+/* Interface between axis and model */
 
-GType psppire_axis_iface_get_type (void);
-
-#define PSPPIRE_TYPE_AXIS_IFACE (psppire_axis_iface_get_type ())
-
-typedef struct _PsppireAxisIface PsppireAxisIface;
-
-struct _PsppireAxisIface
-{
-  GTypeInterface g_iface;
-
+void psppire_axis_insert (PsppireAxis *a, gint posn, gint size);
 
-  /* Virtual Table */
+void psppire_axis_append (PsppireAxis *a, gint size);
 
-  gint  (*unit_size) (const PsppireAxis *a, gint unit);
+void psppire_axis_append_n (PsppireAxis *a, gint n_units, gint size);
 
-  gint  (*unit_count) (const PsppireAxis *a);
+void psppire_axis_resize (PsppireAxis *a, gint posn, glong size);
 
-  glong (*start_pixel) (const PsppireAxis *a, gint unit);
+void psppire_axis_clear (PsppireAxis *);
 
-  gint  (*unit_at_pixel) (const PsppireAxis *a, glong pixel);
+void psppire_axis_delete (PsppireAxis *, gint first, gint n_cases);
 
-  glong (*total_size) (const PsppireAxis *a);
-
-
-  void (*resize) (PsppireAxis *a, gint unit, glong pixels);
-};
-
-
-/* Interface between sheet and axis */
-
-gint psppire_axis_unit_size (const PsppireAxis *a, gint unit);
-
-gint psppire_axis_unit_count (const PsppireAxis *a);
+\f
 
+gint  psppire_axis_unit_count (const PsppireAxis *);
 glong psppire_axis_start_pixel (const PsppireAxis *a, gint unit);
-
-gint psppire_axis_unit_at_pixel (const PsppireAxis *a, glong pixel);
-
-
-void psppire_axis_resize (PsppireAxis *a, gint unit, glong size);
+gint  psppire_axis_unit_size (const PsppireAxis *a, gint unit);
+gint  psppire_axis_unit_at_pixel (const PsppireAxis *a, glong pixel);
 
 G_END_DECLS
 
index c12790bb9f0a79ff2b5ea3cc184cd4333f5ff60a..658ca0a4924694553d1c7ff352e61efca2728767 100644 (file)
                 <property name="column_spacing">2</property>
                 <property name="row_spacing">1</property>
                 <child>
-                  <widget class="GtkLabel" id="decimals_label">
+                  <widget class="GtkHBox" id="hbox2">
                     <property name="visible">True</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes">Decimal Places:</property>
-                    <property name="justify">GTK_JUSTIFY_RIGHT</property>
+                    <child>
+                      <widget class="GtkLabel" id="width_label">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">Width:</property>
+                        <property name="justify">GTK_JUSTIFY_RIGHT</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="pack_type">GTK_PACK_END</property>
+                      </packing>
+                    </child>
                   </widget>
                   <packing>
-                    <property name="top_attach">1</property>
-                    <property name="bottom_attach">2</property>
                     <property name="x_options">GTK_FILL</property>
-                    <property name="y_options"></property>
+                    <property name="y_options">GTK_FILL</property>
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkEntry" id="width_entry">
+                  <widget class="GtkEntry" id="decimals_entry">
                     <property name="width_request">25</property>
+                    <property name="visible">True</property>
                     <property name="can_focus">True</property>
                   </widget>
                   <packing>
                     <property name="left_attach">1</property>
                     <property name="right_attach">2</property>
+                    <property name="top_attach">1</property>
+                    <property name="bottom_attach">2</property>
                     <property name="y_options"></property>
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkEntry" id="decimals_entry">
+                  <widget class="GtkEntry" id="width_entry">
                     <property name="width_request">25</property>
-                    <property name="visible">True</property>
                     <property name="can_focus">True</property>
                   </widget>
                   <packing>
                     <property name="left_attach">1</property>
                     <property name="right_attach">2</property>
-                    <property name="top_attach">1</property>
-                    <property name="bottom_attach">2</property>
                     <property name="y_options"></property>
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkHBox" id="hbox2">
+                  <widget class="GtkLabel" id="decimals_label">
                     <property name="visible">True</property>
-                    <child>
-                      <widget class="GtkLabel" id="width_label">
-                        <property name="visible">True</property>
-                        <property name="label" translatable="yes">Width:</property>
-                        <property name="justify">GTK_JUSTIFY_RIGHT</property>
-                      </widget>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">False</property>
-                        <property name="pack_type">GTK_PACK_END</property>
-                      </packing>
-                    </child>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">Decimal Places:</property>
+                    <property name="justify">GTK_JUSTIFY_RIGHT</property>
                   </widget>
                   <packing>
+                    <property name="top_attach">1</property>
+                    <property name="bottom_attach">2</property>
                     <property name="x_options">GTK_FILL</property>
-                    <property name="y_options">GTK_FILL</property>
+                    <property name="y_options"></property>
                   </packing>
                 </child>
               </widget>
                     <property name="n_columns">2</property>
                     <property name="row_spacing">5</property>
                     <child>
-                      <widget class="GtkVButtonBox" id="vbuttonbox2">
+                      <widget class="GtkScrolledWindow" id="scrolledwindow3">
                         <property name="visible">True</property>
-                        <property name="border_width">5</property>
-                        <child>
-                          <widget class="GtkButton" id="val_labs_add">
-                            <property name="visible">True</property>
-                            <property name="sensitive">False</property>
-                            <property name="can_focus">True</property>
-                            <property name="can_default">True</property>
-                            <property name="label">gtk-add</property>
-                            <property name="use_stock">True</property>
-                            <property name="response_id">0</property>
-                          </widget>
-                        </child>
+                        <property name="can_focus">True</property>
+                        <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+                        <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+                        <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
                         <child>
-                          <widget class="GtkButton" id="val_labs_change">
+                          <widget class="GtkTreeView" id="treeview1">
                             <property name="visible">True</property>
-                            <property name="sensitive">False</property>
                             <property name="can_focus">True</property>
-                            <property name="can_default">True</property>
-                            <property name="label">gtk-apply</property>
-                            <property name="use_stock">True</property>
-                            <property name="response_id">0</property>
+                            <property name="headers_visible">False</property>
+                            <property name="enable_search">False</property>
                           </widget>
-                          <packing>
-                            <property name="position">1</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <widget class="GtkButton" id="val_labs_remove">
-                            <property name="visible">True</property>
-                            <property name="sensitive">False</property>
-                            <property name="can_focus">True</property>
-                            <property name="can_default">True</property>
-                            <property name="label">gtk-remove</property>
-                            <property name="use_stock">True</property>
-                            <property name="response_id">0</property>
-                          </widget>
-                          <packing>
-                            <property name="position">2</property>
-                          </packing>
                         </child>
                       </widget>
                       <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
                         <property name="top_attach">1</property>
                         <property name="bottom_attach">2</property>
                         <property name="x_options">GTK_FILL</property>
+                        <property name="y_options">GTK_FILL</property>
                       </packing>
                     </child>
                     <child>
                         <property name="column_spacing">5</property>
                         <property name="row_spacing">4</property>
                         <child>
-                          <widget class="GtkLabel" id="label5">
+                          <widget class="GtkHBox" id="hbox4">
                             <property name="visible">True</property>
-                            <property name="xalign">0</property>
-                            <property name="label" translatable="yes">Value:</property>
+                            <child>
+                              <widget class="GtkEntry" id="value_entry">
+                                <property name="width_request">85</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                              </widget>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="padding">1</property>
+                              </packing>
+                            </child>
                           </widget>
                           <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
                             <property name="x_options">GTK_FILL</property>
-                            <property name="y_options"></property>
+                            <property name="y_options">GTK_FILL</property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkLabel" id="label6">
+                          <widget class="GtkEntry" id="label_entry">
                             <property name="visible">True</property>
-                            <property name="xalign">0</property>
-                            <property name="label" translatable="yes">Value Label:</property>
+                            <property name="can_focus">True</property>
                           </widget>
                           <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
                             <property name="top_attach">1</property>
                             <property name="bottom_attach">2</property>
-                            <property name="x_options">GTK_FILL</property>
                             <property name="y_options"></property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkEntry" id="label_entry">
+                          <widget class="GtkLabel" id="label6">
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">Value Label:</property>
                           </widget>
                           <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
                             <property name="top_attach">1</property>
                             <property name="bottom_attach">2</property>
+                            <property name="x_options">GTK_FILL</property>
                             <property name="y_options"></property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkHBox" id="hbox4">
+                          <widget class="GtkLabel" id="label5">
                             <property name="visible">True</property>
-                            <child>
-                              <widget class="GtkEntry" id="value_entry">
-                                <property name="width_request">85</property>
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                              </widget>
-                              <packing>
-                                <property name="expand">False</property>
-                                <property name="fill">False</property>
-                                <property name="padding">1</property>
-                              </packing>
-                            </child>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">Value:</property>
                           </widget>
                           <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
                             <property name="x_options">GTK_FILL</property>
-                            <property name="y_options">GTK_FILL</property>
+                            <property name="y_options"></property>
                           </packing>
                         </child>
                       </widget>
                       </packing>
                     </child>
                     <child>
-                      <widget class="GtkScrolledWindow" id="scrolledwindow3">
+                      <widget class="GtkVButtonBox" id="vbuttonbox2">
                         <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
-                        <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
-                        <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
+                        <property name="border_width">5</property>
                         <child>
-                          <widget class="GtkTreeView" id="treeview1">
+                          <widget class="GtkButton" id="val_labs_add">
                             <property name="visible">True</property>
+                            <property name="sensitive">False</property>
                             <property name="can_focus">True</property>
-                            <property name="headers_visible">False</property>
-                            <property name="enable_search">False</property>
+                            <property name="can_default">True</property>
+                            <property name="label">gtk-add</property>
+                            <property name="use_stock">True</property>
+                            <property name="response_id">0</property>
+                          </widget>
+                        </child>
+                        <child>
+                          <widget class="GtkButton" id="val_labs_change">
+                            <property name="visible">True</property>
+                            <property name="sensitive">False</property>
+                            <property name="can_focus">True</property>
+                            <property name="can_default">True</property>
+                            <property name="label">gtk-apply</property>
+                            <property name="use_stock">True</property>
+                            <property name="response_id">0</property>
+                          </widget>
+                          <packing>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkButton" id="val_labs_remove">
+                            <property name="visible">True</property>
+                            <property name="sensitive">False</property>
+                            <property name="can_focus">True</property>
+                            <property name="can_default">True</property>
+                            <property name="label">gtk-remove</property>
+                            <property name="use_stock">True</property>
+                            <property name="response_id">0</property>
                           </widget>
+                          <packing>
+                            <property name="position">2</property>
+                          </packing>
                         </child>
                       </widget>
                       <packing>
-                        <property name="left_attach">1</property>
-                        <property name="right_attach">2</property>
                         <property name="top_attach">1</property>
                         <property name="bottom_attach">2</property>
                         <property name="x_options">GTK_FILL</property>
-                        <property name="y_options">GTK_FILL</property>
                       </packing>
                     </child>
                   </widget>
                     <property name="column_spacing">6</property>
                     <property name="row_spacing">6</property>
                     <child>
-                      <widget class="GtkEntry" id="mv-discrete">
+                      <widget class="GtkLabel" id="label11">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">_Low:</property>
+                        <property name="use_underline">True</property>
+                        <property name="mnemonic_widget">mv-low</property>
+                      </widget>
+                    </child>
+                    <child>
+                      <widget class="GtkEntry" id="mv-low">
                         <property name="width_request">75</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                       <packing>
                         <property name="left_attach">1</property>
                         <property name="right_attach">2</property>
-                        <property name="top_attach">2</property>
-                        <property name="bottom_attach">3</property>
                       </packing>
                     </child>
                     <child>
-                      <widget class="GtkLabel" id="label10">
+                      <widget class="GtkLabel" id="label12">
                         <property name="visible">True</property>
-                        <property name="label" translatable="yes">Di_screte value:</property>
+                        <property name="label" translatable="yes">_High:</property>
                         <property name="use_underline">True</property>
-                        <property name="mnemonic_widget">mv-discrete</property>
+                        <property name="mnemonic_widget">mv-high</property>
                       </widget>
                       <packing>
-                        <property name="top_attach">2</property>
-                        <property name="bottom_attach">3</property>
+                        <property name="top_attach">1</property>
+                        <property name="bottom_attach">2</property>
                       </packing>
                     </child>
                     <child>
                       </packing>
                     </child>
                     <child>
-                      <widget class="GtkLabel" id="label12">
+                      <widget class="GtkLabel" id="label10">
                         <property name="visible">True</property>
-                        <property name="label" translatable="yes">_High:</property>
+                        <property name="label" translatable="yes">Di_screte value:</property>
                         <property name="use_underline">True</property>
-                        <property name="mnemonic_widget">mv-high</property>
+                        <property name="mnemonic_widget">mv-discrete</property>
                       </widget>
                       <packing>
-                        <property name="top_attach">1</property>
-                        <property name="bottom_attach">2</property>
+                        <property name="top_attach">2</property>
+                        <property name="bottom_attach">3</property>
                       </packing>
                     </child>
                     <child>
-                      <widget class="GtkEntry" id="mv-low">
+                      <widget class="GtkEntry" id="mv-discrete">
                         <property name="width_request">75</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                       <packing>
                         <property name="left_attach">1</property>
                         <property name="right_attach">2</property>
+                        <property name="top_attach">2</property>
+                        <property name="bottom_attach">3</property>
                       </packing>
                     </child>
-                    <child>
-                      <widget class="GtkLabel" id="label11">
-                        <property name="visible">True</property>
-                        <property name="label" translatable="yes">_Low:</property>
-                        <property name="use_underline">True</property>
-                        <property name="mnemonic_widget">mv-low</property>
-                      </widget>
-                    </child>
                   </widget>
                 </child>
               </widget>
index 5c84354f1b4dbc5185f27fba40c8a455f06a2adf..6db16ebc47418e188feca860916ac67afeb72c53 100644 (file)
@@ -131,6 +131,7 @@ dist_TESTS = \
        tests/bugs/multipass.sh \
        tests/bugs/overwrite-input-file.sh \
        tests/bugs/overwrite-special-file.sh \
+       tests/bugs/piechart.sh \
        tests/bugs/random.sh \
        tests/bugs/signals.sh \
        tests/bugs/t-test-with-temp.sh \
index 620d42f8918397aa86f06a0d327826e135d50921..5272063094049e75f1513c7c8b2538bafb020f93 100755 (executable)
@@ -92,11 +92,11 @@ diff -b  -w $TEMPDIR/pspp.list - << EOF
 |ABC     |F8.0  |
 +--------+------+
 2.1 DESCRIPTIVES.  Valid cases = 6; cases with missing value(s) = 0.
-+--------#-+-----+-------+-------+-------+
-|Variable#N| Mean|Std Dev|Minimum|Maximum|
-#========#=#=====#=======#=======#=======#
-|ABC     #6|3.000|   .837|  2.000|  4.000|
-+--------#-+-----+-------+-------+-------+
++--------#-+----+-------+-------+-------+
+|Variable#N|Mean|Std Dev|Minimum|Maximum|
+#========#=#====#=======#=======#=======#
+|ABC     #6|3.00|    .84|   2.00|   4.00|
++--------#-+----+-------+-------+-------+
 EOF
 if [ $? -ne 0 ] ; then fail ; fi
 
diff --git a/tests/bugs/piechart.sh b/tests/bugs/piechart.sh
new file mode 100755 (executable)
index 0000000..657e538
--- /dev/null
@@ -0,0 +1,92 @@
+#!/bin/sh
+
+# This program tests for a bug which crashed pspp when a
+# piechart with too many segments was requested.
+
+
+TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
+
+# ensure that top_builddir  are absolute
+if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
+if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
+top_builddir=`cd $top_builddir; pwd`
+PSPP=$top_builddir/src/ui/terminal/pspp
+
+# ensure that top_srcdir is absolute
+top_srcdir=`cd $top_srcdir; pwd`
+
+STAT_CONFIG_PATH=$top_srcdir/config
+export STAT_CONFIG_PATH
+
+
+cleanup()
+{
+     if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then 
+       echo "NOT cleaning $TEMPDIR" 
+       return ; 
+     fi
+     cd /
+     chmod u+w $TEMPDIR
+     rm -rf $TEMPDIR
+}
+
+
+fail()
+{
+    echo $activity
+    echo FAILED
+    cleanup;
+    exit 1;
+}
+
+
+no_result()
+{
+    echo $activity
+    echo NO RESULT;
+    cleanup;
+    exit 2;
+}
+
+pass()
+{
+    cleanup;
+    exit 0;
+}
+
+mkdir -p $TEMPDIR
+
+cd $TEMPDIR
+
+activity="create test syntax"
+cat > $TESTFILE <<EOF
+data list list /x * w *.
+begin data.
+1  4
+34 10
+-9 15
+232 6
+11  4
+134 1
+9  5
+32 16
+-2 6
+2  16
+20  6
+end data.
+
+weight by w.
+
+frequencies /x
+       /piechart.
+EOF
+if [ $? -ne 0 ] ; then no_result ; fi
+
+
+activity="run program 1"
+$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE
+if [ $? -ne 0 ] ; then fail ; fi
+
+
+pass;
index ae7ebf135f04fd9815b446351c2f88fee82de050..f4fc10266fcb8acaa5b24be9fdc786d20c4e1244 100755 (executable)
@@ -101,24 +101,24 @@ diff  -b $TEMPDIR/pspp.list - <<EOF
 #=============#=#====#==============#========#
 #       INDEP |N|Mean|Std. Deviation|SE. Mean#
 #=============#=#====#==============#========#
-#DEP1 a       |5|2.00|          .707|    .316#
-#     b       |5|4.00|          .707|    .316#
-#DEP2 a       |5|4.00|          .707|    .316#
-#     b       |5|2.00|          .707|    .316#
+#DEP1 a       |5|2.00|           .71|     .32#
+#     b       |5|4.00|           .71|     .32#
+#DEP2 a       |5|4.00|           .71|     .32#
+#     b       |5|2.00|           .71|     .32#
 #=============#=#====#==============#========#
 2.2 T-TEST.  Independent Samples Test
-#===============================#==========#===============================================================================#
-#                               # Levene's |                          t-test for Equality of Means                         #
-#                               #----+-----+------+-----+---------------+---------------+---------------------+------------#
-#                               #    |     |      |     |               |               |                     |     95%    #
-#                               #    |     |      |     |               |               |                     +------+-----#
-#                               #  F | Sig.|   t  |  df |Sig. (2-tailed)|Mean Difference|Std. Error Difference| Lower|Upper#
-#===============================#====#=====#======#=====#===============#===============#=====================#======#=====#
-#DEP1Equal variances assumed    #.000|1.000|-4.472|    8|           .002|         -2.000|                 .447|-3.031|-.969#
-#    Equal variances not assumed#    |     |-4.472|8.000|           .002|         -2.000|                 .447|-3.031|-.969#
-#DEP2Equal variances assumed    #.000|1.000| 4.472|    8|           .002|          2.000|                 .447|  .969|3.031#
-#    Equal variances not assumed#    |     | 4.472|8.000|           .002|          2.000|                 .447|  .969|3.031#
-#===============================#====#=====#======#=====#===============#===============#=====================#======#=====#
+#===============================#========#============================================================================#
+#                               #Levene's|                        t-test for Equality of Means                        #
+#                               #---+----+-----+----+---------------+---------------+---------------------+-----------#
+#                               #   |    |     |    |               |               |                     |    95%    #
+#                               #   |    |     |    |               |               |                     +-----+-----#
+#                               # F |Sig.|  t  | df |Sig. (2-tailed)|Mean Difference|Std. Error Difference|Lower|Upper#
+#===============================#===#====#=====#====#===============#===============#=====================#=====#=====#
+#DEP1Equal variances assumed    #.00|1.00|-4.47|8.00|            .00|          -2.00|                  .45|-3.03| -.97#
+#    Equal variances not assumed#   |    |-4.47|8.00|            .00|          -2.00|                  .45|-3.03| -.97#
+#DEP2Equal variances assumed    #.00|1.00| 4.47|8.00|            .00|           2.00|                  .45|  .97| 3.03#
+#    Equal variances not assumed#   |    | 4.47|8.00|            .00|           2.00|                  .45|  .97| 3.03#
+#===============================#===#====#=====#====#===============#===============#=====================#=====#=====#
 EOF
 if [ $? -ne 0 ] ; then fail ; fi
 
index ccfb70b9d752e2d8d71c2110aa99760583ba5226..9a437efb8a466246a09859dc110d102c7dfc739a 100755 (executable)
@@ -97,20 +97,20 @@ diff  -b  $TEMPDIR/pspp.list - << EOF
 #==========#=#====#==============#========#
 #     gv   |N|Mean|Std. Deviation|SE. Mean#
 #==========#=#====#==============#========#
-#x One     |5|2.60|          .548|    .245#
-#  Two     |3|3.50|          .500|    .289#
+#x One     |5|2.60|           .55|     .24#
+#  Two     |3|3.50|           .50|     .29#
 #==========#=#====#==============#========#
 2.2 T-TEST.  Independent Samples Test
-#============================#==========#===============================================================================#
-#                            # Levene's |                          t-test for Equality of Means                         #
-#                            #-----+----+------+-----+---------------+---------------+---------------------+------------#
-#                            #     |    |      |     |               |               |                     |     95%    #
-#                            #     |    |      |     |               |               |                     +------+-----#
-#                            #  F  |Sig.|   t  |  df |Sig. (2-tailed)|Mean Difference|Std. Error Difference| Lower|Upper#
-#============================#=====#====#======#=====#===============#===============#=====================#======#=====#
-#xEqual variances assumed    #1.127|.329|-2.315|    6|           .060|          -.900|                 .379|-1.826| .026#
-# Equal variances not assumed#     |    |-2.377|4.699|           .067|          -.900|                 .379|-1.892| .092#
-#============================#=====#====#======#=====#===============#===============#=====================#======#=====#
+#============================#=========#============================================================================#
+#                            # Levene's|                        t-test for Equality of Means                        #
+#                            #----+----+-----+----+---------------+---------------+---------------------+-----------#
+#                            #    |    |     |    |               |               |                     |    95%    #
+#                            #    |    |     |    |               |               |                     +-----+-----#
+#                            #  F |Sig.|  t  | df |Sig. (2-tailed)|Mean Difference|Std. Error Difference|Lower|Upper#
+#============================#====#====#=====#====#===============#===============#=====================#=====#=====#
+#xEqual variances assumed    #1.13| .33|-2.32|6.00|            .06|           -.90|                  .38|-1.83|  .03#
+# Equal variances not assumed#    |    |-2.38|4.70|            .07|           -.90|                  .38|-1.89|  .09#
+#============================#====#====#=====#====#===============#===============#=====================#=====#=====#
 EOF
 if [ $? -ne 0 ] ; then fail ; fi
 
index 8e0e2c7a1f72bad09b948623670ae8865f62054d..4f96916f76d0a6bd304d66e742af7c932872cbe9 100755 (executable)
@@ -95,26 +95,26 @@ diff -b  -w $TEMPDIR/pspp.list - << EOF
 |SEX     |A1    |
 |X       |F8.0  |
 +--------+------+
-2.1 FREQUENCIES.  X 
+2.1 FREQUENCIES.  X
 +-----------+--------+---------+--------+--------+--------+
 |           |        |         |        |  Valid |   Cum  |
 |Value Label|  Value |Frequency| Percent| Percent| Percent|
 #===========#========#=========#========#========#========#
-|           |   12.00|        1|    25.0|    25.0|    25.0|
-|           |   13.00|        1|    25.0|    25.0|    50.0|
-|           |   21.00|        1|    25.0|    25.0|    75.0|
-|           |   31.00|        1|    25.0|    25.0|   100.0|
+|           |   12.00|        1|   25.00|   25.00|   25.00|
+|           |   13.00|        1|   25.00|   25.00|   50.00|
+|           |   21.00|        1|   25.00|   25.00|   75.00|
+|           |   31.00|        1|   25.00|   25.00|  100.00|
 #===========#========#=========#========#========#========#
 |               Total|        4|   100.0|   100.0|        |
 +--------------------+---------+--------+--------+--------+
-+---------------+------+
-|N       Valid  |     4|
-|        Missing|     0|
-|Mean           |19.250|
-|Std Dev        | 8.808|
-|Minimum        |12.000|
-|Maximum        |31.000|
-+---------------+------+
++---------------+-----+
+|N       Valid  |    4|
+|        Missing|    0|
+|Mean           |19.25|
+|Std Dev        | 8.81|
+|Minimum        |12.00|
+|Maximum        |31.00|
++---------------+-----+
 EOF
 if [ $? -ne 0 ] ; then fail ; fi
 
index 8524bf5e52807d0f0df5a3ee9bd43d30d91c763c..67dfed0a5757fa0d859d743e6a407ef26a3a10eb 100755 (executable)
@@ -102,15 +102,15 @@ activity="compare results"
 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
 diff -b  $TEMPDIR/pspp.list - << EOF
 1.1 EXAMINE.  Case Processing Summary
-#==#===============================#
-#  #             Cases             #
-#  #----------+---------+----------#
-#  #   Valid  | Missing |   Total  #
-#  #--+-------+-+-------+--+-------#
-#  # N|Percent|N|Percent| N|Percent#
-#==#==#=======#=#=======#==#=======#
-#V1#23|   100%|0|     0%|23|   100%#
-#==#==#=======#=#=======#==#=======#
+#==#=======================================#
+#  #                 Cases                 #
+#  #-------------+-----------+-------------#
+#  #    Valid    |  Missing  |    Total    #
+#  #-----+-------+---+-------+-----+-------#
+#  #  N  |Percent| N |Percent|  N  |Percent#
+#==#=====#=======#===#=======#=====#=======#
+#V1#23.00|   100%|.00|     0%|23.00|   100%#
+#==#=====#=======#===#=======#=====#=======#
 1.2 EXAMINE.  Extreme Values
 #============#===========#=====#
 #            #Case Number|Value#
index 095ee0fb93987fcc9735139c39618780c61acabd..11534385ce509ff3f8f5153aa6cb88c09b0cfd0e 100755 (executable)
@@ -116,32 +116,32 @@ diff -b  $TEMPDIR/pspp.list - << EOF
 +--------+------+
 Case#  QUALITY        W    BRAND
 ----- -------- -------- --------
-    1     3.00     1.00     1.00
-    2     2.00     2.00     1.00
-    3     1.00     2.00     1.00
-    4     1.00     1.00     1.00
-    5     4.00     1.00     1.00
-    6     4.00     1.00     1.00
-    7     5.00     1.00     2.00
-    8     2.00     1.00     2.00
-    9     4.00     4.00     2.00
-   10     2.00     1.00     2.00
-   11     3.00     1.00     2.00
-   12     7.00     1.00     3.00
-   13     4.00     2.00     3.00
-   14     5.00     3.00     3.00
-   15     3.00     1.00     3.00
-   16     6.00     1.00     3.00
+    1     3.00     1.00     1.00 
+    2     2.00     2.00     1.00 
+    3     1.00     2.00     1.00 
+    4     1.00     1.00     1.00 
+    5     4.00     1.00     1.00 
+    6     4.00     1.00     1.00 
+    7     5.00     1.00     2.00 
+    8     2.00     1.00     2.00 
+    9     4.00     4.00     2.00 
+   10     2.00     1.00     2.00 
+   11     3.00     1.00     2.00 
+   12     7.00     1.00     3.00 
+   13     4.00     2.00     3.00 
+   14     5.00     3.00     3.00 
+   15     3.00     1.00     3.00 
+   16     6.00     1.00     3.00 
 2.1 EXAMINE.  Case Processing Summary
-#===============#===============================#
-#               #             Cases             #
-#               #----------+---------+----------#
-#               #   Valid  | Missing |   Total  #
-#               #--+-------+-+-------+--+-------#
-#               # N|Percent|N|Percent| N|Percent#
-#===============#==#=======#=#=======#==#=======#
-#Breaking Strain#24|   100%|0|     0%|24|   100%#
-#===============#==#=======#=#=======#==#=======#
+#===============#=======================================#
+#               #                 Cases                 #
+#               #-------------+-----------+-------------#
+#               #    Valid    |  Missing  |    Total    #
+#               #-----+-------+---+-------+-----+-------#
+#               #  N  |Percent| N |Percent|  N  |Percent#
+#===============#=====#=======#===#=======#=====#=======#
+#Breaking Strain#24.00|   100%|.00|     0%|24.00|   100%#
+#===============#=====#=======#===#=======#=====#=======#
 2.2 EXAMINE.  Extreme Values
 #=========================#===========#=====#
 #                         #Case Number|Value#
@@ -158,32 +158,32 @@ Case#  QUALITY        W    BRAND
 #============================================================#=========#==========#
 #                                                            #Statistic|Std. Error#
 #============================================================#=========#==========#
-#Breaking Strain Mean                                        #   3.54  |   .324   #
-#                95% Confidence Interval for Mean Lower Bound#  2.871  |          #
-#                                                 Upper Bound#  4.212  |          #
+#Breaking Strain Mean                                        #   3.54  |    .32   #
+#                95% Confidence Interval for Mean Lower Bound#   2.87  |          #
+#                                                 Upper Bound#   4.21  |          #
 #                5% Trimmed Mean                             #   3.50  |          #
 #                Median                                      #   4.00  |          #
-#                Variance                                    #  2.520  |          #
-#                Std. Deviation                              #  1.587  |          #
-#                Minimum                                     #  1.000  |          #
-#                Maximum                                     #  7.000  |          #
-#                Range                                       #  6.000  |          #
+#                Variance                                    #   2.52  |          #
+#                Std. Deviation                              #   1.59  |          #
+#                Minimum                                     #   1.00  |          #
+#                Maximum                                     #   7.00  |          #
+#                Range                                       #   6.00  |          #
 #                Interquartile Range                         #   2.75  |          #
-#                Skewness                                    #   .059  |   .472   #
-#                Kurtosis                                    #  -.358  |   .918   #
+#                Skewness                                    #   .06   |    .47   #
+#                Kurtosis                                    #   -.36  |    .92   #
 #============================================================#=========#==========#
 2.4 EXAMINE.  Case Processing Summary
-#============================#=============================#
-#                            #            Cases            #
-#                            #---------+---------+---------#
-#                            #  Valid  | Missing |  Total  #
-#                            #-+-------+-+-------+-+-------#
-#                Manufacturer#N|Percent|N|Percent|N|Percent#
-#============================#=#=======#=#=======#=#=======#
-#Breaking Strain Aspeger     #8|   100%|0|     0%|8|   100%#
-#                Bloggs      #8|   100%|0|     0%|8|   100%#
-#                Charlies    #8|   100%|0|     0%|8|   100%#
-#============================#=#=======#=#=======#=#=======#
+#============================#=====================================#
+#                            #                Cases                #
+#                            #------------+-----------+------------#
+#                            #    Valid   |  Missing  |    Total   #
+#                            #----+-------+---+-------+----+-------#
+#                Manufacturer#  N |Percent| N |Percent|  N |Percent#
+#============================#====#=======#===#=======#====#=======#
+#Breaking Strain Aspeger     #8.00|   100%|.00|     0%|8.00|   100%#
+#                Bloggs      #8.00|   100%|.00|     0%|8.00|   100%#
+#                Charlies    #8.00|   100%|.00|     0%|8.00|   100%#
+#============================#====#=======#===#=======#====#=======#
 2.5 EXAMINE.  Extreme Values
 #======================================#===========#=====#
 #                Manufacturer          #Case Number|Value#
@@ -214,49 +214,49 @@ Case#  QUALITY        W    BRAND
 #======================================#===========#=====#
 2.6 EXAMINE.  Descriptives
 #=========================================================================#=========#==========#
-#                Manufacturer                                            #Statistic|Std. Error#
+#                Manufacturer                                             #Statistic|Std. Error#
 #=========================================================================#=========#==========#
-#Breaking Strain Aspeger      Mean                                        #   2.25  |   .453   #
-#                             95% Confidence Interval for Mean Lower Bound#  1.178  |          #
-#                                                              Upper Bound#  3.322  |          #
+#Breaking Strain Aspeger      Mean                                        #   2.25  |    .45   #
+#                             95% Confidence Interval for Mean Lower Bound#   1.18  |          #
+#                                                              Upper Bound#   3.32  |          #
 #                             5% Trimmed Mean                             #   2.22  |          #
 #                             Median                                      #   2.00  |          #
-#                             Variance                                    #  1.643  |          #
-#                             Std. Deviation                              #  1.282  |          #
-#                             Minimum                                     #  1.000  |          #
-#                             Maximum                                     #  4.000  |          #
-#                             Range                                       #  3.000  |          #
+#                             Variance                                    #   1.64  |          #
+#                             Std. Deviation                              #   1.28  |          #
+#                             Minimum                                     #   1.00  |          #
+#                             Maximum                                     #   4.00  |          #
+#                             Range                                       #   3.00  |          #
 #                             Interquartile Range                         #   2.75  |          #
-#                             Skewness                                    #   .475  |   .752   #
-#                             Kurtosis                                    #  -1.546 |   1.481  #
+#                             Skewness                                    #   .47   |    .75   #
+#                             Kurtosis                                    #  -1.55  |   1.48   #
 #               ----------------------------------------------------------#---------+----------#
-#                Bloggs       Mean                                        #   3.50  |   .378   #
-#                             95% Confidence Interval for Mean Lower Bound#  2.606  |          #
-#                                                              Upper Bound#  4.394  |          #
+#                Bloggs       Mean                                        #   3.50  |    .38   #
+#                             95% Confidence Interval for Mean Lower Bound#   2.61  |          #
+#                                                              Upper Bound#   4.39  |          #
 #                             5% Trimmed Mean                             #   3.50  |          #
 #                             Median                                      #   4.00  |          #
-#                             Variance                                    #  1.143  |          #
-#                             Std. Deviation                              #  1.069  |          #
-#                             Minimum                                     #  2.000  |          #
-#                             Maximum                                     #  5.000  |          #
-#                             Range                                       #  3.000  |          #
+#                             Variance                                    #   1.14  |          #
+#                             Std. Deviation                              #   1.07  |          #
+#                             Minimum                                     #   2.00  |          #
+#                             Maximum                                     #   5.00  |          #
+#                             Range                                       #   3.00  |          #
 #                             Interquartile Range                         #   1.75  |          #
-#                             Skewness                                    #  -.468  |   .752   #
-#                             Kurtosis                                    #  -.831  |   1.481  #
+#                             Skewness                                    #   -.47  |    .75   #
+#                             Kurtosis                                    #   -.83  |   1.48   #
 #               ----------------------------------------------------------#---------+----------#
-#                Charlies     Mean                                        #   4.88  |   .441   #
-#                             95% Confidence Interval for Mean Lower Bound#  3.833  |          #
-#                                                              Upper Bound#  5.917  |          #
+#                Charlies     Mean                                        #   4.88  |    .44   #
+#                             95% Confidence Interval for Mean Lower Bound#   3.83  |          #
+#                                                              Upper Bound#   5.92  |          #
 #                             5% Trimmed Mean                             #   4.86  |          #
 #                             Median                                      #   5.00  |          #
-#                             Variance                                    #  1.554  |          #
-#                             Std. Deviation                              #  1.246  |          #
-#                             Minimum                                     #  3.000  |          #
-#                             Maximum                                     #  7.000  |          #
-#                             Range                                       #  4.000  |          #
+#                             Variance                                    #   1.55  |          #
+#                             Std. Deviation                              #   1.25  |          #
+#                             Minimum                                     #   3.00  |          #
+#                             Maximum                                     #   7.00  |          #
+#                             Range                                       #   4.00  |          #
 #                             Interquartile Range                         #   1.75  |          #
-#                             Skewness                                    #   .304  |   .752   #
-#                             Kurtosis                                    #   .146  |   1.481  #
+#                             Skewness                                    #   .30   |    .75   #
+#                             Kurtosis                                    #   .15   |   1.48   #
 #=========================================================================#=========#==========#
 EOF
 if [ $? -ne 0 ] ; then fail ; fi
index fa61d6d684db5ee9ea1060ad6f6dd69cc31f2666..1d8afadaa815f2ece469e7d488845844540f8951 100755 (executable)
@@ -427,4 +427,44 @@ diff -b  $TEMPDIR/pspp.list - << 'EOF'
 EOF
 if [ $? -ne 0 ] ; then fail ; fi
 
+
+
+# Check for a bug caused by having string variables in the database,
+# all of which are null.
+
+activity="populate database 4"
+$pgpath/psql  -h $TEMPDIR -p $port  $dbase > /dev/null << EOF
+
+-- a table which has a text field containing only null, or zero
+-- length entries.
+
+CREATE TABLE foo (int4  int4, text text);
+
+INSERT INTO foo VALUES ('12', '');
+
+INSERT INTO foo VALUES (null, '');
+
+EOF
+if [ $? -ne 0 ] ; then fail ; fi
+
+
+activity="create program 4"
+cat > $TESTFILE <<EOF
+GET DATA /TYPE=psql 
+       /CONNECT="host=$TEMPDIR port=$port dbname=$dbase"
+       /UNENCRYPTED
+       /SQL="select * from foo".
+
+DISPLAY DICTIONARY.
+
+LIST.
+EOF
+if [ $? -ne 0 ] ; then no_result ; fi
+
+
+activity="run program 4"
+$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE
+if [ $? -ne 0 ] ; then no_result ; fi
+
+
 pass;
index f0c2b5c4793b481e1504f8786315a4ecea30e2e9..0cb178bf5776ade7e26ac28b5218f2eefd18e70f 100755 (executable)
@@ -61,7 +61,7 @@ cat > $TESTFILE <<EOF
 DATA LIST LIST NOTABLE /X Y.
 BEGIN DATA.
 1 2
-3 4
+3 .
 5 6
 END DATA.
 
@@ -83,7 +83,7 @@ diff -b  $TEMPDIR/pspp.list - << EOF
        X        Y
 -------- --------
     1.00     2.00 
-    3.00     4.00 
+    3.00     .
     5.00     6.00 
 EOF
 if [ $? -ne 0 ] ; then fail ; fi
index 63696929faab2dedaba7db74e95bec3a4e7a8946..0db048dd34703054bd88b7da91a17f81ae579812 100755 (executable)
@@ -74,6 +74,8 @@ END DATA.
 
 WEIGHT BY w.
 
+SET FORMAT F8.3.
+
 NPAR TESTS
        /BINOMIAL(0.3) = x
        .
@@ -83,7 +85,9 @@ ECHO 'P < 0.5; N1/N2 > 1' .
 
 NEW FILE.
 
-DATA LIST LIST NOTABLE /x * w *.
+
+
+DATA LIST LIST NOTABLE /x (F8.0) w (F8.0).
 BEGIN DATA.
 1   7
 2   6
@@ -101,7 +105,7 @@ ECHO 'P < 0.5; N1/N2 = 1' .
 
 NEW FILE.
 
-DATA LIST LIST NOTABLE /x * w *.
+DATA LIST LIST NOTABLE /x (F8.0) w (F8.0).
 BEGIN DATA.
 1   8
 2   8
@@ -117,7 +121,7 @@ ECHO 'P > 0.5; N1/N2 < 1' .
 
 NEW FILE.
 
-DATA LIST LIST NOTABLE /x * w *.
+DATA LIST LIST NOTABLE /x (F8.0) w (F8.0).
 BEGIN DATA.
 1   11
 2   12
@@ -134,7 +138,7 @@ ECHO 'P > 0.5; N1/N2 > 1' .
 
 NEW FILE.
 
-DATA LIST LIST NOTABLE /x * w *.
+DATA LIST LIST NOTABLE /x (F8.0) w (F8.0).
 BEGIN DATA.
 1   11
 2   9
@@ -149,7 +153,7 @@ ECHO 'P > 0.5; N1/N2 == 1' .
 
 NEW FILE.
 
-DATA LIST LIST NOTABLE /x * w *.
+DATA LIST LIST NOTABLE /x (F8.0) w (F8.0).
 BEGIN DATA.
 1   11
 2   11
@@ -165,7 +169,7 @@ ECHO 'P == 0.5; N1/N2 < 1' .
 
 NEW FILE.
 
-DATA LIST LIST NOTABLE /x * w *.
+DATA LIST LIST NOTABLE /x (F8.0) w (F8.0).
 BEGIN DATA.
 1   8
 2   15
@@ -182,7 +186,7 @@ ECHO 'P == 0.5; N1/N2 > 1' .
 
 NEW FILE.
 
-DATA LIST LIST NOTABLE /x * w *.
+DATA LIST LIST NOTABLE /x (F8.0) w (F8.0).
 BEGIN DATA.
 1   12
 2   6
@@ -197,7 +201,7 @@ ECHO 'P == 0.5; N1/N2 == 1' .
 
 NEW FILE.
 
-DATA LIST LIST NOTABLE /x * w *.
+DATA LIST LIST NOTABLE /x (F8.0) w (F8.0).
 BEGIN DATA.
 1   10
 2   10
@@ -208,6 +212,36 @@ WEIGHT BY w.
 NPAR TESTS
        /BINOMIAL(0.5) = x
        .
+
+ECHO 'P == 0.5; N1/N2 == 1 Cutpoint' .
+
+DATA LIST LIST NOTABLE /x * w *.
+BEGIN DATA.
+9    3
+10   7
+11   16
+END DATA.
+
+WEIGHT BY w.
+
+NPAR TESTS
+       /BINOMIAL(0.5) = x (10)
+       .
+
+ECHO 'P == 0.5; N1/N2 == 1 Named values' .
+
+DATA LIST LIST NOTABLE /x * w *.
+BEGIN DATA.
+10   10
+15   45
+20   13
+END DATA.
+
+WEIGHT BY w.
+
+NPAR TESTS
+       /BINOMIAL(0.5) = x (10, 20)
+       .
 EOF
 if [ $? -ne 0 ] ; then no_result ; fi
 
@@ -221,85 +255,103 @@ perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
 diff -b $TEMPDIR/pspp.list - << EOF
 P < 0.5; N1/N2 < 1
 1.1 NPAR TESTS.  Binomial Test
-+-+------#--------+--+--------------+----------+---------------------+
-| |      #Category| N|Observed Prop.|Test Prop.|Exact Sig. (1-tailed)|
-+-+------#--------+--+--------------+----------+---------------------+
-|x|Group1#    1.00| 6|          .286|      .300|                 .551|
-| |Group2#    2.00|15|          .714|          |                     |
-| |Total #        |21|          1.00|          |                     |
-+-+------#--------+--+--------------+----------+---------------------+
++-+------#--------+-----+--------------+----------+---------------------+
+| |      #Category|  N  |Observed Prop.|Test Prop.|Exact Sig. (1-tailed)|
++-+------#--------+-----+--------------+----------+---------------------+
+|x|Group1#    1.00| 6.00|          .286|      .300|                 .551|
+| |Group2#    2.00|15.00|          .714|          |                     |
+| |Total #        |21.00|         1.000|          |                     |
++-+------#--------+-----+--------------+----------+---------------------+
 P < 0.5; N1/N2 > 1
 2.1 NPAR TESTS.  Binomial Test
 +-+------#--------+--+--------------+----------+---------------------+
 | |      #Category| N|Observed Prop.|Test Prop.|Exact Sig. (1-tailed)|
 +-+------#--------+--+--------------+----------+---------------------+
-|x|Group1#    1.00| 7|          .538|      .400|                 .229|
-| |Group2#    2.00| 6|          .462|          |                     |
-| |Total #        |13|          1.00|          |                     |
+|x|Group1#       1| 7|          .538|      .400|                 .229|
+| |Group2#       2| 6|          .462|          |                     |
+| |Total #        |13|         1.000|          |                     |
 +-+------#--------+--+--------------+----------+---------------------+
 P < 0.5; N1/N2 = 1
 3.1 NPAR TESTS.  Binomial Test
 +-+------#--------+--+--------------+----------+---------------------+
 | |      #Category| N|Observed Prop.|Test Prop.|Exact Sig. (1-tailed)|
 +-+------#--------+--+--------------+----------+---------------------+
-|x|Group1#    1.00| 8|          .500|      .400|                 .284|
-| |Group2#    2.00| 8|          .500|          |                     |
-| |Total #        |16|          1.00|          |                     |
+|x|Group1#       1| 8|          .500|      .400|                 .284|
+| |Group2#       2| 8|          .500|          |                     |
+| |Total #        |16|         1.000|          |                     |
 +-+------#--------+--+--------------+----------+---------------------+
 P > 0.5; N1/N2 < 1
 4.1 NPAR TESTS.  Binomial Test
 +-+------#--------+--+--------------+----------+---------------------+
 | |      #Category| N|Observed Prop.|Test Prop.|Exact Sig. (1-tailed)|
 +-+------#--------+--+--------------+----------+---------------------+
-|x|Group1#    1.00|11|          .478|      .600|                 .164|
-| |Group2#    2.00|12|          .522|          |                     |
-| |Total #        |23|          1.00|          |                     |
+|x|Group1#       1|11|          .478|      .600|                 .164|
+| |Group2#       2|12|          .522|          |                     |
+| |Total #        |23|         1.000|          |                     |
 +-+------#--------+--+--------------+----------+---------------------+
 P > 0.5; N1/N2 > 1
 5.1 NPAR TESTS.  Binomial Test
 +-+------#--------+--+--------------+----------+---------------------+
 | |      #Category| N|Observed Prop.|Test Prop.|Exact Sig. (1-tailed)|
 +-+------#--------+--+--------------+----------+---------------------+
-|x|Group1#    1.00|11|          .550|      .600|                 .404|
-| |Group2#    2.00| 9|          .450|          |                     |
-| |Total #        |20|          1.00|          |                     |
+|x|Group1#       1|11|          .550|      .600|                 .404|
+| |Group2#       2| 9|          .450|          |                     |
+| |Total #        |20|         1.000|          |                     |
 +-+------#--------+--+--------------+----------+---------------------+
 P > 0.5; N1/N2 == 1
 6.1 NPAR TESTS.  Binomial Test
 +-+------#--------+--+--------------+----------+---------------------+
 | |      #Category| N|Observed Prop.|Test Prop.|Exact Sig. (1-tailed)|
 +-+------#--------+--+--------------+----------+---------------------+
-|x|Group1#    1.00|11|          .500|      .600|                 .228|
-| |Group2#    2.00|11|          .500|          |                     |
-| |Total #        |22|          1.00|          |                     |
+|x|Group1#       1|11|          .500|      .600|                 .228|
+| |Group2#       2|11|          .500|          |                     |
+| |Total #        |22|         1.000|          |                     |
 +-+------#--------+--+--------------+----------+---------------------+
 P == 0.5; N1/N2 < 1
 7.1 NPAR TESTS.  Binomial Test
 +-+------#--------+--+--------------+----------+---------------------+
 | |      #Category| N|Observed Prop.|Test Prop.|Exact Sig. (2-tailed)|
 +-+------#--------+--+--------------+----------+---------------------+
-|x|Group1#    1.00| 8|          .348|      .500|                 .210|
-| |Group2#    2.00|15|          .652|          |                     |
-| |Total #        |23|          1.00|          |                     |
+|x|Group1#       1| 8|          .348|      .500|                 .210|
+| |Group2#       2|15|          .652|          |                     |
+| |Total #        |23|         1.000|          |                     |
 +-+------#--------+--+--------------+----------+---------------------+
 P == 0.5; N1/N2 > 1
 8.1 NPAR TESTS.  Binomial Test
 +-+------#--------+--+--------------+----------+---------------------+
 | |      #Category| N|Observed Prop.|Test Prop.|Exact Sig. (2-tailed)|
 +-+------#--------+--+--------------+----------+---------------------+
-|x|Group1#    1.00|12|          .667|      .500|                 .238|
-| |Group2#    2.00| 6|          .333|          |                     |
-| |Total #        |18|          1.00|          |                     |
+|x|Group1#       1|12|          .667|      .500|                 .238|
+| |Group2#       2| 6|          .333|          |                     |
+| |Total #        |18|         1.000|          |                     |
 +-+------#--------+--+--------------+----------+---------------------+
 P == 0.5; N1/N2 == 1
 9.1 NPAR TESTS.  Binomial Test
 +-+------#--------+--+--------------+----------+---------------------+
 | |      #Category| N|Observed Prop.|Test Prop.|Exact Sig. (2-tailed)|
 +-+------#--------+--+--------------+----------+---------------------+
-|x|Group1#    1.00|10|          .500|      .500|                1.000|
-| |Group2#    2.00|10|          .500|          |                     |
-| |Total #        |20|          1.00|          |                     |
+|x|Group1#       1|10|          .500|      .500|                1.000|
+| |Group2#       2|10|          .500|          |                     |
+| |Total #        |20|         1.000|          |                     |
 +-+------#--------+--+--------------+----------+---------------------+
+P == 0.5; N1/N2 == 1 Cutpoint
+10.1 NPAR TESTS.  Binomial Test
++-+------#--------+------+--------------+----------+---------------------+
+| |      #Category|   N  |Observed Prop.|Test Prop.|Exact Sig. (2-tailed)|
++-+------#--------+------+--------------+----------+---------------------+
+|x|Group1#   <= 10|10.000|          .385|      .500|                 .327|
+| |Group2#        |16.000|          .615|          |                     |
+| |Total #        |26.000|         1.000|          |                     |
++-+------#--------+------+--------------+----------+---------------------+
+P == 0.5; N1/N2 == 1 Named values
+11.1 NPAR TESTS.  Binomial Test
++-+------#--------+------+--------------+----------+---------------------+
+| |      #Category|   N  |Observed Prop.|Test Prop.|Exact Sig. (2-tailed)|
++-+------#--------+------+--------------+----------+---------------------+
+|x|Group1#  10.000|10.000|          .435|      .500|                 .678|
+| |Group2#  20.000|13.000|          .565|          |                     |
+| |Total #        |23.000|         1.000|          |                     |
++-+------#--------+------+--------------+----------+---------------------+
 EOF
 if [ $? -ne 0 ] ; then fail ; fi
 
index 1df381b1568d6f809c9c85b09fe7d1af997eb845..33e2311bc9b49bfcd3756b5ccc91373d35db4fc1 100755 (executable)
@@ -102,69 +102,69 @@ diff -b $TEMPDIR/pspp.list - << EOF
 +--------#----------+----------+--------+
 |        #Observed N|Expected N|Residual|
 +--------#----------+----------+--------+
-|    1.00#         3|      2.33|     .67|
-|    2.00#         3|      2.33|     .67|
-|    3.10#         4|      2.33|    1.67|
-|    3.20#         1|      2.33|   -1.33|
-|    4.00#         2|      2.33|    -.33|
-|    5.00#         1|      2.33|   -1.33|
-|Total   #        14|          |        |
+|    1.00#      3.00|      2.33|     .67|
+|    2.00#      3.00|      2.33|     .67|
+|    3.10#      4.00|      2.33|    1.67|
+|    3.20#      1.00|      2.33|   -1.33|
+|    4.00#      2.00|      2.33|    -.33|
+|    5.00#      1.00|      2.33|   -1.33|
+|Total   #     14.00|          |        |
 +--------#----------+----------+--------+
 1.2 NPAR TESTS.  y
 +--------#----------+----------+--------+
 |        #Observed N|Expected N|Residual|
 +--------#----------+----------+--------+
-|    1.00#         7|      3.50|    3.50|
-|    2.00#         4|      3.50|     .50|
-|    3.00#         1|      3.50|   -2.50|
-|    4.00#         2|      3.50|   -1.50|
-|Total   #        14|          |        |
+|    1.00#      7.00|      3.50|    3.50|
+|    2.00#      4.00|      3.50|     .50|
+|    3.00#      1.00|      3.50|   -2.50|
+|    4.00#      2.00|      3.50|   -1.50|
+|Total   #     14.00|          |        |
 +--------#----------+----------+--------+
 1.3 NPAR TESTS.  Test Statistics
-+-----------#-----+-----+
-|           #  x  |  y  |
-+-----------#-----+-----+
-|Chi-Square #3.143|6.000|
-|df         #    5|    3|
-|Asymp. Sig.# .678| .112|
-+-----------#-----+-----+
++-----------#----+----+
+|           #  x |  y |
++-----------#----+----+
+|Chi-Square #3.14|6.00|
+|df         #   5|   3|
+|Asymp. Sig.# .68| .11|
++-----------#----+----+
 2.1 NPAR TESTS.  y
 +--------#----------+----------+--------+
 |        #Observed N|Expected N|Residual|
 +--------#----------+----------+--------+
-|    1.00#         7|      2.63|    4.38|
-|    2.00#         4|      3.50|     .50|
-|    3.00#         1|      4.38|   -3.38|
-|    4.00#         2|      3.50|   -1.50|
-|Total   #        14|          |        |
+|    1.00#      7.00|      2.63|    4.38|
+|    2.00#      4.00|      3.50|     .50|
+|    3.00#      1.00|      4.38|   -3.38|
+|    4.00#      2.00|      3.50|   -1.50|
+|Total   #     14.00|          |        |
 +--------#----------+----------+--------+
 2.2 NPAR TESTS.  Test Statistics
-+-----------#------+
-|           #   y  |
-+-----------#------+
-|Chi-Square #10.610|
-|df         #     3|
-|Asymp. Sig.#  .014|
-+-----------#------+
++-----------#-----+
+|           #  y  |
++-----------#-----+
+|Chi-Square #10.61|
+|df         #    3|
+|Asymp. Sig.#  .01|
++-----------#-----+
 3.1 NPAR TESTS.  Frequencies
 +-----#---------------------------------------#---------------------------------------+
 |     #                   x                   #                   y                   |
 |     #--------+----------+----------+--------#--------+----------+----------+--------+
 |     #Category|Observed N|Expected N|Residual#Category|Observed N|Expected N|Residual|
 +-----#--------+----------+----------+--------#--------+----------+----------+--------+
-|1    #    2.00|         3|      3.16|    -.16#    2.00|         4|      2.21|    1.79|
-|2    #    3.00|         5|      5.26|    -.26#    3.00|         1|      3.68|   -2.68|
-|3    #    4.00|         2|      1.58|     .42#    4.00|         2|      1.11|     .89|
-|Total#        |        10|          |        #        |         7|          |        |
+|1    #    2.00|      3.00|      3.16|    -.16#    2.00|      4.00|      2.21|    1.79|
+|2    #    3.00|      5.00|      5.26|    -.26#    3.00|      1.00|      3.68|   -2.68|
+|3    #    4.00|      2.00|      1.58|     .42#    4.00|      2.00|      1.11|     .89|
+|Total#        |     10.00|          |        #        |      7.00|          |        |
 +-----#--------+----------+----------+--------#--------+----------+----------+--------+
 3.2 NPAR TESTS.  Test Statistics
-+-----------#----+-----+
-|           #  x |  y  |
-+-----------#----+-----+
-|Chi-Square #.133|4.129|
-|df         #   2|    2|
-|Asymp. Sig.#.936| .127|
-+-----------#----+-----+
++-----------#---+----+
+|           # x |  y |
++-----------#---+----+
+|Chi-Square #.13|4.13|
+|df         #  2|   2|
+|Asymp. Sig.#.94| .13|
++-----------#---+----+
 EOF
 if [ $? -ne 0 ] ; then fail ; fi
 
@@ -245,32 +245,32 @@ diff -b $TEMPDIR/pspp.list - <<EOF
 |     #--------+----------+----------+--------#--------+----------+----------+--------+
 |     #Category|Observed N|Expected N|Residual#Category|Observed N|Expected N|Residual|
 +-----#--------+----------+----------+--------#--------+----------+----------+--------+
-|1    #   -2.00|         0|      1.50|   -1.50#   -2.00|         0|      1.88|   -1.88|
-|2    #   -1.00|         0|      1.50|   -1.50#   -1.00|         0|      1.88|   -1.88|
-|3    #     .00|         0|      1.50|   -1.50#     .00|         0|      1.88|   -1.88|
-|4    #    1.00|         3|      1.50|    1.50#    1.00|         7|      1.88|    5.13|
-|5    #    2.00|         3|      1.50|    1.50#    2.00|         4|      1.88|    2.13|
-|6    #    3.00|         5|      1.50|    3.50#    3.00|         1|      1.88|    -.88|
-|7    #    4.00|         0|      1.50|   -1.50#    4.00|         2|      1.88|     .13|
-|8    #    5.00|         1|      1.50|    -.50#    5.00|         1|      1.88|    -.88|
-|Total#        |        12|          |        #        |        15|          |        |
+|1    #   -2.00|       .00|      1.50|   -1.50#   -2.00|       .00|      1.88|   -1.88|
+|2    #   -1.00|       .00|      1.50|   -1.50#   -1.00|       .00|      1.88|   -1.88|
+|3    #     .00|       .00|      1.50|   -1.50#     .00|       .00|      1.88|   -1.88|
+|4    #    1.00|      3.00|      1.50|    1.50#    1.00|      7.00|      1.88|    5.13|
+|5    #    2.00|      3.00|      1.50|    1.50#    2.00|      4.00|      1.88|    2.13|
+|6    #    3.00|      5.00|      1.50|    3.50#    3.00|      1.00|      1.88|    -.88|
+|7    #    4.00|       .00|      1.50|   -1.50#    4.00|      2.00|      1.88|     .13|
+|8    #    5.00|      1.00|      1.50|    -.50#    5.00|      1.00|      1.88|    -.88|
+|Total#        |     12.00|          |        #        |     15.00|          |        |
 +-----#--------+----------+----------+--------#--------+----------+----------+--------+
 1.2 NPAR TESTS.  Test Statistics
-+-----------#------+------+
-|           #   x  |   y  |
-+-----------#------+------+
-|Chi-Square #17.333|22.867|
-|df         #     7|     7|
-|Asymp. Sig.#  .015|  .002|
-+-----------#------+------+
++-----------#-----+-----+
+|           #  x  |  y  |
++-----------#-----+-----+
+|Chi-Square #17.33|22.87|
+|df         #    7|    7|
+|Asymp. Sig.#  .02|  .00|
++-----------#-----+-----+
 1.3 NPAR TESTS.  Descriptive Statistics
-+-#--+-----+-----+-----+-----+
-| # N| Mean| Std.|Minim|Maxim|
-| #  |     |Devia|  um |  um |
-#=#==#=====#=====#=====#=====#
-|x#12|2.467|1.193|1.000|5.000|
-|y#15|2.067|1.335|1.000|5.000|
-+-#--+-----+-----+-----+-----+
++-#-----+----+----+----+----+
+| #  N  |Mean|Std.|Mini|Maxi|
+| #     |    |Devi| mum| mum|
+#=#=====#====#====#====#====#
+|x#12.00|2.47|1.19|1.00|5.00|
+|y#15.00|2.07|1.33|1.00|5.00|
++-#-----+----+----+----+----+
 EOF
 if [ $? -ne 0 ] ; then fail ; fi
 
@@ -316,32 +316,32 @@ diff -b $TEMPDIR/pspp.list - <<EOF
 |     #--------+----------+----------+--------#--------+----------+----------+--------+
 |     #Category|Observed N|Expected N|Residual#Category|Observed N|Expected N|Residual|
 +-----#--------+----------+----------+--------#--------+----------+----------+--------+
-|1    #   -2.00|         0|      1.75|   -1.75#   -2.00|         0|      1.75|   -1.75|
-|2    #   -1.00|         0|      1.75|   -1.75#   -1.00|         0|      1.75|   -1.75|
-|3    #     .00|         0|      1.75|   -1.75#     .00|         0|      1.75|   -1.75|
-|4    #    1.00|         3|      1.75|    1.25#    1.00|         7|      1.75|    5.25|
-|5    #    2.00|         3|      1.75|    1.25#    2.00|         4|      1.75|    2.25|
-|6    #    3.00|         5|      1.75|    3.25#    3.00|         1|      1.75|    -.75|
-|7    #    4.00|         2|      1.75|     .25#    4.00|         2|      1.75|     .25|
-|8    #    5.00|         1|      1.75|    -.75#    5.00|         0|      1.75|   -1.75|
-|Total#        |        14|          |        #        |        14|          |        |
+|1    #   -2.00|       .00|      1.75|   -1.75#   -2.00|       .00|      1.75|   -1.75|
+|2    #   -1.00|       .00|      1.75|   -1.75#   -1.00|       .00|      1.75|   -1.75|
+|3    #     .00|       .00|      1.75|   -1.75#     .00|       .00|      1.75|   -1.75|
+|4    #    1.00|      3.00|      1.75|    1.25#    1.00|      7.00|      1.75|    5.25|
+|5    #    2.00|      3.00|      1.75|    1.25#    2.00|      4.00|      1.75|    2.25|
+|6    #    3.00|      5.00|      1.75|    3.25#    3.00|      1.00|      1.75|    -.75|
+|7    #    4.00|      2.00|      1.75|     .25#    4.00|      2.00|      1.75|     .25|
+|8    #    5.00|      1.00|      1.75|    -.75#    5.00|       .00|      1.75|   -1.75|
+|Total#        |     14.00|          |        #        |     14.00|          |        |
 +-----#--------+----------+----------+--------#--------+----------+----------+--------+
 1.2 NPAR TESTS.  Test Statistics
-+-----------#------+------+
-|           #   x  |   y  |
-+-----------#------+------+
-|Chi-Square #13.429|26.000|
-|df         #     7|     7|
-|Asymp. Sig.#  .062|  .001|
-+-----------#------+------+
++-----------#-----+-----+
+|           #  x  |  y  |
++-----------#-----+-----+
+|Chi-Square #13.43|26.00|
+|df         #    7|    7|
+|Asymp. Sig.#  .06|  .00|
++-----------#-----+-----+
 1.3 NPAR TESTS.  Descriptive Statistics
-+-#--+-----+-----+-----+-----+
-| # N| Mean| Std.|Minim|Maxim|
-| #  |     |Devia|  um |  um |
-#=#==#=====#=====#=====#=====#
-|x#14|2.686|1.231|1.000|5.000|
-|y#14|1.857|1.099|1.000|4.000|
-+-#--+-----+-----+-----+-----+
++-#-----+----+----+----+----+
+| #  N  |Mean|Std.|Mini|Maxi|
+| #     |    |Devi| mum| mum|
+#=#=====#====#====#====#====#
+|x#14.00|2.69|1.23|1.00|5.00|
+|y#14.00|1.86|1.10|1.00|4.00|
++-#-----+----+----+----+----+
 EOF
 if [ $? -ne 0 ] ; then fail ; fi
 
index c4a5d825f4895daff1035d489daeb82e7b9a094c..ae0d39fcba50afedfa9c7f66db21af4310387d96 100755 (executable)
@@ -59,7 +59,7 @@ cd $TEMPDIR
 
 activity="create program 1"
 cat > $TESTFILE <<  EOF
-data list notable list /foo * bar * w *.
+data list notable list /foo * bar * w (f8.0).
 begin data.
 1.00     1.00   1
 1.00     2.00   1
@@ -94,7 +94,6 @@ activity="run program 1"
 $SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE
 if [ $? -ne 0 ] ; then no_result ; fi
 
-
 activity="generate results"
 cat > $TEMPDIR/results.txt <<EOF
 1.1 NPAR TESTS.  Ranks
@@ -111,10 +110,10 @@ cat > $TEMPDIR/results.txt <<EOF
 #=====================#==============#
 #                     #second - first#
 #=====================#==============#
-#Z                    #         -.175#
-#Asymp. Sig (2-tailed)#          .861#
-#Exact Sig (2-tailed) #          .893#
-#Exact Sig (1-tailed) #          .446#
+#Z                    #          -.18#
+#Asymp. Sig (2-tailed)#           .86#
+#Exact Sig (2-tailed) #           .89#
+#Exact Sig (1-tailed) #           .45#
 #=====================#==============#
 
 EOF
@@ -126,6 +125,7 @@ diff pspp.list $TEMPDIR/results.txt
 if [ $? -ne 0 ] ; then fail ; fi
 
 
+
 # No weights this time. But some missing values
 activity="create program 2"
 cat > $TESTFILE <<  EOF
@@ -164,7 +164,6 @@ activity="run program 2"
 $SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE
 if [ $? -ne 0 ] ; then no_result ; fi
 
-
 activity="compare output 2"
 diff pspp.list $TEMPDIR/results.txt
 if [ $? -ne 0 ] ; then fail ; fi
index c5f251c136899f178c1dc1048e928955f13402eb..339456d3d9680dd327fbeebc34344558d3504db4 100755 (executable)
@@ -120,16 +120,16 @@ diff -b  $TEMPDIR/pspp.list - << EOF
 #===============#================#===#===#============#
 #               #Levene Statistic|df1|df2|Significance#
 #===============#================#===#===#============#
-#Breaking Strain#            .092|  2| 12|        .913#
+#Breaking Strain#             .09|  2| 12|         .91#
 #===============#================#===#===#============#
 2.3 ONEWAY.  ANOVA
-#==============================#==============#==#===========#=====#============#
-#                              #Sum of Squares|df|Mean Square|  F  |Significance#
-#===============#==============#==============#==#===========#=====#============#
-#Breaking Strain|Between Groups#         20.13| 2|     10.067|5.119|        .025#
-#               |Within Groups #         23.60|12|      1.967|     |            #
-#               |Total         #         43.73|14|           |     |            #
-#===============#==============#==============#==#===========#=====#============#
+#==============================#==============#==#===========#====#============#
+#                              #Sum of Squares|df|Mean Square|  F |Significance#
+#===============#==============#==============#==#===========#====#============#
+#Breaking Strain|Between Groups#         20.13| 2|      10.07|5.12|         .02#
+#               |Within Groups #         23.60|12|       1.97|    |            #
+#               |Total         #         43.73|14|           |    |            #
+#===============#==============#==============#==#===========#====#============#
 2.4 ONEWAY.  Contrast Coefficients
 #==========#=======================#
 #          #      Manufacturer     #
@@ -140,14 +140,14 @@ diff -b  $TEMPDIR/pspp.list - << EOF
 #        |2#      0|    -1|       1#
 #========#=#=======#======#========#
 2.5 ONEWAY.  Contrast Tests
-#===============================================#=================#==========#=====#=====#===============#
-#                                       Contrast#Value of Contrast|Std. Error|  t  |  df |Sig. (2-tailed)#
-#===============#======================#========#=================#==========#=====#=====#===============#
-#Breaking Strain|Assume equal variances|    1   #             3.80|     1.536|2.474|   12|           .029#
-#               |                      |    2   #             1.80|      .887|2.029|   12|           .065#
-#               |Does not assume equal |    1   #             3.80|     1.483|2.562|8.740|           .031#
-#               |                      |    2   #             1.80|      .917|1.964|7.720|           .086#
-#===============#======================#========#=================#==========#=====#=====#===============#
+#===============================================#=================#==========#====#====#===============#
+#                                       Contrast#Value of Contrast|Std. Error|  t | df |Sig. (2-tailed)#
+#===============#======================#========#=================#==========#====#====#===============#
+#Breaking Strain|Assume equal variances|    1   #             3.80|      1.54|2.47|  12|            .03#
+#               |                      |    2   #             1.80|       .89|2.03|  12|            .07#
+#               |Does not assume equal |    1   #             3.80|      1.48|2.56|8.74|            .03#
+#               |                      |    2   #             1.80|       .92|1.96|7.72|            .09#
+#===============#======================#========#=================#==========#====#====#===============#
 EOF
 if [ $? -ne 0 ] ; then fail ; fi
 
index 5f4936d81b6cdf8ba06d4f60848cdedc4e678736..6f9b3490cb96cc1716935fdf46009904919b4fa4 100755 (executable)
@@ -1585,13 +1585,13 @@ diff -b  $TEMPDIR/pspp.list - << EOF
 #        |.05#     .00|              .00|                      8.11#
 #========#===#========#=================#==========================#
 2.2 REGRESSION.  ANOVA
-#===================#==============#====#===========#=====#============#
-#                   #Sum of Squares| df |Mean Square|  F  |Significance#
-#========#==========#==============#====#===========#=====#============#
-#        |Regression#        235.23|   1|    235.232|3.580|        .059#
-#        |Residual  #      98438.40|1498|     65.713|     |            #
-#        |Total     #      98673.63|1499|           |     |            #
-#========#==========#==============#====#===========#=====#============#
+#===================#==============#====#===========#====#============#
+#                   #Sum of Squares| df |Mean Square|  F |Significance#
+#========#==========#==============#====#===========#====#============#
+#        |Regression#        235.23|   1|     235.23|3.58|         .06#
+#        |Residual  #      98438.40|1498|      65.71|    |            #
+#        |Total     #      98673.63|1499|           |    |            #
+#========#==========#==============#====#===========#====#============#
 2.3 REGRESSION.  Coefficients
 #===================#====#==========#====#====#============#
 #                   #  B |Std. Error|Beta|  t |Significance#
index a8e1942e5326143c9f7d2fdd5a40ae820b33f52e..9f8da00249a9682aa106bf521f0bf05203d8ddc2 100755 (executable)
@@ -98,13 +98,13 @@ diff -b  $TEMPDIR/pspp.list - << EOF
 #        |.97#     .94|              .93|                      1.34#
 #========#===#========#=================#==========================#
 2.2 REGRESSION.  ANOVA
-#===================#==============#==#===========#======#============#
-#                   #Sum of Squares|df|Mean Square|   F  |Significance#
-#========#==========#==============#==#===========#======#============#
-#        |Regression#        202.75| 2|    101.376|56.754|        .000#
-#        |Residual  #         12.50| 7|      1.786|      |            #
-#        |Total     #        215.26| 9|           |      |            #
-#========#==========#==============#==#===========#======#============#
+#===================#==============#==#===========#=====#============#
+#                   #Sum of Squares|df|Mean Square|  F  |Significance#
+#========#==========#==============#==#===========#=====#============#
+#        |Regression#        202.75| 2|     101.38|56.75|         .00#
+#        |Residual  #         12.50| 7|       1.79|     |            #
+#        |Total     #        215.26| 9|           |     |            #
+#========#==========#==============#==#===========#=====#============#
 2.3 REGRESSION.  Coefficients
 #===================#=====#==========#=====#======#============#
 #                   #  B  |Std. Error| Beta|   t  |Significance#
index 0bfa7336b23e7b43ca71070b3debf8c3a6e920af..ed4b4b854c4a67f416be869d0705b8839fda9318 100755 (executable)
@@ -253,89 +253,89 @@ diff pspp.list - << EOF
 Scale: Everything
 
 1.1 RELIABILITY.  Case Processing Summary
-#==============#===#=====#
-#              # N |  %  #
-#==============#===#=====#
-#Cases Valid   #131| 92.9#
-#      Excluded# 10|  7.1#
-#      Total   #141|100.0#
-#==============#===#=====#
+#==============#===#======#
+#              # N |   %  #
+#==============#===#======#
+#Cases Valid   #131| 92.91#
+#      Excluded# 10|  7.09#
+#      Total   #141|100.00#
+#==============#===#======#
 
 1.2 RELIABILITY.  Reliability Statistics
 #================#==========#
 #Cronbach's Alpha#N of items#
 #================#==========#
-#            .748#         4#
+#             .75#         4#
 #================#==========#
 
 Scale: Nothing
 
 2.1 RELIABILITY.  Case Processing Summary
-#==============#===#=====#
-#              # N |  %  #
-#==============#===#=====#
-#Cases Valid   #131| 92.9#
-#      Excluded# 10|  7.1#
-#      Total   #141|100.0#
-#==============#===#=====#
+#==============#===#======#
+#              # N |   %  #
+#==============#===#======#
+#Cases Valid   #131| 92.91#
+#      Excluded# 10|  7.09#
+#      Total   #141|100.00#
+#==============#===#======#
 
 2.2 RELIABILITY.  Reliability Statistics
-#==========================================================#====#
-#Cronbach's Alpha               Part 1           Value     #.550#
-#                                                N of Items#   2#
-#                               Part 2           Value     #.631#
-#                                                N of Items#   2#
-#                               Total N of Items           #   4#
-#Correlation Between Forms                                 #.606#
-#Spearman-Brown Coefficient     Equal Length               #.755#
-#                               Unequal Length             #.755#
-#Guttman Split-Half Coefficient                            #.754#
-#==========================================================#====#
+#==========================================================#===#
+#Cronbach's Alpha               Part 1           Value     #.55#
+#                                                N of Items#  2#
+#                               Part 2           Value     #.63#
+#                                                N of Items#  2#
+#                               Total N of Items           #  4#
+#Correlation Between Forms                                 #.61#
+#Spearman-Brown Coefficient     Equal Length               #.75#
+#                               Unequal Length             #.75#
+#Guttman Split-Half Coefficient                            #.75#
+#==========================================================#===#
 
 Scale: Totals
 
 3.1 RELIABILITY.  Case Processing Summary
-#==============#===#=====#
-#              # N |  %  #
-#==============#===#=====#
-#Cases Valid   #131| 92.9#
-#      Excluded# 10|  7.1#
-#      Total   #141|100.0#
-#==============#===#=====#
+#==============#===#======#
+#              # N |   %  #
+#==============#===#======#
+#Cases Valid   #131| 92.91#
+#      Excluded# 10|  7.09#
+#      Total   #141|100.00#
+#==============#===#======#
 
 3.2 RELIABILITY.  Reliability Statistics
 #================#==========#
 #Cronbach's Alpha#N of items#
 #================#==========#
-#            .748#         4#
+#             .75#         4#
 #================#==========#
 
 3.3 RELIABILITY.  Item-Total Statistics
 #=====#==========================#==============================#================================#================================#
 #     #Scale Mean if Item Deleted|Scale Variance if Item Deleted|Corrected Item-Total Correlation|Cronbach's Alpha if Item Deleted#
 #=====#==========================#==============================#================================#================================#
-#var6 #                    15.969|                         8.430|                            .513|                            .705#
-#var8 #                    16.565|                         7.863|                            .530|                            .698#
-#var15#                    16.473|                         8.451|                            .558|                            .682#
-#var17#                    16.603|                         7.995|                            .570|                            .673#
+#var6 #                     15.97|                          8.43|                             .51|                             .71#
+#var8 #                     16.56|                          7.86|                             .53|                             .70#
+#var15#                     16.47|                          8.45|                             .56|                             .68#
+#var17#                     16.60|                          8.00|                             .57|                             .67#
 #=====#==========================#==============================#================================#================================#
 
 Scale: ANY
 
 4.1 RELIABILITY.  Case Processing Summary
-#==============#===#=====#
-#              # N |  %  #
-#==============#===#=====#
-#Cases Valid   #131| 92.9#
-#      Excluded# 10|  7.1#
-#      Total   #141|100.0#
-#==============#===#=====#
+#==============#===#======#
+#              # N |   %  #
+#==============#===#======#
+#Cases Valid   #131| 92.91#
+#      Excluded# 10|  7.09#
+#      Total   #141|100.00#
+#==============#===#======#
 
 4.2 RELIABILITY.  Reliability Statistics
 #================#==========#
 #Cronbach's Alpha#N of items#
 #================#==========#
-#            .748#         4#
+#             .75#         4#
 #================#==========#
 
 EOF
index 5f4a5c17651a677312cc7523ce4d65477b027531..d1272a3db32e7dd3feccdfe3a344b3ee51da03bd 100755 (executable)
@@ -108,20 +108,20 @@ diff  -b $TEMPDIR/pspp.list - <<EOF
 #===========#==#====#==============#========#
 #     INDEP | N|Mean|Std. Deviation|SE. Mean#
 #===========#==#====#==============#========#
-#DEP >=1.514|11|9.00|         3.821|   1.152#
-#    <1.514 |11|8.00|         2.864|    .863#
+#DEP >=1.514|11|9.00|          3.82|    1.15#
+#    <1.514 |11|8.00|          2.86|     .86#
 #===========#==#====#==============#========#
 2.2 T-TEST.  Independent Samples Test
-#==============================#=========#===============================================================================#
-#                              # Levene's|                          t-test for Equality of Means                         #
-#                              #----+----+-----+------+---------------+---------------+---------------------+------------#
-#                              #    |    |     |      |               |               |                     |    95%     #
-#                              #    |    |     |      |               |               |                     +------+-----#
-#                              #  F |Sig.|  t  |  df  |Sig. (2-tailed)|Mean Difference|Std. Error Difference| Lower|Upper#
-#==============================#====#====#=====#======#===============#===============#=====================#======#=====#
-#DEPEqual variances assumed    #.172|.683|-.695|    20|           .495|         -1.000|                1.440|-4.003|2.003#
-#   Equal variances not assumed#    |    |-.695|18.539|           .496|         -1.000|                1.440|-4.018|2.018#
-#==============================#====#====#=====#======#===============#===============#=====================#======#=====#
+#==============================#========#============================================================================#
+#                              #Levene's|                        t-test for Equality of Means                        #
+#                              #---+----+----+-----+---------------+---------------+---------------------+-----------#
+#                              #   |    |    |     |               |               |                     |    95%    #
+#                              #   |    |    |     |               |               |                     +-----+-----#
+#                              # F |Sig.|  t |  df |Sig. (2-tailed)|Mean Difference|Std. Error Difference|Lower|Upper#
+#==============================#===#====#====#=====#===============#===============#=====================#=====#=====#
+#DEPEqual variances assumed    #.17| .68|-.69|20.00|            .50|          -1.00|                 1.44|-4.00| 2.00#
+#   Equal variances not assumed#   |    |-.69|18.54|            .50|          -1.00|                 1.44|-4.02| 2.02#
+#==============================#===#====#====#=====#===============#===============#=====================#=====#=====#
 EOF
 if [ $? -ne 0 ] ; then fail ; fi
 
index 4019865b52c5a8baf0b8baef12a24cc7180d7a04..2b45701c97ff3385433901b1b59b1703e80dae67 100755 (executable)
@@ -91,18 +91,18 @@ diff  -b $TEMPDIR/pspp.list - <<EOF
 #===#=#====#==============#========#
 #   #N|Mean|Std. Deviation|SE. Mean#
 #===#=#====#==============#========#
-#ABC#6|3.00|           .84|    .342#
+#ABC#6|3.00|           .84|     .34#
 #===#=#====#==============#========#
 2.2 T-TEST.  One-Sample Test
-#===#=====================================================#
-#   #                Test Value = 2.000000                #
-#   #-----+--+---------------+---------------+------------#
-#   #     |  |               |               |    95%     #
-#   #     |  |               |               +-----+------#
-#   #  t  |df|Sig. (2-tailed)|Mean Difference|Lower| Upper#
-#===#=====#==#===============#===============#=====#======#
-#ABC#2.928| 5|           .033|          1.000|.1220|1.8780#
-#===#=====#==#===============#===============#=====#======#
+#===#===================================================#
+#   #               Test Value = 2.000000               #
+#   #----+--+---------------+---------------+-----------#
+#   #    |  |               |               |    95%    #
+#   #    |  |               |               +-----+-----#
+#   #  t |df|Sig. (2-tailed)|Mean Difference|Lower|Upper#
+#===#====#==#===============#===============#=====#=====#
+#ABC#2.93| 5|            .03|           1.00|  .12| 1.88#
+#===#====#==#===============#===============#=====#=====#
 EOF
 if [ $? -ne 0 ] ; then fail ; fi
 
index 25946236121aa271a76e6bcbe62b9b1a60a313ac..3ba90f14b2d80c7cbfa673b237814de7e5ce738e 100755 (executable)
@@ -91,25 +91,25 @@ diff  -b $TEMPDIR/pspp.list - <<EOF
 #========#====#=#==============#========#
 #        #Mean|N|Std. Deviation|SE. Mean#
 #========#====#=#==============#========#
-#Pair 0 A#2.00|5|          .707|    .316#
-#       B#4.00|5|         1.541|    .689#
+#Pair 0 A#2.00|5|           .71|     .32#
+#       B#4.00|5|          1.54|     .69#
 #========#====#=#==============#========#
 2.2 T-TEST.  Paired Samples Correlations
 #======#=====#=#===========#====#
 #      |     #N|Correlation|Sig.#
 #======#=====#=#===========#====#
-#Pair 0|A & B#5|       .918|.028#
+#Pair 0|A & B#5|        .92| .03#
 #======#=====#=#===========#====#
 2.3 T-TEST.  Paired Samples Test
-#===========#=====================================================#======#==#===============#
-#           #                  Paired Differences                 |      |  |               #
-#           #-------+--------------+---------------+--------------+      |  |               #
-#           #       |              |               |95% Confidence|      |  |               #
-#           #       |              |               +-------+------+      |  |               #
-#           #  Mean |Std. Deviation|Std. Error Mean| Lower | Upper|   t  |df|Sig. (2-tailed)#
-#===========#=======#==============#===============#=======#======#======#==#===============#
-#Pair 0A - B#-2.0000|        .93541|         .41833|-3.1615|-.8385|-4.781| 4|           .009#
-#===========#=======#==============#===============#=======#======#======#==#===============#
+#===========#================================================#=====#==#===============#
+#           #               Paired Differences               |     |  |               #
+#           #-----+--------------+---------------+-----------+     |  |               #
+#           #     |              |               |    95%    |     |  |               #
+#           #     |              |               +-----+-----+     |  |               #
+#           # Mean|Std. Deviation|Std. Error Mean|Lower|Upper|  t  |df|Sig. (2-tailed)#
+#===========#=====#==============#===============#=====#=====#=====#==#===============#
+#Pair 0A - B#-2.00|           .94|            .42|-3.16| -.84|-4.78| 4|            .01#
+#===========#=====#==============#===============#=====#=====#=====#==#===============#
 EOF
 if [ $? -ne 0 ] ; then fail ; fi
 
index e2a5af71ae4597e0e1a7b8d7c2ce80ff1cffd56a..660752dd914eda2d4146a9aea42ebc7695597515 100755 (executable)
@@ -96,32 +96,32 @@ diff -b  $TEMPDIR/pspp.list - << EOF
 |C       |F8.0  |
 +--------+------+
 2.1 EXAMINE.  Case Processing Summary
-#=#===============================#
-# #             Cases             #
-# #----------+---------+----------#
-# #   Valid  | Missing |   Total  #
-# #--+-------+-+-------+--+-------#
-# # N|Percent|N|Percent| N|Percent#
-#=#==#=======#=#=======#==#=======#
-#X#52|   100%|0|     0%|52|   100%#
-#=#==#=======#=#=======#==#=======#
+#=#=======================================#
+# #                 Cases                 #
+# #-------------+-----------+-------------#
+# #    Valid    |  Missing  |    Total    #
+# #-----+-------+---+-------+-----+-------#
+# #  N  |Percent| N |Percent|  N  |Percent#
+#=#=====#=======#===#=======#=====#=======#
+#X#52.00|   100%|.00|     0%|52.00|   100%#
+#=#=====#=======#===#=======#=====#=======#
 2.2 EXAMINE.  Descriptives
 #==============================================#=========#==========#
 #                                              #Statistic|Std. Error#
 #==============================================#=========#==========#
-#X Mean                                        #   2.02  |   .034   #
-#  95% Confidence Interval for Mean Lower Bound#  1.952  |          #
-#                                   Upper Bound#  2.087  |          #
+#X Mean                                        #   2.02  |    .03   #
+#  95% Confidence Interval for Mean Lower Bound#   1.95  |          #
+#                                   Upper Bound#   2.09  |          #
 #  5% Trimmed Mean                             #   2.00  |          #
 #  Median                                      #   2.00  |          #
-#  Variance                                    #   .058  |          #
-#  Std. Deviation                              #   .242  |          #
-#  Minimum                                     #  1.000  |          #
-#  Maximum                                     #  3.000  |          #
-#  Range                                       #  2.000  |          #
+#  Variance                                    #   .0  |          #
+#  Std. Deviation                              #   .24   |          #
+#  Minimum                                     #   1.00  |          #
+#  Maximum                                     #   3.00  |          #
+#  Range                                       #   2.00  |          #
 #  Interquartile Range                         #   .00   |          #
-#  Skewness                                    #  1.194  |   .330   #
-#  Kurtosis                                    #  15.732 |   .650   #
+#  Skewness                                    #   1.19  |    .33   #
+#  Kurtosis                                    #  15.73  |    .65   #
 #==============================================#=========#==========#
 EOF
 if [ $? -ne 0 ] ; then fail ; fi
index 6d90315652246bb061504b15db42a7d68880ec29..5da366d9968d9941f34eb5561a7538eaf031dc0a 100755 (executable)
@@ -61,6 +61,7 @@ cd $TEMPDIR
 
 activity="create program"
 cat > $TESTFILE << EOF
+SET FORMAT F8.3.
 data list file='$top_srcdir/tests/weighting.data'/AVAR 1-5 BVAR 6-10.
 weight by BVAR.
 
@@ -86,87 +87,87 @@ diff  -b $TEMPDIR/pspp.list - <<EOF
 |BVAR    |     1|  6- 10|F5.0  |
 +--------+------+-------+------+
 2.1 DESCRIPTIVES.  Valid cases = 730; cases with missing value(s) = 0.
-+--------#-------+---------+------+--------+-------+--------+--------+--------+--------+--------+------+-------+-------+---------+
-|Variable#Valid N|Missing N| Mean |S E Mean|Std Dev|Variance|Kurtosis|S E Kurt|Skewness|S E Skew| Range|Minimum|Maximum|   Sum   |
-#========#=======#=========#======#========#=======#========#========#========#========#========#======#=======#=======#=========#
-|AVAR    #    730|        0|31.515|    .405| 10.937| 119.608|   2.411|    .181|   1.345|    .090|76.000| 18.000| 94.000|23006.000|
-+--------#-------+---------+------+--------+-------+--------+--------+--------+--------+--------+------+-------+-------+---------+
-3.1 FREQUENCIES.  AVAR 
++--------#-------+---------+------+--------+-------+--------+--------+--------+--------+--------+------+-------+-------+--------+
+|Variable#Valid N|Missing N| Mean |S E Mean|Std Dev|Variance|Kurtosis|S E Kurt|Skewness|S E Skew| Range|Minimum|Maximum|   Sum  |
+#========#=======#=========#======#========#=======#========#========#========#========#========#======#=======#=======#========#
+|AVAR    #    730|        0|31.515|    .405| 10.937| 119.608|   2.411|    .181|   1.345|    .090|76.000| 18.000| 94.000|23006.00|
++--------#-------+---------+------+--------+-------+--------+--------+--------+--------+--------+------+-------+-------+--------+
+3.1 FREQUENCIES.  AVAR
 +--------+--------+---+---+
 |        |        |   |Cum|
 |  Value |  Freq  |Pct|Pct|
 #========#========#===#===#
-|      18|       1|  0|  0|
-|      19|       7|  1|  1|
-|      20|      26|  4|  5|
-|      21|      76| 10| 15|
-|      22|      57|  8| 23|
-|      23|      58|  8| 31|
-|      24|      38|  5| 36|
-|      25|      38|  5| 41|
-|      26|      30|  4| 45|
-|      27|      21|  3| 48|
-|      28|      23|  3| 51|
-|      29|      24|  3| 55|
-|      30|      23|  3| 58|
-|      31|      14|  2| 60|
-|      32|      21|  3| 63|
-|      33|      21|  3| 65|
-|      34|      14|  2| 67|
-|      35|      14|  2| 69|
-|      36|      17|  2| 72|
-|      37|      11|  2| 73|
-|      38|      16|  2| 75|
-|      39|      14|  2| 77|
-|      40|      15|  2| 79|
-|      41|      14|  2| 81|
-|      42|      14|  2| 83|
-|      43|       8|  1| 84|
-|      44|      15|  2| 86|
-|      45|      10|  1| 88|
-|      46|      12|  2| 89|
-|      47|      13|  2| 91|
-|      48|      13|  2| 93|
-|      49|       5|  1| 94|
-|      50|       5|  1| 94|
-|      51|       3|  0| 95|
-|      52|       7|  1| 96|
-|      53|       6|  1| 96|
-|      54|       2|  0| 97|
-|      55|       2|  0| 97|
-|      56|       2|  0| 97|
-|      57|       3|  0| 98|
-|      58|       1|  0| 98|
-|      59|       3|  0| 98|
-|      61|       1|  0| 98|
-|      62|       3|  0| 99|
-|      63|       1|  0| 99|
-|      64|       1|  0| 99|
-|      65|       2|  0| 99|
-|      70|       1|  0| 99|
-|      78|       1|  0|100|
-|      79|       1|  0|100|
-|      80|       1|  0|100|
-|      94|       1|  0|100|
+|      18|       1|.13|.13|
+|      19|       7|.95|1.0|
+|      20|      26|3.5|4.6|
+|      21|      76|10.|15.|
+|      22|      57|7.8|22.|
+|      23|      58|7.9|30.|
+|      24|      38|5.2|36.|
+|      25|      38|5.2|41.|
+|      26|      30|4.1|45.|
+|      27|      21|2.8|48.|
+|      28|      23|3.1|51.|
+|      29|      24|3.2|54.|
+|      30|      23|3.1|57.|
+|      31|      14|1.9|59.|
+|      32|      21|2.8|62.|
+|      33|      21|2.8|65.|
+|      34|      14|1.9|67.|
+|      35|      14|1.9|69.|
+|      36|      17|2.3|71.|
+|      37|      11|1.5|73.|
+|      38|      16|2.1|75.|
+|      39|      14|1.9|77.|
+|      40|      15|2.0|79.|
+|      41|      14|1.9|81.|
+|      42|      14|1.9|83.|
+|      43|       8|1.0|84.|
+|      44|      15|2.0|86.|
+|      45|      10|1.3|87.|
+|      46|      12|1.6|89.|
+|      47|      13|1.7|91.|
+|      48|      13|1.7|92.|
+|      49|       5|.68|93.|
+|      50|       5|.68|94.|
+|      51|       3|.41|94.|
+|      52|       7|.95|95.|
+|      53|       6|.82|96.|
+|      54|       2|.27|96.|
+|      55|       2|.27|96.|
+|      56|       2|.27|97.|
+|      57|       3|.41|97.|
+|      58|       1|.13|97.|
+|      59|       3|.41|98.|
+|      61|       1|.13|98.|
+|      62|       3|.41|98.|
+|      63|       1|.13|98.|
+|      64|       1|.13|99.|
+|      65|       2|.27|99.|
+|      70|       1|.13|99.|
+|      78|       1|.13|99.|
+|      79|       1|.13|99.|
+|      80|       1|.13|99.|
+|      94|       1|.13|100|
 +--------+--------+---+---+
-+-----------------------+---------+
-|N           Valid      |      730|
-|            Missing    |        0|
-|Mean                   |   31.515|
-|S.E. Mean              |     .405|
-|Mode                   |   21.000|
-|Std Dev                |   10.937|
-|Variance               |  119.608|
-|Kurtosis               |    2.411|
-|S.E. Kurt              |     .181|
-|Skewness               |    1.345|
-|S.E. Skew              |     .090|
-|Range                  |   76.000|
-|Minimum                |   18.000|
-|Maximum                |   94.000|
-|Sum                    |23006.000|
-|Percentiles 50 (Median)|   28.500|
-+-----------------------+---------+
++-----------------------+--------+
+|N           Valid      |     730|
+|            Missing    |       0|
+|Mean                   |  31.515|
+|S.E. Mean              |    .405|
+|Mode                   |  21.000|
+|Std Dev                |  10.937|
+|Variance               | 119.608|
+|Kurtosis               |   2.411|
+|S.E. Kurt              |    .181|
+|Skewness               |   1.345|
+|S.E. Skew              |    .090|
+|Range                  |  76.000|
+|Minimum                |  18.000|
+|Maximum                |  94.000|
+|Sum                    |23006.00|
+|Percentiles 50 (Median)|      29|
++-----------------------+--------+
 EOF
 if [ $? -ne 0 ] ; then fail ; fi
 
index 82b8cdaa24b2ab1d60641a2a6e18d760f94b7055..ab9618fc0b87a7590e251b8471f9ad75020f0d8f 100755 (executable)
@@ -111,27 +111,27 @@ diff -b $TEMPDIR/pspp.list - <<EOF
 |V16     |     1| 17- 17|F1.0  |
 +--------+------+-------+------+
 2.1 DESCRIPTIVES.  Valid cases = 10; cases with missing value(s) = 0.
-+--------#-------+---------+-----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+------+
-|Variable#Valid N|Missing N| Mean|S E Mean|Std Dev|Variance|Kurtosis|S E Kurt|Skewness|S E Skew|Range|Minimum|Maximum|  Sum |
-#========#=======#=========#=====#========#=======#========#========#========#========#========#=====#=======#=======#======#
-|V0      #     10|        0|3.800|    .841|  2.658|   7.067|   -.035|   1.334|    .889|    .687|8.000|  1.000|  9.000|38.000|
-|V1      #     10|        0|4.600|    .957|  3.026|   9.156|  -1.386|   1.334|   -.032|    .687|9.000|   .000|  9.000|46.000|
-|V2      #     10|        0|4.100|   1.159|  3.665|  13.433|  -2.019|   1.334|    .476|    .687|8.000|  1.000|  9.000|41.000|
-|V3      #     10|        0|4.100|    .875|  2.767|   7.656|  -2.049|   1.334|    .422|    .687|7.000|  1.000|  8.000|41.000|
-|V4      #     10|        0|7.000|    .471|  1.491|   2.222|   7.152|   1.334|  -2.516|    .687|5.000|  3.000|  8.000|70.000|
-|V5      #     10|        0|4.900|   1.027|  3.247|  10.544|  -1.401|   1.334|   -.205|    .687|9.000|   .000|  9.000|49.000|
-|V6      #     10|        0|5.900|    .795|  2.514|   6.322|   -.290|   1.334|   -.960|    .687|7.000|  1.000|  8.000|59.000|
-|V7      #     10|        0|4.700|   1.096|  3.466|  12.011|  -1.993|   1.334|   -.165|    .687|9.000|   .000|  9.000|47.000|
-|V8      #     10|        0|4.100|   1.100|  3.479|  12.100|  -1.928|   1.334|    .371|    .687|9.000|   .000|  9.000|41.000|
-|V9      #     10|        0|4.300|    .870|  2.751|   7.567|   -.875|   1.334|    .730|    .687|8.000|  1.000|  9.000|43.000|
-|V10     #     10|        0|5.500|    .847|  2.677|   7.167|  -1.842|   1.334|   -.326|    .687|7.000|  2.000|  9.000|55.000|
-|V11     #     10|        0|6.500|    .778|  2.461|   6.056|  -1.276|   1.334|   -.895|    .687|6.000|  3.000|  9.000|65.000|
-|V12     #     10|        0|7.900|    .605|  1.912|   3.656|   5.241|   1.334|  -2.208|    .687|6.000|  3.000|  9.000|79.000|
-|V13     #     10|        0|4.300|    .989|  3.129|   9.789|  -1.248|   1.334|    .333|    .687|9.000|   .000|  9.000|43.000|
-|V14     #     10|        0|3.600|   1.013|  3.204|  10.267|   -.961|   1.334|    .809|    .687|9.000|   .000|  9.000|36.000|
-|V15     #     10|        0|3.700|    .920|  2.908|   8.456|  -1.352|   1.334|    .710|    .687|7.000|  1.000|  8.000|37.000|
-|V16     #     10|        0|6.400|    .909|  2.875|   8.267|  -1.142|   1.334|   -.923|    .687|7.000|  2.000|  9.000|64.000|
-+--------#-------+---------+-----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+------+
++--------#-------+---------+----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+-----+
+|Variable#Valid N|Missing N|Mean|S E Mean|Std Dev|Variance|Kurtosis|S E Kurt|Skewness|S E Skew|Range|Minimum|Maximum| Sum |
+#========#=======#=========#====#========#=======#========#========#========#========#========#=====#=======#=======#=====#
+|V0      #     10|        0|3.80|     .84|   2.66|    7.07|    -.03|    1.33|     .89|     .69| 8.00|   1.00|   9.00|38.00|
+|V1      #     10|        0|4.60|     .96|   3.03|    9.16|   -1.39|    1.33|    -.03|     .69| 9.00|    .00|   9.00|46.00|
+|V2      #     10|        0|4.10|    1.16|   3.67|   13.43|   -2.02|    1.33|     .48|     .69| 8.00|   1.00|   9.00|41.00|
+|V3      #     10|        0|4.10|     .87|   2.77|    7.66|   -2.05|    1.33|     .42|     .69| 7.00|   1.00|   8.00|41.00|
+|V4      #     10|        0|7.00|     .47|   1.49|    2.22|    7.15|    1.33|   -2.52|     .69| 5.00|   3.00|   8.00|70.00|
+|V5      #     10|        0|4.90|    1.03|   3.25|   10.54|   -1.40|    1.33|    -.20|     .69| 9.00|    .00|   9.00|49.00|
+|V6      #     10|        0|5.90|     .80|   2.51|    6.32|    -.29|    1.33|    -.96|     .69| 7.00|   1.00|   8.00|59.00|
+|V7      #     10|        0|4.70|    1.10|   3.47|   12.01|   -1.99|    1.33|    -.16|     .69| 9.00|    .00|   9.00|47.00|
+|V8      #     10|        0|4.10|    1.10|   3.48|   12.10|   -1.93|    1.33|     .37|     .69| 9.00|    .00|   9.00|41.00|
+|V9      #     10|        0|4.30|     .87|   2.75|    7.57|    -.87|    1.33|     .73|     .69| 8.00|   1.00|   9.00|43.00|
+|V10     #     10|        0|5.50|     .85|   2.68|    7.17|   -1.84|    1.33|    -.33|     .69| 7.00|   2.00|   9.00|55.00|
+|V11     #     10|        0|6.50|     .78|   2.46|    6.06|   -1.28|    1.33|    -.89|     .69| 6.00|   3.00|   9.00|65.00|
+|V12     #     10|        0|7.90|     .60|   1.91|    3.66|    5.24|    1.33|   -2.21|     .69| 6.00|   3.00|   9.00|79.00|
+|V13     #     10|        0|4.30|     .99|   3.13|    9.79|   -1.25|    1.33|     .33|     .69| 9.00|    .00|   9.00|43.00|
+|V14     #     10|        0|3.60|    1.01|   3.20|   10.27|    -.96|    1.33|     .81|     .69| 9.00|    .00|   9.00|36.00|
+|V15     #     10|        0|3.70|     .92|   2.91|    8.46|   -1.35|    1.33|     .71|     .69| 7.00|   1.00|   8.00|37.00|
+|V16     #     10|        0|6.40|     .91|   2.88|    8.27|   -1.14|    1.33|    -.92|     .69| 7.00|   2.00|   9.00|64.00|
++--------#-------+---------+----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+-----+
 EOF
 if [ $? -ne 0 ] ; then fail ; fi
 
index 72d7841f33119726a95dace55e03d8732f577b8f..eb12331b9308ca30e67bf4deb534f0969f3c6ba2 100755 (executable)
@@ -58,6 +58,8 @@ cd $TEMPDIR
 
 activity="create program"
 cat > $TEMPDIR/descript.stat <<EOF
+SET FORMAT F8.3.
+
 data list notable / X 1.
 begin data.
 0
index a295be5dcaf6d2734ccd091bc3dad749b56ff56c..dacd35824c4ba6072da097f6872a530d3b687e92 100755 (executable)
@@ -98,37 +98,37 @@ diff -b $TEMPDIR/pspp.list - <<EOF
 |V3      |     1|  3-  3|F1.0  |
 +--------+------+-------+------+
 2.1 DESCRIPTIVES.  Valid cases = 7; cases with missing value(s) = 6.
-+--------#-------+---------+-----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+-----+
-|Variable#Valid N|Missing N| Mean|S E Mean|Std Dev|Variance|Kurtosis|S E Kurt|Skewness|S E Skew|Range|Minimum|Maximum| Sum |
-#========#=======#=========#=====#========#=======#========#========#========#========#========#=====#=======#=======#=====#
-|V1      #      1|        6|2.000|    .   |   .   |    .   |    .   |    .   |    .   |    .   | .000|  2.000|  2.000|2.000|
-|V2      #      2|        5|2.500|    .500|   .707|    .500|    .   |    .   |    .   |    .   |1.000|  2.000|  3.000|5.000|
-|V3      #      3|        4|3.000|    .577|  1.000|   1.000|    .   |    .   |    .000|   1.225|2.000|  2.000|  4.000|9.000|
-+--------#-------+---------+-----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+-----+
++--------#-------+---------+----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+----+
+|Variable#Valid N|Missing N|Mean|S E Mean|Std Dev|Variance|Kurtosis|S E Kurt|Skewness|S E Skew|Range|Minimum|Maximum| Sum|
+#========#=======#=========#====#========#=======#========#========#========#========#========#=====#=======#=======#====#
+|V1      #      1|        6|2.00|     .  |    .  |     .  |     .  |     .  |     .  |     .  |  .00|   2.00|   2.00|2.00|
+|V2      #      2|        5|2.50|     .50|    .71|     .50|     .  |     .  |     .  |     .  | 1.00|   2.00|   3.00|5.00|
+|V3      #      3|        4|3.00|     .58|   1.00|    1.00|     .  |     .  |     .00|    1.22| 2.00|   2.00|   4.00|9.00|
++--------#-------+---------+----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+----+
 3.1 DESCRIPTIVES.  Valid cases = 7; cases with missing value(s) = 3.
-+--------#-------+---------+-----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+------+
-|Variable#Valid N|Missing N| Mean|S E Mean|Std Dev|Variance|Kurtosis|S E Kurt|Skewness|S E Skew|Range|Minimum|Maximum|  Sum |
-#========#=======#=========#=====#========#=======#========#========#========#========#========#=====#=======#=======#======#
-|V1      #      5|        2|1.200|    .200|   .447|    .200|   5.000|   2.000|   2.236|    .913|1.000|  1.000|  2.000| 6.000|
-|V2      #      5|        2|1.600|    .400|   .894|    .800|    .312|   2.000|   1.258|    .913|2.000|  1.000|  3.000| 8.000|
-|V3      #      5|        2|2.200|    .583|  1.304|   1.700|  -1.488|   2.000|    .541|    .913|3.000|  1.000|  4.000|11.000|
-+--------#-------+---------+-----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+------+
++--------#-------+---------+----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+-----+
+|Variable#Valid N|Missing N|Mean|S E Mean|Std Dev|Variance|Kurtosis|S E Kurt|Skewness|S E Skew|Range|Minimum|Maximum| Sum |
+#========#=======#=========#====#========#=======#========#========#========#========#========#=====#=======#=======#=====#
+|V1      #      5|        2|1.20|     .20|    .45|     .20|    5.00|    2.00|    2.24|     .91| 1.00|   1.00|   2.00| 6.00|
+|V2      #      5|        2|1.60|     .40|    .89|     .80|     .31|    2.00|    1.26|     .91| 2.00|   1.00|   3.00| 8.00|
+|V3      #      5|        2|2.20|     .58|   1.30|    1.70|   -1.49|    2.00|     .54|     .91| 3.00|   1.00|   4.00|11.00|
++--------#-------+---------+----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+-----+
 4.1 DESCRIPTIVES.  Valid cases = 1; cases with missing value(s) = 6.
-+--------#-------+---------+-----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+-----+
-|Variable#Valid N|Missing N| Mean|S E Mean|Std Dev|Variance|Kurtosis|S E Kurt|Skewness|S E Skew|Range|Minimum|Maximum| Sum |
-#========#=======#=========#=====#========#=======#========#========#========#========#========#=====#=======#=======#=====#
-|V1      #      1|        0|2.000|    .   |   .   |    .   |    .   |    .   |    .   |    .   | .000|  2.000|  2.000|2.000|
-|V2      #      1|        0|3.000|    .   |   .   |    .   |    .   |    .   |    .   |    .   | .000|  3.000|  3.000|3.000|
-|V3      #      1|        0|4.000|    .   |   .   |    .   |    .   |    .   |    .   |    .   | .000|  4.000|  4.000|4.000|
-+--------#-------+---------+-----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+-----+
++--------#-------+---------+----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+----+
+|Variable#Valid N|Missing N|Mean|S E Mean|Std Dev|Variance|Kurtosis|S E Kurt|Skewness|S E Skew|Range|Minimum|Maximum| Sum|
+#========#=======#=========#====#========#=======#========#========#========#========#========#=====#=======#=======#====#
+|V1      #      1|        0|2.00|     .  |    .  |     .  |     .  |     .  |     .  |     .  |  .00|   2.00|   2.00|2.00|
+|V2      #      1|        0|3.00|     .  |    .  |     .  |     .  |     .  |     .  |     .  |  .00|   3.00|   3.00|3.00|
+|V3      #      1|        0|4.00|     .  |    .  |     .  |     .  |     .  |     .  |     .  |  .00|   4.00|   4.00|4.00|
++--------#-------+---------+----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+----+
 5.1 DESCRIPTIVES.  Valid cases = 4; cases with missing value(s) = 3.
-+--------#-------+---------+-----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+------+
-|Variable#Valid N|Missing N| Mean|S E Mean|Std Dev|Variance|Kurtosis|S E Kurt|Skewness|S E Skew|Range|Minimum|Maximum|  Sum |
-#========#=======#=========#=====#========#=======#========#========#========#========#========#=====#=======#=======#======#
-|V1      #      4|        0|1.250|    .250|   .500|    .250|   4.000|   2.619|   2.000|   1.014|1.000|  1.000|  2.000| 5.000|
-|V2      #      4|        0|1.750|    .479|   .957|    .917|  -1.289|   2.619|    .855|   1.014|2.000|  1.000|  3.000| 7.000|
-|V3      #      4|        0|2.500|    .645|  1.291|   1.667|  -1.200|   2.619|    .000|   1.014|3.000|  1.000|  4.000|10.000|
-+--------#-------+---------+-----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+------+
++--------#-------+---------+----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+-----+
+|Variable#Valid N|Missing N|Mean|S E Mean|Std Dev|Variance|Kurtosis|S E Kurt|Skewness|S E Skew|Range|Minimum|Maximum| Sum |
+#========#=======#=========#====#========#=======#========#========#========#========#========#=====#=======#=======#=====#
+|V1      #      4|        0|1.25|     .25|    .50|     .25|    4.00|    2.62|    2.00|    1.01| 1.00|   1.00|   2.00| 5.00|
+|V2      #      4|        0|1.75|     .48|    .96|     .92|   -1.29|    2.62|     .85|    1.01| 2.00|   1.00|   3.00| 7.00|
+|V3      #      4|        0|2.50|     .65|   1.29|    1.67|   -1.20|    2.62|     .00|    1.01| 3.00|   1.00|   4.00|10.00|
++--------#-------+---------+----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+-----+
 EOF
 if [ $? -ne 0 ] ; then fail ; fi
 
index d1e724d70f1289e4027c1bdd93d3e82a272f653d..8ac4c772a410bf8b6de9308de1ac4e30af7651f1 100755 (executable)
@@ -88,32 +88,32 @@ if [ $? -ne 0 ] ; then no_result ; fi
 activity="compare output $i"
 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
 diff  -b $TEMPDIR/pspp.list - <<EOF
-1.1 FREQUENCIES.  X 
+1.1 FREQUENCIES.  X
 +-----------+--------+---------+--------+--------+--------+
 |           |        |         |        |  Valid |   Cum  |
 |Value Label|  Value |Frequency| Percent| Percent| Percent|
 #===========#========#=========#========#========#========#
-|           |    1.00|        1|    20.0|    20.0|    20.0|
-|           |    2.00|        1|    20.0|    20.0|    40.0|
-|           |    3.00|        1|    20.0|    20.0|    60.0|
-|           |    4.00|        1|    20.0|    20.0|    80.0|
-|           |    5.00|        1|    20.0|    20.0|   100.0|
+|           |    1.00|        1|   20.00|   20.00|   20.00|
+|           |    2.00|        1|   20.00|   20.00|   40.00|
+|           |    3.00|        1|   20.00|   20.00|   60.00|
+|           |    4.00|        1|   20.00|   20.00|   80.00|
+|           |    5.00|        1|   20.00|   20.00|  100.00|
 #===========#========#=========#========#========#========#
 |               Total|        5|   100.0|   100.0|        |
 +--------------------+---------+--------+--------+--------+
-+-----------------------+-----+
-|N           Valid      |    5|
-|            Missing    |    0|
-|Mean                   |3.000|
-|Std Dev                |1.581|
-|Minimum                |1.000|
-|Maximum                |5.000|
-|Percentiles 0          |1.000|
-|            25         |1.500|
-|            50 (Median)|3.000|
-|            75         |4.500|
-|            100        |5.000|
-+-----------------------+-----+
++-----------------------+----+
+|N           Valid      |   5|
+|            Missing    |   0|
+|Mean                   |3.00|
+|Std Dev                |1.58|
+|Minimum                |1.00|
+|Maximum                |5.00|
+|Percentiles 0          |1.00|
+|            25         |1.50|
+|            50 (Median)|3.00|
+|            75         |4.50|
+|            100        |5.00|
++-----------------------+----+
 EOF
 if [ $? -ne 0 ] ; then fail ; fi
 
index f818f820b48e35b6f1d04cbe6b03a5dc13817688..4e30d20b8dddb2931df44031fc3438ccfeeb01b5 100755 (executable)
@@ -87,32 +87,32 @@ if [ $? -ne 0 ] ; then no_result ; fi
 activity="compare output $i"
 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
 diff  -b $TEMPDIR/pspp.list - <<EOF
-1.1 FREQUENCIES.  X 
+1.1 FREQUENCIES.  X
 +-----------+--------+---------+--------+--------+--------+
 |           |        |         |        |  Valid |   Cum  |
 |Value Label|  Value |Frequency| Percent| Percent| Percent|
 #===========#========#=========#========#========#========#
-|           |    1.00|        1|    20.0|    20.0|    20.0|
-|           |    2.00|        1|    20.0|    20.0|    40.0|
-|           |    3.00|        1|    20.0|    20.0|    60.0|
-|           |    4.00|        1|    20.0|    20.0|    80.0|
-|           |    5.00|        1|    20.0|    20.0|   100.0|
+|           |    1.00|        1|   20.00|   20.00|   20.00|
+|           |    2.00|        1|   20.00|   20.00|   40.00|
+|           |    3.00|        1|   20.00|   20.00|   60.00|
+|           |    4.00|        1|   20.00|   20.00|   80.00|
+|           |    5.00|        1|   20.00|   20.00|  100.00|
 #===========#========#=========#========#========#========#
 |               Total|        5|   100.0|   100.0|        |
 +--------------------+---------+--------+--------+--------+
-+-----------------------+-----+
-|N           Valid      |    5|
-|            Missing    |    0|
-|Mean                   |3.000|
-|Std Dev                |1.581|
-|Minimum                |1.000|
-|Maximum                |5.000|
-|Percentiles 0          |1.000|
-|            25         |2.000|
-|            50 (Median)|3.000|
-|            75         |4.000|
-|            100        |5.000|
-+-----------------------+-----+
++-----------------------+----+
+|N           Valid      |   5|
+|            Missing    |   0|
+|Mean                   |3.00|
+|Std Dev                |1.58|
+|Minimum                |1.00|
+|Maximum                |5.00|
+|Percentiles 0          |1.00|
+|            25         |2.00|
+|            50 (Median)|3.00|
+|            75         |4.00|
+|            100        |5.00|
++-----------------------+----+
 EOF
 if [ $? -ne 0 ] ; then fail ; fi
 
@@ -150,31 +150,31 @@ if [ $? -ne 0 ] ; then no_result ; fi
 activity="compare output $i"
 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
 diff  -b $TEMPDIR/pspp.list - <<EOF
-1.1 FREQUENCIES.  X 
+1.1 FREQUENCIES.  X
 +-----------+--------+---------+--------+--------+--------+
 |           |        |         |        |  Valid |   Cum  |
 |Value Label|  Value |Frequency| Percent| Percent| Percent|
 #===========#========#=========#========#========#========#
-|           |    1.00|        2|    20.0|    20.0|    20.0|
-|           |    2.00|        2|    20.0|    20.0|    40.0|
-|           |    3.00|        2|    20.0|    20.0|    60.0|
-|           |    4.00|        2|    20.0|    20.0|    80.0|
-|           |    5.00|        2|    20.0|    20.0|   100.0|
+|           |    1.00|     2.00|   20.00|   20.00|   20.00|
+|           |    2.00|     2.00|   20.00|   20.00|   40.00|
+|           |    3.00|     2.00|   20.00|   20.00|   60.00|
+|           |    4.00|     2.00|   20.00|   20.00|   80.00|
+|           |    5.00|     2.00|   20.00|   20.00|  100.00|
 #===========#========#=========#========#========#========#
-|               Total|       10|   100.0|   100.0|        |
+|               Total|    10.00|   100.0|   100.0|        |
 +--------------------+---------+--------+--------+--------+
 +-----------------------+-----+
-|N           Valid      |   10|
-|            Missing    |    0|
-|Mean                   |3.000|
-|Std Dev                |1.491|
-|Minimum                |1.000|
-|Maximum                |5.000|
-|Percentiles 0          |1.000|
-|            25         |2.000|
-|            50 (Median)|3.000|
-|            75         |4.000|
-|            100        |5.000|
+|N           Valid      |10.00|
+|            Missing    |  .00|
+|Mean                   | 3.00|
+|Std Dev                | 1.49|
+|Minimum                | 1.00|
+|Maximum                | 5.00|
+|Percentiles 0          | 1.00|
+|            25         | 2.00|
+|            50 (Median)| 3.00|
+|            75         | 4.00|
+|            100        | 5.00|
 +-----------------------+-----+
 EOF
 if [ $? -ne 0 ] ; then fail ; fi
@@ -211,31 +211,31 @@ if [ $? -ne 0 ] ; then no_result ; fi
 activity="compare output $i"
 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
 diff  -b $TEMPDIR/pspp.list - <<EOF
-1.1 FREQUENCIES.  X 
+1.1 FREQUENCIES.  X
 +-----------+--------+---------+--------+--------+--------+
 |           |        |         |        |  Valid |   Cum  |
 |Value Label|  Value |Frequency| Percent| Percent| Percent|
 #===========#========#=========#========#========#========#
-|           |    1.00|        1|    16.7|    16.7|    16.7|
-|           |    3.00|        2|    33.3|    33.3|    50.0|
-|           |    4.00|        1|    16.7|    16.7|    66.7|
-|           |    5.00|        2|    33.3|    33.3|   100.0|
+|           |    1.00|     1.00|   16.67|   16.67|   16.67|
+|           |    3.00|     2.00|   33.33|   33.33|   50.00|
+|           |    4.00|     1.00|   16.67|   16.67|   66.67|
+|           |    5.00|     2.00|   33.33|   33.33|  100.00|
 #===========#========#=========#========#========#========#
-|               Total|        6|   100.0|   100.0|        |
+|               Total|     6.00|   100.0|   100.0|        |
 +--------------------+---------+--------+--------+--------+
-+-----------------------+-----+
-|N           Valid      |    6|
-|            Missing    |    0|
-|Mean                   |3.500|
-|Std Dev                |1.517|
-|Minimum                |1.000|
-|Maximum                |5.000|
-|Percentiles 0          |1.000|
-|            25         |3.000|
-|            50 (Median)|3.500|
-|            75         |4.750|
-|            100        |5.000|
-+-----------------------+-----+
++-----------------------+----+
+|N           Valid      |6.00|
+|            Missing    | .00|
+|Mean                   |3.50|
+|Std Dev                |1.52|
+|Minimum                |1.00|
+|Maximum                |5.00|
+|Percentiles 0          |1.00|
+|            25         |3.00|
+|            50 (Median)|3.50|
+|            75         |4.75|
+|            100        |5.00|
++-----------------------+----+
 EOF
 if [ $? -ne 0 ] ; then fail ; fi
 
@@ -271,32 +271,32 @@ if [ $? -ne 0 ] ; then no_result ; fi
 activity="compare output $i"
 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
 diff -b $TEMPDIR/pspp.list - <<EOF
-1.1 FREQUENCIES.  X 
+1.1 FREQUENCIES.  X
 +-----------+--------+---------+--------+--------+--------+
 |           |        |         |        |  Valid |   Cum  |
 |Value Label|  Value |Frequency| Percent| Percent| Percent|
 #===========#========#=========#========#========#========#
-|           |    1.00|        1|    10.0|    16.7|    16.7|
-|           |    3.00|        2|    20.0|    33.3|    50.0|
-|           |    4.00|        1|    10.0|    16.7|    66.7|
-|           |    5.00|        2|    20.0|    33.3|   100.0|
-|           |   99.00|        4|    40.0| Missing|        |
+|           |    1.00|     1.00|   10.00|   16.67|   16.67|
+|           |    3.00|     2.00|   20.00|   33.33|   50.00|
+|           |    4.00|     1.00|   10.00|   16.67|   66.67|
+|           |    5.00|     2.00|   20.00|   33.33|  100.00|
+|           |   99.00|     4.00|   40.00| Missing|        |
 #===========#========#=========#========#========#========#
-|               Total|       10|   100.0|   100.0|        |
+|               Total|    10.00|   100.0|   100.0|        |
 +--------------------+---------+--------+--------+--------+
-+-----------------------+-----+
-|N           Valid      |    6|
-|            Missing    |    4|
-|Mean                   |3.500|
-|Std Dev                |1.517|
-|Minimum                |1.000|
-|Maximum                |5.000|
-|Percentiles 0          |1.000|
-|            25         |3.000|
-|            50 (Median)|3.500|
-|            75         |4.750|
-|            100        |5.000|
-+-----------------------+-----+
++-----------------------+----+
+|N           Valid      |6.00|
+|            Missing    |4.00|
+|Mean                   |3.50|
+|Std Dev                |1.52|
+|Minimum                |1.00|
+|Maximum                |5.00|
+|Percentiles 0          |1.00|
+|            25         |3.00|
+|            50 (Median)|3.50|
+|            75         |4.75|
+|            100        |5.00|
++-----------------------+----+
 EOF
 if [ $? -ne 0 ] ; then fail ; fi