Mercurial > hg > xemacs-beta
changeset 2014:92f7301e4a23
[xemacs-hg @ 2004-04-15 15:27:34 by james]
Fix GMP workaround to also work for negative numbers.
author | james |
---|---|
date | Thu, 15 Apr 2004 15:27:38 +0000 |
parents | f2fdfc131770 |
children | 2364237fbc0f |
files | src/ChangeLog src/data.c |
diffstat | 2 files changed, 26 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog Wed Apr 14 22:50:54 2004 +0000 +++ b/src/ChangeLog Thu Apr 15 15:27:38 2004 +0000 @@ -1,3 +1,8 @@ +2004-04-15 Jerry James <james@xemacs.org> + + * data.c (Fstring_to_number): Skip leading '-' when finding the + end of a number. + 2004-04-14 Jerry James <james@xemacs.org> * data.c (Fstring_to_number): Work around limitations of GMP
--- a/src/data.c Wed Apr 14 22:50:54 2004 +0000 +++ b/src/data.c Thu Apr 15 15:27:38 2004 +0000 @@ -1307,18 +1307,23 @@ if (*p == '+') p++; - for (end = p; - (*end >= '0' && *end <= '9') || + end = p; + if (*end == '-') + end++; + while ((*end >= '0' && *end <= '9') || (b > 10 && *end >= 'a' && *end <= 'a' + b - 11) || - (b > 10 && *end >= 'A' && *end <= 'A' + b - 11); - end++); + (b > 10 && *end >= 'A' && *end <= 'A' + b - 11)) + end++; if (*end == '/') - for (end++; - (*end >= '0' && *end <= '9') || - (b > 10 && *end >= 'a' && *end <= 'a' + b - 11) || - (b > 10 && *end >= 'A' && *end <= 'A' + b - 11); - end++); - + { + end++; + if (*end == '-') + end++; + while ((*end >= '0' && *end <= '9') || + (b > 10 && *end >= 'a' && *end <= 'a' + b - 11) || + (b > 10 && *end >= 'A' && *end <= 'A' + b - 11)) + end++; + } save = *end; *end = '\0'; ratio_set_string (scratch_ratio, (const char *) p, b); @@ -1345,11 +1350,13 @@ if (*p == '+') p++; - for (end = p; - (*end >= '0' && *end <= '9') || + end = p; + if (*end == '-') + end++; + while ((*end >= '0' && *end <= '9') || (b > 10 && *end >= 'a' && *end <= 'a' + b - 11) || - (b > 10 && *end >= 'A' && *end <= 'A' + b - 11); - end++); + (b > 10 && *end >= 'A' && *end <= 'A' + b - 11)) + end++; save = *end; *end = '\0'; if (*p == '\0')