home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume6 / uemacs3.7 / part02 < prev    next >
Encoding:
Internet Message Format  |  1986-11-30  |  39.2 KB

  1. Subject: MicroEmacs, Version 3.7 (uEmacs3.7), Part02/12
  2. Newsgroups: mod.sources
  3. Approved: rs@mirror.UUCP
  4.  
  5. Submitted by: ihnp4!pur-ee!pur-phy!duncan!lawrence
  6. Mod.sources: Volume 6, Issue 72
  7. Archive-name: uEmacs3.7/Part02
  8.  
  9. [  This is the latest revision of one of two programs named "MicroEmacs";
  10.    when discussing these on the net, or in contacting the authors, make
  11.    sure to mention the version number -- in this case 3.7 -- as that is
  12.    the easiest way to distinguish between them.  Lawrence will be posting
  13.    uuencoded executables in net.micro.pc and net.micro.amiga; the file
  14.    'readme' contains information on how to also get these from him
  15.    directly.   --r$ ]
  16.  
  17. echo extracting - dg10.c
  18. sed 's/^X//' > dg10.c << 'FRIDAY_NIGHT'
  19. X/*
  20. X * The routines in this file provide support for the Data General Model 10
  21. X * Microcomputer.
  22. X */
  23. X
  24. X#define    termdef    1            /* don't define "term" external */
  25. X
  26. X#include        <stdio.h>
  27. X#include    "estruct.h"
  28. X#include        "edef.h"
  29. X
  30. X#if     DG10
  31. X
  32. X#define NROW    24                      /* Screen size.                 */
  33. X#define NCOL    80                      /* Edit if you want to.         */
  34. X#define    NPAUSE    100            /* # times thru update to pause */
  35. X#define    MARGIN    8            /* size of minimim margin and    */
  36. X#define    SCRSIZ    64            /* scroll size for extended lines */
  37. X#define BEL     0x07                    /* BEL character.               */
  38. X#define ESC     30                      /* DG10 ESC character.          */
  39. X
  40. Xextern  int     ttopen();               /* Forward references.          */
  41. Xextern  int     ttgetc();
  42. Xextern  int     ttputc();
  43. Xextern  int     ttflush();
  44. Xextern  int     ttclose();
  45. Xextern  int     dg10move();
  46. Xextern  int     dg10eeol();
  47. Xextern  int     dg10eeop();
  48. Xextern  int     dg10beep();
  49. Xextern  int     dg10open();
  50. Xextern    int    dg10rev();
  51. Xextern    int    dg10close();
  52. X
  53. X#if    COLOR
  54. Xextern    int    dg10fcol();
  55. Xextern    int    dg10bcol();
  56. X
  57. Xint    cfcolor = -1;        /* current forground color */
  58. Xint    cbcolor = -1;        /* current background color */
  59. Xint    ctrans[] = {        /* emacs -> DG10 color translation table */
  60. X    0, 4, 2, 6, 1, 5, 3, 7};
  61. X#endif
  62. X
  63. X/*
  64. X * Standard terminal interface dispatch table. Most of the fields point into
  65. X * "termio" code.
  66. X */
  67. XTERM    term    = {
  68. X        NROW-1,
  69. X        NCOL,
  70. X    MARGIN,
  71. X    SCRSIZ,
  72. X    NPAUSE,
  73. X        dg10open,
  74. X        dg10close,
  75. X        ttgetc,
  76. X        ttputc,
  77. X        ttflush,
  78. X        dg10move,
  79. X        dg10eeol,
  80. X        dg10eeop,
  81. X        dg10beep,
  82. X    dg10rev
  83. X#if    COLOR
  84. X    , dg10fcol,
  85. X    dg10bcol
  86. X#endif
  87. X};
  88. X
  89. X#if    COLOR
  90. Xdg10fcol(color)        /* set the current output color */
  91. X
  92. Xint color;    /* color to set */
  93. X
  94. X{
  95. X    if (color == cfcolor)
  96. X        return;
  97. X    ttputc(ESC);
  98. X    ttputc(0101);
  99. X    ttputc(ctrans[color]);
  100. X    cfcolor = color;
  101. X}
  102. X
  103. Xdg10bcol(color)        /* set the current background color */
  104. X
  105. Xint color;    /* color to set */
  106. X
  107. X{
  108. X    if (color == cbcolor)
  109. X        return;
  110. X    ttputc(ESC);
  111. X    ttputc(0102);
  112. X    ttputc(ctrans[color]);
  113. X        cbcolor = color;
  114. X}
  115. X#endif
  116. X
  117. Xdg10move(row, col)
  118. X{
  119. X    ttputc(16);
  120. X        ttputc(col);
  121. X    ttputc(row);
  122. X}
  123. X
  124. Xdg10eeol()
  125. X{
  126. X        ttputc(11);
  127. X}
  128. X
  129. Xdg10eeop()
  130. X{
  131. X#if    COLOR
  132. X    dg10fcol(gfcolor);
  133. X    dg10bcol(gbcolor);
  134. X#endif
  135. X        ttputc(ESC);
  136. X        ttputc(0106);
  137. X        ttputc(0106);
  138. X}
  139. X
  140. Xdg10rev(state)        /* change reverse video state */
  141. X
  142. Xint state;    /* TRUE = reverse, FALSE = normal */
  143. X
  144. X{
  145. X#if    COLOR
  146. X    if (state == TRUE) {
  147. X        dg10fcol(0);
  148. X        dg10bcol(7);
  149. X    }
  150. X#else
  151. X    ttputc(ESC);
  152. X    ttputc(state ? 0104: 0105);
  153. X#endif
  154. X}
  155. X
  156. Xdg10beep()
  157. X{
  158. X        ttputc(BEL);
  159. X        ttflush();
  160. X}
  161. X
  162. Xdg10open()
  163. X{
  164. X    revexist = TRUE;
  165. X        ttopen();
  166. X}
  167. X
  168. Xdg10close()
  169. X
  170. X{
  171. X#if    COLOR
  172. X    dg10fcol(7);
  173. X    dg10bcol(0);
  174. X#endif
  175. X    ttclose();
  176. X}
  177. X#else
  178. Xdg10hello()
  179. X{
  180. X}
  181. X#endif
  182. FRIDAY_NIGHT
  183. echo extracting - display.c
  184. sed 's/^X//' > display.c << 'FRIDAY_NIGHT'
  185. X/*
  186. X * The functions in this file handle redisplay. There are two halves, the
  187. X * ones that update the virtual display screen, and the ones that make the
  188. X * physical display screen the same as the virtual display screen. These
  189. X * functions use hints that are left in the windows by the commands.
  190. X *
  191. X */
  192. X
  193. X#include        <stdio.h>
  194. X#include    "estruct.h"
  195. X#include        "edef.h"
  196. X
  197. X#define WFDEBUG 0                       /* Window flag debug. */
  198. X
  199. Xtypedef struct  VIDEO {
  200. X        int    v_flag;                 /* Flags */
  201. X#if    COLOR
  202. X    int    v_fcolor;        /* current forground color */
  203. X    int    v_bcolor;        /* current background color */
  204. X    int    v_rfcolor;        /* requested forground color */
  205. X    int    v_rbcolor;        /* requested background color */
  206. X#endif
  207. X        char    v_text[1];              /* Screen data. */
  208. X}       VIDEO;
  209. X
  210. X#define VFCHG   0x0001                  /* Changed flag            */
  211. X#define    VFEXT    0x0002            /* extended (beyond column 80)    */
  212. X#define    VFREV    0x0004            /* reverse video status        */
  213. X#define    VFREQ    0x0008            /* reverse video request    */
  214. X#define    VFCOL    0x0010            /* color change requested    */
  215. X
  216. XVIDEO   **vscreen;                      /* Virtual screen. */
  217. X#if    IBMPC == 0
  218. XVIDEO   **pscreen;                      /* Physical screen. */
  219. X#endif
  220. X
  221. X/*
  222. X * Initialize the data structures used by the display code. The edge vectors
  223. X * used to access the screens are set up. The operating system's terminal I/O
  224. X * channel is set up. All the other things get initialized at compile time.
  225. X * The original window has "WFCHG" set, so that it will get completely
  226. X * redrawn on the first call to "update".
  227. X */
  228. Xvtinit()
  229. X{
  230. X    register int i;
  231. X    register VIDEO *vp;
  232. X    char *malloc();
  233. X
  234. X    (*term.t_open)();
  235. X    (*term.t_rev)(FALSE);
  236. X    vscreen = (VIDEO **) malloc(term.t_nrow*sizeof(VIDEO *));
  237. X
  238. X    if (vscreen == NULL)
  239. X        exit(1);
  240. X
  241. X#if    IBMPC == 0
  242. X    pscreen = (VIDEO **) malloc(term.t_nrow*sizeof(VIDEO *));
  243. X
  244. X    if (pscreen == NULL)
  245. X        exit(1);
  246. X#endif
  247. X
  248. X    for (i = 0; i < term.t_nrow; ++i)
  249. X        {
  250. X        vp = (VIDEO *) malloc(sizeof(VIDEO)+term.t_ncol);
  251. X
  252. X        if (vp == NULL)
  253. X            exit(1);
  254. X
  255. X    vp->v_flag = 0;
  256. X#if    COLOR
  257. X    vp->v_rfcolor = 7;
  258. X    vp->v_rbcolor = 0;
  259. X#endif
  260. X        vscreen[i] = vp;
  261. X#if    IBMPC == 0
  262. X        vp = (VIDEO *) malloc(sizeof(VIDEO)+term.t_ncol);
  263. X
  264. X        if (vp == NULL)
  265. X            exit(1);
  266. X
  267. X    vp->v_flag = 0;
  268. X        pscreen[i] = vp;
  269. X#endif
  270. X        }
  271. X}
  272. X
  273. X/*
  274. X * Clean up the virtual terminal system, in anticipation for a return to the
  275. X * operating system. Move down to the last line and clear it out (the next
  276. X * system prompt will be written in the line). Shut down the channel to the
  277. X * terminal.
  278. X */
  279. Xvttidy()
  280. X{
  281. X    mlerase();
  282. X    movecursor(term.t_nrow, 0);
  283. X    (*term.t_flush)();
  284. X    (*term.t_close)();
  285. X}
  286. X
  287. X/*
  288. X * Set the virtual cursor to the specified row and column on the virtual
  289. X * screen. There is no checking for nonsense values; this might be a good
  290. X * idea during the early stages.
  291. X */
  292. Xvtmove(row, col)
  293. X{
  294. X    vtrow = row;
  295. X    vtcol = col;
  296. X}
  297. X
  298. X/*
  299. X * Write a character to the virtual screen. The virtual row and column are
  300. X * updated. If the line is too long put a "$" in the last column. This routine
  301. X * only puts printing characters into the virtual terminal buffers. Only
  302. X * column overflow is checked.
  303. X */
  304. Xvtputc(c)
  305. X    int c;
  306. X{
  307. X    register VIDEO      *vp;
  308. X
  309. X    vp = vscreen[vtrow];
  310. X
  311. X    if (vtcol >= term.t_ncol) {
  312. X        vtcol = (vtcol + 0x07) & ~0x07;
  313. X        vp->v_text[term.t_ncol - 1] = '$';
  314. X    } else if (c == '\t')
  315. X        {
  316. X        do
  317. X            {
  318. X            vtputc(' ');
  319. X            }
  320. X        while ((vtcol&0x07) != 0);
  321. X        }
  322. X    else if (c < 0x20 || c == 0x7F)
  323. X        {
  324. X        vtputc('^');
  325. X        vtputc(c ^ 0x40);
  326. X        }
  327. X    else
  328. X    vp->v_text[vtcol++] = c;
  329. X}
  330. X
  331. X/*    put a character to the virtual screen in an extended line. If we are
  332. X    not yet on left edge, don't print it yet. check for overflow on
  333. X    the right margin                        */
  334. X
  335. Xvtpute(c)
  336. X
  337. Xint c;
  338. X
  339. X{
  340. X    register VIDEO      *vp;
  341. X
  342. X    vp = vscreen[vtrow];
  343. X
  344. X    if (vtcol >= term.t_ncol) {
  345. X        vtcol = (vtcol + 0x07) & ~0x07;
  346. X        vp->v_text[term.t_ncol - 1] = '$';
  347. X    } else if (c == '\t')
  348. X        {
  349. X        do
  350. X            {
  351. X            vtpute(' ');
  352. X            }
  353. X        while (((vtcol + lbound)&0x07) != 0);
  354. X        }
  355. X    else if (c < 0x20 || c == 0x7F)
  356. X        {
  357. X        vtpute('^');
  358. X        vtpute(c ^ 0x40);
  359. X        }
  360. X    else {
  361. X    if (vtcol >= 0)
  362. X        vp->v_text[vtcol] = c;
  363. X    ++vtcol;
  364. X    }
  365. X}
  366. X
  367. X/*
  368. X * Erase from the end of the software cursor to the end of the line on which
  369. X * the software cursor is located.
  370. X */
  371. Xvteeol()
  372. X{
  373. X    register VIDEO      *vp;
  374. X
  375. X    vp = vscreen[vtrow];
  376. X    while (vtcol < term.t_ncol)
  377. X        vp->v_text[vtcol++] = ' ';
  378. X}
  379. X
  380. X/* upscreen:    user routine to force a screen update
  381. X        always finishes complete update        */
  382. X
  383. Xupscreen(f, n)
  384. X
  385. X{
  386. X    update(TRUE);
  387. X    return(TRUE);
  388. X}
  389. X
  390. X/*
  391. X * Make sure that the display is right. This is a three part process. First,
  392. X * scan through all of the windows looking for dirty ones. Check the framing,
  393. X * and refresh the screen. Second, make sure that "currow" and "curcol" are
  394. X * correct for the current window. Third, make the virtual and physical
  395. X * screens the same.
  396. X */
  397. Xupdate(force)
  398. X
  399. Xint force;    /* force update past type ahead? */
  400. X
  401. X{
  402. X    register WINDOW *wp;
  403. X
  404. X#if    TYPEAH
  405. X    if (force == FALSE && typahead())
  406. X        return(TRUE);
  407. X#endif
  408. X
  409. X    /* update any windows that need refreshing */
  410. X    wp = wheadp;
  411. X    while (wp != NULL) {
  412. X        if (wp->w_flag) {
  413. X            /* if the window has changed, service it */
  414. X            reframe(wp);    /* check the framing */
  415. X            if ((wp->w_flag & ~WFMODE) == WFEDIT)
  416. X                updone(wp);    /* update EDITed line */
  417. X            else if (wp->w_flag & ~WFMOVE)
  418. X                updall(wp);    /* update all lines */
  419. X#if    ~WFDEBUG
  420. X            if (wp->w_flag & WFMODE)
  421. X                modeline(wp);    /* update modeline */
  422. X#endif
  423. X            wp->w_flag = 0;
  424. X            wp->w_force = 0;
  425. X        }
  426. X#if    WFDEBUG
  427. X        modeline();
  428. X#endif
  429. X        /* on to the next window */
  430. X        wp = wp->w_wndp;
  431. X    }
  432. X
  433. X    /* recalc the current hardware cursor location */
  434. X    updpos();
  435. X
  436. X#if    IBMPC
  437. X    /* update the cursor and flush the buffers */
  438. X    movecursor(currow, curcol - lbound);
  439. X#endif
  440. X
  441. X    /* check for lines to de-extend */
  442. X    upddex();
  443. X
  444. X    /* if screen is garbage, re-plot it */
  445. X    if (sgarbf != FALSE)
  446. X        updgar();
  447. X
  448. X    /* update the virtual screen to the physical screen */
  449. X    updupd(force);
  450. X
  451. X    /* update the cursor and flush the buffers */
  452. X    movecursor(currow, curcol - lbound);
  453. X    (*term.t_flush)();
  454. X    return(TRUE);
  455. X}
  456. X
  457. X/*    reframe:    check to see if the cursor is on in the window
  458. X            and re-frame it if needed or wanted        */
  459. X
  460. Xreframe(wp)
  461. X
  462. XWINDOW *wp;
  463. X
  464. X{
  465. X    register LINE *lp;
  466. X    register int i;
  467. X
  468. X    /* if not a requested reframe, check for a needed one */
  469. X    if ((wp->w_flag & WFFORCE) == 0) {
  470. X        lp = wp->w_linep;
  471. X        for (i = 0; i < wp->w_ntrows; i++) {
  472. X
  473. X            /* if the line is in the window, no reframe */
  474. X            if (lp == wp->w_dotp)
  475. X                return(TRUE);
  476. X
  477. X            /* if we are at the end of the file, reframe */
  478. X            if (lp == wp->w_bufp->b_linep)
  479. X                break;
  480. X
  481. X            /* on to the next line */
  482. X            lp = lforw(lp);
  483. X        }
  484. X    }
  485. X
  486. X    /* reaching here, we need a window refresh */
  487. X    i = wp->w_force;
  488. X
  489. X    /* how far back to reframe? */
  490. X    if (i > 0) {        /* only one screen worth of lines max */
  491. X        if (--i >= wp->w_ntrows)
  492. X            i = wp->w_ntrows - 1;
  493. X    } else if (i < 0) {    /* negative update???? */
  494. X        i += wp->w_ntrows;
  495. X        if (i < 0)
  496. X            i = 0;
  497. X    } else
  498. X        i = wp->w_ntrows / 2;
  499. X
  500. X    /* backup to new line at top of window */
  501. X    lp = wp->w_dotp;
  502. X    while (i != 0 && lback(lp) != wp->w_bufp->b_linep) {
  503. X        --i;
  504. X        lp = lback(lp);
  505. X    }
  506. X
  507. X    /* and reset the current line at top of window */
  508. X    wp->w_linep = lp;
  509. X    wp->w_flag |= WFHARD;
  510. X    wp->w_flag &= ~WFFORCE;
  511. X    return(TRUE);
  512. X}
  513. X
  514. X/*    updone:    update the current line    to the virtual screen        */
  515. X
  516. Xupdone(wp)
  517. X
  518. XWINDOW *wp;    /* window to update current line in */
  519. X
  520. X{
  521. X    register LINE *lp;    /* line to update */
  522. X    register int sline;    /* physical screen line to update */
  523. X    register int i;
  524. X
  525. X    /* search down the line we want */
  526. X    lp = wp->w_linep;
  527. X    sline = wp->w_toprow;
  528. X    while (lp != wp->w_dotp) {
  529. X        ++sline;
  530. X        lp = lforw(lp);
  531. X    }
  532. X
  533. X    /* and update the virtual line */
  534. X    vscreen[sline]->v_flag |= VFCHG;
  535. X    vscreen[sline]->v_flag &= ~VFREQ;
  536. X    vtmove(sline, 0);
  537. X    for (i=0; i < llength(lp); ++i)
  538. X        vtputc(lgetc(lp, i));
  539. X#if    COLOR
  540. X    vscreen[sline]->v_rfcolor = wp->w_fcolor;
  541. X    vscreen[sline]->v_rbcolor = wp->w_bcolor;
  542. X#endif
  543. X    vteeol();
  544. X}
  545. X
  546. X/*    updall:    update all the lines in a window on the virtual screen */
  547. X
  548. Xupdall(wp)
  549. X
  550. XWINDOW *wp;    /* window to update lines in */
  551. X
  552. X{
  553. X    register LINE *lp;    /* line to update */
  554. X    register int sline;    /* physical screen line to update */
  555. X    register int i;
  556. X
  557. X    /* search down the lines, updating them */
  558. X    lp = wp->w_linep;
  559. X    sline = wp->w_toprow;
  560. X    while (sline < wp->w_toprow + wp->w_ntrows) {
  561. X
  562. X        /* and update the virtual line */
  563. X        vscreen[sline]->v_flag |= VFCHG;
  564. X        vscreen[sline]->v_flag &= ~VFREQ;
  565. X        vtmove(sline, 0);
  566. X        if (lp != wp->w_bufp->b_linep) {
  567. X            /* if we are not at the end */
  568. X            for (i=0; i < llength(lp); ++i)
  569. X                vtputc(lgetc(lp, i));
  570. X            lp = lforw(lp);
  571. X        }
  572. X
  573. X        /* on to the next one */
  574. X#if    COLOR
  575. X        vscreen[sline]->v_rfcolor = wp->w_fcolor;
  576. X        vscreen[sline]->v_rbcolor = wp->w_bcolor;
  577. X#endif
  578. X        vteeol();
  579. X        ++sline;
  580. X    }
  581. X
  582. X}
  583. X
  584. X/*    updpos:    update the position of the hardware cursor and handle extended
  585. X        lines. This is the only update for simple moves.    */
  586. X
  587. Xupdpos()
  588. X
  589. X{
  590. X    register LINE *lp;
  591. X    register int c;
  592. X    register int i;
  593. X
  594. X    /* find the current row */
  595. X    lp = curwp->w_linep;
  596. X    currow = curwp->w_toprow;
  597. X    while (lp != curwp->w_dotp) {
  598. X        ++currow;
  599. X        lp = lforw(lp);
  600. X    }
  601. X
  602. X    /* find the current column */
  603. X    curcol = 0;
  604. X    i = 0;
  605. X    while (i < curwp->w_doto) {
  606. X        c = lgetc(lp, i++);
  607. X        if (c == '\t')
  608. X            curcol |= 0x07;
  609. X        else
  610. X            if (c < 0x20 || c == 0x7f)
  611. X                ++curcol;
  612. X
  613. X        ++curcol;
  614. X    }
  615. X
  616. X    /* if extended, flag so and update the virtual line image */
  617. X    if (curcol >=  term.t_ncol - 1) {
  618. X        vscreen[currow]->v_flag |= (VFEXT | VFCHG);
  619. X        updext();
  620. X    } else
  621. X        lbound = 0;
  622. X}
  623. X
  624. X/*    upddex:    de-extend any line that derserves it        */
  625. X
  626. Xupddex()
  627. X
  628. X{
  629. X    register WINDOW *wp;
  630. X    register LINE *lp;
  631. X    register int i,j;
  632. X
  633. X    wp = wheadp;
  634. X
  635. X    while (wp != NULL) {
  636. X        lp = wp->w_linep;
  637. X        i = wp->w_toprow;
  638. X
  639. X        while (i < wp->w_toprow + wp->w_ntrows) {
  640. X            if (vscreen[i]->v_flag & VFEXT) {
  641. X                if ((wp != curwp) || (lp != wp->w_dotp) ||
  642. X                   (curcol < term.t_ncol - 1)) {
  643. X                    vtmove(i, 0);
  644. X                    for (j = 0; j < llength(lp); ++j)
  645. X                        vtputc(lgetc(lp, j));
  646. X                    vteeol();
  647. X
  648. X                    /* this line no longer is extended */
  649. X                    vscreen[i]->v_flag &= ~VFEXT;
  650. X                    vscreen[i]->v_flag |= VFCHG;
  651. X                }
  652. X            }
  653. X            lp = lforw(lp);
  654. X            ++i;
  655. X        }
  656. X        /* and onward to the next window */
  657. X        wp = wp->w_wndp;
  658. X    }
  659. X}
  660. X
  661. X/*    updgar:    if the screen is garbage, clear the physical screen and
  662. X        the virtual screen and force a full update        */
  663. X
  664. Xupdgar()
  665. X
  666. X{
  667. X    register char *txt;
  668. X    register int i,j;
  669. X
  670. X    for (i = 0; i < term.t_nrow; ++i) {
  671. X        vscreen[i]->v_flag |= VFCHG;
  672. X#if    REVSTA
  673. X        vscreen[i]->v_flag &= ~VFREV;
  674. X#endif
  675. X#if    COLOR
  676. X        vscreen[i]->v_fcolor = gfcolor;
  677. X        vscreen[i]->v_bcolor = gbcolor;
  678. X#endif
  679. X#if    IBMPC == 0
  680. X        txt = pscreen[i]->v_text;
  681. X        for (j = 0; j < term.t_ncol; ++j)
  682. X            txt[j] = ' ';
  683. X#endif
  684. X    }
  685. X
  686. X    movecursor(0, 0);         /* Erase the screen. */
  687. X    (*term.t_eeop)();
  688. X    sgarbf = FALSE;             /* Erase-page clears */
  689. X    mpresf = FALSE;             /* the message area. */
  690. X#if    COLOR
  691. X    mlerase();            /* needs to be cleared if colored */
  692. X#endif
  693. X}
  694. X
  695. X/*    updupd:    update the physical screen from the virtual screen    */
  696. X
  697. Xupdupd(force)
  698. X
  699. Xint force;    /* forced update flag */
  700. X
  701. X{
  702. X    register VIDEO *vp1;
  703. X    register int i;
  704. X
  705. X    for (i = 0; i < term.t_nrow; ++i) {
  706. X        vp1 = vscreen[i];
  707. X
  708. X        /* for each line that needs to be updated*/
  709. X        if ((vp1->v_flag & VFCHG) != 0) {
  710. X#if    TYPEAH
  711. X            if (force == FALSE && typahead())
  712. X                return(TRUE);
  713. X#endif
  714. X#if    IBMPC
  715. X            updateline(i, vp1);
  716. X#else
  717. X            updateline(i, vp1, pscreen[i]);
  718. X#endif
  719. X        }
  720. X    }
  721. X    return(TRUE);
  722. X}
  723. X
  724. X/*    updext: update the extended line which the cursor is currently
  725. X        on at a column greater than the terminal width. The line
  726. X        will be scrolled right or left to let the user see where
  727. X        the cursor is
  728. X                                */
  729. X
  730. Xupdext()
  731. X
  732. X{
  733. X    register int rcursor;    /* real cursor location */
  734. X    register LINE *lp;    /* pointer to current line */
  735. X    register int j;        /* index into line */
  736. X
  737. X    /* calculate what column the real cursor will end up in */
  738. X    rcursor = ((curcol - term.t_ncol) % term.t_scrsiz) + term.t_margin;
  739. X    lbound = curcol - rcursor + 1;
  740. X
  741. X    /* scan through the line outputing characters to the virtual screen */
  742. X    /* once we reach the left edge                    */
  743. X    vtmove(currow, -lbound);    /* start scanning offscreen */
  744. X    lp = curwp->w_dotp;        /* line to output */
  745. X    for (j=0; j<llength(lp); ++j)    /* until the end-of-line */
  746. X        vtpute(lgetc(lp, j));
  747. X
  748. X    /* truncate the virtual line */
  749. X    vteeol();
  750. X
  751. X    /* and put a '$' in column 1 */
  752. X    vscreen[currow]->v_text[0] = '$';
  753. X}
  754. X
  755. X/*
  756. X * Update a single line. This does not know how to use insert or delete
  757. X * character sequences; we are using VT52 functionality. Update the physical
  758. X * row and column variables. It does try an exploit erase to end of line. The
  759. X * RAINBOW version of this routine uses fast video.
  760. X */
  761. X#if    IBMPC
  762. X/*    UPDATELINE specific code for the IBM-PC and other compatables */
  763. X
  764. Xupdateline(row, vp1)
  765. X
  766. Xint row;        /* row of screen to update */
  767. Xstruct VIDEO *vp1;    /* virtual screen image */
  768. X
  769. X{
  770. X#if    COLOR
  771. X    scwrite(row, vp1->v_text, vp1->v_rfcolor, vp1->v_rbcolor);
  772. X    vp1->v_fcolor = vp1->v_rfcolor;
  773. X    vp1->v_bcolor = vp1->v_rbcolor;
  774. X#else
  775. X    if (vp1->v_flag & VFREQ)
  776. X        scwrite(row, vp1->v_text, 0, 7);
  777. X    else
  778. X        scwrite(row, vp1->v_text, 7, 0);
  779. X#endif
  780. X    vp1->v_flag &= ~(VFCHG | VFCOL);    /* flag this line as changed */
  781. X
  782. X}
  783. X
  784. X#else
  785. X
  786. Xupdateline(row, vp1, vp2)
  787. X
  788. Xint row;        /* row of screen to update */
  789. Xstruct VIDEO *vp1;    /* virtual screen image */
  790. Xstruct VIDEO *vp2;    /* physical screen image */
  791. X
  792. X{
  793. X#if RAINBOW
  794. X/*    UPDATELINE specific code for the DEC rainbow 100 micro    */
  795. X
  796. X    register char *cp1;
  797. X    register char *cp2;
  798. X    register int nch;
  799. X
  800. X    /* since we don't know how to make the rainbow do this, turn it off */
  801. X    flags &= (~VFREV & ~VFREQ);
  802. X
  803. X    cp1 = &vp1->v_text[0];                    /* Use fast video. */
  804. X    cp2 = &vp2->v_text[0];
  805. X    putline(row+1, 1, cp1);
  806. X    nch = term.t_ncol;
  807. X
  808. X    do
  809. X        {
  810. X        *cp2 = *cp1;
  811. X        ++cp2;
  812. X        ++cp1;
  813. X        }
  814. X    while (--nch);
  815. X    *flags &= ~VFCHG;
  816. X#else
  817. X/*    UPDATELINE code for all other versions        */
  818. X
  819. X    register char *cp1;
  820. X    register char *cp2;
  821. X    register char *cp3;
  822. X    register char *cp4;
  823. X    register char *cp5;
  824. X    register int nbflag;    /* non-blanks to the right flag? */
  825. X    int rev;        /* reverse video flag */
  826. X    int req;        /* reverse video request flag */
  827. X
  828. X
  829. X    /* set up pointers to virtual and physical lines */
  830. X    cp1 = &vp1->v_text[0];
  831. X    cp2 = &vp2->v_text[0];
  832. X
  833. X#if    COLOR
  834. X    (*term.t_setfor)(vp1->v_rfcolor);
  835. X    (*term.t_setback)(vp1->v_rbcolor);
  836. X#endif
  837. X
  838. X#if    REVSTA | COLOR
  839. X    /* if we need to change the reverse video status of the
  840. X       current line, we need to re-write the entire line     */
  841. X    rev = (vp1->v_flag & VFREV) == VFREV;
  842. X    req = (vp1->v_flag & VFREQ) == VFREQ;
  843. X    if ((rev != req)
  844. X#if    COLOR
  845. X        || (vp1->v_fcolor != vp1->v_rfcolor) || (vp1->v_bcolor != vp1->v_rbcolor)
  846. X#endif
  847. X            ) {
  848. X        movecursor(row, 0);    /* Go to start of line. */
  849. X        /* set rev video if needed */
  850. X        if (rev != req)
  851. X            (*term.t_rev)(req);
  852. X
  853. X        /* scan through the line and dump it to the screen and
  854. X           the virtual screen array                */
  855. X        cp3 = &vp1->v_text[term.t_ncol];
  856. X        while (cp1 < cp3) {
  857. X            (*term.t_putchar)(*cp1);
  858. X            ++ttcol;
  859. X            *cp2++ = *cp1++;
  860. X        }
  861. X        /* turn rev video off */
  862. X        if (rev != req)
  863. X            (*term.t_rev)(FALSE);
  864. X
  865. X        /* update the needed flags */
  866. X        vp1->v_flag &= ~VFCHG;
  867. X        if (req)
  868. X            vp1->v_flag |= VFREV;
  869. X        else
  870. X            vp1->v_flag &= ~VFREV;
  871. X#if    COLOR
  872. X        vp1->v_fcolor = vp1->v_rfcolor;
  873. X        vp1->v_bcolor = vp1->v_rbcolor;
  874. X#endif
  875. X        return(TRUE);
  876. X    }
  877. X#endif
  878. X
  879. X    /* advance past any common chars at the left */
  880. X    while (cp1 != &vp1->v_text[term.t_ncol] && cp1[0] == cp2[0]) {
  881. X        ++cp1;
  882. X        ++cp2;
  883. X    }
  884. X
  885. X/* This can still happen, even though we only call this routine on changed
  886. X * lines. A hard update is always done when a line splits, a massive
  887. X * change is done, or a buffer is displayed twice. This optimizes out most
  888. X * of the excess updating. A lot of computes are used, but these tend to
  889. X * be hard operations that do a lot of update, so I don't really care.
  890. X */
  891. X    /* if both lines are the same, no update needs to be done */
  892. X    if (cp1 == &vp1->v_text[term.t_ncol])
  893. X        return(TRUE);
  894. X
  895. X    /* find out if there is a match on the right */
  896. X    nbflag = FALSE;
  897. X    cp3 = &vp1->v_text[term.t_ncol];
  898. X    cp4 = &vp2->v_text[term.t_ncol];
  899. X
  900. X    while (cp3[-1] == cp4[-1]) {
  901. X        --cp3;
  902. X        --cp4;
  903. X        if (cp3[0] != ' ')        /* Note if any nonblank */
  904. X            nbflag = TRUE;        /* in right match. */
  905. X    }
  906. X
  907. X    cp5 = cp3;
  908. X
  909. X    /* Erase to EOL ? */
  910. X    if (nbflag == FALSE && eolexist == TRUE && (req != TRUE)) {
  911. X        while (cp5!=cp1 && cp5[-1]==' ')
  912. X            --cp5;
  913. X
  914. X        if (cp3-cp5 <= 3)        /* Use only if erase is */
  915. X            cp5 = cp3;        /* fewer characters. */
  916. X    }
  917. X
  918. X    movecursor(row, cp1 - &vp1->v_text[0]);    /* Go to start of line. */
  919. X#if    REVSTA
  920. X    (*term.t_rev)((vp1->v_flag & VFREV) == VFREV);
  921. X#endif
  922. X
  923. X    while (cp1 != cp5) {        /* Ordinary. */
  924. X        (*term.t_putchar)(*cp1);
  925. X        ++ttcol;
  926. X        *cp2++ = *cp1++;
  927. X    }
  928. X
  929. X    if (cp5 != cp3) {        /* Erase. */
  930. X        (*term.t_eeol)();
  931. X        while (cp1 != cp3)
  932. X            *cp2++ = *cp1++;
  933. X    }
  934. X#if    REVSTA
  935. X    (*term.t_rev)(FALSE);
  936. X#endif
  937. X    vp1->v_flag &= ~VFCHG;        /* flag this line is changed */
  938. X    return(TRUE);
  939. X#endif
  940. X}
  941. X#endif
  942. X
  943. X/*
  944. X * Redisplay the mode line for the window pointed to by the "wp". This is the
  945. X * only routine that has any idea of how the modeline is formatted. You can
  946. X * change the modeline format by hacking at this routine. Called by "update"
  947. X * any time there is a dirty window.
  948. X */
  949. Xmodeline(wp)
  950. X    WINDOW *wp;
  951. X{
  952. X    register char *cp;
  953. X    register int c;
  954. X    register int n;        /* cursor position count */
  955. X    register BUFFER *bp;
  956. X    register i;            /* loop index */
  957. X    register lchar;        /* character to draw line in buffer with */
  958. X    register firstm;        /* is this the first mode? */
  959. X    char tline[NLINE];        /* buffer for part of mode line */
  960. X
  961. X    n = wp->w_toprow+wp->w_ntrows;          /* Location. */
  962. X    vscreen[n]->v_flag |= VFCHG | VFREQ | VFCOL;/* Redraw next time. */
  963. X#if    COLOR
  964. X    vscreen[n]->v_rfcolor = 0;            /* black on */
  965. X    vscreen[n]->v_rbcolor = 7;            /* white.....*/
  966. X#endif
  967. X    vtmove(n, 0);                           /* Seek to right line. */
  968. X    if (wp == curwp)                /* mark the current buffer */
  969. X    lchar = '=';
  970. X    else
  971. X#if    REVSTA
  972. X    if (revexist)
  973. X        lchar = ' ';
  974. X    else
  975. X#endif
  976. X        lchar = '-';
  977. X
  978. X    vtputc(lchar);
  979. X    bp = wp->w_bufp;
  980. X
  981. X    if ((bp->b_flag&BFCHG) != 0)                /* "*" if changed. */
  982. X        vtputc('*');
  983. X    else
  984. X        vtputc(lchar);
  985. X
  986. X    n  = 2;
  987. X    strcpy(tline, " MicroEMACS 3.7 (");        /* Buffer name. */
  988. X
  989. X    /* display the modes */
  990. X
  991. X    firstm = TRUE;
  992. X    for (i = 0; i < NUMMODES; i++)    /* add in the mode flags */
  993. X        if (wp->w_bufp->b_mode & (1 << i)) {
  994. X            if (firstm != TRUE)
  995. X                strcat(tline, " ");
  996. X            firstm = FALSE;
  997. X            strcat(tline, modename[i]);
  998. X        }
  999. X    strcat(tline,") ");
  1000. X
  1001. X    cp = &tline[0];
  1002. X    while ((c = *cp++) != 0)
  1003. X        {
  1004. X        vtputc(c);
  1005. X        ++n;
  1006. X        }
  1007. X
  1008. X#if WFDEBUG
  1009. X    vtputc(lchar);
  1010. X    vtputc((wp->w_flag&WFCOLR) != 0  ? 'C' : lchar);
  1011. X    vtputc((wp->w_flag&WFMODE) != 0  ? 'M' : lchar);
  1012. X    vtputc((wp->w_flag&WFHARD) != 0  ? 'H' : lchar);
  1013. X    vtputc((wp->w_flag&WFEDIT) != 0  ? 'E' : lchar);
  1014. X    vtputc((wp->w_flag&WFMOVE) != 0  ? 'V' : lchar);
  1015. X    vtputc((wp->w_flag&WFFORCE) != 0 ? 'F' : lchar);
  1016. X    vtputc(lchar);
  1017. X    n += 8;
  1018. X#endif
  1019. X
  1020. X    vtputc(lchar);
  1021. X    vtputc(lchar);
  1022. X    vtputc(' ');
  1023. X    n += 3;
  1024. X    cp = &bp->b_bname[0];
  1025. X
  1026. X    while ((c = *cp++) != 0)
  1027. X        {
  1028. X        vtputc(c);
  1029. X        ++n;
  1030. X        }
  1031. X
  1032. X    vtputc(' ');
  1033. X    vtputc(lchar);
  1034. X    vtputc(lchar);
  1035. X    n += 3;
  1036. X
  1037. X    if (bp->b_fname[0] != 0)            /* File name. */
  1038. X        {
  1039. X    vtputc(' ');
  1040. X    ++n;
  1041. X        cp = "File: ";
  1042. X
  1043. X        while ((c = *cp++) != 0)
  1044. X            {
  1045. X            vtputc(c);
  1046. X            ++n;
  1047. X            }
  1048. X
  1049. X        cp = &bp->b_fname[0];
  1050. X
  1051. X        while ((c = *cp++) != 0)
  1052. X            {
  1053. X            vtputc(c);
  1054. X            ++n;
  1055. X            }
  1056. X
  1057. X        vtputc(' ');
  1058. X        ++n;
  1059. X        }
  1060. X
  1061. X    while (n < term.t_ncol)             /* Pad to full width. */
  1062. X        {
  1063. X        vtputc(lchar);
  1064. X        ++n;
  1065. X        }
  1066. X}
  1067. X
  1068. Xupmode()    /* update all the mode lines */
  1069. X
  1070. X{
  1071. X    register WINDOW *wp;
  1072. X
  1073. X    wp = wheadp;
  1074. X    while (wp != NULL) {
  1075. X        wp->w_flag |= WFMODE;
  1076. X        wp = wp->w_wndp;
  1077. X    }
  1078. X}
  1079. X
  1080. X/*
  1081. X * Send a command to the terminal to move the hardware cursor to row "row"
  1082. X * and column "col". The row and column arguments are origin 0. Optimize out
  1083. X * random calls. Update "ttrow" and "ttcol".
  1084. X */
  1085. Xmovecursor(row, col)
  1086. X    {
  1087. X    if (row!=ttrow || col!=ttcol)
  1088. X        {
  1089. X        ttrow = row;
  1090. X        ttcol = col;
  1091. X        (*term.t_move)(row, col);
  1092. X        }
  1093. X    }
  1094. X
  1095. X/*
  1096. X * Erase the message line. This is a special routine because the message line
  1097. X * is not considered to be part of the virtual screen. It always works
  1098. X * immediately; the terminal buffer is flushed via a call to the flusher.
  1099. X */
  1100. Xmlerase()
  1101. X    {
  1102. X    int i;
  1103. X    
  1104. X    movecursor(term.t_nrow, 0);
  1105. X#if    COLOR
  1106. X     (*term.t_setfor)(7);
  1107. X     (*term.t_setback)(0);
  1108. X#endif
  1109. X    if (eolexist == TRUE)
  1110. X        (*term.t_eeol)();
  1111. X    else {
  1112. X        for (i = 0; i < term.t_ncol - 1; i++)
  1113. X            (*term.t_putchar)(' ');
  1114. X        movecursor(term.t_nrow, 1);    /* force the move! */
  1115. X        movecursor(term.t_nrow, 0);
  1116. X    }
  1117. X    (*term.t_flush)();
  1118. X    mpresf = FALSE;
  1119. X    }
  1120. X
  1121. X/*
  1122. X * Write a message into the message line. Keep track of the physical cursor
  1123. X * position. A small class of printf like format items is handled. Assumes the
  1124. X * stack grows down; this assumption is made by the "++" in the argument scan
  1125. X * loop. Set the "message line" flag TRUE.
  1126. X */
  1127. X
  1128. Xmlwrite(fmt, arg)
  1129. X    char *fmt;
  1130. X    {
  1131. X    register int c;
  1132. X    register char *ap;
  1133. X
  1134. X#if    COLOR
  1135. X    (*term.t_setfor)(7);
  1136. X    (*term.t_setback)(0);
  1137. X#endif
  1138. X    if (eolexist == FALSE) {
  1139. X        mlerase();
  1140. X        (*term.t_flush)();
  1141. X    }
  1142. X
  1143. X    movecursor(term.t_nrow, 0);
  1144. X    ap = (char *) &arg;
  1145. X    while ((c = *fmt++) != 0) {
  1146. X        if (c != '%') {
  1147. X            (*term.t_putchar)(c);
  1148. X            ++ttcol;
  1149. X            }
  1150. X        else
  1151. X            {
  1152. X            c = *fmt++;
  1153. X            switch (c) {
  1154. X                case 'd':
  1155. X                    mlputi(*(int *)ap, 10);
  1156. X                    ap += sizeof(int);
  1157. X                    break;
  1158. X
  1159. X                case 'o':
  1160. X                    mlputi(*(int *)ap,  8);
  1161. X                    ap += sizeof(int);
  1162. X                    break;
  1163. X
  1164. X                case 'x':
  1165. X                    mlputi(*(int *)ap, 16);
  1166. X                    ap += sizeof(int);
  1167. X                    break;
  1168. X
  1169. X                case 'D':
  1170. X                    mlputli(*(long *)ap, 10);
  1171. X                    ap += sizeof(long);
  1172. X                    break;
  1173. X
  1174. X                case 's':
  1175. X                    mlputs(*(char **)ap);
  1176. X                    ap += sizeof(char *);
  1177. X                    break;
  1178. X
  1179. X        case 'f':
  1180. X            mlputf(*(int *)ap);
  1181. X            ap += sizeof(int);
  1182. X            break;
  1183. X
  1184. X                default:
  1185. X                    (*term.t_putchar)(c);
  1186. X                    ++ttcol;
  1187. X                }
  1188. X            }
  1189. X        }
  1190. X    if (eolexist == TRUE)
  1191. X        (*term.t_eeol)();
  1192. X    (*term.t_flush)();
  1193. X    mpresf = TRUE;
  1194. X    }
  1195. X
  1196. X/*
  1197. X * Write out a string. Update the physical cursor position. This assumes that
  1198. X * the characters in the string all have width "1"; if this is not the case
  1199. X * things will get screwed up a little.
  1200. X */
  1201. Xmlputs(s)
  1202. X    char *s;
  1203. X    {
  1204. X    register int c;
  1205. X
  1206. X    while ((c = *s++) != 0)
  1207. X        {
  1208. X        (*term.t_putchar)(c);
  1209. X        ++ttcol;
  1210. X        }
  1211. X    }
  1212. X
  1213. X/*
  1214. X * Write out an integer, in the specified radix. Update the physical cursor
  1215. X * position.
  1216. X */
  1217. Xmlputi(i, r)
  1218. X    {
  1219. X    register int q;
  1220. X    static char hexdigits[] = "0123456789ABCDEF";
  1221. X
  1222. X    if (i < 0)
  1223. X        {
  1224. X        i = -i;
  1225. X        (*term.t_putchar)('-');
  1226. X        }
  1227. X
  1228. X    q = i/r;
  1229. X
  1230. X    if (q != 0)
  1231. X        mlputi(q, r);
  1232. X
  1233. X    (*term.t_putchar)(hexdigits[i%r]);
  1234. X    ++ttcol;
  1235. X    }
  1236. X
  1237. X/*
  1238. X * do the same except as a long integer.
  1239. X */
  1240. Xmlputli(l, r)
  1241. X    long l;
  1242. X    {
  1243. X    register long q;
  1244. X
  1245. X    if (l < 0)
  1246. X        {
  1247. X        l = -l;
  1248. X        (*term.t_putchar)('-');
  1249. X        }
  1250. X
  1251. X    q = l/r;
  1252. X
  1253. X    if (q != 0)
  1254. X        mlputli(q, r);
  1255. X
  1256. X    (*term.t_putchar)((int)(l%r)+'0');
  1257. X    ++ttcol;
  1258. X    }
  1259. X
  1260. X/*
  1261. X *    write out a scaled integer with two decimal places
  1262. X */
  1263. X
  1264. Xmlputf(s)
  1265. X
  1266. Xint s;    /* scaled integer to output */
  1267. X
  1268. X{
  1269. X    int i;    /* integer portion of number */
  1270. X    int f;    /* fractional portion of number */
  1271. X
  1272. X    /* break it up */
  1273. X    i = s / 100;
  1274. X    f = s % 100;
  1275. X
  1276. X    /* send out the integer portion */
  1277. X    mlputi(i, 10);
  1278. X    (*term.t_putchar)('.');
  1279. X    (*term.t_putchar)((f / 10) + '0');
  1280. X    (*term.t_putchar)((f % 10) + '0');
  1281. X    ttcol += 3;
  1282. X}    
  1283. X
  1284. X#if RAINBOW
  1285. X
  1286. Xputline(row, col, buf)
  1287. X    int row, col;
  1288. X    char buf[];
  1289. X    {
  1290. X    int n;
  1291. X
  1292. X    n = strlen(buf);
  1293. X    if (col + n - 1 > term.t_ncol)
  1294. X        n = term.t_ncol - col + 1;
  1295. X    Put_Data(row, col, n, buf);
  1296. X    }
  1297. X#endif
  1298. X
  1299. FRIDAY_NIGHT
  1300. echo extracting - ebind.h
  1301. sed 's/^X//' > ebind.h << 'FRIDAY_NIGHT'
  1302. X/*    EBIND:        Initial default key to function bindings for
  1303. X            MicroEMACS 3.7
  1304. X*/
  1305. X
  1306. X/*
  1307. X * Command table.
  1308. X * This table  is *roughly* in ASCII order, left to right across the
  1309. X * characters of the command. This expains the funny location of the
  1310. X * control-X commands.
  1311. X */
  1312. XKEYTAB  keytab[NBINDS] = {
  1313. X    {CTRL|'A',        gotobol},
  1314. X    {CTRL|'B',        backchar},
  1315. X    {CTRL|'C',        insspace},
  1316. X    {CTRL|'D',        forwdel},
  1317. X    {CTRL|'E',        gotoeol},
  1318. X    {CTRL|'F',        forwchar},
  1319. X    {CTRL|'G',        ctrlg},
  1320. X    {CTRL|'H',        backdel},
  1321. X    {CTRL|'I',        tab},
  1322. X    {CTRL|'J',        indent},
  1323. X    {CTRL|'K',        killtext},
  1324. X    {CTRL|'L',        refresh},
  1325. X    {CTRL|'M',        newline},
  1326. X    {CTRL|'N',        forwline},
  1327. X    {CTRL|'O',        openline},
  1328. X    {CTRL|'P',        backline},
  1329. X    {CTRL|'Q',        quote},
  1330. X    {CTRL|'R',        backsearch},
  1331. X    {CTRL|'S',        forwsearch},
  1332. X    {CTRL|'T',        twiddle},
  1333. X    {CTRL|'V',        forwpage},
  1334. X    {CTRL|'W',        killregion},
  1335. X    {CTRL|'X',        cex},
  1336. X    {CTRL|'Y',        yank},
  1337. X    {CTRL|'Z',        backpage},
  1338. X    {CTRL|']',        meta},
  1339. X    {CTLX|CTRL|'B',        listbuffers},
  1340. X    {CTLX|CTRL|'C',        quit},          /* Hard quit.           */
  1341. X    {CTLX|CTRL|'F',        filefind},
  1342. X    {CTLX|CTRL|'I',        insfile},
  1343. X    {CTLX|CTRL|'L',        lowerregion},
  1344. X    {CTLX|CTRL|'M',        delmode},
  1345. X    {CTLX|CTRL|'N',        mvdnwind},
  1346. X    {CTLX|CTRL|'O',        deblank},
  1347. X    {CTLX|CTRL|'P',        mvupwind},
  1348. X    {CTLX|CTRL|'R',        fileread},
  1349. X    {CTLX|CTRL|'S',        filesave},
  1350. X    {CTLX|CTRL|'U',        upperregion},
  1351. X    {CTLX|CTRL|'V',        viewfile},
  1352. X    {CTLX|CTRL|'W',        filewrite},
  1353. X    {CTLX|CTRL|'X',        swapmark},
  1354. X    {CTLX|CTRL|'Z',        shrinkwind},
  1355. X    {CTLX|'?',        deskey},
  1356. X    {CTLX|'!',        spawn},
  1357. X    {CTLX|'@',        pipe},
  1358. X    {CTLX|'#',        filter},
  1359. X    {CTLX|'=',        showcpos},
  1360. X    {CTLX|'(',        ctlxlp},
  1361. X    {CTLX|')',        ctlxrp},
  1362. X    {CTLX|'^',        enlargewind},
  1363. X    {CTLX|'0',        delwind},
  1364. X    {CTLX|'1',        onlywind},
  1365. X    {CTLX|'2',        splitwind},
  1366. X    {CTLX|'B',        usebuffer},
  1367. X    {CTLX|'C',        spawncli},
  1368. X#if    BSD
  1369. X    {CTLX|'D',        bktoshell},
  1370. X#endif
  1371. X    {CTLX|'E',        ctlxe},
  1372. X    {CTLX|'F',        setfillcol},
  1373. X    {CTLX|'K',        killbuffer},
  1374. X    {CTLX|'M',        setmode},
  1375. X    {CTLX|'N',        filename},
  1376. X    {CTLX|'O',        nextwind},
  1377. X    {CTLX|'P',        prevwind},
  1378. X#if    ISRCH
  1379. X    {CTLX|'R',        risearch},
  1380. X    {CTLX|'S',        fisearch},
  1381. X#endif
  1382. X    {CTLX|'W',        resize},
  1383. X    {CTLX|'X',        nextbuffer},
  1384. X    {CTLX|'Z',        enlargewind},
  1385. X#if    WORDPRO
  1386. X    {META|CTRL|'C',        wordcount},
  1387. X#endif
  1388. X    {META|CTRL|'H',        delbword},
  1389. X    {META|CTRL|'K',        unbindkey},
  1390. X    {META|CTRL|'L',        reposition},
  1391. X    {META|CTRL|'M',        delgmode},
  1392. X    {META|CTRL|'N',        namebuffer},
  1393. X    {META|CTRL|'R',        qreplace},
  1394. X    {META|CTRL|'V',        scrnextdw},
  1395. X#if    WORDPRO
  1396. X    {META|CTRL|'W',        killpara},
  1397. X#endif
  1398. X    {META|CTRL|'Z',        scrnextup},
  1399. X    {META|' ',        setmark},
  1400. X    {META|'?',        help},
  1401. X    {META|'!',        reposition},
  1402. X    {META|'.',        setmark},
  1403. X    {META|'>',        gotoeob},
  1404. X    {META|'<',        gotobob},
  1405. X    {META|'~',        unmark},
  1406. X    {META|'B',        backword},
  1407. X    {META|'C',        capword},
  1408. X    {META|'D',        delfword},
  1409. X    {META|'F',        forwword},
  1410. X    {META|'G',        gotoline},
  1411. X    {META|'K',        bindtokey},
  1412. X    {META|'L',        lowerword},
  1413. X    {META|'M',        setgmode},
  1414. X#if    WORDPRO
  1415. X    {META|'N',        gotoeop},
  1416. X    {META|'P',        gotobop},
  1417. X    {META|'Q',        fillpara},
  1418. X#endif
  1419. X    {META|'R',        sreplace},
  1420. X#if    BSD
  1421. X    {META|'S',        bktoshell},
  1422. X#endif
  1423. X    {META|'U',        upperword},
  1424. X    {META|'V',        backpage},
  1425. X    {META|'W',        copyregion},
  1426. X    {META|'X',        namedcmd},
  1427. X    {META|'Z',        quickexit},
  1428. X    {META|0x7F,              delbword},
  1429. X
  1430. X#if    MSDOS & (HP150 == 0) & (WANGPC == 0)
  1431. X    {SPEC|CTRL|'_',        forwhunt},
  1432. X    {SPEC|CTRL|'S',        backhunt},
  1433. X    {SPEC|71,        gotobob},
  1434. X    {SPEC|72,        backline},
  1435. X    {SPEC|73,        backpage},
  1436. X    {SPEC|75,        backchar},
  1437. X    {SPEC|77,        forwchar},
  1438. X    {SPEC|79,        gotoeob},
  1439. X    {SPEC|80,        forwline},
  1440. X    {SPEC|81,        forwpage},
  1441. X    {SPEC|82,        insspace},
  1442. X    {SPEC|83,        forwdel},
  1443. X    {SPEC|115,        backword},
  1444. X    {SPEC|116,        forwword},
  1445. X    {SPEC|132,        gotobop},
  1446. X    {SPEC|118,        gotoeop},
  1447. X    {SPEC|84,        cbuf1},
  1448. X    {SPEC|85,        cbuf2},
  1449. X    {SPEC|86,        cbuf3},
  1450. X    {SPEC|87,        cbuf4},
  1451. X    {SPEC|88,        cbuf5},
  1452. X    {SPEC|89,        cbuf6},
  1453. X    {SPEC|90,        cbuf7},
  1454. X    {SPEC|91,        cbuf8},
  1455. X    {SPEC|92,        cbuf9},
  1456. X    {SPEC|93,        cbuf10},
  1457. X#endif
  1458. X
  1459. X#if    HP150
  1460. X    {SPEC|32,        backline},
  1461. X    {SPEC|33,        forwline},
  1462. X    {SPEC|35,        backchar},
  1463. X    {SPEC|34,        forwchar},
  1464. X    {SPEC|44,        gotobob},
  1465. X    {SPEC|46,        forwpage},
  1466. X    {SPEC|47,        backpage},
  1467. X    {SPEC|82,        nextwind},
  1468. X    {SPEC|68,        openline},
  1469. X    {SPEC|69,        killtext},
  1470. X    {SPEC|65,        forwdel},
  1471. X    {SPEC|64,        ctlxe},
  1472. X    {SPEC|67,        refresh},
  1473. X    {SPEC|66,        reposition},
  1474. X    {SPEC|83,        help},
  1475. X    {SPEC|81,        deskey},
  1476. X#endif
  1477. X
  1478. X#if    AMIGA
  1479. X    {SPEC|'?',        help},
  1480. X    {SPEC|'A',        backline},
  1481. X    {SPEC|'B',        forwline},
  1482. X    {SPEC|'C',        forwchar},
  1483. X    {SPEC|'D',        backchar},
  1484. X    {SPEC|'T',        backpage},
  1485. X    {SPEC|'S',        forwpage},
  1486. X    {SPEC|'a',        backword},
  1487. X    {SPEC|'`',        forwword},
  1488. X    {SPEC|'P',        cbuf1},
  1489. X    {SPEC|'Q',        cbuf2},
  1490. X    {SPEC|'R',        cbuf3},
  1491. X    {SPEC|'S',        cbuf4},
  1492. X    {SPEC|'T',        cbuf5},
  1493. X    {SPEC|'U',        cbuf6},
  1494. X    {SPEC|'V',        cbuf7},
  1495. X    {SPEC|'W',        cbuf8},
  1496. X    {SPEC|'X',        cbuf9},
  1497. X    {SPEC|'Y',        cbuf10},
  1498. X
  1499. X#endif
  1500. X
  1501. X#if  WANGPC
  1502. X    SPEC|0xE0,              quit,           /* Cancel */
  1503. X    SPEC|0xE1,              help,           /* Help */
  1504. X    SPEC|0xF1,              help,           /* ^Help */
  1505. X    SPEC|0xE3,              ctrlg,          /* Print */
  1506. X    SPEC|0xF3,              ctrlg,          /* ^Print */
  1507. X    SPEC|0xC0,              backline,       /* North */
  1508. X    SPEC|0xD0,              gotobob,        /* ^North */
  1509. X    SPEC|0xC1,              forwchar,       /* East */
  1510. X    SPEC|0xD1,              gotoeol,        /* ^East */
  1511. X    SPEC|0xC2,              forwline,       /* South */
  1512. X    SPEC|0xD2,              gotobop,        /* ^South */
  1513. X    SPEC|0xC3,              backchar,       /* West */
  1514. X    SPEC|0xD3,              gotobol,        /* ^West */
  1515. X    SPEC|0xC4,              ctrlg,          /* Home */
  1516. X    SPEC|0xD4,              gotobob,        /* ^Home */
  1517. X    SPEC|0xC5,              filesave,       /* Execute */
  1518. X    SPEC|0xD5,              ctrlg,          /* ^Execute */
  1519. X    SPEC|0xC6,              insfile,        /* Insert */
  1520. X    SPEC|0xD6,              ctrlg,          /* ^Insert */
  1521. X    SPEC|0xC7,              forwdel,        /* Delete */
  1522. X    SPEC|0xD7,              killregion,     /* ^Delete */
  1523. X    SPEC|0xC8,              backpage,       /* Previous */
  1524. X    SPEC|0xD8,              prevwind,       /* ^Previous */
  1525. X    SPEC|0xC9,              forwpage,       /* Next */
  1526. X    SPEC|0xD9,              nextwind,       /* ^Next */
  1527. X    SPEC|0xCB,              ctrlg,          /* Erase */
  1528. X    SPEC|0xDB,              ctrlg,          /* ^Erase */
  1529. X    SPEC|0xDC,              ctrlg,          /* ^Tab */
  1530. X    SPEC|0xCD,              ctrlg,          /* BackTab */
  1531. X    SPEC|0xDD,              ctrlg,          /* ^BackTab */
  1532. X    SPEC|0x80,              ctrlg,          /* Indent */
  1533. X    SPEC|0x90,              ctrlg,          /* ^Indent */
  1534. X    SPEC|0x81,              ctrlg,          /* Page */
  1535. X    SPEC|0x91,              ctrlg,          /* ^Page */
  1536. X    SPEC|0x82,              ctrlg,          /* Center */
  1537. X    SPEC|0x92,              ctrlg,          /* ^Center */
  1538. X    SPEC|0x83,              ctrlg,          /* DecTab */
  1539. X    SPEC|0x93,              ctrlg,          /* ^DecTab */
  1540. X    SPEC|0x84,              ctrlg,          /* Format */
  1541. X    SPEC|0x94,              ctrlg,          /* ^Format */
  1542. X    SPEC|0x85,              ctrlg,          /* Merge */
  1543. X    SPEC|0x95,              ctrlg,          /* ^Merge */
  1544. X    SPEC|0x86,              setmark,        /* Note */
  1545. X    SPEC|0x96,              ctrlg,          /* ^Note */
  1546. X    SPEC|0x87,              ctrlg,          /* Stop */
  1547. X    SPEC|0x97,              ctrlg,          /* ^Stop */
  1548. X    SPEC|0x88,              forwsearch,     /* Srch */
  1549. X    SPEC|0x98,              backsearch,     /* ^Srch */
  1550. X    SPEC|0x89,              sreplace,       /* Replac */
  1551. X    SPEC|0x99,              qreplace,       /* ^Replac */
  1552. X    SPEC|0x8A,              ctrlg,          /* Copy */
  1553. X    SPEC|0x9A,              ctrlg,          /* ^Copy */
  1554. X    SPEC|0x8B,              ctrlg,          /* Move */
  1555. X    SPEC|0x9B,              ctrlg,          /* ^Move */
  1556. X    SPEC|0x8C,              namedcmd,       /* Command */
  1557. X    SPEC|0x9C,              spawn,          /* ^Command */
  1558. X    SPEC|0x8D,              ctrlg,          /* ^ */
  1559. X    SPEC|0x9D,              ctrlg,          /* ^^ */
  1560. X    SPEC|0x8E,              ctrlg,          /* Blank */
  1561. X    SPEC|0x9E,              ctrlg,          /* ^Blank */
  1562. X    SPEC|0x8F,              gotoline,       /* GoTo */
  1563. X    SPEC|0x9F,              usebuffer,      /* ^GoTo */
  1564. X#endif
  1565. X    {0x7F,            backdel},
  1566. X    {0,            NULL}
  1567. X};
  1568. X
  1569. X#if RAINBOW
  1570. X
  1571. X#include "rainbow.h"
  1572. X
  1573. X/*
  1574. X * Mapping table from the LK201 function keys to the internal EMACS character.
  1575. X */
  1576. X
  1577. Xshort lk_map[][2] = {
  1578. X    Up_Key,                         CTRL+'P',
  1579. X    Down_Key,                       CTRL+'N',
  1580. X    Left_Key,                       CTRL+'B',
  1581. X    Right_Key,                      CTRL+'F',
  1582. X    Shift+Left_Key,                 META+'B',
  1583. X    Shift+Right_Key,                META+'F',
  1584. X    Control+Left_Key,               CTRL+'A',
  1585. X    Control+Right_Key,              CTRL+'E',
  1586. X    Prev_Scr_Key,                   META+'V',
  1587. X    Next_Scr_Key,                   CTRL+'V',
  1588. X    Shift+Up_Key,                   META+'<',
  1589. X    Shift+Down_Key,                 META+'>',
  1590. X    Cancel_Key,                     CTRL+'G',
  1591. X    Find_Key,                       CTRL+'S',
  1592. X    Shift+Find_Key,                 CTRL+'R',
  1593. X    Insert_Key,                     CTRL+'Y',
  1594. X    Options_Key,                    CTRL+'D',
  1595. X    Shift+Options_Key,              META+'D',
  1596. X    Remove_Key,                     CTRL+'W',
  1597. X    Shift+Remove_Key,               META+'W',
  1598. X    Select_Key,                     CTRL+'@',
  1599. X    Shift+Select_Key,               CTLX+CTRL+'X',
  1600. X    Interrupt_Key,                  CTRL+'U',
  1601. X    Keypad_PF2,                     META+'L',
  1602. X    Keypad_PF3,                     META+'C',
  1603. X    Keypad_PF4,                     META+'U',
  1604. X    Shift+Keypad_PF2,               CTLX+CTRL+'L',
  1605. X    Shift+Keypad_PF4,               CTLX+CTRL+'U',
  1606. X    Keypad_1,                       CTLX+'1',
  1607. X    Keypad_2,                       CTLX+'2',
  1608. X    Do_Key,                         CTLX+'E',
  1609. X    Keypad_4,                       CTLX+CTRL+'B',
  1610. X    Keypad_5,                       CTLX+'B',
  1611. X    Keypad_6,                       CTLX+'K',
  1612. X    Resume_Key,                     META+'!',
  1613. X    Control+Next_Scr_Key,           CTLX+'N',
  1614. X    Control+Prev_Scr_Key,           CTLX+'P',
  1615. X    Control+Up_Key,                 CTLX+CTRL+'P',
  1616. X    Control+Down_Key,               CTLX+CTRL+'N',
  1617. X    Help_Key,                       CTLX+'=',
  1618. X    Shift+Do_Key,                   CTLX+'(',
  1619. X    Control+Do_Key,                 CTLX+')',
  1620. X    Keypad_0,                       CTLX+'Z',
  1621. X    Shift+Keypad_0,                 CTLX+CTRL+'Z',
  1622. X    Main_Scr_Key,                   CTRL+'C',
  1623. X    Keypad_Enter,                   CTLX+'!',
  1624. X    Exit_Key,                       CTLX+CTRL+'C',
  1625. X    Shift+Exit_Key,                 CTRL+'Z'
  1626. X};
  1627. X
  1628. X#define lk_map_size     (sizeof(lk_map)/2)
  1629. X#endif
  1630. X
  1631. FRIDAY_NIGHT
  1632. echo es.2 completed!
  1633. : That's all folks!
  1634.  
  1635.