home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / editors / 1833 < prev    next >
Encoding:
Internet Message Format  |  1992-07-28  |  43.2 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!sample.eng.ohio-state.edu!purdue!haven.umd.edu!darwin.sura.net!Sirius.dfn.de!math.fu-berlin.de!wolff
  2. From: wolff@inf.fu-berlin.de (Thomas Wolff)
  3. Newsgroups: comp.editors
  4. Subject: Editor mined (4/4)
  5. Message-ID: <62I5CYD@math.fu-berlin.de>
  6. Date: 28 Jul 92 15:04:17 GMT
  7. Sender: news@math.fu-berlin.de (Math Department)
  8. Organization: Free University of Berlin, Germany
  9. Lines: 1735
  10.  
  11. #! /bin/sh
  12. : This is a sharchive -- extract the files by running through sh
  13.  
  14. echo ---------------------- extracting minedio.c -----------------
  15. sed 's/^,//' << \EOSED > minedio.c
  16. ,/*  ==================================================================    *
  17. , *                Editor mined                *
  18. , *            Operating system dependant I/O            *
  19. , *  ==================================================================    */
  20. ,
  21. ,#include "mined.h"
  22. ,#include <errno.h>
  23. ,#include <signal.h>
  24. ,
  25. ,#ifdef CURSES
  26. ,#include <curses.h>
  27. ,#undef FALSE
  28. ,#undef TRUE
  29. ,#undef TERMIO    /* \ must be  */
  30. ,#undef SGTTY    /* / disabled */
  31. ,#endif
  32. ,
  33. ,#ifdef TERMIO
  34. ,#include <termios.h>
  35. ,#endif
  36. ,#ifdef SGTTY
  37. ,#include <sys/ioctl.h>    /* <sgtty.h> ? */
  38. ,#endif
  39. ,
  40. ,#ifdef msdos
  41. ,#include <conio.h>
  42. ,#undef SIGINT    /* signal (SIGINT, catchint) not understood */
  43. ,#define _getch_
  44. ,#endif
  45. ,
  46. ,#ifdef unix
  47. ,#include <sys/time.h>    /* for struct timeval (for select in inputreadyafter) */
  48. ,#define selectread    /* use select () ? */
  49. ,#endif
  50. ,
  51. ,#ifdef vms
  52. ,#undef u_char
  53. ,#include <socket.h>    /* for select () and struct timeval */
  54. ,#ifdef CURSES
  55. ,#define _getch_
  56. ,#endif
  57. ,#endif
  58. ,
  59. ,/*  ==================================================================    *
  60. , *            Unix signalling routines            *
  61. , *  ==================================================================    */
  62. ,
  63. ,catch_signals (catch)
  64. ,  void (* catch) ();
  65. ,{
  66. ,#ifdef SIGHUP
  67. ,  signal (SIGHUP, catch);
  68. ,#endif
  69. ,#ifdef SIGILL
  70. ,  signal (SIGILL, catch);
  71. ,#endif
  72. ,#ifdef SIGTRAP
  73. ,  signal (SIGTRAP, catch);
  74. ,#endif
  75. ,#ifdef SIGABRT
  76. ,  signal (SIGABRT, catch);
  77. ,#endif
  78. ,#ifdef SIGEMT
  79. ,  signal (SIGEMT, catch);
  80. ,#endif
  81. ,#ifdef SIGFPE
  82. ,  signal (SIGFPE, catch);
  83. ,#endif
  84. ,#ifdef SIGBUS
  85. ,  signal (SIGBUS, catch);
  86. ,#endif
  87. ,#ifdef SIGSEGV
  88. ,  signal (SIGSEGV, catch);
  89. ,#endif
  90. ,#ifdef SIGSYS
  91. ,  signal (SIGSYS, catch);
  92. ,#endif
  93. ,#ifdef SIGPIPE
  94. ,  signal (SIGPIPE, catch);
  95. ,#endif
  96. ,#ifdef SIGALRM
  97. ,  signal (SIGALRM, catch);
  98. ,#endif
  99. ,#ifdef SIGTERM
  100. ,  signal (SIGTERM, catch);
  101. ,#endif
  102. ,#ifdef SIGXCPU
  103. ,  signal (SIGXCPU, catch);
  104. ,#endif
  105. ,#ifdef SIGXFSZ
  106. ,  signal (SIGXFSZ, catch);
  107. ,#endif
  108. ,#ifdef SIGVTALRM
  109. ,  signal (SIGVTALRM, catch);
  110. ,#endif
  111. ,#ifdef SIGPROF
  112. ,  signal (SIGPROF, catch);
  113. ,#endif
  114. ,#ifdef SIGLOST
  115. ,  signal (SIGLOST, catch);
  116. ,#endif
  117. ,#ifdef SIGUSR1
  118. ,  signal (SIGUSR1, catch);
  119. ,#endif
  120. ,#ifdef SIGUSR2
  121. ,  signal (SIGUSR2, catch);
  122. ,#endif
  123. ,}
  124. ,
  125. ,#ifdef SIGTSTP
  126. ,suspendmyself ()
  127. ,{
  128. ,  kill (getpid (), SIGTSTP);
  129. ,}
  130. ,FLAG cansuspendmyself = TRUE;
  131. ,#else
  132. ,suspendmyself () {}
  133. ,FLAG cansuspendmyself = FALSE;
  134. ,#endif
  135. ,
  136. ,#ifdef SIGWINCH
  137. ,/*
  138. , * Catch the SIGWINCH signal sent to mined.
  139. , */
  140. ,catchwinch ()
  141. ,{
  142. ,  winchg = TRUE;
  143. ,/*  if (waitingforinput == TRUE) RDwin ();    now done in __readchar () */
  144. ,  signal (SIGWINCH, catchwinch); /* Re-installation of the signal */
  145. ,}
  146. ,#endif
  147. ,
  148. ,#ifdef SIGQUIT
  149. ,/*
  150. , * Catch the SIGQUIT signal (^\) sent to mined. It turns on the quitflag.
  151. , */
  152. ,catchquit ()
  153. ,{
  154. ,#ifdef UNUSED /* Should not be needed with new __readchar () */
  155. ,/* Was previously needed on SUN but showed bad effects on Iris. */
  156. ,  static char quitchar = '\0';
  157. ,  if (waitingforinput == TRUE)
  158. ,    /* simulate input to enable immediate break also during input */
  159. ,    ioctl (input_fd, TIOCSTI, & quitchar);
  160. ,#endif
  161. ,  quit = TRUE;
  162. ,  signal (SIGQUIT, catchquit); /* Re-installation of the signal */
  163. ,}
  164. ,#endif
  165. ,
  166. ,#ifdef SIGINT
  167. ,/*
  168. , * Catch the SIGINT signal (^C) sent if it cannot be ignored by tty driver
  169. , */
  170. ,catchint ()
  171. ,{
  172. ,  intr = TRUE;
  173. ,  signal (SIGINT, catchint); /* Re-installation of the signal */
  174. ,}
  175. ,#endif
  176. ,
  177. ,/*  ==================================================================    *
  178. , *            Terminal mode switcher                *
  179. , *  ==================================================================    */
  180. ,
  181. ,/*
  182. , * Set and reset tty into CBREAK or old mode according to argument `state'.
  183. , * It also sets all signal characters (except for ^\) to UNDEF. ^\ is caught.
  184. , */
  185. ,raw_mode (state)
  186. ,  FLAG state;
  187. ,{
  188. ,#ifdef TERMIO
  189. ,  static struct termios old_termio;
  190. ,     struct termios new_termio;
  191. ,#define gettermio(fd, iopoi)    tcgetattr (fd, iopoi);
  192. ,#define settermio(fd, iopoi)    tcsetattr (fd, TCSADRAIN, iopoi); /**/
  193. ,/* #define gettermio(fd, iopoi)    ioctl (fd, TCGETS, iopoi);
  194. ,   #define settermio(fd, iopoi)    ioctl (fd, TCSETSW, iopoi); /**/
  195. ,#endif
  196. ,#ifdef SGTTY
  197. ,  static struct sgttyb old_tty;
  198. ,     struct sgttyb new_tty;
  199. ,  static int oldlmode;
  200. ,     int lmode;
  201. ,  static struct tchars old_tchars;
  202. ,  static struct ltchars old_ltchars;
  203. ,#define NDEF '\377'
  204. ,  static struct tchars new_tchars = {NDEF, QUITCHAR, NDEF, NDEF, NDEF, NDEF};
  205. ,  static struct ltchars new_ltchars = {NDEF, NDEF, NDEF, NDEF, NDEF, NDEF};
  206. ,/* correspondence between the tchars/ltchars characters of the sgtty 
  207. ,   interface and the c_cc characters of the termios interface (codes vary):
  208. ,    sgtty        termio        sgtty        termio
  209. ,    t_intrc        VINTR        t_suspc        VSUSP
  210. ,    t_quitc        VQUIT        t_dsuspc    VDSUSP
  211. ,    t_startc    VSTART        t_rprntc    VREPRINT
  212. ,    t_stopc        VSTOP        t_flushc    VDISCARD
  213. ,    t_eofc        VEOF (VMIN)    t_werasc    VWERASE
  214. ,    t_brkc        VEOL (VTIME)    t_lnextc    VLNEXT
  215. ,*/
  216. ,#endif
  217. ,
  218. ,  if (state == OFF) {
  219. ,    isscreenmode = FALSE;
  220. ,#ifdef CURSES
  221. ,    endwin ();
  222. ,#ifdef vms
  223. ,    system ("set terminal /ttsync /nopasthru");
  224. ,#endif
  225. ,#else
  226. ,    end_screen_mode ();
  227. ,    flush ();
  228. ,#endif
  229. ,#ifdef TERMIO
  230. ,    settermio (input_fd, & old_termio);
  231. ,#endif
  232. ,#ifdef SGTTY
  233. ,    ioctl (input_fd, TIOCSETP, & old_tty);
  234. ,    ioctl (input_fd, TIOCSETC, & old_tchars);
  235. ,    ioctl (input_fd, TIOCSLTC, & old_ltchars);
  236. ,    ioctl (input_fd, TIOCLSET, & oldlmode);
  237. ,#endif
  238. ,    return;
  239. ,  }
  240. ,
  241. ,  else /* (state == ON) */ {
  242. ,    isscreenmode = TRUE;
  243. ,#ifdef CURSES
  244. ,    refresh ();
  245. ,#else
  246. ,    start_screen_mode ();
  247. ,    flush ();
  248. ,#endif
  249. ,#ifdef TERMIO
  250. ,    gettermio (input_fd, & old_termio);
  251. ,    gettermio (input_fd, & new_termio);
  252. ,
  253. ,    new_termio.c_iflag &= ~(ISTRIP|IXON|IXOFF);
  254. ,    new_termio.c_oflag &= ~OPOST;
  255. ,    new_termio.c_cflag &= ~(PARENB|CSIZE);
  256. ,    new_termio.c_cflag |= CS8;
  257. ,    new_termio.c_lflag &= ~(ICANON|ECHO);
  258. ,#define NDEF '\000'
  259. ,    new_termio.c_cc [VMIN] = 1;
  260. ,    new_termio.c_cc [VTIME] = 0;
  261. ,    new_termio.c_cc [VQUIT] = QUITCHAR;
  262. ,    new_termio.c_cc [VINTR] = NDEF;
  263. ,    new_termio.c_cc [VSUSP] = NDEF;
  264. ,#ifdef VDISCARD
  265. ,    new_termio.c_cc [VDISCARD] = NDEF;
  266. ,#endif
  267. ,    settermio (input_fd, & new_termio);
  268. ,#endif
  269. ,#ifdef SGTTY
  270. ,/* Save old tty settings */
  271. ,    ioctl (input_fd, TIOCGETP, & old_tty);
  272. ,    ioctl (input_fd, TIOCGETC, & old_tchars);
  273. ,    ioctl (input_fd, TIOCGLTC, & old_ltchars);
  274. ,    ioctl (input_fd, TIOCLGET, & oldlmode);
  275. ,/* Set line mode */
  276. ,/* If this feature should not be available on some system, RAW must be used
  277. ,   instead of CBREAK below to enable 8 bit characters on output */
  278. ,    lmode = oldlmode;
  279. ,    lmode |= LPASS8; /* enable 8 bit characters on input in CBREAK mode */
  280. ,    lmode |= LLITOUT; /* enable 8 bit characters on output in CBREAK mode;
  281. ,        this may not be necessary in newer Unixes, e.g. SUN-OS 4;
  282. ,        output handling is slightly complicated by LITOUT */
  283. ,    ioctl (input_fd, TIOCLSET, & lmode);
  284. ,/* Set tty to CBREAK (or RAW) mode */
  285. ,    new_tty = old_tty;
  286. ,    new_tty.sg_flags &= ~ECHO;
  287. ,    new_tty.sg_flags |= CBREAK;
  288. ,    ioctl (input_fd, TIOCSETP, & new_tty);
  289. ,/* Unset signal chars */
  290. ,    ioctl (input_fd, TIOCSETC, & new_tchars);  /* Only leaves QUITCHAR */
  291. ,    ioctl (input_fd, TIOCSLTC, & new_ltchars); /* Leaves nothing */
  292. ,#endif
  293. ,
  294. ,/* Define signal handlers */
  295. ,#ifdef SIGQUIT
  296. ,    signal (SIGQUIT, catchquit);    /* Catch QUITCHAR (^\) */
  297. ,#endif
  298. ,#ifdef SIGINT
  299. ,    signal (SIGINT, catchint);    /* Catch INTR char (^C) */
  300. ,#endif
  301. ,#ifdef SIGWINCH
  302. ,    signal (SIGWINCH, catchwinch);    /* Catch window size changes */
  303. ,#endif
  304. ,  }
  305. ,}
  306. ,
  307. ,/*  ==================================================================    *
  308. , *            Unix I/O routines                *
  309. , *  ==================================================================    */
  310. ,
  311. ,#ifdef CURSES
  312. ,
  313. ,__putchar (c)
  314. ,  register u_char c;
  315. ,{ addch (c); }
  316. ,
  317. ,putstring (str)
  318. ,  register u_char * str;
  319. ,{ addstr (str); }
  320. ,
  321. ,flush ()
  322. ,{ refresh (); }
  323. ,
  324. ,FLAG can_add_line = TRUE, can_delete_line = TRUE, can_clear_eol = TRUE;
  325. ,
  326. ,clear_screen ()
  327. ,{
  328. ,  clear ();
  329. ,}
  330. ,clear_eol ()
  331. ,{
  332. ,  clrtoeol ();
  333. ,}
  334. ,scroll_forward ()
  335. ,{
  336. ,  scroll (stdscr);
  337. ,}
  338. ,scroll_reverse ()
  339. ,{ /* only called if cursor is at top of screen */
  340. ,  insertln ();
  341. ,}
  342. ,add_line (y)
  343. ,  register int y;
  344. ,{
  345. ,  move (y, 0);
  346. ,  insertln ();
  347. ,}
  348. ,delete_line (y)
  349. ,  register int y;
  350. ,{
  351. ,  move (y, 0);
  352. ,  deleteln ();
  353. ,}
  354. ,move_cursor (x, y)
  355. ,  register int x, y;
  356. ,{
  357. ,  move (y, x);
  358. ,}
  359. ,reverse_on ()
  360. ,{
  361. ,  standout ();
  362. ,}
  363. ,reverse_off ()
  364. ,{
  365. ,  standend ();
  366. ,}
  367. ,
  368. ,get_term_cap (TERMname)
  369. ,  char * TERMname;
  370. ,{
  371. ,#ifdef vms
  372. ,  system ("set terminal /pasthru /nottsync");
  373. ,#endif
  374. ,  initscr ();
  375. ,#ifdef vms
  376. ,  crmode ();
  377. ,#else
  378. ,  crmode (); /* cbreak (); */
  379. ,  nonl ();
  380. ,#endif
  381. ,  noecho ();
  382. ,  scrollok (stdscr, TRUE);
  383. ,#ifdef unix
  384. ,#ifndef vax
  385. ,  idlok (stdscr, TRUE);
  386. ,#ifndef sun
  387. ,  typeahead (input_fd);
  388. ,#endif
  389. ,#endif
  390. ,#endif
  391. ,
  392. ,  YMAX = LINES - 1;    /* # of lines */
  393. ,  XMAX = COLS - 1;    /* # of columns */
  394. ,  getwinsize ();
  395. ,}
  396. ,
  397. ,/*------------------------------------------------------------------------*/
  398. ,#else    /* not CURSES */
  399. ,
  400. ,__putchar (c)
  401. ,  register u_char c;
  402. ,{ writechar (output_fd, (c)); }
  403. ,
  404. ,putstring (str)
  405. ,  register u_char * str;
  406. ,{ writestring (output_fd, (str)); }
  407. ,
  408. ,flush ()
  409. ,{ flush_buffer (output_fd); }
  410. ,
  411. ,#ifdef unix
  412. ,
  413. ,/* Storage for the terminal control sequences */
  414. ,char *cCL, *cCE, *cSR, *cAL, *cDL, *cCS, *cSC, *cRC,
  415. ,     *cCM, *cSO, *cSE, *cVS, *cVE, *cTI, *cTE;
  416. ,#define aff1 0
  417. ,#define affmax YMAX
  418. ,
  419. ,FLAG can_add_line = FALSE, can_delete_line = FALSE, can_clear_eol = FALSE;
  420. ,
  421. ,clear_screen ()
  422. ,{
  423. ,  tputs (cCL, affmax, __putchar);
  424. ,}
  425. ,clear_eol ()
  426. ,{
  427. ,  if (cCE) tputs (cCE, aff1, __putchar);
  428. ,  else putstring (blank_line);
  429. ,}
  430. ,scroll_forward ()
  431. ,{
  432. ,  move_cursor (0, YMAX);
  433. ,/*  putchar ('\n');    */
  434. ,  tputs ("\n", affmax, __putchar);
  435. ,}
  436. ,scroll_reverse ()
  437. ,{
  438. ,  tputs (cSR, affmax, __putchar);
  439. ,}
  440. ,add_line (y)
  441. ,  register int y;
  442. ,{
  443. ,  if (cAL) {
  444. ,    move_cursor (0, y);
  445. ,    tputs (cAL, affmax, __putchar);
  446. ,  }
  447. ,  else {
  448. ,    move_cursor (0, y);
  449. ,    tputs (cSC, aff1, __putchar);
  450. ,    tputs (tgoto (cCS, YMAX, y), aff1, __putchar);
  451. ,    tputs (cRC, aff1, __putchar);
  452. ,    tputs (cSR, affmax, __putchar);
  453. ,    tputs (tgoto (cCS, YMAX, 0), aff1, __putchar);
  454. ,    tputs (cRC, aff1, __putchar);
  455. ,  }
  456. ,}
  457. ,delete_line (y)
  458. ,  register int y;
  459. ,{
  460. ,  if (cDL) {
  461. ,    move_cursor (0, y);
  462. ,    tputs (cDL, affmax, __putchar);
  463. ,  }
  464. ,  else {
  465. ,    move_cursor (0, y);
  466. ,    tputs (cSC, aff1, __putchar);
  467. ,    tputs (tgoto (cCS, YMAX, y), aff1, __putchar);
  468. ,    move_cursor (0, YMAX);
  469. ,/*    putchar ('\n');    */
  470. ,    tputs ("\n", affmax, __putchar);
  471. ,    tputs (tgoto (cCS, YMAX, 0), aff1, __putchar);
  472. ,    tputs (cRC, aff1, __putchar);
  473. ,  }
  474. ,}
  475. ,move_cursor (x, y)
  476. ,  register int x, y;
  477. ,{
  478. ,  tputs (tgoto (cCM, x, y), aff1, __putchar);
  479. ,}
  480. ,reverse_on ()
  481. ,{
  482. ,  tputs (cSO, aff1, __putchar);
  483. ,}
  484. ,reverse_off ()
  485. ,{
  486. ,  tputs (cSE, aff1, __putchar);
  487. ,}
  488. ,start_screen_mode ()
  489. ,{
  490. ,  tputs (cTI, affmax, __putchar);
  491. ,  tputs (cVS, affmax, __putchar);
  492. ,/* Install correct scrolling region in case terminal is bigger than assumed */
  493. ,/* (this effect was observed after window size changes of Sun windows): */
  494. ,  if (cCS) tputs (tgoto (cCS, YMAX, 0), aff1, __putchar);
  495. ,}
  496. ,end_screen_mode ()
  497. ,{
  498. ,  tputs (cTE, affmax, __putchar);
  499. ,  tputs (cVE, affmax, __putchar);
  500. ,}
  501. ,
  502. ,get_term_cap (TERMname)
  503. ,  char * TERMname;
  504. ,{
  505. ,#define termbuflen 100
  506. ,  char entry [1024];
  507. ,  static char termbuf [termbuflen];
  508. ,  char * loc = termbuf;
  509. ,  extern char * tgetstr ();
  510. ,
  511. ,  if (tgetent (entry, TERMname) <= 0) {
  512. ,    panic ("Unknown terminal", NIL_PTR);
  513. ,  }
  514. ,
  515. ,  YMAX = tgetnum ("li", & loc) - 1;    /* # of lines */
  516. ,  XMAX = tgetnum ("co", & loc) - 1;    /* # of columns */
  517. ,/* getenv ("LINES"), getenv ("COLUMNS") ?! */
  518. ,  getwinsize ();
  519. ,
  520. ,  cCL = tgetstr ("cl", & loc);    /* clear screen */
  521. ,  cCE = tgetstr ("ce", & loc);    /* clear to end of line */
  522. ,  cSR = tgetstr ("sr", & loc);    /* scroll reverse */
  523. ,  cAL = tgetstr ("al", & loc);    /* add line */
  524. ,  if (!cSR) cSR = cAL;
  525. ,  cDL = tgetstr ("dl", & loc);    /* delete line */
  526. ,  cCS = tgetstr ("cs", & loc);    /* change scrolling region */
  527. ,  cSC = tgetstr ("sc", & loc);    /* save cursor    \ needed with vt100   */
  528. ,  cRC = tgetstr ("rc", & loc);    /* restore cursor / for add/delete line */
  529. ,  cCM = tgetstr ("cm", & loc);    /* cursor motion */
  530. ,  cSO = tgetstr ("so", & loc);    /* stand out mode */
  531. ,  cSE = tgetstr ("se", & loc);    /* end " */
  532. ,  cVS = tgetstr ("vs", & loc);    /* visual mode */
  533. ,  cVE = tgetstr ("ve", & loc);    /* end " */
  534. ,  cTI = tgetstr ("ti", & loc);    /* positioning mode */
  535. ,  cTE = tgetstr ("te", & loc);    /* end " */
  536. ,
  537. ,  if (cAL || (cSR && cCS)) can_add_line = TRUE;
  538. ,  if (cDL || cCS) can_delete_line = TRUE;
  539. ,  if (cCE) can_clear_eol = TRUE;
  540. ,
  541. ,  if (loc > termbuf + termbuflen) {
  542. ,    panic ("Terminal control strings don't fit", NIL_PTR);
  543. ,  }
  544. ,  if (!cCL || !cCM || !cSR || !cCE /* || !cSO || !cSE */ ) {
  545. ,    panic ("Sorry, no mined on this type of terminal", NIL_PTR);
  546. ,  }
  547. ,}
  548. ,
  549. ,/*------------------------------------------------------------------------*/
  550. ,#endif unix
  551. ,
  552. ,#ifdef msdos
  553. ,#ifdef conio
  554. ,#include <conio.h>
  555. ,
  556. ,FLAG can_add_line = TRUE, can_delete_line = TRUE, can_clear_eol = TRUE;
  557. ,
  558. ,clear_screen ()
  559. ,{ clrscr (); }
  560. ,clear_eol ()
  561. ,{ clreol (); }
  562. ,scroll_forward ()
  563. ,{
  564. ,  move_cursor (0, YMAX);
  565. ,  putchar ('\n');
  566. ,}
  567. ,scroll_reverse ()
  568. ,{ /* only called if cursor is at top of screen */
  569. ,  insline ();
  570. ,}
  571. ,add_line (y)
  572. ,  register int y;
  573. ,{
  574. ,  move_cursor (0, y);
  575. ,  insline ();
  576. ,}
  577. ,delete_line (y)
  578. ,  register int y;
  579. ,{
  580. ,  move_cursor (0, y);
  581. ,  delline ();
  582. ,}
  583. ,move_cursor (x, y)
  584. ,{
  585. ,  gotoxy (x + 1, y + 1);
  586. ,}
  587. ,reverse_on ()
  588. ,{ highvideo ();
  589. ,}
  590. ,reverse_off ()
  591. ,{ normvideo ();
  592. ,}
  593. ,start_screen_mode ()
  594. ,{}
  595. ,end_screen_mode ()
  596. ,{}
  597. ,
  598. ,get_term ()
  599. ,{
  600. ,  getwinsize ();
  601. ,}
  602. ,
  603. ,getwinsize ()
  604. ,{
  605. ,/* this has to be extended to request the current screen size */
  606. ,  struct text_info scrinfo;
  607. ,
  608. ,  gettextinfo (& scrinfo);
  609. ,  /* This seems to be a junk procedure since no other information than
  610. ,     25 * 80 comes out in 50 lines mode */
  611. ,  YMAX = scrinfo.screenheight - 1;
  612. ,  XMAX = scrinfo.screenwidth - 1;
  613. ,}
  614. ,
  615. ,#else   # conio
  616. ,
  617. ,/* adjust the following values to the capabilities of your ANSI driver: */
  618. ,FLAG can_add_line = TRUE, can_delete_line = TRUE, can_clear_eol = TRUE;
  619. ,
  620. ,clear_screen ()
  621. ,{ putstring ("[2J"); }
  622. ,clear_eol ()
  623. ,{ putstring ("[K"); }
  624. ,scroll_forward ()
  625. ,{
  626. ,  move_cursor (0, YMAX);
  627. ,  putchar ('\n');
  628. ,}
  629. ,scroll_reverse ()
  630. ,{ /* only called if cursor is at top of screen */
  631. ,  putstring ("[1L");
  632. ,}
  633. ,add_line (y)
  634. ,  register int y;
  635. ,{
  636. ,  move_cursor (0, y);
  637. ,  putstring ("[1L");
  638. ,}
  639. ,delete_line (y)
  640. ,  register int y;
  641. ,{
  642. ,  move_cursor (0, y);
  643. ,  putstring ("[1M");
  644. ,}
  645. ,move_cursor (x, y)
  646. ,  register int x, y;
  647. ,{ static char s [11];
  648. ,  build_string (s, "[%d;%dH", y + 1, x + 1);
  649. ,  putstring (s);
  650. ,}
  651. ,char reverse_on_str [30] = "[7m";    /* inverse mode */
  652. ,char reverse_off_str [30] = "[27m";    /* inverse off */
  653. ,reverse_on ()
  654. ,{ putstring (reverse_on_str); /* 1m | 7m | 7m    | 7;2m */
  655. ,}
  656. ,reverse_off ()
  657. ,{ putstring (reverse_off_str); /* m  | 0m | 0m 1m | m    */
  658. ,}
  659. ,start_screen_mode ()
  660. ,{}
  661. ,end_screen_mode ()
  662. ,{}
  663. ,
  664. ,get_term ()
  665. ,{
  666. ,  char * colstr = unnull (getenv ("MINEDCOL"));
  667. ,  char * coloff = colstr;
  668. ,  while (* coloff != '\0' && * coloff != ' ') coloff ++;
  669. ,  if (* coloff == ' ') {* coloff = '\0'; coloff ++;}
  670. ,  if (* colstr != '\0') build_string (reverse_on_str, "[%sm", colstr);
  671. ,  if (* coloff != '\0') build_string (reverse_off_str, "[%sm", coloff);
  672. ,  getwinsize ();
  673. ,}
  674. ,
  675. ,getwinsize ()
  676. ,{
  677. ,  move_cursor (200, 200);
  678. ,  putstring ("[6n");
  679. ,  flush ();
  680. ,  (void) readchar (); (void) readchar ();
  681. ,  get_digits (& YMAX); YMAX = YMAX - 1;
  682. ,  get_digits (& XMAX); XMAX = XMAX - 1;
  683. ,  readchar ();    /* NNANSI sends a final return */
  684. ,}
  685. ,
  686. ,#endif else conio
  687. ,#endif msdos
  688. ,
  689. ,#endif else CURSES
  690. ,
  691. ,/*------------------------------------------------------------------------*/
  692. ,
  693. ,/*
  694. , * Read a character from the operating system and handle interrupts.
  695. , * Concerning problems due to the interference of read operations and
  696. , * incoming signals (QUIT, WINCH) see the comments at readchar ().
  697. , */
  698. ,strange (err)
  699. ,  char * err;
  700. ,{
  701. ,  ring_bell ();
  702. ,  error ("Read interrupted: ", err);
  703. ,  sleep (1);
  704. ,  ring_bell ();
  705. ,  return QUITCHAR;
  706. ,}
  707. ,
  708. ,/*
  709. , * Is a character available within msec milliseconds from file no fid?
  710. , */
  711. ,int
  712. ,inputreadyafter (fid, msec)
  713. ,  int fid;
  714. ,  int msec;
  715. ,{
  716. ,#ifdef selectread
  717. ,  int readfds;
  718. ,  static struct timeval timeoutstru = {0, 0};
  719. ,  register int nfds;
  720. ,
  721. ,  readfds = 1 << fid;
  722. ,  timeoutstru.tv_usec = 1000 * msec;
  723. ,  nfds = select (fid + 1, & readfds, 0, 0, & timeoutstru);
  724. ,  return nfds;
  725. ,#else
  726. ,  if (msec < 500)
  727. ,    return 1;
  728. ,  else    return 0;
  729. ,#endif
  730. ,}
  731. ,
  732. ,/*
  733. , * Read a char from operating system, handle interrupts if possible, 
  734. , * handle window size changes if possible.
  735. , */
  736. ,#ifdef selectread
  737. ,__readchar ()
  738. ,{
  739. ,  u_char c;
  740. ,  register int n;
  741. ,  int readfds, exceptfds;
  742. ,
  743. ,  do {
  744. ,    if (winchg == TRUE) RDwin ();
  745. ,    readfds = 1 << input_fd;
  746. ,    exceptfds = readfds;
  747. ,    select (input_fd + 1, & readfds, 0, & exceptfds, 0);
  748. ,    if (exceptfds) {
  749. ,       if (quit == TRUE) return QUITCHAR;
  750. ,       else if (winchg == TRUE) ;
  751. ,       else if (intr == TRUE) {intr = FALSE; return '\003';}
  752. ,       else return strange ("exception");
  753. ,    }
  754. ,    else
  755. ,#ifdef _getch_
  756. ,       return getch ();
  757. ,#else
  758. ,    {
  759. ,       if ((n = read (input_fd, & c, 1)) == 1) return c;
  760. ,       else if ((n == 0) || (geterrno () != EINTR))
  761. ,        panicio ("Error during character input", serror ());
  762. ,       else return strange (serror ());
  763. ,    }
  764. ,#endif
  765. ,  } while (TRUE);
  766. ,}
  767. ,#else
  768. ,__readchar ()
  769. ,{
  770. ,  u_char c;
  771. ,
  772. ,#ifdef _getch_
  773. ,  c = getch ();
  774. ,  if (intr == TRUE) {intr = FALSE; c = '\003';}
  775. ,#else
  776. ,  if (read (input_fd, & c, 1) != 1 && quit == FALSE) {
  777. ,    if (geterrno () == EINTR) return __readchar ();
  778. ,    else panicio ("Error during character input", serror ());
  779. ,  }
  780. ,#endif
  781. ,  if (quit == TRUE) c = QUITCHAR;
  782. ,  return c;
  783. ,}
  784. ,#endif
  785. ,
  786. ,/*------------------------------------------------------------------------*/
  787. ,
  788. ,#ifdef vms
  789. ,
  790. ,get_term ()
  791. ,{
  792. ,  get_term_cap (NIL_PTR);
  793. ,}
  794. ,
  795. ,getwinsize ()
  796. ,{ }
  797. ,
  798. ,#endif vms
  799. ,
  800. ,#ifdef unix
  801. ,
  802. ,/*
  803. , * Get current window size
  804. , */
  805. ,getwinsize ()
  806. ,{
  807. ,  struct winsize winsiz;
  808. ,
  809. ,  ioctl (output_fd, TIOCGWINSZ, & winsiz);
  810. ,  if (winsiz.ws_row != 0) YMAX = winsiz.ws_row - 1;
  811. ,  if (winsiz.ws_col != 0) XMAX = winsiz.ws_col - 1;
  812. ,}
  813. ,
  814. ,/*
  815. , * Get terminal information
  816. , */
  817. ,get_term ()
  818. ,{
  819. ,  char * TERMname = (char *) getenv ("TERM");
  820. ,
  821. ,  if (TERMname == NIL_PTR)
  822. ,    panic ("Terminal not specified", NIL_PTR);
  823. ,
  824. ,/*
  825. ,  if (  (strisprefix ("vt", TERMname) && strlen (TERMname) > 2)
  826. ,     || strisprefix ("sun", TERMname)
  827. ,     || strisprefix ("xterm", TERMname)
  828. ,     )
  829. ,    SHIFT_MARK = ';';
  830. ,  else    SHIFT_MARK = '>';
  831. ,*/
  832. ,
  833. ,  get_term_cap (TERMname);
  834. ,
  835. ,/* build_string (text_buffer, "Terminal is %s, %d * %d.\n", TERMname, YMAX+1, XMAX+1);
  836. ,  putstring (text_buffer); */
  837. ,}
  838. ,
  839. ,#endif unix
  840. ,
  841. ,/*  ==================================================================    *
  842. , *                End                    *
  843. , *  ==================================================================    */
  844. EOSED
  845.  
  846. echo ---------------------- extracting minedmp.c -----------------
  847. sed 's/^,//' << \EOSED > minedmp.c
  848. ,/*  ==================================================================    *
  849. , *                Editor mined                *
  850. , *            Command and character set mappings        *
  851. , *  ==================================================================    */
  852. ,
  853. ,#include "mined.h"
  854. ,
  855. ,#define iso_latin_1
  856. ,
  857. ,#ifdef msdos
  858. ,#undef iso_latin_1
  859. ,#undef dec_sup
  860. ,#define pc_charset
  861. ,#endif
  862. ,
  863. ,/*  ==================================================================    *
  864. , *            character set coding                *
  865. , *  ==================================================================    */
  866. ,
  867. ,/*
  868. , * Determine a default diacritic character value for _readchar ().
  869. , * The characters are given literally except for the MSDOS version in order
  870. , * not to depend on the function of a character set translator.
  871. , * For all non-MSDOS platforms, ISO-Latin1 or the very similar 
  872. , * DEC-Supplemental are assumed.
  873. , * For MSDOS, characters for the "International Codepage" ("850") are 
  874. , * generated which includes the real letters (not all graphic and Greek 
  875. , * characters) of the old IBM codepage ("437") (which, by the way, some 
  876. , * time ago someone must have designed in an attack of mental sickness).
  877. , */
  878. ,u_char
  879. ,diacritic (c)
  880. ,  u_char c;
  881. ,{
  882. ,  /*    the following characters cannot be inserted by this function:
  883. ,    )*.:<=> and MSDOS graphics characters */
  884. ,  switch (c) {
  885. ,#ifdef pc_charset
  886. ,    case 'C' : return 128;
  887. ,    case 'c' : return 135;
  888. ,    case 'N' : return 165;
  889. ,    case 'n' : return 164;
  890. ,    case 's' : return 225;
  891. ,    case '!' : return 173;
  892. ,    case '$' : return 189;
  893. ,    case '/' : return 189;
  894. ,    case 'l' : return 156;
  895. ,    case 'L' : return 156;
  896. ,    case 'Y' : return 190;
  897. ,    case '+' : return 241;
  898. ,    case '?' : return 168;
  899. ,    case '0' : return 248;
  900. ,    case '1' : return 251;
  901. ,    case '2' : return 253;
  902. ,    case '3' : return 252;
  903. ,    case '<' : return 174;
  904. ,    case '>' : return 175;
  905. ,    case ':' : return 246;
  906. ,    case 'x' : return 158;
  907. ,    case 'f' : return 159;
  908. ,    case 'D' : return 209;
  909. ,    case 'd' : return 208;
  910. ,    case 'P' : return 232;
  911. ,    case 'p' : return 231;
  912. ,    case 'i' : return 213;
  913. ,    case '|' : return 221;
  914. ,    case '&' : return 244;
  915. ,    case '\\' : return 170;
  916. ,    case '_' : return 238;
  917. ,    case '-' : return 240;
  918. ,    case 'm' : return 230;
  919. ,    case '=' : return 242;
  920. ,    case '#' : return 245;
  921. ,    case '.' : return 250;
  922. ,    case ',' : return 247;
  923. ,    case '\'' : return 239;
  924. ,    case 'X' : return 207;
  925. ,#else
  926. ,    case 'C' : return 'G';
  927. ,    case 'c' : return 'g';
  928. ,    case 'N' : return 'Q';
  929. ,    case 'n' : return 'q';
  930. ,    case 's' : return '_';
  931. ,    case '!' : return '!';
  932. ,    case '$' : return '"';
  933. ,    case '/' : return '"';
  934. ,    case 'l' : return '#';
  935. ,    case 'L' : return '#';
  936. ,    case 'Y' : return '%';
  937. ,    case '+' : return '1';
  938. ,    case '?' : return '?';
  939. ,    case '0' : return '0';
  940. ,    case '2' : return '2';
  941. ,    case '<' : return '+';
  942. ,    case '>' : return ';';
  943. ,    case 'D' : return 'P';
  944. ,    case 'd' : return 'p';
  945. ,    case 'P' : return '^';
  946. ,    case 'p' : return '~';
  947. ,    case '|' : return '&';
  948. ,    case '&' : return ''';
  949. ,    case '\\' : return ',';
  950. ,    case '_' : return '/';
  951. ,    case '-' : return '-';
  952. ,    case 'm' : return '5';
  953. ,    case '#' : return '6';
  954. ,    case '.' : return '7';
  955. ,    case '*' : return '7';
  956. ,    case ',' : return '8';
  957. ,    case '\'' : return '4';
  958. ,    case '1' : return '9';
  959. ,    case '3' : return '3';
  960. ,#ifdef iso_latin_1
  961. ,    case 'X' : return '$';
  962. ,    case '"' : return '(';
  963. ,    case 'x' : return 'W';
  964. ,    case ':' : return 'w';
  965. ,#endif
  966. ,#ifdef dec_sup
  967. ,    case 'X' : return '('; /* $ */
  968. ,#endif
  969. ,#endif
  970. ,    default: return c;
  971. ,  }
  972. ,}
  973. ,
  974. ,grave (ch)
  975. ,  u_char ch;
  976. ,{
  977. ,    switch (ch) {
  978. ,#ifdef pc_charset
  979. ,        case 'A' : return 183;
  980. ,        case 'E' : return 212;
  981. ,        case 'I' : return 222;
  982. ,        case 'O' : return 227;
  983. ,        case 'U' : return 235;
  984. ,        case 'a' : return 133;
  985. ,        case 'e' : return 138;
  986. ,        case 'i' : return 141;
  987. ,        case 'o' : return 149;
  988. ,        case 'u' : return 151;
  989. ,#else
  990. ,        case 'A' : return '@';
  991. ,        case 'E' : return 'H';
  992. ,        case 'I' : return 'L';
  993. ,        case 'O' : return 'R';
  994. ,        case 'U' : return 'Y';
  995. ,        case 'a' : return '`';
  996. ,        case 'e' : return 'h';
  997. ,        case 'i' : return 'l';
  998. ,        case 'o' : return 'r';
  999. ,        case 'u' : return 'y';
  1000. ,#endif
  1001. ,        default : return diacritic (ch);
  1002. ,    }
  1003. ,}
  1004. ,circumflex (ch)
  1005. ,  u_char ch;
  1006. ,{
  1007. ,    switch (ch) {
  1008. ,#ifdef pc_charset
  1009. ,        case 'A' : return 182;
  1010. ,        case 'E' : return 210;
  1011. ,        case 'I' : return 215;
  1012. ,        case 'O' : return 226;
  1013. ,        case 'U' : return 234;
  1014. ,        case 'a' : return 131;
  1015. ,        case 'e' : return 136;
  1016. ,        case 'i' : return 140;
  1017. ,        case 'o' : return 147;
  1018. ,        case 'u' : return 150;
  1019. ,#else
  1020. ,        case 'A' : return 'B';
  1021. ,        case 'E' : return 'J';
  1022. ,        case 'I' : return 'N';
  1023. ,        case 'O' : return 'T';
  1024. ,        case 'U' : return '[';
  1025. ,        case 'a' : return 'b';
  1026. ,        case 'e' : return 'j';
  1027. ,        case 'i' : return 'n';
  1028. ,        case 'o' : return 't';
  1029. ,        case 'u' : return '{';
  1030. ,#endif
  1031. ,        default : return diacritic (ch);
  1032. ,    }
  1033. ,}
  1034. ,acute (ch)
  1035. ,  u_char ch;
  1036. ,{
  1037. ,    switch (ch) {
  1038. ,#ifdef pc_charset
  1039. ,        case 'A' : return 181;
  1040. ,        case 'E' : return 144;
  1041. ,        case 'I' : return 214;
  1042. ,        case 'O' : return 224;
  1043. ,        case 'U' : return 233;
  1044. ,        case 'a' : return 160;
  1045. ,        case 'e' : return 130;
  1046. ,        case 'i' : return 161;
  1047. ,        case 'o' : return 162;
  1048. ,        case 'u' : return 163;
  1049. ,        case 'Y' : return 237;
  1050. ,        case 'y' : return 236;
  1051. ,        case ' ' : return 239;
  1052. ,#else
  1053. ,        case 'A' : return 'A';
  1054. ,        case 'E' : return 'I';
  1055. ,        case 'I' : return 'M';
  1056. ,        case 'O' : return 'S';
  1057. ,        case 'U' : return 'Z';
  1058. ,        case 'a' : return 'a';
  1059. ,        case 'e' : return 'i';
  1060. ,        case 'i' : return 'm';
  1061. ,        case 'o' : return 's';
  1062. ,        case 'u' : return 'z';
  1063. ,        case ' ' : return '4';
  1064. ,#ifdef iso_latin_1
  1065. ,        case 'Y' : return ']';
  1066. ,        case 'y' : return '}';
  1067. ,#endif
  1068. ,#endif
  1069. ,        default : return diacritic (ch);
  1070. ,    }
  1071. ,}
  1072. ,diaeresis (ch)
  1073. ,  u_char ch;
  1074. ,{
  1075. ,    switch (ch) {
  1076. ,#ifdef pc_charset
  1077. ,        case 'A' : return 142;
  1078. ,        case 'E' : return 211;
  1079. ,        case 'I' : return 216;
  1080. ,        case 'O' : return 153;
  1081. ,        case 'U' : return 154;
  1082. ,        case 'a' : return 132;
  1083. ,        case 'e' : return 137;
  1084. ,        case 'i' : return 139;
  1085. ,        case 'o' : return 148;
  1086. ,        case 'u' : return 129;
  1087. ,        case 'y' : return 152;
  1088. ,        case ' ' : return 249;
  1089. ,#else
  1090. ,        case 'A' : return 'D';
  1091. ,        case 'E' : return 'K';
  1092. ,        case 'I' : return 'O';
  1093. ,        case 'O' : return 'V';
  1094. ,        case 'U' : return '\';
  1095. ,        case 'a' : return 'd';
  1096. ,        case 'e' : return 'k';
  1097. ,        case 'i' : return 'o';
  1098. ,        case 'o' : return 'v';
  1099. ,        case 'u' : return '|';
  1100. ,#ifdef iso_latin_1
  1101. ,        case ' ' : return '(';
  1102. ,        case 'y' : return '\377'; /* '' aborts sun compiler */
  1103. ,#endif
  1104. ,#ifdef dec_sup
  1105. ,        case 'Y' : return ']'; /* capital  */
  1106. ,        case 'y' : return '}'; /*  */
  1107. ,#endif
  1108. ,#endif
  1109. ,        default : return diacritic (ch);
  1110. ,    }
  1111. ,}
  1112. ,tilde (ch)
  1113. ,  u_char ch;
  1114. ,{
  1115. ,    switch (ch) {
  1116. ,#ifdef pc_charset
  1117. ,        case 'A' : return 199;
  1118. ,        case 'O' : return 229;
  1119. ,        case 'a' : return 198;
  1120. ,        case 'o' : return 228;
  1121. ,#else
  1122. ,        case 'A' : return 'C';
  1123. ,        case 'O' : return 'U';
  1124. ,        case 'a' : return 'c';
  1125. ,        case 'o' : return 'u';
  1126. ,#ifdef dec_sup
  1127. ,        case 'E' : return 'W'; /* OE */
  1128. ,        case 'e' : return 'w'; /* oe */
  1129. ,#endif
  1130. ,#endif
  1131. ,        default : return diacritic (ch);
  1132. ,    }
  1133. ,}
  1134. ,angstrom (ch)
  1135. ,  u_char ch;
  1136. ,{
  1137. ,    switch (ch) {
  1138. ,#ifdef pc_charset
  1139. ,        case 'A' : return 143;
  1140. ,        case 'E' : return 146;
  1141. ,        case 'O' : return 157;
  1142. ,        case 'a' : return 134;
  1143. ,        case 'e' : return 145;
  1144. ,        case 'o' : return 155;
  1145. ,#else
  1146. ,        case 'A' : return 'E';
  1147. ,        case 'E' : return 'F';
  1148. ,        case 'O' : return 'X';
  1149. ,        case 'a' : return 'e';
  1150. ,        case 'e' : return 'f';
  1151. ,        case 'o' : return 'x';
  1152. ,#endif
  1153. ,        default : return diacritic (ch);
  1154. ,    }
  1155. ,}
  1156. ,
  1157. ,/*  ==================================================================    *
  1158. , *        key and function key -> command mapping            *
  1159. , *  ==================================================================    */
  1160. ,
  1161. ,/* The mapping between input codes and functions */
  1162. ,
  1163. ,extern MUP (), MDN (), MLF (), MRT (), MNW (), MPW (), GOTO (), GOMA ();
  1164. ,extern SD (), SU (), PD (), PU (), HOME (), EF (), BL (), EL (), HIGH (), LOW ();
  1165. ,extern S (), SNL (), LIB (), DPC (), DCC (), DLN (), DNW (), DPW (), CTRl ();
  1166. ,extern QUED (), WT (), EDIT (), RD (), SH (), I (), FS (), REPT ();
  1167. ,extern SFW (), SRV (), RS (), LR (), GR (), REPL ();
  1168. ,extern MARK (), YA (), DT (), PT (), WB (), INF ();
  1169. ,extern HOP (), CANCEL (), ESCAPE (), HELP (), BAD (), FUNKEY (), DIRECT ();
  1170. ,extern EXED (), VIEW ();
  1171. ,
  1172. ,#ifdef unix
  1173. ,#define NULLcmd BAD
  1174. ,#define BSPcmd MLF
  1175. ,#endif
  1176. ,#ifdef msdos
  1177. ,#define NULLcmd FUNKEY    /* since FUNcmd is 0 */
  1178. ,#define BSPcmd DPC
  1179. ,#endif
  1180. ,#ifdef vms
  1181. ,#define NULLcmd ESCAPE
  1182. ,#define BSPcmd MLF
  1183. ,#endif
  1184. ,
  1185. ,int (* key_map [256]) () =
  1186. ,{    /* characters to functions map */
  1187. ,   /* 000-017 */ NULLcmd, MPW, DCC, PD, MRT, MUP, MNW, GOTO,
  1188. ,         BSPcmd, S, S, DLN, HOP, SNL, RS, LIB,
  1189. ,   /* 020-037 */ PT, HOP, PU, MLF, DNW, DT, CTRl, SU,
  1190. ,         MDN, YA, SD, ESCAPE, CANCEL, MARK, DPW, BAD,
  1191. ,   /* 040-057 */ S, S, S, S, S, S, S, S, S, S, S, S, S, S, S, S,
  1192. ,   /* 060-077 */ S, S, S, S, S, S, S, S, S, S, S, S, S, S, S, S,
  1193. ,   /* 100-117 */ S, S, S, S, S, S, S, S, S, S, S, S, S, S, S, S,
  1194. ,   /* 120-137 */ S, S, S, S, S, S, S, S, S, S, S, S, S, S, S, S,
  1195. ,   /* 140-157 */ S, S, S, S, S, S, S, S, S, S, S, S, S, S, S, S,
  1196. ,   /* 160-177 */ S, S, S, S, S, S, S, S, S, S, S, S, S, S, S, DPC,
  1197. ,#ifdef msdos
  1198. ,   /* 200-217 */ S, S, S, S, S, S, S, S, S, S, S, S, S, S, S, S,
  1199. ,   /* 220-237 */ S, S, S, S, S, S, S, S, S, S, S, S, S, S, S, S,
  1200. ,#else
  1201. ,   /* 200-217 */ FUNKEY, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I,
  1202. ,   /* 220-237 */ I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I,
  1203. ,#endif
  1204. ,   /* 240-257 */ S, S, S, S, S, S, S, S, S, S, S, S, S, S, S, S,
  1205. ,   /* 260-277 */ S, S, S, S, S, S, S, S, S, S, S, S, S, S, S, S,
  1206. ,   /* 300-317 */ S, S, S, S, S, S, S, S, S, S, S, S, S, S, S, S,
  1207. ,   /* 320-337 */ S, S, S, S, S, S, S, S, S, S, S, S, S, S, S, S,
  1208. ,   /* 340-357 */ S, S, S, S, S, S, S, S, S, S, S, S, S, S, S, S,
  1209. ,   /* 360-377 */ S, S, S, S, S, S, S, S, S, S, S, S, S, S, S, S,
  1210. ,};
  1211. ,
  1212. ,#ifdef msdos
  1213. ,/*
  1214. ,function keys deliver NUL and the following codes:
  1215. ,Block1: RGISOQHKPM
  1216. ,Block2: GHIKMOPQRS    Pos1 Up PgUp Left Center Right End Down PdDn Ins
  1217. ,Cntrl:    st <-/->
  1218. ,Cntrl:    wu Pos1/End
  1219. ,    dv PgUp / PgDn
  1220. ,F1-F10: ;<=>?@ABCD
  1221. ,shift:    TUVWXYZ[\]
  1222. ,cntrl:    ^_`abcdefg
  1223. ,alt:    hijklmnopq
  1224. ,*/
  1225. ,
  1226. ,HELPF ()
  1227. ,{ status_msg ("       F2 write  F3 edit  F6 \357  F7 \371  F8 search      F9 next  F10 hop"); }
  1228. ,HELPS ()
  1229. ,{ status_msg ("shift- F2 exit            F6 `  F7 ~  F8 search rev  F9 next  F10 hop"); }
  1230. ,HELPC ()
  1231. ,{ status_msg ("cntrl- F2 write  F3 view  F6 ^  F7 \370  F8 search next          F10 hop"); }
  1232. ,HELPA ()
  1233. ,{ status_msg ("alt-   F2 write buffer                F8 search rev           F10 hop"); }
  1234. ,
  1235. ,int (* pc_key_map [256]) () =
  1236. ,{    /* function characters to functions map */
  1237. ,   /* 000-017 */ I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I,
  1238. ,   /* 020-037 */ I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I,
  1239. ,   /* 040-057 */ I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I,
  1240. ,   /* 060-077 */ I, I, I, I, I, I, I, I, I, I, I, HELPF, WT, EDIT, I, I,
  1241. ,   /* 100-117 */ acute, diaeresis, SFW, RS, GOTO, I, I, MARK, MUP, PU, I, MLF, HOP, MRT, I, YA,
  1242. ,   /* 120-137 */ MDN, PD, PT, DCC, HELPS, EXED, I, I, I, grave, tilde, SRV, RS, GOTO, HELPC, WT,
  1243. ,   /* 140-157 */ VIEW, I, I, circumflex, angstrom, RS, I, GOTO, HELPA, WB, I, I, I, I, I, SRV,
  1244. ,   /* 160-177 */ I, GOTO, I, MPW, MNW, DT, SD, HOP, I, I, I, I, I, I, I, I,
  1245. ,   /* 200-217 */ I, I, I, I, SU, I, I, I, I, I, I, I, I, I, I, I,
  1246. ,   /* 220-237 */ I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I,
  1247. ,   /* 240-257 */ I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I,
  1248. ,   /* 260-277 */ I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I,
  1249. ,   /* 300-317 */ I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I,
  1250. ,   /* 320-337 */ I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I,
  1251. ,   /* 340-357 */ I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I,
  1252. ,   /* 360-377 */ I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I
  1253. ,};
  1254. ,#endif
  1255. ,
  1256. ,#ifndef msdos
  1257. ,
  1258. ,/* The mapping between function key sequences and functions */
  1259. ,
  1260. ,struct {char * fk; int (* fp) ();} keycode [] =
  1261. ,{    /* Escape-key sequences of function keys */
  1262. ,    /* VT100 and SUN */
  1263. ,    "[A",    MUP,    /* move cursor up    */
  1264. ,    "[B",    MDN,    /* more cursor down    */
  1265. ,    "[C",    MRT,    /* more cursor right    */
  1266. ,    "[D",    MLF,    /* more cursor left    */
  1267. ,    /* SUN raw keycodes */
  1268. ,    "[215z",    MUP,    /* move cursor up    */
  1269. ,    "[221z",    MDN,    /* more cursor down    */
  1270. ,    "[219z",    MRT,    /* more cursor right    */
  1271. ,    "[217z",    MLF,    /* more cursor left    */
  1272. ,    /* VT100 */
  1273. ,    "[6~",    PD,    /* Next Screen    */
  1274. ,    "[5~",    PU,    /* Prev Screen    */
  1275. ,    "[4~",    MARK,    /* Select    */
  1276. ,    "[3~",    DT,    /* Remove    */
  1277. ,    "[2~",    PT,    /* Insert Here    */
  1278. ,    "[1~",    SFW,    /* Find        */
  1279. ,    "[29~",    YA,    /* Do        */
  1280. ,    "[28~",    HELP,    /* Help        */
  1281. ,    "[17~",    diaeresis, /* F6    */
  1282. ,    "[18~",    diaeresis, /* F7    */
  1283. ,    "[19~",    SFW,    /* F8    */
  1284. ,    "[20~",    RS,    /* F9    */
  1285. ,    "[21~",    I,    /* F10    */
  1286. ,    "[23~",    I,    /* F11    */
  1287. ,    "[24~",    I,    /* F12    */
  1288. ,    "[25~",    I,    /* F13    */
  1289. ,    "[26~",    I,    /* F14    */
  1290. ,    "[31~",    I,    /* F17    */
  1291. ,    "[32~",    I,    /* F18    */
  1292. ,    "[33~",    I,    /* F19    */
  1293. ,    "[34~",    I,    /* F20    */
  1294. ,    "OP",    HOP,    /* PF1    */
  1295. ,    "OQ",    SU,    /* PF2    */
  1296. ,    "OR",    SD,    /* PF3    */
  1297. ,    "OS",    I,    /* PF4    */
  1298. ,    /* SUN */
  1299. ,    "[208z",    grave,        /* R1 */
  1300. ,    "[209z",    circumflex,    /* R2 */
  1301. ,    "[210z",    acute,        /* R3 */
  1302. ,    "[211z",    diaeresis,    /* R4 */
  1303. ,    "[212z",    tilde,        /* R5 */
  1304. ,    "[213z",    angstrom,    /* R6 */
  1305. ,    "[214z",    SU,    /* R7    */
  1306. ,    "[216z",    PU,    /* R9    */
  1307. ,    "[218z",    HOP,    /* R11    */
  1308. ,    "[220z",    SD,    /* R13    */
  1309. ,    "[222z",    PD,    /* R15    */
  1310. ,    "[254z",    GOMA,    /* - */
  1311. ,    "[253z",    MARK,    /* + */
  1312. ,    "[250z",    YA,    /* Enter */
  1313. ,    "[249z",    DT,    /* Del */
  1314. ,    "[247z",    PT,    /* Ins */
  1315. ,    "[2z",        PT,    /* Ins (NeWS) */
  1316. ,    "[192z",    MARK,    /* Stop */
  1317. ,    "[193z",    I,    /* Again */
  1318. ,    "[194z",    FS,    /* Props */
  1319. ,    "[195z",    I,    /* Undo */
  1320. ,    "[197z",    YA,    /* Copy */
  1321. ,    "[199z",    PT,    /* Paste */
  1322. ,    "[200z",    RS,    /* Find */
  1323. ,    "[201z",    DT,    /* Cut */
  1324. ,    "[196z",    HELP,    /* Help */
  1325. ,    "[225z",    I,    /* F2 */
  1326. ,    "[226z",    I,    /* F3 */
  1327. ,    "[227z",    I,    /* F4 */
  1328. ,    "[228z",    I,    /* F5 */
  1329. ,    "[229z",    PU,    /* F6 */
  1330. ,    "[230z",    PD,    /* F7 */
  1331. ,    "[231z",    SFW,    /* F8 */
  1332. ,    "[232z",    RS,    /* F9 */
  1333. ,    "[233z",    I,    /* F10 */
  1334. ,    "[234z",    I,    /* F11 */
  1335. ,    "[235z",    I,    /* F12 */
  1336. ,    /* Iris */
  1337. ,    "[209q",    MARK,    /* Print Screen */
  1338. ,    "[213q",    YA,    /* Scroll Lock */
  1339. ,/*    "[217q",    I,    /* Pause */
  1340. ,    "[139q",    PT,    /* Insert, Ins */
  1341. ,    "[P",    DT,    /* Del */
  1342. ,    "[H",    SU,    /* Home */
  1343. ,    "[150q",    PU,    /* PgUp */
  1344. ,    "[146q",    SD,    /* End */
  1345. ,    "[154q",    PD,    /* PgDn */
  1346. ,    "[000q",    HOP,    /* 5 */
  1347. ,    "[001q",    I,    /* F1 */
  1348. ,    "[002q",    I,    /* F2 */
  1349. ,    "[005q",    I,    /* F5 */
  1350. ,    "[006q",    I,    /* F6 */
  1351. ,    "[007q",    I,    /* F7 */
  1352. ,    "[008q",    SFW,    /* F8 */
  1353. ,    "[009q",    RS,    /* F9 */
  1354. ,    "[022q",    grave,        /* Shift-F10 */
  1355. ,    "[023q",    circumflex,    /* Shift-F11 */
  1356. ,    "[024q",    acute,        /* Shift-F12 */
  1357. ,    "[010q",    diaeresis,    /* F10 */
  1358. ,    "[011q",    tilde,        /* F11 */
  1359. ,    "[012q",    angstrom,    /* F12 */
  1360. ,    /* VT100 emulator at IBM-PC */
  1361. ,    "M",        PU,    /* Pg Up */
  1362. ,    "D",        PD,    /* Pg Dn */
  1363. ,/*    "[H",        SU,    /* Home    , same at Iris */
  1364. ,    "[24;1H",    SD,    /* End    */
  1365. ,    "1",        HOP,    /* Ins    */
  1366. ,        /* cursor keys and F1-4 same as VT100 */
  1367. ,    /* crttool */
  1368. ,    "m",        DIRECT,    /* direct cursor address */
  1369. ,    NIL_PTR
  1370. ,};
  1371. ,
  1372. ,#define MAXCODELEN 7 /* max. length of function key sequence to be detected, 
  1373. ,            depending on the keycode table => used in mined1.c */
  1374. ,
  1375. ,#endif
  1376. ,
  1377. ,/*  ==================================================================    *
  1378. , *                End                    *
  1379. , *  ==================================================================    */
  1380. EOSED
  1381.  
  1382. echo ---------------------- extracting mined.h -----------------
  1383. sed 's/^,//' << \EOSED > mined.h
  1384. ,/*  ====================================================================  *
  1385. , *                Mined.h                      *
  1386. , *  ====================================================================  */
  1387. ,
  1388. ,#ifndef minedH
  1389. ,#define minedH
  1390. ,
  1391. ,#define msdos
  1392. ,#ifdef unix
  1393. ,#  undef msdos
  1394. ,#endif
  1395. ,#ifdef vms
  1396. ,#  undef msdos
  1397. ,#endif
  1398. ,
  1399. ,#ifdef msdos
  1400. ,/* With Turbo-C, compile with memory model >= Compact */
  1401. ,/* #define conio doesn't work with current combined positioning/output method */
  1402. ,extern far * getenv ();
  1403. ,extern far * getcwd ();
  1404. ,#  define u_char unsigned char
  1405. ,#  include <fcntl.h>
  1406. ,#  define abort()    exit (1)
  1407. ,#  define FUNcmd    '\000'
  1408. ,#endif
  1409. ,
  1410. ,#ifdef vms
  1411. ,#  define u_char unsigned char
  1412. ,#  include <unixio.h>
  1413. ,#  include <file.h>    /* for the O_... attributes to open () */
  1414. ,#  include <unixlib.h>
  1415. ,#  undef putchar
  1416. ,#  undef FALSE
  1417. ,#  undef TRUE
  1418. ,#  define CURSES
  1419. ,#  define FUNcmd    '\200'
  1420. ,#endif
  1421. ,
  1422. ,#ifdef unix
  1423. ,#  include <stdio.h>
  1424. ,#  include <fcntl.h>
  1425. ,#  undef putchar
  1426. ,#  undef NULL
  1427. ,#  undef EOF
  1428. ,#  define FUNcmd    '\200'
  1429. ,#endif
  1430. ,
  1431. ,/*------------------------------------------------------------------------*/
  1432. ,
  1433. ,extern clear_screen ();
  1434. ,extern clear_eol ();
  1435. ,extern scroll_forward ();
  1436. ,extern scroll_reverse ();
  1437. ,extern add_line (/* y */);
  1438. ,extern delete_line (/* y */);
  1439. ,extern move_cursor (/* x, y */);
  1440. ,extern reverse_on ();
  1441. ,extern reverse_off ();
  1442. ,extern start_screen_mode ();
  1443. ,extern end_screen_mode ();
  1444. ,extern get_term ();
  1445. ,extern getwinsize ();
  1446. ,extern inputreadyafter ();
  1447. ,extern __readchar ();
  1448. ,
  1449. ,/*------------------------------------------------------------------------*/
  1450. ,
  1451. ,/* Set cursor at coordinates x, y */
  1452. ,#define set_cursor(nx, ny)    move_cursor(nx, ny)
  1453. ,
  1454. ,/* Screen size and display definitions. Coordinates start at 0, 0 */
  1455. ,#ifdef msdos
  1456. ,#  define maxYMAX        64
  1457. ,#  define maxXMAX        132
  1458. ,#else
  1459. ,#  define maxYMAX        126    /* 73 */
  1460. ,#  define maxXMAX        279    /* 163 */
  1461. ,#endif
  1462. ,
  1463. ,extern short YMAX;
  1464. ,extern short XMAX;
  1465. ,#define SCREENMAX    (YMAX - 1)    /* last line displayed (first is 0) */
  1466. ,#define XBREAK        (XMAX - 1)    /* Shift line display at this column */
  1467. ,#define SHIFT_SIZE    25        /* Number of chars to shift */
  1468. ,#define maxLINE_LEN    (maxXMAX + 1)    /* max screen line length */
  1469. ,#define screen_BUFL    (maxXMAX * maxYMAX)    /* Size of I/O buffering */
  1470. ,
  1471. ,#define MAX_CHARS    1024        /* max chars on one line of text */
  1472. ,        /* LINE_START must be rounded up to the lowest SHIFT_SIZE */
  1473. ,#define LINE_START    (((-MAX_CHARS - 1) / SHIFT_SIZE) * SHIFT_SIZE \
  1474. ,                     - SHIFT_SIZE)
  1475. ,#define LINE_END    (MAX_CHARS + 1)    /* Highest x-coordinate for line */
  1476. ,
  1477. ,#define BLOCK_SIZE    1024
  1478. ,
  1479. ,/* Return values of functions */
  1480. ,#define ERRORS        -1
  1481. ,#define NO_LINE        (ERRORS - 1)    /* Must be < 0 */
  1482. ,#define FINE         (ERRORS + 1)
  1483. ,#define NO_INPUT    (ERRORS + 2)
  1484. ,
  1485. ,#define STD_IN        0        /* Input file # */
  1486. ,#define STD_OUT         1        /* Terminal output file # */
  1487. ,#define STD_ERR        2
  1488. ,
  1489. ,#define REPORT    2        /* Report change of lines on # lines */
  1490. ,
  1491. ,/*
  1492. , * Common enum type for all flags used in mined.
  1493. , */
  1494. ,typedef enum {
  1495. ,/* General flags */
  1496. ,  FALSE,
  1497. ,  TRUE,
  1498. ,  OFF,
  1499. ,  ON,
  1500. ,/* yank_status and other */
  1501. ,  NOT_VALID,
  1502. ,  VALID,
  1503. ,
  1504. ,/* Expression flags */
  1505. ,  FORWARD,
  1506. ,  REVERSE,
  1507. ,
  1508. ,/* Yank flags */
  1509. ,  SMALLER,
  1510. ,  BIGGER,
  1511. ,  SAME,
  1512. ,/*  EMPTY, */
  1513. ,  NO_DELETE,
  1514. ,  DELETE,
  1515. ,  READ,
  1516. ,  WRITE
  1517. ,} FLAG;
  1518. ,
  1519. ,/*
  1520. , * The Line structure. Each line entry contains a pointer to the next line,
  1521. , * a pointer to the previous line, a pointer to the text and an unsigned char
  1522. , * telling at which offset of the line printing should start (usually 0).
  1523. , */
  1524. ,struct Line {
  1525. ,  struct Line * next;
  1526. ,  struct Line * prev;
  1527. ,  char * text;
  1528. ,  unsigned char shift_count;
  1529. ,};
  1530. ,
  1531. ,typedef struct Line LINE;
  1532. ,
  1533. ,/* Dummy line indicator */
  1534. ,#define DUMMY        0x80
  1535. ,#define DUMMY_MASK    0x7F
  1536. ,
  1537. ,/* Expression definitions */
  1538. ,#define NO_MATCH    0
  1539. ,#define MATCH        1
  1540. ,#define REG_ERROR    2
  1541. ,
  1542. ,#define BEGIN_LINE    (2 * REG_ERROR)
  1543. ,#define END_LINE    (2 * BEGIN_LINE)
  1544. ,
  1545. ,/*
  1546. , * The regex structure. Status can be any of 0, BEGIN_LINE or REG_ERROR. In
  1547. , * the last case, the result.err_mess field is assigned. Start_ptr and end_ptr
  1548. , * point to the match found. For more details see the documentation file.
  1549. , */
  1550. ,struct regex {
  1551. ,  union {
  1552. ,      char * err_mess;
  1553. ,      int * expression;
  1554. ,  } result;
  1555. ,  char status;
  1556. ,  char * start_ptr;
  1557. ,  char * end_ptr;
  1558. ,};
  1559. ,
  1560. ,typedef struct regex REGEX;
  1561. ,
  1562. ,/* NULL definitions */
  1563. ,#define NIL_PTR        ((char *) 0)
  1564. ,#define NIL_LINE    ((LINE *) 0)
  1565. ,#define NIL_REG        ((REGEX *) 0)
  1566. ,#define NIL_INT        ((int *) 0)
  1567. ,
  1568. ,/*
  1569. , * Forward declarations
  1570. , */
  1571. ,extern int nlines;        /* Number of lines in file */
  1572. ,extern LINE * header;        /* Head of line list */
  1573. ,extern LINE * tail;        /* Last line in line list */
  1574. ,extern LINE * top_line;        /* First line of screen */
  1575. ,extern LINE * bot_line;        /* Last line of screen */
  1576. ,extern LINE * cur_line;        /* Current line in use */
  1577. ,extern char * cur_text;        /* Pointer to char on current line in use */
  1578. ,extern int last_y;        /* Last y of screen, usually SCREENMAX */
  1579. ,
  1580. ,extern int x, y;        /* x, y coordinates on screen */
  1581. ,extern FLAG modified;        /* Set when file is modified */
  1582. ,extern FLAG viewonly;        /* Set when view only mode is selected */
  1583. ,extern FLAG quit;        /* Set when quit character is typed */
  1584. ,extern FLAG intr;        /* Set when intr character is typed */
  1585. ,extern FLAG winchg;        /* Set when the window size changes */
  1586. ,extern FLAG waitingforinput;    /* Set while waiting for the next command key */
  1587. ,extern FLAG isscreenmode;    /* Set when screen mode is on */
  1588. ,extern int out_count;        /* Index in output buffer */
  1589. ,extern char text_buffer [MAX_CHARS];    /* Buffer for modifying text */
  1590. ,extern int input_fd;        /* File descriptors for terminal dialog */
  1591. ,extern int output_fd;
  1592. ,extern char SHIFT_MARK;
  1593. ,extern char blank_line [];    /* For line clearance, in case terminal cannot do it */
  1594. ,extern int fprot;        /* To be used for all file creatings */
  1595. ,
  1596. ,extern char yank_file [];    /* Temp. file for buffer */
  1597. ,extern char yankie_file [];    /* Temp. file for inter-window buffer */
  1598. ,extern char panic_file [];    /* file for panic-write-back */
  1599. ,extern FLAG yank_status;    /* Status of yank_file */
  1600. ,extern long chars_saved;    /* # of chars saved in buffer */
  1601. ,
  1602. ,extern int hop_flag;        /* set to 2 by HOP key function */
  1603. ,
  1604. ,extern FLAG can_add_line, can_delete_line, can_clear_eol;
  1605. ,extern FLAG cansuspendmyself;
  1606. ,extern char * get_line_err1;
  1607. ,extern char * get_line_err2;
  1608. ,extern char * serror ();
  1609. ,extern char * serrorof ();
  1610. ,extern int geterrno ();
  1611. ,
  1612. ,extern LINE * proceed ();
  1613. ,extern LINE * match ();
  1614. ,extern LINE * line_insert ();
  1615. ,extern char * num_out ();
  1616. ,extern get_digits ();
  1617. ,extern char * basename ();
  1618. ,extern u_char promptyn ();
  1619. ,extern FLAG checkoverwrite ();
  1620. ,extern delete_file ();
  1621. ,extern char * unnull ();
  1622. ,
  1623. ,#define putchar(c)    __putchar (c)
  1624. ,extern __putchar ();    /* do not use _putchar! it may conflict with curses */
  1625. ,extern writechar ();
  1626. ,extern putstring ();
  1627. ,extern writestring ();
  1628. ,extern flush ();
  1629. ,extern flush_buffer ();
  1630. ,
  1631. ,extern char * alloc ();
  1632. ,
  1633. ,/*
  1634. , * String functions
  1635. , */
  1636. ,#define streq(s1, s2)        (strcmp (s1, s2) == 0)
  1637. ,#define strisprefix(s1, s2)    (strncmp (s2, s1, strlen (s1)) == 0)
  1638. ,
  1639. ,/*
  1640. , * Empty output buffer
  1641. , */
  1642. ,#define clear_buffer()        (out_count = 0)
  1643. ,
  1644. ,/*
  1645. , * Ring bell on terminal
  1646. , */
  1647. ,#define ring_bell()        putchar ('\07')
  1648. ,
  1649. ,#ifdef UNUSED    /* putchar, putstring, flush, and #include <curses.h> 
  1650. ,           are now in minedio.c */
  1651. ,/*
  1652. , * Print character on terminal    - obsolete due to new putchar macro
  1653. , */
  1654. ,#ifdef CURSES
  1655. ,#  define putchar(c)        addch (c)
  1656. ,#else
  1657. ,#  define putchar(c)        writechar (output_fd, (c))
  1658. ,#endif
  1659. ,/*
  1660. , * Print string on terminal
  1661. , */
  1662. ,#ifdef CURSES
  1663. ,#  define putstring(str)    addstr (str)
  1664. ,#else
  1665. ,#  define putstring(str)    writestring (output_fd, (str))
  1666. ,#endif
  1667. ,/*
  1668. , * Flush output buffer
  1669. , */
  1670. ,#ifdef CURSES
  1671. ,#  define flush()        refresh ()
  1672. ,#else
  1673. ,#  define flush()        flush_buffer (output_fd)
  1674. ,#endif
  1675. ,
  1676. ,#endif UNUSED
  1677. ,
  1678. ,/*
  1679. , * Print line on terminal at offset 0 and clear tail of line
  1680. , */
  1681. ,#define line_print(line)    put_line (line, 0, TRUE)
  1682. ,
  1683. ,/*
  1684. , * Functions handling status_line. ON means in reverse video.
  1685. , */
  1686. ,#define status_msg(str)        status_line (str, NIL_PTR)
  1687. ,#define status_line(str1, str2)        \
  1688. ,    bottom_line (ON, (str1), (str2), NIL_PTR, FALSE)
  1689. ,#define status_beg(str)            \
  1690. ,    bottom_line (ON, (str), NIL_PTR, NIL_PTR, TRUE)
  1691. ,#define error(str1, str2)        \
  1692. ,    bottom_line (ON, (str1), (str2), NIL_PTR, FALSE)
  1693. ,#define get_string(str1, str2, fl)    \
  1694. ,    bottom_line (ON, (str1), NIL_PTR, (str2), fl)
  1695. ,#define clear_status()            \
  1696. ,    bottom_line (OFF, NIL_PTR, NIL_PTR, NIL_PTR, FALSE)
  1697. ,
  1698. ,/*
  1699. , * Print info about current file and buffer.
  1700. , */
  1701. ,#define fstatus(mess, cnt)    \
  1702. ,    file_status ((mess), (cnt), file_name, nlines, writable, modified, viewonly)
  1703. ,
  1704. ,/*
  1705. , * Build formatted string.
  1706. , * If this definition is left out, a routine will be defined in mined1.c.
  1707. , */
  1708. ,#define build_string sprintf /**/
  1709. ,
  1710. ,/*
  1711. , * Get real shift value.
  1712. , */
  1713. ,#define get_shift(cnt)        ((cnt) & DUMMY_MASK)
  1714. ,
  1715. ,/*
  1716. , * Special character.
  1717. , */
  1718. ,#define QUITCHAR '\034' /* ^\ */
  1719. ,
  1720. ,/*------------------------------------------------------------------------*/
  1721. ,#endif
  1722. ,/*------------------------------------------------------------------------*/
  1723. EOSED
  1724.  
  1725. echo ---------------------- extracting mined.c -----------------
  1726. sed 's/^,//' << \EOSED > mined.c
  1727. ,/* mined single compilation version for my attempts with Turbo-C
  1728. ,   (since I don't know how to compile separately with it)
  1729. , */
  1730. ,
  1731. ,#define single_pass_compilation
  1732. ,#include "minedmp.c"
  1733. ,#include "mined1.c"
  1734. ,#include "mined2.c"
  1735. ,#include "minedio.c"
  1736. EOSED
  1737.  
  1738. echo ---------------------- extracting mined.prj -----------------
  1739. sed 's/^,//' << \EOSED > mined.prj
  1740. ,mined1.c
  1741. ,mined2.c
  1742. ,minedio.c
  1743. EOSED
  1744.  
  1745. exit 0
  1746.