home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume33 / xvi / part17 < prev    next >
Encoding:
Text File  |  1992-11-01  |  55.7 KB  |  2,134 lines

  1. Newsgroups: comp.sources.misc
  2. From: jmd@cyclone.bt.co.uk (John Downey)
  3. Subject:  v33i026:  xvi - portable multi-window vi-like editor, Part17/18
  4. Message-ID: <1992Oct24.172547.2525@sparky.imd.sterling.com>
  5. X-Md4-Signature: 2fcd7cecc4b956aac7f682a7154eec74
  6. Date: Sat, 24 Oct 1992 17:25:47 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: jmd@cyclone.bt.co.uk (John Downey)
  10. Posting-number: Volume 33, Issue 26
  11. Archive-name: xvi/part17
  12. Environment: Unix, MS-DOS, OS/2, QNX
  13.  
  14. #! /bin/sh
  15. # This is a shell archive.  Remove anything before this line, then feed it
  16. # into a shell via "sh file" or similar.  To overwrite existing files,
  17. # type "sh file -c".
  18. # Contents:  xvi/doc/COPYING xvi/src/ascii.c xvi/src/ascii.h
  19. #   xvi/src/buffers.c xvi/src/makefile.msc xvi/src/makefile.pos
  20. #   xvi/src/makefile.qc xvi/src/makefile.zc2 xvi/src/makefile.zc3
  21. #   xvi/src/mark.c xvi/src/msdos.h xvi/src/ptrfunc.c xvi/src/signal.c
  22. #   xvi/src/status.c xvi/src/sunview.h xvi/src/tos.h xvi/src/virtscr.h
  23. # Wrapped by kent@sparky on Thu Oct 22 09:03:44 1992
  24. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
  25. echo If this archive is complete, you will see the following message:
  26. echo '          "shar: End of archive 17 (of 18)."'
  27. if test -f 'xvi/doc/COPYING' -a "${1}" != "-c" ; then 
  28.   echo shar: Will not clobber existing file \"'xvi/doc/COPYING'\"
  29. else
  30.   echo shar: Extracting \"'xvi/doc/COPYING'\" \(2279 characters\)
  31.   sed "s/^X//" >'xvi/doc/COPYING' <<'END_OF_FILE'
  32. XXvi copying permission notice Copyright (C) 1991,1992 Chris and John Downey.
  33. X
  34. XXvi is distributed in the hope that it will be useful, but because the
  35. Xauthors do not receive any payment for it, it is provided without any
  36. Xwarranty. No author or distributor accepts responsibility to anyone for
  37. Xthe consequences of using it or for whether it serves any particular
  38. Xpurpose or works at all, unless he/she says so in writing.
  39. X
  40. XEveryone is granted permission to copy, modify and redistribute Xvi
  41. Xunder the following conditions:
  42. X
  43. X    Permission is granted to anyone to make or distribute verbatim copies
  44. X    of Xvi source code as received, in any medium, provided that all
  45. X    copyright notices and permission and nonwarranty notices are preserved,
  46. X    and that the distributor grants the recipient permission for further
  47. X    redistribution as permitted by this document, and gives him/her and
  48. X    points out to him/her an exact copy of this document to inform him/her
  49. X    of his/her rights.
  50. X
  51. X    Permission is granted to distribute modified versions of Xvi source
  52. X    code, or of portions of it, under the above conditions, provided also
  53. X    that all changed files carry prominent notices stating who last changed
  54. X    them and that all the Xvi-derived material, including everything
  55. X    packaged together with it and not independently usable, is distributed
  56. X    under the conditions stated in this document.
  57. X
  58. X    Permission is granted to distribute Xvi in compiled or executable form
  59. X    under the same conditions applying for source code, provided that either
  60. X
  61. X    A    it is accompanied by the corresponding machine-readable source
  62. X        code, or
  63. X    B    it is accompanied by a written offer, with no time limit, to
  64. X        give anyone a machine-readable copy of the corresponding source
  65. X        code in return for reimbursement of the cost of distribution.
  66. X        This written offer must permit verbatim duplication by anyone.
  67. X    C    it is distributed by someone who received only the executable
  68. X        form, and is accompanied by a copy of the written offer of
  69. X        source code which he/she received along with it.
  70. X
  71. XIn other words, you are welcome to use, share and improve Xvi.
  72. XYou are forbidden to forbid anyone else to use, share and improve
  73. Xwhat you give them. Help stamp out software-hoarding!
  74. X
  75. XThis copyright notice was adapted from the one supplied with GNU Emacs.
  76. END_OF_FILE
  77.   if test 2279 -ne `wc -c <'xvi/doc/COPYING'`; then
  78.     echo shar: \"'xvi/doc/COPYING'\" unpacked with wrong size!
  79.   fi
  80.   # end of 'xvi/doc/COPYING'
  81. fi
  82. if test -f 'xvi/src/ascii.c' -a "${1}" != "-c" ; then 
  83.   echo shar: Will not clobber existing file \"'xvi/src/ascii.c'\"
  84. else
  85.   echo shar: Extracting \"'xvi/src/ascii.c'\" \(2812 characters\)
  86.   sed "s/^X//" >'xvi/src/ascii.c' <<'END_OF_FILE'
  87. X/* Copyright (c) 1990,1991,1992 Chris and John Downey */
  88. X#ifndef lint
  89. Xstatic char *sccsid = "@(#)ascii.c    2.1 (Chris & John Downey) 7/29/92";
  90. X#endif
  91. X
  92. X/***
  93. X
  94. X* program name:
  95. X    xvi
  96. X* function:
  97. X    PD version of UNIX "vi" editor, with extensions.
  98. X* module name:
  99. X    ascii.c
  100. X* module function:
  101. X    Visual representations of control & other characters.
  102. X
  103. X    This file is specific to the ASCII character set;
  104. X    versions for other character sets could be implemented if
  105. X    required.
  106. X* history:
  107. X    STEVIE - ST Editor for VI Enthusiasts, Version 3.10
  108. X    Originally by Tim Thompson (twitch!tjt)
  109. X    Extensive modifications by Tony Andrews (onecom!wldrdg!tony)
  110. X    Heavily modified by Chris & John Downey
  111. X
  112. X***/
  113. X
  114. X#include "xvi.h"
  115. X
  116. X/*
  117. X * Output visual representation for a character. Return value is the
  118. X * width, in display columns, of the representation; the actual string
  119. X * is returned in *pp unless pp is NULL.
  120. X *
  121. X * If tabcol is -1, a tab is represented as "^I"; otherwise, it gives
  122. X * the current physical column, & is used to determine the number of
  123. X * spaces in the string returned as *pp.
  124. X *
  125. X * Looks at the parameters tabs, list, cchars and mchars.
  126. X * This may sound costly, but in fact it's a single memory
  127. X * access for each parameter.
  128. X */
  129. Xunsigned
  130. Xvischar(c, pp, tabcol)
  131. X    register int    c;
  132. X    register char    **pp;
  133. X    register int    tabcol;
  134. X{
  135. X    static char        crep[5];
  136. X
  137. X    if (c == '\t' && tabcol >= 0 && Pb(P_tabs) && !Pb(P_list)) {
  138. X    /*
  139. X     * Tab which we have to display as a string of
  140. X     * spaces (rather than "^I" or directly).
  141. X     */
  142. X    register unsigned    nspaces;
  143. X
  144. X    while (tabcol >= Pn(P_tabstop))
  145. X        tabcol -= Pn(P_tabstop);
  146. X    nspaces = Pn(P_tabstop) - tabcol;
  147. X    if (pp != NULL) {
  148. X        static char    spstr[MAX_TABSTOP + 1];
  149. X        static unsigned    lastnum;
  150. X
  151. X        /*
  152. X         * Paranoia (maybe).
  153. X         */
  154. X        if (nspaces > MAX_TABSTOP)
  155. X        nspaces = MAX_TABSTOP;
  156. X        if (nspaces > lastnum)
  157. X        (void) memset(&spstr[lastnum], ' ',
  158. X               (int) (nspaces - lastnum));
  159. X        spstr[lastnum = nspaces] = '\0';
  160. X        *pp = spstr;
  161. X    }
  162. X    return nspaces;
  163. X    } else if (((unsigned char) c < ' ' || c == DEL) && !Pb(P_cchars)) {
  164. X    /*
  165. X     * ASCII Control characters.
  166. X     */
  167. X    if (pp != NULL) {
  168. X        *pp = crep;
  169. X        crep[0] = '^';
  170. X        crep[1] = (c == DEL ? '?' : c + ('A' - 1));
  171. X        crep[2] = '\0';
  172. X    }
  173. X    return 2;
  174. X    } else if ((c & ~0177) && !Pb(P_mchars)) {
  175. X    /*
  176. X     * If Pb(P_mchars) is unset, we display non-ASCII characters
  177. X     * (i.e. top-bit-set characters) as octal escape sequences.
  178. X     */
  179. X    if (pp != NULL) {
  180. X        *pp = crep;
  181. X        crep[0] = '\\';
  182. X        crep[1] = ((c >> 6) & 7) + '0';
  183. X        crep[2] = ((c >> 3) & 7) + '0';
  184. X        crep[3] = (c        & 7) + '0';
  185. X        crep[4] = '\0';
  186. X    }
  187. X    return 4;
  188. X    } else {
  189. X    /*
  190. X     * Printable character.
  191. X     */
  192. X    if (pp != NULL) {
  193. X        *pp = crep;
  194. X        crep[0] = c;
  195. X        crep[1] = '\0';
  196. X    }
  197. X    return 1;
  198. X    }
  199. X}
  200. END_OF_FILE
  201.   if test 2812 -ne `wc -c <'xvi/src/ascii.c'`; then
  202.     echo shar: \"'xvi/src/ascii.c'\" unpacked with wrong size!
  203.   fi
  204.   # end of 'xvi/src/ascii.c'
  205. fi
  206. if test -f 'xvi/src/ascii.h' -a "${1}" != "-c" ; then 
  207.   echo shar: Will not clobber existing file \"'xvi/src/ascii.h'\"
  208. else
  209.   echo shar: Extracting \"'xvi/src/ascii.h'\" \(2985 characters\)
  210.   sed "s/^X//" >'xvi/src/ascii.h' <<'END_OF_FILE'
  211. X/* Copyright (c) 1990,1991,1992 Chris and John Downey */
  212. X/***
  213. X
  214. X* @(#)ascii.h    2.1 (Chris & John Downey) 7/29/92
  215. X
  216. X* program name:
  217. X    xvi
  218. X* function:
  219. X    PD version of UNIX "vi" editor, with extensions.
  220. X* module name:
  221. X    ascii.h
  222. X* module function:
  223. X    Keycode definitions for special keys - e.g. help, cursor arrow
  224. X    keys, page up, page down etc., & test & conversion macros for
  225. X    single characters.
  226. X
  227. X    On systems that have any special keys, the routine 'inchar' in
  228. X    the terminal interface code should return one of the codes
  229. X    here.
  230. X
  231. X    This file is specific to the ASCII character set; versions for
  232. X    other character sets could be implemented if required.
  233. X* history:
  234. X    STEVIE - ST Editor for VI Enthusiasts, Version 3.10
  235. X    Originally by Tim Thompson (twitch!tjt)
  236. X    Extensive modifications by Tony Andrews (onecom!wldrdg!tony)
  237. X    Heavily modified by Chris & John Downey
  238. X
  239. X***/
  240. X
  241. X#include <ctype.h>
  242. X
  243. X/*
  244. X * Tests on single characters.
  245. X */
  246. X#define is_alpha(c)    (isascii(c) && isalpha(c))
  247. X#define is_upper(c)    (isascii(c) && isupper(c))
  248. X#define is_lower(c)    (isascii(c) && islower(c))
  249. X#define is_digit(c)    (isascii(c) && isdigit(c))
  250. X#define is_xdigit(c)    (isascii(c) && isxdigit(c))
  251. X#define is_octdigit(c)    ((c) >= '0' && (c) <= '7')
  252. X#define is_space(c)    (isascii(c) && isspace(c))
  253. X#define is_punct(c)    (isascii(c) && ispunct(c))
  254. X#define is_alnum(c)    (isascii(c) && isalnum(c))
  255. X#define is_print(c)    (isascii(c) && isprint(c))
  256. X#define is_graph(c)    (isascii(c) && isgraph(c))
  257. X#define is_cntrl(c)    (isascii(c) && iscntrl(c))
  258. X
  259. X/*
  260. X * Conversions.
  261. X *
  262. X * Note that no argument validity checking is performed.
  263. X */
  264. X/*
  265. X * Upper case to lower case.
  266. X */
  267. X#define to_lower(c)    ((c) | 040)
  268. X/*
  269. X * Lower case to upper case.
  270. X */
  271. X#define to_upper(c)    ((c) & 0137)
  272. X/*
  273. X * Hexadecimal digit to binary integer.
  274. X */
  275. X#define hex_to_bin(h)    (is_digit(h) ? (h) & 017 : ((h) & 7) + 9)
  276. X
  277. X/*
  278. X * Key codes.
  279. X */
  280. X#define K_HELP        0x80
  281. X#define K_UNDO        0x81
  282. X#define K_INSERT    0x82
  283. X#define K_HOME        0x83
  284. X#define K_UARROW    0x84
  285. X#define K_DARROW    0x85
  286. X#define K_LARROW    0x86
  287. X#define K_RARROW    0x87
  288. X#define K_CGRAVE    0x88    /* control grave accent */
  289. X#define K_PGDOWN    0x89
  290. X#define K_PGUP        0x8a
  291. X#define K_END        0x8b
  292. X
  293. X/*
  294. X * Function keys.
  295. X */
  296. X#define K_FUNC(n)    (0xa0 + (n))
  297. X
  298. X/*
  299. X * Some common control characters.
  300. X */
  301. X#define ESC        '\033'
  302. X#define DEL        '\177'
  303. X
  304. X#undef    CTRL
  305. X#define CTRL(x)     ((x) & 0x1f)
  306. X
  307. X/*
  308. X * Convert a command character to an ASCII character.
  309. X *
  310. X * This is needed for normal(), which uses the mapped value as an
  311. X * index into a table.
  312. X *
  313. X * QNX is the only ASCII-based system which gives us a minor problem
  314. X * here because its newline character is the same as control-^; so we
  315. X * convert this value to an ASCII linefeed.
  316. X */
  317. X#ifdef QNX
  318. X#   define ascii_map(n)    ((n) == '\n' ? 012 : (n))
  319. X#else
  320. X#   define ascii_map(n)    (n)
  321. X#endif
  322. X
  323. X/*
  324. X * The top bit for extended character sets.
  325. X * Note that this is NOT related to the size of a char in bits,
  326. X * but to the ASCII character set - i.e. it is always 128.
  327. X */
  328. X#define    TOP_BIT        128
  329. END_OF_FILE
  330.   if test 2985 -ne `wc -c <'xvi/src/ascii.h'`; then
  331.     echo shar: \"'xvi/src/ascii.h'\" unpacked with wrong size!
  332.   fi
  333.   # end of 'xvi/src/ascii.h'
  334. fi
  335. if test -f 'xvi/src/buffers.c' -a "${1}" != "-c" ; then 
  336.   echo shar: Will not clobber existing file \"'xvi/src/buffers.c'\"
  337. else
  338.   echo shar: Extracting \"'xvi/src/buffers.c'\" \(2955 characters\)
  339.   sed "s/^X//" >'xvi/src/buffers.c' <<'END_OF_FILE'
  340. X/* Copyright (c) 1990,1991,1992 Chris and John Downey */
  341. X#ifndef lint
  342. Xstatic char *sccsid = "@(#)buffers.c    2.1 (Chris & John Downey) 7/29/92";
  343. X#endif
  344. X
  345. X/***
  346. X
  347. X* program name:
  348. X    xvi
  349. X* function:
  350. X    PD version of UNIX "vi" editor, with extensions.
  351. X* module name:
  352. X    buffers.c
  353. X* module function:
  354. X    Handle buffer allocation, deallocation, etc.
  355. X* history:
  356. X    STEVIE - ST Editor for VI Enthusiasts, Version 3.10
  357. X    Originally by Tim Thompson (twitch!tjt)
  358. X    Extensive modifications by Tony Andrews (onecom!wldrdg!tony)
  359. X    Heavily modified by Chris & John Downey
  360. X
  361. X***/
  362. X
  363. X#include "xvi.h"
  364. X
  365. Xstatic    bool_t    setup_buffer P((Buffer *));
  366. X
  367. X/*
  368. X * Create a new buffer.
  369. X */
  370. XBuffer *
  371. Xnew_buffer()
  372. X{
  373. X    Buffer    *new;
  374. X
  375. X    new = (Buffer *) alloc(sizeof(Buffer));
  376. X    if (new == NULL) {
  377. X    return(NULL);
  378. X    }
  379. X
  380. X    /*
  381. X     * Allocate memory for lines etc.
  382. X     */
  383. X    if (setup_buffer(new) == FALSE) {
  384. X    free((char *) new);
  385. X    return(NULL);
  386. X    }
  387. X
  388. X    /*
  389. X     * Since setup_buffer() does not set up
  390. X     * the filenames, we must do it ourselves.
  391. X     */
  392. X    new->b_filename = NULL;
  393. X    new->b_tempfname = NULL;
  394. X
  395. X    new->b_nwindows = 0;
  396. X
  397. X    return(new);
  398. X}
  399. X
  400. X/*
  401. X * Delete the given buffer.
  402. X */
  403. Xvoid
  404. Xfree_buffer(buffer)
  405. XBuffer    *buffer;
  406. X{
  407. X    if (buffer == NULL)
  408. X    return;
  409. X
  410. X    /*
  411. X     * Free all the lines in the buffer.
  412. X     */
  413. X    throw(buffer->b_line0);
  414. X
  415. X    free((char *) buffer);
  416. X}
  417. X
  418. X/*
  419. X * Free up all the memory used indirectly by the buffer,
  420. X * and then get some new stuff. This only has an effect
  421. X * on the allocated fields within the buffer, i.e. it
  422. X * does not change any variables such as filenames.
  423. X *
  424. X * Returns TRUE for success, FALSE for failure to get memory.
  425. X */
  426. Xbool_t
  427. Xclear_buffer(buffer)
  428. XBuffer    *buffer;
  429. X{
  430. X    /*
  431. X     * Free all the lines in the buffer.
  432. X     */
  433. X    throw(buffer->b_line0);
  434. X    return(setup_buffer(buffer));
  435. X}
  436. X
  437. X/*
  438. X * Allocate and initialise a buffer structure.
  439. X *
  440. X * Don't touch filenames.
  441. X *
  442. X * Returns TRUE for success, FALSE if we couldn't get memory.
  443. X */
  444. Xstatic bool_t
  445. Xsetup_buffer(b)
  446. XBuffer    *b;
  447. X{
  448. X    /*
  449. X     * Allocate the single "dummy" line, and the two
  450. X     * out-of-bounds lines for lines 0 and (n+1).
  451. X     * This is a little strange ...
  452. X     */
  453. X    b->b_line0 = newline(0);
  454. X    b->b_file = newline(1);
  455. X    b->b_lastline = newline(0);
  456. X    if (b->b_line0 == NULL || b->b_file == NULL || b->b_lastline == NULL) {
  457. X    return(FALSE);
  458. X    }
  459. X
  460. X    /*
  461. X     * Connect everything togther to form a minimal list.
  462. X     */
  463. X    b->b_line0->l_next = b->b_file;
  464. X    b->b_file->l_prev = b->b_line0;
  465. X    b->b_file->l_next = b->b_lastline;
  466. X    b->b_lastline->l_prev = b->b_file;
  467. X
  468. X    /*
  469. X     * Clear all marks.
  470. X     */
  471. X    init_marks(b);
  472. X
  473. X    /*
  474. X     * Clear the undo status of the buffer.
  475. X     */
  476. X    init_undo(b);
  477. X
  478. X    /*
  479. X     * Clear all flags, and then pay special attention to the
  480. X     * "noedit" flag which must be set if the parameter is FALSE.
  481. X     */
  482. X    b->b_flags = 0;
  483. X    if (!Pb(P_edit)) {
  484. X    b->b_flags |= FL_NOEDIT;
  485. X    }
  486. X
  487. X    return(TRUE);
  488. X}
  489. END_OF_FILE
  490.   if test 2955 -ne `wc -c <'xvi/src/buffers.c'`; then
  491.     echo shar: \"'xvi/src/buffers.c'\" unpacked with wrong size!
  492.   fi
  493.   # end of 'xvi/src/buffers.c'
  494. fi
  495. if test -f 'xvi/src/makefile.msc' -a "${1}" != "-c" ; then 
  496.   echo shar: Will not clobber existing file \"'xvi/src/makefile.msc'\"
  497. else
  498.   echo shar: Extracting \"'xvi/src/makefile.msc'\" \(2648 characters\)
  499.   sed "s/^X//" >'xvi/src/makefile.msc' <<'END_OF_FILE'
  500. X# Copyright (c) 1990,1991,1992 Chris and John Downey
  501. X#***
  502. X#
  503. X# @(#)makefile.msc    2.2 (Chris & John Downey) 7/31/92
  504. X#
  505. X# program name:
  506. X#    xvi
  507. X# function:
  508. X#    PD version of UNIX "vi" editor, with extensions.
  509. X# module name:
  510. X#    makefile.msc
  511. X# module function:
  512. X#    Makefile for Microsoft C for MS-DOS
  513. X#
  514. X#    (but it won't work with Microsoft's Make, which is brain-dead.
  515. X#    There are several good public domain make utilities available
  516. X#    for MS-DOS).
  517. X#
  518. X#    Microsoft Macro Assembler (or a compatible assembler) is also
  519. X#    required.
  520. X# history:
  521. X#    STEVIE - ST Editor for VI Enthusiasts, Version 3.10
  522. X#    Originally by Tim Thompson (twitch!tjt)
  523. X#    Extensive modifications by Tony Andrews (onecom!wldrdg!tony)
  524. X#    Heavily modified by Chris & John Downey
  525. X#***
  526. X
  527. X#
  528. X# Name of this file.
  529. X#
  530. XTHISFILE=    makefile.msc
  531. X
  532. XMEMMODEL=    L
  533. XCC=        cl
  534. XCFLAGS=        -A$(MEMMODEL)
  535. XAS=        masm
  536. XASFLAGS=    -Mx -DMEMMODEL=$(MEMMODEL) # -Zi
  537. XLD=        link
  538. XLDFLAGS=    /NOI /NOE /STACK:20480
  539. X
  540. XINC=        ascii.h param.h ptrfunc.h regexp.h regmagic.h xvi.h \
  541. X        virtscr.h msdos.h ibmpc.h 8086mm.inc
  542. X
  543. XSRC=        defscr.c \
  544. X        alloc.c ascii.c buffers.c cmdline.c cursor.c \
  545. X        edit.c ex_cmds1.c ex_cmds2.c events.c fileio.c find.c \
  546. X        flexbuf.c map.c mark.c misccmds.c mouse.c movement.c \
  547. X        normal.c param.c pipe.c preserve.c ptrfunc.c \
  548. X        regexp.c screen.c search.c startup.c status.c \
  549. X        tags.c undo.c version.c windows.c \
  550. X        yankput.c \
  551. X        msdos_c.c msdos_a.asm ibmpc_a.asm ibmpc_c.c
  552. X
  553. XOBJ=        defscr.obj \
  554. X        alloc.obj ascii.obj buffers.obj cmdline.obj cursor.obj \
  555. X        edit.obj ex_cmds1.obj ex_cmds2.obj events.obj fileio.obj \
  556. X        find.obj flexbuf.obj map.obj mark.obj misccmds.obj \
  557. X        mouse.obj movement.obj \
  558. X        normal.obj param.obj pipe.obj preserve.obj ptrfunc.obj \
  559. X        regexp.obj screen.obj search.obj startup.obj status.obj \
  560. X        tags.obj undo.obj version.obj windows.obj \
  561. X        yankput.obj \
  562. X        msdos_c.obj msdos_a.obj ibmpc_a.obj ibmpc_c.obj
  563. X
  564. XLINKFILE=    xvi.lnk
  565. X
  566. Xall:        xvi.exe
  567. X
  568. Xxvi.exe:    $(OBJ) $(LINKFILE) version.c
  569. X        $(CC) $(CFLAGS) -c version.c
  570. X        $(LD) @$(LINKFILE)
  571. X
  572. X$(LINKFILE):    $(THISFILE)
  573. X        +echo defscr + >> $@
  574. X        +echo alloc + ascii + buffers + cmdline + cursor + >> $@
  575. X        +echo edit + ex_cmds1 + ex_cmds2 + events + fileio + >> $@
  576. X        +echo find + flexbuf + map + mark + misccmds + mouse + >> $@
  577. X        +echo movement + normal + param + pipe + preserve + >> $@
  578. X        +echo ptrfunc + regexp + screen + search + startup + >> $@
  579. X        +echo status + tags + undo + version + windows + >> $@
  580. X        +echo yankput + >> $@
  581. X        +echo msdos_c + msdos_a + ibmpc_a + ibmpc_c + >> $@
  582. X        +echo $(LIB)\setargv >> $@
  583. X        +echo xvi.exe $(LDFLAGS) ; >> $@
  584. X
  585. X.c.obj:
  586. X        $(CC) $(CFLAGS) -Fo$@ -c $<
  587. X
  588. X.asm.obj:
  589. X        $(AS) $(ASFLAGS) $* ;
  590. X
  591. Xclean:
  592. X        del *.obj
  593. X        del $(LINKFILE)
  594. X        del *.map
  595. END_OF_FILE
  596.   if test 2648 -ne `wc -c <'xvi/src/makefile.msc'`; then
  597.     echo shar: \"'xvi/src/makefile.msc'\" unpacked with wrong size!
  598.   fi
  599.   # end of 'xvi/src/makefile.msc'
  600. fi
  601. if test -f 'xvi/src/makefile.pos' -a "${1}" != "-c" ; then 
  602.   echo shar: Will not clobber existing file \"'xvi/src/makefile.pos'\"
  603. else
  604.   echo shar: Extracting \"'xvi/src/makefile.pos'\" \(2085 characters\)
  605.   sed "s/^X//" >'xvi/src/makefile.pos' <<'END_OF_FILE'
  606. X# Copyright (c) 1992 Chris and John Downey
  607. X#***
  608. X#
  609. X# @(#)makefile.pos    2.2 (Chris & John Downey) 7/31/92
  610. X#
  611. X# program name:
  612. X#    xvi
  613. X# function:
  614. X#    PD version of UNIX "vi" editor, with extensions.
  615. X# module name:
  616. X#    makefile.pos
  617. X# module function:
  618. X#    Makefile for POSIX.
  619. X#    This is tested on BSDI, which paradoxically does not want
  620. X#    BSD to be defined - but we define TERMIOS and POSIX to get
  621. X#    nice POSIX-style terminal I/O.
  622. X# history:
  623. X#    STEVIE - ST Editor for VI Enthusiasts, Version 3.10
  624. X#    Originally by Tim Thompson (twitch!tjt)
  625. X#    Extensive modifications by Tony Andrews (onecom!wldrdg!tony)
  626. X#    Heavily modified by Chris & John Downey
  627. X#***
  628. X
  629. XSYSDEFS=    -DUNIX -DTERMIOS -DPOSIX
  630. XINCDIRS=
  631. X
  632. XLIBS=        -ltermcap
  633. XLDFLAGS=    -ansi
  634. X
  635. XDEBUGFLAG=    -g
  636. XOPTFLAG=    -O
  637. XCFLAGS=     $(SYSDEFS) $(INCDIRS) $(OPTFLAG) -ansi
  638. X
  639. XLINTFLAGS=    $(SYSDEFS) $(INCDIRS) -ah
  640. X
  641. XMACHSRC=    unix.c termcap.c defscr.c
  642. XMACHOBJ=    unix.o termcap.o defscr.o
  643. XMACHINC=    unix.h termcap.h
  644. X
  645. XGENINC=        ascii.h param.h ptrfunc.h regexp.h regmagic.h xvi.h virtscr.h
  646. X
  647. XGENSRC=        alloc.c ascii.c buffers.c cmdline.c cursor.c \
  648. X        edit.c ex_cmds1.c ex_cmds2.c events.c fileio.c \
  649. X        find.c flexbuf.c map.c mark.c misccmds.c movement.c \
  650. X        normal.c param.c pipe.c preserve.c ptrfunc.c \
  651. X        regexp.c screen.c search.c signal.c startup.c status.c \
  652. X        tags.c undo.c version.c windows.c yankput.c
  653. X
  654. XGENOBJ=        alloc.o ascii.o buffers.o cmdline.o cursor.o \
  655. X        edit.o ex_cmds1.o ex_cmds2.o events.o fileio.o \
  656. X        find.o flexbuf.o map.o mark.o misccmds.o movement.o \
  657. X        normal.o param.o pipe.o preserve.o ptrfunc.o \
  658. X        regexp.o screen.o search.o signal.o startup.o status.o \
  659. X        tags.o undo.o version.o windows.o yankput.o
  660. X
  661. Xall:        xvi
  662. X
  663. Xxvi:        $(GENOBJ) $(MACHOBJ)
  664. X        $(CC) $(CFLAGS) -o xvi $(GENOBJ) $(MACHOBJ) $(LIBS)
  665. X
  666. X.c.o:        $< $(GENINC) $(MACHINC) param.c
  667. X        $(CC) $(CFLAGS) -c -o $@ $<
  668. X
  669. Xsources:
  670. X        sccs check || sccs delget `sccs tell`
  671. X
  672. Xlint:
  673. X        lint $(LINTFLAGS) $(GENSRC) $(MACHSRC)
  674. X
  675. Xtags:        $(GENSRC) $(MACHSRC)
  676. X        ctags -t $(GENSRC) $(MACHSRC) $(GENINC) $(MACHINC)
  677. X
  678. Xclean:
  679. X        csh -c 'rm -f *.{o,obj} xvi'
  680. X
  681. Xinstall:
  682. X        mv xvi $(HOME)/bin/`arch`/xvi
  683. X
  684. X$(GENOBJ):     $(GENINC) $(MACHINC)
  685. END_OF_FILE
  686.   if test 2085 -ne `wc -c <'xvi/src/makefile.pos'`; then
  687.     echo shar: \"'xvi/src/makefile.pos'\" unpacked with wrong size!
  688.   fi
  689.   # end of 'xvi/src/makefile.pos'
  690. fi
  691. if test -f 'xvi/src/makefile.qc' -a "${1}" != "-c" ; then 
  692.   echo shar: Will not clobber existing file \"'xvi/src/makefile.qc'\"
  693. else
  694.   echo shar: Extracting \"'xvi/src/makefile.qc'\" \(2901 characters\)
  695.   sed "s/^X//" >'xvi/src/makefile.qc' <<'END_OF_FILE'
  696. X# Copyright (c) 1990,1991,1992 Chris and John Downey
  697. X#***
  698. X#
  699. X# @(#)makefile.qc    2.2 (Chris & John Downey) 7/31/92
  700. X#
  701. X# program name:
  702. X#    xvi
  703. X# function:
  704. X#    PD version of UNIX "vi" editor, with extensions.
  705. X# module name:
  706. X#    makefile.qc
  707. X# module function:
  708. X#    Makefile for MS-DOS, using Microsoft Quick C (standalone
  709. X#    version) & Microsoft's make utility.
  710. X#
  711. X#    Microsoft Macro Assembler (or a compatible assembler) is also
  712. X#    required.
  713. X# history:
  714. X#    STEVIE - ST Editor for VI Enthusiasts, Version 3.10
  715. X#    Originally by Tim Thompson (twitch!tjt)
  716. X#    Extensive modifications by Tony Andrews (onecom!wldrdg!tony)
  717. X#    Heavily modified by Chris & John Downey
  718. X#***
  719. X
  720. X#
  721. X# Name of this file.
  722. X#
  723. XTHISFILE=    makefile.qc
  724. XMEMMODEL=    L
  725. XCFLAGS=        -A$(MEMMODEL) -D__STDC__=1 -Ol
  726. XLDFLAGS=    /NOI /NOE /STACK:20480
  727. XLINKFILE=    xvi.lnk
  728. X
  729. X.c.obj:
  730. X        qcl -c $(CFLAGS) $*.c
  731. X
  732. X.asm.obj:
  733. X        masm -Mx -DMEMMODEL=$(MEMMODEL) $* ;
  734. X
  735. Xalloc.obj:    alloc.c
  736. X
  737. Xascii.obj:    ascii.c
  738. X
  739. Xbuffers.obj:    buffers.c
  740. X
  741. Xcmdline.obj:    cmdline.c
  742. X
  743. Xcursor.obj:    cursor.c
  744. X
  745. Xdefscr.obj:    defscr.c
  746. X
  747. Xedit.obj:    edit.c
  748. X
  749. Xex_cmds1.obj:    ex_cmds1.c
  750. X
  751. Xex_cmds2.obj:    ex_cmds2.c
  752. X
  753. Xevents.obj:    events.c
  754. X
  755. Xfileio.obj:    fileio.c
  756. X
  757. Xfind.obj:    find.c
  758. X
  759. Xflexbuf.obj:    flexbuf.c
  760. X
  761. Xibmpc_c.obj:    ibmpc_c.c
  762. X
  763. Xmap.obj:    map.c
  764. X
  765. Xmark.obj:    mark.c
  766. X
  767. Xmisccmds.obj:    misccmds.c
  768. X
  769. Xmouse.obj:    mouse.c
  770. X
  771. Xmovement.obj:    movement.c
  772. X
  773. Xmsdos_c.obj:    msdos_c.c
  774. X
  775. Xnormal.obj:    normal.c
  776. X
  777. Xparam.obj:    param.c
  778. X
  779. Xpipe.obj:    pipe.c
  780. X
  781. Xpreserve.obj:    preserve.c
  782. X
  783. Xptrfunc.obj:    ptrfunc.c
  784. X
  785. Xregexp.obj:    regexp.c
  786. X
  787. Xscreen.obj:    screen.c
  788. X
  789. Xsearch.obj:    search.c
  790. X
  791. Xstartup.obj:    startup.c
  792. X
  793. Xstatus.obj:    status.c
  794. X
  795. Xtags.obj:    tags.c
  796. X
  797. Xundo.obj:    undo.c
  798. X
  799. Xwindows.obj:    windows.c
  800. X
  801. Xyankput.obj:    yankput.c
  802. X
  803. Xibmpc_a.obj:    ibmpc_a.asm
  804. X
  805. Xmsdos_a.obj:    msdos_a.asm
  806. X
  807. X$(LINKFILE):    $(THISFILE)
  808. X        +echo alloc + ascii + buffers + > $(LINKFILE)
  809. X        +echo cmdline + cursor + >> $(LINKFILE)
  810. X        +echo edit + ex_cmds1 + ex_cmds2 + events + >> $(LINKFILE)
  811. X        +echo fileio + find + flexbuf + map + mark + >> $(LINKFILE)
  812. X        +echo misccmds + mouse + movement + normal + >> $(LINKFILE)
  813. X        +echo param + pipe + >> $(LINKFILE)
  814. X        +echo preserve + ptrfunc + regexp + screen + >> $(LINKFILE)
  815. X        +echo search + startup + status + tags + >> $(LINKFILE)
  816. X        +echo undo + version + windows + >> $(LINKFILE)
  817. X        +echo yankput + >> $(LINKFILE)
  818. X        +echo defscr + >> $(LINKFILE)
  819. X        +echo msdos_c + msdos_a + ibmpc_a + ibmpc_c + >> $(LINKFILE)
  820. X        +echo $(LIB)\setargv >> $(LINKFILE)
  821. X        +echo xvi.exe $(LDFLAGS) ; >> $(LINKFILE)
  822. X
  823. Xxvi.exe:    alloc.obj ascii.obj buffers.obj cmdline.obj cursor.obj \
  824. X        edit.obj ex_cmds1.obj ex_cmds2.obj events.obj fileio.obj \
  825. X        find.obj flexbuf.obj map.obj mark.obj misccmds.obj \
  826. X        mouse.obj movement.obj \
  827. X        normal.obj param.obj pipe.obj preserve.obj ptrfunc.obj \
  828. X        regexp.obj screen.obj search.obj startup.obj status.obj \
  829. X        tags.obj undo.obj windows.obj \
  830. X        yankput.obj \
  831. X        defscr.obj \
  832. X        ibmpc_c.obj msdos_c.obj ibmpc_a.obj msdos_a.obj \
  833. X        $(LINKFILE)
  834. X        qcl -c $(CFLAGS) version.c
  835. X        link @$(LINKFILE)
  836. END_OF_FILE
  837.   if test 2901 -ne `wc -c <'xvi/src/makefile.qc'`; then
  838.     echo shar: \"'xvi/src/makefile.qc'\" unpacked with wrong size!
  839.   fi
  840.   # end of 'xvi/src/makefile.qc'
  841. fi
  842. if test -f 'xvi/src/makefile.zc2' -a "${1}" != "-c" ; then 
  843.   echo shar: Will not clobber existing file \"'xvi/src/makefile.zc2'\"
  844. else
  845.   echo shar: Extracting \"'xvi/src/makefile.zc2'\" \(2745 characters\)
  846.   sed "s/^X//" >'xvi/src/makefile.zc2' <<'END_OF_FILE'
  847. X# Copyright (c) 1990,1991,1992 Chris and John Downey
  848. X#***
  849. X#
  850. X# @(#)makefile.zc2    2.2 (Chris & John Downey) 7/31/92
  851. X#
  852. X# program name:
  853. X#    xvi
  854. X# function:
  855. X#    PD version of UNIX "vi" editor, with extensions.
  856. X# module name:
  857. X#    makefile.zc2
  858. X# module function:
  859. X#    Makefile for Zortech C 2.18 for MS-DOS
  860. X#
  861. X#    Microsoft Macro Assembler (or a compatible assembler) is also
  862. X#    required.
  863. X# history:
  864. X#    STEVIE - ST Editor for VI Enthusiasts, Version 3.10
  865. X#    Originally by Tim Thompson (twitch!tjt)
  866. X#    Extensive modifications by Tony Andrews (onecom!wldrdg!tony)
  867. X#    Heavily modified by Chris & John Downey
  868. X#***
  869. X
  870. X#
  871. X# Name of this file.
  872. X#
  873. XTHISFILE=    makefile.zc2
  874. X
  875. XMEMMODEL=    l
  876. XREGEXPDIR=    .
  877. XCC=        ztc
  878. XOPTFLAGS=    -o+reg -o+loop
  879. XDEBUGFLAGS=    -g
  880. XCDEFS=        -DMSDOS -D__STDC__=1
  881. XCFLAGS=        -m$(MEMMODEL) -b -I$(REGEXPDIR) $(CDEFS) $(OPTFLAGS)
  882. XAS=        masm
  883. XASFLAGS=    -Ml -DMEMMODEL=$(MEMMODEL)
  884. XLD=        blink
  885. XLDFLAGS=    /DO /NOI
  886. XTARGET=        xvi
  887. X
  888. XINC=        ascii.h param.h ptrfunc.h xvi.h virtscr.h msdos.h ibmpc.h \
  889. X        8086mm.inc
  890. X
  891. XSRC=        defscr.c startup.c \
  892. X        alloc.c buffers.c edit.c cmdline.c cursor.c \
  893. X        ex_cmds1.c ex_cmds2.c events.c flexbuf.c \
  894. X        fileio.c find.c ascii.c map.c mark.c misccmds.c \
  895. X        mouse.c movement.c normal.c param.c preserve.c ptrfunc.c \
  896. X        pipe.c \
  897. X        screen.c $(REGEXPDIR)\regexp.c \
  898. X        search.c status.c \
  899. X        tags.c undo.c windows.c yankput.c msdos_c.c msdos_a.asm \
  900. X        ibmpc_a.asm ibmpc_c.c version.c
  901. X
  902. XOBJ=        defscr.obj startup.obj \
  903. X        alloc.obj buffers.obj edit.obj cmdline.obj cursor.obj \
  904. X        ex_cmds1.obj ex_cmds2.obj events.obj flexbuf.obj \
  905. X        fileio.obj find.obj ascii.obj map.obj mark.obj \
  906. X        misccmds.obj mouse.obj movement.obj normal.obj param.obj \
  907. X        pipe.obj \
  908. X        preserve.obj ptrfunc.obj screen.obj search.obj status.obj \
  909. X        tags.obj undo.obj windows.obj yankput.obj \
  910. X        $(REGEXPDIR)\regexp.obj \
  911. X        msdos_c.obj msdos_a.obj ibmpc_a.obj ibmpc_c.obj
  912. X
  913. XLINKFILE=    $(TARGET).lnk
  914. X
  915. Xall:        $(TARGET).exe
  916. X
  917. X$(TARGET).exe:    $(OBJ) $(LINKFILE) version.c
  918. X        $(CC) $(CFLAGS) -c version.c
  919. X        $(LD) @$(LINKFILE)
  920. X
  921. X$(LINKFILE):    $(THISFILE)
  922. X        +echo defscr + startup + > $@
  923. X        +echo alloc + buffers + edit + cmdline + cursor + >> $@
  924. X        +echo ex_cmds1 + ex_cmds2 + events + >> $@
  925. X        +echo flexbuf + fileio + find + ascii + >> $@
  926. X        +echo map + mark + misccmds + mouse + movement + >> $@
  927. X        +echo normal + param + preserve + pipe + >> $@
  928. X        +echo ptrfunc + screen + search + status + tags + >> $@
  929. X        +echo undo + windows + yankput + >> $@
  930. X        +echo $(REGEXPDIR)\regexp + >> $@
  931. X        +echo msdos_c + msdos_a + ibmpc_a + ibmpc_c + >> $@
  932. X        +echo version + >> $@
  933. X        +echo $(LIB)\_main$(MEMMODEL) + >> $@
  934. X        +echo $(LIB)\int >> $@
  935. X        +echo $(TARGET).exe $(LDFLAGS) ;  >> $@
  936. X
  937. X.c.obj:
  938. X        # $(CC) $(CFLAGS) -o$@ -c $<
  939. X        $(CC) $(CFLAGS) -c $<
  940. X
  941. X.asm.obj:
  942. X        $(AS) $(ASFLAGS) $* ;
  943. X
  944. Xclean:
  945. X        del *.obj
  946. X        del $(LINKFILE)
  947. X        del *.map
  948. END_OF_FILE
  949.   if test 2745 -ne `wc -c <'xvi/src/makefile.zc2'`; then
  950.     echo shar: \"'xvi/src/makefile.zc2'\" unpacked with wrong size!
  951.   fi
  952.   # end of 'xvi/src/makefile.zc2'
  953. fi
  954. if test -f 'xvi/src/makefile.zc3' -a "${1}" != "-c" ; then 
  955.   echo shar: Will not clobber existing file \"'xvi/src/makefile.zc3'\"
  956. else
  957.   echo shar: Extracting \"'xvi/src/makefile.zc3'\" \(2977 characters\)
  958.   sed "s/^X//" >'xvi/src/makefile.zc3' <<'END_OF_FILE'
  959. X# Copyright (c) 1990,1991,1992 Chris and John Downey
  960. X#***
  961. X#
  962. X# @(#)makefile.zc3    2.2 (Chris & John Downey) 7/31/92
  963. X#
  964. X# program name:
  965. X#    xvi
  966. X# function:
  967. X#    PD version of UNIX "vi" editor, with extensions.
  968. X# module name:
  969. X#    makefile.zc3
  970. X# module function:
  971. X#    Makefile for Zortech C 3.00 for MS-DOS
  972. X#
  973. X#    Microsoft Macro Assembler (or a compatible assembler) is also
  974. X#    required.
  975. X# history:
  976. X#    STEVIE - ST Editor for VI Enthusiasts, Version 3.10
  977. X#    Originally by Tim Thompson (twitch!tjt)
  978. X#    Extensive modifications by Tony Andrews (onecom!wldrdg!tony)
  979. X#    Heavily modified by Chris & John Downey
  980. X#***
  981. X
  982. X#
  983. X# Name of this file.
  984. X#
  985. XTHISFILE=    makefile.zc3
  986. X
  987. X#
  988. X# Set this to x to run the 386 extended version of the compiler
  989. X# itself. On an 8088, 8086, virtual 8086 or 80286 development system,
  990. X# set it to nothing.
  991. X#
  992. XCC_EXE_TYPE=    x
  993. X
  994. XMEMMODEL=    l
  995. XREGEXPDIR=    .
  996. XCC=        ztc
  997. XOPTFLAGS=    -o+reg -o+loop
  998. XDEBUGFLAGS=    -g
  999. XCDEFS=        -DMSDOS -D__STDC__=1
  1000. XCFLAGS=        -m$(MEMMODEL) -b$(CC_EXE_TYPE) -I$(REGEXPDIR) $(CDEFS) $(OPTFLAGS)
  1001. XAS=        masm
  1002. XASFLAGS=    -Ml -DMEMMODEL=$(MEMMODEL)
  1003. XLD=        blink$(CC_EXE_TYPE)
  1004. X# LD=        c:\bin\rmode\link
  1005. XLDFLAGS=    # /CO /MAP
  1006. XTARGET=        xvi
  1007. X
  1008. XINC=        ascii.h param.h ptrfunc.h xvi.h virtscr.h msdos.h ibmpc.h \
  1009. X        8086mm.inc
  1010. X
  1011. XSRC=        defscr.c startup.c \
  1012. X        alloc.c buffers.c edit.c cmdline.c cursor.c \
  1013. X        ex_cmds1.c ex_cmds2.c events.c flexbuf.c \
  1014. X        fileio.c find.c ascii.c map.c mark.c misccmds.c \
  1015. X        mouse.c movement.c normal.c param.c preserve.c ptrfunc.c \
  1016. X        pipe.c \
  1017. X        screen.c $(REGEXPDIR)\regexp.c \
  1018. X        search.c status.c \
  1019. X        tags.c undo.c windows.c yankput.c msdos_c.c msdos_a.asm \
  1020. X        ibmpc_a.asm ibmpc_c.c version.c
  1021. X
  1022. XOBJ=        defscr.obj startup.obj \
  1023. X        alloc.obj buffers.obj edit.obj cmdline.obj cursor.obj \
  1024. X        ex_cmds1.obj ex_cmds2.obj events.obj flexbuf.obj \
  1025. X        fileio.obj find.obj ascii.obj map.obj mark.obj \
  1026. X        misccmds.obj mouse.obj movement.obj normal.obj param.obj \
  1027. X        pipe.obj \
  1028. X        preserve.obj ptrfunc.obj screen.obj search.obj status.obj \
  1029. X        tags.obj undo.obj windows.obj yankput.obj \
  1030. X        $(REGEXPDIR)\regexp.obj \
  1031. X        msdos_c.obj msdos_a.obj ibmpc_a.obj ibmpc_c.obj
  1032. X
  1033. XLINKFILE=    $(TARGET).lnk
  1034. X
  1035. Xall:        $(TARGET).exe
  1036. X
  1037. X$(TARGET).exe:    $(OBJ) $(LINKFILE) version.c
  1038. X        $(CC) $(CFLAGS) -c version.c
  1039. X        $(LD) @$(LINKFILE)
  1040. X
  1041. X$(LINKFILE):    $(THISFILE)
  1042. X        +echo defscr + startup + > $@
  1043. X        +echo alloc + buffers + edit + cmdline + cursor + >> $@
  1044. X        +echo ex_cmds1 + ex_cmds2 + events + >> $@
  1045. X        +echo flexbuf + fileio + find + ascii + >> $@
  1046. X        +echo map + mark + misccmds + mouse + movement + >> $@
  1047. X        +echo normal + param + preserve + pipe + >> $@
  1048. X        +echo ptrfunc + screen + search + status + tags + >> $@
  1049. X        +echo undo + windows + yankput + >> $@
  1050. X        +echo $(REGEXPDIR)\regexp + >> $@
  1051. X        +echo msdos_c + msdos_a + ibmpc_a + ibmpc_c + >> $@
  1052. X        +echo version + >> $@
  1053. X        # +echo $(LIB)\_main$(MEMMODEL) + >> $@
  1054. X        +echo $(LIB)\int >> $@
  1055. X        +echo $(TARGET).exe $(LDFLAGS) ;  >> $@
  1056. X
  1057. X.c.obj:
  1058. X        # $(CC) $(CFLAGS) -o$@ -c $<
  1059. X        $(CC) $(CFLAGS) -c $<
  1060. X
  1061. X.asm.obj:
  1062. X        $(AS) $(ASFLAGS) $* ;
  1063. X
  1064. Xclean:
  1065. X        del *.obj
  1066. X        del $(LINKFILE)
  1067. X        del *.map
  1068. END_OF_FILE
  1069.   if test 2977 -ne `wc -c <'xvi/src/makefile.zc3'`; then
  1070.     echo shar: \"'xvi/src/makefile.zc3'\" unpacked with wrong size!
  1071.   fi
  1072.   # end of 'xvi/src/makefile.zc3'
  1073. fi
  1074. if test -f 'xvi/src/mark.c' -a "${1}" != "-c" ; then 
  1075.   echo shar: Will not clobber existing file \"'xvi/src/mark.c'\"
  1076. else
  1077.   echo shar: Extracting \"'xvi/src/mark.c'\" \(2886 characters\)
  1078.   sed "s/^X//" >'xvi/src/mark.c' <<'END_OF_FILE'
  1079. X/* Copyright (c) 1990,1991,1992 Chris and John Downey */
  1080. X#ifndef lint
  1081. Xstatic char *sccsid = "@(#)mark.c    2.1 (Chris & John Downey) 7/29/92";
  1082. X#endif
  1083. X
  1084. X/***
  1085. X
  1086. X* program name:
  1087. X    xvi
  1088. X* function:
  1089. X    PD version of UNIX "vi" editor, with extensions.
  1090. X* module name:
  1091. X    mark.c
  1092. X* module function:
  1093. X    Routines to maintain and manipulate marks.
  1094. X* history:
  1095. X    STEVIE - ST Editor for VI Enthusiasts, Version 3.10
  1096. X    Originally by Tim Thompson (twitch!tjt)
  1097. X    Extensive modifications by Tony Andrews (onecom!wldrdg!tony)
  1098. X    Heavily modified by Chris & John Downey
  1099. X
  1100. X***/
  1101. X
  1102. X#include "xvi.h"
  1103. X
  1104. X#ifdef    MEGAMAX
  1105. Xoverlay "mark"
  1106. X#endif
  1107. X
  1108. X/*
  1109. X * A new buffer - initialise it so there are no marks.
  1110. X */
  1111. Xvoid
  1112. Xinit_marks(buffer)
  1113. XBuffer    *buffer;
  1114. X{
  1115. X    Mark    *mlist = buffer->b_mlist;
  1116. X    int    i;
  1117. X
  1118. X    for (i = 0; i < NMARKS; i++)
  1119. X    mlist[i].m_name = '\0';
  1120. X
  1121. X    buffer->b_pcvalid = FALSE;
  1122. X}
  1123. X
  1124. X/*
  1125. X * setmark(c) - set mark 'c' at current cursor position in given buffer.
  1126. X *
  1127. X * Returns TRUE on success, FALSE if no room for mark or bad name given.
  1128. X */
  1129. Xbool_t
  1130. Xsetmark(c, buffer, pos)
  1131. Xint    c;
  1132. XBuffer    *buffer;
  1133. XPosn    *pos;
  1134. X{
  1135. X    Mark    *mlist = buffer->b_mlist;
  1136. X    int    i;
  1137. X
  1138. X    if (!is_alpha((unsigned char) c))
  1139. X    return(FALSE);
  1140. X
  1141. X    /*
  1142. X     * If there is already a mark of this name, then just use the
  1143. X     * existing mark entry.
  1144. X     */
  1145. X    for (i = 0; i < NMARKS; i++) {
  1146. X    if (mlist[i].m_name == (unsigned char) c) {
  1147. X        mlist[i].m_pos = *pos;
  1148. X        return(TRUE);
  1149. X    }
  1150. X    }
  1151. X
  1152. X    /*
  1153. X     * There wasn't a mark of the given name, so find a free slot
  1154. X     */
  1155. X    for (i = 0; i < NMARKS; i++) {
  1156. X    if (mlist[i].m_name == '\0') {    /* got a free one */
  1157. X        mlist[i].m_name = c;
  1158. X        mlist[i].m_pos = *pos;
  1159. X        return(TRUE);
  1160. X    }
  1161. X    }
  1162. X    return(FALSE);
  1163. X}
  1164. X
  1165. X/*
  1166. X * setpcmark() - set the previous context mark to the current position
  1167. X */
  1168. Xvoid
  1169. Xsetpcmark(window)
  1170. XXviwin    *window;
  1171. X{
  1172. X    window->w_buffer->b_pcmark.m_pos = *(window->w_cursor);
  1173. X    window->w_buffer->b_pcvalid = TRUE;
  1174. X}
  1175. X
  1176. X/*
  1177. X * getmark(c) - find mark for char 'c' in given buffer
  1178. X *
  1179. X * Return pointer to Position or NULL if no such mark.
  1180. X */
  1181. XPosn *
  1182. Xgetmark(c, buffer)
  1183. Xint    c;
  1184. XBuffer    *buffer;
  1185. X{
  1186. X    Mark    *mlist = buffer->b_mlist;
  1187. X    int    i;
  1188. X
  1189. X    if (c == '\'' || c == '`') {    /* previous context mark */
  1190. X    return(buffer->b_pcvalid ? &(buffer->b_pcmark.m_pos) : NULL);
  1191. X    }
  1192. X
  1193. X    for (i = 0; i < NMARKS; i++) {
  1194. X    if (mlist[i].m_name == (unsigned char) c)
  1195. X        return(&(mlist[i].m_pos));
  1196. X    }
  1197. X    return(NULL);
  1198. X}
  1199. X
  1200. X/*
  1201. X * clrmark(line) - clear any marks for 'line'
  1202. X *
  1203. X * Used any time a line is deleted so we don't have marks pointing to
  1204. X * non-existent lines.
  1205. X */
  1206. Xvoid
  1207. Xclrmark(line, buffer)
  1208. XLine    *line;
  1209. XBuffer    *buffer;
  1210. X{
  1211. X    Mark    *mlist = buffer->b_mlist;
  1212. X    int    i;
  1213. X
  1214. X    for (i = 0; i < NMARKS; i++) {
  1215. X    if (mlist[i].m_pos.p_line == line) {
  1216. X        mlist[i].m_name = '\0';
  1217. X    }
  1218. X    }
  1219. X    if (buffer->b_pcvalid && (buffer->b_pcmark.m_pos.p_line == line)) {
  1220. X    buffer->b_pcvalid = FALSE;
  1221. X    }
  1222. X}
  1223. END_OF_FILE
  1224.   if test 2886 -ne `wc -c <'xvi/src/mark.c'`; then
  1225.     echo shar: \"'xvi/src/mark.c'\" unpacked with wrong size!
  1226.   fi
  1227.   # end of 'xvi/src/mark.c'
  1228. fi
  1229. if test -f 'xvi/src/msdos.h' -a "${1}" != "-c" ; then 
  1230.   echo shar: Will not clobber existing file \"'xvi/src/msdos.h'\"
  1231. else
  1232.   echo shar: Extracting \"'xvi/src/msdos.h'\" \(3255 characters\)
  1233.   sed "s/^X//" >'xvi/src/msdos.h' <<'END_OF_FILE'
  1234. X/* Copyright (c) 1990,1991,1992 Chris and John Downey */
  1235. X/***
  1236. X* @(#)msdos.h    2.1 (Chris & John Downey) 7/29/92
  1237. X
  1238. X* program name:
  1239. X    xvi
  1240. X* function:
  1241. X    PD version of UNIX "vi" editor, with extensions.
  1242. X* module name:
  1243. X    msdos.h
  1244. X* module function:
  1245. X    Definitions for MS-DOS system interface.
  1246. X* history:
  1247. X    STEVIE - ST Editor for VI Enthusiasts, Version 3.10
  1248. X    Originally by Tim Thompson (twitch!tjt)
  1249. X    Extensive modifications by Tony Andrews (onecom!wldrdg!tony)
  1250. X    Heavily modified by Chris & John Downey
  1251. X
  1252. X***/
  1253. X
  1254. X#include <dos.h>
  1255. X#include <fcntl.h>
  1256. X#include <io.h>
  1257. X#include <process.h>
  1258. X#include <stdlib.h>
  1259. X#include <time.h>
  1260. X
  1261. X/*
  1262. X * This is a workaround for a particularly nasty bug which appeared
  1263. X * in one compiler recently.
  1264. X */
  1265. X#ifdef NULL
  1266. X#   undef NULL
  1267. X#endif
  1268. X#define NULL    ((void *) 0)
  1269. X
  1270. X/*
  1271. X * Get definitions for terminal interface.
  1272. X */
  1273. X#ifdef DOS386
  1274. X#   include "pc386.h"
  1275. X#else
  1276. X#   include "ibmpc.h"
  1277. X#endif
  1278. X
  1279. X#ifndef HELPFILE
  1280. X#   define HELPFILE    "c:\\xvi\\help"
  1281. X#endif
  1282. X
  1283. X/*
  1284. X * System-dependent constants.
  1285. X */
  1286. X#define    MAXPATHLEN    143    /* maximum length of full path name */
  1287. X#define    MAXNAMLEN    12    /* maximum length of file name */
  1288. X#define    DIRSEPS        "\\/"    /*
  1289. X                 * directory separators within
  1290. X                 * pathnames
  1291. X                 */
  1292. X/*
  1293. X * Under MS-DOS, characters with the top bit set are perfectly valid
  1294. X * (although not necessarily always what you want to see).
  1295. X */
  1296. X#define DEF_CCHARS    TRUE
  1297. X#define DEF_MCHARS    TRUE
  1298. X
  1299. X#define DEF_TFF        fmt_MSDOS
  1300. X
  1301. X/*
  1302. X * Macros to open files in binary mode,
  1303. X * and to expand filenames.
  1304. X */
  1305. X#define fopenrb(f)    fopen((f),"rb")
  1306. X#define fopenwb(f)    fopen((f),"wb")
  1307. X#define fexpand(f)    (f)
  1308. X
  1309. X/*
  1310. X * Execute a command in a subshell.
  1311. X */
  1312. X#define call_system(s)    system(s)
  1313. X
  1314. X/*
  1315. X * Execute a shell.
  1316. X */
  1317. X#define call_shell(s)    spawnlp(0, (s), (s), (char *) NULL)
  1318. X
  1319. X/*
  1320. X * Size of buffer for file i/o routines.
  1321. X * The SETVBUF_AVAIL forces the file i/o routines to
  1322. X * use a large buffer for reading and writing, and
  1323. X * this results in a large performance improvement.
  1324. X */
  1325. X#define SETVBUF_AVAIL
  1326. X#define WRTBUFSIZ    0x7000
  1327. X#define READBUFSIZ    0x1000
  1328. X
  1329. X#ifdef    __ZTC__
  1330. X#   define exists(f)    (findfirst((f),FA_HIDDEN|FA_SYSTEM|FA_DIREC)\
  1331. X                                != NULL)
  1332. X#else /* not Zortech */
  1333. X#   include <malloc.h>
  1334. X#   define  exists(f)    (access(f, 0) == 0)
  1335. X#endif /* not Zortech */
  1336. X
  1337. X/*
  1338. X * Definitions needed for dstat() system call.
  1339. X */
  1340. Xstruct dstat
  1341. X{
  1342. X    char        d_bytealigned[43];
  1343. X};
  1344. X
  1345. X#define    dst_mode    d_bytealigned[21]
  1346. X#define dst_BASENAME(i)    (&(i).d_bytealigned[30])
  1347. X            /* file's basename */
  1348. X#define dst_LAST(i)    (&(i).d_bytealigned[42])
  1349. X            /* pointer to terminating '\0' of basename */
  1350. X
  1351. X/*
  1352. X * Mode bits.
  1353. X */
  1354. X#define    dst_READONLY    1
  1355. X#define    dst_HIDDEN    2
  1356. X#define    dst_SYSTEM    4
  1357. X#define    dst_VLABEL    010
  1358. X#define    dst_DIR        020
  1359. X#define    dst_ARCHIVE    040
  1360. X
  1361. X/*
  1362. X * Declarations for system interface routines in msdos_c.c &
  1363. X * msdos_a.asm (or pc386.c):
  1364. X */
  1365. Xextern    bool_t        can_write P((char *));
  1366. Xextern    void        catchints P((void));
  1367. Xextern    void        delay P((void));
  1368. Xextern    int        statfirst P((char *, struct dstat *, int));
  1369. Xextern    int        statnext P((struct dstat *));
  1370. Xextern    void        sys_init P((void));
  1371. Xextern    void        sys_startv P((void));
  1372. Xextern    void        sys_endv P((void));
  1373. Xextern    void        sys_exit P((int));
  1374. Xextern    bool_t        sys_pipe P((char *, int (*)(FILE *), long (*)(FILE *)));
  1375. Xextern    char        *tempfname P((char *));
  1376. END_OF_FILE
  1377.   if test 3255 -ne `wc -c <'xvi/src/msdos.h'`; then
  1378.     echo shar: \"'xvi/src/msdos.h'\" unpacked with wrong size!
  1379.   fi
  1380.   # end of 'xvi/src/msdos.h'
  1381. fi
  1382. if test -f 'xvi/src/ptrfunc.c' -a "${1}" != "-c" ; then 
  1383.   echo shar: Will not clobber existing file \"'xvi/src/ptrfunc.c'\"
  1384. else
  1385.   echo shar: Extracting \"'xvi/src/ptrfunc.c'\" \(2501 characters\)
  1386.   sed "s/^X//" >'xvi/src/ptrfunc.c' <<'END_OF_FILE'
  1387. X/* Copyright (c) 1990,1991,1992 Chris and John Downey */
  1388. X#ifndef lint
  1389. Xstatic char *sccsid = "@(#)ptrfunc.c    2.2 (Chris & John Downey) 8/28/92";
  1390. X#endif
  1391. X
  1392. X/***
  1393. X
  1394. X* program name:
  1395. X    xvi
  1396. X* function:
  1397. X    PD version of UNIX "vi" editor, with extensions.
  1398. X* module name:
  1399. X    ptrfunc.c
  1400. X* module function:
  1401. X    Primitive functions on "Posn"s.
  1402. X* history:
  1403. X    STEVIE - ST Editor for VI Enthusiasts, Version 3.10
  1404. X    Originally by Tim Thompson (twitch!tjt)
  1405. X    Extensive modifications by Tony Andrews (onecom!wldrdg!tony)
  1406. X    Heavily modified by Chris & John Downey
  1407. X
  1408. X***/
  1409. X
  1410. X#include "xvi.h"
  1411. X
  1412. X/*
  1413. X * The routines in this file attempt to imitate many of the operations
  1414. X * that used to be performed on simple character pointers and are now
  1415. X * performed on Posn's. This makes it easier to modify other sections
  1416. X * of the code. Think of a Posn as representing a position in the file.
  1417. X * Posns can be incremented, decremented, compared, etc. through the
  1418. X * functions implemented here.
  1419. X *
  1420. X * Note that some functions are now implemented as macros, in ptrfunc.h.
  1421. X */
  1422. X
  1423. X/*
  1424. X * inc(p)
  1425. X *
  1426. X * Increment the line pointer 'p' crossing line boundaries as
  1427. X * necessary. Return mv_CHLINE when crossing a line, mv_NOMOVE when at
  1428. X * end of file, mv_SAMELINE otherwise.
  1429. X */
  1430. Xenum mvtype
  1431. Xinc(lp)
  1432. Xregister Posn    *lp;
  1433. X{
  1434. X    register char *p;
  1435. X
  1436. X    p = &(lp->p_line->l_text[lp->p_index]);
  1437. X
  1438. X    if (*p != '\0') {            /* still within line */
  1439. X    lp->p_index++;
  1440. X    return((p[1] != '\0') ? mv_SAMELINE : mv_EOL);
  1441. X    }
  1442. X
  1443. X    if (!is_lastline(lp->p_line->l_next)) {
  1444. X    lp->p_index = 0;
  1445. X    lp->p_line = lp->p_line->l_next;
  1446. X    return(mv_CHLINE);
  1447. X    }
  1448. X
  1449. X    return(mv_NOMOVE);
  1450. X}
  1451. X
  1452. X/*
  1453. X * dec(p)
  1454. X *
  1455. X * Decrement the line pointer 'p' crossing line boundaries as
  1456. X * necessary. Return mv_CHLINE when crossing a line, mv_NOMOVE when at
  1457. X * start of file, mv_SAMELINE otherwise.
  1458. X */
  1459. Xenum mvtype
  1460. Xdec(lp)
  1461. Xregister Posn    *lp;
  1462. X{
  1463. X    if (lp->p_index > 0) {            /* still within line */
  1464. X    lp->p_index--;
  1465. X    return(mv_SAMELINE);
  1466. X    }
  1467. X
  1468. X    if (!is_line0(lp->p_line->l_prev)) {
  1469. X    lp->p_line = lp->p_line->l_prev;
  1470. X    lp->p_index = strlen(lp->p_line->l_text);
  1471. X    return(mv_CHLINE);
  1472. X    }
  1473. X
  1474. X    return(mv_NOMOVE);                /* at start of file */
  1475. X}
  1476. X
  1477. X/*
  1478. X * pswap(a, b) - swap two position pointers.
  1479. X */
  1480. Xvoid
  1481. Xpswap(a, b)
  1482. Xregister Posn    *a, *b;
  1483. X{
  1484. X    register Posn    tmp;
  1485. X
  1486. X    tmp = *a;
  1487. X    *a  = *b;
  1488. X    *b  = tmp;
  1489. X}
  1490. X
  1491. X/*
  1492. X * Posn comparisons.
  1493. X */
  1494. Xbool_t
  1495. Xlt(a, b)
  1496. Xregister Posn    *a, *b;
  1497. X{
  1498. X    if (a->p_line != b->p_line) {
  1499. X    return(earlier(a->p_line, b->p_line));
  1500. X    } else {
  1501. X    return(a->p_index < b->p_index);
  1502. X    }
  1503. X}
  1504. END_OF_FILE
  1505.   if test 2501 -ne `wc -c <'xvi/src/ptrfunc.c'`; then
  1506.     echo shar: \"'xvi/src/ptrfunc.c'\" unpacked with wrong size!
  1507.   fi
  1508.   # end of 'xvi/src/ptrfunc.c'
  1509. fi
  1510. if test -f 'xvi/src/signal.c' -a "${1}" != "-c" ; then 
  1511.   echo shar: Will not clobber existing file \"'xvi/src/signal.c'\"
  1512. else
  1513.   echo shar: Extracting \"'xvi/src/signal.c'\" \(3071 characters\)
  1514.   sed "s/^X//" >'xvi/src/signal.c' <<'END_OF_FILE'
  1515. X/* Copyright (c) 1990,1991,1992 Chris and John Downey */
  1516. X#ifndef lint
  1517. Xstatic char *sccsid = "@(#)signal.c    2.1 (Chris & John Downey) 7/29/92";
  1518. X#endif
  1519. X
  1520. X/***
  1521. X
  1522. X* program name:
  1523. X    xvi
  1524. X* function:
  1525. X    PD version of UNIX "vi" editor, with extensions.
  1526. X* module name:
  1527. X    signal.c
  1528. X* module function:
  1529. X    Signal handling routines.
  1530. X
  1531. X    This is all fairly system-dependent, & may be replaced by more
  1532. X    system-specific routines if required. On MS-DOS, for instance,
  1533. X    this module isn't used at all: ignore_signals() &
  1534. X    catch_signals() are defined in msdos_c.c & msdos_a.asm instead.
  1535. X* history:
  1536. X    STEVIE - ST Editor for VI Enthusiasts, Version 3.10
  1537. X    Originally by Tim Thompson (twitch!tjt)
  1538. X    Extensive modifications by Tony Andrews (onecom!wldrdg!tony)
  1539. X    Heavily modified by Chris & John Downey
  1540. X
  1541. X***/
  1542. X
  1543. X#include "xvi.h"
  1544. X
  1545. X/*
  1546. X * Signal handlers.
  1547. X */
  1548. X#ifdef    SIGINT
  1549. X    static    void    int_handler P((int));
  1550. X#endif
  1551. X#ifdef    SIGTSTP
  1552. X    static    void    tstp_handler P((int));
  1553. X#endif
  1554. X#ifdef    SIGHUP
  1555. X    static    void    hup_handler P((int));
  1556. X#endif
  1557. X#ifdef SIGTERM
  1558. X    static    void    term_handler P((int));
  1559. X#endif
  1560. X
  1561. Xvoid
  1562. Xignore_signals()
  1563. X{
  1564. X#ifdef    SIGINT
  1565. X    (void) signal(SIGINT, SIG_IGN);
  1566. X#endif
  1567. X#ifdef SIGBREAK
  1568. X    /*
  1569. X     * On OS/2, this is generated by pressing control-break.
  1570. X     */
  1571. X    (void) signal(SIGBREAK, SIG_IGN);
  1572. X#endif
  1573. X#ifdef    SIGQUIT
  1574. X    (void) signal(SIGQUIT, SIG_IGN);
  1575. X#endif
  1576. X#ifdef    SIGTSTP
  1577. X    (void) signal(SIGTSTP, SIG_IGN);
  1578. X#endif
  1579. X    /*
  1580. X     * There isn't much point in catching or ignoring SIGHUP
  1581. X     * signals until we have some modified buffers to preserve.
  1582. X     */
  1583. X#ifdef SIGTERM
  1584. X    (void) signal(SIGTERM, SIG_IGN);
  1585. X#endif
  1586. X}
  1587. X
  1588. Xvoid
  1589. Xcatch_signals()
  1590. X{
  1591. X#ifdef    SIGINT
  1592. X    (void) signal(SIGINT, int_handler);
  1593. X#endif
  1594. X#ifdef SIGBREAK
  1595. X    /*
  1596. X     * On OS/2, this is generated by pressing control-break.
  1597. X     */
  1598. X    (void) signal(SIGBREAK, int_handler);
  1599. X#endif
  1600. X#ifdef    SIGTSTP
  1601. X    (void) signal(SIGTSTP, tstp_handler);
  1602. X#endif
  1603. X#ifdef SIGHUP
  1604. X    (void) signal(SIGHUP, hup_handler);
  1605. X#endif
  1606. X#ifdef SIGTERM
  1607. X    (void) signal(SIGTERM, term_handler);
  1608. X#endif
  1609. X}
  1610. X
  1611. X/*
  1612. X * Handler for SIGINT (keyboard interrupt).
  1613. X */
  1614. X#ifdef    SIGINT
  1615. Xstatic void
  1616. Xint_handler(sig)
  1617. Xint    sig;
  1618. X{
  1619. X    signal(SIGINT, int_handler);
  1620. X    kbdintr = 1;
  1621. X}
  1622. X#endif
  1623. X
  1624. X/*
  1625. X * This function is used on UNIX as the signal handler
  1626. X * for the keyboard-generated TSTP signal.
  1627. X */
  1628. X#ifdef    SIGTSTP
  1629. Xstatic void
  1630. Xtstp_handler(sig)
  1631. Xint    sig;
  1632. X{
  1633. X    do_suspend(curwin);
  1634. X}
  1635. X#endif
  1636. X
  1637. X/*
  1638. X * This one is used for the hangup signal, which generally means that
  1639. X * the terminal line has gone dead. This means sys_exit() doesn't make
  1640. X * much sense, so we call exit() instead.
  1641. X */
  1642. X#ifdef    SIGHUP
  1643. Xstatic void
  1644. Xhup_handler(sig)
  1645. Xint    sig;
  1646. X{
  1647. X    signal(SIGHUP, SIG_IGN);
  1648. X    /*
  1649. X     * Make backup copies of all modified buffers.
  1650. X     */
  1651. X    (void) do_preserve();
  1652. X    exit(0);
  1653. X}
  1654. X#endif
  1655. X
  1656. X/*
  1657. X * This one is used for the software-generated terminate signal.
  1658. X */
  1659. X#ifdef SIGTERM
  1660. Xstatic void
  1661. Xterm_handler(sig)
  1662. Xint    sig;
  1663. X{
  1664. X    signal(SIGTERM, SIG_IGN);
  1665. X    /*
  1666. X     * Make backup copies of all modified buffers.
  1667. X     */
  1668. X    (void) do_preserve();
  1669. X    sys_exit(0);
  1670. X}
  1671. X#endif
  1672. END_OF_FILE
  1673.   if test 3071 -ne `wc -c <'xvi/src/signal.c'`; then
  1674.     echo shar: \"'xvi/src/signal.c'\" unpacked with wrong size!
  1675.   fi
  1676.   # end of 'xvi/src/signal.c'
  1677. fi
  1678. if test -f 'xvi/src/status.c' -a "${1}" != "-c" ; then 
  1679.   echo shar: Will not clobber existing file \"'xvi/src/status.c'\"
  1680. else
  1681.   echo shar: Extracting \"'xvi/src/status.c'\" \(2442 characters\)
  1682.   sed "s/^X//" >'xvi/src/status.c' <<'END_OF_FILE'
  1683. X/* Copyright (c) 1990,1991,1992 Chris and John Downey */
  1684. X#ifndef lint
  1685. Xstatic char *sccsid = "@(#)status.c    2.1 (Chris & John Downey) 7/29/92";
  1686. X#endif
  1687. X
  1688. X/***
  1689. X
  1690. X* program name:
  1691. X    xvi
  1692. X* function:
  1693. X    PD version of UNIX "vi" editor, with extensions.
  1694. X* module name:
  1695. X    status.c
  1696. X* module function:
  1697. X    Routines to print status line messages.
  1698. X* history:
  1699. X    STEVIE - ST Editor for VI Enthusiasts, Version 3.10
  1700. X    Originally by Tim Thompson (twitch!tjt)
  1701. X    Extensive modifications by Tony Andrews (onecom!wldrdg!tony)
  1702. X    Heavily modified by Chris & John Downey
  1703. X
  1704. X***/
  1705. X
  1706. X#include "xvi.h"
  1707. X
  1708. X/*
  1709. X * Set up the "slinetype" field in the given buffer structure,
  1710. X * according to the number of columns available.
  1711. X */
  1712. Xvoid
  1713. Xinit_sline(win)
  1714. XXviwin    *win;
  1715. X{
  1716. X    flexclear(&win->w_statusline);
  1717. X}
  1718. X
  1719. X/*VARARGS2*/
  1720. X/*PRINTFLIKE*/
  1721. Xvoid
  1722. Xshow_message
  1723. X#ifdef    __STDC__
  1724. X    (Xviwin *window, char *format, ...)
  1725. X#else /* not __STDC__ */
  1726. X    (window, format, va_alist)
  1727. X    Xviwin    *window;
  1728. X    char    *format;
  1729. X    va_dcl
  1730. X#endif    /* __STDC__ */
  1731. X{
  1732. X    va_list    argp;
  1733. X
  1734. X    VA_START(argp, format);
  1735. X    (void) flexclear(&window->w_statusline);
  1736. X    (void) vformat(&window->w_statusline, format, argp);
  1737. X    va_end(argp);
  1738. X
  1739. X    update_sline(window);
  1740. X}
  1741. X
  1742. X/*VARARGS2*/
  1743. X/*PRINTFLIKE*/
  1744. Xvoid
  1745. Xshow_error
  1746. X#ifdef    __STDC__
  1747. X    (Xviwin *window, char *format, ...)
  1748. X#else /* not __STDC__ */
  1749. X    (window, format, va_alist)
  1750. X    Xviwin    *window;
  1751. X    char    *format;
  1752. X    va_dcl
  1753. X#endif    /* __STDC__ */
  1754. X{
  1755. X    va_list    argp;
  1756. X
  1757. X    beep(window);
  1758. X    VA_START(argp, format);
  1759. X    (void) flexclear(&window->w_statusline);
  1760. X    (void) vformat(&window->w_statusline, format, argp);
  1761. X    va_end(argp);
  1762. X
  1763. X    update_sline(window);
  1764. X}
  1765. X
  1766. Xvoid
  1767. Xshow_file_info(window)
  1768. XXviwin    *window;
  1769. X{
  1770. X    if (echo & e_SHOWINFO) {
  1771. X    Buffer    *buffer;
  1772. X    Flexbuf    *slp;
  1773. X    long    position, total;
  1774. X    long    percentage;
  1775. X
  1776. X    buffer = window->w_buffer;
  1777. X
  1778. X    position = lineno(buffer, window->w_cursor->p_line);
  1779. X    total = lineno(buffer, buffer->b_lastline->l_prev);
  1780. X    percentage = (total > 0) ? (position * 100) / total : 0;
  1781. X
  1782. X    slp = &window->w_statusline;
  1783. X    flexclear(slp);
  1784. X    if (buffer->b_filename == NULL) {
  1785. X        (void) lformat(slp, "No File ");
  1786. X    } else {
  1787. X        (void) lformat(slp, "\"%s\" ", buffer->b_filename);
  1788. X    }
  1789. X    (void) lformat(slp, "%s%s%sline %ld of %ld (%ld%%)",
  1790. X        is_readonly(buffer) ? "[Read only] " : "",
  1791. X        not_editable(buffer) ? "[Not editable] " : "",
  1792. X        is_modified(buffer) ? "[Modified] " : "",
  1793. X        position,
  1794. X        total,
  1795. X        percentage);
  1796. X    }
  1797. X    update_sline(window);
  1798. X}
  1799. END_OF_FILE
  1800.   if test 2442 -ne `wc -c <'xvi/src/status.c'`; then
  1801.     echo shar: \"'xvi/src/status.c'\" unpacked with wrong size!
  1802.   fi
  1803.   # end of 'xvi/src/status.c'
  1804. fi
  1805. if test -f 'xvi/src/sunview.h' -a "${1}" != "-c" ; then 
  1806.   echo shar: Will not clobber existing file \"'xvi/src/sunview.h'\"
  1807. else
  1808.   echo shar: Extracting \"'xvi/src/sunview.h'\" \(2341 characters\)
  1809.   sed "s/^X//" >'xvi/src/sunview.h' <<'END_OF_FILE'
  1810. X/* Copyright (c) 1990,1991,1992 Chris and John Downey */
  1811. X/***
  1812. X
  1813. X* @(#)sunview.h    2.1 (Chris & John Downey) 7/29/92
  1814. X
  1815. X* program name:
  1816. X    xvi
  1817. X* function:
  1818. X    PD version of UNIX "vi" editor, with extensions.
  1819. X* module name:
  1820. X    sunview.h
  1821. X* module function:
  1822. X    Definitions for terminal interface module for SunView.
  1823. X* history:
  1824. X    STEVIE - ST Editor for VI Enthusiasts, Version 3.10
  1825. X    Originally by Tim Thompson (twitch!tjt)
  1826. X    Extensive modifications by Tony Andrews (onecom!wldrdg!tony)
  1827. X    Heavily modified by Chris & John Downey
  1828. X
  1829. X***/
  1830. X
  1831. X/*
  1832. X * Definitions for communications link between front end & back end
  1833. X * processes.
  1834. X */
  1835. X#define XYDIGITS    3    /*
  1836. X                 * Number of hex. digits encoding row
  1837. X                 * or column position of mouse in
  1838. X                 * window.
  1839. X                 */
  1840. X
  1841. X#define PREFIXCHAR    '\022'    /* control-R */
  1842. X
  1843. X/*
  1844. X * Size of screen.
  1845. X */
  1846. Xextern    unsigned int    Rows;
  1847. Xextern    unsigned int    Columns;
  1848. X
  1849. X/*
  1850. X * We can't do these:
  1851. X */
  1852. X#define invis_cursor()        /* invisible cursor (very optional) */
  1853. X#define vis_cursor()        /* visible cursor (very optional) */
  1854. X
  1855. X#define can_scroll_area FALSE    /* true if we can set scroll region */
  1856. X#define scroll_up(s,e,n)
  1857. X#define scroll_down(s,e,n)
  1858. X#define can_del_line    TRUE    /* true if we can delete screen lines */
  1859. X/*
  1860. X * tty_linefeed() isn't needed if can_del_line is TRUE.
  1861. X */
  1862. X#define tty_linefeed()
  1863. X#define can_ins_line    TRUE    /* true if we can insert screen lines */
  1864. X#define can_inschar    TRUE    /* true if we can insert characters */
  1865. X#define cost_goto    1    /*
  1866. X                 * Cost of doing a goto.
  1867. X                 *
  1868. X                 * This is a guess, but it's probably
  1869. X                 * reasonable.
  1870. X                 */
  1871. X/*
  1872. X * Colour handling (only in monochrome at the moment).
  1873. X */
  1874. X#define DEF_COLOUR    1    /* maps to normal text colours */
  1875. X#define DEF_STCOLOUR    2    /* maps to reverse video */
  1876. X#define DEF_SYSCOLOUR    0    /* maps to normal text colours */
  1877. X
  1878. Xextern    void        outchar P((int c));
  1879. Xextern    void        outstr P((char *s));
  1880. Xextern    void        alert P((void));
  1881. Xextern    void        flush_output P((void));
  1882. Xextern    void        set_colour P((int c));
  1883. Xextern    void        tty_goto P((int row, int col));
  1884. Xextern    void        insert_line P((void));
  1885. Xextern    void        delete_line P((void));
  1886. Xextern    void        inschar P((int));
  1887. Xextern    void        erase_line P((void));
  1888. Xextern    void        erase_display P((void));
  1889. Xextern    void        tty_open P((unsigned int *, unsigned int *));
  1890. Xextern    void        tty_startv P((void));
  1891. Xextern    void        tty_endv P((void));
  1892. Xextern    void        tty_close P((void));
  1893. END_OF_FILE
  1894.   if test 2341 -ne `wc -c <'xvi/src/sunview.h'`; then
  1895.     echo shar: \"'xvi/src/sunview.h'\" unpacked with wrong size!
  1896.   fi
  1897.   # end of 'xvi/src/sunview.h'
  1898. fi
  1899. if test -f 'xvi/src/tos.h' -a "${1}" != "-c" ; then 
  1900.   echo shar: Will not clobber existing file \"'xvi/src/tos.h'\"
  1901. else
  1902.   echo shar: Extracting \"'xvi/src/tos.h'\" \(2771 characters\)
  1903.   sed "s/^X//" >'xvi/src/tos.h' <<'END_OF_FILE'
  1904. X/* Copyright (c) 1990,1991,1992 Chris and John Downey */
  1905. X/***
  1906. X
  1907. X* @(#)tos.h    2.1 (Chris & John Downey) 7/29/92
  1908. X
  1909. X* program name:
  1910. X    xvi
  1911. X* function:
  1912. X    Portable version of UNIX "vi" editor, with extensions.
  1913. X* module name:
  1914. X    tos.h
  1915. X* module function:
  1916. X    Definitions for TOS system interface module.
  1917. X* history:
  1918. X    STEVIE - ST Editor for VI Enthusiasts, Version 3.10
  1919. X    Originally by Tim Thompson (twitch!tjt)
  1920. X    Extensive modifications by Tony Andrews (onecom!wldrdg!tony)
  1921. X    Heavily modified by Chris & John Downey
  1922. X
  1923. X***/
  1924. X
  1925. X#ifndef    HELPFILE
  1926. X#   define  HELPFILE    "c:\\bin\\help.xvi"
  1927. X#endif
  1928. X
  1929. X/*
  1930. X * System-dependent constants
  1931. X */
  1932. X
  1933. X/*
  1934. X * These numbers may not be right for TOS; who knows?
  1935. X */
  1936. X#define    MAXPATHLEN    79    /* maximum length of full path name */
  1937. X#define    MAXNAMLEN    12    /* maximum length of file name */
  1938. X#define    DIRSEPS        "\\"
  1939. X
  1940. Xextern    int        Rows;            /* size of screen */
  1941. Xextern    int        Columns;
  1942. X
  1943. X/*
  1944. X * Default file format.
  1945. X */
  1946. X#define DEF_TFF        fmt_TOS
  1947. X
  1948. X/*
  1949. X * No need to flush output - it has already happened.
  1950. X */
  1951. X#define    flush_output()
  1952. X
  1953. X/*
  1954. X * Terminal driving functions.
  1955. X */
  1956. X#define    erase_line()    outstr("\033K")    /* erase to end of line */
  1957. X#define    insert_line()    outstr("\033L")    /* insert one line */
  1958. X#define    delete_line()    outstr("\033M")    /* delete one line */
  1959. X#define    erase_display()    outstr("\033E")    /* erase display */
  1960. X#define    invis_cursor()    outstr("\033f")    /* invisible cursor */
  1961. X#define    vis_cursor()    outstr("\033e")    /* visible cursor */
  1962. X#define    scroll_up(x, y, z)    st_scroll((x),(y),(z))    /* scroll up area */
  1963. X#define    scroll_down(x, y, z)    st_scroll((x),(y),-(z))    /* scroll down area */
  1964. X
  1965. X#define    cost_goto    8            /* cost of using tty_goto() */
  1966. X#define    can_ins_line    TRUE
  1967. X#define    can_del_line    TRUE
  1968. X/*
  1969. X * tty_linefeed() isn't needed if can_del_line is TRUE.
  1970. X */
  1971. X#define tty_linefeed()
  1972. X
  1973. X#define    can_scroll_area    TRUE
  1974. X
  1975. X#define    can_inschar    FALSE
  1976. X#define    inschar(c)
  1977. X
  1978. X/*
  1979. X * Colour handling: just b/w on Ataris at the moment.
  1980. X */
  1981. X#define    DEF_COLOUR    0
  1982. X#define    DEF_STCOLOUR    1
  1983. X#define    DEF_SYSCOLOUR    0
  1984. X
  1985. X/*
  1986. X * Macros to open files in binary mode,
  1987. X * and to expand filenames.
  1988. X */
  1989. X#define fopenrb(f)    fopen((f), "rb")
  1990. X#define fopenwb(f)    fopen((f), "wb")
  1991. X#define    fexpand(f)    (f)
  1992. X
  1993. X#define call_system(s)    system(s)
  1994. X#define call_shell(s)    forkl((s), (char *) NULL)
  1995. X
  1996. X/*
  1997. X * Declarations for system interface routines in tos.c.
  1998. X */
  1999. Xextern    int        inchar(long);
  2000. Xextern    void        outchar(char);
  2001. Xextern    void        outstr(char *);
  2002. Xextern    void        alert(void);
  2003. X#ifndef LATTICE
  2004. X    extern  bool_t    remove(char *);
  2005. X#endif
  2006. Xextern    bool_t        can_write(char *);
  2007. Xextern    void        sys_init(void);
  2008. Xextern    void        sys_startv(void);
  2009. Xextern    void        sys_endv(void);
  2010. Xextern    void        sys_exit(int);
  2011. Xextern    void        tty_goto(int, int);
  2012. Xextern    void        delay(void);
  2013. Xextern  void        sleep(unsigned);
  2014. Xextern  void        set_colour(int);
  2015. Xextern  char        *tempfname(char *);
  2016. END_OF_FILE
  2017.   if test 2771 -ne `wc -c <'xvi/src/tos.h'`; then
  2018.     echo shar: \"'xvi/src/tos.h'\" unpacked with wrong size!
  2019.   fi
  2020.   # end of 'xvi/src/tos.h'
  2021. fi
  2022. if test -f 'xvi/src/virtscr.h' -a "${1}" != "-c" ; then 
  2023.   echo shar: Will not clobber existing file \"'xvi/src/virtscr.h'\"
  2024. else
  2025.   echo shar: Extracting \"'xvi/src/virtscr.h'\" \(2655 characters\)
  2026.   sed "s/^X//" >'xvi/src/virtscr.h' <<'END_OF_FILE'
  2027. X/* Copyright (c) 1990,1991,1992 Chris and John Downey */
  2028. X/***
  2029. X
  2030. X* @(#)virtscr.h    2.3 (Chris & John Downey) 9/4/92
  2031. X
  2032. X* program name:
  2033. X    xvi
  2034. X* function:
  2035. X    PD version of UNIX "vi" editor, with extensions.
  2036. X* module name:
  2037. X    virtscr.h
  2038. X* module function:
  2039. X    Definition of the VirtScr class.
  2040. X* history:
  2041. X    STEVIE - ST Editor for VI Enthusiasts, Version 3.10
  2042. X    Originally by Tim Thompson (twitch!tjt)
  2043. X    Extensive modifications by Tony Andrews (onecom!wldrdg!tony)
  2044. X    Heavily modified by Chris & John Downey
  2045. X
  2046. X***/
  2047. X
  2048. X/*
  2049. X * Type of an object whose pointers can be freely cast.
  2050. X */
  2051. X#ifdef    __STDC__
  2052. X#   define  genptr    void
  2053. X#else
  2054. X#   define  genptr    char
  2055. X#endif
  2056. X
  2057. Xtypedef struct virtscr {
  2058. X    genptr    *pv_window;
  2059. X    int        pv_rows;
  2060. X    int        pv_cols;
  2061. X/* public: */
  2062. X    struct virtscr
  2063. X        *(*v_new) P((struct virtscr *));
  2064. X    void    (*v_close) P((struct virtscr *));
  2065. X
  2066. X    int        (*v_rows) P((struct virtscr *));
  2067. X    int        (*v_cols) P((struct virtscr *));
  2068. X
  2069. X    void    (*v_clear_all) P((struct virtscr *));
  2070. X    void    (*v_clear_line) P((struct virtscr *, int, int));
  2071. X
  2072. X    void    (*v_goto) P((struct virtscr *, int, int));
  2073. X    void    (*v_advise) P((struct virtscr *, int, int, int, char *));
  2074. X
  2075. X    void    (*v_write) P((struct virtscr *, int, int, char *));
  2076. X    void    (*v_putc) P((struct virtscr *, int, int, int));
  2077. X
  2078. X    void    (*v_set_colour) P((struct virtscr *, int));
  2079. X    int        (*v_colour_cost) P((struct virtscr *));
  2080. X
  2081. X    void    (*v_flush) P((struct virtscr *));
  2082. X
  2083. X    void    (*v_beep) P((struct virtscr *));
  2084. X
  2085. X/* optional: do not use if NULL */
  2086. X    void    (*v_insert) P((struct virtscr *, int, int, char *));
  2087. X
  2088. X    int        (*v_scroll) P((struct virtscr *, int, int, int));
  2089. X
  2090. X    void    (*v_flash) P((struct virtscr *));
  2091. X
  2092. X    void    (*v_status) P((struct virtscr *, char *, char *, long, long));
  2093. X
  2094. X    void    (*v_activate) P((struct virtscr *));
  2095. X} VirtScr;
  2096. X
  2097. X#define    VSrows(vs)            ((*(vs->v_rows))(vs))
  2098. X#define    VScols(vs)            ((*(vs->v_cols))(vs))
  2099. X#define    VSclear_all(vs)            ((*(vs->v_clear_all))(vs))
  2100. X#define    VSclear_line(vs, row, col)    ((*(vs->v_clear_line))(vs, row, col))
  2101. X#define    VSgoto(vs, row, col)        ((*(vs->v_goto))(vs, row, col))
  2102. X#define    VSadvise(vs, r, c, i, str)    ((*(vs->v_advise))(vs, r, c, i, str))
  2103. X#define    VSwrite(vs, row, col, str)    ((*(vs->v_write))(vs, row, col, str))
  2104. X#define    VSputc(vs, row, col, c)        ((*(vs->v_putc))(vs, row, col, c))
  2105. X#define    VSset_colour(vs, colour)    ((*(vs->v_set_colour))(vs, colour))
  2106. X#define    VScolour_cost(vs)        ((*(vs->v_colour_cost))(vs))
  2107. X#define    VSflush(vs)            ((*(vs->v_flush))(vs))
  2108. X#define    VSbeep(vs)            ((*(vs->v_beep))(vs))
  2109. X#define    VSinsert(vs, row, col, str)    ((*(vs->v_insert))(vs, row, col, str))
  2110. X#define    VSscroll(vs, start, end, n)    ((*(vs->v_scroll))(vs, start, end, n))
  2111. END_OF_FILE
  2112.   if test 2655 -ne `wc -c <'xvi/src/virtscr.h'`; then
  2113.     echo shar: \"'xvi/src/virtscr.h'\" unpacked with wrong size!
  2114.   fi
  2115.   # end of 'xvi/src/virtscr.h'
  2116. fi
  2117. echo shar: End of archive 17 \(of 18\).
  2118. cp /dev/null ark17isdone
  2119. MISSING=""
  2120. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ; do
  2121.     if test ! -f ark${I}isdone ; then
  2122.     MISSING="${MISSING} ${I}"
  2123.     fi
  2124. done
  2125. if test "${MISSING}" = "" ; then
  2126.     echo You have unpacked all 18 archives.
  2127.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2128. else
  2129.     echo You still must unpack the following archives:
  2130.     echo "        " ${MISSING}
  2131. fi
  2132. exit 0
  2133. exit 0 # Just in case...
  2134.