Mercurial > hg > xemacs-beta
annotate src/dump-data.c @ 5908:6174848f3e6c
Use parse_integer() in read_atom(); support bases with ratios like integers
src/ChangeLog addition:
2015-05-08 Aidan Kehoe <kehoea@parhasard.net>
* data.c (init_errors_once_early):
Move the Qunsupported_type here from numbers.c, so it's available
when the majority of our types are not supported.
* general-slots.h: Add it here, too.
* number.c: Remove the definition of Qunsupported_type from here.
* lread.c (read_atom):
Check if the first character could reflect a rational, if so, call
parse_integer(), don't check the syntax of the other
characters. This allows us to accept the non-ASCII digit
characters too.
If that worked partially, but not completely, and the next char is
a slash, try to parse as a ratio.
If that fails, try isfloat_string(), but only if the first
character could plausibly be part of a float.
Otherwise, treat as a symbol.
* lread.c (read_rational):
Rename from read_integer. Handle ratios with the same radix
specification as was used for integers.
* lread.c (read1):
Rename read_integer in this function. Support the Common Lisp
#NNNrMMM syntax for parsing a number MMM of arbitrary radix NNN.
man/ChangeLog addition:
2015-05-08 Aidan Kehoe <kehoea@parhasard.net>
* lispref/numbers.texi (Numbers):
Describe the newly-supported arbitrary-base syntax for rationals
(integers and ratios). Describe that ratios can take the same base
specification as integers, something also new.
tests/ChangeLog addition:
2015-05-08 Aidan Kehoe <kehoea@parhasard.net>
* automated/lisp-reader-tests.el:
Check the arbitrary-base integer reader syntax support, just
added. Check the reader base support for ratios, just added.
Check the non-ASCII-digit support in the reader, just added.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sat, 09 May 2015 00:40:57 +0100 |
parents | 308d34e9f07d |
children |
rev | line source |
---|---|
2015 | 1 /* Static array to put the dumped data in and its management |
2 Copyright (C) 2003 Olivier Galibert | |
3 | |
4 This file is part of XEmacs. | |
5 | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
2367
diff
changeset
|
6 XEmacs is free software: you can redistribute it and/or modify it |
2015 | 7 under the terms of the GNU General Public License as published by the |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
2367
diff
changeset
|
8 Free Software Foundation, either version 3 of the License, or (at your |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
2367
diff
changeset
|
9 option) any later version. |
2015 | 10 |
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
14 for more details. | |
15 | |
16 You should have received a copy of the GNU General Public License | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
2367
diff
changeset
|
17 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */ |
2015 | 18 |
19 /* Synched up with: Not in FSF. */ | |
20 | |
21 /* Mule-ized? Mwahahahahahaha */ | |
22 | |
23 /* Magic values by Larry McVoy to prevent every known compiler, including | |
24 an especially perverse HP-UX one, from putting the array in BSS. | |
25 */ | |
26 | |
27 | |
28 #include <config.h> | |
29 #include "lisp.h" | |
30 #include "dump-data.h" | |
31 | |
32 /* 4 bytes for the data size, 4096 for alignment */ | |
33 | |
2367 | 34 static Rawbyte dumped_data[MAX_SIZE+4096+4] = { |
2015 | 35 255, |
36 6, | |
37 1, | |
38 2, | |
39 3, | |
40 4, | |
41 255, | |
42 3, | |
43 9, | |
44 62, | |
45 255, | |
46 10, | |
47 4, | |
48 61, | |
49 255 | |
50 }; | |
51 | |
52 size_t | |
2367 | 53 dumped_data_size (void) |
2015 | 54 { |
2367 | 55 return dumped_data[0] | (dumped_data[1] << 8) | (dumped_data[2] << 16) | |
56 (dumped_data[3] << 24); | |
2015 | 57 } |
58 | |
59 size_t | |
2367 | 60 dumped_data_max_size (void) |
2015 | 61 { |
62 return MAX_SIZE; | |
63 } | |
64 | |
65 size_t | |
2367 | 66 dumped_data_align_offset (void) |
2015 | 67 { |
2367 | 68 EMACS_INT iptr = (EMACS_INT) dumped_data; |
2015 | 69 EMACS_INT iptr2; |
2367 | 70 iptr2 = (iptr + 4 + 4095) & ~(EMACS_INT) 4095; |
2015 | 71 |
2367 | 72 return iptr2 - iptr; |
2015 | 73 } |
74 | |
2367 | 75 Rawbyte * |
76 dumped_data_get (void) | |
2015 | 77 { |
2367 | 78 EMACS_INT iptr = (EMACS_INT) dumped_data; |
79 iptr = (iptr + 4 + 4095) & ~(EMACS_INT) 4095; | |
80 return (Rawbyte *) iptr; | |
2015 | 81 } |
82 |