annotate src/terminfo.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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 /* Interface from Emacs to terminfo.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 Copyright (C) 1985, 1986, 1993 Free Software Foundation, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 2286
diff changeset
6 XEmacs is free software: you can redistribute it and/or modify it
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
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: 2286
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: 2286
diff changeset
9 option) any later version.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
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: 2286
diff changeset
17 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 /* Synched up with: FSF 19.30. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 #include <config.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 #include <string.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 /* Every little bit of this God-damned file has caused all manner
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 of headaches due to inconsistent and incorrect header files
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 on one system or other, and we don't currently need anything here,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 so just comment the whole damn lot out!!! */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 #ifndef HAVE_TERMIOS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32 #ifdef AIX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 #include <termio.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 #endif /* AIX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 /* Interface to curses/terminfo library.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 Turns out that all of the terminfo-level routines look
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 like their termcap counterparts except for tparm, which replaces
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 tgoto. Not only is the calling sequence different, but the string
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 format is different too.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
43 #include CURSES_H_FILE
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 /* Sun, in their infinite lameness, supplies (possibly) broken headers
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 even under Solaris. GCC feels it necessary to correct things by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 supplying its own headers. Unfortunately, if you build GCC under
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 one version of Solaris and then upgrade your Solaris, you may get
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 screwed because Sun in their continuing lameness changes curses.h
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 in such a way that the "fixed" GCC headers are now broken. (GCC
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 is equally lame in that it supplies "fixed" headers for curses.h
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 but not term.h.) However, it seems to work to just not include
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 term.h under Solaris, so we try that. KLUDGE! */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 #if !(defined (__GNUC__) && defined (SOLARIS2))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
54 #include TERM_H_FILE
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 extern void *xmalloc (int size);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 #if 0 /* If this isn't declared somewhere, too bad */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
60 extern char * tparm (const char *string, int arg1, int arg2, int arg3,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 int arg4, int arg5, int arg6, int arg7, int arg8,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 int arg9);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 /* XEmacs: renamed this function because just tparam() conflicts with
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 ncurses (We don't use this function anyway!) */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 char *
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 493
diff changeset
67 emacs_tparam (const char *string, char *outstring, int UNUSED (len), int arg1,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 int arg2, int arg3, int arg4, int arg5, int arg6, int arg7,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 int arg8, int arg9)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 char *temp;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 temp = (char *) tparm (string, arg1, arg2, arg3, arg4, arg5, arg6, arg7,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 arg8, arg9);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 if (outstring == 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 outstring = (char *) xmalloc (strlen (temp) + 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 strcpy (outstring, temp);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 return outstring;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 #endif /* not HAVE_TERMIOS */