home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume4 / uemacs3.6 / part3 < prev    next >
Text File  |  1986-11-30  |  38KB  |  1,164 lines

  1. Subject: MicroEMACS 3.6 (Part 3 of 8)
  2. Newsgroups: mod.sources
  3. Approved: jpn@panda.UUCP
  4.  
  5. Mod.sources:  Volume 4, Issue 100
  6. Submitted by: genrad!decvax!ihnp4!itivax!duncan!lawrence
  7.  
  8. echo x - ebind.h
  9. sed 's/^X//' >ebind.h <<'*-*-END-of-ebind.h-*-*'
  10. X/*    EBIND:        Initial default key to function bindings for
  11. X            MicroEMACS 3.2
  12. X
  13. X            written by Dave G. Conroy
  14. X            modified by Steve Wilhite, George Jones
  15. X            greatly modified by Daniel Lawrence
  16. X*/
  17. X
  18. X/*
  19. X * Command table.
  20. X * This table  is *roughly* in ASCII order, left to right across the
  21. X * characters of the command. This expains the funny location of the
  22. X * control-X commands.
  23. X */
  24. XKEYTAB  keytab[NBINDS] = {
  25. X    {CTRL|'A',        gotobol},
  26. X    {CTRL|'B',        backchar},
  27. X    {CTRL|'C',        insspace},
  28. X    {CTRL|'D',        forwdel},
  29. X    {CTRL|'E',        gotoeol},
  30. X    {CTRL|'F',        forwchar},
  31. X    {CTRL|'G',        ctrlg},
  32. X    {CTRL|'H',        backdel},
  33. X    {CTRL|'I',        tab},
  34. X    {CTRL|'J',        indent},
  35. X    {CTRL|'K',        killtext},
  36. X    {CTRL|'L',        refresh},
  37. X    {CTRL|'M',        newline},
  38. X    {CTRL|'N',        forwline},
  39. X    {CTRL|'O',        openline},
  40. X    {CTRL|'P',        backline},
  41. X    {CTRL|'Q',        quote},
  42. X    {CTRL|'R',        backsearch},
  43. X    {CTRL|'S',        forwsearch},
  44. X    {CTRL|'T',        twiddle},
  45. X    {CTRL|'V',        forwpage},
  46. X    {CTRL|'W',        killregion},
  47. X    {CTRL|'Y',        yank},
  48. X    {CTRL|'Z',        backpage},
  49. X    {CTLX|CTRL|'B',        listbuffers},
  50. X    {CTLX|CTRL|'C',        quit},          /* Hard quit.           */
  51. X    {CTLX|CTRL|'F',        filefind},
  52. X    {CTLX|CTRL|'I',        insfile},
  53. X    {CTLX|CTRL|'L',        lowerregion},
  54. X    {CTLX|CTRL|'M',        delmode},
  55. X    {CTLX|CTRL|'N',        mvdnwind},
  56. X    {CTLX|CTRL|'O',        deblank},
  57. X    {CTLX|CTRL|'P',        mvupwind},
  58. X    {CTLX|CTRL|'R',        fileread},
  59. X    {CTLX|CTRL|'S',        filesave},
  60. X    {CTLX|CTRL|'U',        upperregion},
  61. X    {CTLX|CTRL|'V',        viewfile},
  62. X    {CTLX|CTRL|'W',        filewrite},
  63. X    {CTLX|CTRL|'X',        swapmark},
  64. X    {CTLX|CTRL|'Z',        shrinkwind},
  65. X    {CTLX|'?',        deskey},
  66. X    {CTLX|'!',        spawn},         /* Run 1 command.       */
  67. X    {CTLX|'=',        showcpos},
  68. X    {CTLX|'(',        ctlxlp},
  69. X    {CTLX|')',        ctlxrp},
  70. X    {CTLX|'^',        enlargewind},
  71. X    {CTLX|'1',        onlywind},
  72. X    {CTLX|'2',        splitwind},
  73. X    {CTLX|'B',        usebuffer},
  74. X    {CTLX|'C',        spawncli},      /* Run CLI in subjob.   */
  75. X#if    V7 & BSD
  76. X    {CTLX|'D',        bktoshell},    /* suspend emacs */
  77. X#endif
  78. X    {CTLX|'E',        ctlxe},
  79. X    {CTLX|'F',        setfillcol},
  80. X    {CTLX|'K',        killbuffer},
  81. X    {CTLX|'M',        setmode},
  82. X    {CTLX|'N',        filename},
  83. X    {CTLX|'O',        nextwind},
  84. X    {CTLX|'P',        prevwind},
  85. X    {CTLX|'S',        filesave},
  86. X    {CTLX|'X',        nextbuffer},
  87. X    {CTLX|'Z',        enlargewind},
  88. X    {META|CTRL|'H',        delbword},
  89. X    {META|CTRL|'K',        unbindkey},
  90. X    {META|CTRL|'L',        reposition},
  91. X    {META|CTRL|'M',        delgmode},
  92. X    {META|CTRL|'N',        namebuffer},
  93. X    {META|CTRL|'R',        qreplace},
  94. X    {META|CTRL|'V',        scrnextdw},
  95. X    {META|CTRL|'W',        killpara},
  96. X    {META|CTRL|'Z',        scrnextup},
  97. X    {META|' ',        setmark},
  98. X    {META|'?',        help},
  99. X    {META|'!',        reposition},
  100. X    {META|'.',        setmark},
  101. X    {META|'>',        gotoeob},
  102. X    {META|'<',        gotobob},
  103. X    {META|'B',        backword},
  104. X    {META|'C',        capword},
  105. X    {META|'D',        delfword},
  106. X    {META|'F',        forwword},
  107. X    {META|'G',        gotoline},
  108. X    {META|'K',        bindtokey},
  109. X    {META|'L',        lowerword},
  110. X    {META|'M',        setgmode},
  111. X    {META|'N',        gotoeop},
  112. X    {META|'P',        gotobop},
  113. X    {META|'Q',        fillpara},
  114. X    {META|'R',        sreplace},
  115. X#if    V7 & BSD
  116. X    {META|'S',        bktoshell},
  117. X#endif
  118. X    {META|'U',        upperword},
  119. X    {META|'V',        backpage},
  120. X    {META|'W',        copyregion},
  121. X    {META|'X',        namedcmd},
  122. X    {META|'Z',        quickexit},
  123. X    {META|0x7F,              delbword},
  124. X
  125. X#if    MSDOS & (HP150 == 0)
  126. X    {SPEC|CTRL|'_',        forwhunt},
  127. X    {SPEC|CTRL|'S',        backhunt},
  128. X    {SPEC|71,        gotobob},
  129. X    {SPEC|72,        backline},
  130. X    {SPEC|73,        backpage},
  131. X    {SPEC|75,        backchar},
  132. X    {SPEC|77,        forwchar},
  133. X    {SPEC|79,        gotoeob},
  134. X    {SPEC|80,        forwline},
  135. X    {SPEC|81,        forwpage},
  136. X    {SPEC|82,        insspace},
  137. X    {SPEC|83,        forwdel},
  138. X    {SPEC|115,        backword},
  139. X    {SPEC|116,        forwword},
  140. X    {SPEC|132,        gotobop},
  141. X    {SPEC|118,        gotoeop},
  142. X#endif
  143. X
  144. X#if    HP150
  145. X    {SPEC|32,        backline},
  146. X    {SPEC|33,        forwline},
  147. X    {SPEC|35,        backchar},
  148. X    {SPEC|34,        forwchar},
  149. X    {SPEC|44,        gotobob},
  150. X    {SPEC|46,        forwpage},
  151. X    {SPEC|47,        backpage},
  152. X    {SPEC|82,        nextwind},
  153. X    {SPEC|68,        openline},
  154. X    {SPEC|69,        killtext},
  155. X    {SPEC|65,        forwdel},
  156. X    {SPEC|64,        ctlxe},
  157. X    {SPEC|67,        refresh},
  158. X    {SPEC|66,        reposition},
  159. X    {SPEC|83,        help},
  160. X    {SPEC|81,        deskey},
  161. X#endif
  162. X
  163. X#if    AMIGA
  164. X    {SPEC|'?',        help},
  165. X    {SPEC|'A',        backline},
  166. X    {SPEC|'B',        forwline},
  167. X    {SPEC|'C',        forwchar},
  168. X    {SPEC|'D',        backchar},
  169. X    {SPEC|'T',        backpage},
  170. X    {SPEC|'S',        forwpage},
  171. X    {SPEC|'a',        backword},
  172. X    {SPEC|'`',        forwword},
  173. X#endif
  174. X
  175. X    {0x7F,            backdel},
  176. X    {0,            NULL}
  177. X};
  178. X
  179. X#if RAINBOW
  180. X
  181. X#include "rainbow.h"
  182. X
  183. X/*
  184. X * Mapping table from the LK201 function keys to the internal EMACS character.
  185. X */
  186. X
  187. Xshort lk_map[][2] = {
  188. X    Up_Key,                         CTRL+'P',
  189. X    Down_Key,                       CTRL+'N',
  190. X    Left_Key,                       CTRL+'B',
  191. X    Right_Key,                      CTRL+'F',
  192. X    Shift+Left_Key,                 META+'B',
  193. X    Shift+Right_Key,                META+'F',
  194. X    Control+Left_Key,               CTRL+'A',
  195. X    Control+Right_Key,              CTRL+'E',
  196. X    Prev_Scr_Key,                   META+'V',
  197. X    Next_Scr_Key,                   CTRL+'V',
  198. X    Shift+Up_Key,                   META+'<',
  199. X    Shift+Down_Key,                 META+'>',
  200. X    Cancel_Key,                     CTRL+'G',
  201. X    Find_Key,                       CTRL+'S',
  202. X    Shift+Find_Key,                 CTRL+'R',
  203. X    Insert_Key,                     CTRL+'Y',
  204. X    Options_Key,                    CTRL+'D',
  205. X    Shift+Options_Key,              META+'D',
  206. X    Remove_Key,                     CTRL+'W',
  207. X    Shift+Remove_Key,               META+'W',
  208. X    Select_Key,                     CTRL+'@',
  209. X    Shift+Select_Key,               CTLX+CTRL+'X',
  210. X    Interrupt_Key,                  CTRL+'U',
  211. X    Keypad_PF2,                     META+'L',
  212. X    Keypad_PF3,                     META+'C',
  213. X    Keypad_PF4,                     META+'U',
  214. X    Shift+Keypad_PF2,               CTLX+CTRL+'L',
  215. X    Shift+Keypad_PF4,               CTLX+CTRL+'U',
  216. X    Keypad_1,                       CTLX+'1',
  217. X    Keypad_2,                       CTLX+'2',
  218. X    Do_Key,                         CTLX+'E',
  219. X    Keypad_4,                       CTLX+CTRL+'B',
  220. X    Keypad_5,                       CTLX+'B',
  221. X    Keypad_6,                       CTLX+'K',
  222. X    Resume_Key,                     META+'!',
  223. X    Control+Next_Scr_Key,           CTLX+'N',
  224. X    Control+Prev_Scr_Key,           CTLX+'P',
  225. X    Control+Up_Key,                 CTLX+CTRL+'P',
  226. X    Control+Down_Key,               CTLX+CTRL+'N',
  227. X    Help_Key,                       CTLX+'=',
  228. X    Shift+Do_Key,                   CTLX+'(',
  229. X    Control+Do_Key,                 CTLX+')',
  230. X    Keypad_0,                       CTLX+'Z',
  231. X    Shift+Keypad_0,                 CTLX+CTRL+'Z',
  232. X    Main_Scr_Key,                   CTRL+'C',
  233. X    Keypad_Enter,                   CTLX+'!',
  234. X    Exit_Key,                       CTLX+CTRL+'C',
  235. X    Shift+Exit_Key,                 CTRL+'Z'
  236. X};
  237. X
  238. X#define lk_map_size     (sizeof(lk_map)/2)
  239. X#endif
  240. X
  241. *-*-END-of-ebind.h-*-*
  242. echo x - edef.h
  243. sed 's/^X//' >edef.h <<'*-*-END-of-edef.h-*-*'
  244. X/*    EDEF:        Global variable definitions for
  245. X            MicroEMACS 3.2
  246. X
  247. X            written by Dave G. Conroy
  248. X            modified by Steve Wilhite, George Jones
  249. X            greatly modified by Daniel Lawrence
  250. X*/
  251. X
  252. X#ifdef    maindef
  253. X
  254. X/* for MAIN.C */
  255. X
  256. X/* initialized global definitions */
  257. X
  258. Xint     fillcol = 72;                   /* Current fill column          */
  259. Xshort   kbdm[NKBDM] = {CTLX|')'};       /* Macro                        */
  260. Xchar    pat[NPAT];                      /* Search pattern        */
  261. Xchar    rpat[NPAT];            /* replacement pattern        */
  262. Xchar    sarg[NSTRING] = "";        /* string argument for line exec*/
  263. Xint    eolexist = TRUE;        /* does clear to EOL exist    */
  264. Xint    revexist = FALSE;        /* does reverse video exist?    */
  265. Xchar    *modename[] = {            /* name of modes        */
  266. X    "WRAP", "CMODE", "SPELL", "EXACT", "VIEW", "OVER"};
  267. Xchar    modecode[] = "WCSEVO";        /* letters to represent modes    */
  268. Xint    gmode = 0;            /* global editor mode        */
  269. Xint     sgarbf  = TRUE;                 /* TRUE if screen is garbage    */
  270. Xint     mpresf  = FALSE;                /* TRUE if message in last line */
  271. Xint    clexec    = FALSE;        /* command line execution flag    */
  272. X
  273. X/* uninitialized global definitions */
  274. X
  275. Xint     currow;                 /* Cursor row                   */
  276. Xint     curcol;                 /* Cursor column                */
  277. Xint     thisflag;               /* Flags, this command          */
  278. Xint     lastflag;               /* Flags, last command          */
  279. Xint     curgoal;                /* Goal for C-P, C-N            */
  280. XWINDOW  *curwp;                 /* Current window               */
  281. XBUFFER  *curbp;                 /* Current buffer               */
  282. XWINDOW  *wheadp;                /* Head of list of windows      */
  283. XBUFFER  *bheadp;                /* Head of list of buffers      */
  284. XBUFFER  *blistp;                /* Buffer for C-X C-B           */
  285. Xshort   *kbdmip;                /* Input pointer for above      */
  286. Xshort   *kbdmop;                /* Output pointer for above     */
  287. X
  288. XBUFFER  *bfind();               /* Lookup a buffer by name      */
  289. XWINDOW  *wpopup();              /* Pop up window creation       */
  290. XLINE    *lalloc();              /* Allocate a line              */
  291. X
  292. X#else
  293. X
  294. X/* for all the other .C files */
  295. X
  296. X/* initialized global external declarations */
  297. X
  298. Xextern  int     fillcol;                /* Fill column                  */
  299. Xextern  short   kbdm[];                 /* Holds kayboard macro data    */
  300. Xextern  char    pat[];                  /* Search pattern               */
  301. Xextern    char    rpat[];            /* Replacement pattern        */
  302. Xextern    char    sarg[];            /* string argument for line exec*/
  303. Xextern    int    eolexist;        /* does clear to EOL exist?    */
  304. Xextern    int    revexist;        /* does reverse video exist?    */
  305. Xextern    char *modename[];        /* text names of modes        */
  306. Xextern    char    modecode[];        /* letters to represent modes    */
  307. Xextern    KEYTAB keytab[];        /* key bind to functions table    */
  308. Xextern    NBIND names[];            /* name to function table    */
  309. Xextern    int    gmode;            /* global editor mode        */
  310. Xextern  int     sgarbf;                 /* State of screen unknown      */
  311. Xextern  int     mpresf;                 /* Stuff in message line        */
  312. Xextern    int    clexec;            /* command line execution flag    */
  313. X
  314. X/* initialized global external declarations */
  315. X
  316. Xextern  int     currow;                 /* Cursor row                   */
  317. Xextern  int     curcol;                 /* Cursor column                */
  318. Xextern  int     thisflag;               /* Flags, this command          */
  319. Xextern  int     lastflag;               /* Flags, last command          */
  320. Xextern  int     curgoal;                /* Goal for C-P, C-N            */
  321. Xextern  WINDOW  *curwp;                 /* Current window               */
  322. Xextern  BUFFER  *curbp;                 /* Current buffer               */
  323. Xextern  WINDOW  *wheadp;                /* Head of list of windows      */
  324. Xextern  BUFFER  *bheadp;                /* Head of list of buffers      */
  325. Xextern  BUFFER  *blistp;                /* Buffer for C-X C-B           */
  326. Xextern  short   *kbdmip;                /* Input pointer for above      */
  327. Xextern  short   *kbdmop;                /* Output pointer for above     */
  328. X
  329. Xextern  BUFFER  *bfind();               /* Lookup a buffer by name      */
  330. Xextern  WINDOW  *wpopup();              /* Pop up window creation       */
  331. Xextern  LINE    *lalloc();              /* Allocate a line              */
  332. X
  333. X#endif
  334. X
  335. X/* terminal table defined only in TERM.C */
  336. X
  337. X#ifndef    termdef
  338. Xextern  TERM    term;                   /* Terminal information.        */
  339. X#endif
  340. X
  341. X
  342. *-*-END-of-edef.h-*-*
  343. echo x - efunc.h
  344. sed 's/^X//' >efunc.h <<'*-*-END-of-efunc.h-*-*'
  345. X/*    EFUNC.H:    MicroEMACS function declarations and names
  346. X
  347. X        This file list all the C code functions used by MicroEMACS
  348. X    and the names to use to bind keys to them. To add functions,
  349. X    declare it here in both the extern function list and the name
  350. X    binding table.
  351. X
  352. X    Update History:
  353. X
  354. X    Daniel Lawrence
  355. X        29-jan-86
  356. X        - separeted out external declarations to a separate .h file
  357. X        - built original name to function binding table
  358. X        30-jan-86
  359. X        - added command declarations for Fill Paragraph command
  360. X        11-feb-86
  361. X        - added declaration for help and describe key commands
  362. X        13-feb-86
  363. X        - added declarations for view-file command
  364. X        15-feb-86
  365. X        - added declataitons for insert file command
  366. X        17-feb-86
  367. X        - added declarations for scroll next window up/down
  368. X        20-feb-86
  369. X        - expanded binding table to make room for new bindings
  370. X        24-feb-86
  371. X        - added declarations for bind-to-key and unbind-key
  372. X          execute named command and describe bindings
  373. X        26-feb-86
  374. X        - added declarations for execute command
  375. X        - changed name of "visit-file" to "find-file"
  376. X        - added declaration for execute-buffer command
  377. X        27-feb-86
  378. X        - added declarations for execute-file command
  379. X        3-apr-86
  380. X        - added declarations for next-buffer command
  381. X        5-apr-86
  382. X        - added declarations for kill-paragraph command
  383. X        8-apr-86
  384. X        - added declarations for add/delete global mode
  385. X        8-apr-86
  386. X        - added declarations for insert space command
  387. X*/
  388. X
  389. X/*    External function declarations        */
  390. X
  391. Xextern  int     ctrlg();                /* Abort out of things          */
  392. Xextern  int     quit();                 /* Quit                         */
  393. Xextern  int     ctlxlp();               /* Begin macro                  */
  394. Xextern  int     ctlxrp();               /* End macro                    */
  395. Xextern  int     ctlxe();                /* Execute macro                */
  396. Xextern  int     fileread();             /* Get a file, read only        */
  397. Xextern  int     filefind();        /* Get a file, read write       */
  398. Xextern  int     filewrite();            /* Write a file                 */
  399. Xextern  int     filesave();             /* Save current file            */
  400. Xextern  int     filename();             /* Adjust file name             */
  401. Xextern  int     getccol();              /* Get current column           */
  402. Xextern  int     gotobol();              /* Move to start of line        */
  403. Xextern  int     forwchar();             /* Move forward by characters   */
  404. Xextern  int     gotoeol();              /* Move to end of line          */
  405. Xextern  int     backchar();             /* Move backward by characters  */
  406. Xextern  int     forwline();             /* Move forward by lines        */
  407. Xextern  int     backline();             /* Move backward by lines       */
  408. Xextern  int     forwpage();             /* Move forward by pages        */
  409. Xextern  int     backpage();             /* Move backward by pages       */
  410. Xextern  int     gotobob();              /* Move to start of buffer      */
  411. Xextern  int     gotoeob();              /* Move to end of buffer        */
  412. Xextern  int     setfillcol();           /* Set fill column.             */
  413. Xextern  int     setmark();              /* Set mark                     */
  414. Xextern  int     swapmark();             /* Swap "." and mark            */
  415. Xextern  int     forwsearch();           /* Search forward               */
  416. Xextern  int     backsearch();           /* Search backwards             */
  417. Xextern    int    sreplace();        /* search and replace        */
  418. Xextern    int    qreplace();        /* search and replace w/query    */
  419. Xextern  int     showcpos();             /* Show the cursor position     */
  420. Xextern  int     nextwind();             /* Move to the next window      */
  421. Xextern  int     prevwind();             /* Move to the previous window  */
  422. Xextern  int     onlywind();             /* Make current window only one */
  423. Xextern  int     splitwind();            /* Split current window         */
  424. Xextern  int     mvdnwind();             /* Move window down             */
  425. Xextern  int     mvupwind();             /* Move window up               */
  426. Xextern  int     enlargewind();          /* Enlarge display window.      */
  427. Xextern  int     shrinkwind();           /* Shrink window.               */
  428. Xextern  int     listbuffers();          /* Display list of buffers      */
  429. Xextern  int     usebuffer();            /* Switch a window to a buffer  */
  430. Xextern  int     killbuffer();           /* Make a buffer go away.       */
  431. Xextern  int     reposition();           /* Reposition window            */
  432. Xextern  int     refresh();              /* Refresh the screen           */
  433. Xextern  int     twiddle();              /* Twiddle characters           */
  434. Xextern  int     tab();                  /* Insert tab                   */
  435. Xextern  int     newline();              /* Insert CR-LF                 */
  436. Xextern  int     indent();               /* Insert CR-LF, then indent    */
  437. Xextern  int     openline();             /* Open up a blank line         */
  438. Xextern  int     deblank();              /* Delete blank lines           */
  439. Xextern  int     quote();                /* Insert literal               */
  440. Xextern  int     backword();             /* Backup by words              */
  441. Xextern  int     forwword();             /* Advance by words             */
  442. Xextern  int     forwdel();              /* Forward delete               */
  443. Xextern  int     backdel();              /* Backward delete              */
  444. Xextern  int     killtext();             /* Kill forward                 */
  445. Xextern  int     yank();                 /* Yank back from killbuffer.   */
  446. Xextern  int     upperword();            /* Upper case word.             */
  447. Xextern  int     lowerword();            /* Lower case word.             */
  448. Xextern  int     upperregion();          /* Upper case region.           */
  449. Xextern  int     lowerregion();          /* Lower case region.           */
  450. Xextern  int     capword();              /* Initial capitalize word.     */
  451. Xextern  int     delfword();             /* Delete forward word.         */
  452. Xextern  int     delbword();             /* Delete backward word.        */
  453. Xextern  int     killregion();           /* Kill region.                 */
  454. Xextern  int     copyregion();           /* Copy region to kill buffer.  */
  455. Xextern  int     spawncli();             /* Run CLI in a subjob.         */
  456. Xextern  int     spawn();                /* Run a command in a subjob.   */
  457. Xextern  int     quickexit();            /* low keystroke style exit.    */
  458. Xextern    int    setmode();        /* set an editor mode        */
  459. Xextern    int    delmode();        /* delete a mode        */
  460. Xextern    int    gotoline();        /* go to a numbered line    */
  461. Xextern    int    namebuffer();        /* rename the current buffer    */
  462. Xextern    int    gotobop();        /* go to begining/paragraph    */
  463. Xextern    int    gotoeop();        /* go to end/paragraph        */
  464. Xextern    int    fillpara();        /* fill current paragraph    */
  465. Xextern    int    help();            /* get the help file here    */
  466. Xextern    int    deskey();        /* describe a key's binding    */
  467. Xextern    int    viewfile();        /* find a file in view mode    */
  468. Xextern    int    insfile();        /* insert a file        */
  469. Xextern    int    scrnextup();        /* scroll next window back    */
  470. Xextern    int    scrnextdw();        /* scroll next window down    */
  471. Xextern    int    bindtokey();        /* bind a function to a key    */
  472. Xextern    int    unbindkey();        /* unbind a key's function    */
  473. Xextern    int    namedcmd();        /* execute named command    */
  474. Xextern    int    desbind();        /* describe bindings        */
  475. Xextern    int    execcmd();        /* execute a command line    */
  476. Xextern    int    execbuf();        /* exec commands from a buffer    */
  477. Xextern    int    execfile();        /* exec commands from a file    */
  478. Xextern    int    nextbuffer();        /* switch to the next buffer    */
  479. Xextern    int    killpara();        /* kill the current paragraph    */
  480. Xextern    int    setgmode();        /* set a global mode        */
  481. Xextern    int    delgmode();        /* delete a global mode        */
  482. Xextern    int    insspace();        /* insert a space forword    */
  483. Xextern    int    forwhunt();        /* hunt forward for next match    */
  484. Xextern    int    backhunt();        /* hunt backwards for next match*/
  485. X
  486. X#if    V7 & BSD
  487. Xextern    int    bktoshell();        /* suspend emacs to parent shell*/
  488. Xextern    int    rtfrmshell();        /* return from a suspended state*/
  489. X#endif
  490. X
  491. X/*    Name to function binding table
  492. X
  493. X        This table gives the names of all the bindable functions
  494. X    end their C function address. These are used for the bind-to-key
  495. X    function.
  496. X*/
  497. X
  498. XNBIND    names[] = {
  499. X    {"add-mode",            setmode},
  500. X    {"add-global-mode",        setgmode},
  501. X    {"backward-character",        backchar},
  502. X    {"begin-macro",            ctlxlp},
  503. X    {"begining-of-file",        gotobob},
  504. X    {"begining-of-line",        gotobol},
  505. X    {"bind-to-key",            bindtokey},
  506. X    {"buffer-position",        showcpos},
  507. X    {"case-region-lower",        lowerregion},
  508. X    {"case-region-upper",        upperregion},
  509. X    {"case-word-capitalize",    capword},
  510. X    {"case-word-lower",        lowerword},
  511. X    {"case-word-upper",        upperword},
  512. X    {"change-file-name",        filename},
  513. X    {"clear-and-redraw",        refresh},
  514. X    {"copy-region",            copyregion},
  515. X    {"delete-blank-lines",        deblank},
  516. X    {"delete-buffer",        killbuffer},
  517. X    {"delete-mode",            delmode},
  518. X    {"delete-global-mode",        delgmode},
  519. X    {"delete-next-character",    forwdel},
  520. X    {"delete-next-word",        delfword},
  521. X    {"delete-other-windows",    onlywind},
  522. X    {"delete-previous-character",    backdel},
  523. X    {"delete-previous-word",    delbword},
  524. X    {"describe-bindings",        desbind},
  525. X    {"describe-key",        deskey},
  526. X    {"end-macro",            ctlxrp},
  527. X    {"end-of-file",            gotoeob},
  528. X    {"end-of-line",            gotoeol},
  529. X    {"exchange-point-and-mark",    swapmark},
  530. X    {"execute-buffer",        execbuf},
  531. X    {"execute-command-line",    execcmd},
  532. X    {"execute-file",        execfile},
  533. X    {"execute-macro",        ctlxe},
  534. X    {"execute-named-command",    namedcmd},
  535. X    {"exit-emacs",            quit},
  536. X    {"fill-paragraph",        fillpara},
  537. X    {"find-file",            filefind},
  538. X    {"forward-character",        forwchar},
  539. X    {"goto-line",            gotoline},
  540. X    {"grow-window",            enlargewind},
  541. X    {"handle-tab",            tab},
  542. X    {"hunt-forward",        forwhunt},
  543. X    {"hunt-backward",        backhunt},
  544. X    {"help",            help},
  545. X    {"i-shell",            spawncli},
  546. X    {"insert-file",            insfile},
  547. X    {"insert-space",        insspace},
  548. X    {"kill-paragraph",        killpara},
  549. X    {"kill-region",            killregion},
  550. X    {"kill-to-end-of-line",        killtext},
  551. X    {"list-buffers",        listbuffers},
  552. X    {"move-window-down",        mvdnwind},
  553. X    {"move-window-up",        mvupwind},
  554. X    {"name-buffer",            namebuffer},
  555. X    {"newline",            newline},
  556. X    {"newline-and-indent",        indent},
  557. X    {"next-buffer",            nextbuffer},
  558. X    {"next-line",            forwline},
  559. X    {"next-page",            forwpage},
  560. X    {"next-paragraph",        gotoeop},
  561. X    {"next-window",            nextwind},
  562. X    {"next-word",            forwword},
  563. X    {"open-line",            openline},
  564. X    {"previous-line",        backline},
  565. X    {"previous-page",        backpage},
  566. X    {"previous-paragraph",        gotobop},
  567. X    {"previous-window",        prevwind},
  568. X    {"previous-word",        backword},
  569. X    {"query-replace-string",    qreplace},
  570. X    {"quick-exit",            quickexit},
  571. X    {"quote-character",        quote},
  572. X    {"read-file",            fileread},
  573. X    {"redraw-display",        reposition},
  574. X    {"replace-string",        sreplace},
  575. X    {"save-file",            filesave},
  576. X    {"scroll-next-up",        scrnextup},
  577. X    {"scroll-next-down",        scrnextdw},
  578. X    {"search-forward",        forwsearch},
  579. X    {"search-reverse",        backsearch},
  580. X    {"select-buffer",        usebuffer},
  581. X    {"set-fill-column",        setfillcol},
  582. X    {"set-mark",            setmark},
  583. X    {"shell-command",        spawn},
  584. X    {"shrink-window",        shrinkwind},
  585. X    {"split-current-window",    splitwind},
  586. X#if    V7 & BSD
  587. X    {"suspend-emacs",        bktoshell},
  588. X#endif
  589. X    {"transpose-characters",    twiddle},
  590. X    {"unbind-key",            unbindkey},
  591. X    {"view-file",            viewfile},
  592. X    {"write-file",            filewrite},
  593. X    {"yank",            yank},
  594. X
  595. X    {"",            NULL}
  596. X};
  597. *-*-END-of-efunc.h-*-*
  598. echo x - epath.h
  599. sed 's/^X//' >epath.h <<'*-*-END-of-epath.h-*-*'
  600. X/*    PATH:    This file contains certain info needed to locate the
  601. X        MicroEMACS files on a system dependant basis.
  602. X
  603. X                                    */
  604. X
  605. X/*    possible names and paths of help files under different OSs    */
  606. X
  607. Xchar *pathname[] = {
  608. X
  609. X#if    AMIGA
  610. X    ".emacsrc",
  611. X    "emacs.hlp",
  612. X    "",
  613. X    ":c/",
  614. X    ":t/"
  615. X#endif
  616. X
  617. X#if    MSDOS
  618. X    "emacs.rc",
  619. X    "emacs.hlp",
  620. X    "\\sys\\public\\",
  621. X    "\\usr\\bin\\",
  622. X    "\\bin\\",
  623. X    "\\",
  624. X    ""
  625. X#endif
  626. X
  627. X#if    V7
  628. X    ".emacsrc",
  629. X    "emacs.hlp",
  630. X    "/usr/local/",
  631. X    "/usr/lib/",
  632. X    ""
  633. X#endif
  634. X
  635. X#if    VMS
  636. X    "emacs.rc",
  637. X    "emacs.hlp",
  638. X    "",
  639. X    "sys$sysdevice:[vmstools]"
  640. X#endif
  641. X
  642. X};
  643. X
  644. X#define    NPNAMES    (sizeof(pathname)/sizeof(char *))
  645. *-*-END-of-epath.h-*-*
  646. echo x - ansi.c
  647. sed 's/^X//' >ansi.c <<'*-*-END-of-ansi.c-*-*'
  648. X/*
  649. X * The routines in this file provide support for ANSI style terminals
  650. X * over a serial line. The serial I/O services are provided by routines in
  651. X * "termio.c". It compiles into nothing if not an ANSI device.
  652. X */
  653. X
  654. X#define    termdef    1            /* don't define "term" external */
  655. X
  656. X#include        <stdio.h>
  657. X#include    "estruct.h"
  658. X#include        "edef.h"
  659. X
  660. X#if     ANSI
  661. X
  662. X#if    AMIGA
  663. X#define NROW    23                      /* Screen size.                 */
  664. X#define NCOL    77                      /* Edit if you want to.         */
  665. X#else
  666. X#define NROW    25                      /* Screen size.                 */
  667. X#define NCOL    80                      /* Edit if you want to.         */
  668. X#endif
  669. X#define    MARGIN    8            /* size of minimim margin and    */
  670. X#define    SCRSIZ    64            /* scroll size for extended lines */
  671. X#define BEL     0x07                    /* BEL character.               */
  672. X#define ESC     0x1B                    /* ESC character.               */
  673. X
  674. Xextern  int     ttopen();               /* Forward references.          */
  675. Xextern  int     ttgetc();
  676. Xextern  int     ttputc();
  677. Xextern  int     ttflush();
  678. Xextern  int     ttclose();
  679. Xextern  int     ansimove();
  680. Xextern  int     ansieeol();
  681. Xextern  int     ansieeop();
  682. Xextern  int     ansibeep();
  683. Xextern  int     ansiopen();
  684. Xextern    int    ansirev();
  685. X/*
  686. X * Standard terminal interface dispatch table. Most of the fields point into
  687. X * "termio" code.
  688. X */
  689. XTERM    term    = {
  690. X        NROW-1,
  691. X        NCOL,
  692. X    MARGIN,
  693. X    SCRSIZ,
  694. X        ansiopen,
  695. X        ttclose,
  696. X        ttgetc,
  697. X        ttputc,
  698. X        ttflush,
  699. X        ansimove,
  700. X        ansieeol,
  701. X        ansieeop,
  702. X        ansibeep,
  703. X    ansirev
  704. X};
  705. X
  706. Xansimove(row, col)
  707. X{
  708. X        ttputc(ESC);
  709. X        ttputc('[');
  710. X        ansiparm(row+1);
  711. X        ttputc(';');
  712. X        ansiparm(col+1);
  713. X        ttputc('H');
  714. X}
  715. X
  716. Xansieeol()
  717. X{
  718. X        ttputc(ESC);
  719. X        ttputc('[');
  720. X        ttputc('K');
  721. X}
  722. X
  723. Xansieeop()
  724. X{
  725. X        ttputc(ESC);
  726. X        ttputc('[');
  727. X        ttputc('J');
  728. X}
  729. X
  730. Xansirev(state)        /* change reverse video state */
  731. X
  732. Xint state;    /* TRUE = reverse, FALSE = normal */
  733. X
  734. X{
  735. X    ttputc(ESC);
  736. X    ttputc('[');
  737. X    ttputc(state ? '7': '0');
  738. X    ttputc('m');
  739. X}
  740. X
  741. Xansibeep()
  742. X{
  743. X        ttputc(BEL);
  744. X        ttflush();
  745. X}
  746. X
  747. Xansiparm(n)
  748. Xregister int    n;
  749. X{
  750. X        register int    q;
  751. X
  752. X        q = n/10;
  753. X        if (q != 0)
  754. X                ansiparm(q);
  755. X        ttputc((n%10) + '0');
  756. X}
  757. X
  758. X#endif
  759. X
  760. Xansiopen()
  761. X{
  762. X#if     V7
  763. X        register char *cp;
  764. X        char *getenv();
  765. X
  766. X        if ((cp = getenv("TERM")) == NULL) {
  767. X                puts("Shell variable TERM not defined!");
  768. X                exit(1);
  769. X        }
  770. X        if (strcmp(cp, "vt100") != 0) {
  771. X                puts("Terminal type not 'vt100'!");
  772. X                exit(1);
  773. X        }
  774. X#endif
  775. X    revexist = TRUE;
  776. X        ttopen();
  777. X}
  778. *-*-END-of-ansi.c-*-*
  779. echo x - basic.c
  780. sed 's/^X//' >basic.c <<'*-*-END-of-basic.c-*-*'
  781. X/*
  782. X * The routines in this file move the cursor around on the screen. They
  783. X * compute a new value for the cursor, then adjust ".". The display code
  784. X * always updates the cursor location, so only moves between lines, or
  785. X * functions that adjust the top line in the window and invalidate the
  786. X * framing, are hard.
  787. X */
  788. X#include        <stdio.h>
  789. X#include    "estruct.h"
  790. X#include        "edef.h"
  791. X
  792. X/*
  793. X * Move the cursor to the
  794. X * beginning of the current line.
  795. X * Trivial.
  796. X */
  797. Xgotobol(f, n)
  798. X{
  799. X        curwp->w_doto  = 0;
  800. X        return (TRUE);
  801. X}
  802. X
  803. X/*
  804. X * Move the cursor backwards by "n" characters. If "n" is less than zero call
  805. X * "forwchar" to actually do the move. Otherwise compute the new cursor
  806. X * location. Error if you try and move out of the buffer. Set the flag if the
  807. X * line pointer for dot changes.
  808. X */
  809. Xbackchar(f, n)
  810. Xregister int    n;
  811. X{
  812. X        register LINE   *lp;
  813. X
  814. X        if (n < 0)
  815. X                return (forwchar(f, -n));
  816. X        while (n--) {
  817. X                if (curwp->w_doto == 0) {
  818. X                        if ((lp=lback(curwp->w_dotp)) == curbp->b_linep)
  819. X                                return (FALSE);
  820. X                        curwp->w_dotp  = lp;
  821. X                        curwp->w_doto  = llength(lp);
  822. X                        curwp->w_flag |= WFMOVE;
  823. X                } else
  824. X                        curwp->w_doto--;
  825. X        }
  826. X        return (TRUE);
  827. X}
  828. X
  829. X/*
  830. X * Move the cursor to the end of the current line. Trivial. No errors.
  831. X */
  832. Xgotoeol(f, n)
  833. X{
  834. X        curwp->w_doto  = llength(curwp->w_dotp);
  835. X        return (TRUE);
  836. X}
  837. X
  838. X/*
  839. X * Move the cursor forwwards by "n" characters. If "n" is less than zero call
  840. X * "backchar" to actually do the move. Otherwise compute the new cursor
  841. X * location, and move ".". Error if you try and move off the end of the
  842. X * buffer. Set the flag if the line pointer for dot changes.
  843. X */
  844. Xforwchar(f, n)
  845. Xregister int    n;
  846. X{
  847. X        if (n < 0)
  848. X                return (backchar(f, -n));
  849. X        while (n--) {
  850. X                if (curwp->w_doto == llength(curwp->w_dotp)) {
  851. X                        if (curwp->w_dotp == curbp->b_linep)
  852. X                                return (FALSE);
  853. X                        curwp->w_dotp  = lforw(curwp->w_dotp);
  854. X                        curwp->w_doto  = 0;
  855. X                        curwp->w_flag |= WFMOVE;
  856. X                } else
  857. X                        curwp->w_doto++;
  858. X        }
  859. X        return (TRUE);
  860. X}
  861. X
  862. Xgotoline(f, n)        /* move to a particular line.
  863. X               argument (n) must be a positive integer for
  864. X               this to actually do anything        */
  865. X
  866. X{
  867. X    if (n < 1)        /* if a bogus argument...then leave */
  868. X        return(FALSE);
  869. X
  870. X    /* first, we go to the start of the buffer */
  871. X        curwp->w_dotp  = lforw(curbp->b_linep);
  872. X        curwp->w_doto  = 0;
  873. X    return(forwline(f, n-1));
  874. X}
  875. X
  876. X/*
  877. X * Goto the beginning of the buffer. Massive adjustment of dot. This is
  878. X * considered to be hard motion; it really isn't if the original value of dot
  879. X * is the same as the new value of dot. Normally bound to "M-<".
  880. X */
  881. Xgotobob(f, n)
  882. X{
  883. X        curwp->w_dotp  = lforw(curbp->b_linep);
  884. X        curwp->w_doto  = 0;
  885. X        curwp->w_flag |= WFHARD;
  886. X        return (TRUE);
  887. X}
  888. X
  889. X/*
  890. X * Move to the end of the buffer. Dot is always put at the end of the file
  891. X * (ZJ). The standard screen code does most of the hard parts of update.
  892. X * Bound to "M->".
  893. X */
  894. Xgotoeob(f, n)
  895. X{
  896. X        curwp->w_dotp  = curbp->b_linep;
  897. X        curwp->w_doto  = 0;
  898. X        curwp->w_flag |= WFHARD;
  899. X        return (TRUE);
  900. X}
  901. X
  902. X/*
  903. X * Move forward by full lines. If the number of lines to move is less than
  904. X * zero, call the backward line function to actually do it. The last command
  905. X * controls how the goal column is set. Bound to "C-N". No errors are
  906. X * possible.
  907. X */
  908. Xforwline(f, n)
  909. X{
  910. X        register LINE   *dlp;
  911. X
  912. X        if (n < 0)
  913. X                return (backline(f, -n));
  914. X        if ((lastflag&CFCPCN) == 0)             /* Reset goal if last   */
  915. X                curgoal = getccol(FALSE);       /* not C-P or C-N       */
  916. X        thisflag |= CFCPCN;
  917. X        dlp = curwp->w_dotp;
  918. X        while (n-- && dlp!=curbp->b_linep)
  919. X                dlp = lforw(dlp);
  920. X        curwp->w_dotp  = dlp;
  921. X        curwp->w_doto  = getgoal(dlp);
  922. X        curwp->w_flag |= WFMOVE;
  923. X        return (TRUE);
  924. X}
  925. X
  926. X/*
  927. X * This function is like "forwline", but goes backwards. The scheme is exactly
  928. X * the same. Check for arguments that are less than zero and call your
  929. X * alternate. Figure out the new line and call "movedot" to perform the
  930. X * motion. No errors are possible. Bound to "C-P".
  931. X */
  932. Xbackline(f, n)
  933. X{
  934. X        register LINE   *dlp;
  935. X
  936. X        if (n < 0)
  937. X                return (forwline(f, -n));
  938. X        if ((lastflag&CFCPCN) == 0)             /* Reset goal if the    */
  939. X                curgoal = getccol(FALSE);       /* last isn't C-P, C-N  */
  940. X        thisflag |= CFCPCN;
  941. X        dlp = curwp->w_dotp;
  942. X        while (n-- && lback(dlp)!=curbp->b_linep)
  943. X                dlp = lback(dlp);
  944. X        curwp->w_dotp  = dlp;
  945. X        curwp->w_doto  = getgoal(dlp);
  946. X        curwp->w_flag |= WFMOVE;
  947. X        return (TRUE);
  948. X}
  949. X
  950. Xgotobop(f, n)    /* go back to the begining of the current paragraph
  951. X           here we look for a <NL><NL> or <NL><TAB> or <NL><SPACE>
  952. X           combination to delimit the begining of a paragraph    */
  953. X
  954. Xint f, n;    /* default Flag & Numeric argument */
  955. X
  956. X{
  957. X    register int suc;    /* success of last backchar */
  958. X
  959. X    if (n < 0)    /* the other way...*/
  960. X        return(gotoeop(f, -n));
  961. X
  962. X    while (n-- > 0) {    /* for each one asked for */
  963. X
  964. X        /* first scan back until we are in a word */
  965. X        suc = backchar(FALSE, 1);
  966. X        while (!inword() && suc)
  967. X            suc = backchar(FALSE, 1);
  968. X        curwp->w_doto = 0;    /* and go to the B-O-Line */
  969. X
  970. X        /* and scan back until we hit a <NL><NL> or <NL><TAB>
  971. X           or a <NL><SPACE>                    */
  972. X        while (lback(curwp->w_dotp) != curbp->b_linep)
  973. X            if (llength(curwp->w_dotp) != 0 &&
  974. X                lgetc(curwp->w_dotp, curwp->w_doto) != TAB &&
  975. X                lgetc(curwp->w_dotp, curwp->w_doto) != ' ')
  976. X                curwp->w_dotp = lback(curwp->w_dotp);
  977. X            else
  978. X                break;
  979. X
  980. X        /* and then forward until we are in a word */
  981. X        suc = forwchar(FALSE, 1);
  982. X        while (suc && !inword())
  983. X            suc = forwchar(FALSE, 1);
  984. X    }
  985. X    curwp->w_flag |= WFMOVE;    /* force screen update */
  986. X}
  987. X
  988. Xgotoeop(f, n)    /* go forword to the end of the current paragraph
  989. X           here we look for a <NL><NL> or <NL><TAB> or <NL><SPACE>
  990. X           combination to delimit the begining of a paragraph    */
  991. X
  992. Xint f, n;    /* default Flag & Numeric argument */
  993. X
  994. X{
  995. X    register int suc;    /* success of last backchar */
  996. X
  997. X    if (n < 0)    /* the other way...*/
  998. X        return(gotobop(f, -n));
  999. X
  1000. X    while (n-- > 0) {    /* for each one asked for */
  1001. X
  1002. X        /* first scan forward until we are in a word */
  1003. X        suc = forwchar(FALSE, 1);
  1004. X        while (!inword() && suc)
  1005. X            suc = forwchar(FALSE, 1);
  1006. X        curwp->w_doto = 0;    /* and go to the B-O-Line */
  1007. X        if (suc)    /* of next line if not at EOF */
  1008. X            curwp->w_dotp = lforw(curwp->w_dotp);
  1009. X
  1010. X        /* and scan forword until we hit a <NL><NL> or <NL><TAB>
  1011. X           or a <NL><SPACE>                    */
  1012. X        while (curwp->w_dotp != curbp->b_linep) {
  1013. X            if (llength(curwp->w_dotp) != 0 &&
  1014. X                lgetc(curwp->w_dotp, curwp->w_doto) != TAB &&
  1015. X                lgetc(curwp->w_dotp, curwp->w_doto) != ' ')
  1016. X                curwp->w_dotp = lforw(curwp->w_dotp);
  1017. X            else
  1018. X                break;
  1019. X        }
  1020. X
  1021. X        /* and then backward until we are in a word */
  1022. X        suc = backchar(FALSE, 1);
  1023. X        while (suc && !inword()) {
  1024. X            suc = backchar(FALSE, 1);
  1025. X        }
  1026. X        curwp->w_doto = llength(curwp->w_dotp);    /* and to the EOL */
  1027. X    }
  1028. X    curwp->w_flag |= WFMOVE;    /* force screen update */
  1029. X}
  1030. X
  1031. X/*
  1032. X * This routine, given a pointer to a LINE, and the current cursor goal
  1033. X * column, return the best choice for the offset. The offset is returned.
  1034. X * Used by "C-N" and "C-P".
  1035. X */
  1036. Xgetgoal(dlp)
  1037. Xregister LINE   *dlp;
  1038. X{
  1039. X        register int    c;
  1040. X        register int    col;
  1041. X        register int    newcol;
  1042. X        register int    dbo;
  1043. X
  1044. X        col = 0;
  1045. X        dbo = 0;
  1046. X        while (dbo != llength(dlp)) {
  1047. X                c = lgetc(dlp, dbo);
  1048. X                newcol = col;
  1049. X                if (c == '\t')
  1050. X                        newcol |= 0x07;
  1051. X                else if (c<0x20 || c==0x7F)
  1052. X                        ++newcol;
  1053. X                ++newcol;
  1054. X                if (newcol > curgoal)
  1055. X                        break;
  1056. X                col = newcol;
  1057. X                ++dbo;
  1058. X        }
  1059. X        return (dbo);
  1060. X}
  1061. X
  1062. X/*
  1063. X * Scroll forward by a specified number of lines, or by a full page if no
  1064. X * argument. Bound to "C-V". The "2" in the arithmetic on the window size is
  1065. X * the overlap; this value is the default overlap value in ITS EMACS. Because
  1066. X * this zaps the top line in the display window, we have to do a hard update.
  1067. X */
  1068. Xforwpage(f, n)
  1069. Xregister int    n;
  1070. X{
  1071. X        register LINE   *lp;
  1072. X
  1073. X        if (f == FALSE) {
  1074. X                n = curwp->w_ntrows - 2;        /* Default scroll.      */
  1075. X                if (n <= 0)                     /* Forget the overlap   */
  1076. X                        n = 1;                  /* if tiny window.      */
  1077. X        } else if (n < 0)
  1078. X                return (backpage(f, -n));
  1079. X#if     CVMVAS
  1080. X        else                                    /* Convert from pages   */
  1081. X                n *= curwp->w_ntrows;           /* to lines.            */
  1082. X#endif
  1083. X        lp = curwp->w_linep;
  1084. X        while (n-- && lp!=curbp->b_linep)
  1085. X                lp = lforw(lp);
  1086. X        curwp->w_linep = lp;
  1087. X        curwp->w_dotp  = lp;
  1088. X        curwp->w_doto  = 0;
  1089. X        curwp->w_flag |= WFHARD;
  1090. X        return (TRUE);
  1091. X}
  1092. X
  1093. X/*
  1094. X * This command is like "forwpage", but it goes backwards. The "2", like
  1095. X * above, is the overlap between the two windows. The value is from the ITS
  1096. X * EMACS manual. Bound to "M-V". We do a hard update for exactly the same
  1097. X * reason.
  1098. X */
  1099. Xbackpage(f, n)
  1100. Xregister int    n;
  1101. X{
  1102. X        register LINE   *lp;
  1103. X
  1104. X        if (f == FALSE) {
  1105. X                n = curwp->w_ntrows - 2;        /* Default scroll.      */
  1106. X                if (n <= 0)                     /* Don't blow up if the */
  1107. X                        n = 1;                  /* window is tiny.      */
  1108. X        } else if (n < 0)
  1109. X                return (forwpage(f, -n));
  1110. X#if     CVMVAS
  1111. X        else                                    /* Convert from pages   */
  1112. X                n *= curwp->w_ntrows;           /* to lines.            */
  1113. X#endif
  1114. X        lp = curwp->w_linep;
  1115. X        while (n-- && lback(lp)!=curbp->b_linep)
  1116. X                lp = lback(lp);
  1117. X        curwp->w_linep = lp;
  1118. X        curwp->w_dotp  = lp;
  1119. X        curwp->w_doto  = 0;
  1120. X        curwp->w_flag |= WFHARD;
  1121. X        return (TRUE);
  1122. X}
  1123. X
  1124. X/*
  1125. X * Set the mark in the current window to the value of "." in the window. No
  1126. X * errors are possible. Bound to "M-.".
  1127. X */
  1128. Xsetmark(f, n)
  1129. X{
  1130. X        curwp->w_markp = curwp->w_dotp;
  1131. X        curwp->w_marko = curwp->w_doto;
  1132. X        mlwrite("[Mark set]");
  1133. X        return (TRUE);
  1134. X}
  1135. X
  1136. X/*
  1137. X * Swap the values of "." and "mark" in the current window. This is pretty
  1138. X * easy, bacause all of the hard work gets done by the standard routine
  1139. X * that moves the mark about. The only possible error is "no mark". Bound to
  1140. X * "C-X C-X".
  1141. X */
  1142. Xswapmark(f, n)
  1143. X{
  1144. X        register LINE   *odotp;
  1145. X        register int    odoto;
  1146. X
  1147. X        if (curwp->w_markp == NULL) {
  1148. X                mlwrite("No mark in this window");
  1149. X                return (FALSE);
  1150. X        }
  1151. X        odotp = curwp->w_dotp;
  1152. X        odoto = curwp->w_doto;
  1153. X        curwp->w_dotp  = curwp->w_markp;
  1154. X        curwp->w_doto  = curwp->w_marko;
  1155. X        curwp->w_markp = odotp;
  1156. X        curwp->w_marko = odoto;
  1157. X        curwp->w_flag |= WFMOVE;
  1158. X        return (TRUE);
  1159. X}
  1160. *-*-END-of-basic.c-*-*
  1161. exit
  1162.  
  1163.  
  1164.