[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pspp-cvs] pspp/src/data ChangeLog sys-file-writer.c varia...
From: |
Ben Pfaff |
Subject: |
[Pspp-cvs] pspp/src/data ChangeLog sys-file-writer.c varia... |
Date: |
Wed, 25 Jul 2007 04:31:34 +0000 |
CVSROOT: /cvsroot/pspp
Module name: pspp
Changes by: Ben Pfaff <blp> 07/07/25 04:31:34
Modified files:
src/data : ChangeLog sys-file-writer.c variable.c
variable.h
Log message:
Fix bug #6113.
* sys-file-writer.c (write_variable_display_parameters): Use new
var_default_display_width function to choose display width of
segments after the first one in a given variable.
* variable.c (var_create): Use var_default_display_width to pick
new variable's display width.
(var_default_display_width): New function.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/ChangeLog?cvsroot=pspp&r1=1.141&r2=1.142
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/sys-file-writer.c?cvsroot=pspp&r1=1.29&r2=1.30
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/variable.c?cvsroot=pspp&r1=1.29&r2=1.30
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/variable.h?cvsroot=pspp&r1=1.24&r2=1.25
Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/pspp/pspp/src/data/ChangeLog,v
retrieving revision 1.141
retrieving revision 1.142
diff -u -b -r1.141 -r1.142
--- ChangeLog 25 Jul 2007 04:09:44 -0000 1.141
+++ ChangeLog 25 Jul 2007 04:31:34 -0000 1.142
@@ -1,5 +1,15 @@
2007-07-24 Ben Pfaff <address@hidden>
+ Fix bug #6113.
+ * sys-file-writer.c (write_variable_display_parameters): Use new
+ var_default_display_width function to choose display width of
+ segments after the first one in a given variable.
+ * variable.c (var_create): Use var_default_display_width to pick
+ new variable's display width.
+ (var_default_display_width): New function.
+
+2007-07-24 Ben Pfaff <address@hidden>
+
Fix bug #20427.
* por-file-writer.c (write_variables): Write weight variable.
Reviewed by John Darrington.
Index: sys-file-writer.c
===================================================================
RCS file: /cvsroot/pspp/pspp/src/data/sys-file-writer.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- sys-file-writer.c 24 Jul 2007 05:33:43 -0000 1.29
+++ sys-file-writer.c 25 Jul 2007 04:31:34 -0000 1.30
@@ -547,8 +547,7 @@
int width_left = width - sfm_segment_effective_offset (width, i);
write_int (w, measure);
write_int (w, (i == 0 ? var_get_display_width (v)
- : sfm_width_to_segments (width_left) > 1 ? 32
- : width_left));
+ : var_default_display_width (width_left)));
write_int (w, alignment);
}
}
Index: variable.c
===================================================================
RCS file: /cvsroot/pspp/pspp/src/data/variable.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- variable.c 23 Jul 2007 05:05:46 -0000 1.29
+++ variable.c 25 Jul 2007 04:31:34 -0000 1.30
@@ -112,16 +112,15 @@
{
v->print = fmt_for_output (FMT_F, 8, 2);
v->alignment = ALIGN_RIGHT;
- v->display_width = 8;
v->measure = MEASURE_SCALE;
}
else
{
v->print = fmt_for_output (FMT_A, var_get_width (v), 0);
v->alignment = ALIGN_LEFT;
- v->display_width = 8;
v->measure = MEASURE_NOMINAL;
}
+ v->display_width = var_default_display_width (width);
v->write = v->print;
v->val_labs = NULL;
v->label = NULL;
@@ -722,9 +721,6 @@
return v->display_width;
}
-
-
-
/* Sets V's display width to DISPLAY_WIDTH. */
void
var_set_display_width (struct variable *v, int display_width)
@@ -733,6 +729,15 @@
dict_var_changed (v);
}
+/* Returns the default display width for a variable of the given
+ WIDTH, as set by var_create. The return value can be used to
+ reset a variable's display width to the default. */
+int
+var_default_display_width (int width)
+{
+ return width == 0 ? 8 : MIN (width, 32);
+}
+
/* Returns true if A is a valid alignment,
false otherwise. */
bool
Index: variable.h
===================================================================
RCS file: /cvsroot/pspp/pspp/src/data/variable.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- variable.h 23 Jul 2007 05:05:46 -0000 1.24
+++ variable.h 25 Jul 2007 04:31:34 -0000 1.25
@@ -123,6 +123,8 @@
int var_get_display_width (const struct variable *);
void var_set_display_width (struct variable *, int display_width);
+int var_default_display_width (int width);
+
/* Alignment of data for display. */
enum alignment
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pspp-cvs] pspp/src/data ChangeLog sys-file-writer.c varia...,
Ben Pfaff <=