Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10 5/3/83; site umcp-cs.UUCP
Path: utzoo!linus!philabs!seismo!rlgvax!cvl!umcp-cs!chris
From: chris@umcp-cs.UUCP
Newsgroups: net.sources
Subject: Window source #0 [of 7]: misc files, header files
Message-ID: <364@umcp-cs.UUCP>
Date: Fri, 1-Jul-83 04:09:20 EDT
Article-I.D.: umcp-cs.364
Posted: Fri Jul 1 04:09:20 1983
Date-Received: Sat, 2-Jul-83 06:59:50 EDT
Organization: Univ. of Maryland, Computer Science Dept.
Lines: 665
: Run this shell script with "sh" not "csh"
PATH=:/bin:/usr/bin:/usr/ucb
export PATH
all=FALSE
if [ $1x = -ax ]; then
all=TRUE
fi
/bin/echo 'Extracting Makefile'
sed 's/^X//' <<'//go.sysin dd *' >Makefile
XDOBJS= display.o TrmAmb.o TrmBitG.o TrmTEK4025.o TrmTERM.o TrmVT100.o init.o
XDSRCS= display.c TrmAmb.c TrmBitG.c TrmTEK4025.c TrmTERM.c TrmVT100.c init.c
XWOBJS= acursor.o aprint.o aread.o auxcursor.o\
X back.o bclear.o bclearline.o bcopy.o\
X bcursor.o bdelchars.o bdelcols.o bdellines.o binschars.o binscols.o\
X binslines.o border.o box.o boxfind.o bprint.o bread.o bscroll.o\
X btowcursor.o cleanup.o clear.o clearline.o close.o closeall.o\
X cover.o delchars.o delcols.o dellines.o disp.o filedump.o find.o\
X frame.o front.o getframe.o globals.o hide.o inschars.o inscols.o\
X inslines.o label.o link.o move.o oncursor.o open.o print.o read.o\
X retro.o scroll.o setbuf.o setframe.o setmargins.o size.o suspend.o\
X wcursor.o wexit.o
XWSRCS= acursor.c aprint.c aread.c auxcursor.c\
X back.c bclear.c bclearline.c bcopy.c\
X bcursor.c bdelchars.c bdelcols.c bdellines.c binschars.c binscols.c\
X binslines.c border.c box.c boxfind.c bprint.c bread.c bscroll.c\
X btowcursor.c cleanup.c clear.c clearline.c close.c closeall.c\
X cover.c delchars.c delcols.c dellines.c disp.c filedump.c find.c\
X frame.c front.c getframe.c globals.c hide.c inschars.c inscols.c\
X inslines.c label.c link.c move.c oncursor.c open.c print.c read.c\
X retro.c scroll.c setbuf.c setframe.c setmargins.c size.c suspend.c\
X wcursor.c wexit.c
XJOBSOBJS=
XLIBDIR=/usr/lib
XINCLUDEDIR=/usr/include/local
X
X# To make winlib.a, type ``make winlib.a''. If you're on a Vax,
X# everything should compile. If you're on a 68000, you'll need to
X# edit win.h to reverse the two character elements of union chr.
X# (If you don't, everything will (probably) compile, but not run.)
X#
X# To install winlib.a, after it has been made, type ``make install''.
X# You probably need special priveleges for this, depending on what
X# your system administrators have set up.
X#
X# Note 1: if your system does not have ``ranlib'', you can change the
X# ``ar cr winlib.a ...'' line to read:
X# ar cr winlib.a `cat TSORT`
X# and comment out the ranlib line.
X#
X# Note 2: if your system does not have the jobs library, you can add
X# the file "jobs.o" to the JOBSOBJS= line so that it reads
X# JOBSOBJS=jobs.o
X# and add 'jobs.o' to the end of the TSORT file. A better(?) alternative
X# is to use jobs.c to make a ``jobs library''.
X
X# Take out the -DVAX if you're not on a Vax.
X
XCFLAGS= -O -R -DVAX
X
Xwinlib.a: $(DOBJS) $(WOBJS) $(JOBSOBJS)
X ar cr winlib.a $(DOBJS) $(WOBJS) $(JOBSOBJS)
X ranlib winlib.a
X
X# Once winlib has been made, it can be updated incrementally by
X# deleting the "incremental-" from the front of this next name,
X# commenting out the first entry, and removing the # from the
X# second line of the .c.o entry. This will only work for people
X# who have ranlib.
X
Xincremental-winlib.a: $(DOBJS) $(WOBJS) $(JOBSOBJS)
X ranlib winlib.a
X
Xdepend:
X mkdep -n $(DSRCS) $(WSRCS)
X
X.c.o:
X cc $(CFLAGS) -c $<
X# ar r winlib.a $@
X
XTrmAmb.o: TrmAmb.c Trm.h
XTrmBitG.o: TrmBitG.c Trm.h
XTrmTEK4025.o: TrmTEK4025.c Trm.h
XTrmTERM.o: TrmTERM.c Trm.h win.h
XTrmVT100.o: TrmVT100.c Trm.h
Xdisplay.o: display.c Trm.h win.h
Xinit.o: init.c display.h win.h Trm.h
X
Xacursor.o: acursor.c win.h
Xaread.o: aread.c win.h
Xauxcursor.o: auxcursor.c win.h
Xbclear.o: bclear.c win.h
Xbclearline.o: bclearline.c win.h
Xbcursor.o: bcursor.c win.h
Xbdelchars.o: bdelchars.c win.h
Xbdelcols.o: bdelcols.c win.h
Xbdellines.o: bdellines.c win.h
Xbinschars.o: binschars.c win.h
Xbinscols.o: binscols.c win.h
Xbinslines.o: binslines.c win.h
Xborder.o: border.c win.h
Xbox.o: box.c win.h display.h Trm.h
Xboxfind.o: boxfind.c win.h
Xbread.o: bread.c win.h
Xbscroll.o: bscroll.c win.h
Xbtowcursor.o: btowcursor.c win.h
Xcleanup.o: cleanup.c win.h display.h Trm.h
Xclear.o: clear.c win.h
Xclearline.o: clearline.c win.h
Xclose.o: close.c win.h
Xcloseall.o: closeall.c win.h
Xcover.o: cover.c win.h
Xcursor.o: cursor.c win.h
Xdelchars.o: delchars.c win.h
Xdelcols.o: delcols.c win.h
Xdellines.o: dellines.c win.h
Xdisp.o: disp.c win.h display.h Trm.h
Xfiledump.o: filedump.c win.h display.h Trm.h
Xfind.o: find.c win.h
Xframe.o: frame.c win.h Trm.h
Xfront.o: front.c win.h
Xgetframe.o: getframe.c Trm.h win.h
Xglobals.o: globals.c win.h
Xhide.o: hide.c win.h
Xinschars.o: inschars.c win.h
Xinscols.o: inscols.c win.h
Xinslines.o: inslines.c win.h
Xlabel.o: label.c win.h
Xlink.o: link.c win.h display.h Trm.h
Xmove.o: move.c win.h display.h Trm.h
Xoncursor.o: oncursor.c win.h
Xopen.o: open.c win.h display.h Trm.h
Xprint.o: print.c win.h
Xread.o: read.c win.h
Xretro.o: retro.c win.h
Xscroll.o: scroll.c win.h
Xsetbuf.o: setbuf.c win.h
Xsetframe.o: setframe.c Trm.h win.h
Xsetmargins.o: setmargins.c win.h
Xsize.o: size.c win.h display.h Trm.h
Xsuspend.o: suspend.c win.h
Xwcursor.o: wcursor.c win.h
X
Xinstall:
X cp winlib.a $(LIBDIR)/libwinlib.a
X cp win.h window.h $(INCLUDEDIR)
X ranlib $(LIBDIR)/libwinlib.a
X# uucp -c winlib.a cvl!~uucp/winlib.a
X# uucp -c win.h cvl!~uucp/win.h
X# uucp -c window.h cvl!~uucp/window.h
X# mail -s 'new version of winlib in ~uucp' cvl!staff README
XLook at the Makefile for installation instructions. Everything is
Xset up for a Vax running Berkeley Unix. If you're running Berkeley
XUnix, you should only need to ``make winlib.a'' followed by a ``make
Xinstall''.
X
XIf you're not on a Vax, several changes are in order. First, take
Xout the -DVAX flag in the Makefile. Second, find out whether the
Xdefinition of union chr in win.h must be changed. For a 68000,
Xthe two char elements should be reversed. Third, you'll probably
Xget a name conflict on WBclear and WBclearline, and on setmode and
Xsetmodes in TrmTERM.c. For the first, add the following line to
Xwin.h:
X
X#define WBclearline WBclrln
X
XFor the second, add the following line to the top of TrmTERM.c:
X
X#define setmodes smodes
X
XFourth, you may get an error in init.c (something like "Undefined:
X_IOLBF"). If so, change the appropriate line to remove the "_IOLBF|"
Xfrom it.
X
XFinally, you may not have ranlib. See the Makefile for an alternative.
X
XThe above changes were sufficient to make winlib run on a Sun
XMicrosystems workstation and on a Codata CTW-300. (Both are 68000
Xbased.)
X
XFor greater speed, you may want to try rewriting the CopyLine
Xroutine in assembly code. I found rewriting bcopy in assembly and
Xchanging CopyLine sufficient on the Sun:
X
X/***** CopyLine *****/
Xhidden procedure CopyLine (from, to)
Xregister struct line *from, *to;
X{
X to -> touched = 0;
X to -> length = from -> length;
X bcopy (from -> body, to -> body, sizeof (Ch) * from -> length);
X}
X
X/***** bcopy.s *****/
X .text
Xn = -12 | 4 * (number of saved regs + number of local vars)
Xsv = 0x3080 | save: a5/a4/d7
X
X .globl _bcopy
X_bcopy:
X link a6,#-n
X moveml #sv,a6@(n)
X movl a6@(16),d7 | get # bytes
X beq rtn | done if none
X movl a6@(8),a5 | get from address
X movl a6@(12),a4 | get to address
X btst #0,a6@(8) | is from address on an even word boundary?
X bne hard | no: do hard way
X btst #0,a6@(12) | is to address on an even word boundary?
X bne hard | no: do hard way
X asrl #1,d7 | yes: divide count by 2
Xwd: movw a5@+,a4@+ | move one word
X dbra d7,wd | --d7 and branch if nonzero
X
Xrtn: moveml a6@(n),#sv
X unlk a6
X rts
X
Xhard: movb a5@+,a4@+ | move one byte
X dbra d7,hard | --d7 and branch if nonzero
X bra rtn
//go.sysin dd *
made=TRUE
if [ $made = TRUE ]; then
/bin/chmod 644 README
/bin/echo -n ' '; /bin/ls -ld README
fi
/bin/echo 'Extracting WISHLIST'
sed 's/^X//' <<'//go.sysin dd *' >WISHLIST
XIf there was only a way to keep the tty driver from flushing output
Xwhen you hit DEL...
X
XHP264? terminals standout just DOESN'T WORK....
X
XThe generic terminal handler needs to be completely rewritten. It's
Xa big CPU hog, and it's just plain ineffecient. It DOES, however, WORK
X(for the most part).
X
XIt'd be nice not to have to copy lines in the two screens in display.c.
//go.sysin dd *
made=TRUE
if [ $made = TRUE ]; then
/bin/chmod 644 WISHLIST
/bin/echo -n ' '; /bin/ls -ld WISHLIST
fi
/bin/echo 'Extracting TSORT'
sed 's/^X//' <<'//go.sysin dd *' >TSORT
Xacursor.o aprint.o aread.o auxcursor.o back.o bclear.o bclearline.o
Xbcursor.o bdelchars.o bdelcols.o bdellines.o binschars.o binscols.o
Xbinslines.o box.o boxfind.o bprint.o bread.o bscroll.o btowcursor.o
Xclear.o closeall.o close.o delchars.o delcols.o dellines.o filedump.o
Xfind.o frame.o border.o front.o getframe.o hide.o inschars.o
Xinscols.o inslines.o label.o link.o move.o oncursor.o open.o read.o
Xretro.o setframe.o size.o cover.o setbuf.o setmargins.o wcursor.o
Xinit.o suspend.o wexit.o cleanup.o print.o disp.o scroll.o clearline.o
Xdisplay.o TrmAmb.o TrmBitG.o TrmTEK4025.o TrmTERM.o TrmVT100.o
Xbcopy.o globals.o
//go.sysin dd *
made=TRUE
if [ $made = TRUE ]; then
/bin/chmod 644 TSORT
/bin/echo -n ' '; /bin/ls -ld TSORT
fi
/bin/echo 'Extracting jobs.c'
sed 's/^X//' <<'//go.sysin dd *' >jobs.c
X#include
X
X/* Copyright (c) 1983 University of Maryland Computer Science Department */
X
X/*
X * Jobs library emulator using old signal mechanism
X *
X * 26 March 1983 ACT
X *
X * held_sigs == the signals held via sighold()
X * executing_sigs == the signals held because the signal handler is already
X * running
X * pending_sigs == the signals pending, for sigrelse() or whatever
X */
X
Xstatic long held_sigs, pending_sigs, executing_sigs;
Xstatic int (*sigfuncs[32])();
Xint sigcatch();
X
Xint (*sigset (signo, f))()
Xregister signo;
Xint (*f)();
X{
X int (*rv)() = sigfuncs[signo];
X
X if (f == SIG_DFL || f == SIG_IGN) { /* these are just zap-em-ins */
X sigfuncs[signo] = f;
X signal (signo, f);
X pending_sigs &= ~(1<Trm.h
X/* Copyright (c) 1983 University of Maryland Computer Science Department */
X/* terminal control module header file */
X
X/* Original code copyright (c) 1981,1980 James Gosling */
X
X/* ACT 10-Nov-1982 Modified for Window Package */
X
Xstruct TrmControl {
X int (*t_topos) (); /* move the cursor to the indicated
X (row,column); (1,1) is the upper left */
X int (*t_reset) (); /* reset terminal (screen is in unkown state,
X convert it to a known one) */
X int (*t_INSmode) (); /* set or reset character insert mode */
X int (*t_modes) (); /* (re)set highlight, blink, bold, underln */
X int (*t_inslines) (); /* insert n lines */
X int (*t_dellines) (); /* delete n lines */
X int (*t_blanks) (); /* print n blanks */
X int (*t_init) (); /* initialize terminal settings */
X int (*t_cleanup) (); /* clean up terminal settings */
X int (*t_wipeline) (); /* erase to the end of the line */
X int (*t_wipescreen) (); /* erase the entire screen */
X int (*t_delchars) (); /* delete n characters */
X int (*t_writechars) (); /* write characters; either inserting or
X overwriting according to the current
X character insert mode. */
X int (*t_window) (); /* set the screen window so that IDline
X operations only affect the first n
X lines of the screen */
X int (*t_flash) (); /* Flash the screen -- not set if this
X terminal type won't support it. */
X/* This is a hack for VT100s with cute graphics chars */
X int (*t_donerefresh) ();/* A Wrefresh() is done. Not set if not
X needed. */
X/* costs are expressed as number_affected*mf + ov
X cost to insert/delete 1 line: (number of lines left)*ILmf+ILov
X cost to insert one character: (number of chars left on line)*ICmf+ICov
X cost to delete n characters: n*DCmf+DCov */
X float t_ILmf; /* insert lines multiply factor */
X int t_ILov; /* insert lines overhead */
X float t_ICmf; /* insert character multiply factor */
X int t_ICov; /* insert character overhead */
X float t_DCmf; /* delete character multiply factor */
X int t_DCov; /* delete character overhead */
X int t_length; /* screen length */
X int t_width; /* screen width */
X int t_needspaces; /* set true iff the terminal needs to have
X real spaces in the middle of lines in
X order to have character insertion work --
X this only matters on terminals that
X distinguish between real and imaginary
X blanks. */
X char t_padc; /* Pad character (default ^@) */
X char t_frames[8]; /* Window frame chars (default +-+||+-+) */
X};
X
X#define MissingFeature 99999 /* IC and IL overheads should be set to this
X value if the corresponding feature is
X missing */
Xstruct TrmControl W_tt; /* terminal specific information for the
X current display */
X
Xint InverseVideo, /* Use inverse video if terminal supports it */
X NoOperation (); /* Global no-op function */
//go.sysin dd *
made=TRUE
if [ $made = TRUE ]; then
/bin/chmod 644 Trm.h
/bin/echo -n ' '; /bin/ls -ld Trm.h
fi
/bin/echo 'Extracting display.h'
sed 's/^X//' <<'//go.sysin dd *' >display.h
X/* Copyright (c) 1983 University of Maryland Computer Science Department */
X
X/* Ultra-hot screen management package
X * James Gosling, January 1980
X * ACT 11-Nov-1982 modified for window package
X */
X
X#include "Trm.h"
X
X#define ScreenLength (W_tt.t_length)
X#define ScreenWidth (W_tt.t_width)
X
Xint ScreenGarbaged, /* true => screen content is uncertain. */
X WDCurrentLine, /* current line for writing to the virtual
X * screen. */
X#ifdef DEBUG
X IDdebug, /* line insertion/deletion debug switch */
X RDdebug, /* line redraw debug switch */
X#endif DEBUG
X WDleft; /* number of columns left on the current
X * line of the virtual screen. */
XCh
X *WDcursor; /* pointer into a line object, indicates
X * where to put the next character */
X
X/* 'dsputc' places a character at the current position on the display,
X * the character must be a simple one, taking up EXACTLY one position on
X * the screen. ie. tabs and \n's shouldn't be passed to dsputc. */
X#define dsputc(c,m) (WDleft--,\
X WDcursor++ -> ch_all = (((m)&MODEMASK)< Mode ^= m)
X
X/* 'dspskip' skips over n characters on the display */
X#define dspskip(n) (WDleft -= (n), WDcursor += (n))
X
X/* 'setpos' positions the cursor at position (row,col) in the virtual
X * screen
Xsetpos(row,col);
X
X/* 'WDUpdateScreen' updates the physical screen, assuming that it looks
X * like the 'CurrentScreen', making it look like the 'DesiredScreen'.
X * If 'hard' is true then the difficult line I/D algorithm will be used;
X * otherwise no line I/D will be performed.
XWDUpdateScreen(hard);
X
X */
//go.sysin dd *
made=TRUE
if [ $made = TRUE ]; then
/bin/chmod 644 display.h
/bin/echo -n ' '; /bin/ls -ld display.h
fi
/bin/echo 'Extracting win.h'
sed 's/^X//' <<'//go.sysin dd *' >win.h
X/* Copyright (c) 1983 University of Maryland Computer Science Department */
X
X#define NBPB 8 /* Number of bits per byte */
X
Xunion chr {
X struct {
X char ch; /* NOTE: this is known to be low byte */
X char mode;
X } ch_two;
X short ch_all;
X};
X
X/* ch_all is set to ' ' or (' '|(WBUF<(b)?(a):(b))
X#define Min(a,b) ((a)<(b)?(a):(b))
//go.sysin dd *
made=TRUE
if [ $made = TRUE ]; then
/bin/chmod 644 win.h
/bin/echo -n ' '; /bin/ls -ld win.h
fi
/bin/echo 'Extracting window.h'
sed 's/^X//' <<'//go.sysin dd *' >window.h
X/* Copyright (c) 1983 University of Maryland Computer Science Department */
X
X#include "win.h"
X
X#define Wwrap(w,on) ((w)->w_status &= ~WWRAPOFF, \
X (w)->w_status |= (on)?0:WWRAPOFF, 0)
X#define Wnewline(w,on) ((w)->w_status &= ~WNEWLINE, \
X (w)->w_status |= (on)?WNEWLINE:0, 0)
X#define Wsetmode(w,m) ((w)->w_mode &= ~MODEMASK, \
X (w)->w_mode |= (m) & MODEMASK, 0)
X#define Wsetpopup(w,p) ((w)->w_popup = (p), 0)
X#define Wcurup(w,n) (WAcursor (w, \
X (w)->w_cursor.row+(w)->w_bstart.row-(n),\
X (w)->w_cursor.col+(w)->w_bstart.col))
X#define Wcurdown(w,n) (WAcursor (w, \
X (w)->w_cursor.row+(w)->w_bstart.row+(n),\
X (w)->w_cursor.col+(w)->w_bstart.col))
X#define Wcurleft(w,n) (WAcursor (w, \
X (w)->w_cursor.row+(w)->w_bstart.row,\
X (w)->w_cursor.col+(w)->w_bstart.col-(n)))
X#define Wcurright(w,n) (WAcursor (w, \
X (w)->w_cursor.row+(w)->w_bstart.row,\
X (w)->w_cursor.col+(w)->w_bstart.col+(n)))
X#define WWtoBcursor(w) (WAcursor (w, \
X (w)->w_textbuf->b_cursor.row, \
X (w)->w_textbuf->b_cursor.col))
X
X/* NOTE: THESE MACROS MAY BE SYSTEM DEPENDENT */
X#define WCHAROF(c) ((c)&0377)
X#define WMODEOF(c) ((c)>>NBPB)
X
X/* Function types for non-integer functions */
XWin *Wopen (), *Wlink (), *Wfind (), *Wboxfind ();
//go.sysin dd *
made=TRUE
if [ $made = TRUE ]; then
/bin/chmod 644 window.h
/bin/echo -n ' '; /bin/ls -ld window.h
fi
--
UUCP: {seismo,allegra,brl-bmd}!umcp-cs!chris
CSNet: chris@umcp-cs
ARPA: chris.umcp-cs@UDel-Relay