Mercurial > emacs
comparison src/systty.h @ 2658:8be0a57686cb
* systty.h (EMACS_GET_TTY, EMACS_SET_TTY): Move these into
functions in sysdep.c.
* sysdep.c (emacs_get_tty, emacs_set_tty): Here they are.
author | Jim Blandy <jimb@redhat.com> |
---|---|
date | Tue, 04 May 1993 02:39:05 +0000 |
parents | 9994dd2e75c9 |
children | f1cd54cf1b67 |
comparison
equal
deleted
inserted
replaced
2657:cddb75caa9c5 | 2658:8be0a57686cb |
---|---|
292 int lmode; | 292 int lmode; |
293 #endif | 293 #endif |
294 }; | 294 }; |
295 | 295 |
296 /* Define EMACS_GET_TTY and EMACS_SET_TTY, | 296 /* Define EMACS_GET_TTY and EMACS_SET_TTY, |
297 the macros for reading and setting parts of `struct emacs_tty'. */ | 297 the macros for reading and setting parts of `struct emacs_tty'. |
298 | 298 |
299 #ifdef HAVE_TCATTR | 299 These got pretty unmanageable (huge macros are hard to debug), and |
300 | 300 finally needed some code which couldn't be done as part of an |
301 #define EMACS_GET_TTY_1(fd, p) (tcgetattr ((fd), &(p)->main) != -1) | 301 expression, so we moved them out to their own functions in sysdep.c. */ |
302 #define EMACS_SET_TTY_1(fd, p, waitp) \ | 302 #define EMACS_GET_TTY(fd, p) (emacs_get_tty ((fd), (p))) |
303 (tcsetattr ((fd), (waitp) ? TCSAFLUSH : TCSADRAIN, &(p)->main) != -1) | 303 #define EMACS_SET_TTY(fd, p, waitp) (emacs_set_tty ((fd), (p), (waitp))) |
304 | 304 |
305 #else | |
306 #ifdef HAVE_TERMIO | |
307 | |
308 #define EMACS_GET_TTY_1(fd, p) (ioctl ((fd), TCGETA, &(p)->main) != -1) | |
309 #define EMACS_SET_TTY_1(fd, p, waitp) \ | |
310 (ioctl ((fd), (waitp) ? TCSETAW : TCSETAF, &(p)->main) != -1) | |
311 | |
312 #else | |
313 #ifdef VMS | |
314 | |
315 /* These definitions will really only work in sysdep.c, because of their | |
316 use of input_iosb. I don't know enough about VMS QIO to fix this. */ | |
317 #define EMACS_GET_TTY_1(fd, p) \ | |
318 (1 & SYS$QIOW (0, (fd), IO$_SENSEMODE, (p), 0, 0, \ | |
319 &(p)->main.class, 12, 0, 0, 0, 0)) | |
320 #define EMACS_SET_TTY_1(fd, p, waitp) \ | |
321 (1 & SYS$QIOW (0, (fd), IO$_SETMODE, &input_iosb, 0, 0, \ | |
322 &(p)->main.class, 12, 0, 0, 0, 0)) | |
323 | |
324 #else | |
325 | |
326 #define EMACS_GET_TTY_1(fd, p) (ioctl ((fd), TIOCGETP, &(p)->main) != -1) | |
327 #define EMACS_SET_TTY_1(fd, p, waitp) \ | |
328 (ioctl ((fd), (waitp) ? TIOCSETP : TIOCSETN, &(p)->main) != -1) | |
329 | |
330 #endif | |
331 #endif | |
332 #endif | |
333 | |
334 #ifdef TIOCGLTC | |
335 #define EMACS_GET_TTY_2(fd, p) \ | |
336 (ioctl ((fd), TIOCGLTC, &(p)->ltchars) != -1) | |
337 #define EMACS_SET_TTY_2(fd, p, waitp) \ | |
338 (ioctl ((fd), TIOCSLTC, &(p)->ltchars) != -1) | |
339 #else | |
340 #define EMACS_GET_TTY_2(fd, p) 1 | |
341 #define EMACS_SET_TTY_2(fd, p, waitp) 1 | |
342 #endif /* TIOCGLTC */ | |
343 | |
344 #ifdef TIOCGETC | |
345 #define EMACS_GET_TTY_3(fd, p) \ | |
346 (ioctl ((fd), TIOCGETC, &(p)->tchars) != -1 \ | |
347 && ioctl ((fd), TIOCLGET, &(p)->lmode) != -1) | |
348 #define EMACS_SET_TTY_3(fd, p, waitp) \ | |
349 (ioctl ((fd), TIOCSETC, &(p)->tchars) != -1 \ | |
350 && ioctl ((fd), TIOCLSET, &(p)->lmode) != -1) | |
351 #else | |
352 #define EMACS_GET_TTY_3(fd, p) 1 | |
353 #define EMACS_SET_TTY_3(fd, p, waitp) 1 | |
354 #endif /* TIOCGLTC */ | |
355 | |
356 /* Define these to be a concatenation of all the EMACS_{GET,SET}_TTY_n | |
357 macros. */ | |
358 #define EMACS_GET_TTY(fd, tc) \ | |
359 (EMACS_GET_TTY_1 (fd, tc) \ | |
360 && EMACS_GET_TTY_2 (fd, tc) \ | |
361 && EMACS_GET_TTY_3 (fd, tc)) | |
362 | |
363 #define EMACS_SET_TTY(fd, tc, waitp) \ | |
364 (EMACS_SET_TTY_1 (fd, tc, waitp) \ | |
365 && EMACS_SET_TTY_2 (fd, tc, waitp) \ | |
366 && EMACS_SET_TTY_3 (fd, tc, waitp)) | |
367 | 305 |
368 /* Define EMACS_TTY_TABS_OK. */ | 306 /* Define EMACS_TTY_TABS_OK. */ |
369 | 307 |
370 #ifdef HAVE_TERMIOS | 308 #ifdef HAVE_TERMIOS |
371 | 309 |