Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!rutgers!ames!ptsfa!ihnp4!inuxc!iuvax!isrnix!mr From: mr@isrnix.UUCP (a.k.a regoli@silver.bacs.indiana.edu) Newsgroups: comp.sys.ibm.pc Subject: Repost: EMACS 3.8L Source (Part 2 of 9) Message-ID: <870@isrnix.UUCP> Date: Fri, 31-Jul-87 15:24:21 EDT Article-I.D.: isrnix.870 Posted: Fri Jul 31 15:24:21 1987 Date-Received: Sun, 2-Aug-87 08:54:14 EDT Sender: mr@isrnix.UUCP Organization: indiana university, bloomington Lines: 2258 #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create: # dg10.c # display.c # dolock.c # ebind.h # edef.h # This archive created: Fri Jul 31 13:54:16 1987 # By: michael regoli (indiana university, bloomington) export PATH; PATH=/bin:/usr/bin:$PATH echo shar: "extracting 'dg10.c'" '(0 character)' if test -f 'dg10.c' then echo shar: "will not over-write existing file 'dg10.c'" else cat << \SHAR_EOF > 'dg10.c' /* * The routines in this file provide support for the Data General Model 10 * Microcomputer. */ #define termdef 1 /* don't define "term" external */ #include #include "estruct.h" #include "edef.h" #if DG10 #define NROW 24 /* Screen size. */ #define NCOL 80 /* Edit if you want to. */ #define NPAUSE 100 /* # times thru update to pause */ #define MARGIN 8 /* size of minimim margin and */ #define SCRSIZ 64 /* scroll size for extended lines */ #define BEL 0x07 /* BEL character. */ #define ESC 30 /* DG10 ESC character. */ extern int ttopen(); /* Forward references. */ extern int ttgetc(); extern int ttputc(); extern int ttflush(); extern int ttclose(); extern int dg10kopen(); extern int dg10kclose(); extern int dg10move(); extern int dg10eeol(); extern int dg10eeop(); extern int dg10beep(); extern int dg10open(); extern int dg10rev(); extern int dg10close(); extern int dg10cres(); #if COLOR extern int dg10fcol(); extern int dg10bcol(); int cfcolor = -1; /* current forground color */ int cbcolor = -1; /* current background color */ int ctrans[] = { /* emacs -> DG10 color translation table */ 0, 4, 2, 6, 1, 5, 3, 7}; #endif /* * Standard terminal interface dispatch table. Most of the fields point into * "termio" code. */ TERM term = { NROW-1, NROW-1, NCOL, NCOL, MARGIN, SCRSIZ, NPAUSE, dg10open, dg10close, dg10kopen, dg10kclose, ttgetc, ttputc, ttflush, dg10move, dg10eeol, dg10eeop, dg10beep, dg10rev, dg10cres #if COLOR , dg10fcol, dg10bcol #endif }; #if COLOR dg10fcol(color) /* set the current output color */ int color; /* color to set */ { if (color == cfcolor) return; ttputc(ESC); ttputc(0101); ttputc(ctrans[color]); cfcolor = color; } dg10bcol(color) /* set the current background color */ int color; /* color to set */ { if (color == cbcolor) return; ttputc(ESC); ttputc(0102); ttputc(ctrans[color]); cbcolor = color; } #endif dg10move(row, col) { ttputc(16); ttputc(col); ttputc(row); } dg10eeol() { ttputc(11); } dg10eeop() { #if COLOR dg10fcol(gfcolor); dg10bcol(gbcolor); #endif ttputc(ESC); ttputc(0106); ttputc(0106); } dg10rev(state) /* change reverse video state */ int state; /* TRUE = reverse, FALSE = normal */ { #if COLOR if (state == TRUE) { dg10fcol(0); dg10bcol(7); } #else ttputc(ESC); ttputc(state ? 0104: 0105); #endif } dg10cres() /* change screen resolution */ { return(TRUE); } spal() /* change palette string */ { /* Does nothing here */ } dg10beep() { ttputc(BEL); ttflush(); } dg10open() { strcpy(sres, "NORMAL"); revexist = TRUE; ttopen(); } dg10close() { #if COLOR dg10fcol(7); dg10bcol(0); #endif ttclose(); } dg10kopen() { } dg10kclose() { } #if FLABEL fnclabel(f, n) /* label a function key */ int f,n; /* default flag, numeric argument [unused] */ { /* on machines with no function keys...don't bother */ return(TRUE); } #endif #else dg10hello() { } #endif SHAR_EOF chmod +x 'dg10.c' fi echo shar: "extracting 'display.c'" '(0 character)' if test -f 'display.c' then echo shar: "will not over-write existing file 'display.c'" else cat << \SHAR_EOF > 'display.c' /* * The functions in this file handle redisplay. There are two halves, the * ones that update the virtual display screen, and the ones that make the * physical display screen the same as the virtual display screen. These * functions use hints that are left in the windows by the commands. * */ #include #include "estruct.h" #include "edef.h" typedef struct VIDEO { int v_flag; /* Flags */ #if COLOR int v_fcolor; /* current forground color */ int v_bcolor; /* current background color */ int v_rfcolor; /* requested forground color */ int v_rbcolor; /* requested background color */ #endif char v_text[1]; /* Screen data. */ } VIDEO; #define VFCHG 0x0001 /* Changed flag */ #define VFEXT 0x0002 /* extended (beyond column 80) */ #define VFREV 0x0004 /* reverse video status */ #define VFREQ 0x0008 /* reverse video request */ #define VFCOL 0x0010 /* color change requested */ VIDEO **vscreen; /* Virtual screen. */ #if MEMMAP == 0 VIDEO **pscreen; /* Physical screen. */ #endif /* * Initialize the data structures used by the display code. The edge vectors * used to access the screens are set up. The operating system's terminal I/O * channel is set up. All the other things get initialized at compile time. * The original window has "WFCHG" set, so that it will get completely * redrawn on the first call to "update". */ vtinit() { register int i; register VIDEO *vp; char *malloc(); TTopen(); /* open the screen */ TTkopen(); /* open the keyboard */ TTrev(FALSE); vscreen = (VIDEO **) malloc(term.t_mrow*sizeof(VIDEO *)); if (vscreen == NULL) exit(1); #if MEMMAP == 0 pscreen = (VIDEO **) malloc(term.t_mrow*sizeof(VIDEO *)); if (pscreen == NULL) exit(1); #endif for (i = 0; i < term.t_mrow; ++i) { vp = (VIDEO *) malloc(sizeof(VIDEO)+term.t_mcol); if (vp == NULL) exit(1); vp->v_flag = 0; #if COLOR vp->v_rfcolor = 7; vp->v_rbcolor = 0; #endif vscreen[i] = vp; #if MEMMAP == 0 vp = (VIDEO *) malloc(sizeof(VIDEO)+term.t_mcol); if (vp == NULL) exit(1); vp->v_flag = 0; pscreen[i] = vp; #endif } } /* * Clean up the virtual terminal system, in anticipation for a return to the * operating system. Move down to the last line and clear it out (the next * system prompt will be written in the line). Shut down the channel to the * terminal. */ vttidy() { mlerase(); movecursor(term.t_nrow, 0); TTflush(); TTclose(); TTkclose(); } /* * Set the virtual cursor to the specified row and column on the virtual * screen. There is no checking for nonsense values; this might be a good * idea during the early stages. */ vtmove(row, col) { vtrow = row; vtcol = col; } /* Write a character to the virtual screen. The virtual row and column are updated. If we are not yet on left edge, don't print it yet. If the line is too long put a "$" in the last column. This routine only puts printing characters into the virtual terminal buffers. Only column overflow is checked. */ vtputc(c) int c; { register VIDEO *vp; /* ptr to line being updated */ vp = vscreen[vtrow]; if (c == '\t') { do { vtputc(' '); } while (((vtcol + taboff)&0x07) != 0); } else if (vtcol >= term.t_ncol) { ++vtcol; vp->v_text[term.t_ncol - 1] = '$'; } else if (c < 0x20 || c == 0x7F) { vtputc('^'); vtputc(c ^ 0x40); } else { if (vtcol >= 0) vp->v_text[vtcol] = c; ++vtcol; } } /* * Erase from the end of the software cursor to the end of the line on which * the software cursor is located. */ vteeol() { register VIDEO *vp; vp = vscreen[vtrow]; while (vtcol < term.t_ncol) vp->v_text[vtcol++] = ' '; } /* upscreen: user routine to force a screen update always finishes complete update */ upscreen(f, n) { update(TRUE); return(TRUE); } /* * Make sure that the display is right. This is a three part process. First, * scan through all of the windows looking for dirty ones. Check the framing, * and refresh the screen. Second, make sure that "currow" and "curcol" are * correct for the current window. Third, make the virtual and physical * screens the same. */ update(force) int force; /* force update past type ahead? */ { register WINDOW *wp; #if TYPEAH if (force == FALSE && typahead()) return(TRUE); #endif #if VISMAC == 0 if (force == FALSE && kbdmode == PLAY) return(TRUE); #endif /* update any windows that need refreshing */ wp = wheadp; while (wp != NULL) { if (wp->w_flag) { /* if the window has changed, service it */ reframe(wp); /* check the framing */ if ((wp->w_flag & ~WFMODE) == WFEDIT) updone(wp); /* update EDITed line */ else if (wp->w_flag & ~WFMOVE) updall(wp); /* update all lines */ if (wp->w_flag & WFMODE) modeline(wp); /* update modeline */ wp->w_flag = 0; wp->w_force = 0; } /* on to the next window */ wp = wp->w_wndp; } /* recalc the current hardware cursor location */ updpos(); #if MEMMAP /* update the cursor and flush the buffers */ movecursor(currow, curcol - lbound); #endif /* check for lines to de-extend */ upddex(); /* if screen is garbage, re-plot it */ if (sgarbf != FALSE) updgar(); /* update the virtual screen to the physical screen */ updupd(force); /* update the cursor and flush the buffers */ movecursor(currow, curcol - lbound); TTflush(); return(TRUE); } /* reframe: check to see if the cursor is on in the window and re-frame it if needed or wanted */ reframe(wp) WINDOW *wp; { register LINE *lp; register int i; /* if not a requested reframe, check for a needed one */ if ((wp->w_flag & WFFORCE) == 0) { lp = wp->w_linep; for (i = 0; i < wp->w_ntrows; i++) { /* if the line is in the window, no reframe */ if (lp == wp->w_dotp) return(TRUE); /* if we are at the end of the file, reframe */ if (lp == wp->w_bufp->b_linep) break; /* on to the next line */ lp = lforw(lp); } } /* reaching here, we need a window refresh */ i = wp->w_force; /* how far back to reframe? */ if (i > 0) { /* only one screen worth of lines max */ if (--i >= wp->w_ntrows) i = wp->w_ntrows - 1; } else if (i < 0) { /* negative update???? */ i += wp->w_ntrows; if (i < 0) i = 0; } else i = wp->w_ntrows / 2; /* backup to new line at top of window */ lp = wp->w_dotp; while (i != 0 && lback(lp) != wp->w_bufp->b_linep) { --i; lp = lback(lp); } /* and reset the current line at top of window */ wp->w_linep = lp; wp->w_flag |= WFHARD; wp->w_flag &= ~WFFORCE; return(TRUE); } /* updone: update the current line to the virtual screen */ updone(wp) WINDOW *wp; /* window to update current line in */ { register LINE *lp; /* line to update */ register int sline; /* physical screen line to update */ register int i; /* search down the line we want */ lp = wp->w_linep; sline = wp->w_toprow; while (lp != wp->w_dotp) { ++sline; lp = lforw(lp); } /* and update the virtual line */ vscreen[sline]->v_flag |= VFCHG; vscreen[sline]->v_flag &= ~VFREQ; vtmove(sline, 0); for (i=0; i < llength(lp); ++i) vtputc(lgetc(lp, i)); #if COLOR vscreen[sline]->v_rfcolor = wp->w_fcolor; vscreen[sline]->v_rbcolor = wp->w_bcolor; #endif vteeol(); } /* updall: update all the lines in a window on the virtual screen */ updall(wp) WINDOW *wp; /* window to update lines in */ { register LINE *lp; /* line to update */ register int sline; /* physical screen line to update */ register int i; /* search down the lines, updating them */ lp = wp->w_linep; sline = wp->w_toprow; while (sline < wp->w_toprow + wp->w_ntrows) { /* and update the virtual line */ vscreen[sline]->v_flag |= VFCHG; vscreen[sline]->v_flag &= ~VFREQ; vtmove(sline, 0); if (lp != wp->w_bufp->b_linep) { /* if we are not at the end */ for (i=0; i < llength(lp); ++i) vtputc(lgetc(lp, i)); lp = lforw(lp); } /* on to the next one */ #if COLOR vscreen[sline]->v_rfcolor = wp->w_fcolor; vscreen[sline]->v_rbcolor = wp->w_bcolor; #endif vteeol(); ++sline; } } /* updpos: update the position of the hardware cursor and handle extended lines. This is the only update for simple moves. */ updpos() { register LINE *lp; register int c; register int i; /* find the current row */ lp = curwp->w_linep; currow = curwp->w_toprow; while (lp != curwp->w_dotp) { ++currow; lp = lforw(lp); } /* find the current column */ curcol = 0; i = 0; while (i < curwp->w_doto) { c = lgetc(lp, i++); if (c == '\t') curcol |= 0x07; else if (c < 0x20 || c == 0x7f) ++curcol; ++curcol; } /* if extended, flag so and update the virtual line image */ if (curcol >= term.t_ncol - 1) { vscreen[currow]->v_flag |= (VFEXT | VFCHG); updext(); } else lbound = 0; } /* upddex: de-extend any line that derserves it */ upddex() { register WINDOW *wp; register LINE *lp; register int i,j; wp = wheadp; while (wp != NULL) { lp = wp->w_linep; i = wp->w_toprow; while (i < wp->w_toprow + wp->w_ntrows) { if (vscreen[i]->v_flag & VFEXT) { if ((wp != curwp) || (lp != wp->w_dotp) || (curcol < term.t_ncol - 1)) { vtmove(i, 0); for (j = 0; j < llength(lp); ++j) vtputc(lgetc(lp, j)); vteeol(); /* this line no longer is extended */ vscreen[i]->v_flag &= ~VFEXT; vscreen[i]->v_flag |= VFCHG; } } lp = lforw(lp); ++i; } /* and onward to the next window */ wp = wp->w_wndp; } } /* updgar: if the screen is garbage, clear the physical screen and the virtual screen and force a full update */ updgar() { register char *txt; register int i,j; for (i = 0; i < term.t_nrow; ++i) { vscreen[i]->v_flag |= VFCHG; #if REVSTA vscreen[i]->v_flag &= ~VFREV; #endif #if COLOR vscreen[i]->v_fcolor = gfcolor; vscreen[i]->v_bcolor = gbcolor; #endif #if MEMMAP == 0 txt = pscreen[i]->v_text; for (j = 0; j < term.t_ncol; ++j) txt[j] = ' '; #endif } movecursor(0, 0); /* Erase the screen. */ (*term.t_eeop)(); sgarbf = FALSE; /* Erase-page clears */ mpresf = FALSE; /* the message area. */ #if COLOR mlerase(); /* needs to be cleared if colored */ #endif } /* updupd: update the physical screen from the virtual screen */ updupd(force) int force; /* forced update flag */ { register VIDEO *vp1; register int i; for (i = 0; i < term.t_nrow; ++i) { vp1 = vscreen[i]; /* for each line that needs to be updated*/ if ((vp1->v_flag & VFCHG) != 0) { #if TYPEAH if (force == FALSE && typahead()) return(TRUE); #endif #if MEMMAP updateline(i, vp1); #else updateline(i, vp1, pscreen[i]); #endif } } return(TRUE); } /* updext: update the extended line which the cursor is currently on at a column greater than the terminal width. The line will be scrolled right or left to let the user see where the cursor is */ updext() { register int rcursor; /* real cursor location */ register LINE *lp; /* pointer to current line */ register int j; /* index into line */ /* calculate what column the real cursor will end up in */ rcursor = ((curcol - term.t_ncol) % term.t_scrsiz) + term.t_margin; taboff = lbound = curcol - rcursor + 1; /* scan through the line outputing characters to the virtual screen */ /* once we reach the left edge */ vtmove(currow, -lbound); /* start scanning offscreen */ lp = curwp->w_dotp; /* line to output */ for (j=0; jv_text[0] = '$'; } /* * Update a single line. This does not know how to use insert or delete * character sequences; we are using VT52 functionality. Update the physical * row and column variables. It does try an exploit erase to end of line. The * RAINBOW version of this routine uses fast video. */ #if MEMMAP /* UPDATELINE specific code for the IBM-PC and other compatables */ updateline(row, vp1) int row; /* row of screen to update */ struct VIDEO *vp1; /* virtual screen image */ { #if COLOR scwrite(row, vp1->v_text, vp1->v_rfcolor, vp1->v_rbcolor); vp1->v_fcolor = vp1->v_rfcolor; vp1->v_bcolor = vp1->v_rbcolor; #else if (vp1->v_flag & VFREQ) scwrite(row, vp1->v_text, 0, 7); else scwrite(row, vp1->v_text, 7, 0); #endif vp1->v_flag &= ~(VFCHG | VFCOL); /* flag this line as changed */ } #else updateline(row, vp1, vp2) int row; /* row of screen to update */ struct VIDEO *vp1; /* virtual screen image */ struct VIDEO *vp2; /* physical screen image */ { #if RAINBOW /* UPDATELINE specific code for the DEC rainbow 100 micro */ register char *cp1; register char *cp2; register int nch; /* since we don't know how to make the rainbow do this, turn it off */ flags &= (~VFREV & ~VFREQ); cp1 = &vp1->v_text[0]; /* Use fast video. */ cp2 = &vp2->v_text[0]; putline(row+1, 1, cp1); nch = term.t_ncol; do { *cp2 = *cp1; ++cp2; ++cp1; } while (--nch); *flags &= ~VFCHG; #else /* UPDATELINE code for all other versions */ register char *cp1; register char *cp2; register char *cp3; register char *cp4; register char *cp5; register int nbflag; /* non-blanks to the right flag? */ int rev; /* reverse video flag */ int req; /* reverse video request flag */ /* set up pointers to virtual and physical lines */ cp1 = &vp1->v_text[0]; cp2 = &vp2->v_text[0]; #if COLOR TTforg(vp1->v_rfcolor); TTbacg(vp1->v_rbcolor); #endif #if REVSTA | COLOR /* if we need to change the reverse video status of the current line, we need to re-write the entire line */ rev = (vp1->v_flag & VFREV) == VFREV; req = (vp1->v_flag & VFREQ) == VFREQ; if ((rev != req) #if COLOR || (vp1->v_fcolor != vp1->v_rfcolor) || (vp1->v_bcolor != vp1->v_rbcolor) #endif #if HP150 /* the HP150 has some reverse video problems */ || req || rev #endif ) { movecursor(row, 0); /* Go to start of line. */ /* set rev video if needed */ if (rev != req) (*term.t_rev)(req); /* scan through the line and dump it to the screen and the virtual screen array */ cp3 = &vp1->v_text[term.t_ncol]; while (cp1 < cp3) { TTputc(*cp1); ++ttcol; *cp2++ = *cp1++; } /* turn rev video off */ if (rev != req) (*term.t_rev)(FALSE); /* update the needed flags */ vp1->v_flag &= ~VFCHG; if (req) vp1->v_flag |= VFREV; else vp1->v_flag &= ~VFREV; #if COLOR vp1->v_fcolor = vp1->v_rfcolor; vp1->v_bcolor = vp1->v_rbcolor; #endif return(TRUE); } #endif /* advance past any common chars at the left */ while (cp1 != &vp1->v_text[term.t_ncol] && cp1[0] == cp2[0]) { ++cp1; ++cp2; } /* This can still happen, even though we only call this routine on changed * lines. A hard update is always done when a line splits, a massive * change is done, or a buffer is displayed twice. This optimizes out most * of the excess updating. A lot of computes are used, but these tend to * be hard operations that do a lot of update, so I don't really care. */ /* if both lines are the same, no update needs to be done */ if (cp1 == &vp1->v_text[term.t_ncol]) { vp1->v_flag &= ~VFCHG; /* flag this line is changed */ return(TRUE); } /* find out if there is a match on the right */ nbflag = FALSE; cp3 = &vp1->v_text[term.t_ncol]; cp4 = &vp2->v_text[term.t_ncol]; while (cp3[-1] == cp4[-1]) { --cp3; --cp4; if (cp3[0] != ' ') /* Note if any nonblank */ nbflag = TRUE; /* in right match. */ } cp5 = cp3; /* Erase to EOL ? */ if (nbflag == FALSE && eolexist == TRUE && (req != TRUE)) { while (cp5!=cp1 && cp5[-1]==' ') --cp5; if (cp3-cp5 <= 3) /* Use only if erase is */ cp5 = cp3; /* fewer characters. */ } movecursor(row, cp1 - &vp1->v_text[0]); /* Go to start of line. */ #if REVSTA TTrev(rev); #endif while (cp1 != cp5) { /* Ordinary. */ TTputc(*cp1); ++ttcol; *cp2++ = *cp1++; } if (cp5 != cp3) { /* Erase. */ TTeeol(); while (cp1 != cp3) *cp2++ = *cp1++; } #if REVSTA TTrev(FALSE); #endif vp1->v_flag &= ~VFCHG; /* flag this line as updated */ return(TRUE); #endif } #endif /* * Redisplay the mode line for the window pointed to by the "wp". This is the * only routine that has any idea of how the modeline is formatted. You can * change the modeline format by hacking at this routine. Called by "update" * any time there is a dirty window. */ modeline(wp) WINDOW *wp; { register char *cp; register int c; register int n; /* cursor position count */ register BUFFER *bp; register i; /* loop index */ register lchar; /* character to draw line in buffer with */ register firstm; /* is this the first mode? */ char tline[NLINE]; /* buffer for part of mode line */ n = wp->w_toprow+wp->w_ntrows; /* Location. */ vscreen[n]->v_flag |= VFCHG | VFREQ | VFCOL;/* Redraw next time. */ #if COLOR vscreen[n]->v_rfcolor = 0; /* black on */ vscreen[n]->v_rbcolor = 7; /* white.....*/ #endif vtmove(n, 0); /* Seek to right line. */ if (wp == curwp) /* mark the current buffer */ lchar = '='; else #if REVSTA if (revexist) lchar = ' '; else #endif lchar = '-'; vtputc(lchar); bp = wp->w_bufp; if ((bp->b_flag&BFCHG) != 0) /* "*" if changed. */ vtputc('*'); else vtputc(lchar); n = 2; strcpy(tline, " "); /* Buffer name. */ strcat(tline, PROGNAME); strcat(tline, " "); strcat(tline, VERSION); strcat(tline, " ("); /* display the modes */ firstm = TRUE; for (i = 0; i < NUMMODES; i++) /* add in the mode flags */ if (wp->w_bufp->b_mode & (1 << i)) { if (firstm != TRUE) strcat(tline, " "); firstm = FALSE; strcat(tline, modename[i]); } strcat(tline,") "); cp = &tline[0]; while ((c = *cp++) != 0) { vtputc(c); ++n; } #if 0 vtputc(lchar); vtputc((wp->w_flag&WFCOLR) != 0 ? 'C' : lchar); vtputc((wp->w_flag&WFMODE) != 0 ? 'M' : lchar); vtputc((wp->w_flag&WFHARD) != 0 ? 'H' : lchar); vtputc((wp->w_flag&WFEDIT) != 0 ? 'E' : lchar); vtputc((wp->w_flag&WFMOVE) != 0 ? 'V' : lchar); vtputc((wp->w_flag&WFFORCE) != 0 ? 'F' : lchar); vtputc(lchar); n += 8; #endif vtputc(lchar); vtputc(lchar); vtputc(' '); n += 3; cp = &bp->b_bname[0]; while ((c = *cp++) != 0) { vtputc(c); ++n; } vtputc(' '); vtputc(lchar); vtputc(lchar); n += 3; if (bp->b_fname[0] != 0) /* File name. */ { vtputc(' '); ++n; cp = "File: "; while ((c = *cp++) != 0) { vtputc(c); ++n; } cp = &bp->b_fname[0]; while ((c = *cp++) != 0) { vtputc(c); ++n; } vtputc(' '); ++n; } while (n < term.t_ncol) /* Pad to full width. */ { vtputc(lchar); ++n; } } upmode() /* update all the mode lines */ { register WINDOW *wp; wp = wheadp; while (wp != NULL) { wp->w_flag |= WFMODE; wp = wp->w_wndp; } } /* * Send a command to the terminal to move the hardware cursor to row "row" * and column "col". The row and column arguments are origin 0. Optimize out * random calls. Update "ttrow" and "ttcol". */ movecursor(row, col) { if (row!=ttrow || col!=ttcol) { ttrow = row; ttcol = col; TTmove(row, col); } } /* * Erase the message line. This is a special routine because the message line * is not considered to be part of the virtual screen. It always works * immediately; the terminal buffer is flushed via a call to the flusher. */ mlerase() { int i; movecursor(term.t_nrow, 0); if (discmd == FALSE) return; #if COLOR TTforg(7); TTbacg(0); #endif if (eolexist == TRUE) TTeeol(); else { for (i = 0; i < term.t_ncol - 1; i++) TTputc(' '); movecursor(term.t_nrow, 1); /* force the move! */ movecursor(term.t_nrow, 0); } TTflush(); mpresf = FALSE; } /* * Write a message into the message line. Keep track of the physical cursor * position. A small class of printf like format items is handled. Assumes the * stack grows down; this assumption is made by the "++" in the argument scan * loop. Set the "message line" flag TRUE. */ mlwrite(fmt, arg) char *fmt; /* format string for output */ char *arg; /* pointer to first argument to print */ { register int c; /* current char in format string */ register char *ap; /* ptr to current data field */ /* if we are not currently echoing on the command line, abort this */ if (discmd == FALSE) { movecursor(term.t_nrow, 0); return; } #if COLOR /* set up the proper colors for the command line */ TTforg(7); TTbacg(0); #endif /* if we can not erase to end-of-line, do it manually */ if (eolexist == FALSE) { mlerase(); TTflush(); } movecursor(term.t_nrow, 0); ap = (char *) &arg; while ((c = *fmt++) != 0) { if (c != '%') { TTputc(c); ++ttcol; } else { c = *fmt++; switch (c) { case 'd': mlputi(*(int *)ap, 10); ap += sizeof(int); break; case 'o': mlputi(*(int *)ap, 8); ap += sizeof(int); break; case 'x': mlputi(*(int *)ap, 16); ap += sizeof(int); break; case 'D': mlputli(*(long *)ap, 10); ap += sizeof(long); break; case 's': mlputs(*(char **)ap); ap += sizeof(char *); break; case 'f': mlputf(*(int *)ap); ap += sizeof(int); break; default: TTputc(c); ++ttcol; } } } /* if we can, erase to the end of screen */ if (eolexist == TRUE) TTeeol(); TTflush(); mpresf = TRUE; } /* Force a string out to the message line regardless of the current $discmd setting. This is needed when $debug is TRUE and for the write-message and clear-message-line commands */ mlforce(s) char *s; /* string to force out */ { register oldcmd; /* original command display flag */ oldcmd = discmd; /* save the discmd value */ discmd = TRUE; /* and turn display on */ mlwrite(s); /* write the string out */ discmd = oldcmd; /* and restore the original setting */ } /* * Write out a string. Update the physical cursor position. This assumes that * the characters in the string all have width "1"; if this is not the case * things will get screwed up a little. */ mlputs(s) char *s; { register int c; while ((c = *s++) != 0) { TTputc(c); ++ttcol; } } /* * Write out an integer, in the specified radix. Update the physical cursor * position. */ mlputi(i, r) { register int q; static char hexdigits[] = "0123456789ABCDEF"; if (i < 0) { i = -i; TTputc('-'); } q = i/r; if (q != 0) mlputi(q, r); TTputc(hexdigits[i%r]); ++ttcol; } /* * do the same except as a long integer. */ mlputli(l, r) long l; { register long q; if (l < 0) { l = -l; TTputc('-'); } q = l/r; if (q != 0) mlputli(q, r); TTputc((int)(l%r)+'0'); ++ttcol; } /* * write out a scaled integer with two decimal places */ mlputf(s) int s; /* scaled integer to output */ { int i; /* integer portion of number */ int f; /* fractional portion of number */ /* break it up */ i = s / 100; f = s % 100; /* send out the integer portion */ mlputi(i, 10); TTputc('.'); TTputc((f / 10) + '0'); TTputc((f % 10) + '0'); ttcol += 3; } #if RAINBOW putline(row, col, buf) int row, col; char buf[]; { int n; n = strlen(buf); if (col + n - 1 > term.t_ncol) n = term.t_ncol - col + 1; Put_Data(row, col, n, buf); } #endif SHAR_EOF chmod +x 'display.c' fi echo shar: "extracting 'dolock.c'" '(0 character)' if test -f 'dolock.c' then echo shar: "will not over-write existing file 'dolock.c'" else cat << \SHAR_EOF > 'dolock.c' #if 0 /* dolock: MDBS specific Unix 4.2BSD file locking mechinism this is not to be distributed generally */ #include #include #include #include /* included by port.h: mdbs.h, mdbsio.h, sys/types.h, sys/stat.h */ #ifndef bsdunix char *dolock(){return(NULL);} char *undolock(){return(NULL);} #else #include #include extern int errno; #define LOCKDIR ".xlk" #define LOCKMSG "LOCK ERROR -- " #define LOCKMSZ sizeof(LOCKMSG) #define LOCKERR(s) { strcat(lmsg,s); oldumask = umask(oldumask); return(lmsg); } /********************** * * dolock -- lock the file fname * * if successful, returns NULL * if file locked, returns username of person locking the file * if other error, returns "LOCK ERROR: explanation" * * Jon Reid, 2/19/86 * *********************/ BOOL parent = FALSE; BOOL tellall = FALSE; char *gtname(filespec) /* get name component of unix-style filespec */ char *filespec; { char *rname, *rindex(); rname = rindex(filespec,'/'); if (rname != NULL) return(rname); else return(filespec); } char *getpath(filespec) char *filespec; { char rbuff[LFILEN]; char *rname, *rindex(); strcpy(rbuff,filespec); rname = rindex(rbuff,'/'); if (rname == NULL) return(NULL); else { *(++rname) = '\0'; return(rbuff); } } char *dolock(fname) char *fname; { static char lockname[LFILEN] = LOCKDIR; static char username[12]; static char lmsg[40] = LOCKMSG; char *pathfmt; struct stat statblk; struct passwd *pblk; long pid, getpid(); FILE *lf, *fopen(); int oldumask; oldumask = umask(0); /* maximum access allowed to lock files */ if (*fname != '/') pathfmt = "./%s%s"; else pathfmt = "%s/%s"; sprintf(lockname,pathfmt,getpath(fname), LOCKDIR); if (tellall) printf("checking for existence of %s\n",lockname); if (stat(lockname,&statblk)) { if (tellall) printf("making directory %s\n",lockname); mkdir(lockname,0777); } sprintf(lockname,"%s/%s",lockname,gtname(fname)); if (tellall) printf("checking for existence of %s\n",lockname); if (stat(lockname,&statblk)) { makelock: if (tellall) printf("creating %s\n",lockname); if ((lf = fopen(lockname,FOP_TW)) == NULL) LOCKERR("could not create lock file") else { if (parent) pid = getppid(); /* parent pid */ else pid = getpid(); /* current pid */ if (tellall) printf("pid is %ld\n",pid); fprintf(lf,"%ld",pid); /* write pid to lock file */ fclose(lf); oldumask = umask(oldumask); return(NULL); } } else { if (tellall) printf("reading lock file %s\n",lockname); if ((lf = fopen(lockname,FOP_TR)) == NULL) LOCKERR("could not read lock file") else { fscanf(lf,"%ld",&pid); /* contains current pid */ fclose(lf); if (tellall) printf("pid in %s is %ld\n",lockname, pid); if (tellall) printf("signaling process %ld\n", pid); if (kill(pid,0)) switch (errno) { case ESRCH: /* process not found */ goto makelock; break; case EPERM: /* process exists, not yours */ if (tellall) puts("process exists"); break; default: LOCKERR("kill was bad") break; } else if (tellall) puts("kill was good; process exists"); } if ((pblk = getpwuid(statblk.st_uid)) == NULL) sprintf(username,"uid %d",atoi(statblk.st_uid)); else strcpy(username,pblk->pw_name); oldumask = umask(oldumask); return(username); } } /********************** * * undolock -- unlock the file fname * * if successful, returns NULL * if other error, returns "LOCK ERROR: explanation" * * Jon Reid, 2/19/86 * *********************/ char *undolock(fname) char *fname; { static char lockname[LFILEN] = LOCKDIR; static char lmsg[40] = LOCKMSG; char *pathfmt; if (*fname != '/') pathfmt = "./%s%s"; else pathfmt = "%s/%s"; sprintf(lockname,pathfmt,getpath(fname), LOCKDIR); sprintf(lockname,"%s/%s",lockname,gtname(fname)); if (tellall) printf("attempting to unlink %s\n",lockname); if (unlink(lockname)) { strcat(lmsg,"could not remove lock file"); return(lmsg); } else return(NULL); } #endif bsdunix /****************** * end dolock module *******************/ #else dolhello() { } #endif SHAR_EOF chmod +x 'dolock.c' fi echo shar: "extracting 'ebind.h'" '(0 character)' if test -f 'ebind.h' then echo shar: "will not over-write existing file 'ebind.h'" else cat << \SHAR_EOF > 'ebind.h' /* EBIND: Initial default key to function bindings for MicroEMACS 3.7 */ /* * Command table. * This table is *roughly* in ASCII order, left to right across the * characters of the command. This explains the funny location of the * control-X commands. */ KEYTAB keytab[NBINDS] = { {CTRL|'A', gotobol}, {CTRL|'B', backchar}, {CTRL|'C', insspace}, {CTRL|'D', forwdel}, {CTRL|'E', gotoeol}, {CTRL|'F', forwchar}, {CTRL|'G', ctrlg}, {CTRL|'H', backdel}, {CTRL|'I', tab}, {CTRL|'J', indent}, {CTRL|'K', killtext}, {CTRL|'L', refresh}, {CTRL|'M', newline}, {CTRL|'N', forwline}, {CTRL|'O', openline}, {CTRL|'P', backline}, {CTRL|'Q', quote}, {CTRL|'R', backsearch}, {CTRL|'S', forwsearch}, {CTRL|'T', twiddle}, {CTRL|'U', unarg}, {CTRL|'V', forwpage}, {CTRL|'W', killregion}, {CTRL|'X', cex}, {CTRL|'Y', yank}, {CTRL|'Z', backpage}, {CTRL|']', meta}, {CTLX|CTRL|'B', listbuffers}, {CTLX|CTRL|'C', quit}, /* Hard quit. */ #if AEDIT {CTLX|CTRL|'D', detab}, {CTLX|CTRL|'E', entab}, #endif {CTLX|CTRL|'F', filefind}, {CTLX|CTRL|'I', insfile}, {CTLX|CTRL|'L', lowerregion}, {CTLX|CTRL|'M', delmode}, {CTLX|CTRL|'N', mvdnwind}, {CTLX|CTRL|'O', deblank}, {CTLX|CTRL|'P', mvupwind}, {CTLX|CTRL|'R', fileread}, {CTLX|CTRL|'S', filesave}, #if AEDIT {CTLX|CTRL|'T', trim}, #endif {CTLX|CTRL|'U', upperregion}, {CTLX|CTRL|'V', viewfile}, {CTLX|CTRL|'W', filewrite}, {CTLX|CTRL|'X', swapmark}, {CTLX|CTRL|'Z', shrinkwind}, {CTLX|'?', deskey}, {CTLX|'!', spawn}, {CTLX|'@', pipecmd}, {CTLX|'#', filter}, {CTLX|'=', showcpos}, {CTLX|'(', ctlxlp}, {CTLX|')', ctlxrp}, {CTLX|'^', enlargewind}, {CTLX|'0', delwind}, {CTLX|'1', onlywind}, {CTLX|'2', splitwind}, {CTLX|'A', setvar}, {CTLX|'B', usebuffer}, {CTLX|'C', spawncli}, #if BSD {CTLX|'D', bktoshell}, #endif {CTLX|'E', ctlxe}, {CTLX|'F', setfillcol}, {CTLX|'K', killbuffer}, {CTLX|'M', setmode}, {CTLX|'N', filename}, {CTLX|'O', nextwind}, {CTLX|'P', prevwind}, #if ISRCH {CTLX|'R', risearch}, {CTLX|'S', fisearch}, #endif {CTLX|'W', resize}, {CTLX|'X', nextbuffer}, {CTLX|'Z', enlargewind}, #if WORDPRO {META|CTRL|'C', wordcount}, #endif #if PROC {META|CTRL|'E', execproc}, #endif #if CFENCE {META|CTRL|'F', getfence}, #endif {META|CTRL|'H', delbword}, {META|CTRL|'K', unbindkey}, {META|CTRL|'L', reposition}, {META|CTRL|'M', delgmode}, {META|CTRL|'N', namebuffer}, {META|CTRL|'R', qreplace}, {META|CTRL|'S', newsize}, {META|CTRL|'T', newwidth}, {META|CTRL|'V', scrnextdw}, #if WORDPRO {META|CTRL|'W', killpara}, #endif {META|CTRL|'Z', scrnextup}, {META|' ', setmark}, {META|'?', help}, {META|'!', reposition}, {META|'.', setmark}, {META|'>', gotoeob}, {META|'<', gotobob}, {META|'~', unmark}, #if APROP {META|'A', apro}, #endif {META|'B', backword}, {META|'C', capword}, {META|'D', delfword}, #if CRYPT {META|'E', setkey}, #endif {META|'F', forwword}, {META|'G', gotoline}, {META|'K', bindtokey}, {META|'L', lowerword}, {META|'M', setgmode}, #if WORDPRO {META|'N', gotoeop}, {META|'P', gotobop}, {META|'Q', fillpara}, #endif {META|'R', sreplace}, #if BSD {META|'S', bktoshell}, #endif {META|'U', upperword}, {META|'V', backpage}, {META|'W', copyregion}, {META|'X', namedcmd}, {META|'Z', quickexit}, {META|0x7F, delbword}, #if MSDOS & (HP150 == 0) & (WANGPC == 0) & (HP110 == 0) {SPEC|CTRL|'_', forwhunt}, {SPEC|CTRL|'S', backhunt}, {SPEC|71, gotobob}, {SPEC|72, backline}, {SPEC|73, backpage}, {SPEC|75, backchar}, {SPEC|77, forwchar}, {SPEC|79, gotoeob}, {SPEC|80, forwline}, {SPEC|81, forwpage}, {SPEC|82, insspace}, {SPEC|83, forwdel}, {SPEC|115, backword}, {SPEC|116, forwword}, #if WORDPRO {SPEC|132, gotobop}, {SPEC|118, gotoeop}, #endif {SPEC|84, cbuf1}, {SPEC|85, cbuf2}, {SPEC|86, cbuf3}, {SPEC|87, cbuf4}, {SPEC|88, cbuf5}, {SPEC|89, cbuf6}, {SPEC|90, cbuf7}, {SPEC|91, cbuf8}, {SPEC|92, cbuf9}, {SPEC|93, cbuf10}, #endif #if HP150 {SPEC|32, backline}, {SPEC|33, forwline}, {SPEC|35, backchar}, {SPEC|34, forwchar}, {SPEC|44, gotobob}, {SPEC|46, forwpage}, {SPEC|47, backpage}, {SPEC|82, nextwind}, {SPEC|68, openline}, {SPEC|69, killtext}, {SPEC|65, forwdel}, {SPEC|64, ctlxe}, {SPEC|67, refresh}, {SPEC|66, reposition}, {SPEC|83, help}, {SPEC|81, deskey}, #endif #if HP110 {SPEC|0x4b, backchar}, {SPEC|0x4d, forwchar}, {SPEC|0x48, backline}, {SPEC|0x50, forwline}, {SPEC|0x43, help}, {SPEC|0x73, backword}, {SPEC|0x74, forwword}, {SPEC|0x49, backpage}, {SPEC|0x51, forwpage}, {SPEC|84, cbuf1}, {SPEC|85, cbuf2}, {SPEC|86, cbuf3}, {SPEC|87, cbuf4}, {SPEC|88, cbuf5}, {SPEC|89, cbuf6}, {SPEC|90, cbuf7}, {SPEC|91, cbuf8}, #endif #if AMIGA {SPEC|'?', help}, {SPEC|'A', backline}, {SPEC|'B', forwline}, {SPEC|'C', forwchar}, {SPEC|'D', backchar}, {SPEC|'T', backpage}, {SPEC|'S', forwpage}, {SPEC|'a', backword}, {SPEC|'`', forwword}, {SPEC|'P', cbuf1}, {SPEC|'Q', cbuf2}, {SPEC|'R', cbuf3}, {SPEC|'S', cbuf4}, {SPEC|'T', cbuf5}, {SPEC|'U', cbuf6}, {SPEC|'V', cbuf7}, {SPEC|'W', cbuf8}, {SPEC|'X', cbuf9}, {SPEC|'Y', cbuf10}, {127, forwdel}, #endif #if ST520 {SPEC|'b', help}, {SPEC|'H', backline}, {SPEC|'P', forwline}, {SPEC|'M', forwchar}, {SPEC|'K', backchar}, {SPEC|'t', setmark}, {SPEC|'a', yank}, {SPEC|'R', insspace}, {SPEC|'G', gotobob}, {127, forwdel}, {SPEC|84, cbuf1}, {SPEC|85, cbuf2}, {SPEC|86, cbuf3}, {SPEC|87, cbuf4}, {SPEC|88, cbuf5}, {SPEC|89, cbuf6}, {SPEC|90, cbuf7}, {SPEC|91, cbuf8}, {SPEC|92, cbuf9}, {SPEC|93, cbuf10}, #endif #if WANGPC SPEC|0xE0, quit, /* Cancel */ SPEC|0xE1, help, /* Help */ SPEC|0xF1, help, /* ^Help */ SPEC|0xE3, ctrlg, /* Print */ SPEC|0xF3, ctrlg, /* ^Print */ SPEC|0xC0, backline, /* North */ SPEC|0xD0, gotobob, /* ^North */ SPEC|0xC1, forwchar, /* East */ SPEC|0xD1, gotoeol, /* ^East */ SPEC|0xC2, forwline, /* South */ SPEC|0xD2, gotobop, /* ^South */ SPEC|0xC3, backchar, /* West */ SPEC|0xD3, gotobol, /* ^West */ SPEC|0xC4, ctrlg, /* Home */ SPEC|0xD4, gotobob, /* ^Home */ SPEC|0xC5, filesave, /* Execute */ SPEC|0xD5, ctrlg, /* ^Execute */ SPEC|0xC6, insfile, /* Insert */ SPEC|0xD6, ctrlg, /* ^Insert */ SPEC|0xC7, forwdel, /* Delete */ SPEC|0xD7, killregion, /* ^Delete */ SPEC|0xC8, backpage, /* Previous */ SPEC|0xD8, prevwind, /* ^Previous */ SPEC|0xC9, forwpage, /* Next */ SPEC|0xD9, nextwind, /* ^Next */ SPEC|0xCB, ctrlg, /* Erase */ SPEC|0xDB, ctrlg, /* ^Erase */ SPEC|0xDC, ctrlg, /* ^Tab */ SPEC|0xCD, ctrlg, /* BackTab */ SPEC|0xDD, ctrlg, /* ^BackTab */ SPEC|0x80, ctrlg, /* Indent */ SPEC|0x90, ctrlg, /* ^Indent */ SPEC|0x81, ctrlg, /* Page */ SPEC|0x91, ctrlg, /* ^Page */ SPEC|0x82, ctrlg, /* Center */ SPEC|0x92, ctrlg, /* ^Center */ SPEC|0x83, ctrlg, /* DecTab */ SPEC|0x93, ctrlg, /* ^DecTab */ SPEC|0x84, ctrlg, /* Format */ SPEC|0x94, ctrlg, /* ^Format */ SPEC|0x85, ctrlg, /* Merge */ SPEC|0x95, ctrlg, /* ^Merge */ SPEC|0x86, setmark, /* Note */ SPEC|0x96, ctrlg, /* ^Note */ SPEC|0x87, ctrlg, /* Stop */ SPEC|0x97, ctrlg, /* ^Stop */ SPEC|0x88, forwsearch, /* Srch */ SPEC|0x98, backsearch, /* ^Srch */ SPEC|0x89, sreplace, /* Replac */ SPEC|0x99, qreplace, /* ^Replac */ SPEC|0x8A, ctrlg, /* Copy */ SPEC|0x9A, ctrlg, /* ^Copy */ SPEC|0x8B, ctrlg, /* Move */ SPEC|0x9B, ctrlg, /* ^Move */ SPEC|0x8C, namedcmd, /* Command */ SPEC|0x9C, spawn, /* ^Command */ SPEC|0x8D, ctrlg, /* ^ */ SPEC|0x9D, ctrlg, /* ^^ */ SPEC|0x8E, ctrlg, /* Blank */ SPEC|0x9E, ctrlg, /* ^Blank */ SPEC|0x8F, gotoline, /* GoTo */ SPEC|0x9F, usebuffer, /* ^GoTo */ #endif {0x7F, backdel}, /* special internal bindings */ SPEC|META|'W', wrapword, /* called on word wrap */ SPEC|META|'C', nullproc, /* every command input */ {0, NULL} }; #if RAINBOW #include "rainbow.h" /* * Mapping table from the LK201 function keys to the internal EMACS character. */ short lk_map[][2] = { Up_Key, CTRL+'P', Down_Key, CTRL+'N', Left_Key, CTRL+'B', Right_Key, CTRL+'F', Shift+Left_Key, META+'B', Shift+Right_Key, META+'F', Control+Left_Key, CTRL+'A', Control+Right_Key, CTRL+'E', Prev_Scr_Key, META+'V', Next_Scr_Key, CTRL+'V', Shift+Up_Key, META+'<', Shift+Down_Key, META+'>', Cancel_Key, CTRL+'G', Find_Key, CTRL+'S', Shift+Find_Key, CTRL+'R', Insert_Key, CTRL+'Y', Options_Key, CTRL+'D', Shift+Options_Key, META+'D', Remove_Key, CTRL+'W', Shift+Remove_Key, META+'W', Select_Key, CTRL+'@', Shift+Select_Key, CTLX+CTRL+'X', Interrupt_Key, CTRL+'U', Keypad_PF2, META+'L', Keypad_PF3, META+'C', Keypad_PF4, META+'U', Shift+Keypad_PF2, CTLX+CTRL+'L', Shift+Keypad_PF4, CTLX+CTRL+'U', Keypad_1, CTLX+'1', Keypad_2, CTLX+'2', Do_Key, CTLX+'E', Keypad_4, CTLX+CTRL+'B', Keypad_5, CTLX+'B', Keypad_6, CTLX+'K', Resume_Key, META+'!', Control+Next_Scr_Key, CTLX+'N', Control+Prev_Scr_Key, CTLX+'P', Control+Up_Key, CTLX+CTRL+'P', Control+Down_Key, CTLX+CTRL+'N', Help_Key, CTLX+'=', Shift+Do_Key, CTLX+'(', Control+Do_Key, CTLX+')', Keypad_0, CTLX+'Z', Shift+Keypad_0, CTLX+CTRL+'Z', Main_Scr_Key, CTRL+'C', Keypad_Enter, CTLX+'!', Exit_Key, CTLX+CTRL+'C', Shift+Exit_Key, CTRL+'Z' }; #define lk_map_size (sizeof(lk_map)/2) #endif SHAR_EOF chmod +x 'ebind.h' fi echo shar: "extracting 'edef.h'" '(0 character)' if test -f 'edef.h' then echo shar: "will not over-write existing file 'edef.h'" else cat << \SHAR_EOF > 'edef.h' /* EDEF: Global variable definitions for MicroEMACS 3.2 written by Dave G. Conroy modified by Steve Wilhite, George Jones greatly modified by Daniel Lawrence */ /* some global fuction declarations */ char *malloc(); char *strcpy(); char *strcat(); char *strncpy(); char *itoa(); char *getval(); char *gtenv(); char *gtusr(); char *gtfun(); char *token(); char *ltos(); char *flook(); char *mkupper(); char *mklower(); unsigned int getckey(); #ifdef maindef /* for MAIN.C */ /* initialized global definitions */ int fillcol = 72; /* Current fill column */ short kbdm[NKBDM]; /* Macro */ char *execstr = NULL; /* pointer to string to execute */ char golabel[NPAT] = ""; /* current line to go to */ int execlevel = 0; /* execution IF level */ int eolexist = TRUE; /* does clear to EOL exist */ int revexist = FALSE; /* does reverse video exist? */ int flickcode = FALSE; /* do flicker supression? */ char *modename[] = { /* name of modes */ "WRAP", "CMODE", "SPELL", "EXACT", "VIEW", "OVER", "MAGIC", "CRYPT", "ASAVE"}; char modecode[] = "WCSEVOMYA"; /* letters to represent modes */ int gmode = 0; /* global editor mode */ int gfcolor = 7; /* global forgrnd color (white) */ int gbcolor = 0; /* global backgrnd color (black)*/ int gasave = 256; /* global ASAVE size */ int gacount = 256; /* count until next ASAVE */ int sgarbf = TRUE; /* TRUE if screen is garbage */ int mpresf = FALSE; /* TRUE if message in last line */ int clexec = FALSE; /* command line execution flag */ int mstore = FALSE; /* storing text to macro flag */ int discmd = TRUE; /* display command flag */ int disinp = TRUE; /* display input characters */ struct BUFFER *bstore = NULL; /* buffer to store macro text to*/ int vtrow = 0; /* Row location of SW cursor */ int vtcol = 0; /* Column location of SW cursor */ int ttrow = HUGE; /* Row location of HW cursor */ int ttcol = HUGE; /* Column location of HW cursor */ int lbound = 0; /* leftmost column of current line being displayed */ int taboff = 0; /* tab offset for display */ int metac = CTRL | '['; /* current meta character */ int ctlxc = CTRL | 'X'; /* current control X prefix char */ int reptc = CTRL | 'U'; /* current universal repeat char */ int abortc = CTRL | 'G'; /* current abort command char */ int quotec = 0x11; /* quote char during mlreply() */ char *cname[] = { /* names of colors */ "BLACK", "RED", "GREEN", "YELLOW", "BLUE", "MAGENTA", "CYAN", "WHITE"}; KILL *kbufp = NULL; /* current kill buffer chunk pointer */ KILL *kbufh = NULL; /* kill buffer header pointer */ int kused = KBLOCK; /* # of bytes used in kill buffer */ WINDOW *swindow = NULL; /* saved window pointer */ int cryptflag = FALSE; /* currently encrypting? */ short *kbdptr; /* current position in keyboard buf */ short *kbdend = &kbdm[0]; /* ptr to end of the keyboard */ int kbdmode = STOP; /* current keyboard macro mode */ int kbdrep = 0; /* number of repetitions */ int restflag = FALSE; /* restricted use? */ int lastkey = 0; /* last keystoke */ int seed = 0; /* random number seed */ long envram = 0l; /* # of bytes current in use by malloc */ int macbug = FALSE; /* macro debuging flag */ char errorm[] = "ERROR"; /* error literal */ char truem[] = "TRUE"; /* true literal */ char falsem[] = "FALSE"; /* false litereal */ int cmdstatus = TRUE; /* last command status */ char palstr[49] = ""; /* palette string */ /* uninitialized global definitions */ int currow; /* Cursor row */ int curcol; /* Cursor column */ int thisflag; /* Flags, this command */ int lastflag; /* Flags, last command */ int curgoal; /* Goal for C-P, C-N */ WINDOW *curwp; /* Current window */ BUFFER *curbp; /* Current buffer */ WINDOW *wheadp; /* Head of list of windows */ BUFFER *bheadp; /* Head of list of buffers */ BUFFER *blistp; /* Buffer for C-X C-B */ BUFFER *bfind(); /* Lookup a buffer by name */ WINDOW *wpopup(); /* Pop up window creation */ LINE *lalloc(); /* Allocate a line */ char sres[NBUFN]; /* current screen resolution */ char pat[NPAT]; /* Search pattern */ char tap[NPAT]; /* Reversed pattern array. */ char rpat[NPAT]; /* replacement pattern */ /* The variable matchlen holds the length of the matched * string - used by the replace functions. * The variable patmatch holds the string that satisfies * the search command. * The variables matchline and matchoff hold the line and * offset position of the start of match. */ unsigned int matchlen = 0; unsigned int mlenold = 0; char *patmatch = NULL; LINE *matchline = NULL; int matchoff = 0; #if MAGIC /* * The variable magical determines if there are actual * metacharacters in the string - if not, then we don't * have to use the slower MAGIC mode search functions. */ short int magical = FALSE; MC mcpat[NPAT]; /* the magic pattern */ MC tapcm[NPAT]; /* the reversed magic pattern */ #endif #else /* for all the other .C files */ /* initialized global external declarations */ extern int fillcol; /* Fill column */ extern short kbdm[]; /* Holds kayboard macro data */ extern char pat[]; /* Search pattern */ extern char rpat[]; /* Replacement pattern */ extern char *execstr; /* pointer to string to execute */ extern char golabel[]; /* current line to go to */ extern int execlevel; /* execution IF level */ extern int eolexist; /* does clear to EOL exist? */ extern int revexist; /* does reverse video exist? */ extern int flickcode; /* do flicker supression? */ extern char *modename[]; /* text names of modes */ extern char modecode[]; /* letters to represent modes */ extern KEYTAB keytab[]; /* key bind to functions table */ extern NBIND names[]; /* name to function table */ extern int gmode; /* global editor mode */ extern int gfcolor; /* global forgrnd color (white) */ extern int gbcolor; /* global backgrnd color (black)*/ extern int gasave; /* global ASAVE size */ extern int gacount; /* count until next ASAVE */ extern int sgarbf; /* State of screen unknown */ extern int mpresf; /* Stuff in message line */ extern int clexec; /* command line execution flag */ extern int mstore; /* storing text to macro flag */ extern int discmd; /* display command flag */ extern int disinp; /* display input characters */ extern struct BUFFER *bstore; /* buffer to store macro text to*/ extern int vtrow; /* Row location of SW cursor */ extern int vtcol; /* Column location of SW cursor */ extern int ttrow; /* Row location of HW cursor */ extern int ttcol; /* Column location of HW cursor */ extern int lbound; /* leftmost column of current line being displayed */ extern int taboff; /* tab offset for display */ extern int metac; /* current meta character */ extern int ctlxc; /* current control X prefix char */ extern int reptc; /* current universal repeat char */ extern int abortc; /* current abort command char */ extern int quotec; /* quote char during mlreply() */ extern char *cname[]; /* names of colors */ extern KILL *kbufp; /* current kill buffer chunk pointer */ extern KILL *kbufh; /* kill buffer header pointer */ extern int kused; /* # of bytes used in KB */ extern WINDOW *swindow; /* saved window pointer */ extern int cryptflag; /* currently encrypting? */ extern short *kbdptr; /* current position in keyboard buf */ extern short *kbdend; /* ptr to end of the keyboard */ extern int kbdmode; /* current keyboard macro mode */ extern int kbdrep; /* number of repetitions */ extern int restflag; /* restricted use? */ extern int lastkey; /* last keystoke */ extern int seed; /* random number seed */ extern long envram; /* # of bytes current in use by malloc */ extern int macbug; /* macro debuging flag */ extern char errorm[]; /* error literal */ extern char truem[]; /* true literal */ extern char falsem[]; /* false litereal */ extern int cmdstatus; /* last command status */ extern char palstr[]; /* palette string */ /* uninitialized global external declarations */ extern int currow; /* Cursor row */ extern int curcol; /* Cursor column */ extern int thisflag; /* Flags, this command */ extern int lastflag; /* Flags, last command */ extern int curgoal; /* Goal for C-P, C-N */ extern WINDOW *curwp; /* Current window */ extern BUFFER *curbp; /* Current buffer */ extern WINDOW *wheadp; /* Head of list of windows */ extern BUFFER *bheadp; /* Head of list of buffers */ extern BUFFER *blistp; /* Buffer for C-X C-B */ extern BUFFER *bfind(); /* Lookup a buffer by name */ extern WINDOW *wpopup(); /* Pop up window creation */ extern LINE *lalloc(); /* Allocate a line */ extern char sres[NBUFN]; /* current screen resolution */ extern char pat[]; /* Search pattern */ extern char tap[]; /* Reversed pattern array. */ extern char rpat[]; /* replacement pattern */ extern unsigned int matchlen; /* length of found string */ extern unsigned int mlenold; /* previous length of found str */ extern char *patmatch; /* the found string */ extern LINE *matchline; /* line pointer to found string */ extern int matchoff; /* offset to the found string */ #if MAGIC extern short int magical; /* meta-characters in pattern? */ extern MC mcpat[]; /* the magic pattern */ extern MC tapcm[]; /* the reversed magic pattern */ #endif #endif /* terminal table defined only in TERM.C */ #ifndef termdef extern TERM term; /* Terminal information. */ #endif SHAR_EOF chmod +x 'edef.h' fi exit 0 # End of shell archive