Name |
Date |
Size |
#Lines |
LOC |
||
---|---|---|---|---|---|---|
.. | - | - | ||||
:tt | H A D | 06-Jun-1993 | 370 | 12 | 11 | |
:tty | H A D | 06-Jun-1993 | 282 | 7 | 6 | |
:var | H A D | 06-Jun-1993 | 65 | 3 | 2 | |
:ww | H A D | 06-Jun-1993 | 613 | 20 | 19 | |
Makefile | H A D | 06-Jun-1993 | 990 | 23 | 19 | |
README | H A D | 06-Jun-1993 | 8 KiB | 174 | 147 | |
alias.h | H A D | 06-Jun-1993 | 744 | 27 | 10 | |
char.c | H A D | 06-Jun-1993 | 4.2 KiB | 125 | 104 | |
char.h | H A D | 06-Jun-1993 | 1.1 KiB | 36 | 10 | |
cmd.c | H A D | 06-Jun-1993 | 4.6 KiB | 275 | 251 | |
cmd1.c | H A D | 06-Jun-1993 | 2.8 KiB | 147 | 131 | |
cmd2.c | H A D | 06-Jun-1993 | 3.8 KiB | 129 | 111 | |
cmd3.c | H A D | 06-Jun-1993 | 729 | 40 | 26 | |
cmd4.c | H A D | 06-Jun-1993 | 642 | 31 | 17 | |
cmd5.c | H A D | 06-Jun-1993 | 1.8 KiB | 104 | 78 | |
cmd6.c | H A D | 06-Jun-1993 | 1.4 KiB | 85 | 65 | |
cmd7.c | H A D | 06-Jun-1993 | 4.3 KiB | 246 | 211 | |
compress.c | H A D | 06-Jun-1993 | 18.1 KiB | 874 | 782 | |
context.c | H A D | 06-Jun-1993 | 1.7 KiB | 106 | 82 | |
context.h | H A D | 06-Jun-1993 | 1.7 KiB | 58 | 39 | |
defs.h | H A D | 06-Jun-1993 | 1.3 KiB | 46 | 25 | |
error.c | H A D | 06-Jun-1993 | 1.4 KiB | 70 | 52 | |
lcmd.c | H A D | 06-Jun-1993 | 3 KiB | 129 | 110 | |
lcmd.h | H A D | 06-Jun-1993 | 810 | 36 | 18 | |
lcmd1.c | H A D | 06-Jun-1993 | 7.3 KiB | 404 | 346 | |
lcmd2.c | H A D | 06-Jun-1993 | 8.3 KiB | 372 | 325 | |
local.h | H A D | 06-Jun-1993 | 578 | 26 | 8 | |
main.c | H A D | 02-Apr-1994 | 3.5 KiB | 177 | 153 | |
mloop.c | H A D | 06-Jun-1993 | 1.2 KiB | 59 | 44 | |
parser.h | H A D | 06-Jun-1993 | 538 | 22 | 8 | |
parser1.c | H A D | 06-Jun-1993 | 2.9 KiB | 197 | 165 | |
parser2.c | H A D | 06-Jun-1993 | 4.2 KiB | 206 | 181 | |
parser3.c | H A D | 06-Jun-1993 | 2.5 KiB | 166 | 120 | |
parser4.c | H A D | 06-Jun-1993 | 4.5 KiB | 271 | 243 | |
parser5.c | H A D | 06-Jun-1993 | 2.9 KiB | 176 | 151 | |
scanner.c | H A D | 06-Jun-1993 | 9.8 KiB | 547 | 526 | |
startup.c | H A D | 06-Jun-1993 | 1.6 KiB | 67 | 46 | |
string.c | H A D | 06-Jun-1993 | 2 KiB | 128 | 98 | |
string.h | H A D | 06-Jun-1993 | 803 | 40 | 21 | |
token.h | H A D | 06-Jun-1993 | 1.1 KiB | 58 | 43 | |
tt.h | H A D | 06-Jun-1993 | 3.3 KiB | 128 | 73 | |
ttf100.c | H A D | 06-Jun-1993 | 867 | 44 | 25 | |
ttgeneric.c | H A D | 06-Jun-1993 | 9.9 KiB | 524 | 468 | |
tth19.c | H A D | 06-Jun-1993 | 4.3 KiB | 253 | 202 | |
tth29.c | H A D | 06-Jun-1993 | 1.5 KiB | 69 | 38 | |
ttinit.c | H A D | 06-Jun-1993 | 1.9 KiB | 94 | 70 | |
ttoutput.c | H A D | 06-Jun-1993 | 1.9 KiB | 121 | 97 | |
tttermcap.c | H A D | 06-Jun-1993 | 1.5 KiB | 92 | 67 | |
tttvi925.c | H A D | 06-Jun-1993 | 732 | 39 | 20 | |
ttwyse60.c | H A D | 06-Jun-1993 | 1 KiB | 51 | 28 | |
ttwyse75.c | H A D | 06-Jun-1993 | 1 KiB | 51 | 28 | |
ttzapple.c | H A D | 06-Jun-1993 | 6.9 KiB | 458 | 393 | |
ttzentec.c | H A D | 06-Jun-1993 | 855 | 41 | 20 | |
value.h | H A D | 06-Jun-1993 | 550 | 28 | 13 | |
var.c | H A D | 06-Jun-1993 | 2.2 KiB | 132 | 107 | |
var.h | H A D | 06-Jun-1993 | 854 | 33 | 17 | |
win.c | H A D | 06-Jun-1993 | 6.5 KiB | 345 | 256 | |
window.1 | H A D | 30-Dec-1993 | 22.6 KiB | 922 | 921 | |
windowrc | H A D | 06-Jun-1993 | 1.4 KiB | 60 | 55 | |
ww.h | H A D | 06-Jun-1993 | 9 KiB | 296 | 217 | |
wwadd.c | H A D | 06-Jun-1993 | 1.3 KiB | 63 | 44 | |
wwalloc.c | H A D | 06-Jun-1993 | 883 | 46 | 30 | |
wwbox.c | H A D | 06-Jun-1993 | 930 | 41 | 27 | |
wwchild.c | H A D | 06-Jun-1993 | 947 | 46 | 31 | |
wwclose.c | H A D | 06-Jun-1993 | 787 | 34 | 21 | |
wwclreol.c | H A D | 06-Jun-1993 | 1.3 KiB | 70 | 38 | |
wwclreos.c | H A D | 06-Jun-1993 | 619 | 30 | 15 | |
wwcursor.c | H A D | 06-Jun-1993 | 1.4 KiB | 67 | 51 | |
wwdata.c | H A D | 06-Jun-1993 | 360 | 14 | 3 | |
wwdelchar.c | H A D | 06-Jun-1993 | 1.8 KiB | 98 | 65 | |
wwdelete.c | H A D | 06-Jun-1993 | 2.2 KiB | 114 | 89 | |
wwdelline.c | H A D | 06-Jun-1993 | 1.2 KiB | 63 | 37 | |
wwdump.c | H A D | 06-Jun-1993 | 1.6 KiB | 89 | 66 | |
wwend.c | H A D | 06-Jun-1993 | 626 | 39 | 24 | |
wwenviron.c | H A D | 06-Jun-1993 | 1.8 KiB | 77 | 54 | |
wwerror.c | H A D | 06-Jun-1993 | 882 | 44 | 30 | |
wwflush.c | H A D | 06-Jun-1993 | 1.4 KiB | 83 | 64 | |
wwframe.c | H A D | 06-Jun-1993 | 4 KiB | 224 | 193 | |
wwgets.c | H A D | 06-Jun-1993 | 1.5 KiB | 84 | 68 | |
wwinit.c | H A D | 28-Apr-1995 | 7.4 KiB | 363 | 310 | |
wwinschar.c | H A D | 06-Jun-1993 | 1.9 KiB | 105 | 72 | |
wwinsline.c | H A D | 06-Jun-1993 | 1.2 KiB | 63 | 37 | |
wwiomux.c | H A D | 06-Jun-1993 | 4.2 KiB | 178 | 132 | |
wwlabel.c | H A D | 06-Jun-1993 | 1.4 KiB | 71 | 49 | |
wwmisc.c | H A D | 06-Jun-1993 | 901 | 42 | 24 | |
wwmove.c | H A D | 06-Jun-1993 | 1.5 KiB | 73 | 50 | |
wwopen.c | H A D | 28-Apr-1995 | 3.6 KiB | 165 | 139 | |
wwprintf.c | H A D | 06-Jun-1993 | 612 | 32 | 16 | |
wwpty.c | H A D | 06-Jun-1993 | 1.3 KiB | 62 | 48 | |
wwputc.c | H A D | 06-Jun-1993 | 451 | 23 | 10 | |
wwputs.c | H A D | 06-Jun-1993 | 503 | 27 | 13 | |
wwredraw.c | H A D | 06-Jun-1993 | 602 | 31 | 17 | |
wwredrawwin.c | H A D | 06-Jun-1993 | 1 KiB | 48 | 34 | |
wwrint.c | H A D | 06-Jun-1993 | 1.5 KiB | 66 | 37 | |
wwscroll.c | H A D | 06-Jun-1993 | 4.2 KiB | 209 | 158 | |
wwsize.c | H A D | 06-Jun-1993 | 3.5 KiB | 166 | 120 | |
wwspawn.c | H A D | 06-Jun-1993 | 1.1 KiB | 60 | 42 | |
wwsuspend.c | H A D | 06-Jun-1993 | 639 | 31 | 17 | |
wwterminfo.c | H A D | 06-Jun-1993 | 1.7 KiB | 82 | 47 | |
wwtty.c | H A D | 06-Jun-1993 | 3.1 KiB | 155 | 120 | |
wwunframe.c | H A D | 06-Jun-1993 | 1.1 KiB | 51 | 35 | |
wwupdate.c | H A D | 06-Jun-1993 | 5.1 KiB | 246 | 199 | |
wwwrite.c | H A D | 06-Jun-1993 | 5.6 KiB | 273 | 246 | |
xx.c | H A D | 06-Jun-1993 | 3.7 KiB | 227 | 185 | |
xx.h | H A D | 06-Jun-1993 | 653 | 33 | 16 | |
xxflush.c | H A D | 06-Jun-1993 | 4.3 KiB | 171 | 134 |
README
1/*- 2 * Copyright (c) 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Edward Wang at The University of California, Berkeley. 7 * 8 * %sccs.include.redist.c% 9 * 10 * @(#)README 8.1 (Berkeley) 06/06/93 11 */ 12 13Compilation notes: 14 15 Compiler options: 16 17 BYTE_ORDER (used only in ww.h) 18 It should already be defined in machine/endian.h. 19 The code knows about BIG_ENDIAN, LITTLE_ENDIAN, and PDP_ENDIAN. 20 It only cares about byte order in words, so PDP_ENDIAN 21 is the same as LITTLE_ENDIAN. 22 OLD_TTY 23 If you don't have Posix termios, then define this. 24 VMIN_BUG 25 Even if you have Posix termios, define this if the MIN and TIME 26 feature in noncanonical mode doesn't work correctly. 27 28 Ok, there's another one, STR_DEBUG. It turns on consistency checks 29 in the string allocator. It's been left on since performace doesn't 30 seem to suffer. There's an abort() somewhere when an inconsistency 31 is found. It hasn't happened in years. 32 33 The file local.h contains locally tunable constants. 34 35 The makefile used to be updated with mkmf; it has been changed 36at various times to use cpp -M and, currently, mkdep. The only library 37it needs is termcap. 38 39 Window, as is, only runs on 4.3 (or later) machines. 40 41 On 4.2 machines, at least these modifications must be done: 42 43 delete uses of window size ioctls: TIOCGWINSZ, TIOCSWINSZ, 44 struct winsize 45 add to ww.h 46 typedef int fd_set; 47 #define FD_ZERO(s) (*(s) = 0) 48 #define FD_SET(b, s) (*(s) |= 1 << (b)) 49 #define FD_ISSET(b, s) (*(s) & 1 << (b)) 50 add to ww.h 51 #define sigmask(s) (1 << (s) - 1) 52 53 54A few notes about the internals: 55 56 The window package. Windows are opened by calling wwopen(). 57Wwwrite() is the primitive for writing to windows. Wwputc(), wwputs(), 58and wwprintf() are also supported. Some of the outputs to windows are 59delayed. Wwupdate() updates the terminal to match the internal screen 60buffer. Wwspawn() spawns a child process on the other end of a window, 61with its environment tailored to the window. Visible windows are 62doubly linked in the order of their overlap. Wwadd() inserts a window 63into the list at a given place. Wwdelete() deletes it. Windows not in 64the list are not visible, though wwwrite() still works. Window was 65written before the days of X and Sunview, so some of the terminology 66is not standard. 67 68 Most functions return -1 on error. Wwopen() returns the null 69pointer. An error number is saved in wwerrno. Wwerror() returns an 70error string based on wwerrno suitable for printing. 71 72 The terminal drivers perform all output to the physical terminal, 73including special functions like character and line insertion and 74deletion. The window package keeps a list of known terminals. At 75initialization time, the terminal type is matched against the list to 76find the right terminal driver to use. The last driver, the generic 77driver, matches all terminals and uses the termcap database. The 78interface between the window package the terminal driver is the `tt' 79structure. It contains pointers to functions to perform special 80functions and terminal output, as well as flags about the 81characteristics of the terminal. Most of these ideas are borrowed 82from the Maryland window package, which in turn is based on Goslin's 83Emacs. 84 85 The IO system is semi-synchronous. Terminal input is signal 86driven, and everything else is done synchronously with a single 87select(). It is roughly event-driven, though not in a clean way. 88 89 Normally, in both conversation mode and command mode, window 90sleeps in a select() in wwiomux() waiting for data from the 91pseudo-terminals. At the same time, terminal input causes SIGIO which 92is caught by wwrint(). The select() returns when at least one of the 93pseudo-terminals becomes ready for reading. 94 95 Wwrint() is the interrupt handler for tty input. It reads input 96into a linear buffer accessed through four pointers: 97 98 +-------+--------------+----------------+ 99 | empty | data | empty | 100 +-------+--------------+----------------+ 101 ^ ^ ^ ^ 102 | | | | 103 wwib wwibp wwibq wwibe 104 105Wwrint() appends characters at the end and increments wwibq (*wwibq++ 106= c), and characters are taken off the buffer at wwibp using the 107wwgetc() and wwpeekc() macros. As is the convention in C, wwibq 108and wwibe point to one position beyond the end. In addition, 109wwrint() will do a longjmp(wwjmpbuf) if wwsetjmp is true. This is 110used by wwiomux() to interrupt the select() which would otherwise 111resume after the interrupt. (Actually, I hear this is not true, 112but the longjmp feature is used to avoid a race condition as well. 113Anyway, it means I didn't have to depend on a feature in a 114daily-changing kernel, but that's another story.) The macro 115wwinterrupt() returns true if the input buffer is non-empty. 116Wwupdate(), wwwrite(), and wwiomux() check this condition and will 117return at the first convenient opportunity when it becomes true. 118In the case of wwwrite(), the flag ww_nointr in the window structure 119overrides this. This feature allows the user to interrupt lengthy 120outputs safely. The structure of the input buffer is designed to 121avoid race conditions without blocking interrupts. 122 123 Actually, wwsetjmp and wwinterrupt() are part of a software 124interrupt scheme used by the two interrupt catchers wwrint() and 125wwchild(). Asserting the interrupt lets the synchronous parts of 126the program know that there's an interesting asynchronous condition 127(i.e., got a keyboard character, or a child process died) that they 128might want to process before anything else. The synchronous routines 129can check for this condition with wwinterrupt() or by arranging 130that a longjmp() be done. 131 132 Wwiomux() copies pseudo-terminal output into their corresponding 133windows. Without anything to do, it blocks in a select(), waiting for 134read ready on pseudo-terminals. Reads are done into per-window buffers 135in the window structures. When there is at least one buffer non-empty, 136wwiomux() finds the top most of these windows and writes it using 137wwwrite(). Then the process is repeated. A non-blocking select() is 138done after a wwwrite() to pick up any output that may have come in 139during the write, which may take a long time. Specifically, we use 140this to stop output or flush buffer when a pseudo-terminal tells us to 141(we use pty packet mode). The select() blocks only when all of the 142windows' buffers are empty. A wwupdate() is done prior to this, which 143is the only time the screen is guaranteed to be completely up to date. 144Wwiomux() loops until wwinterrupt() becomes true. 145 146 The top level routine for all this is mloop(). In conversation 147mode, it simply calls wwiomux(), which only returns when input is 148available. The input buffer is then written to the pseudo-terminal of 149the current window. If the escape character is found in the input, 150command mode is entered. Otherwise, the process is repeated. In 151command mode, control is transferred to docmd() which returns only when 152conversation mode is reentered. Docmd() and other command processing 153routines typically wait for input in a loop: 154 155 while (wwpeekc() < 0) 156 wwiomux(); 157 158When the loop terminates, wwgetc() is used to read the input buffer. 159 160 Output to the physical terminal is handled by the lowest level 161routines of the window package, in the files ttoutput.c and tt.h. The 162standard IO package is not used, to get better control over buffering 163and to use non-blocking reads in wwrint(). The buffer size is set to 164approximately one second of output time, based on the baudrate. 165 166 The result of all this complexity is faster response time, 167especially in output stopping and flushing. Wwwrite() checks 168wwinterrupt() after every line. It also calls wwupdate() for each line 169it writes. The output buffer is limited to one second of output time. 170Thus, there is usually only a delay of one to two lines plus one second 171after a ^C or ^S. Also, commands that produce lengthy output can be 172aborted without actually showing all of it on the terminal. (Try the 173'?' command followed by escape immediately.) 174