/[gentoo-alt]/trunk/sys-apps/gawk/files/gawk-3.1.4-flonum.patch
Gentoo

Contents of /trunk/sys-apps/gawk/files/gawk-3.1.4-flonum.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 242 - (show annotations) (download)
Sun Feb 27 23:26:00 2005 UTC (9 years, 7 months ago) by angusyoung
File size: 3341 byte(s)
Bumped gawk from 3.1.4 to 3.1.4-r4

1 Ripped from Fedora.
2
3 --- gawk-3.1.4/node.c.flonum 2004-07-28 15:45:04.000000000 +0200
4 +++ gawk-3.1.4/node.c 2004-11-09 15:53:03.353119096 +0100
5 @@ -91,7 +91,7 @@
6
7 if (do_non_decimal_data) {
8 errno = 0;
9 - if (! do_traditional && isnondecimal(cp)) {
10 + if (! do_traditional && isnondecimal(cp, TRUE)) {
11 n->numbr = nondec2awknum(cp, cpend - cp);
12 goto finish;
13 }
14 @@ -584,3 +584,38 @@
15 return c;
16 }
17 }
18 +
19 +/* isnondecimal --- return true if number is not a decimal number */
20 +
21 +int
22 +isnondecimal(const char *str, int use_locale)
23 +{
24 + int dec_point = '.';
25 +#if ENABLE_NLS && defined(HAVE_LOCALE_H)
26 + if (use_locale)
27 + dec_point = loc.decimal_point[0]; /* XXX --- assumes one char */
28 +#endif
29 +
30 + if (str[0] != '0')
31 + return FALSE;
32 +
33 + /* leading 0x or 0X */
34 + if (str[1] == 'x' || str[1] == 'X')
35 + return TRUE;
36 +
37 + /*
38 + * Numbers with '.', 'e', or 'E' are decimal.
39 + * Have to check so that things like 00.34 are handled right.
40 + *
41 + * These beasts can have trailing whitespace. Deal with that too.
42 + */
43 + for (; *str != '\0'; str++) {
44 + if (*str == 'e' || *str == 'E' || *str == dec_point)
45 + return FALSE;
46 + else if (! ISDIGIT(*str))
47 + break;
48 + }
49 +
50 + return TRUE;
51 +}
52 +
53 --- gawk-3.1.4/awkgram.y.flonum 2004-07-26 16:11:12.000000000 +0200
54 +++ gawk-3.1.4/awkgram.y 2004-11-09 15:53:03.355118792 +0100
55 @@ -2069,12 +2069,14 @@
56 eof_warned = TRUE;
57 }
58 tokadd('\0');
59 - if (! do_traditional && isnondecimal(tokstart)) {
60 - static short warned = FALSE;
61 - if (do_lint && ! warned) {
62 - warned = TRUE;
63 - lintwarn("numeric constant `%.*s' treated as octal or hexadecimal",
64 - strlen(tokstart)-1, tokstart);
65 + if (! do_traditional && isnondecimal(tokstart, FALSE)) {
66 + if (do_lint) {
67 + if (ISDIGIT(tokstart[1])) /* not an 'x' or 'X' */
68 + lintwarn("numeric constant `%.*s' treated as octal",
69 + strlen(tokstart)-1, tokstart);
70 + else if (tokstart[1] == 'x' || tokstart[1] == 'X')
71 + lintwarn("numeric constant `%.*s' treated as hexadecimal",
72 + strlen(tokstart)-1, tokstart);
73 }
74 yylval.nodeval = make_number(nondec2awknum(tokstart, strlen(tokstart)));
75 } else
76 --- gawk-3.1.4/builtin.c.flonum 2004-07-13 09:55:28.000000000 +0200
77 +++ gawk-3.1.4/builtin.c 2004-11-09 15:53:03.357118488 +0100
78 @@ -2779,7 +2779,7 @@
79
80 if ((tmp->flags & (NUMBER|NUMCUR)) != 0)
81 d = (double) force_number(tmp);
82 - else if (isnondecimal(tmp->stptr))
83 + else if (isnondecimal(tmp->stptr, TRUE))
84 d = nondec2awknum(tmp->stptr, tmp->stlen);
85 else
86 d = (double) force_number(tmp);
87 --- gawk-3.1.4/awk.h.flonum 2004-07-26 16:11:05.000000000 +0200
88 +++ gawk-3.1.4/awk.h 2004-11-09 15:53:03.358118336 +0100
89 @@ -742,8 +742,6 @@
90 /* ------------------------- Pseudo-functions ------------------------- */
91
92 #define is_identchar(c) (isalnum(c) || (c) == '_')
93 -#define isnondecimal(str) (((str)[0]) == '0' && (ISDIGIT((str)[1]) \
94 - || (str)[1] == 'x' || (str)[1] == 'X'))
95
96 #define var_uninitialized(n) ((n)->var_value == Nnull_string)
97
98 @@ -1138,6 +1136,7 @@
99 extern int avoid_dfa P((NODE *re, char *str, size_t len)); /* temporary */
100 extern int reisstring P((const char *text, size_t len, Regexp *re, const char *buf));
101 extern int remaybelong P((const char *text, size_t len));
102 +extern int isnondecimal P((const char *str, int use_locale));
103
104 /* strncasecmp.c */
105 #ifndef BROKEN_STRNCASECMP

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.20