Initial revision
[bpt/emacs.git] / src / s / dgux4.h
1 /* Definitions file for GNU Emacs running on Data General's DG/UX
2 Release 4.10 and above.
3 Copyright (C) 1996 Free Software Foundation, Inc.
4
5 This file is part of GNU Emacs.
6
7 GNU Emacs is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11
12 GNU Emacs is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GNU Emacs; see the file COPYING. If not, write to
19 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
20
21 /* This file was written by Roderick Schertler <roderick@ibcinc.com>,
22 contact me if you have problems with or comments about running Emacs
23 on dgux.
24
25 A number of things in the older dgux*.h files don't make sense to me,
26 but since I'm relying on memory and I don't have any older dgux
27 systems installed on which to test changes I'm undoing or fixing them
28 here rather than fixing them at the source. */
29
30 /* In dgux.h it says "Can't use sys_signal because then etc/server.c
31 would need sysdep.o." and then it #defines signal() to be
32 berk_signal(), but emacsserver.c does `#undef signal' anyway, so that
33 doesn't make sense.
34
35 Further, sys_signal() in sysdep.c already had a special case for
36 #ifdef DGUX, it called berk_signal() explicitly. I've removed that
37 special case because it also didn't make sense: All versions of dgux
38 which the dgux*.h headers take into account have POSIX signals
39 (POSIX_SIGNALS is #defined in dgux.h). The comments in sys_signal()
40 even acknowledged this (saying that the special berk_signal() case
41 wasn't really necessary), they said that sys_signal() was using
42 berk_signal() instead of sigaction() for efficiency. Since both give
43 reliable signals neither has to be invoked within the handler. If
44 the efficiency that the comments were talking about is the overhead
45 of setting up the sigaction struct rather than just passing the
46 function pointer in (which is the only efficiency I can think of)
47 then that's a needless optimization, the Emacs sources do better
48 without the special case.
49
50 The following definition will prevent dgux.h from re-defining
51 signal(). I can't just say `#undef signal' after including dgux.h
52 because signal() is already a macro, defined in <sys/signal.h>, and
53 the original definition would be lost. */
54 #define NO_DGUX_SIGNAL_REDEF
55
56 #include "dgux5-4r3.h"
57
58 #define LIBS_DEBUG /* nothing, -lg doesn't exist */
59
60 #ifndef NOT_C_CODE
61
62 /* dgux.h defines _setjmp() to be sigsetjmp(), but it defines _longjmp
63 to be longjmp() rather than siglongjmp(). Further, it doesn't define
64 jmp_buf, so sigsetjmp() is being called with a jmp_buf rather than a
65 sigjmp_buf, and the buffer is then passed to vanilla longjmp(). This
66 provides a more complete emulation of the Berkeley semantics. */
67
68 #include <setjmp.h>
69 #undef jmp_buf
70 #undef _setjmp
71 #undef setjmp
72 #undef _longjmp
73 #undef longjmp
74 #define jmp_buf sigjmp_buf
75 #define _setjmp(env) sigsetjmp(env, 0)
76 #define setjmp(env) sigsetjmp(env, 1)
77 #define _longjmp siglongjmp
78 #define longjmp siglongjmp
79
80 /* The BAUD_CONVERT definition in dgux.h is wrong with this version
81 of dgux, but I'm not sure when it changed.
82
83 With the current system Emacs' standard handling of ospeed and
84 baud_rate don't work. The baud values (B9600 and so on) returned by
85 cfgetospeed() aren't compatible with those used by ospeed. speed_t,
86 the type returned by cfgetospeed(), is unsigned long and speed_t
87 values are large. Further, it isn't possible to get at both the
88 SysV3 (ospeed) and POSIX (cfgetospeed()) values through symbolic
89 constants simultaneously because they both use the same names
90 (B9600). To get both baud_rate and ospeed right at the same time
91 it's necessary to hardcode the values for one set of values, here I'm
92 hardcoding ospeed. */
93 #undef BAUD_CONVERT
94 #define INIT_BAUD_RATE() \
95 struct termios sg; \
96 \
97 tcgetattr (input_fd, &sg); \
98 switch (cfgetospeed (&sg)) { \
99 case B50: baud_rate = 50; ospeed = 0x1; break; \
100 case B75: baud_rate = 75; ospeed = 0x2; break; \
101 case B110: baud_rate = 110; ospeed = 0x3; break; \
102 case B134: baud_rate = 134; ospeed = 0x4; break; \
103 case B150: baud_rate = 150; ospeed = 0x5; break; \
104 case B200: baud_rate = 200; ospeed = 0x6; break; \
105 case B300: baud_rate = 300; ospeed = 0x7; break; \
106 case B600: baud_rate = 600; ospeed = 0x8; break; \
107 default: \
108 case B1200: baud_rate = 1200; ospeed = 0x9; break; \
109 case B1800: baud_rate = 1800; ospeed = 0xa; break; \
110 case B2400: baud_rate = 2400; ospeed = 0xb; break; \
111 case B4800: baud_rate = 4800; ospeed = 0xc; break; \
112 case B9600: baud_rate = 9600; ospeed = 0xd; break; \
113 case B19200: baud_rate = 19200; ospeed = 0xe; break; \
114 case B38400: baud_rate = 38400; ospeed = 0xf; break; \
115 } \
116 return;
117
118 /* The `stop on tty output' problem which occurs when using
119 INTERRUPT_INPUT and when Emacs is invoked under X11 using a job
120 control shell (csh, ksh, etc.) in the background doesn't look to be
121 present in R4.11. (At least, I can't reproduce it using jsh, csh,
122 ksh or zsh.) */
123 #undef BROKEN_FIONREAD
124 #define INTERRUPT_INPUT
125
126 /* In R4.11 (or maybe R4.10, I don't have a system with that version
127 loaded) some of the internal stdio semantics were changed. One I
128 found while working on MH is that _cnt has to be 0 before _filbuf()
129 is called. Another is that (_ptr - _base) doesn't indicate how many
130 characters are waiting to be sent. I can't spot a good way to get
131 that info from the FILE internals. */
132 #define PENDING_OUTPUT_COUNT(FILE) (1)
133
134 #endif /* NOT_C_CODE */