Subject: Terminfo/Curses Part 5 of 11 : Run this shell script with "sh" not "csh" PATH=:/bin:/usr/bin:/usr/ucb export PATH if test ! -d =src then echo 'Making directory "=src"' mkdir =src fi echo 'x - =src/MKcaptab.awk' sed 's/^X//' <<'//go.sysin dd *' >=src/MKcaptab.awk #********************************************************************* # COPYRIGHT NOTICE * #********************************************************************* # This software is copyright (C) 1982 by Pavel Curtis * # * # Permission is granted to reproduce and distribute * # this file by any means so long as no fee is charged * # above a nominal handling fee and so long as this * # notice is always included in the copies. * # * # Other rights are reserved except as explicitly granted * # by written permission of the author. * # Pavel Curtis * # Computer Science Dept. * # 405 Upson Hall * # Cornell University * # Ithaca, NY 14853 * # * # Ph- (607) 256-4934 * # * # Pavel.Cornell@Udel-Relay (ARPAnet) * # decvax!cornell!pavel (UUCPnet) * #********************************************************************/ # # $Header: RCS/MKcaptab.v Revision 2.1 82/10/25 14:45:02 pavel Exp$ # BEGIN { print "/*" print " * comp_captab.c -- The names of the capabilities in a form ready for" print " * the making of a hash table for the compiler." print " *" print " */" print "" print "" print "#include \"compiler.h\"" print "#include \"term.h\"" print "" print "" print "struct name_table_entry cap_table[] =" print "{" } $3 == "bool" { printf "\t0,%15s,\tBOOLEAN,\t%3d,\n", $2, BoolCount++ } $3 == "number" { printf "\t0,%15s,\tNUMBER,\t\t%3d,\n", $2, NumCount++ } $3 == "str" { printf "\t0,%15s,\tSTRING,\t\t%3d,\n", $2, StrCount++ } END { print "};" print "" printf "struct name_table_entry *cap_hash_table[%d];\n",\ (BoolCount + NumCount + StrCount) * 2 print "" printf "int Hashtabsize = %d;\n",\ (BoolCount + NumCount + StrCount) * 2 printf "int Captabsize = %d;\n", BoolCount + NumCount + StrCount print "" print "" printf "#if (BOOLCOUNT!=%d)||(NUMCOUNT!=%d)||(STRCOUNT!=%d)\n",\ BoolCount, NumCount, StrCount print " --> term.h and comp_captab.c disagree about the <--" print " --> numbers of booleans, numbers and/or strings <--" print "#endif" } //go.sysin dd * echo 'x - =src/MKnames.awk' sed 's/^X//' <<'//go.sysin dd *' >=src/MKnames.awk #********************************************************************* # COPYRIGHT NOTICE * #********************************************************************* # This software is copyright (C) 1982 by Pavel Curtis * # * # Permission is granted to reproduce and distribute * # this file by any means so long as no fee is charged * # above a nominal handling fee and so long as this * # notice is always included in the copies. * # * # Other rights are reserved except as explicitly granted * # by written permission of the author. * # Pavel Curtis * # Computer Science Dept. * # 405 Upson Hall * # Cornell University * # Ithaca, NY 14853 * # * # Ph- (607) 256-4934 * # * # Pavel.Cornell@Udel-Relay (ARPAnet) * # decvax!cornell!pavel (UUCPnet) * #********************************************************************/ # # $Header: RCS/MKnames.v Revision 2.1 82/10/25 14:45:06 pavel Exp$ # BEGIN { print "/*" > "boolnames" print " * dump_names.c - Arrays of capability names for use by the" > "boolnames" print " * dump program." > "boolnames" print " *" > "boolnames" print " */" > "boolnames" print "" > "boolnames" print "" > "boolnames" print "char *BoolNames[] = {" > "boolnames" print "char *NumNames[] = {" > "numnames" print "char *StrNames[] = {" > "strnames" } $3 == "bool" { printf "\t\t%s,\n", $2 > "boolnames" } $3 == "number" { printf "\t\t%s,\n", $2 > "numnames" } $3 == "str" { printf "\t\t%s,\n", $2 > "strnames" } END { print "};" > "boolnames" print "" > "boolnames" print "};" > "numnames" print "" > "numnames" print "};" > "strnames" } //go.sysin dd * echo 'x - =src/MKterm.h.awk' sed 's/^X//' <<'//go.sysin dd *' >=src/MKterm.h.awk #********************************************************************* # COPYRIGHT NOTICE * #********************************************************************* # This software is copyright (C) 1982 by Pavel Curtis * # * # Permission is granted to reproduce and distribute * # this file by any means so long as no fee is charged * # above a nominal handling fee and so long as this * # notice is always included in the copies. * # * # Other rights are reserved except as explicitly granted * # by written permission of the author. * # Pavel Curtis * # Computer Science Dept. * # 405 Upson Hall * # Cornell University * # Ithaca, NY 14853 * # * # Ph- (607) 256-4934 * # * # Pavel.Cornell@Udel-Relay (ARPAnet) * # decvax!cornell!pavel (UUCPnet) * #********************************************************************/ # # $Header: RCS/MKterm.h.v Revision 2.1 82/10/25 14:45:11 pavel Exp$ # BEGIN { print "/*" print "** term.h -- Definition of struct term" print "*/" print "" print "#ifndef SGTTY" print "# include \"curses.h\"" print "#endif" print "" print "#ifdef SINGLE" print "# define CUR _first_term." print "#else" print "# define CUR cur_term->" print "#endif" print "" print "" } $3 == "bool" { printf "#define %-30s CUR Booleans[%d]\n", $1, BoolCount++ } $3 == "number" { printf "#define %-30s CUR Numbers[%d]\n", $1, NumberCount++ } $3 == "str" { printf "#define %-30s CUR Strings[%d]\n", $1, StringCount++ } END { print "" print "" print "struct term" print "{" print " char *term_names; /* offset in str_table of terminal names */" print " char *str_table; /* pointer to string table */" print " short Filedes; /* file description being written to */" print " SGTTY Ottyb, /* original state of the terminal */" print " Nttyb; /* current state of the terminal */" print "" printf " char Booleans[%d];\n", BoolCount printf " short Numbers[%d];\n", NumberCount printf " char *Strings[%d];\n", StringCount print "};" print "" print "struct term _first_term;" print "struct term *cur_term;" print "" printf "#define BOOLCOUNT %d\n", BoolCount printf "#define NUMCOUNT %d\n", NumberCount printf "#define STRCOUNT %d\n", StringCount } //go.sysin dd * echo 'x - =src/Makefile' sed 's/^X//' <<'//go.sysin dd *' >=src/Makefile #********************************************************************* # COPYRIGHT NOTICE * #********************************************************************* # This software is copyright (C) 1982 by Pavel Curtis * # * # Permission is granted to reproduce and distribute * # this file by any means so long as no fee is charged * # above a nominal handling fee and so long as this * # notice is always included in the copies. * # * # Other rights are reserved except as explicitly granted * # by written permission of the author. * # Pavel Curtis * # Computer Science Dept. * # 405 Upson Hall * # Cornell University * # Ithaca, NY 14853 * # * # Ph- (607) 256-4934 * # * # Pavel.Cornell@Udel-Relay (ARPAnet) * # decvax!cornell!pavel (UUCPnet) * #********************************************************************/ # RCSid: $Header: RCS/Makefile.v Revision 2.2 82/10/25 15:28:23 pavel Exp$ SRCDIR= /etc/term CFLAGS= -O -DSRCDIR='"$(SRCDIR)"' DFLAGS= -g -DTRACE -DSRCDIR='"$(SRCDIR)"' SRCS= comp_main.c comp_hash.c comp_captab.c comp_scan.c comp_error.c \ comp_parse.c read_entry.c \ dump.c dump_names.c \ lib_setup.c lib_fixterm.c lib_tparm.c lib_tputs.c \ lib_unctrl.c lib_raw.c lib_vidattr.c lib_trace.c lib_data.c \ lib_beep.c lib_doupdate.c lib_refresh.c lib_initscr.c lib_newwin.c \ lib_addch.c lib_addstr.c lib_scroll.c lib_clreol.c lib_touchwin.c \ lib_mvcur.c lib_delwin.c lib_endwin.c lib_clrbot.c lib_move.c \ lib_printw.c lib_scanw.c lib_erase.c lib_getch.c lib_options.c \ lib_box.c lib_clear.c lib_delch.c lib_deleteln.c lib_insch.c \ lib_insertln.c lib_getstr.c lib_mvwin.c lib_longname.c lib_tstp.c \ lib_newterm.c lib_set_term.c lib_overlay.c lib_scrreg.c # # Normal, optimised object files # LIBOBJS= lib_setup.o lib_fixterm.o lib_tparm.o read_entry.o lib_tputs.o \ lib_unctrl.o lib_raw.o lib_vidattr.o lib_trace.o lib_data.o lib_beep.o \ lib_doupdate.o lib_refresh.o lib_initscr.o lib_newwin.o lib_addch.o \ lib_addstr.o lib_scroll.o lib_clreol.o lib_touchwin.o lib_mvcur.o \ lib_delwin.o lib_endwin.o lib_clrbot.o lib_move.o lib_printw.o \ lib_scanw.o lib_erase.o lib_getch.o lib_options.o \ lib_box.o lib_clear.o lib_delch.o lib_deleteln.o lib_insch.o \ lib_insertln.o lib_getstr.o lib_mvwin.o lib_longname.o lib_tstp.o \ lib_newterm.o lib_set_term.o lib_overlay.o lib_scrreg.o # # Debugging (tracing) object files # DLIBOBJS= lib_setup.d lib_fixterm.d lib_tparm.d read_entry.d lib_tputs.d \ lib_unctrl.d lib_raw.d lib_vidattr.d lib_trace.d lib_data.d lib_beep.d \ lib_doupdate.d lib_refresh.d lib_initscr.d lib_newwin.d lib_addch.d \ lib_addstr.d lib_scroll.d lib_clreol.d lib_touchwin.d lib_mvcur.d \ lib_delwin.d lib_endwin.d lib_clrbot.d lib_move.d lib_printw.d \ lib_scanw.d lib_erase.d lib_getch.d lib_options.d \ lib_box.d lib_clear.d lib_delch.d lib_deleteln.d lib_insch.d \ lib_insertln.d lib_getstr.d lib_mvwin.d lib_longname.d lib_tstp.d \ lib_newterm.d lib_set_term.d lib_overlay.d lib_scrreg.d # # Profiled Optimised object files # PLIBOBJS= lib_setup.p lib_fixterm.p lib_tparm.p read_entry.p lib_tputs.p \ lib_unctrl.p lib_raw.p lib_vidattr.p lib_trace.p lib_data.p lib_beep.p \ lib_doupdate.p lib_refresh.p lib_initscr.p lib_newwin.p lib_addch.p \ lib_addstr.p lib_scroll.p lib_clreol.p lib_touchwin.p lib_mvcur.p \ lib_delwin.p lib_endwin.p lib_clrbot.p lib_move.p lib_printw.p \ lib_scanw.p lib_erase.p lib_getch.p lib_options.p \ lib_box.p lib_clear.p lib_delch.p lib_deleteln.p lib_insch.p \ lib_insertln.p lib_getstr.p lib_mvwin.p lib_longname.p lib_tstp.p \ lib_newterm.p lib_set_term.p lib_overlay.p lib_scrreg.p COMPOBJS= comp_main.o comp_hash.o comp_captab.o comp_scan.o comp_error.o \ comp_parse.o read_entry.o X.SUFFIXES: .d .p X.c.d: -mv $*.o $*.O cc -c $(DFLAGS) $*.c mv $*.o $*.d -mv $*.O $*.o X.c.p: -mv $*.o $*.O cc -pg -c $(CFLAGS) $*.c mv $*.o $*.p -mv $*.O $*.o all: compile dump lib dlib install: all sed -e 's/clude *"curses.h" *$$/clude /' term.h > /usr/include/term.h sed -e 's/^#include *"terminfo.h" *$$/#include /' curses.h > /usr/include/ncurses.h cp terminfo.h /usr/include/terminfo.h cp unctrl.h /usr/include/unctrl.h cp compile $(SRCDIR)/compile cp dump $(SRCDIR)/dump cp libcurses.a /usr/lib/libncurses.a cp libdcurses.a /usr/lib/libdcurses.a ranlib /usr/lib/libncurses.a ranlib /usr/lib/libdcurses.a lib: libcurses.a libcurses.a: ${LIBOBJS} ar rv libcurses.a ${LIBOBJS} ranlib libcurses.a dlib: libdcurses.a libdcurses.a: ${DLIBOBJS} ar rv libdcurses.a ${DLIBOBJS} ranlib libdcurses.a plib: libpcurses.a libpcurses.a: ${PLIBOBJS} ar rv libpcurses.a ${PLIBOBJS} ranlib libpcurses.a compile: ${COMPOBJS} cc -o compile ${COMPOBJS} dump: dump.o dump_names.o read_entry.o cc -o dump dump.o dump_names.o read_entry.o lint: ${SRCS} lint ${DFLAGS} ${SRCS} > lint.out term.h: Caps MKterm.h.awk awk -f MKterm.h.awk Caps > term.h comp_captab.c: Caps MKcaptab.awk awk -f MKcaptab.awk Caps > comp_captab.c dump.o: dump.c term.h compiler.h dump_names.c: Caps MKnames.awk awk -f MKnames.awk Caps cat boolnames numnames strnames > dump_names.c -rm -f boolnames numnames strnames clean: -rm -f *.[od] term.h comp_captab.c tags dump_names.c tags: *.c *.h ctags *.c *.h depend: ${SRCS} grep "^#include" ${SRCS} \ | sed 's/\([^:]*\).c:[^"]*"\([^"]*\)".*/\1.o: \2/' \ | sed '/#include/d' > makedep echo '/^# DO NOT DELETE THIS LINE/+2,$$d' > eddep echo '$$r makedep' >> eddep echo '/^# DO NOT DELETE THIS LINE/+2,$$s/\.o/.d/' >> eddep echo '$$r makedep' >> eddep echo 'w' >> eddep cp Makefile Makefile.bak ex - Makefile < eddep rm makedep eddep echo >> Makefile echo "# DEPENDENCIES MUST END AT END OF FILE" >> Makefile echo "# IF YOU PUT STUFF HERE, IT WILL GO AWAY" >> Makefile echo "# See make depend, above" >> Makefile # DO NOT DELETE THIS LINE - make depend needs it comp_main.d: compiler.h comp_hash.d: compiler.h comp_hash.d: term.h comp_captab.d: compiler.h comp_captab.d: term.h comp_scan.d: compiler.h comp_error.d: compiler.h comp_parse.d: compiler.h comp_parse.d: term.h comp_parse.d: object.h read_entry.d: term.h read_entry.d: object.h dump.d: compiler.h dump.d: term.h lib_setup.d: curses.h lib_setup.d: curses.priv.h lib_setup.d: term.h lib_fixterm.d: curses.h lib_fixterm.d: curses.priv.h lib_fixterm.d: term.h lib_tparm.d: curses.h lib_tparm.d: curses.priv.h lib_tparm.d: term.h lib_tputs.d: curses.h lib_tputs.d: curses.priv.h lib_tputs.d: term.h lib_raw.d: curses.h lib_raw.d: curses.priv.h lib_raw.d: term.h lib_vidattr.d: curses.h lib_vidattr.d: curses.priv.h lib_vidattr.d: term.h lib_trace.d: term.h lib_trace.d: curses.h lib_trace.d: curses.priv.h lib_data.d: curses.priv.h lib_data.d: curses.h lib_data.d: term.h lib_beep.d: curses.h lib_beep.d: curses.priv.h lib_beep.d: term.h lib_doupdate.d: curses.h lib_doupdate.d: curses.priv.h lib_doupdate.d: term.h lib_refresh.d: curses.h lib_refresh.d: curses.priv.h lib_initscr.d: curses.h lib_initscr.d: curses.priv.h lib_newwin.d: term.h lib_newwin.d: curses.h lib_newwin.d: curses.priv.h lib_addch.d: curses.h lib_addch.d: curses.priv.h lib_addch.d: unctrl.h lib_addstr.d: curses.h lib_addstr.d: curses.priv.h lib_scroll.d: curses.h lib_scroll.d: curses.priv.h lib_clreol.d: curses.h lib_clreol.d: curses.priv.h lib_touchwin.d: curses.h lib_touchwin.d: curses.priv.h lib_mvcur.d: term.h lib_mvcur.d: curses.h lib_mvcur.d: curses.priv.h lib_delwin.d: curses.h lib_delwin.d: curses.priv.h lib_endwin.d: term.h lib_endwin.d: curses.h lib_endwin.d: curses.priv.h lib_clrbot.d: curses.h lib_clrbot.d: curses.priv.h lib_move.d: curses.h lib_move.d: curses.priv.h lib_printw.d: curses.h lib_printw.d: curses.priv.h lib_scanw.d: curses.h lib_scanw.d: curses.priv.h lib_erase.d: curses.h lib_erase.d: curses.priv.h lib_getch.d: curses.h lib_getch.d: curses.priv.h lib_options.d: term.h lib_options.d: curses.h lib_options.d: curses.priv.h lib_box.d: curses.h lib_box.d: curses.priv.h lib_clear.d: curses.h lib_clear.d: curses.priv.h lib_delch.d: curses.h lib_delch.d: curses.priv.h lib_delch.d: term.h lib_deleteln.d: curses.h lib_deleteln.d: curses.priv.h lib_insch.d: curses.h lib_insch.d: curses.priv.h lib_insertln.d: curses.h lib_insertln.d: curses.priv.h lib_getstr.d: curses.h lib_getstr.d: curses.priv.h lib_getstr.d: unctrl.h lib_mvwin.d: curses.h lib_mvwin.d: curses.priv.h lib_longname.d: curses.h lib_longname.d: curses.priv.h lib_tstp.d: term.h lib_tstp.d: curses.h lib_tstp.d: curses.priv.h lib_newterm.d: curses.h lib_newterm.d: term.h lib_newterm.d: curses.priv.h lib_set_term.d: curses.h lib_set_term.d: curses.priv.h lib_set_term.d: term.h lib_overlay.d: curses.h lib_overlay.d: curses.priv.h lib_scrreg.d: curses.h lib_scrreg.d: curses.priv.h comp_main.o: compiler.h comp_hash.o: compiler.h comp_hash.o: term.h comp_captab.o: compiler.h comp_captab.o: term.h comp_scan.o: compiler.h comp_error.o: compiler.h comp_parse.o: compiler.h comp_parse.o: term.h comp_parse.o: object.h read_entry.o: term.h read_entry.o: object.h dump.o: compiler.h dump.o: term.h lib_setup.o: curses.h lib_setup.o: curses.priv.h lib_setup.o: term.h lib_fixterm.o: curses.h lib_fixterm.o: curses.priv.h lib_fixterm.o: term.h lib_tparm.o: curses.h lib_tparm.o: curses.priv.h lib_tparm.o: term.h lib_tputs.o: curses.h lib_tputs.o: curses.priv.h lib_tputs.o: term.h lib_raw.o: curses.h lib_raw.o: curses.priv.h lib_raw.o: term.h lib_vidattr.o: curses.h lib_vidattr.o: curses.priv.h lib_vidattr.o: term.h lib_trace.o: term.h lib_trace.o: curses.h lib_trace.o: curses.priv.h lib_data.o: curses.priv.h lib_data.o: curses.h lib_data.o: term.h lib_beep.o: curses.h lib_beep.o: curses.priv.h lib_beep.o: term.h lib_doupdate.o: curses.h lib_doupdate.o: curses.priv.h lib_doupdate.o: term.h lib_refresh.o: curses.h lib_refresh.o: curses.priv.h lib_initscr.o: curses.h lib_initscr.o: curses.priv.h lib_newwin.o: term.h lib_newwin.o: curses.h lib_newwin.o: curses.priv.h lib_addch.o: curses.h lib_addch.o: curses.priv.h lib_addch.o: unctrl.h lib_addstr.o: curses.h lib_addstr.o: curses.priv.h lib_scroll.o: curses.h lib_scroll.o: curses.priv.h lib_clreol.o: curses.h lib_clreol.o: curses.priv.h lib_touchwin.o: curses.h lib_touchwin.o: curses.priv.h lib_mvcur.o: term.h lib_mvcur.o: curses.h lib_mvcur.o: curses.priv.h lib_delwin.o: curses.h lib_delwin.o: curses.priv.h lib_endwin.o: term.h lib_endwin.o: curses.h lib_endwin.o: curses.priv.h lib_clrbot.o: curses.h lib_clrbot.o: curses.priv.h lib_move.o: curses.h lib_move.o: curses.priv.h lib_printw.o: curses.h lib_printw.o: curses.priv.h lib_scanw.o: curses.h lib_scanw.o: curses.priv.h lib_erase.o: curses.h lib_erase.o: curses.priv.h lib_getch.o: curses.h lib_getch.o: curses.priv.h lib_options.o: term.h lib_options.o: curses.h lib_options.o: curses.priv.h lib_box.o: curses.h lib_box.o: curses.priv.h lib_clear.o: curses.h lib_clear.o: curses.priv.h lib_delch.o: curses.h lib_delch.o: curses.priv.h lib_delch.o: term.h lib_deleteln.o: curses.h lib_deleteln.o: curses.priv.h lib_insch.o: curses.h lib_insch.o: curses.priv.h lib_insertln.o: curses.h lib_insertln.o: curses.priv.h lib_getstr.o: curses.h lib_getstr.o: curses.priv.h lib_getstr.o: unctrl.h lib_mvwin.o: curses.h lib_mvwin.o: curses.priv.h lib_longname.o: curses.h lib_longname.o: curses.priv.h lib_tstp.o: term.h lib_tstp.o: curses.h lib_tstp.o: curses.priv.h lib_newterm.o: curses.h lib_newterm.o: term.h lib_newterm.o: curses.priv.h lib_set_term.o: curses.h lib_set_term.o: curses.priv.h lib_set_term.o: term.h lib_overlay.o: curses.h lib_overlay.o: curses.priv.h lib_scrreg.o: curses.h lib_scrreg.o: curses.priv.h # DEPENDENCIES MUST END AT END OF FILE # IF YOU PUT STUFF HERE, IT WILL GO AWAY # See make depend, above //go.sysin dd * echo 'x - =src/curses.h' sed 's/^X//' <<'//go.sysin dd *' >=src/curses.h X/********************************************************************* * COPYRIGHT NOTICE * ********************************************************************** * This software is copyright (C) 1982 by Pavel Curtis * * * * Permission is granted to reproduce and distribute * * this file by any means so long as no fee is charged * * above a nominal handling fee and so long as this * * notice is always included in the copies. * * * * Other rights are reserved except as explicitly granted * * by written permission of the author. * * Pavel Curtis * * Computer Science Dept. * * 405 Upson Hall * * Cornell University * * Ithaca, NY 14853 * * * * Ph- (607) 256-4934 * * * * Pavel.Cornell@Udel-Relay (ARPAnet) * * decvax!cornell!pavel (UUCPnet) * *********************************************************************/ X/* * curses.h - Main header file for the curses package * * $Header: RCS/curses.v Revision 2.1 82/10/25 14:46:08 pavel Exp$ * * $Log: RCS/curses.v $ Revision 2.1 82/10/25 14:46:08 pavel Added Copyright Notice Revision 2.0 82/10/24 15:17:22 pavel Beta-one Test Release Revision 1.4 82/08/23 22:30:13 pavel The REAL Alpha-one Release Version Revision 1.3 82/08/20 16:52:46 pavel XFixed bug Revision 1.2 82/08/19 19:10:13 pavel Alpha Test Release One Revision 1.1 82/08/12 18:38:57 pavel Initial revision * */ #ifndef WINDOW #include "terminfo.h" #define bool char #ifndef MINICURSES typedef unsigned short chtype; #else typedef unsigned char chtype; #endif MINICURSES #ifndef TRUE # define TRUE (1) # define FALSE (0) #endif #define ERR (0) #define OK (1) #define _SUBWIN 01 #define _ENDLINE 02 #define _FULLWIN 04 #define _SCROLLWIN 010 #define _NOCHANGE -1 struct _win_st { short _cury, _curx; short _maxy, _maxx; short _begy, _begx; short _flags; chtype _attrs; bool _clear; bool _leave; bool _scroll; bool _idlok; bool _use_keypad; /* 0=no, 1=yes, 2=yes/timeout */ bool _use_meta; /* T=use the meta key */ bool _nodelay; /* T=don't wait for tty input */ chtype **_line; short *_firstchar; /* First changed character in the line */ short *_lastchar; /* Last changed character in the line */ short *_numchngd; /* Number of changes made in the line */ short _regtop; /* Top and bottom of scrolling region */ short _regbottom; }; #define WINDOW struct _win_st WINDOW *stdscr, *curscr; int LINES, COLS; WINDOW *initscr(), *newwin(), *subwin(); char *longname(); struct screen *newterm(), *set_term(); X/* * psuedo functions */ #define getyx(win,y,x) (y = (win)->_cury, x = (win)->_curx) #define inch() winch(stdscr) #define standout() wstandout(stdscr) #define standend() wstandend(stdscr) #define attron(at) wattron(stdscr,at) #define attroff(at) wattroff(stdscr,at) #define attrset(at) wattrset(stdscr,at) #define winch(win) ((win)->_line[(win)->_cury][(win)->_curx]) #define wstandout(win) (wattrset(win,A_STANDOUT)) #define wstandend(win) (wattrset(win,A_NORMAL)) #define wattron(win,at) ((win)->_attrs |= (at)) #define wattroff(win,at) ((win)->_attrs &= ~(at)) #define wattrset(win,at) ((win)->_attrs = (at)) #ifndef MINICURSES /* * psuedo functions for standard screen */ # define addch(ch) waddch(stdscr, ch) # define getch() wgetch(stdscr) # define addstr(str) waddstr(stdscr, str) # define getstr(str) wgetstr(stdscr, str) # define move(y, x) wmove(stdscr, y, x) # define clear() wclear(stdscr) # define erase() werase(stdscr) # define clrtobot() wclrtobot(stdscr) # define clrtoeol() wclrtoeol(stdscr) # define insertln() winsertln(stdscr) # define deleteln() wdeleteln(stdscr) # define refresh() wrefresh(stdscr) # define insch(c) winsch(stdscr,c) # define delch() wdelch(stdscr) # define setscrreg(t,b) wsetscrreg(stdscr,t,b) /* * mv functions */ # define mvwaddch(win,y,x,ch) (wmove(win,y,x) == ERR ? ERR : waddch(win,ch)) # define mvwgetch(win,y,x) (wmove(win,y,x) == ERR ? ERR : wgetch(win)) # define mvwaddstr(win,y,x,str) (wmove(win,y,x) == ERR ? ERR \ : waddstr(win,str)) # define mvwgetstr(win,y,x) (wmove(win,y,x) == ERR ? ERR : wgetstr(win)) # define mvwinch(win,y,x) (wmove(win,y,x) == ERR ? ERR : winch(win)) # define mvwdelch(win,y,x) (wmove(win,y,x) == ERR ? ERR : wdelch(win)) # define mvwinsch(win,y,x,c) (wmove(win,y,x) == ERR ? ERR : winsch(win,c)) # define mvaddch(y,x,ch) mvwaddch(stdscr,y,x,ch) # define mvgetch(y,x) mvwgetch(stdscr,y,x) # define mvaddstr(y,x,str) mvwaddstr(stdscr,y,x,str) # define mvgetstr(y,x) mvwgetstr(stdscr,y,x) # define mvinch(y,x) mvwinch(stdscr,y,x) # define mvdelch(y,x) mvwdelch(stdscr,y,x) # define mvinsch(y,x,c) mvwinsch(stdscr,y,x,c) #else MINICURSES # define addch m_addch # define addstr m_addstr # define erase m_erase # define clear m_clear # define refresh m_refresh # define initscr m_initscr # define newterm m_newterm # define mvaddch(y,x,ch) (move(y,x) == ERR ? ERR : addch(ch)) # define mvaddstr(y,x,str) (move(y,x) == ERR ? ERR : addstr(str)) X/* * These functions don't exist in minicurses, so we define them * to nonexistent functions to help the user catch the error. */ # define box no_box # define clrtobot no_clrtobot # define clrtoeol no_clrtoeol # define delch no_delch # define deleteln no_deleteln # define delwin no_delwin # define getch no_getch # define getstr no_getstr # define insch no_insch # define insertln no_insertln # define longname no_longname # define mvprintw no_mvprintw # define mvscanw no_mvscanw # define mvwin no_mvwin # define mvwprintw no_mvwprintw # define mvwscanw no_mvwscanw # define newwin no_newwin # define overlay no_overlay # define overwrite no_overwrite # define printw no_printw # define putp no_putp # define scanw no_scanw # define scroll no_scroll # define setscrreg no_setscrreg # define subwin no_subwin # define touchwin no_touchwin # define tstp no_tstp # define vidattr no_vidattr # define waddch no_waddch # define waddstr no_waddstr # define wclear no_wclear # define wclrtobot no_wclrtobot # define wclrtoeol no_wclrtoeol # define wdelch no_wdelch # define wdeleteln no_wdeleteln # define werase no_werase # define wgetch no_wgetch # define wgetstr no_wgetstr # define winsch no_winsch # define winsertln no_winsertln # define wmove no_wmove # define wprintw no_wprintw # define wrefresh no_wrefresh # define wscanw no_wscanw # define wsetscrreg no_wsetscrreg X/* mv functions that aren't valid */ # define mvdelch no_mvwdelch # define mvgetch no_mvwgetch # define mvgetstr no_mvwgetstr # define mvinch no_mvwinch # define mvinsch no_mvwinsch # define mvwaddch no_mvwaddch # define mvwaddstr no_mvaddstr # define mvwdelch no_mvwdelch # define mvwgetch no_mvwgetch # define mvwgetstr no_mvwgetstr # define mvwinch no_mvwinch # define mvwinsch no_mvwinsch #endif MINICURSES #ifndef MINICURSES X/* Funny "characters" enabled for various special function keys for input */ #define KEY_BREAK 0401 /* break key (unreliable) */ #define KEY_DOWN 0402 /* The four arrow keys ... */ #define KEY_UP 0403 #define KEY_LEFT 0404 #define KEY_RIGHT 0405 /* ... */ #define KEY_HOME 0406 /* Home key (upward+left arrow) */ #define KEY_BACKSPACE 0407 /* backspace (unreliable) */ #define KEY_F0 0410 /* Function keys. Space for 64 */ #define KEY_F(n) (KEY_F0+(n)) /* keys is reserved. */ #define KEY_DL 0510 /* Delete line */ #define KEY_IL 0511 /* Insert line */ #define KEY_DC 0512 /* Delete character */ #define KEY_IC 0513 /* Insert char or enter insert mode */ #define KEY_EIC 0514 /* Exit insert char mode */ #define KEY_CLEAR 0515 /* Clear screen */ #define KEY_EOS 0516 /* Clear to end of screen */ #define KEY_EOL 0517 /* Clear to end of line */ #define KEY_SF 0520 /* Scroll 1 line forward */ #define KEY_SR 0521 /* Scroll 1 line backwards (reverse) */ #define KEY_NPAGE 0522 /* Next page */ #define KEY_PPAGE 0523 /* Previous page */ #define KEY_STAB 0524 /* Set tab */ #define KEY_CTAB 0525 /* Clear tab */ #define KEY_CATAB 0526 /* Clear all tabs */ #define KEY_ENTER 0527 /* Enter or send (unreliable) */ #define KEY_SRESET 0530 /* soft (partial) reset (unreliable) */ #define KEY_RESET 0531 /* reset or hard reset (unreliable) */ #define KEY_PRINT 0532 /* print or copy */ #define KEY_LL 0533 /* home down or bottom (lower left) */ #endif MINICURSES #endif WINDOW //go.sysin dd * echo 'x - =src/curses.priv.h' sed 's/^X//' <<'//go.sysin dd *' >=src/curses.priv.h X/********************************************************************* * COPYRIGHT NOTICE * ********************************************************************** * This software is copyright (C) 1982 by Pavel Curtis * * * * Permission is granted to reproduce and distribute * * this file by any means so long as no fee is charged * * above a nominal handling fee and so long as this * * notice is always included in the copies. * * * * Other rights are reserved except as explicitly granted * * by written permission of the author. * * Pavel Curtis * * Computer Science Dept. * * 405 Upson Hall * * Cornell University * * Ithaca, NY 14853 * * * * Ph- (607) 256-4934 * * * * Pavel.Cornell@Udel-Relay (ARPAnet) * * decvax!cornell!pavel (UUCPnet) * *********************************************************************/ X/* * curses.priv.h * * Header file for curses library objects which are private to * the library. * * $Log: RCS/curses.priv.v $ Revision 2.1 82/10/25 14:46:17 pavel Added Copyright Notice Revision 2.0 82/10/25 13:50:25 pavel Beta-one Test Release * */ #include #include "curses.h" #define min(a,b) ((a) > (b) ? (b) : (a)) #define max(a,b) ((a) < (b) ? (b) : (a)) #define CHANGED -1 WINDOW *newscr; extern int _tracing; struct try { struct try *child; /* ptr to child. NULL if none */ struct try *sibling; /* ptr to sibling. NULL if none */ char ch; /* character at this node */ short value; /* code of string so far. NULL if none */ }; struct screen { FILE *_ifp; /* input file ptr for this terminal */ FILE *_ofp; /* output file ptr for this terminal */ struct term *_term; /* used by terminfo stuff */ WINDOW *_curscr; /* windows specific to a given terminal */ WINDOW *_newscr; struct try *_keytry; /* "Try" for use with keypad mode */ char _backbuf[10]; /* Buffer for pushed back characters */ int _backcnt; /* How many characters in _backbuf? */ int _cursrow; /* Row and column of physical cursor */ int _curscol; bool _nl; /* True if terminal has CRMOD bit on */ bool _raw; /* True if in raw mode */ bool _cbreak; /* True if in cbreak mode */ bool _echo; /* True if echo on */ bool _nlmapping; /* True if terminal is really doing */ /* NL mapping (fn of raw and nl) */ int _costs[9]; /* costs of cursor movements for mvcur */ int _costinit; /* set if _costs[] is initialized */ }; struct screen *SP; #define MAXCOLUMNS 135 #define MAXLINES 66 #define UNINITIALISED ((struct try * ) -1) //go.sysin dd * echo 'x - =src/object.h' sed 's/^X//' <<'//go.sysin dd *' >=src/object.h X/********************************************************************* * COPYRIGHT NOTICE * ********************************************************************** * This software is copyright (C) 1982 by Pavel Curtis * * * * Permission is granted to reproduce and distribute * * this file by any means so long as no fee is charged * * above a nominal handling fee and so long as this * * notice is always included in the copies. * * * * Other rights are reserved except as explicitly granted * * by written permission of the author. * * Pavel Curtis * * Computer Science Dept. * * 405 Upson Hall * * Cornell University * * Ithaca, NY 14853 * * * * Ph- (607) 256-4934 * * * * Pavel.Cornell@Udel-Relay (ARPAnet) * * decvax!cornell!pavel (UUCPnet) * *********************************************************************/ X/* ** $Header: RCS/object.v Revision 2.1 82/10/25 14:49:50 pavel Exp$ ** ** object.h - Format of compiled terminfo files ** ** Header (12 bytes), containing information given below ** Names Section, containing the names of the terminal ** Boolean Section, containing the values of all of the ** boolean capabilities ** A null byte may be inserted here to make ** sure that the Number Section begins on an ** even word boundary. ** Number Section, containing the values of all of the numeric ** capabilities, each as a short integer ** String Section, containing short integer offsets into the ** String Table, one per string capability ** String Table, containing the actual characters of the string ** capabilities. ** ** NOTE that all short integers in the file are stored using VAX/PDP-style ** byte-swapping, i.e., least-significant byte first. The code in ** read_entry() automatically fixes this up on machines which don't use ** this system (I hope). ** ** $Log: RCS/object.v $ Revision 2.1 82/10/25 14:49:50 pavel Added Copyright Notice Revision 2.0 82/10/24 15:18:19 pavel Beta-one Test Release Revision 1.3 82/08/23 22:31:12 pavel The REAL Alpha-one Release Version Revision 1.2 82/08/19 19:10:18 pavel Alpha Test Release One Revision 1.1 82/08/12 18:48:55 pavel Initial revision ** */ #define MAGIC 0432 struct header { short magic; /* Magic Number (0432) */ short name_size; /* Size of names section */ short bool_count; /* Number of booleans */ short num_count; /* Number of numbers */ short str_count; /* Number of strings */ short str_size; /* Size of string table */ }; //go.sysin dd * echo 'x - =src/term.h' sed 's/^X//' <<'//go.sysin dd *' >=src/term.h X/* ** term.h -- Definition of struct term */ #ifndef SGTTY # include "curses.h" #endif #ifdef SINGLE # define CUR _first_term. #else # define CUR cur_term-> #endif #define auto_left_margin CUR Booleans[0] #define auto_right_margin CUR Booleans[1] #define beehive_glitch CUR Booleans[2] #define ceol_standout_glitch CUR Booleans[3] #define eat_newline_glitch CUR Booleans[4] #define erase_overstrike CUR Booleans[5] #define generic_type CUR Booleans[6] #define hard_copy CUR Booleans[7] #define has_meta_key CUR Booleans[8] #define has_status_line CUR Booleans[9] #define insert_null_glitch CUR Booleans[10] #define memory_above CUR Booleans[11] #define memory_below CUR Booleans[12] #define move_insert_mode CUR Booleans[13] #define move_standout_mode CUR Booleans[14] #define over_strike CUR Booleans[15] #define status_line_esc_ok CUR Booleans[16] #define teleray_glitch CUR Booleans[17] #define tilde_glitch CUR Booleans[18] #define transparent_underline CUR Booleans[19] #define xon_xoff CUR Booleans[20] #define columns CUR Numbers[0] #define init_tabs CUR Numbers[1] #define lines CUR Numbers[2] #define lines_of_memory CUR Numbers[3] #define magic_cookie_glitch CUR Numbers[4] #define padding_baud_rate CUR Numbers[5] #define virtual_terminal CUR Numbers[6] #define width_status_line CUR Numbers[7] #define num_labels CUR Numbers[8] #define label_height CUR Numbers[9] #define label_width CUR Numbers[10] #define back_tab CUR Strings[0] #define bell CUR Strings[1] #define carriage_return CUR Strings[2] #define change_scroll_region CUR Strings[3] #define clear_all_tabs CUR Strings[4] #define clear_screen CUR Strings[5] #define clr_eol CUR Strings[6] #define clr_eos CUR Strings[7] #define column_address CUR Strings[8] #define command_character CUR Strings[9] #define cursor_address CUR Strings[10] #define cursor_down CUR Strings[11] #define cursor_home CUR Strings[12] #define cursor_invisible CUR Strings[13] #define cursor_left CUR Strings[14] #define cursor_mem_address CUR Strings[15] #define cursor_normal CUR Strings[16] #define cursor_right CUR Strings[17] #define cursor_to_ll CUR Strings[18] #define cursor_up CUR Strings[19] #define cursor_visible CUR Strings[20] #define delete_character CUR Strings[21] #define delete_line CUR Strings[22] #define dis_status_line CUR Strings[23] #define down_half_line CUR Strings[24] #define enter_alt_charset_mode CUR Strings[25] #define enter_blink_mode CUR Strings[26] #define enter_bold_mode CUR Strings[27] #define enter_ca_mode CUR Strings[28] #define enter_delete_mode CUR Strings[29] #define enter_dim_mode CUR Strings[30] #define enter_insert_mode CUR Strings[31] #define enter_secure_mode CUR Strings[32] #define enter_protected_mode CUR Strings[33] #define enter_reverse_mode CUR Strings[34] #define enter_standout_mode CUR Strings[35] #define enter_underline_mode CUR Strings[36] #define erase_chars CUR Strings[37] #define exit_alt_charset_mode CUR Strings[38] #define exit_attribute_mode CUR Strings[39] #define exit_ca_mode CUR Strings[40] #define exit_delete_mode CUR Strings[41] #define exit_insert_mode CUR Strings[42] #define exit_standout_mode CUR Strings[43] #define exit_underline_mode CUR Strings[44] #define flash_screen CUR Strings[45] #define form_feed CUR Strings[46] #define from_status_line CUR Strings[47] #define init_1string CUR Strings[48] #define init_2string CUR Strings[49] #define init_3string CUR Strings[50] #define init_file CUR Strings[51] #define insert_character CUR Strings[52] #define insert_line CUR Strings[53] #define insert_padding CUR Strings[54] #define key_backspace CUR Strings[55] #define key_catab CUR Strings[56] #define key_clear CUR Strings[57] #define key_ctab CUR Strings[58] #define key_dc CUR Strings[59] #define key_dl CUR Strings[60] #define key_down CUR Strings[61] #define key_eic CUR Strings[62] #define key_eol CUR Strings[63] #define key_eos CUR Strings[64] #define key_f0 CUR Strings[65] #define key_f1 CUR Strings[66] #define key_f10 CUR Strings[67] #define key_f2 CUR Strings[68] #define key_f3 CUR Strings[69] #define key_f4 CUR Strings[70] #define key_f5 CUR Strings[71] #define key_f6 CUR Strings[72] #define key_f7 CUR Strings[73] #define key_f8 CUR Strings[74] #define key_f9 CUR Strings[75] #define key_home CUR Strings[76] #define key_ic CUR Strings[77] #define key_il CUR Strings[78] #define key_left CUR Strings[79] #define key_ll CUR Strings[80] #define key_npage CUR Strings[81] #define key_ppage CUR Strings[82] #define key_right CUR Strings[83] #define key_sf CUR Strings[84] #define key_sr CUR Strings[85] #define key_stab CUR Strings[86] #define key_up CUR Strings[87] #define keypad_local CUR Strings[88] #define keypad_xmit CUR Strings[89] #define lab_f0 CUR Strings[90] #define lab_f1 CUR Strings[91] #define lab_f10 CUR Strings[92] #define lab_f2 CUR Strings[93] #define lab_f3 CUR Strings[94] #define lab_f4 CUR Strings[95] #define lab_f5 CUR Strings[96] #define lab_f6 CUR Strings[97] #define lab_f7 CUR Strings[98] #define lab_f8 CUR Strings[99] #define lab_f9 CUR Strings[100] #define meta_off CUR Strings[101] #define meta_on CUR Strings[102] #define newline CUR Strings[103] #define pad_char CUR Strings[104] #define parm_dch CUR Strings[105] #define parm_delete_line CUR Strings[106] #define parm_down_cursor CUR Strings[107] #define parm_ich CUR Strings[108] #define parm_index CUR Strings[109] #define parm_insert_line CUR Strings[110] #define parm_left_cursor CUR Strings[111] #define parm_right_cursor CUR Strings[112] #define parm_rindex CUR Strings[113] #define parm_up_cursor CUR Strings[114] #define pkey_key CUR Strings[115] #define pkey_local CUR Strings[116] #define pkey_xmit CUR Strings[117] #define print_screen CUR Strings[118] #define prtr_off CUR Strings[119] #define prtr_on CUR Strings[120] #define repeat_char CUR Strings[121] #define reset_1string CUR Strings[122] #define reset_2string CUR Strings[123] #define reset_3string CUR Strings[124] #define reset_file CUR Strings[125] #define restore_cursor CUR Strings[126] #define row_address CUR Strings[127] #define save_cursor CUR Strings[128] #define scroll_forward CUR Strings[129] #define scroll_reverse CUR Strings[130] #define set_attributes CUR Strings[131] #define set_tab CUR Strings[132] #define set_window CUR Strings[133] #define tab CUR Strings[134] #define to_status_line CUR Strings[135] #define underline_char CUR Strings[136] #define up_half_line CUR Strings[137] #define init_prog CUR Strings[138] #define key_a1 CUR Strings[139] #define key_a3 CUR Strings[140] #define key_b2 CUR Strings[141] #define key_c1 CUR Strings[142] #define key_c3 CUR Strings[143] #define prtr_non CUR Strings[144] #define char_padding CUR Strings[145] #define acs_chars CUR Strings[146] #define plab_norm CUR Strings[147] struct term { char *term_names; /* offset in str_table of terminal names */ char *str_table; /* pointer to string table */ short Filedes; /* file description being written to */ SGTTY Ottyb, /* original state of the terminal */ Nttyb; /* current state of the terminal */ char Booleans[21]; short Numbers[11]; char *Strings[148]; }; struct term _first_term; struct term *cur_term; #define BOOLCOUNT 21 #define NUMCOUNT 11 #define STRCOUNT 148 //go.sysin dd * echo 'x - =src/terminfo.h' sed 's/^X//' <<'//go.sysin dd *' >=src/terminfo.h X/********************************************************************* * COPYRIGHT NOTICE * ********************************************************************** * This software is copyright (C) 1982 by Pavel Curtis * * * * Permission is granted to reproduce and distribute * * this file by any means so long as no fee is charged * * above a nominal handling fee and so long as this * * notice is always included in the copies. * * * * Other rights are reserved except as explicitly granted * * by written permission of the author. * * Pavel Curtis * * Computer Science Dept. * * 405 Upson Hall * * Cornell University * * Ithaca, NY 14853 * * * * Ph- (607) 256-4934 * * * * Pavel.Cornell@Udel-Relay (ARPAnet) * * decvax!cornell!pavel (UUCPnet) * *********************************************************************/ X/* * $Header: RCS/terminfo.v Revision 2.1 82/10/25 14:49:59 pavel Exp$ * * terminfo.h - those things needed for programs runnning at the * terminfo level. * * $Log: RCS/terminfo.v $ Revision 2.1 82/10/25 14:49:59 pavel Added Copyright Notice Revision 2.0 82/10/24 15:18:26 pavel Beta-one Test Release Revision 1.4 82/08/23 22:31:21 pavel The REAL Alpha-one Release Version Revision 1.3 82/08/19 19:24:11 pavel Alpha Test Release One Revision 1.2 82/08/19 19:10:56 pavel Alpha Test Release One Revision 1.1 82/08/15 16:42:20 pavel Initial revision * */ #ifndef A_STANDOUT #include #include #define SGTTY struct sgttyb /* Video attributes */ #define A_NORMAL 0000000 #define A_ATTRIBUTES 0377600 #define A_CHARTEXT 0000177 #define A_STANDOUT 0000200 #define A_UNDERLINE 0000400 #ifndef MINICURSES # define A_REVERSE 0001000 # define A_BLINK 0002000 # define A_DIM 0004000 # define A_BOLD 0010000 # define A_INVIS 0020000 # define A_PROTECT 0040000 # define A_ALTCHARSET 0100000 #endif MINICURSES extern char ttytype[]; #define NAMESIZE 256 #endif //go.sysin dd * echo 'x - =src/unctrl.h' sed 's/^X//' <<'//go.sysin dd *' >=src/unctrl.h X/********************************************************************* * COPYRIGHT NOTICE * ********************************************************************** * This software is copyright (C) 1982 by Pavel Curtis * * * * Permission is granted to reproduce and distribute * * this file by any means so long as no fee is charged * * above a nominal handling fee and so long as this * * notice is always included in the copies. * * * * Other rights are reserved except as explicitly granted * * by written permission of the author. * * Pavel Curtis * * Computer Science Dept. * * 405 Upson Hall * * Cornell University * * Ithaca, NY 14853 * * * * Ph- (607) 256-4934 * * * * Pavel.Cornell@Udel-Relay (ARPAnet) * * decvax!cornell!pavel (UUCPnet) * *********************************************************************/ X/* * unctrl.h * * $Header: RCS/unctrl.v Revision 2.1 82/10/25 14:50:04 pavel Exp$ * * $Log: RCS/unctrl.v $ Revision 2.1 82/10/25 14:50:04 pavel Added Copyright Notice Revision 2.0 82/10/24 15:18:28 pavel Beta-one Test Release Revision 1.3 82/08/23 22:31:24 pavel The REAL Alpha-one Release Version Revision 1.2 82/08/19 19:10:59 pavel Alpha Test Release One Revision 1.1 82/08/19 19:04:26 pavel Initial revision */ extern char *_unctrl[]; # define unctrl(ch) (_unctrl[(unsigned) ch]) //go.sysin dd * exit