Mercurial > hg > xemacs-beta
annotate src/systty.h @ 5489:159face738c3
Never pass a leading + to mpz_set_string, parse_integer ().
src/ChangeLog addition:
2011-05-01 Aidan Kehoe <kehoea@parhasard.net>
* lread.c (parse_integer):
GMP's mpz_set_string deals with a leading plus badly, make sure it
never sees one coming from this function.
tests/ChangeLog addition:
2011-05-01 Aidan Kehoe <kehoea@parhasard.net>
* automated/lisp-reader-tests.el:
If the bignum feature is available, check that a leading plus sign
is treated correctly when reading bignum integers.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sun, 01 May 2011 13:51:33 +0100 |
parents | 308d34e9f07d |
children |
rev | line source |
---|---|
428 | 1 /* systty.h - System-dependent definitions for terminals. |
2 Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. | |
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:
4759
diff
changeset
|
6 XEmacs is free software: you can redistribute it and/or modify it |
428 | 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:
4759
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:
4759
diff
changeset
|
9 option) any later version. |
428 | 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:
4759
diff
changeset
|
17 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */ |
428 | 18 |
19 /* Synched up with: FSF 19.30. */ | |
20 | |
440 | 21 #ifndef INCLUDED_systty_h_ |
22 #define INCLUDED_systty_h_ | |
428 | 23 |
24 #ifdef HAVE_TERMIOS | |
25 # define HAVE_TCATTR | |
26 #endif | |
27 | |
28 | |
29 /* Include the proper files. */ | |
30 | |
31 #ifdef HAVE_UNISTD_H | |
32 #include <unistd.h> | |
33 #endif | |
34 | |
35 /* XEmacs: TERMIOS is mo' better than TERMIO so we use it if it's | |
36 there. Since TERMIO is backward-compatibility stuff if both it | |
37 and TERMIOS exist, it's more likely to be broken. */ | |
38 | |
39 #if defined (HAVE_TERMIOS) | |
40 | |
41 /***** (1) The TERMIOS way (POSIX style) *****/ | |
42 | |
43 # if defined (_AIX) && defined (_I386) | |
44 # include <termios.h> /* termios.h needs to be before termio.h */ | |
45 # include <termio.h> | |
46 # else | |
47 # if !defined (NO_TERMIO) | |
48 # include <termio.h> | |
49 # endif | |
50 # include <termios.h> | |
51 # endif /* _AIX && _I386 */ | |
52 # ifndef INCLUDED_FCNTL | |
53 # define INCLUDED_FCNTL | |
54 # include <fcntl.h> | |
55 # endif | |
56 | |
57 #elif defined (HAVE_TERMIO) | |
58 | |
59 /***** (2) The TERMIO way (system V style) *****/ | |
60 | |
61 # ifndef NO_TERMIO | |
62 # include <termio.h> | |
63 # endif /* not NO_TERMIO */ | |
64 # ifndef INCLUDED_FCNTL | |
65 # define INCLUDED_FCNTL | |
66 # include <fcntl.h> | |
67 # endif | |
68 | |
442 | 69 #elif defined (WIN32_NATIVE) |
428 | 70 |
442 | 71 /***** (3) The WIN32_NATIVE way *****/ |
428 | 72 |
73 /* Nothing doing */ | |
74 | |
75 #else | |
76 | |
77 /***** (4) The BSD way *****/ | |
78 | |
79 # ifdef linux /* XEmacs addition -- necessary? */ | |
80 # include <bsd/sgtty.h> | |
81 # else | |
82 # include <sgtty.h> | |
83 # endif | |
84 | |
85 | |
86 #endif /* HAVE_TERMIOS */ | |
87 | |
88 /* XEmacs: I don't think we need the following crap. */ | |
89 #ifdef __GNU_LIBRARY__ | |
90 #include <termios.h> | |
91 #endif | |
92 | |
93 /* Formerly there was a conditional that included sys/filio.h if | |
94 USG5_4 was defined, but this is already included in s/usg5-4.h */ | |
95 | |
96 /* Generally useful to include this file: */ | |
97 | |
4759
aa5ed11f473b
Remove support for obsolete systems. See xemacs-patches message with ID
Jerry James <james@xemacs.org>
parents:
771
diff
changeset
|
98 #if !defined (WIN32_NATIVE) |
428 | 99 # include <sys/ioctl.h> |
100 #endif | |
101 | |
102 | |
103 /* ----------------------------------------------------- */ | |
104 /* miscellaneous includes */ | |
105 /* ----------------------------------------------------- */ | |
106 | |
107 /* Include files for PTY's */ | |
108 | |
535 | 109 #if defined (HAVE_SYS_PTYIO_H) /* HP-UX */ |
428 | 110 #include <sys/ptyio.h> |
111 #endif | |
112 | |
535 | 113 #if defined (HAVE_PTY_H) |
114 #include <pty.h> | |
115 #elif defined (HAVE_SYS_PTY_H) | |
428 | 116 #include <sys/pty.h> |
117 #endif | |
118 | |
119 /* XEmacs: removed some random if defined (pfa) crap for FASYNC (SIGIO). | |
120 We've cleaned SIGIO up. */ | |
121 | |
122 | |
123 /* ----------------------------------------------------- */ | |
124 /* inhibiting particular features */ | |
125 /* ----------------------------------------------------- */ | |
126 | |
127 | |
4759
aa5ed11f473b
Remove support for obsolete systems. See xemacs-patches message with ID
Jerry James <james@xemacs.org>
parents:
771
diff
changeset
|
128 #if defined (BROKEN_TIOCGETC) |
428 | 129 #undef TIOCGETC /* Avoid confusing some conditionals that test this. */ |
130 #endif | |
131 | |
132 /* XEmacs: SIGIO is cleaned up so we remove the crap here that messes | |
133 with it (and FIONREAD and FASYNC, which are related). */ | |
134 | |
135 /* On TERMIOS systems, the tcmumbleattr calls take care of these | |
136 parameters, and it's a bad idea to use them (on AIX, it makes the | |
137 tty hang for a long time). */ | |
138 #if defined (TIOCGLTC) && !defined (HAVE_TERMIOS) | |
139 #define HAVE_LTCHARS | |
140 #endif | |
141 | |
142 #if defined (TIOCGETC) && !defined (HAVE_TERMIOS) | |
143 #define HAVE_TCHARS | |
144 #endif | |
145 | |
146 | |
147 /* ----------------------------------------------------- */ | |
148 /* disabling terminal functions */ | |
149 /* ----------------------------------------------------- */ | |
150 | |
151 /* Try to establish the correct character to disable terminal functions | |
152 in a system-independent manner. | |
153 We use the POSIX standard way to do this, and emulate on other systems. */ | |
154 | |
155 #ifndef _POSIX_VDISABLE | |
156 # if defined CDEL | |
157 # define _POSIX_VDISABLE CDEL | |
158 # else | |
159 # define _POSIX_VDISABLE 255 | |
160 # endif | |
161 #endif /* ! _POSIX_VDISABLE */ | |
162 | |
163 | |
164 /* ----------------------------------------------------- */ | |
165 /* Get the number of characters queued for output */ | |
166 /* ----------------------------------------------------- */ | |
167 | |
168 /* EMACS_OUTQSIZE(FD, int *SIZE) stores the number of characters | |
169 queued for output to the terminal FD in *SIZE, if FD is a tty. | |
170 Returns -1 if there was an error (i.e. FD is not a tty), 0 | |
171 otherwise. */ | |
172 #ifdef TIOCOUTQ | |
173 #define EMACS_OUTQSIZE(fd, size) ioctl (fd, TIOCOUTQ, size) | |
174 #endif | |
175 | |
176 #ifdef HAVE_TERMIO | |
177 #ifdef TCOUTQ | |
178 #undef EMACS_OUTQSIZE | |
179 #define EMACS_OUTQSIZE(fd, size) ioctl (fd, TCOUTQ, size) | |
180 #endif | |
181 #endif | |
182 | |
183 | |
184 /* -------------------------------------------------------------------- */ | |
185 /* Manipulate a terminal's current (foreground) process group */ | |
186 /* -------------------------------------------------------------------- */ | |
187 | |
442 | 188 /* EMACS_GET_TTY_PGRP(int FD, pid_t *PGID) sets *PGID to the terminal |
189 FD's current foreground process group. Return -1 if there is an error. | |
190 | |
191 EMACS_SET_TTY_PGRP(int FD, pid_t *PGID) sets the terminal FD's current | |
192 foreground process group to *PGID. Return -1 if there is an error. | |
428 | 193 |
442 | 194 We prefer using the ioctl (BSD) interface instead of its Posix |
195 replacement tgetpgrp/tcsetpgrp since that is documented as being | |
196 restricted to processes sharing the same controlling tty. */ | |
428 | 197 |
442 | 198 #if defined (TIOCGPGRP) |
428 | 199 |
442 | 200 #define EMACS_GET_TTY_PROCESS_GROUP(fd, pgid) ioctl (fd, TIOCGPGRP, pgid) |
201 #define EMACS_SET_TTY_PROCESS_GROUP(fd, pgid) ioctl (fd, TIOCSPGRP, pgid) | |
202 | |
203 #elif defined (HAVE_TCGETPGRP) | |
428 | 204 |
442 | 205 #define EMACS_GET_TTY_PROCESS_GROUP(fd, pgid) (*(pgid) = tcgetpgrp (fd)) |
206 #define EMACS_SET_TTY_PROCESS_GROUP(fd, pgid) tcsetpgrp (fd, *(pgid)) | |
428 | 207 |
442 | 208 #else |
428 | 209 |
442 | 210 /* Just ignore this for now and hope for the best */ |
211 #define EMACS_GET_TTY_PROCESS_GROUP(fd, pgid) 0 | |
212 #define EMACS_SET_TTY_PROCESS_GROUP(fd, pgif) 0 | |
428 | 213 |
214 #endif | |
215 | |
216 /* EMACS_GETPGRP (arg) returns the process group of the terminal. */ | |
217 | |
218 #ifdef GETPGRP_VOID | |
219 #define EMACS_GETPGRP(x) getpgrp() | |
220 #else | |
221 #define EMACS_GETPGRP(x) getpgrp(x) | |
222 #endif /* GETPGRP_VOID */ | |
223 | |
224 /* XEmacs backward-compatibility. Is 0 always a reasonable argument? */ | |
225 #define EMACS_GET_PROCESS_GROUP() EMACS_GETPGRP (0) | |
226 | |
227 /* XEmacs addition? */ | |
228 | |
229 /* EMACS_SEPARATE_PROCESS_GROUP () creates a separate process group for the | |
230 running process. */ | |
231 | |
232 /* EMACS_SET_PROCESS_GROUP () sets our process group as specified. */ | |
233 | |
234 /* POSIX calls for setpgid(), so we use it if it's available. | |
235 Otherwise use setpgrp(), in USG or BSD flavor. Note that | |
236 on newer systems, setpgrp() has unwanted effects (e.g. | |
237 creating a new session), so we want to avoid its use | |
238 if possible. | |
239 | |
240 NOTE: On some older systems, we should consider using setpgrp2() | |
241 if it exists. This is sufficiently rare, though, that there | |
242 seems no point in autodetecting it. Currently dgux.h is the | |
243 only place where this has to be munged. */ | |
244 | |
245 #if defined (HAVE_SETPGID) | |
246 # define EMACS_SEPARATE_PROCESS_GROUP() setpgid (0, 0) | |
247 # define EMACS_SET_PROCESS_GROUP(pg) setpgid (0, pg) | |
248 #elif defined (USG) | |
249 # define EMACS_SEPARATE_PROCESS_GROUP() setpgrp () | |
250 /* old (pre-SVR4) USG's don't provide any way to do this. | |
251 No big loss -- it just means that ^Z won't work right | |
252 if we're run from sh. */ | |
253 # define EMACS_SET_PROCESS_GROUP(pg) | |
771 | 254 #elif defined (WIN32_NATIVE) |
432 | 255 # define EMACS_SEPARATE_PROCESS_GROUP() |
428 | 256 #else |
257 /* Under NeXTstep, a process group of 0 is not the same as specifying | |
258 your own process ID, so we go ahead and specify it explicitly. */ | |
259 # define EMACS_SEPARATE_PROCESS_GROUP() setpgrp (0, getpid ()) | |
260 # define EMACS_SET_PROCESS_GROUP(pg) setpgrp (0, pg) | |
261 #endif | |
262 | |
263 | |
264 /* --------------------------------------------------------- */ | |
265 /* Manipulate a TTY's input/output processing parameters */ | |
266 /* --------------------------------------------------------- */ | |
267 | |
268 /* struct emacs_tty is a structure used to hold the current tty | |
269 parameters. If the terminal has several structures describing its | |
270 state, for example a struct tchars, a struct sgttyb, a struct | |
271 tchars, a struct ltchars, and a struct pagechars, struct | |
272 emacs_tty should contain an element for each parameter struct | |
273 that Emacs may change. | |
274 | |
430 | 275 emacs_get_tty (int FD, struct emacs_tty *P) stores the parameters |
428 | 276 of the tty on FD in *P. Return zero if all's well, or -1 if we ran |
277 into an error we couldn't deal with. | |
278 | |
430 | 279 emacs_set_tty (int FD, struct emacs_tty *P, int flushp) |
428 | 280 sets the parameters of the tty on FD according to the contents of |
281 *P. If flushp is non-zero, we discard queued input to be | |
282 written before making the change. | |
283 Return 0 if all went well, and -1 if anything failed. | |
284 | |
285 EMACS_TTY_TABS_OK (struct emacs_tty *P) is false iff the kernel | |
286 expands tabs to spaces upon output; in that case, there is no | |
287 advantage to using tabs over spaces. */ | |
288 | |
289 | |
290 /* For each tty parameter structure that Emacs might want to save and restore, | |
291 - include an element for it in this structure, and | |
292 - extend the emacs_{get,set}_tty functions in sysdep.c to deal with the | |
293 new members. */ | |
294 | |
295 struct emacs_tty { | |
296 | |
297 /* There is always one of the following elements, so there is no need | |
298 for dummy get and set definitions. */ | |
299 #ifdef HAVE_TCATTR | |
300 struct termios main; | |
301 #else /* !HAVE_TCATTR */ | |
302 #ifdef HAVE_TERMIO | |
303 struct termio main; | |
304 #else /* !HAVE_TERMIO */ | |
442 | 305 #ifdef WIN32_NATIVE |
428 | 306 int main; |
442 | 307 #else /* not WIN32_NATIVE */ |
428 | 308 struct sgttyb main; |
442 | 309 #endif /* not WIN32_NATIVE */ |
428 | 310 #endif /* !HAVE_TERMIO */ |
311 #endif /* !HAVE_TCATTR */ | |
312 | |
313 /* If we have TERMIOS, we don't need to do this - they're taken care of | |
314 by the tc*attr calls. */ | |
315 #ifndef HAVE_TERMIOS | |
316 #ifdef HAVE_LTCHARS | |
317 struct ltchars ltchars; | |
318 #endif /* HAVE_LTCHARS */ | |
319 | |
320 #ifdef HAVE_TCHARS | |
321 struct tchars tchars; | |
322 int lmode; | |
323 #endif /* HAVE_TCHARS */ | |
324 #endif /* HAVE_TERMIOS */ | |
325 }; | |
326 | |
430 | 327 int emacs_get_tty (int fd, struct emacs_tty *settings); |
328 int emacs_set_tty (int fd, struct emacs_tty *settings, int flushp); | |
428 | 329 |
330 | |
331 /* --------------------------------------------------------- */ | |
332 /* Define EMACS_TTY_TABS_OK */ | |
333 /* --------------------------------------------------------- */ | |
334 | |
513 | 335 #if defined (TABDLY) && defined (TAB3) |
336 # define EMACS_TTY_TABS_OK(p) (((p)->main.c_oflag & TABDLY) != TAB3) | |
337 #elif defined (OXTABS) | |
338 # define EMACS_TTY_TABS_OK(p) (((p)->main.c_oflag & OXTABS) != OXTABS) | |
428 | 339 #else |
513 | 340 # define EMACS_TTY_TABS_OK(p) 1 |
341 #endif | |
428 | 342 |
440 | 343 #endif /* INCLUDED_systty_h_ */ |