[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pspp-cvs] pspp/src/language/stats ChangeLog frequencies.q
From: |
Ben Pfaff |
Subject: |
[Pspp-cvs] pspp/src/language/stats ChangeLog frequencies.q |
Date: |
Tue, 20 Jun 2006 05:09:07 +0000 |
CVSROOT: /cvsroot/pspp
Module name: pspp
Changes by: Ben Pfaff <blp> 06/06/20 05:09:07
Modified files:
src/language/stats: ChangeLog frequencies.q
Log message:
Mon Jun 19 22:07:13 2006 Ben Pfaff <address@hidden>
* frequencies.q: (dump_full) Only put the first MAX_SHORT_STRING
bytes of string variables into the output cells, seeing as we
only
copy that many.
(dump_condensed) Ditto.
Mon Jun 19 21:52:05 2006 Ben Pfaff <address@hidden>
Fixes a bug reported by Greg Hunt <address@hidden>.
* frequencies.q: (hsh_hash_bytes) We only copy the first
MAX_SHORT_STRING bytes of string variables, so we must only
compare that many bytes, even if the string variable is longer.
(compare_value_alpha_a) Ditto.
(compare_freq_alpha_a) Ditto.
(compare_freq_alpha_d) Ditto.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/stats/ChangeLog?cvsroot=pspp&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/stats/frequencies.q?cvsroot=pspp&r1=1.8&r2=1.9
Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/pspp/pspp/src/language/stats/ChangeLog,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- ChangeLog 11 May 2006 18:04:21 -0000 1.23
+++ ChangeLog 20 Jun 2006 05:09:07 -0000 1.24
@@ -1,3 +1,21 @@
+Mon Jun 19 22:07:13 2006 Ben Pfaff <address@hidden>
+
+ * frequencies.q: (dump_full) Only put the first MAX_SHORT_STRING
+ bytes of string variables into the output cells, seeing as we only
+ copy that many.
+ (dump_condensed) Ditto.
+
+Mon Jun 19 21:52:05 2006 Ben Pfaff <address@hidden>
+
+ Fixes a bug reported by Greg Hunt <address@hidden>.
+
+ * frequencies.q: (hsh_hash_bytes) We only copy the first
+ MAX_SHORT_STRING bytes of string variables, so we must only
+ compare that many bytes, even if the string variable is longer.
+ (compare_value_alpha_a) Ditto.
+ (compare_freq_alpha_a) Ditto.
+ (compare_freq_alpha_d) Ditto.
+
2006-05-11 Jason Stover <address@hidden>
* regression.q: Adjusted code to account for cache->coeff being a
Index: frequencies.q
===================================================================
RCS file: /cvsroot/pspp/pspp/src/language/stats/frequencies.q,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- frequencies.q 6 May 2006 17:46:52 -0000 1.8
+++ frequencies.q 20 Jun 2006 05:09:07 -0000 1.9
@@ -58,6 +58,8 @@
#include <output/output.h>
#include <output/table.h>
+#include "minmax.h"
+
#include "gettext.h"
#define _(msgid) gettext (msgid)
#define N_(msgid) msgid
@@ -985,7 +987,7 @@
const struct freq *value = value_;
struct variable *v = v_;
- return hsh_hash_bytes (value->v.s, v->width);
+ return hsh_hash_bytes (value->v.s, MIN (MAX_SHORT_STRING, v->width));
}
/* Ascending numeric compare of values. */
@@ -1011,7 +1013,7 @@
const struct freq *b = b_;
const struct variable *v = v_;
- return memcmp (a->v.s, b->v.s, v->width);
+ return memcmp (a->v.s, b->v.s, MIN (MAX_SHORT_STRING, v->width));
}
/* Descending numeric compare of values. */
@@ -1063,7 +1065,7 @@
else if (a->c < b->c)
return -1;
else
- return memcmp (a->v.s, b->v.s, v->width);
+ return memcmp (a->v.s, b->v.s, MIN (MAX_SHORT_STRING, v->width));
}
/* Descending numeric compare of frequency;
@@ -1101,7 +1103,7 @@
else if (a->c < b->c)
return 1;
else
- return memcmp (a->v.s, b->v.s, v->width);
+ return memcmp (a->v.s, b->v.s, MIN (MAX_SHORT_STRING, v->width));
}
/* Frequency table display. */
@@ -1133,6 +1135,7 @@
int r;
double cum_total = 0.0;
double cum_freq = 0.0;
+ struct fmt_spec fmt;
struct init
{
@@ -1172,6 +1175,10 @@
tab_text (t, p->c - (p->r ? !lab : 0), p->r,
TAB_CENTER | TAT_TITLE, gettext (p->s));
+ fmt = v->print;
+ if (v->width > MAX_SHORT_STRING)
+ fmt.w = MAX_SHORT_STRING * (fmt.type == FMT_AHEX ? 2 : 1);
+
r = 2;
for (f = ft->valid; f < ft->missing; f++)
{
@@ -1190,7 +1197,7 @@
tab_text (t, 0, r, TAB_LEFT, label);
}
- tab_value (t, 0 + lab, r, TAB_NONE, &f->v, &v->print);
+ tab_value (t, 0 + lab, r, TAB_NONE, &f->v, &fmt);
tab_float (t, 1 + lab, r, TAB_NONE, f->c, 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);
@@ -1208,7 +1215,7 @@
tab_text (t, 0, r, TAB_LEFT, label);
}
- tab_value (t, 0 + lab, r, TAB_NONE, &f->v, &v->print);
+ tab_value (t, 0 + lab, r, TAB_NONE, &f->v, &fmt);
tab_float (t, 1 + lab, r, TAB_NONE, f->c, 8, 0);
tab_float (t, 2 + lab, r, TAB_NONE,
f->c / ft->total_cases * 100.0, 5, 1);
@@ -1261,6 +1268,7 @@
struct tab_table *t;
int r;
double cum_total = 0.0;
+ struct fmt_spec fmt;
ft = &get_var_freqs (v)->tab;
n_categories = ft->n_valid + ft->n_missing;
@@ -1274,6 +1282,10 @@
tab_text (t, 3, 1, TAB_CENTER | TAT_TITLE, _("Pct"));
tab_dim (t, condensed_dim);
+ fmt = v->print;
+ if (v->width > MAX_SHORT_STRING)
+ fmt.w = MAX_SHORT_STRING * (fmt.type == FMT_AHEX ? 2 : 1);
+
r = 2;
for (f = ft->valid; f < ft->missing; f++)
{
@@ -1282,7 +1294,7 @@
percent = f->c / ft->total_cases * 100.0;
cum_total += f->c / ft->valid_cases * 100.0;
- tab_value (t, 0, r, TAB_NONE, &f->v, &v->print);
+ tab_value (t, 0, r, TAB_NONE, &f->v, &fmt);
tab_float (t, 1, r, TAB_NONE, f->c, 8, 0);
tab_float (t, 2, r, TAB_NONE, percent, 3, 0);
tab_float (t, 3, r, TAB_NONE, cum_total, 3, 0);
@@ -1290,7 +1302,7 @@
}
for (; f < &ft->valid[n_categories]; f++)
{
- tab_value (t, 0, r, TAB_NONE, &f->v, &v->print);
+ tab_value (t, 0, r, TAB_NONE, &f->v, &fmt);
tab_float (t, 1, r, TAB_NONE, f->c, 8, 0);
tab_float (t, 2, r, TAB_NONE,
f->c / ft->total_cases * 100.0, 3, 0);
- [Pspp-cvs] pspp/src/language/stats ChangeLog frequencies.q,
Ben Pfaff <=