Mercurial > hg > xemacs-beta
annotate src/sysproc.h @ 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 | 611a6845ebee |
children | b58b74274fa2 |
rev | line source |
---|---|
428 | 1 /* |
2 Copyright (C) 1995 Free Software Foundation, Inc. | |
853 | 3 Copyright (C) 2000, 2002 Ben Wing. |
428 | 4 |
5 This file is part of XEmacs. | |
6 | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4759
diff
changeset
|
7 XEmacs is free software: you can redistribute it and/or modify it |
428 | 8 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:
4759
diff
changeset
|
9 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:
4759
diff
changeset
|
10 option) any later version. |
428 | 11 |
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 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:
4759
diff
changeset
|
18 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */ |
428 | 19 |
20 /* Synched up with: Not really in FSF. */ | |
21 | |
440 | 22 #ifndef INCLUDED_sysproc_h_ |
23 #define INCLUDED_sysproc_h_ | |
24 | |
428 | 25 #include "systime.h" /* necessary for sys/resource.h; also gets the |
26 FD_* defines on some systems. */ | |
442 | 27 #ifndef WIN32_NATIVE |
428 | 28 #include <sys/resource.h> |
29 #endif | |
30 | |
771 | 31 #ifdef MINGW |
32 #include <../mingw/process.h> | |
33 #elif defined (WIN32_NATIVE) | |
34 /* <process.h> should not conflict with "process.h", as per ANSI definition. | |
35 This is not true with visual c though. The trick below works with | |
36 VC4.2b, 5.0 and 6.0. It assumes that VC is installed in a kind of | |
37 standard way, so include path ends with /include. | |
38 */ | |
39 #include <../include/process.h> | |
40 #endif | |
41 | |
428 | 42 #ifdef HAVE_SOCKETS /* TCP connection support, if kernel can do it */ |
43 # include <sys/types.h> /* AJK */ | |
442 | 44 # ifndef WIN32_NATIVE |
45 # include <sys/socket.h> | |
46 # include <netdb.h> | |
47 # include <netinet/in.h> | |
48 # include <arpa/inet.h> | |
49 # endif | |
428 | 50 #endif /* HAVE_SOCKETS */ |
51 | |
442 | 52 #ifdef WIN32_NATIVE |
53 /* Note: winsock.h already included in systime.h above */ | |
54 /* map winsock error codes to standard names */ | |
55 #define EWOULDBLOCK WSAEWOULDBLOCK | |
56 #define EINPROGRESS WSAEINPROGRESS | |
57 #define EALREADY WSAEALREADY | |
58 #define ENOTSOCK WSAENOTSOCK | |
59 #define EDESTADDRREQ WSAEDESTADDRREQ | |
60 #define EMSGSIZE WSAEMSGSIZE | |
61 #define EPROTOTYPE WSAEPROTOTYPE | |
62 #define ENOPROTOOPT WSAENOPROTOOPT | |
63 #define EPROTONOSUPPORT WSAEPROTONOSUPPORT | |
64 #define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT | |
65 #define EOPNOTSUPP WSAEOPNOTSUPP | |
66 #define EPFNOSUPPORT WSAEPFNOSUPPORT | |
67 #define EAFNOSUPPORT WSAEAFNOSUPPORT | |
68 #define EADDRINUSE WSAEADDRINUSE | |
69 #define EADDRNOTAVAIL WSAEADDRNOTAVAIL | |
70 #define ENETDOWN WSAENETDOWN | |
71 #define ENETUNREACH WSAENETUNREACH | |
72 #define ENETRESET WSAENETRESET | |
73 #define ECONNABORTED WSAECONNABORTED | |
74 #define ECONNRESET WSAECONNRESET | |
75 #define ENOBUFS WSAENOBUFS | |
76 #define EISCONN WSAEISCONN | |
77 #define ENOTCONN WSAENOTCONN | |
78 #define ESHUTDOWN WSAESHUTDOWN | |
79 #define ETOOMANYREFS WSAETOOMANYREFS | |
80 #define ETIMEDOUT WSAETIMEDOUT | |
81 #define ECONNREFUSED WSAECONNREFUSED | |
82 #define ELOOP WSAELOOP | |
83 /* #define ENAMETOOLONG WSAENAMETOOLONG */ | |
84 #define EHOSTDOWN WSAEHOSTDOWN | |
85 #define EHOSTUNREACH WSAEHOSTUNREACH | |
86 /* #define ENOTEMPTY WSAENOTEMPTY */ | |
87 #define EPROCLIM WSAEPROCLIM | |
88 #define EUSERS WSAEUSERS | |
89 #define EDQUOT WSAEDQUOT | |
90 #define ESTALE WSAESTALE | |
91 #define EREMOTE WSAEREMOTE | |
92 #endif /* WIN32_NATIVE */ | |
93 | |
3025 | 94 /* On some systems, e.g. DGUX, inet_addr returns a `struct in_addr'. */ |
428 | 95 #ifdef HAVE_BROKEN_INET_ADDR |
96 # define IN_ADDR struct in_addr | |
97 # define NUMERIC_ADDR_ERROR (numeric_addr.s_addr == -1) | |
98 #else | |
99 # if (LONGBITS > 32) | |
100 # define IN_ADDR unsigned int | |
101 # else | |
102 # define IN_ADDR unsigned long | |
103 # endif | |
104 # define NUMERIC_ADDR_ERROR (numeric_addr == (IN_ADDR) -1) | |
105 #endif | |
106 | |
107 /* Define first descriptor number available for subprocesses. */ | |
108 #define FIRST_PROC_DESC 3 | |
109 | |
110 #ifdef AIX | |
111 #include <sys/select.h> | |
112 #endif | |
113 | |
444 | 114 #ifdef HAVE_STROPTS_H |
115 #include <stropts.h> /* isastream(), I_PUSH */ | |
442 | 116 #endif |
117 | |
444 | 118 #ifdef HAVE_STRTIO_H |
119 #include <strtio.h> /* TIOCSIGNAL */ | |
442 | 120 #endif |
121 | |
122 #ifdef HAVE_PTY_H | |
123 #include <pty.h> /* openpty() on Tru64, Linux */ | |
124 #endif | |
125 | |
126 #ifdef HAVE_LIBUTIL_H | |
458 | 127 #include <libutil.h> /* openpty() on FreeBSD */ |
128 #endif | |
129 | |
130 #ifdef HAVE_UTIL_H | |
131 #include <util.h> /* openpty() on NetBSD */ | |
442 | 132 #endif |
133 | |
2286 | 134 /* The FD_* macros expand to __extension__ forms on glibc-based systems. Uno |
135 does not understand such forms, so let's help it out. */ | |
136 #ifdef UNO | |
137 #undef FD_SET | |
138 #undef FD_CLR | |
139 #undef FD_ISSET | |
140 #undef FD_ZERO | |
141 #undef MAXDESC | |
142 #undef SELECT_TYPE | |
143 #endif /* UNO */ | |
144 | |
428 | 145 #ifdef FD_SET |
146 | |
147 /* We could get this from param.h, but better not to depend on finding that. | |
148 And better not to risk that it might define other symbols used in this | |
149 file. */ | |
150 # ifdef FD_SETSIZE | |
151 # define MAXDESC FD_SETSIZE | |
152 # else | |
153 # define MAXDESC 64 | |
154 # endif /* FD_SETSIZE */ | |
155 # define SELECT_TYPE fd_set | |
156 | |
157 #else /* no FD_SET */ | |
158 | |
159 # define MAXDESC 32 | |
160 # define SELECT_TYPE int | |
161 | |
162 /* Define the macros to access a single-int bitmap of descriptors. */ | |
163 # define FD_SET(n, p) (*(p) |= (1 << (n))) | |
164 # define FD_CLR(n, p) (*(p) &= ~(1 << (n))) | |
165 # define FD_ISSET(n, p) (*(p) & (1 << (n))) | |
166 # define FD_ZERO(p) (*(p) = 0) | |
167 | |
168 #endif /* no FD_SET */ | |
169 | |
170 int poll_fds_for_input (SELECT_TYPE mask); | |
867 | 171 int qxe_execve (const Ibyte *filename, Ibyte * const argv[], |
172 Ibyte * const envp[]); | |
771 | 173 pid_t qxe_getpid (void); |
428 | 174 |
853 | 175 /* #### I would really like to delete the remaining synchronous code entirely. |
176 We are now using it only for *REALLY* old systems -- how many systems | |
177 nowadays | |
178 | |
179 (a) lack job control, or | |
180 (b) lack mkdir() or rmdir() | |
181 | |
182 ????? | |
183 | |
184 --ben | |
185 */ | |
186 | |
859 | 187 #include "syssignal.h" /* needed for SIGTSTP */ |
854 | 188 |
4759
aa5ed11f473b
Remove support for obsolete systems. See xemacs-patches message with ID
Jerry James <james@xemacs.org>
parents:
3025
diff
changeset
|
189 #if !defined (WIN32_NATIVE) && (!defined (SIGTSTP) || !defined (HAVE_MKDIR) || !defined (HAVE_RMDIR)) |
853 | 190 |
191 #define NEED_SYNC_PROCESS_CODE | |
192 | |
193 /* True iff we are about to fork off a synchronous process or if we | |
194 are waiting for it. */ | |
195 extern volatile int synch_process_alive; | |
196 | |
197 /* Nonzero => this is a string explaining death of synchronous subprocess. */ | |
198 extern const char *synch_process_death; | |
199 | |
200 /* If synch_process_death is zero, | |
201 this is exit code of synchronous subprocess. */ | |
202 extern int synch_process_retcode; | |
203 | |
204 #endif | |
205 | |
206 | |
440 | 207 #endif /* INCLUDED_sysproc_h_ */ |