diff options
| author | Po Lu | 2023-07-14 07:58:49 +0800 |
|---|---|---|
| committer | Po Lu | 2023-07-14 07:58:49 +0800 |
| commit | a65960c5b9cc48496fb4e6d3759ada18c14a8eac (patch) | |
| tree | 74e54b99d609c64bb6724dc6f1f0b5cd117ffbf3 /src | |
| parent | 3615bdd5bcf28674861f1bb7aa9b1ca5fa6d57a6 (diff) | |
| parent | 3ffb99f28f29cd98094f359ea316468572535aa0 (diff) | |
| download | emacs-a65960c5b9cc48496fb4e6d3759ada18c14a8eac.tar.gz emacs-a65960c5b9cc48496fb4e6d3759ada18c14a8eac.zip | |
Merge remote-tracking branch 'origin/master' into feature/android
Diffstat (limited to 'src')
| -rw-r--r-- | src/data.c | 3 | ||||
| -rw-r--r-- | src/lread.c | 29 | ||||
| -rw-r--r-- | src/process.c | 3 |
3 files changed, 30 insertions, 5 deletions
diff --git a/src/data.c b/src/data.c index 6de8e0cf1a1..5a31462d8ca 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -3033,7 +3033,8 @@ If the base used is not 10, STRING is always parsed as an integer. */) | |||
| 3033 | p++; | 3033 | p++; |
| 3034 | 3034 | ||
| 3035 | Lisp_Object val = string_to_number (p, b, 0); | 3035 | Lisp_Object val = string_to_number (p, b, 0); |
| 3036 | return NILP (val) ? make_fixnum (0) : val; | 3036 | return ((IEEE_FLOATING_POINT ? NILP (val) : !NUMBERP (val)) |
| 3037 | ? make_fixnum (0) : val); | ||
| 3037 | } | 3038 | } |
| 3038 | 3039 | ||
| 3039 | enum arithop | 3040 | enum arithop |
diff --git a/src/lread.c b/src/lread.c index c3829d2a3a3..11bfc52a83f 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -166,6 +166,10 @@ file_get_char (file_stream stream) | |||
| 166 | # ifndef INFINITY | 166 | # ifndef INFINITY |
| 167 | # define INFINITY ((union ieee754_double) {.ieee = {.exponent = -1}}.d) | 167 | # define INFINITY ((union ieee754_double) {.ieee = {.exponent = -1}}.d) |
| 168 | # endif | 168 | # endif |
| 169 | #else | ||
| 170 | # ifndef INFINITY | ||
| 171 | # define INFINITY HUGE_VAL | ||
| 172 | # endif | ||
| 169 | #endif | 173 | #endif |
| 170 | 174 | ||
| 171 | /* The objects or placeholders read with the #n=object form. | 175 | /* The objects or placeholders read with the #n=object form. |
| @@ -4721,10 +4725,17 @@ substitute_in_interval (INTERVAL interval, void *arg) | |||
| 4721 | } | 4725 | } |
| 4722 | 4726 | ||
| 4723 | 4727 | ||
| 4728 | #if !IEEE_FLOATING_POINT | ||
| 4729 | /* Strings that stand in for +NaN, -NaN, respectively. */ | ||
| 4730 | static Lisp_Object not_a_number[2]; | ||
| 4731 | #endif | ||
| 4732 | |||
| 4724 | /* Convert the initial prefix of STRING to a number, assuming base BASE. | 4733 | /* Convert the initial prefix of STRING to a number, assuming base BASE. |
| 4725 | If the prefix has floating point syntax and BASE is 10, return a | 4734 | If the prefix has floating point syntax and BASE is 10, return a |
| 4726 | nearest float; otherwise, if the prefix has integer syntax, return | 4735 | nearest float; otherwise, if the prefix has integer syntax, return |
| 4727 | the integer; otherwise, return nil. If PLEN, set *PLEN to the | 4736 | the integer; otherwise, return nil. (On antique platforms that lack |
| 4737 | support for NaNs, if the prefix has NaN syntax return a Lisp object that | ||
| 4738 | will provoke an error if used as a number.) If PLEN, set *PLEN to the | ||
| 4728 | length of the numeric prefix if there is one, otherwise *PLEN is | 4739 | length of the numeric prefix if there is one, otherwise *PLEN is |
| 4729 | unspecified. */ | 4740 | unspecified. */ |
| 4730 | 4741 | ||
| @@ -4789,7 +4800,6 @@ string_to_number (char const *string, int base, ptrdiff_t *plen) | |||
| 4789 | cp++; | 4800 | cp++; |
| 4790 | while ('0' <= *cp && *cp <= '9'); | 4801 | while ('0' <= *cp && *cp <= '9'); |
| 4791 | } | 4802 | } |
| 4792 | #if IEEE_FLOATING_POINT | ||
| 4793 | else if (cp[-1] == '+' | 4803 | else if (cp[-1] == '+' |
| 4794 | && cp[0] == 'I' && cp[1] == 'N' && cp[2] == 'F') | 4804 | && cp[0] == 'I' && cp[1] == 'N' && cp[2] == 'F') |
| 4795 | { | 4805 | { |
| @@ -4802,12 +4812,17 @@ string_to_number (char const *string, int base, ptrdiff_t *plen) | |||
| 4802 | { | 4812 | { |
| 4803 | state |= E_EXP; | 4813 | state |= E_EXP; |
| 4804 | cp += 3; | 4814 | cp += 3; |
| 4815 | #if IEEE_FLOATING_POINT | ||
| 4805 | union ieee754_double u | 4816 | union ieee754_double u |
| 4806 | = { .ieee_nan = { .exponent = 0x7ff, .quiet_nan = 1, | 4817 | = { .ieee_nan = { .exponent = 0x7ff, .quiet_nan = 1, |
| 4807 | .mantissa0 = n >> 31 >> 1, .mantissa1 = n }}; | 4818 | .mantissa0 = n >> 31 >> 1, .mantissa1 = n }}; |
| 4808 | value = u.d; | 4819 | value = u.d; |
| 4809 | } | 4820 | #else |
| 4821 | if (plen) | ||
| 4822 | *plen = cp - string; | ||
| 4823 | return not_a_number[negative]; | ||
| 4810 | #endif | 4824 | #endif |
| 4825 | } | ||
| 4811 | else | 4826 | else |
| 4812 | cp = ecp; | 4827 | cp = ecp; |
| 4813 | } | 4828 | } |
| @@ -5951,6 +5966,14 @@ that are loaded before your customizations are read! */); | |||
| 5951 | DEFSYM (Qcomma, ","); | 5966 | DEFSYM (Qcomma, ","); |
| 5952 | DEFSYM (Qcomma_at, ",@"); | 5967 | DEFSYM (Qcomma_at, ",@"); |
| 5953 | 5968 | ||
| 5969 | #if !IEEE_FLOATING_POINT | ||
| 5970 | for (int negative = 0; negative < 2; negative++) | ||
| 5971 | { | ||
| 5972 | not_a_number[negative] = build_pure_c_string (&"-0.0e+NaN"[!negative]); | ||
| 5973 | staticpro (¬_a_number[negative]); | ||
| 5974 | } | ||
| 5975 | #endif | ||
| 5976 | |||
| 5954 | DEFSYM (Qinhibit_file_name_operation, "inhibit-file-name-operation"); | 5977 | DEFSYM (Qinhibit_file_name_operation, "inhibit-file-name-operation"); |
| 5955 | DEFSYM (Qascii_character, "ascii-character"); | 5978 | DEFSYM (Qascii_character, "ascii-character"); |
| 5956 | DEFSYM (Qfunction, "function"); | 5979 | DEFSYM (Qfunction, "function"); |
diff --git a/src/process.c b/src/process.c index 0eff789e599..8b7b8d8566e 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -7147,7 +7147,8 @@ See function `signal-process' for more details on usage. */) | |||
| 7147 | { | 7147 | { |
| 7148 | ptrdiff_t len; | 7148 | ptrdiff_t len; |
| 7149 | tem = string_to_number (SSDATA (process), 10, &len); | 7149 | tem = string_to_number (SSDATA (process), 10, &len); |
| 7150 | if (NILP (tem) || len != SBYTES (process)) | 7150 | if ((IEEE_FLOATING_POINT ? NILP (tem) : !NUMBERP (tem)) |
| 7151 | || len != SBYTES (process)) | ||
| 7151 | return Qnil; | 7152 | return Qnil; |
| 7152 | } | 7153 | } |
| 7153 | process = tem; | 7154 | process = tem; |