/* -*-C-*-
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/osterm.h,v 1.1 1990/06/20 19:36:43 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/osterm.h,v 1.2 1990/10/16 20:53:21 cph Exp $
Copyright (c) 1990 Massachusetts Institute of Technology
extern int EXFUN (OS_terminal_read_char, (Tchannel channel));
extern int EXFUN (OS_terminal_char_ready_p, (Tchannel channel, clock_t delay));
+extern unsigned int EXFUN (OS_terminal_get_ispeed, (Tchannel channel));
+extern unsigned int EXFUN (OS_terminal_get_ospeed, (Tchannel channel));
+extern unsigned int EXFUN (arg_baud_index, (unsigned int argument));
+extern unsigned int EXFUN (OS_baud_index_to_rate, (unsigned int index));
+extern int EXFUN (OS_baud_rate_to_index, (unsigned int rate));
+extern int EXFUN (OS_terminal_cooked_output_p, (Tchannel channel));
+extern void EXFUN (OS_terminal_raw_output, (Tchannel channel));
+extern void EXFUN (OS_terminal_cooked_output, (Tchannel channel));
extern int EXFUN (OS_terminal_buffered_p, (Tchannel channel));
extern void EXFUN (OS_terminal_buffered, (Tchannel channel));
extern void EXFUN (OS_terminal_nonbuffered, (Tchannel channel));
/* -*-C-*-
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/prosterm.c,v 1.1 1990/06/20 19:38:35 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/prosterm.c,v 1.2 1990/10/16 20:53:32 cph Exp $
Copyright (c) 1990 Massachusetts Institute of Technology
(arg_nonnegative_integer (2)))));
}
+DEFINE_PRIMITIVE ("TERMINAL-GET-ISPEED", Prim_terminal_get_ispeed, 1, 1, 0)
+{
+ PRIMITIVE_HEADER (1);
+ PRIMITIVE_RETURN
+ (long_to_integer (OS_terminal_get_ispeed (arg_terminal (1))));
+}
+
+DEFINE_PRIMITIVE ("TERMINAL-GET-OSPEED", Prim_terminal_get_ospeed, 1, 1, 0)
+{
+ PRIMITIVE_HEADER (1);
+ PRIMITIVE_RETURN
+ (long_to_integer (OS_terminal_get_ospeed (arg_terminal (1))));
+}
+
+DEFINE_PRIMITIVE ("BAUD-INDEX->RATE", Prim_baud_index_to_rate, 1, 1, 0)
+{
+ PRIMITIVE_HEADER (1);
+ PRIMITIVE_RETURN
+ (long_to_integer (OS_baud_index_to_rate [arg_baud_index (1)]));
+}
+
+DEFINE_PRIMITIVE ("BAUD-RATE->INDEX", Prim_baud_rate_to_index, 1, 1, 0)
+{
+ PRIMITIVE_HEADER (1);
+ {
+ int index = (OS_baud_rate_to_index (arg_nonnegative_integer (1)));
+ if (index < 0)
+ error_bad_range_arg (1);
+ PRIMITIVE_RETURN (long_to_integer (index));
+ }
+}
+\f
+DEFINE_PRIMITIVE ("TERMINAL-COOKED-OUTPUT?", Prim_terminal_cooked_output_p, 1, 1,
+ "Return #F iff TERMINAL is not in cooked output mode.")
+{
+ PRIMITIVE_HEADER (1);
+ PRIMITIVE_RETURN
+ (BOOLEAN_TO_OBJECT (OS_terminal_cooked_output_p (arg_terminal (1))));
+}
+
+DEFINE_PRIMITIVE ("TERMINAL-RAW-OUTPUT", Prim_terminal_raw_output, 1, 1,
+ "Put TERMINAL into raw output mode.")
+{
+ PRIMITIVE_HEADER (1);
+ OS_terminal_raw_output (arg_terminal (1));
+ PRIMITIVE_RETURN (UNSPECIFIC);
+}
+
+DEFINE_PRIMITIVE ("TERMINAL-COOKED-OUTPUT", Prim_terminal_cooked_output, 1, 1,
+ "Put TERMINAL into cooked output mode.")
+{
+ PRIMITIVE_HEADER (1);
+ OS_terminal_cooked_output (arg_terminal (1));
+ PRIMITIVE_RETURN (UNSPECIFIC);
+}
+
DEFINE_PRIMITIVE ("TERMINAL-BUFFERED?", Prim_terminal_buffered_p, 1, 1,
"Return #F iff TERMINAL is not in buffered mode.")
{
OS_terminal_drain_output (arg_terminal (1));
PRIMITIVE_RETURN (UNSPECIFIC);
}
-
+\f
DEFINE_PRIMITIVE ("OPEN-PTY-MASTER", Prim_open_pty_master, 0, 0,
"Open a PTY master, returning the master's channel and the slave's name.\n\
The result is a pair whose car is a channel and whose cdr is a filename.\n\
/* -*-C-*-
System file for BSD4.2
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/s/Attic/bsd4-2.h,v 1.4 1990/06/20 19:54:52 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/s/Attic/bsd4-2.h,v 1.5 1990/10/16 20:56:47 cph Rel $
-Copyright (c) 1989 Massachusetts Institute of Technology
+Copyright (c) 1989, 1990 Massachusetts Institute of Technology
This material was developed by the Scheme project at the Massachusetts
Institute of Technology, Department of Electrical Engineering and
promotional, or sales literature without prior written consent from
MIT in each case. */
-/* This says we have curses terminal support for Edwin. */
-#define HAVE_CURSES
-
#define C_SWITCH_SYSTEM -D_BSD4_2
-#define LIBS_SYSTEM -ltermcap
+#define LIBS_TERMCAP -ltermcap
#define ALTERNATE_M4 s/ultrix.m4
/* -*-C-*-
System file for BSD4.3
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/s/Attic/bsd4-3.h,v 1.1 1990/06/20 19:55:31 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/s/Attic/bsd4-3.h,v 1.2 1990/10/16 20:56:53 cph Rel $
Copyright (c) 1990 Massachusetts Institute of Technology
promotional, or sales literature without prior written consent from
MIT in each case. */
-/* This says we have curses terminal support for Edwin. */
-#define HAVE_CURSES
-
#define C_SWITCH_SYSTEM -D_BSD4_3
-#define LIBS_SYSTEM -ltermcap
+#define LIBS_TERMCAP -ltermcap
#define ALTERNATE_M4 s/ultrix.m4
/* -*-C-*-
System file for HP-UX
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/s/Attic/hpux.h,v 1.6 1990/06/20 19:54:58 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/s/Attic/hpux.h,v 1.7 1990/10/16 20:57:00 cph Exp $
Copyright (c) 1989, 1990 Massachusetts Institute of Technology
promotional, or sales literature without prior written consent from
MIT in each case. */
-/* This says we have curses terminal support for Edwin. */
-#define HAVE_CURSES
+#define HAVE_TERMINFO
/* Define HAVE_STARBASE_GRAPHICS if you want Starbase graphics support. */
/* #define HAVE_STARBASE_GRAPHICS */
/* No special libraries are needed for debugging. */
#define LIB_DEBUG
-#ifndef HAVE_CURSES
-#define LIBS_SYSTEM -lcurses
-#endif
-
#ifndef INSTALL_PROGRAM
#define INSTALL_PROGRAM cp
#endif
/* -*-C-*-
System file for NeXT running Mach
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/s/Attic/nextos.h,v 1.1 1990/09/06 18:57:34 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/s/Attic/nextos.h,v 1.2 1990/10/16 20:57:07 cph Rel $
Copyright (c) 1990 Massachusetts Institute of Technology
promotional, or sales literature without prior written consent from
MIT in each case. */
-/* This says we have curses terminal support for Edwin. */
-#define HAVE_CURSES
-
#define C_SWITCH_SYSTEM -bsd -fwritable-strings -D_BSD4_3
-#define LIBS_SYSTEM -ltermcap
+#define LIBS_TERMCAP -ltermcap
/* -*-C-*-
System file for SUNOS
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/s/Attic/sunos3.h,v 1.1 1990/06/20 19:55:45 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/s/Attic/sunos3.h,v 1.2 1990/10/16 20:57:13 cph Rel $
Copyright (c) 1990 Massachusetts Institute of Technology
promotional, or sales literature without prior written consent from
MIT in each case. */
-/* This says we have curses terminal support for Edwin. */
-#define HAVE_CURSES
-
#ifndef ALTERNATE_CC
#define C_SWITCH_SYSTEM -D_SUNOS3 -DCAST_FUNCTION_TO_INT_BUG
#else
#define C_SWITCH_SYSTEM -D_SUNOS3
#endif
-#define LIBS_SYSTEM -ltermcap
+#define LIBS_TERMCAP -ltermcap
#define ALTERNATE_M4 s/ultrix.m4
/* -*-C-*-
System file for SUNOS
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/s/Attic/sunos4.h,v 1.1 1990/06/20 19:56:08 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/s/Attic/sunos4.h,v 1.2 1990/10/16 20:57:19 cph Rel $
Copyright (c) 1990 Massachusetts Institute of Technology
promotional, or sales literature without prior written consent from
MIT in each case. */
-/* This says we have curses terminal support for Edwin. */
-#define HAVE_CURSES
-
#define C_SWITCH_SYSTEM -D_SUNOS4
-#define LIBS_SYSTEM -ltermcap
+#define LIBS_TERMCAP -ltermcap
#define ALTERNATE_M4 s/ultrix.m4
/* -*-C-*-
System file for Ultrix
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/s/Attic/ultrix.h,v 1.10 1990/10/10 02:36:36 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/s/Attic/ultrix.h,v 1.11 1990/10/16 20:57:25 cph Exp $
Copyright (c) 1989, 1990 Massachusetts Institute of Technology
/* Why? -- ask JMiller */
#undef ultrix
-/* This says we have curses terminal support for Edwin. */
-#define HAVE_CURSES
-
/* This is in mips.h for some reason. */
/* #define LIB_DEBUG */
#define C_SWITCH_SYSTEM -D_ULTRIX -YPOSIX
-#define LIBS_SYSTEM -ltermcap
+#define LIBS_TERMCAP -ltermcap
/* Fix random bug in Ultrix "libX11.a"; I quote:
/* -*-C-*-
System file for Encore UMAX42 and Mach
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/s/Attic/umax.h,v 1.2 1990/06/20 19:55:07 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/s/Attic/umax.h,v 1.3 1990/10/16 20:57:29 cph Rel $
-Copyright (c) 1989 Massachusetts Institute of Technology
+Copyright (c) 1989, 1990 Massachusetts Institute of Technology
This material was developed by the Scheme project at the Massachusetts
Institute of Technology, Department of Electrical Engineering and
promotional, or sales literature without prior written consent from
MIT in each case. */
-/* This says we have curses terminal support for Edwin. */
-#define HAVE_CURSES
-
#define C_SWITCH_SYSTEM -D_BSD4_2 -Dumax
-#define LIBS_SYSTEM -ltermcap
+#define LIBS_TERMCAP -ltermcap
/* -*-C-*-
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/unxutl/Attic/ymkfile,v 1.29 1990/10/02 22:52:47 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/unxutl/Attic/ymkfile,v 1.30 1990/10/16 20:54:17 cph Exp $
Copyright (c) 1989, 1990 Massachusetts Institute of Technology
#define LIBX11_SYSTEM
#endif
+#ifdef HAVE_TERMINFO
+#ifndef LIBS_TERMCAP
+#define LIBS_TERMCAP -lcurses
+#endif
+TERMCAP_OBJECTS = terminfo.o tterm.o
+#else /* not HAVE_TERMINFO */
+#ifndef LIBS_TERMCAP
+#define LIBS_TERMCAP
+TERMCAP_OBJECTS = termcap.o tparam.o tterm.o
+#else /* LIBS_TERMCAP */
+TERMCAP_OBJECTS = tparam.o tterm.o
+#endif /* LIBS_TERMCAP */
+#endif /* not HAVE_TERMINFO */
+TERMCAP_SOURCES = tterm.c
+TERMCAP_LIBS = LIBS_TERMCAP
+
#ifdef HAVE_X_WINDOWS
X_SOURCES = x11base.c x11term.c x11graph.c
X_OBJECTS = x11base.o x11term.o x11graph.o
GRAPHICS_LIBS =
#endif /* HAVE_STARBASE_GRAPHICS */
-#ifdef HAVE_CURSES
-CTERM_SOURCES = cterm.c
-CTERM_OBJECTS = cterm.o
-CTERM_LIB = -lcurses
-#else /* not HAVE_CURSES */
-CTERM_SOURCES =
-CTERM_OBJECTS =
-CTERM_LIB =
-#endif /* HAVE_CURSES */
-
#if (PROC_TYPE == PROC_TYPE_68020)
#define PROC_TYPE_KNOWN
MACHINE_SWITCHES = -DMC68020 -DHAS_COMPILER_SUPPORT
/* Source and object files */
-SCHEME_SOURCES = $(X_SOURCES) $(CTERM_SOURCES) $(GRAPHICS_SOURCES) SOURCES_SYSTEM SOURCES_MACHINE $(USER_PRIM_SOURCES) missing.c
-SCHEME_OBJECTS = $(X_OBJECTS) $(CTERM_OBJECTS) $(GRAPHICS_OBJECTS) OBJECTS_SYSTEM OBJECTS_MACHINE $(USER_PRIM_OBJECTS) missing.o usrdef.o
-SCHEME_LIB = $(USER_LIBS) $(GRAPHICS_LIBS) $(X_LIB) $(CTERM_LIB) LIB_MATH LIBS_SYSTEM LIBS_MACHINE LIB_DEBUG LIB_STANDARD
+SCHEME_SOURCES = $(X_SOURCES) $(TERMCAP_SOURCES) $(GRAPHICS_SOURCES) SOURCES_SYSTEM SOURCES_MACHINE $(USER_PRIM_SOURCES) missing.c
+SCHEME_OBJECTS = $(X_OBJECTS) $(TERMCAP_OBJECTS) $(GRAPHICS_OBJECTS) OBJECTS_SYSTEM OBJECTS_MACHINE $(USER_PRIM_OBJECTS) missing.o usrdef.o
+SCHEME_LIB = $(USER_LIBS) $(GRAPHICS_LIBS) $(X_LIB) $(TERMCAP_LIBS) LIB_MATH LIBS_SYSTEM LIBS_MACHINE LIB_DEBUG LIB_STANDARD
SOURCES = \
$(MACHINE_SOURCES) \
storage.o : scheme.touch gctype.c
char.o string.o : scheme.touch prims.h
+tterm.o : scheme.touch prims.h osterm.h
boot.o : scheme.touch prims.h version.h paths.h ostop.h
term.o : scheme.touch
x11base.o x11graph.o x11term.o starbasex.o : scheme.touch prims.h x11.h
x11base.o : ux.h
-cterm.o : scheme.touch prims.h
starbase.o : scheme.touch prims.h
Sgraph.o Sgraph_xt.o SgX.o : scheme.touch prims.h Sgraph.h
/* -*-C-*-
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/ux.c,v 1.2 1990/08/16 22:33:42 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/ux.c,v 1.3 1990/10/16 20:53:43 cph Exp $
Copyright (c) 1990 Massachusetts Institute of Technology
#ifdef HAVE_BSD_JOB_CONTROL
|| ((UX_ioctl (fd, TIOCGLTC, (& (s -> ltc)))) < 0)
#endif
- ) ? (-1) : 0);
+ || ((UX_ioctl (fd, TIOCLGET, (& (s -> lmode)))) < 0))
+ ? (-1) : 0);
}
int
#ifdef HAVE_BSD_JOB_CONTROL
|| ((UX_ioctl (fd, TIOCSLTC, (& (s -> ltc)))) < 0)
#endif
- ) ? (-1) : 0);
+ || ((UX_ioctl (fd, TIOCLSET, (& (s -> lmode)))) < 0))
+ ? (-1) : 0);
}
#endif /* HAVE_BSD_TTY_DRIVER */
/* -*-C-*-
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/ux.h,v 1.10 1990/08/17 20:05:32 markf Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/ux.h,v 1.11 1990/10/16 20:53:48 cph Exp $
Copyright (c) 1988, 1989, 1990 Massachusetts Institute of Technology
#ifdef HAVE_BSD_JOB_CONTROL
struct ltchars ltc;
#endif
+ int lmode;
} Ttty_state;
#endif /* HAVE_BSD_TTY_DRIVER */
/* -*-C-*-
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/uxterm.c,v 1.3 1990/07/28 18:57:03 jinx Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/uxterm.c,v 1.4 1990/10/16 20:53:55 cph Exp $
Copyright (c) 1990 Massachusetts Institute of Technology
#include "ux.h"
#include "uxterm.h"
#include "uxio.h"
+
+#if defined(HAVE_TERMIOS) || defined(HAVE_TERMIO)
+
+#ifndef ISTRIP
+#define ISTRIP 0
+#endif
+#ifndef CS8
+#define CS8 0
+#endif
+#ifndef PARENB
+#define PARENB 0
+#endif
+
+#else
+#ifdef HAVE_BSD_TTY_DRIVER
+
+/* LPASS8 is new in 4.3, and makes cbreak mode provide all 8 bits. */
+#ifndef LPASS8
+#define LPASS8 0
+#endif
+
+#endif /* HAVE_BSD_TTY_DRIVER */
+#endif /* not HAVE_TERMIOS nor HAVE_TERMIO */
\f
struct terminal_state
{
int buffer;
-#if defined(HAVE_TERMIOS) || defined(HAVE_TERMIO)
- char saved_echo;
- cc_t saved_vmin;
- cc_t saved_vtime;
-#endif
+ Ttty_state state;
};
static struct terminal_state * terminal_table;
#define TERMINAL_BUFFER(channel) ((terminal_table[(channel)]) . buffer)
-#if defined(HAVE_TERMIOS) || defined(HAVE_TERMIO)
-#define TERMINAL_ECHO(channel) ((terminal_table[(channel)]) . saved_echo)
-#define TERMINAL_VMIN(channel) ((terminal_table[(channel)]) . saved_vmin)
-#define TERMINAL_VTIME(channel) ((terminal_table[(channel)]) . saved_vtime)
+#define TERMINAL_ORIGINAL_STATE(channel) ((terminal_table[(channel)]) . state)
+
+#ifdef HAVE_TERMIOS
+#define TIO(s) (s)
+#else
+#ifdef HAVE_TERMIO
+#define TIO(s) (& ((s) -> tio))
+#endif
#endif
void
DEFUN (terminal_open, (channel), Tchannel channel)
{
(TERMINAL_BUFFER (channel)) = (-1);
-#if defined(HAVE_TERMIOS) || defined(HAVE_TERMIO)
- {
- Ttty_state s;
-#ifdef HAVE_TERMIOS
- struct termios * tio = (&s);
-#else
- struct termio * tio = (& (s . tio));
-#endif
- get_terminal_state (channel, (&s));
- (TERMINAL_ECHO (channel)) = (((tio -> c_lflag) & ECHO) != 0);
- (TERMINAL_VMIN (channel)) = ((tio -> c_cc) [VMIN]);
- (TERMINAL_VTIME (channel)) = ((tio -> c_cc) [VTIME]);
- }
-#endif
+ get_terminal_state (channel, (& (TERMINAL_ORIGINAL_STATE (channel))));
}
int
}
}
\f
-int
-DEFUN (terminal_state_buffered_p, (s), Ttty_state * s)
+unsigned int
+DEFUN (terminal_state_get_ospeed, (s), Ttty_state * s)
{
-#if defined(HAVE_TERMIOS) || defined(HAVE_TERMIO)
#ifdef HAVE_TERMIOS
- struct termios * tio = s;
+ return (cfgetospeed (s));
#else
- struct termio * tio = (& (s -> tio));
-#endif
- return (((tio -> c_lflag) & ICANON) != 0);
+#ifdef HAVE_TERMIO
+ return (((TIO (s)) -> c_cflag) & CBAUD);
+#else
+#ifdef HAVE_BSD_TTY_DRIVER
+ return (s -> sg . sg_ospeed);
+#endif /* HAVE_BSD_TTY_DRIVER */
+#endif /* not HAVE_TERMIO */
+#endif /* not HAVE_TERMIOS */
+}
+
+unsigned int
+DEFUN (terminal_state_get_ispeed, (s), Ttty_state * s)
+{
+#ifdef HAVE_TERMIOS
+ return (cfgetispeed (s));
+#else
+#ifdef HAVE_TERMIO
+ return (((TIO (s)) -> c_cflag) & CBAUD);
+#else
+#ifdef HAVE_BSD_TTY_DRIVER
+ return (s -> sg . sg_ispeed);
+#endif /* HAVE_BSD_TTY_DRIVER */
+#endif /* not HAVE_TERMIO */
+#endif /* not HAVE_TERMIOS */
+}
+
+int
+DEFUN (terminal_state_cooked_output_p, (s), Ttty_state * s)
+{
+#if defined(HAVE_TERMIOS) || defined(HAVE_TERMIO)
+ return ((((TIO (s)) -> c_oflag) & OPOST) != 0);
#else /* not HAVE_TERMIOS nor HAVE_TERMIO */
#ifdef HAVE_BSD_TTY_DRIVER
- return (((s -> sg . sg_flags) & CBREAK) == 0);
+ return (((s -> sg . sg_flags) & LLITOUT) == 0);
#endif /* HAVE_BSD_TTY_DRIVER */
#endif /* HAVE_TERMIOS or HAVE_TERMIO */
}
void
-DEFUN (terminal_state_buffered, (s, channel),
- Ttty_state * s AND
- Tchannel channel)
+DEFUN (terminal_state_raw_output, (s), Ttty_state * s)
{
#if defined(HAVE_TERMIOS) || defined(HAVE_TERMIO)
-#ifdef HAVE_TERMIOS
- struct termios * tio = s;
-#else
- struct termio * tio = (& (s -> tio));
-#endif
- (tio -> c_lflag) |= ICANON;
- if (TERMINAL_ECHO (channel))
- (tio -> c_lflag) |= ECHO;
- ((tio -> c_cc) [VMIN]) = (TERMINAL_VMIN (channel));
- ((tio -> c_cc) [VTIME]) = (TERMINAL_VTIME (channel));
+ ((TIO (s)) -> c_oflag) &=~ OPOST;
#else /* not HAVE_TERMIOS nor HAVE_TERMIO */
#ifdef HAVE_BSD_TTY_DRIVER
- (s -> sg . sg_flags) &=~ CBREAK;
+ (s -> sg . sg_flags) &=~ ALLDELAY;
+ (s -> lmode) |= LLITOUT;
+#endif /* HAVE_BSD_TTY_DRIVER */
+#endif /* HAVE_TERMIOS or HAVE_TERMIO */
+}
+
+void
+DEFUN (terminal_state_cooked_output, (s, channel),
+ Ttty_state * s AND Tchannel channel)
+{
+ Ttty_state * os = (& (TERMINAL_ORIGINAL_STATE (channel)));
+#if defined(HAVE_TERMIOS) || defined(HAVE_TERMIO)
+ ((TIO (s)) -> c_oflag) = ((TIO (os)) -> c_oflag);
+#else /* not HAVE_TERMIOS nor HAVE_TERMIO */
+#ifdef HAVE_BSD_TTY_DRIVER
+ (s -> sg . sg_flags) =
+ (((s -> sg . sg_flags) &~ ALLDELAY) | ((os -> sg . sg_flags) & ALLDELAY));
+ (s -> lmode) = (((s -> lmode) &~ LLITOUT) | ((os -> lmode) & LLITOUT));
+#endif /* HAVE_BSD_TTY_DRIVER */
+#endif /* HAVE_TERMIOS or HAVE_TERMIO */
+}
+\f
+int
+DEFUN (terminal_state_buffered_p, (s), Ttty_state * s)
+{
+#if defined(HAVE_TERMIOS) || defined(HAVE_TERMIO)
+ return ((((TIO (s)) -> c_lflag) & ICANON) != 0);
+#else /* not HAVE_TERMIOS nor HAVE_TERMIO */
+#ifdef HAVE_BSD_TTY_DRIVER
+ return (((s -> sg . sg_flags) & (CBREAK | RAW)) == 0);
#endif /* HAVE_BSD_TTY_DRIVER */
#endif /* HAVE_TERMIOS or HAVE_TERMIO */
}
Ttty_state * s AND int polling)
{
#if defined(HAVE_TERMIOS) || defined(HAVE_TERMIO)
-#ifdef HAVE_TERMIOS
- struct termios * tio = s;
-#else
- struct termio * tio = (& (s -> tio));
-#endif
- (tio -> c_lflag) &=~ (ICANON | ECHO);
- ((tio -> c_cc) [VMIN]) = (polling ? 0 : 1);
- ((tio -> c_cc) [VTIME]) = 0;
+ ((TIO (s)) -> c_lflag) &=~ (ICANON | ECHO);
+ ((TIO (s)) -> c_lflag) |= ISIG;
+ ((TIO (s)) -> c_iflag) |= IGNBRK;
+ ((TIO (s)) -> c_iflag) &=~ (ICRNL | IXON | ISTRIP);
+ ((TIO (s)) -> c_cflag) |= CS8;
+ ((TIO (s)) -> c_cflag) &=~ PARENB;
+ (((TIO (s)) -> c_cc) [VMIN]) = (polling ? 0 : 1);
+ (((TIO (s)) -> c_cc) [VTIME]) = 0;
#else /* not HAVE_TERMIOS nor HAVE_TERMIO */
#ifdef HAVE_BSD_TTY_DRIVER
- (s -> sg . sg_flags) |= CBREAK;
+ (s -> sg . sg_flags) &=~ (ECHO | CRMOD);
+ (s -> sg . sg_flags) |= (ANYP | CBREAK);
+ (s -> lmode) |= (LPASS8 | LNOFLSH);
#endif /* HAVE_BSD_TTY_DRIVER */
#endif /* HAVE_TERMIOS or HAVE_TERMIO */
}
DEFUN (terminal_state_raw, (s), Ttty_state * s)
{
#if defined(HAVE_TERMIOS) || defined(HAVE_TERMIO)
-#ifdef HAVE_TERMIOS
- struct termios * tio = s;
-#else
- struct termio * tio = (& (s -> tio));
-#endif
- (tio -> c_lflag) &=~ (ICANON | ECHO | ISIG);
- ((tio -> c_cc) [VMIN]) = 1;
- ((tio -> c_cc) [VTIME]) = 0;
+ ((TIO (s)) -> c_lflag) &=~ (ICANON | ECHO | ISIG);
+ ((TIO (s)) -> c_iflag) |= IGNBRK;
+ ((TIO (s)) -> c_iflag) &=~ (ICRNL | IXON | ISTRIP);
+ (((TIO (s)) -> c_cc) [VMIN]) = 1;
+ (((TIO (s)) -> c_cc) [VTIME]) = 0;
#else /* not HAVE_TERMIOS nor HAVE_TERMIO */
#ifdef HAVE_BSD_TTY_DRIVER
- (s -> sg . sg_flags) |= RAW;
+ (s -> sg . sg_flags) &=~ (ECHO | CRMOD);
+ (s -> sg . sg_flags) |= (ANYP | RAW);
+ (s -> lmode) |= (LPASS8 | LNOFLSH);
+#endif /* HAVE_BSD_TTY_DRIVER */
+#endif /* HAVE_TERMIOS or HAVE_TERMIO */
+}
+
+void
+DEFUN (terminal_state_buffered, (s, channel),
+ Ttty_state * s AND
+ Tchannel channel)
+{
+ Ttty_state * os = (& (TERMINAL_ORIGINAL_STATE (channel)));
+#if defined(HAVE_TERMIOS) || defined(HAVE_TERMIO)
+ ((TIO (s)) -> c_lflag) = ((TIO (os)) -> c_lflag);
+ ((TIO (s)) -> c_iflag) = ((TIO (os)) -> c_iflag);
+ ((TIO (s)) -> c_cflag) = ((TIO (os)) -> c_cflag);
+ (((TIO (s)) -> c_cc) [VMIN]) = (((TIO (os)) -> c_cc) [VMIN]);
+ (((TIO (s)) -> c_cc) [VTIME]) = (((TIO (os)) -> c_cc) [VTIME]);
+#else /* not HAVE_TERMIOS nor HAVE_TERMIO */
+#ifdef HAVE_BSD_TTY_DRIVER
+ (s -> sg . sg_flags) =
+ (((s -> sg . sg_flags) &~ (ECHO | CRMOD | ANYP | CBREAK | RAW))
+ | ((os -> sg . sg_flags) & (ECHO | CRMOD | ANYP | CBREAK | RAW)));
+ (s -> lmode) =
+ (((s -> lmode) &~ (LPASS8 | LNOFLSH))
+ | ((os -> lmode) & (LPASS8 | LNOFLSH)));
#endif /* HAVE_BSD_TTY_DRIVER */
#endif /* HAVE_TERMIOS or HAVE_TERMIO */
}
#endif /* HAVE_TERMIO or HAVE_TERMIOS */
#endif /* HAVE_FIONREAD */
\f
+unsigned int
+DEFUN (OS_terminal_get_ispeed, (channel), Tchannel channel)
+{
+ Ttty_state s;
+ get_terminal_state (channel, (&s));
+ return (terminal_state_get_ispeed (&s));
+}
+
+unsigned int
+DEFUN (OS_terminal_get_ospeed, (channel), Tchannel channel)
+{
+ Ttty_state s;
+ get_terminal_state (channel, (&s));
+ return (terminal_state_get_ospeed (&s));
+}
+
+static unsigned int baud_convert [] =
+#ifdef _HPUX
+ {
+ 0, 50, 75, 110, 135, 150, 200, 300, 600, 900, 1200,
+ 1800, 2400, 3600, 4800, 7200, 9600, 19200, 38400
+ };
+#else
+ {
+ 0, 50, 75, 110, 135, 150, 200, 300, 600, 1200,
+ 1800, 2400, 4800, 9600, 19200, 38400
+ };
+#endif
+
+#define BAUD_CONVERT_LENGTH \
+ ((sizeof (baud_convert)) / (sizeof (baud_convert[0])))
+
+unsigned int
+DEFUN (arg_baud_index, (argument), unsigned int argument)
+{
+ return (arg_index_integer (argument, BAUD_CONVERT_LENGTH));
+}
+
+unsigned int
+DEFUN (OS_baud_index_to_rate, (index), unsigned int index)
+{
+ return (baud_convert [index]);
+}
+
+int
+DEFUN (OS_baud_rate_to_index, (rate), unsigned int rate)
+{
+ unsigned int * scan = baud_convert;
+ unsigned int * end = (scan + BAUD_CONVERT_LENGTH);
+ while (scan < end)
+ if ((*scan++) = rate)
+ return ((scan - 1) - baud_convert);
+ return (-1);
+}
+\f
+int
+DEFUN (OS_terminal_cooked_output_p, (channel), Tchannel channel)
+{
+ Ttty_state s;
+ get_terminal_state (channel, (&s));
+ return (terminal_state_cooked_output_p (&s));
+}
+
+void
+DEFUN (OS_terminal_raw_output, (channel), Tchannel channel)
+{
+ Ttty_state s;
+ get_terminal_state (channel, (&s));
+ terminal_state_raw_output (&s);
+ set_terminal_state (channel, (&s));
+}
+
+void
+DEFUN (OS_terminal_cooked_output, (channel), Tchannel channel)
+{
+ Ttty_state s;
+ get_terminal_state (channel, (&s));
+ terminal_state_cooked_output ((&s), channel);
+ set_terminal_state (channel, (&s));
+}
+
int
DEFUN (OS_terminal_buffered_p, (channel), Tchannel channel)
{
/* -*-C-*-
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/version.h,v 11.48 1990/10/07 13:34:49 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/version.h,v 11.49 1990/10/16 20:54:01 cph Exp $
Copyright (c) 1988, 1989, 1990 Massachusetts Institute of Technology
#define VERSION 11
#endif
#ifndef SUBVERSION
-#define SUBVERSION 48
+#define SUBVERSION 49
#endif
#ifndef UCODE_TABLES_FILENAME
/* -*-C-*-
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/x11term.c,v 1.11 1990/10/07 13:34:08 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/x11term.c,v 1.12 1990/10/16 20:54:09 cph Exp $
Copyright (c) 1989, 1990 Massachusetts Institute of Technology
}
\f
static void
-DEFUN (xterm_scroll_lines_up,
- (xw, x_start, x_end, y_start, y_end, lines, hl),
+DEFUN (xterm_scroll_lines_up, (xw, x_start, x_end, y_start, y_end, lines),
struct xwindow * xw AND
unsigned int x_start AND
unsigned int x_end AND
unsigned int y_start AND
unsigned int y_end AND
- unsigned int lines AND
- unsigned int hl)
+ unsigned int lines)
{
{
unsigned int y_to = y_start;
(((y_end - y_start) - lines) * (FONT_HEIGHT (XW_FONT (xw)))),
(XTERM_X_PIXEL (xw, x_start)),
(XTERM_Y_PIXEL (xw, y_start)));
- xterm_clear_rectangle (xw, x_start, x_end, (y_end - lines), y_end, hl);
}
-DEFINE_PRIMITIVE ("XTERM-SCROLL-LINES-UP", Prim_xterm_scroll_lines_up, 7, 7,
- "(XTERM-SCROLL-LINES-UP XTERM X-START X-END Y-START Y-END LINES HL)\n\
-Scroll the contents of the region up by LINES, clearing with HL.")
+DEFINE_PRIMITIVE ("XTERM-SCROLL-LINES-UP", Prim_xterm_scroll_lines_up, 6, 6,
+ "(XTERM-SCROLL-LINES-UP XTERM X-START X-END Y-START Y-END LINES)\n\
+Scroll the contents of the region up by LINES.")
{
- PRIMITIVE_HEADER (7);
+ PRIMITIVE_HEADER (6);
{
struct xwindow * xw = (x_window_arg (1));
unsigned int x_end = (arg_index_integer (3, ((XW_X_CSIZE (xw)) + 1)));
unsigned int y_end = (arg_index_integer (5, ((XW_Y_CSIZE (xw)) + 1)));
unsigned int y_start = (arg_index_integer (4, (y_end + 1)));
unsigned int lines = (arg_index_integer (6, ((y_end - y_start) + 1)));
- unsigned int hl = (HL_ARG (7));
if ((lines > 0) && (x_start < x_end) && (y_start < y_end))
{
unsigned int y_mid = (y_start + lines);
if (CURSOR_IN_RECTANGLE (xw, x_start, x_end, y_mid, y_end))
{
xterm_erase_cursor (xw);
- xterm_scroll_lines_up
- (xw, x_start, x_end, y_start, y_end, lines, hl);
+ xterm_scroll_lines_up (xw, x_start, x_end, y_start, y_end, lines);
xterm_draw_cursor (xw);
}
else
{
- xterm_scroll_lines_up
- (xw, x_start, x_end, y_start, y_end, lines, hl);
+ xterm_scroll_lines_up (xw, x_start, x_end, y_start, y_end, lines);
if (CURSOR_IN_RECTANGLE (xw, x_start, x_end, y_start, y_mid))
{
(XW_CURSOR_VISIBLE_P (xw)) = 0;
}
\f
static void
-DEFUN (xterm_scroll_lines_down,
- (xw, x_start, x_end, y_start, y_end, lines, hl),
+DEFUN (xterm_scroll_lines_down, (xw, x_start, x_end, y_start, y_end, lines),
struct xwindow * xw AND
unsigned int x_start AND
unsigned int x_end AND
unsigned int y_start AND
unsigned int y_end AND
- unsigned int lines AND
- unsigned int hl)
+ unsigned int lines)
{
{
unsigned int y_to = y_end;
(((y_end - y_start) - lines) * (FONT_HEIGHT (XW_FONT (xw)))),
(XTERM_X_PIXEL (xw, x_start)),
(XTERM_Y_PIXEL (xw, (y_start + lines))));
- xterm_clear_rectangle (xw, x_start, x_end, y_start, (y_start + lines), hl);
}
-DEFINE_PRIMITIVE ("XTERM-SCROLL-LINES-DOWN", Prim_xterm_scroll_lines_down, 7, 7,
- "(XTERM-SCROLL-LINES-DOWN XTERM X-START X-END Y-START Y-END LINES HL)\n\
-Scroll the contents of the region down by LINES, clearing with HL.")
+DEFINE_PRIMITIVE ("XTERM-SCROLL-LINES-DOWN", Prim_xterm_scroll_lines_down, 6, 6,
+ "(XTERM-SCROLL-LINES-DOWN XTERM X-START X-END Y-START Y-END LINES)\n\
+Scroll the contents of the region down by LINES.")
{
- PRIMITIVE_HEADER (7);
+ PRIMITIVE_HEADER (6);
{
struct xwindow * xw = (x_window_arg (1));
unsigned int x_end = (arg_index_integer (3, ((XW_X_CSIZE (xw)) + 1)));
unsigned int y_end = (arg_index_integer (5, ((XW_Y_CSIZE (xw)) + 1)));
unsigned int y_start = (arg_index_integer (4, (y_end + 1)));
unsigned int lines = (arg_index_integer (6, ((y_end - y_start) + 1)));
- unsigned int hl = (HL_ARG (7));
if ((lines > 0) && (x_start < x_end) && (y_start < y_end))
{
unsigned int y_mid = (y_end - lines);
{
xterm_erase_cursor (xw);
xterm_scroll_lines_down
- (xw, x_start, x_end, y_start, y_end, lines, hl);
+ (xw, x_start, x_end, y_start, y_end, lines);
xterm_draw_cursor (xw);
}
else
{
xterm_scroll_lines_down
- (xw, x_start, x_end, y_start, y_end, lines, hl);
+ (xw, x_start, x_end, y_start, y_end, lines);
if (CURSOR_IN_RECTANGLE (xw, x_start, x_end, y_mid, y_end))
{
(XW_CURSOR_VISIBLE_P (xw)) = 0;
/* -*-C-*-
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/version.h,v 11.48 1990/10/07 13:34:49 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/version.h,v 11.49 1990/10/16 20:54:01 cph Exp $
Copyright (c) 1988, 1989, 1990 Massachusetts Institute of Technology
#define VERSION 11
#endif
#ifndef SUBVERSION
-#define SUBVERSION 48
+#define SUBVERSION 49
#endif
#ifndef UCODE_TABLES_FILENAME