pvr@wang.com (Peter Reilley) (02/28/91)
#! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of archive 5 (of 11)." # Contents: def.h def_dos.h # Wrapped by pvr@elf on Wed Feb 27 14:16:49 1991 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'def.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'def.h'\" else echo shar: Extracting \"'def.h'\" \(19462 characters\) sed "s/^X//" >'def.h' <<'END_OF_FILE' X/* X * Common header file. X * X * This file is the general header file for all parts X * of the display editor. It contains all of the X * general definitions and macros. It also contains some X * conditional compilation flags. All of the per-system and X * per-terminal definitions are in special header files. X * The most common reason to edit this file would be to zap X * the definition of CVMVAS or BACKUP. X */ X#define LINT_ARGS 1 /* enable lint type checking */ X#include "stdio.h" X X#define UNIX 1 X#define MSDOS 0 X X#define BACKUP 1 /* Make backup file. */ X#define RUNCHK 1 /* Do additional checking at run time */ X X#ifndef uchar X#define uchar unsigned char X#endif X X#ifndef uint X#define uint unsigned int X#endif X X#ifndef ulong X#define ulong unsigned long X#endif X X/* these defines are reserved for handling data values from the buffer */ X#define D8 uchar /* this had better be a 8 bit quantity */ X#define D16 uint /* this had better be a 16 bit quantity */ X#define D32 ulong /* this had better be a 32 bit quantity */ X X/* this define is reserved for the address of a location in the buffer */ X#define A32 long /* this is a 32 bit address into the buffer */ X X#define bool char /* used for boolean values */ X#define bits char /* used for boolean bit flags */ X X/* X * MS-DOS system header file. X */ X#if MSDOS X#define LARGE 1 /* Large model. */ X#endif X#define PCC 1 /* "[]" won't work. */ X#define GOOD 0 /* Indicate hunkydoryhood */ X X/* X * Macros used by the buffer name making code. X * Start at the end of the file name, scan to the left X * until BDC1 (or BDC2, if defined) is reached. The buffer X * name starts just to the right of that location, and X * stops at end of string (or at the next BDC3 character, X * if defined). BDC2 and BDC3 are mainly for VMS. X */ X#define BDC1 ':' /* Buffer names. */ X#define BDC2 '/' /* Buffer names. jam */ X X/* X * Digital ANSI terminal header file X */ X#define GOSLING 0 /* Compile in fancy display. */ X X#define NROW 25 /* Rows.for boot */ X#define NCOL 80 /* Columns. */ X X#define CUSTOMIZE /* compile switch for extended key X binding in extend.c */ X#define COSMETIC /* cosmetic screen stuff on X insert off screen */ X#if MSDOS X#define WANG_CHARACTER_SCREEN 0xf0000000L X#endif X/* X * Table sizes, etc. X */ X#define NSHASH 31 /* Symbol table hash size. */ X#define NFILEN 80 /* Length, file name. */ X#define NBUFN 13 /* Length, buffer name. */ X#define NFILE 12 /* Length, file name. */ /* krw */ X#define NLINE 80 /* Length, line. pvr */ X#define NKBDM 256 /* Length, keyboard macro. */ X#define NMSG 512 /* Length, message buffer. */ X#define NPAT 80 /* Length, pattern. */ X#define HUGE 1000 /* A rather large number. */ X#define NSRCH 128 /* Undoable search commands. */ X#define NXNAME 64 /* Length, extended command. */ X#define NBLOCK 16 /* Line block chunk size */ X#define MAXPOS 0x7FFFFFFF /* Maximum positive long value */ X X/* X * Universal. X */ X#define FALSE 0 /* False, no, bad, etc. */ X#define TRUE 1 /* True, yes, good, etc. */ X#define ABORT 2 /* Death, ^G, abort, etc. */ X X/* X * These flag bits keep track of X * some aspects of the last command. X * The CFKILL flag controls the clearing versus appending X * of data in the kill buffer. X */ X#define CFKILL 0x0002 /* Last command was a kill */ X X/* X * File I/O. X */ X#define FIOSUC 0 /* Success. */ X#define FIOFNF 1 /* File not found. */ X#define FIOEOF 2 /* End of file. */ X#define FIOERR 3 /* Error. */ X X/* X * Directory I/O. X */ X#define DIOSUC 0 /* Success. */ X#define DIOEOF 1 /* End of file. */ X#define DIOERR 2 /* Error. */ X X/* X * Display colors. X */ X#define CNONE 0 /* Unknown color. */ X#define CTEXT 1 /* Text color. */ X#define CMODE 2 /* Mode line color. */ X X/* X * Flags for "eread". X */ X#define EFNEW 0x0001 /* New prompt. */ X#define EFAUTO 0x0002 /* Autocompletion enabled. */ X#define EFCR 0x0004 /* Echo CR at end; last read. */ X X/* X * Keys are represented inside using an 11 bit X * keyboard code. The transformation between the keys on X * the keyboard and 11 bit code is done by terminal specific X * code in the "kbd.c" file. The actual character is stored X * in 8 bits (DEC multinationals work); there is also a control X * flag KCTRL, a meta flag KMETA, and a control-X flag KCTLX. X * ASCII control characters are always represented using the X * KCTRL form. Although the C0 control set is free, it is X * reserved for C0 controls because it makes the communication X * between "getkey" and "getkbd" easier. The funny keys get X * mapped into the C1 control area. X */ X#define NKEYS 2048 /* 11 bit code. */ X X#define METACH 0x1B /* M- prefix, Control-[, ESC */ X#define CTMECH 0x1C /* C-M- prefix, Control-\ */ X#define EXITCH 0x1D /* Exit level, Control-] */ X#define CTRLCH 0x1E /* C- prefix, Control-^ */ X#define HELPCH 0x1F /* Help key, Control-_ */ X X#define KCHAR 0x00FF /* The basic character code. */ X#define KCTRL 0x0100 /* Control flag. */ X#define KMETA 0x0200 /* Meta flag. */ X#define KCTLX 0x0400 /* Control-X flag. */ X X#define KFIRST 0x0080 /* First special. fitz */ X#define KLAST 0x00F3 /* Last special. */ X X#define KRANDOM 0x0080 /* A "no key" code. */ X/* X * These flags, and the macros below them, X * make up a do-it-yourself set of "ctype" macros that X * understand the DEC multinational set, and let me ask X * a slightly different set of questions. X */ X#define _W 0x01 /* Word. */ X#define _U 0x02 /* Upper case letter. */ X#define _L 0x04 /* Lower case letter. */ X#define _C 0x08 /* Control. */ X X#define ISCTRL(c) ((cinfo[(c)]&_C)!=0) X#define ISUPPER(c) ((cinfo[(c)]&_U)!=0) X#define ISLOWER(c) ((cinfo[(c)]&_L)!=0) X#define TOUPPER(c) ((c)-0x20) X#define TOLOWER(c) ((c)+0x20) X X#define BUF_SIZE(wp) (wp -> w_bufp -> b_linep -> l_bp -> l_file_offset + \ X wp -> w_bufp -> b_linep -> l_bp -> l_used) X#define BUF_START(wp) (wp -> w_bufp -> b_linep -> l_fp -> l_file_offset) X#define DOT_POS(wp) (wp -> w_dotp -> l_file_offset + wp -> w_doto) X#define MARK_POS(wp) (wp -> w_markp -> l_file_offset + wp -> w_marko) X#define DOT_CHAR(wp) (wp -> w_dotp -> l_text[wp -> w_doto]) X#define WIND_POS(wp) (wp -> w_linep -> l_file_offset + wp -> w_loff) X#define R_TYPE(wp) (wp -> w_fmt_ptr -> r_type) X#define R_SIZE(wp) (wp -> w_fmt_ptr -> r_size) X#define R_UNITS(wp) (wp -> w_fmt_ptr -> r_units) X#define R_BYTES(wp) (wp -> w_fmt_ptr -> r_bytes) X#define R_ALIGN(wp) (wp -> w_fmt_ptr -> r_align) X#define R_B_PER_U(wp) (wp -> w_fmt_ptr -> r_b_per_u) X#define R_CHR_PER_U(wp) (wp -> w_fmt_ptr -> r_chr_per_u) X#define R_FLAGS(wp) (wp -> w_fmt_ptr -> r_flags) X#define R_UNIT_FMT(wp) (wp -> w_fmt_ptr -> r_unit_fmt) X#define R_POS_FMT(wp) (wp -> w_fmt_ptr -> r_pos_fmt) X#define R_BYTE_FMT(wp) (wp -> w_fmt_ptr -> r_byte_fmt) X#define R_POSITIONS(wp) (wp -> w_fmt_ptr -> r_positions) X X/* X * The symbol table links editing functions X * to names. Entries in the key map point at the symbol X * table entry. A reference count is kept, but it is X * probably next to useless right now. The old type code, X * which was not being used and probably not right X * anyway, is all gone. X */ Xtypedef struct SYMBOL { X struct SYMBOL *s_symp; /* Hash chain. */ X short s_nkey; /* Count of keys bound here. */ X char *s_name; /* Name. */ X int (*s_funcp)(); /* Function. */ X bits s_modify; /* modify bit */ X} SYMBOL; X X/* X* These are the legal values for 's_modify' and 'k_modify' X*/ X#define SMOD 0x01 /* command modifies the buffer */ X#define SSIZE 0x02 /* command changes buffer size */ X#define SSRCH 0x04 /* command valid in search */ X#define SRPLC 0x08 /* command valid in replace */ X X/* X * There is a window structure allocated for X * every active display window. The windows are kept in a X * big list, in top to bottom screen order, with the listhead at X * "wheadp". Each window contains its own values of dot and mark. X * The flag field contains some bits that are set by commands X * to guide redisplay; although this is a bit of a compromise in X * terms of decoupling, the full blown redisplay is just too X * expensive to run for every input character. X */ Xtypedef struct WINDOW { X struct WINDOW *w_wndp; /* Next window */ X struct BUFFER *w_bufp; /* Buffer displayed in window */ X struct LINE *w_linep; /* Top line in the window */ X int w_loff; /* Offset into line for start pvr */ X struct LINE *w_dotp; /* Line containing "." */ X int w_doto; /* Offset into line for "." */ X struct LINE *w_markp; /* Line containing "mark" */ X int w_marko; /* Byte offset for "mark" */ X char w_unit_offset; /* Byte offset for "." into unit pvr */ X char w_toprow; /* Origin 0 top row of window */ X char w_ntrows; /* # of rows of text in window */ X bits w_flag; /* Flags. */ X char w_disp_shift; /* Display byte shift; 0-3 pvr */ X bool w_intel_mode; /* Display byte swaped. pvr */ X struct ROW_FMT *w_fmt_ptr; /* Pointer to display format pvr */ X} WINDOW; X X/* X * Window flags are set by command processors to X * tell the display system what has happened to the buffer X * mapped by the window. Setting "WFHARD" is always a safe thing X * to do, but it may do more work than is necessary. Always try X * to set the simplest action that achieves the required update. X * Because commands set bits in the "w_flag", update will see X * all change flags, and do the most general one. X */ X#define WFFORCE 0x01 /* Force reframe. */ X#define WFMOVE 0x02 /* Movement from line to line. */ X#define WFEDIT 0x04 /* Editing within a line. */ X#define WFHARD 0x08 /* Better to a full display. */ X#define WFMODE 0x10 /* Update mode line. */ X/* X* This structure contains how a row is constructed. pvr X*/ X Xtypedef struct ROW_FMT { X uchar r_type; /* format type nibbles */ X uchar r_size; /* format size: must be 0,1,3,7,15, etc */ X uchar r_units; /* number of units per window row: must be 1,2,4,8,16*/ X uchar r_bytes; /* number of bytes per window row: must be 1,2,4,8,16*/ X uchar r_align; /* number of bytes per align row: must be 1,2,4,8,16*/ X uchar r_b_per_u; /* number of bytes per unit: must be 1,2,4,8,16 */ X uchar r_chr_per_u; /* displayed chars per unit */ X bits r_flags; /* flags controlling format */ X char *r_unit_fmt; /* print format for unit */ X char *r_pos_fmt; /* print format for buffer position, always a long */ X char *r_byte_fmt; /* print format for bytes */ X uchar *r_positions; /* list of unit positions */ X struct ROW_FMT *r_srch_fmt; /* pointer to search display format */ X } ROW_FMT; X X/* legal values for 'r_size' (values significant; used as bit mask) pvr */ X X#define BYTES 0x00 /* Display as byte; 8 bits */ X#define WORDS 0x01 /* Display as word; 16 bits */ X#define DWORDS 0x03 /* Display as doubles; 32 bits */ X X/* legal values for 'r_type' pvr */ X#define ASCII 0x10 /* Display as ascii */ X#define OCTAL 0x20 /* Display as octal values */ X#define DECIMAL 0x30 /* Display as decimal values */ X#define HEX 0x40 /* Display as hex values */ X#define BINARY 0x50 /* Display as binary values */ X#define EBCDIC 0x60 /* Display as ebcdic */ X#define TEXT 0x70 /* Display as normal text */ X X/* X * Text is kept in buffers. A buffer header, described X * below, exists for every buffer in the system. The buffers are X * kept in a big list, so that commands that search for a buffer by X * name can find the buffer header. There is a safe store for the X * dot and mark in the header, but this is only valid if the buffer X * is not being displayed (that is, if "b_nwnd" is 0). The text for X * the buffer is kept in a circularly linked list of lines, with X * a pointer to the header line in "b_linep". X */ Xtypedef struct BUFFER { X bits buf_type; /* Type of buffer */ X struct BUFFER *b_bufp; /* Link to next BUFFER */ X struct LINE *b_dotp; /* Link to "." LINE structure */ X int b_doto; /* Offset of "." in above LINE */ X char b_unit_offset; /* Offset into unit for "." pvr */ X struct LINE *b_markp; /* The same as the above two, */ X int b_marko; /* but for the "mark" */ X struct LINE *b_linep; /* Link to the header LINE */ X char b_nwnd; /* Count of windows on buffer */ X bits b_flag; /* Flags */ X A32 b_begin_addr; /* File address of begining of buffer */ X A32 b_end_addr; /* File address of end of buffer */ X A32 b_file_size; /* Size of file */ X char b_fname[NFILEN]; /* File name */ X char b_bname[NBUFN]; /* Buffer name */ X} BUFFER; X X/* Values for 'buf_type' */ X#define BFILE 0x00 /* Buffer contains a file */ X#define BDISK 0x01 /* Buffer points to a disk */ X#define BMEMORY 0x02 /* Buffer points to memory */ X#define INMEM 0x04 /* File is entirely in memory */ X X/* Values for 'b_flag' */ X X#define BFCHG 0x01 /* Changed. */ X#define BFBAK 0x02 /* Need to make a backup. */ X#define BFBAD 0x04 /* may be trashed alloc error? */ X#define BFSAV 0x08 /* saved buffer from save-region */ X#define BFNWL 0x10 /* append newline to this buffer */ X#define BFVIEW 0x20 /* read only (jam) */ X#define BFLINK 0x40 /* Linked mode pvr */ X#define BFSLOCK 0x80 /* Lock buffer size pvr */ X/* X * This structure holds the starting position X * (as a line/offset pair) and the number of characters in a X * region of a buffer. This makes passing the specification X * of a region around a little bit easier. X * There have been some complaints that the short in this X * structure is wrong; that a long would be more appropriate. X * I'll await more comments from the folks with the little X * machines; I have a VAX, and everything fits. X */ Xtypedef struct reg { X struct LINE *r_linep; /* Origin LINE address. */ X int r_offset; /* Origin LINE offset. */ X int r_size; /* Length in characters. */ X} REGION; X X/* X * All text is kept in circularly linked X * lists of "LINE" structures. These begin at the X * header line (which is the blank line beyond the X * end of the buffer). This line is pointed to by X * the "BUFFER". Each line contains a the number of X * bytes in the line (the "used" size), the size X * of the text array, and the text. The end of line X * is not stored as a byte; it's implied. Future X * additions will include update hints, and a X * list of marks into the line. X */ Xtypedef struct LINE { X struct LINE *l_fp; /* Link to the next line */ X struct LINE *l_bp; /* Link to the previous line */ X A32 l_file_offset; /* Offset from begining of file pvr */ X int l_size; /* Allocated size */ X int l_used; /* Used size */ X#if PCC X char l_text[1]; /* A bunch of characters. */ X#else X char l_text[]; /* A bunch of characters. */ X#endif X} LINE; X X/* X * The rationale behind these macros is that you X * could (with some editing, like changing the type of a line X * link from a "LINE *" to a "REFLINE", and fixing the commands X * like file reading that break the rules) change the actual X * storage representation of lines to use something fancy on X * machines with small address spaces. X */ X#define lforw(lp) ((lp)->l_fp) X#define lback(lp) ((lp)->l_bp) X#define lgetc(lp, n) ((lp)->l_text[(n)]&0xFF) X#define lputc(lp, n, c) ((lp)->l_text[(n)]=(c)) X#define llength(lp) ((lp)->l_used) X X/* X * Externals. X */ Xextern int thisflag; Xextern int lastflag; Xextern int curgoal; Xextern int epresf; Xextern int sgarbf; Xextern WINDOW *curwp; Xextern BUFFER *curbp; Xextern WINDOW *wheadp; Xextern BUFFER *bheadp; Xextern BUFFER *blistp; Xextern short kbdm[]; Xextern short *kbdmip; Xextern short *kbdmop; Xextern char pat[]; Xextern SYMBOL *symbol[]; Xextern SYMBOL *binding[]; Xextern BUFFER *bfind(); Xextern BUFFER *bcreate(); Xextern WINDOW *wpopup(); Xextern LINE *lalloc(); Xextern int nrow; Xextern int ncol; Xextern char version[]; Xextern int ttrow; Xextern int ttcol; Xextern int tceeol; Xextern int tcinsl; Xextern int tcdell; Xextern char cinfo[]; Xextern SYMBOL *symlookup(); Xextern int nmsg; Xextern int curmsgf; Xextern int newmsgf; Xextern char msg[]; X X/* jam X */ Xextern char *okmsg; Xextern int insert_mode; Xextern int extend_buf; Xextern int flush_num; Xextern int auto_update; Xextern int flush_count; Xextern int rowb; Xextern char file_off_bad; X X/* X * Standard I/O. X */ Xextern char *malloc(); Xextern char *strcpy(); Xextern char *strcat(); END_OF_FILE if test 19462 -ne `wc -c <'def.h'`; then echo shar: \"'def.h'\" unpacked with wrong size! fi chmod +x 'def.h' # end of 'def.h' fi if test -f 'def_dos.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'def_dos.h'\" else echo shar: Extracting \"'def_dos.h'\" \(19462 characters\) sed "s/^X//" >'def_dos.h' <<'END_OF_FILE' X/* X * Common header file. X * X * This file is the general header file for all parts X * of the display editor. It contains all of the X * general definitions and macros. It also contains some X * conditional compilation flags. All of the per-system and X * per-terminal definitions are in special header files. X * The most common reason to edit this file would be to zap X * the definition of CVMVAS or BACKUP. X */ X#define LINT_ARGS 1 /* enable lint type checking */ X#include "stdio.h" X X#define UNIX 0 X#define MSDOS 1 X X#define BACKUP 1 /* Make backup file. */ X#define RUNCHK 1 /* Do additional checking at run time */ X X#ifndef uchar X#define uchar unsigned char X#endif X X#ifndef uint X#define uint unsigned int X#endif X X#ifndef ulong X#define ulong unsigned long X#endif X X/* these defines are reserved for handling data values from the buffer */ X#define D8 uchar /* this had better be a 8 bit quantity */ X#define D16 uint /* this had better be a 16 bit quantity */ X#define D32 ulong /* this had better be a 32 bit quantity */ X X/* this define is reserved for the address of a location in the buffer */ X#define A32 long /* this is a 32 bit address into the buffer */ X X#define bool char /* used for boolean values */ X#define bits char /* used for boolean bit flags */ X X/* X * MS-DOS system header file. X */ X#if MSDOS X#define LARGE 1 /* Large model. */ X#endif X#define PCC 1 /* "[]" won't work. */ X#define GOOD 0 /* Indicate hunkydoryhood */ X X/* X * Macros used by the buffer name making code. X * Start at the end of the file name, scan to the left X * until BDC1 (or BDC2, if defined) is reached. The buffer X * name starts just to the right of that location, and X * stops at end of string (or at the next BDC3 character, X * if defined). BDC2 and BDC3 are mainly for VMS. X */ X#define BDC1 ':' /* Buffer names. */ X#define BDC2 '/' /* Buffer names. jam */ X X/* X * Digital ANSI terminal header file X */ X#define GOSLING 0 /* Compile in fancy display. */ X X#define NROW 25 /* Rows.for boot */ X#define NCOL 80 /* Columns. */ X X#define CUSTOMIZE /* compile switch for extended key X binding in extend.c */ X#define COSMETIC /* cosmetic screen stuff on X insert off screen */ X#if MSDOS X#define WANG_CHARACTER_SCREEN 0xf0000000L X#endif X/* X * Table sizes, etc. X */ X#define NSHASH 31 /* Symbol table hash size. */ X#define NFILEN 80 /* Length, file name. */ X#define NBUFN 13 /* Length, buffer name. */ X#define NFILE 12 /* Length, file name. */ /* krw */ X#define NLINE 80 /* Length, line. pvr */ X#define NKBDM 256 /* Length, keyboard macro. */ X#define NMSG 512 /* Length, message buffer. */ X#define NPAT 80 /* Length, pattern. */ X#define HUGE 1000 /* A rather large number. */ X#define NSRCH 128 /* Undoable search commands. */ X#define NXNAME 64 /* Length, extended command. */ X#define NBLOCK 16 /* Line block chunk size */ X#define MAXPOS 0x7FFFFFFF /* Maximum positive long value */ X X/* X * Universal. X */ X#define FALSE 0 /* False, no, bad, etc. */ X#define TRUE 1 /* True, yes, good, etc. */ X#define ABORT 2 /* Death, ^G, abort, etc. */ X X/* X * These flag bits keep track of X * some aspects of the last command. X * The CFKILL flag controls the clearing versus appending X * of data in the kill buffer. X */ X#define CFKILL 0x0002 /* Last command was a kill */ X X/* X * File I/O. X */ X#define FIOSUC 0 /* Success. */ X#define FIOFNF 1 /* File not found. */ X#define FIOEOF 2 /* End of file. */ X#define FIOERR 3 /* Error. */ X X/* X * Directory I/O. X */ X#define DIOSUC 0 /* Success. */ X#define DIOEOF 1 /* End of file. */ X#define DIOERR 2 /* Error. */ X X/* X * Display colors. X */ X#define CNONE 0 /* Unknown color. */ X#define CTEXT 1 /* Text color. */ X#define CMODE 2 /* Mode line color. */ X X/* X * Flags for "eread". X */ X#define EFNEW 0x0001 /* New prompt. */ X#define EFAUTO 0x0002 /* Autocompletion enabled. */ X#define EFCR 0x0004 /* Echo CR at end; last read. */ X X/* X * Keys are represented inside using an 11 bit X * keyboard code. The transformation between the keys on X * the keyboard and 11 bit code is done by terminal specific X * code in the "kbd.c" file. The actual character is stored X * in 8 bits (DEC multinationals work); there is also a control X * flag KCTRL, a meta flag KMETA, and a control-X flag KCTLX. X * ASCII control characters are always represented using the X * KCTRL form. Although the C0 control set is free, it is X * reserved for C0 controls because it makes the communication X * between "getkey" and "getkbd" easier. The funny keys get X * mapped into the C1 control area. X */ X#define NKEYS 2048 /* 11 bit code. */ X X#define METACH 0x1B /* M- prefix, Control-[, ESC */ X#define CTMECH 0x1C /* C-M- prefix, Control-\ */ X#define EXITCH 0x1D /* Exit level, Control-] */ X#define CTRLCH 0x1E /* C- prefix, Control-^ */ X#define HELPCH 0x1F /* Help key, Control-_ */ X X#define KCHAR 0x00FF /* The basic character code. */ X#define KCTRL 0x0100 /* Control flag. */ X#define KMETA 0x0200 /* Meta flag. */ X#define KCTLX 0x0400 /* Control-X flag. */ X X#define KFIRST 0x0080 /* First special. fitz */ X#define KLAST 0x00F3 /* Last special. */ X X#define KRANDOM 0x0080 /* A "no key" code. */ X/* X * These flags, and the macros below them, X * make up a do-it-yourself set of "ctype" macros that X * understand the DEC multinational set, and let me ask X * a slightly different set of questions. X */ X#define _W 0x01 /* Word. */ X#define _U 0x02 /* Upper case letter. */ X#define _L 0x04 /* Lower case letter. */ X#define _C 0x08 /* Control. */ X X#define ISCTRL(c) ((cinfo[(c)]&_C)!=0) X#define ISUPPER(c) ((cinfo[(c)]&_U)!=0) X#define ISLOWER(c) ((cinfo[(c)]&_L)!=0) X#define TOUPPER(c) ((c)-0x20) X#define TOLOWER(c) ((c)+0x20) X X#define BUF_SIZE(wp) (wp -> w_bufp -> b_linep -> l_bp -> l_file_offset + \ X wp -> w_bufp -> b_linep -> l_bp -> l_used) X#define BUF_START(wp) (wp -> w_bufp -> b_linep -> l_fp -> l_file_offset) X#define DOT_POS(wp) (wp -> w_dotp -> l_file_offset + wp -> w_doto) X#define MARK_POS(wp) (wp -> w_markp -> l_file_offset + wp -> w_marko) X#define DOT_CHAR(wp) (wp -> w_dotp -> l_text[wp -> w_doto]) X#define WIND_POS(wp) (wp -> w_linep -> l_file_offset + wp -> w_loff) X#define R_TYPE(wp) (wp -> w_fmt_ptr -> r_type) X#define R_SIZE(wp) (wp -> w_fmt_ptr -> r_size) X#define R_UNITS(wp) (wp -> w_fmt_ptr -> r_units) X#define R_BYTES(wp) (wp -> w_fmt_ptr -> r_bytes) X#define R_ALIGN(wp) (wp -> w_fmt_ptr -> r_align) X#define R_B_PER_U(wp) (wp -> w_fmt_ptr -> r_b_per_u) X#define R_CHR_PER_U(wp) (wp -> w_fmt_ptr -> r_chr_per_u) X#define R_FLAGS(wp) (wp -> w_fmt_ptr -> r_flags) X#define R_UNIT_FMT(wp) (wp -> w_fmt_ptr -> r_unit_fmt) X#define R_POS_FMT(wp) (wp -> w_fmt_ptr -> r_pos_fmt) X#define R_BYTE_FMT(wp) (wp -> w_fmt_ptr -> r_byte_fmt) X#define R_POSITIONS(wp) (wp -> w_fmt_ptr -> r_positions) X X/* X * The symbol table links editing functions X * to names. Entries in the key map point at the symbol X * table entry. A reference count is kept, but it is X * probably next to useless right now. The old type code, X * which was not being used and probably not right X * anyway, is all gone. X */ Xtypedef struct SYMBOL { X struct SYMBOL *s_symp; /* Hash chain. */ X short s_nkey; /* Count of keys bound here. */ X char *s_name; /* Name. */ X int (*s_funcp)(); /* Function. */ X bits s_modify; /* modify bit */ X} SYMBOL; X X/* X* These are the legal values for 's_modify' and 'k_modify' X*/ X#define SMOD 0x01 /* command modifies the buffer */ X#define SSIZE 0x02 /* command changes buffer size */ X#define SSRCH 0x04 /* command valid in search */ X#define SRPLC 0x08 /* command valid in replace */ X X/* X * There is a window structure allocated for X * every active display window. The windows are kept in a X * big list, in top to bottom screen order, with the listhead at X * "wheadp". Each window contains its own values of dot and mark. X * The flag field contains some bits that are set by commands X * to guide redisplay; although this is a bit of a compromise in X * terms of decoupling, the full blown redisplay is just too X * expensive to run for every input character. X */ Xtypedef struct WINDOW { X struct WINDOW *w_wndp; /* Next window */ X struct BUFFER *w_bufp; /* Buffer displayed in window */ X struct LINE *w_linep; /* Top line in the window */ X int w_loff; /* Offset into line for start pvr */ X struct LINE *w_dotp; /* Line containing "." */ X int w_doto; /* Offset into line for "." */ X struct LINE *w_markp; /* Line containing "mark" */ X int w_marko; /* Byte offset for "mark" */ X char w_unit_offset; /* Byte offset for "." into unit pvr */ X char w_toprow; /* Origin 0 top row of window */ X char w_ntrows; /* # of rows of text in window */ X bits w_flag; /* Flags. */ X char w_disp_shift; /* Display byte shift; 0-3 pvr */ X bool w_intel_mode; /* Display byte swaped. pvr */ X struct ROW_FMT *w_fmt_ptr; /* Pointer to display format pvr */ X} WINDOW; X X/* X * Window flags are set by command processors to X * tell the display system what has happened to the buffer X * mapped by the window. Setting "WFHARD" is always a safe thing X * to do, but it may do more work than is necessary. Always try X * to set the simplest action that achieves the required update. X * Because commands set bits in the "w_flag", update will see X * all change flags, and do the most general one. X */ X#define WFFORCE 0x01 /* Force reframe. */ X#define WFMOVE 0x02 /* Movement from line to line. */ X#define WFEDIT 0x04 /* Editing within a line. */ X#define WFHARD 0x08 /* Better to a full display. */ X#define WFMODE 0x10 /* Update mode line. */ X/* X* This structure contains how a row is constructed. pvr X*/ X Xtypedef struct ROW_FMT { X uchar r_type; /* format type nibbles */ X uchar r_size; /* format size: must be 0,1,3,7,15, etc */ X uchar r_units; /* number of units per window row: must be 1,2,4,8,16*/ X uchar r_bytes; /* number of bytes per window row: must be 1,2,4,8,16*/ X uchar r_align; /* number of bytes per align row: must be 1,2,4,8,16*/ X uchar r_b_per_u; /* number of bytes per unit: must be 1,2,4,8,16 */ X uchar r_chr_per_u; /* displayed chars per unit */ X bits r_flags; /* flags controlling format */ X char *r_unit_fmt; /* print format for unit */ X char *r_pos_fmt; /* print format for buffer position, always a long */ X char *r_byte_fmt; /* print format for bytes */ X uchar *r_positions; /* list of unit positions */ X struct ROW_FMT *r_srch_fmt; /* pointer to search display format */ X } ROW_FMT; X X/* legal values for 'r_size' (values significant; used as bit mask) pvr */ X X#define BYTES 0x00 /* Display as byte; 8 bits */ X#define WORDS 0x01 /* Display as word; 16 bits */ X#define DWORDS 0x03 /* Display as doubles; 32 bits */ X X/* legal values for 'r_type' pvr */ X#define ASCII 0x10 /* Display as ascii */ X#define OCTAL 0x20 /* Display as octal values */ X#define DECIMAL 0x30 /* Display as decimal values */ X#define HEX 0x40 /* Display as hex values */ X#define BINARY 0x50 /* Display as binary values */ X#define EBCDIC 0x60 /* Display as ebcdic */ X#define TEXT 0x70 /* Display as normal text */ X X/* X * Text is kept in buffers. A buffer header, described X * below, exists for every buffer in the system. The buffers are X * kept in a big list, so that commands that search for a buffer by X * name can find the buffer header. There is a safe store for the X * dot and mark in the header, but this is only valid if the buffer X * is not being displayed (that is, if "b_nwnd" is 0). The text for X * the buffer is kept in a circularly linked list of lines, with X * a pointer to the header line in "b_linep". X */ Xtypedef struct BUFFER { X bits buf_type; /* Type of buffer */ X struct BUFFER *b_bufp; /* Link to next BUFFER */ X struct LINE *b_dotp; /* Link to "." LINE structure */ X int b_doto; /* Offset of "." in above LINE */ X char b_unit_offset; /* Offset into unit for "." pvr */ X struct LINE *b_markp; /* The same as the above two, */ X int b_marko; /* but for the "mark" */ X struct LINE *b_linep; /* Link to the header LINE */ X char b_nwnd; /* Count of windows on buffer */ X bits b_flag; /* Flags */ X A32 b_begin_addr; /* File address of begining of buffer */ X A32 b_end_addr; /* File address of end of buffer */ X A32 b_file_size; /* Size of file */ X char b_fname[NFILEN]; /* File name */ X char b_bname[NBUFN]; /* Buffer name */ X} BUFFER; X X/* Values for 'buf_type' */ X#define BFILE 0x00 /* Buffer contains a file */ X#define BDISK 0x01 /* Buffer points to a disk */ X#define BMEMORY 0x02 /* Buffer points to memory */ X#define INMEM 0x04 /* File is entirely in memory */ X X/* Values for 'b_flag' */ X X#define BFCHG 0x01 /* Changed. */ X#define BFBAK 0x02 /* Need to make a backup. */ X#define BFBAD 0x04 /* may be trashed alloc error? */ X#define BFSAV 0x08 /* saved buffer from save-region */ X#define BFNWL 0x10 /* append newline to this buffer */ X#define BFVIEW 0x20 /* read only (jam) */ X#define BFLINK 0x40 /* Linked mode pvr */ X#define BFSLOCK 0x80 /* Lock buffer size pvr */ X/* X * This structure holds the starting position X * (as a line/offset pair) and the number of characters in a X * region of a buffer. This makes passing the specification X * of a region around a little bit easier. X * There have been some complaints that the short in this X * structure is wrong; that a long would be more appropriate. X * I'll await more comments from the folks with the little X * machines; I have a VAX, and everything fits. X */ Xtypedef struct reg { X struct LINE *r_linep; /* Origin LINE address. */ X int r_offset; /* Origin LINE offset. */ X int r_size; /* Length in characters. */ X} REGION; X X/* X * All text is kept in circularly linked X * lists of "LINE" structures. These begin at the X * header line (which is the blank line beyond the X * end of the buffer). This line is pointed to by X * the "BUFFER". Each line contains a the number of X * bytes in the line (the "used" size), the size X * of the text array, and the text. The end of line X * is not stored as a byte; it's implied. Future X * additions will include update hints, and a X * list of marks into the line. X */ Xtypedef struct LINE { X struct LINE *l_fp; /* Link to the next line */ X struct LINE *l_bp; /* Link to the previous line */ X A32 l_file_offset; /* Offset from begining of file pvr */ X int l_size; /* Allocated size */ X int l_used; /* Used size */ X#if PCC X char l_text[1]; /* A bunch of characters. */ X#else X char l_text[]; /* A bunch of characters. */ X#endif X} LINE; X X/* X * The rationale behind these macros is that you X * could (with some editing, like changing the type of a line X * link from a "LINE *" to a "REFLINE", and fixing the commands X * like file reading that break the rules) change the actual X * storage representation of lines to use something fancy on X * machines with small address spaces. X */ X#define lforw(lp) ((lp)->l_fp) X#define lback(lp) ((lp)->l_bp) X#define lgetc(lp, n) ((lp)->l_text[(n)]&0xFF) X#define lputc(lp, n, c) ((lp)->l_text[(n)]=(c)) X#define llength(lp) ((lp)->l_used) X X/* X * Externals. X */ Xextern int thisflag; Xextern int lastflag; Xextern int curgoal; Xextern int epresf; Xextern int sgarbf; Xextern WINDOW *curwp; Xextern BUFFER *curbp; Xextern WINDOW *wheadp; Xextern BUFFER *bheadp; Xextern BUFFER *blistp; Xextern short kbdm[]; Xextern short *kbdmip; Xextern short *kbdmop; Xextern char pat[]; Xextern SYMBOL *symbol[]; Xextern SYMBOL *binding[]; Xextern BUFFER *bfind(); Xextern BUFFER *bcreate(); Xextern WINDOW *wpopup(); Xextern LINE *lalloc(); Xextern int nrow; Xextern int ncol; Xextern char version[]; Xextern int ttrow; Xextern int ttcol; Xextern int tceeol; Xextern int tcinsl; Xextern int tcdell; Xextern char cinfo[]; Xextern SYMBOL *symlookup(); Xextern int nmsg; Xextern int curmsgf; Xextern int newmsgf; Xextern char msg[]; X X/* jam X */ Xextern char *okmsg; Xextern int insert_mode; Xextern int extend_buf; Xextern int flush_num; Xextern int auto_update; Xextern int flush_count; Xextern int rowb; Xextern char file_off_bad; X X/* X * Standard I/O. X */ Xextern char *malloc(); Xextern char *strcpy(); Xextern char *strcat(); END_OF_FILE if test 19462 -ne `wc -c <'def_dos.h'`; then echo shar: \"'def_dos.h'\" unpacked with wrong size! fi # end of 'def_dos.h' fi echo shar: End of archive 5 \(of 11\). cp /dev/null ark5isdone MISSING="" for I in 1 2 3 4 5 6 7 8 9 10 11 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 11 archives. rm -f ark[1-9]isdone ark[1-9][0-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0