[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pspp-cvs] pspp src/language/control/ChangeLog src/languag...
From: |
John Darrington |
Subject: |
[Pspp-cvs] pspp src/language/control/ChangeLog src/languag... |
Date: |
Fri, 02 Feb 2007 13:50:16 +0000 |
CVSROOT: /sources/pspp
Module name: pspp
Changes by: John Darrington <jmd> 07/02/02 13:50:16
Modified files:
src/language/control: ChangeLog repeat.c
tests/command : do-repeat.sh
Log message:
Fixed bug parsing floating point values in DO-REPEAT.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/control/ChangeLog?cvsroot=pspp&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/control/repeat.c?cvsroot=pspp&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/pspp/tests/command/do-repeat.sh?cvsroot=pspp&r1=1.4&r2=1.5
Patches:
Index: src/language/control/ChangeLog
===================================================================
RCS file: /sources/pspp/pspp/src/language/control/ChangeLog,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- src/language/control/ChangeLog 20 Dec 2006 16:09:44 -0000 1.8
+++ src/language/control/ChangeLog 2 Feb 2007 13:50:16 -0000 1.9
@@ -1,3 +1,8 @@
+Fri Feb 2 22:41:43 WST 2007 John Darrington <address@hidden>
+
+ * repeat.c (parse_numbers): Fixed bug parseing ranges vs. lists.
+ Ensured that floats are accepted in lists, but not in ranges.
+
Tue Dec 19 08:12:46 2006 Ben Pfaff <address@hidden>
Fix LOOP. Thanks to Daniel Williams
Index: src/language/control/repeat.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/control/repeat.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- src/language/control/repeat.c 15 Dec 2006 00:16:02 -0000 1.23
+++ src/language/control/repeat.c 2 Feb 2007 13:50:16 -0000 1.24
@@ -1,5 +1,5 @@
/* PSPP - computes sample statistics.
- Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1997-9, 2000, 2007 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -402,9 +402,10 @@
macro->replacements[(*used)++] = replacement;
}
-/* Parses a list of numbers for DO REPEAT. */
+/* Parses a list or range of numbers for DO REPEAT. */
static int
-parse_numbers (struct lexer *lexer, struct repeat_macro *macro, struct pool
*pool)
+parse_numbers (struct lexer *lexer, struct repeat_macro *macro,
+ struct pool *pool)
{
size_t used = 0;
size_t allocated = 0;
@@ -414,23 +415,33 @@
do
{
- long a, b, i;
+ bool integer_value_seen;
+ double a, b, i;
/* Parse A TO B into a, b. */
- if (!lex_force_int (lexer))
+ if (!lex_force_num (lexer))
return 0;
+
+ if ( (integer_value_seen = lex_is_integer (lexer) ) )
a = lex_integer (lexer);
+ else
+ a = lex_number (lexer);
lex_get (lexer);
if (lex_token (lexer) == T_TO)
{
+ if ( !integer_value_seen )
+ {
+ msg (SE, _("Ranges may only have integer bounds"));
+ return 0;
+ }
lex_get (lexer);
if (!lex_force_int (lexer))
return 0;
b = lex_integer (lexer);
if (b < a)
{
- msg (SE, _("%ld TO %ld is an invalid range."), a, b);
+ msg (SE, _("%g TO %g is an invalid range."), a, b);
return 0;
}
lex_get (lexer);
@@ -439,7 +450,7 @@
b = a;
for (i = a; i <= b; i++)
- add_replacement (ss_cstr (pool_asprintf (pool, "%ld", i)),
+ add_replacement (ss_cstr (pool_asprintf (pool, "%g", i)),
macro, pool, &used, &allocated);
lex_match (lexer, ',');
Index: tests/command/do-repeat.sh
===================================================================
RCS file: /sources/pspp/pspp/tests/command/do-repeat.sh,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- tests/command/do-repeat.sh 28 Oct 2006 08:31:23 -0000 1.4
+++ tests/command/do-repeat.sh 2 Feb 2007 13:50:16 -0000 1.5
@@ -60,7 +60,7 @@
0
END DATA.
-DO REPEAT h = h0 TO h3 / x = 0 TO 3 / y = 8, 7, 6, 5.
+DO REPEAT h = h0 TO h3 / x = 0 TO 3 / y = 8, 7.5, 6, 5.
COMPUTE h = x + y.
END REPEAT.
@@ -88,7 +88,7 @@
diff -b $TEMPDIR/pspp.list - <<EOF
a h0 h1 h2 h3 v1 v2 v3 v4
v5 v6
- -------- -------- -------- -------- -------- -------- -------- --------
-------- --------
-0 8.00 8.00 8.00 8.00 4.00 5.00 6.00 5.00
6.00 7.00
+0 8.00 8.50 8.00 8.00 4.00 5.00 6.00 5.00
6.00 7.00
EOF
if [ $? -ne 0 ] ; then fail ; fi
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pspp-cvs] pspp src/language/control/ChangeLog src/languag...,
John Darrington <=