home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume11 / stevie3.69a / part01 next >
Encoding:
Text File  |  1990-03-10  |  60.5 KB  |  2,161 lines

  1. Newsgroups: comp.sources.misc
  2. organization: AT&T Bell Labs - Lincroft, NJ
  3. keywords: Portable vi clone
  4. subject: v11i009: Stevie 3.69a - 1/6
  5. from: dmt@pegasus.ATT.COM (Dave Tutelman)
  6. Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  7.  
  8. Posting-number: Volume 11, Issue 9
  9. Submitted-by: dmt@pegasus.ATT.COM (Dave Tutelman)
  10. Archive-name: stevie3.69a/part01
  11.  
  12. Here's my improvements to Tony Andrews' vi clone Stevie.
  13. It also includes some stuff that I integrated from Larry Shurr.
  14. Tony has said it's OK to post.  It's a branch off 3.69,
  15. which is the latest "official" distribution.  I'm also sending
  16. it to Tony, and he will probably integrate it.
  17.  
  18. The first three files in the shell archive are:
  19.   readme    Tony's intro, updated to 3.69a
  20.   readme.dmt    Changes (enhancements & bugfixes) in 3.69a
  21.   stevie.mm    Nroff -mm source for the documentation
  22.  
  23. I've tested it out on MSDOS (using Turbo C) and UNIX System V (using cc).
  24. I've tried to keep the other versions up to date (TOS, OS/2, MINIX, and
  25. MSDOS using Microsoft C), but I didn't have the means to make or test
  26. them, and probably broke them somewhere.  (Even the Turbo C version is
  27. sorta' broken; the makefile gives command lines too long for MSDOS.
  28. Use the integrated environment or response files instead.)
  29.  
  30. Use and enjoy!
  31. Dave
  32. +---------------------------------------------------------------+
  33. |    Dave Tutelman                        |
  34. |    Physical - AT&T Bell Labs  -  Lincroft, NJ            |
  35. |    Logical -  ...att!pegasus!dmt                |
  36. |    Audible -  (201) 576 2194                    |
  37. +---------------------------------------------------------------+
  38. : This is a shar archive.  Extract with sh, not csh.
  39. : The rest of this file will extract:
  40. : readme readme.dmt stevie.mm source.doc porting.doc ctags.doc dos_msc.mk dos_tc.mk minix.mk os2.mk tos.mk unix.mk stevie.h term.h
  41. echo extracting - readme
  42. sed 's/^X//' > readme << '!EOR!'
  43. XSTEVIE Source Release - 3.69a
  44. X
  45. XThis is a source release of the STEVIE editor, a public domain clone
  46. Xof the UNIX editor 'vi'. The program was originally developed for the
  47. XAtari ST, but has been ported to UNIX, OS/2, DOS, and Minix-ST as well.
  48. XPorts done by others, but not directly supported by this release, include
  49. XMinix-PC, Amiga, and a Data General system of some sort.
  50. X
  51. XThe good news about stevie is that it is extremely portable. It supports
  52. Xsystems with virtually all combinations of integer size, pointer size,
  53. Xand byte order. The only major issue remaining, for some environments,
  54. Xis that the file is kept in memory. For most environments, this isn't a
  55. Xproblem, but for Minix-PC it is particularly annoying.
  56. X
  57. XSome advantages of Stevie over other versions/clones of 'vi' are:
  58. X   -    Built-in help facility.
  59. X   -    Tag stacking (for users of CTAGS).
  60. X   -    Extensive system-specific features (e.g.- the MSDOS version
  61. X       supports function keys, cursor keys, colors, 43-line mode;
  62. X       the stubs are there to add such support to other systems.)
  63. X   -    You have the source code.
  64. X
  65. XThe files included in this release are:
  66. X
  67. XREADME
  68. X    This file.
  69. X
  70. Xstevie.mm
  71. Xstevie.doc
  72. X    Reference manual for STEVIE. Assumes familiarity with vi.
  73. X
  74. Xsource.doc
  75. X    Quick overview of the major data structures used.
  76. X
  77. Xporting.doc
  78. X    Tips for porting STEVIE to other systems.
  79. X
  80. Xos2.mk
  81. Xunix.mk
  82. Xdos_msc.mk
  83. Xdos_tc.mk
  84. Xtos.mk
  85. Xminix.mk
  86. X    Makefiles for OS/2, UNIX, DOS, and the Atari ST (TOS and Minix).
  87. X    (DOS_MSC & DOS_TC are for the two most popular DOS C compilers.)
  88. X
  89. Xos2.c
  90. Xunix.c
  91. Xdos.c
  92. Xtos.c
  93. Xminix.c
  94. Xterm.h
  95. Xenv.h
  96. X    System-dependent code for the same.
  97. X
  98. Xalloc.c ascii.h cmdline.c edit.c enveval.c fileio.c help.c hexchars.c
  99. Xkeymap.h linefunc.c main.c mark.c misccmds.c normal.c ops.c ops.h
  100. Xparam.c param.h ptrfunc.c regexp.c regexp.h regmagic.h regsub.c
  101. Xscreen.c search.c sentence.c stevie.h tagcmd.c term.c undo.c version.c
  102. X
  103. X    C source and header files for STEVIE.
  104. X
  105. Xctags.doc
  106. X    Documentation for the accompanying program 'ctags'.
  107. X
  108. Xctags.c
  109. X    Source code for the program 'ctags'.
  110. X
  111. Xsetenv.c
  112. X    Source code for an improved SETENV for MSDOS.
  113. X
  114. X
  115. XTo compile STEVIE for one of the provided systems:
  116. X
  117. X    1. Edit the file 'env.h' to set the system defines as needed.
  118. X
  119. X    2. Check the makefile for your system, and modify as needed.
  120. X
  121. X    3. Compile.
  122. X
  123. XGood Luck...
  124. X
  125. XDave Tutelman - Rel 3.69a
  126. X2/27/90
  127. X
  128. XTony Andrews - Author
  129. X8/6/89
  130. !EOR!
  131. echo extracting - readme.dmt
  132. sed 's/^X//' > readme.dmt << '!EOR!'
  133. X                       New in STEVIE 3.69a
  134. X        Added by Dave Tutelman  -  Feb 1990
  135. X
  136. X
  137. XEnhancements
  138. X^^^^^^^^^^^^
  139. X
  140. XTAG STACKING:
  141. X    Calls to ':ta' are now "stacked".  That is, the place from which
  142. X    the call was made is remembered and pushed onto a tag stack.
  143. X    A new command ':untag' takes you back to that place (and pops
  144. X    the tag stack).
  145. X
  146. X    Tag stacking is enabled by the 'tg' parameter;  use ":set tg".
  147. X    When it is enabled, the Ctrl-^ key doesn't automatically edit
  148. X    the alternate file; if the tag stack isn't empty, Ctrl-^ causes
  149. X    a ':untag'.
  150. X
  151. XIMPROVED HELP:
  152. X    Rather than just stepping through the help screens sequentially,
  153. X    you can now move "up" and "down" through the pages, using
  154. X    keystrokes with the obvious analogies to 'vi' navigation.
  155. X    You can also go directly to any screen by entering the number
  156. X    of that screen.  (The 0th screen is a table of contents to 
  157. X    the help screens.)
  158. X
  159. X    Also, a system-dependent help screen for DOS and OS/2 special
  160. X    keys (cursor and function keys) has been added.
  161. X
  162. X    Finally, the help screens are state-dependent, in the sense
  163. X    that they vary according to the settings of the parameters.
  164. X    (E.g.- if 'tildeop' is enabled, the help screens show tilde
  165. X    as an operator; if not, they show tilde as a character
  166. X    replacement.)  Also, your last help screen is remembered, and
  167. X    that is where you will return if you re-enter help.
  168. X
  169. XNEW SEARCHES:
  170. X    Stevie 3.69 is missing some of the standard searches:
  171. X       }    next paragraph
  172. X       {    previous paragraph
  173. X       )    next sentence
  174. X       (    previous sentence
  175. X    These now work.
  176. X
  177. XMORE UNIX-LIKE HANDLING OF FILES:
  178. X    Environment variables are evaluated when dealing with filenames.
  179. X    (Thus you can now say things like   :e $HOME\autoexec.bat).
  180. X
  181. X    The file mode is preserved.  (Editing with the old STEVIE
  182. X    changed the mode of a file to the default mode.)  This could
  183. X    be viewed as a bugfix rather than an enhancement.
  184. X
  185. XCOLOR AND 43-LINE MODE FOR MSDOS:
  186. X    Thanks to Larry Shurr for a BIOS version for MSDOS.  I bought
  187. X    back his color and 43-line additions into the NANSI.SYS version.
  188. X    I also added stubs for color and lines-on-screen changes for
  189. X    the other environments.  Larry has also supplied source for
  190. X    a SETENV command for MSDOS that can handle embedded '=' signs
  191. X    in the set string.
  192. X
  193. XDOS & OS/2 FUNCTION KEYS:
  194. X    These have been modified to something I find more logical.
  195. X    (The original author may disagree; it's largely a matter
  196. X    of taste.  If you like still another choice, then the
  197. X    changes you need to make are in files dos.c and help.c;
  198. X    i.e., don't forget to update help screen 7.)
  199. X
  200. X
  201. XBugs Fixed
  202. X^^^^^^^^^^
  203. X
  204. X   -    Replacement commands 'r' and 'R' didn't handle newlines right;
  205. X       they inserted them instead of wiping out the current character.
  206. X       That is now fixed.
  207. X
  208. X   -    Esc in a command line was considered part of the command.  Now
  209. X       it [properly] aborts the command line.
  210. X
  211. X   -    In some implementations, the program would hang if asked to
  212. X       delete to a nonexistent mark.  That is now fixed.
  213. X
  214. X   -    If a delete ended at the beginning of a line, it would delete
  215. X       the leading character whether it should or not.  That is now
  216. X       fixed.  The same problem had to be fixed for yank.
  217. X
  218. X   -    The #define for the Ctrl-^ key was incorrectly called K_CGRAVE.
  219. X       (If you're going to use French terminology, PLEASE learn some
  220. X       French. This is an "accent circumflex", not an "accent grave".)
  221. X       This may not seem like a bug, but I wasted over an hour trying 
  222. X    to find where Ctrl-^ had its effect.  Anyway, it's now called
  223. X    K_CCIRCM.
  224. X
  225. X   -    The function search in CTAGS has been improved.  Before, it
  226. X       missed function definitions if there was whitespace between
  227. X       the function name and the open '('; this has been fixed.
  228. X
  229. !EOR!
  230. echo extracting - stevie.mm
  231. sed 's/^X//' > stevie.mm << '!EOR!'
  232. X.\" $Header: /nw/tony/src/stevie/src/RCS/stevie.mm,v 3.69 89/08/13 11:44:04 tony Exp $
  233. X.\"
  234. X.\" Documentation for STEVIE. Process with nroff using the mm macros.
  235. X.\"
  236. X.nr Hu 1
  237. X.SA 1
  238. X.TL
  239. XSTEVIE - An Aspiring VI Clone
  240. X.sp
  241. XUser Reference - 3.69a
  242. X.AU "Tony Andrews"
  243. X.AF ""
  244. X.MT 4
  245. X.PH "'STEVIE''User Reference'"
  246. X.PF "''- \\\\nP -''"
  247. X.H 1 "Overview"
  248. XSTEVIE is an editor designed to mimic the interface of the UNIX
  249. Xeditor 'vi'. The name (ST Editor for VI Enthusiasts) comes from the fact that
  250. Xthe editor was first written for the Atari ST. The current version also supports
  251. XUNIX, Minix (ST), MS-DOS, and OS/2, but I've left
  252. Xthe name intact for now.
  253. X.P
  254. XThis program is the result of many late nights of hacking over the last
  255. Xcouple of years.
  256. XThe first version was written by Tim Thompson and posted
  257. Xto USENET. From there, I reworked the data structures completely, added
  258. XLOTS of features, and generally improved the overall performance in the
  259. Xprocess.
  260. X.P
  261. XI've labelled STEVIE an 'aspiring' vi clone as a warning to those who
  262. Xmay expect too much. On the whole, the editor is pretty complete.
  263. XNearly all of the visual mode commands are supported.
  264. XAnd several of the more important 'ex' commands are supported as well.
  265. XI've tried hard to
  266. Xcapture the feel of vi by getting the little things right.
  267. XMaking lines
  268. Xwrap correctly, supporting true operators, and even getting the cursor to
  269. Xland on the right place for tabs are all a pain, but really help make
  270. Xthe editor feel right.
  271. XI've tried to resist the temptation to deviate from the behavior
  272. Xof vi, even where I disagree with the original design.
  273. X.P
  274. XThe biggest problem remaining has to do with the fact that the edit buffer
  275. Xis maintained entirely in memory, limiting the size of files that can
  276. Xbe edited in some environments.
  277. XOther missing features include named buffers and macros.
  278. XPerformance is generally reasonable, although the screen update code
  279. Xcould be more efficient.
  280. XThis is generally only visible on fairly slow systems.
  281. X.P
  282. XSTEVIE may be freely distributed. The source isn't copyrighted or
  283. Xrestricted in any way. If you pass the program along, please include all
  284. Xthe documentation and, if practical, the source as well. I'm not fanatical
  285. Xabout this, but I tried to make STEVIE fairly portable and I'd like to
  286. Xsee as many people have access to the source as possible.
  287. X.P
  288. XThe remainder of this document describes the operation of the editor.
  289. XThis is intended as a reference for users already familiar with the real
  290. Xvi editor.
  291. X.H 1 "Starting the Editor"
  292. XThe following command line forms are supported:
  293. X.VL 20
  294. X.LI "stevie [file ...]"
  295. XEdit the specified file(s)
  296. X.LI "stevie -t tag"
  297. XStart at the location of the given tag
  298. X.LI "stevie + file"
  299. XEdit file starting at end
  300. X.LI "stevie +n file"
  301. XEdit file starting a line number 'n'
  302. X.LI "stevie +/pat file"
  303. XEdit file starting at pattern 'pat'
  304. X.LE
  305. X.P
  306. XIf multiple files are given on the command line (using the first form),
  307. Xthe ":n" command goes to the next file, ":N" goes backward in the list,
  308. Xand ":rew" can be used to rewind back to the start of the file list.
  309. X.H 1 "Set Command Options"
  310. XThe ":set" command works as usual to set parameters. Each parameter has
  311. Xa long and an abbreviated name, either of which may be used. Boolean
  312. Xparameters are set as in:
  313. X.sp
  314. X.ti +5
  315. Xset showmatch
  316. X.sp
  317. Xor cleared by:
  318. X.sp
  319. X.ti +5
  320. Xset noshowmatch
  321. X.sp
  322. XNumeric parameters are set as in:
  323. X.sp
  324. X.ti +5
  325. Xset scroll=5
  326. X.sp
  327. XSeveral parameters may be set with a single command:
  328. X.sp
  329. X.ti +5
  330. Xset novb sm report=1
  331. X.P
  332. XTo see the status of all parameters use ":set all". Typing ":set" with
  333. Xno arguments will show only those parameters that have been changed.
  334. XThe supported parameters, their names, abbreviations, defaults,
  335. Xand descriptions are shown below:
  336. X.VL 12
  337. X.LI autoindent
  338. XShort: ai, Default: noai, Type: Boolean
  339. X.br
  340. XWhen in insert mode, start new lines at the same column as the prior
  341. Xline. Unlike vi, you can backspace over the indentation.
  342. X.LI backup
  343. XShort: bk, Default: nobk, Type: Boolean
  344. X.br
  345. XLeave a backup on file writes.
  346. X(During file writes, a backup is always kept for
  347. Xsafety anyway, until the write is completed.
  348. XAt that point, the 'backup' parameter
  349. Xdetermines whether the backup file is deleted.)
  350. X.LI color
  351. XShort: co, Default: system-dependent, Type: Numeric
  352. X.br
  353. XChange the screen color (video attributes).
  354. XThere is a system-dependent mapping between numbers and colors.
  355. X(For instance, in MSDOS we use the BIOS-type attributes for
  356. XCGA or monochrome screens in alphanumeric mode.)
  357. X.LI errorbells
  358. XShort: eb, Default: noeb, Type: Boolean
  359. X.br
  360. XRing bell when error messages are shown.
  361. X.LI ignorecase
  362. XShort: ic, Default: noic, Type: Boolean
  363. X.br
  364. XIgnore case in string searches.
  365. X.LI lines
  366. XShort: lines, Default: lines=25, Type: Numeric
  367. X.br
  368. XNumber of physical lines on the screen. The default value
  369. Xand possible settings depend on the host machine.
  370. XThe default value is 25 on most systems.
  371. X.LI list
  372. XShort: list, Default: nolist, Type: Boolean
  373. X.br
  374. XShow tabs and newlines graphically.
  375. X.LI modelines
  376. XShort: ml, Default: noml, Type: Boolean
  377. X.br
  378. XEnable processing of modelines in files.
  379. X.LI number
  380. XShort: nu, Default: nonu, Type: Boolean
  381. X.br
  382. XDisplay lines on the screen with their line numbers.
  383. X.LI report
  384. XShort: report, Default: report=5, Type: Numeric
  385. X.br
  386. XMinimum number of lines to report operations on.
  387. X.LI return
  388. XShort: cr, Default: cr, Type: Boolean
  389. X.br
  390. XEnd lines with cr-lf when writing files.
  391. X.LI scroll
  392. XShort: scroll, Default: scroll=12, Type: Numeric
  393. X.br
  394. XNumber of lines to scroll for ^D & ^U.
  395. X.LI showmatch
  396. XShort: sm, Default: nosm, Type: Boolean
  397. X.br
  398. XWhen a ), }, or ] is typed, show the matching (, {, or [ if
  399. Xit's on the current screen by moving the cursor there briefly.
  400. X.LI showmode
  401. XShort: mo, Default: nomo, Type: Boolean
  402. X.br
  403. XShow on status line when in insert mode.
  404. X.LI tabstop
  405. XShort: ts, Default: ts=8, Type: Numeric
  406. X.br
  407. XNumber of spaces in a tab.
  408. X.LI tagstack
  409. XShort: tg, Default: notg, Type: Boolean
  410. X.br
  411. XIf set, the tag command :ta is "stacked";
  412. Xthat is, the place from which it was called is pushed onto a stack.
  413. XA new command ":untag" goes back to that place, and pops the tag stack.
  414. X.LI terse
  415. XShort: terse, Default: noterse, Type: Boolean
  416. X.br
  417. XThis option is currently ignored.
  418. XIt is provided only for compatibility with vi.
  419. X.LI tildeop
  420. XShort: to, Default: noto, Type: Boolean
  421. X.br
  422. XIf set, tilde is an operator. Otherwise, tilde acts as normal.
  423. X.LI wrapscan
  424. XShort: ws, Default: ws, Type: Boolean
  425. X.br
  426. XString searches wrap around the ends of the file.
  427. X.LI vbell
  428. XShort: vb, Default: vb, Type: Boolean
  429. X.br
  430. XUse a visual bell, if possible. (novb for audible bell)
  431. X.LE
  432. X.P
  433. XThe EXINIT environment variable can be used to modify the default values
  434. Xon startup as in:
  435. X.sp
  436. X.ti +5
  437. Xsetenv EXINIT="set sm ts=4"
  438. X.P
  439. XIn environments (e.g. OS/2 or TOS) where lines are normally terminated by
  440. XCR-LF, the 'return' parameter allows files to be written with only a LF
  441. Xterminator (if the parameter is cleared).
  442. XThis parameter is ignored on UNIX systems.
  443. X.P
  444. XThe 'lines' parameter tells the editor how many lines there are on the screen.
  445. XThis is useful on systems like the ST (or OS/2 machines with an EGA adapter)
  446. Xwhere various screen resolutions may be
  447. Xused. By using the 'lines' parameter, different screen sizes can be easily
  448. Xhandled.
  449. X.H 1 "Colon Commands"
  450. XSeveral of the normal 'vi' colon commands are supported by STEVIE.
  451. XSome commands may be preceded by a
  452. Xline range specification.
  453. XFor commands that accept a range of lines,
  454. Xthe following address forms are supported:
  455. X.DS 1
  456. Xaddr
  457. Xaddr + number
  458. Xaddr - number
  459. X.DE
  460. Xwhere 'addr' may be one of the following:
  461. X.DS 1
  462. Xa line number
  463. Xa mark (as in 'a or 'b)
  464. X\'.' (the current line)
  465. X\'$' (the last line)
  466. X.DE
  467. X.P
  468. XAn address range of "%" is accepted as an abbreviation of "1,$".
  469. X.H 2 "Mode Lines"
  470. XMode lines are a little-known, but often useful, feature of vi.
  471. XTo use this feature, special strings are placed in the first or
  472. Xlast five lines in a file.
  473. XWhen the file is edited, these strings are detected and processed
  474. Xas though typed as a colon command.
  475. XOne instance where this can be useful is to set the "tabstop"
  476. Xparameter on a per-file basis.
  477. XThe following are examples of mode lines:
  478. X.DS 1
  479. Xvi:set ts=4 noai:
  480. Xex:45:
  481. X.DE
  482. X.P
  483. XMode lines are characterized by the string "vi" or "ex" followed
  484. Xby a command surrounded by colons. Other text may appear on the
  485. Xline, and multiple mode lines may be present. No guarantee is
  486. Xmade regarding the order in which multiple mode lines will be
  487. Xprocessed.
  488. X.P
  489. XThe processing of mode lines is enabled by setting the "ml"
  490. Xparameter. This should be done in the "EXINIT" environment
  491. Xvariable, so that mode line processing is enabled as soon
  492. Xas the editor begins.
  493. XBy default, mode lines are disabled for security reasons.
  494. X.H 2 "The Global Command"
  495. XA limited form of the global command is supported, accepting the
  496. Xfollowing command form:
  497. X.DS 1
  498. Xg/pattern/X
  499. X.DE
  500. Xwhere X may be either 'd' or 'p' to delete or print lines that match
  501. Xthe given pattern.
  502. XIf a line range is given, only those lines are checked for a match
  503. Xwith the pattern.
  504. XIf no range is given, all lines are checked.
  505. X.P
  506. XIf the trailing command character is omitted, 'p' is assumed.
  507. XIn this case, the trailing slash is also optional.
  508. XThe current version of the editor does not support the undo operation
  509. Xfollowing the deletion of lines with the global command.
  510. X.H 2 "The Substitute Command"
  511. XThe substitute command provides a powerful mechanism for making more
  512. Xcomplex substitutions than can be done directly from visual mode.
  513. XThe general form of the command is:
  514. X.DS 1
  515. Xs/pattern/replacement/g
  516. X.DE
  517. XEach line in the given range (or the current line, if no range was
  518. Xgiven) is scanned for the given regular expression.
  519. XWhen found, the string that matched the pattern is replaced with
  520. Xthe given replacement string.
  521. XIf the replacement string is null, each matching pattern string is
  522. Xdeleted.
  523. X.P
  524. XThe trailing 'g' is optional and, if present, indicates that multiple
  525. Xoccurrences of 'pattern' on a line should all be replaced.
  526. X.P
  527. XSome special sequences are recognized in the replacement string. The
  528. Xampersand character is replaced by the entire pattern that was matched.
  529. XFor example, the following command could be used to put all occurrences
  530. Xof 'foo' or 'bar' within double quotes:
  531. X.DS 1
  532. X1,$s/foo|bar/"&"/g
  533. X.DE
  534. X.P
  535. XThe special sequence "\\n" where 'n' is a digit from 1 to 9, is replaced
  536. Xby the string the matched the corresponding parenthesized expression in
  537. Xthe pattern. The following command could be used to swap the first two
  538. Xparameters in calls to the C function "foo":
  539. X.DS 1
  540. X1,$s/foo\\\\(([^,]*),([^,]*),/foo(\\\\2,\\\\1,/g
  541. X.DE
  542. X.P
  543. XLike the global command, substitutions can't be undone with this
  544. Xversion of the editor.
  545. X.H 2 "File Manipulation Commands"
  546. XThe following table shows the supported file manipulation commands as
  547. Xwell as some other 'ex' commands that aren't described elsewhere:
  548. X.DS CB
  549. X:w        write the current file
  550. X:wq        write and quit
  551. X:x        write (if necessary) and quit
  552. XZZ        same as ":x"
  553. X
  554. X:e file        edit the named file
  555. X:e!        re-edit the current file, discarding changes
  556. X:e #        edit the alternate file
  557. X
  558. X:w file        write the buffer to the named file
  559. X:x,yw file    write lines x through y to the named file
  560. X:r file        read the named file into the buffer
  561. X
  562. X:n        edit the next file
  563. X:N        edit the previous file
  564. X:rew        rewind the file list
  565. X
  566. X:f        show the current file name
  567. X:f name        change the current file name
  568. X:x=        show the line number of address 'x'
  569. X
  570. X:ta tag        go to the named tag
  571. X^]        like ":ta" using the current word as the tag
  572. X:untag        go back to place from which ":ta" was called
  573. X
  574. X:help        display a command summary
  575. X:ve        show the version number
  576. X
  577. X:sh        run an interactive shell
  578. X:!cmd        run a command
  579. X.DE
  580. X.P
  581. XThe commands above work pretty much like they do in 'vi'. Most of the
  582. Xcommands support a '!' suffix (if appropriate) to discard any pending
  583. Xchanges.
  584. X.H 1 Help Facility
  585. XThe ":help" command can also be invoked with the <HELP> key on the Atari
  586. XST and the F1 key on MSDOS and OS/2 PCs.
  587. XThis actually displays a pretty complete summary of the real vi with
  588. Xunsupported features indicated appropriately.
  589. XCertain features controlled by "set" parameters will have varied displays
  590. Xon the Help screens, to correspond to the current
  591. Xsetting of their parameters.
  592. X.P
  593. XThe help screens (there are multiple screens) can be traversed
  594. Xusing "reasonable" keystrokes.  For instance, any key that would take you
  595. X"down" in the vi editor, will take you to the next help screen in
  596. Xthe help facility.  Similarly, "up" commands will take you to
  597. Xthe previous screen. 
  598. XThe screens are numbered, and any numeric key will take you to
  599. Xthe corresponding screen.
  600. XThe first screen (screen 0) is a table of contents for the
  601. Xhelp screens.
  602. X.H 1 "String Searches"
  603. XString searches are supported, as in vi, accepting the usual regular
  604. Xexpression syntax. This was done using a modified form of
  605. XHenry Spencer's regular expression
  606. Xlibrary. I added code outside the library to support
  607. Xthe '\\<' and '\\>' extensions.
  608. XThe parameter "ignorecase" can be set to ignore case in all string searches.
  609. X.H 1 "Operators"
  610. XThe vi operators (d, c, y, !, <, and >) work as true operators.
  611. XThe tilde command may also be used as an operator if the parameter "tildeop"
  612. Xhas been set. By default, this parameter is not set.
  613. X.H 1 "Tags"
  614. XTags are implemented and a fairly simple version of 'ctags' is supplied
  615. Xwith the editor. The current version of ctags will find functions and
  616. Xmacros following a specific (but common) form.  See 'ctags.doc' for a
  617. Xcomplete discussion.
  618. X.P
  619. XA non-standard but useful variant of tags is the "stacking" of calls to
  620. Xthe ':ta' command.
  621. XWhen tag-stacking is enabled (with ':set tg'), stevie remembers
  622. X(and stacks) the position from which any tag call is made.
  623. XIn this mode, a new ':untag' command returns to the remembered position
  624. Xand pops the stack.
  625. XAlso while in the tagstack mode, the Ctrl-^ keystroke has a somewhat
  626. Xdifferent effect.  Before it switches to edit the alternate file
  627. X(its normal function), it checks to see if the tag stack is empty,
  628. Xand does an ':untag' if not empty.
  629. X.H 1 "System-Specific Comments"
  630. XThe following sections provide additional relevant information for the
  631. Xsystems to which STEVIE has been ported.
  632. X(WARNING: If you compile Stevie for, or port Stevie to,
  633. Xyour favorite environment, don't forget to edit ENV.H
  634. Xto correspond to the target environment.)
  635. X.H 2 "Atari ST"
  636. X.H 3 "TOS"
  637. XThe editor has been tested in all three resolutions, although low and
  638. Xhigh res. are less tested than medium. The 50-line high res. mode can
  639. Xbe used by setting the 'lines' parameter to 50. Alternatively, the
  640. Xenvironment variable 'LINES' can be set. The editor doesn't actively
  641. Xset the number of lines on the screen. It just operates using the number
  642. Xof lines it was told.
  643. X.P
  644. XThe arrow keys, as well as the <INSERT>, <HELP>, and <UNDO> keys are
  645. Xall mapped appropriately.
  646. X.H 3 "Minix"
  647. XThe editor is pretty much the same under Minix, but many of the
  648. Xkeyboard mappings aren't yet supported.
  649. X.H 2 "UNIX"
  650. XThe editor has been ported to UNIX System V release 3 as well as 4.2 BSD.
  651. XThis was done
  652. Xmainly to get some profiling data so I haven't put much effort into
  653. Xdoing the UNIX version right.
  654. XWhile the termcap routines are supported, the editor is still fairly
  655. Xpicky about the capabilities it wants and makes little effort to
  656. Xdo clever things with less intelligent terminals.
  657. X.H 2 "OS/2"
  658. XThis port was done because the editor that comes with the OS/2 developer's
  659. Xkit really stinks. Make sure 'ansi' mode is on (using the 'ansi' command).
  660. XThe OS/2 console driver doesn't support insert/delete line, so STEVIE
  661. Xbypasses the driver and makes the appropriate system calls directly.
  662. XThis is all done in the system-specific part of the editor so the kludge
  663. Xis at least localized.
  664. X.P
  665. XThe arrow keys, page up/down and home/end all do what
  666. Xyou'd expect. The function keys are hard-coded to some useful macros until
  667. XI can get true support for macros into the editor. The current mappings
  668. Xare:
  669. X.DS 1
  670. XF1    Help
  671. XF2    Next file (:n)             \h'|3.3i'Shift-F2  discard changes (:n!)
  672. XF3    Previous file (:N)         \h'|3.3i'Shift-F3  discard changes (:N!)
  673. XF4    Alternate file (:e #)      \h'|3.3i'Shift-F4  discard changes (:e! #)
  674. XF5    Rewind file list (:rew)    \h'|3.3i'Shift-F5  discard changes (:rew!)
  675. XF6    Next function (]])         \h'|3.3i'Shift-F6  Prev. function ([[)
  676. XF8    Global subst. (:1,$s/)
  677. XF9    Convert cdecl to English   \h'|3.3i'Shift-F9  Convert English to cdecl
  678. XF10   Save & quit (:x)           \h'|3.3i'Shift-F10 discard changes (:q!)
  679. X.DE
  680. X.P
  681. XFunction keys F9 and Shift-F9 assume the presence of the cdecl program.
  682. X.H 2 "MSDOS"
  683. XSTEVIE has been ported to MSDOS 3.3 using
  684. X(1) the Microsoft C compiler, version 5.1, and
  685. X(2) the Borland Turbo C compiler, version 2.0.
  686. X.P
  687. XThe keyboard mappings are the same as for OS/2.
  688. XThe only problem with the PC version is that the inefficiency of
  689. Xthe screen update code becomes painfully apparent on slower machines.
  690. X(In Rev 3.69a, there are a couple of ways in which screen I/O
  691. Xis significantly speeded up.)
  692. X.P
  693. XThere are two DOS versions:
  694. Xone that uses an extended console driver,
  695. Xand another that uses the BIOS directly.
  696. XThe extended-console-driver version works well with "nansi.sys",
  697. Xwhich is widely available shareware.
  698. XIt does not work well with the "ANSI.SYS" driver included as part of
  699. XMSDOS (at least through the 3.30 version).
  700. XIn order to be independent of the console driver,
  701. Xyou may compile with BIOS #defined;
  702. Xthis uses the BIOS as the exclusive screen I/O mechanism.
  703. X(Note that it is somewhat slower than nansi.sys.)
  704. X.P
  705. XThe color settings are the video attributes for the alphanumeric modes
  706. Xof the CGA and monochrome displays.
  707. XWhile these make most sense in binary or hex, they must be entered
  708. Xin decimal.  The reference table below gives a few common values:
  709. X.DS 1
  710. X07    White on black          Initial default
  711. X23    White on blue
  712. X30    Bright yellow on blue   My favorite
  713. X.DE
  714. X.H 1 "Missing Features"
  715. X.AL
  716. X.LI
  717. XThe ability to edit files larger than the available memory.
  718. XThis isn't a problem on the machines I use, but it hits the
  719. XMinix-PC people pretty hard.
  720. X.LI
  721. XMacros with support for function keys.
  722. X.LI
  723. XMore "set" options.
  724. X.LI
  725. XMany others...
  726. X.LE
  727. X.H 1 "Known Bugs and Problems"
  728. X.AL
  729. X.LI
  730. XThe yank buffer uses statically allocated memory, so large yanks
  731. Xwill fail. If a delete spans an area larger than the yank buffer,
  732. Xthe program asks
  733. Xfor confirmation before proceeding. That way, if you were moving text,
  734. Xyou don't get screwed by the limited yank buffer. You just have to move
  735. Xsmaller chunks at a time. All the internal buffers (yank, redo, etc.)
  736. Xneed to be reworked to allocate memory dynamically. The 'undo' buffer
  737. Xis now dynamically allocated, so any change can be undone.
  738. X.LI
  739. XIf you stay in insert mode for a long time, the insert buffer can overflow.
  740. XThe editor will print a message and dump you back into command mode.
  741. X.LI
  742. XThe current version of the substitute and global commands
  743. X(i.e. ":s/foo/bar" or ":g/foo/d") can't
  744. Xbe undone.
  745. XThis is due to the current design of the undo code.
  746. XTo undo these
  747. Xcommands would generally involve unreasonable amounts of memory.
  748. X.LI
  749. XSeveral other less bothersome glitches...
  750. X.LE
  751. X.SK
  752. X.H 1 "Conclusion"
  753. XThe editor has reached a pretty stable state, and performs well on
  754. Xthe systems I use it on, so I'm pretty much in maintenance mode now.
  755. XThere's still plenty to be done; the screen update code is still pretty
  756. Xinefficient and the yank/put code is still primitive.
  757. XI'm still interested in bug reports, and I do still add a new feature
  758. Xfrom time to time, but the rate of change is way down now.
  759. X.P
  760. XI'd like to thank Tim Thompson for writing the original version of the
  761. Xeditor. His program was well structured and quite readable. Thanks for
  762. Xgiving me a good base to work with.
  763. XThanks also to many users of STEVIE who have sent in their changes.
  764. XMany of the changes I've received aren't portable to all the systems
  765. XI support, but I'm working to get portable implementations integrated
  766. Xinto the editor where possible.
  767. X.P
  768. XIf you're reading this file, but didn't get the source code for STEVIE,
  769. Xit can be had by sending a disk with return postage to the address given
  770. Xbelow. I can write disks for the Atari ST (SS or DS) or MSDOS (360K or
  771. X1.2M). Please be sure to include the return postage. I don't intend to
  772. Xmake money from this program, but I don't want to lose any either.
  773. X.DS 1
  774. XTony Andrews        UUCP: onecom!wldrdg!tony
  775. X5902E Gunbarrel Ave.
  776. XBoulder, CO 80301
  777. X.DE
  778. X.DS 1
  779. X3.69a Additions from
  780. XDave Tutelman           UUCP: pegasus.att.com!dmt
  781. XLarry Shurr (The BIOS implementation)
  782. X.DE
  783. X.SK
  784. X.HU "Character Function Summary"
  785. XThe following list describes the meaning of each character that's used
  786. Xby the editor. In some cases characters have meaning in both command and
  787. Xinsert mode; these are all described.
  788. X.SP 2
  789. X.VL 8
  790. X.LI ^@
  791. XThe null character. Not used in any mode. This character may not
  792. Xbe present in the file, as is the case with vi.
  793. X.LI ^B
  794. XBackward one screen.
  795. X.LI ^D
  796. XScroll the window down one half screen.
  797. X.LI ^E
  798. XScroll the screen up one line.
  799. X.LI ^F
  800. XForward one screen.
  801. X.LI ^G
  802. XSame as ":f" command. Displays file information.
  803. X.LI ^H
  804. X(Backspace) Moves cursor left one space in command mode.
  805. XIn insert mode, erases the last character typed.
  806. X.LI ^J
  807. XMove the cursor down one line.
  808. X.LI ^L
  809. XClear and redraw the screen.
  810. X.LI ^M
  811. X(Carriage return) Move to the first non-white character
  812. Xin the next line. In insert mode, a carriage return opens a new
  813. Xline for input.
  814. X.LI ^N
  815. XMove the cursor down a line.
  816. X.LI ^P
  817. XMove the cursor up a line.
  818. X.LI ^U
  819. XScroll the window up one half screen.
  820. X.LI ^Y
  821. XScroll the screen down one line.
  822. X.LI ^[
  823. XEscape cancels a pending command in command mode, and is used to
  824. Xterminate insert mode.
  825. X.LI ^]
  826. XMoves to the tag whose name is given by the word in which the cursor
  827. Xresides.
  828. X.LI ^`
  829. XSame as ":e #" if supported (system-dependent).
  830. X.LI SPACE
  831. XMove the cursor right on column.
  832. X.LI !
  833. XThe filter operator always operates on a range of lines, passing the
  834. Xlines as input to a program, and replacing them with the output of the
  835. Xprogram. The shorthand command "!!" can be used to filter a number of
  836. Xlines (specified by a preceding count). The command "!" is replaced
  837. Xby the last command used, so "!!!<RETURN>" runs the given number of
  838. Xlines through the last specified command.
  839. X.LI $
  840. XMove to the end of the current line.
  841. X.LI %
  842. XIf the cursor rests on a paren '()', brace '{}', or bracket '[]',
  843. Xmove to the matching one.
  844. X.LI \'
  845. XUsed to move the cursor to a previously marked position, as
  846. Xin 'a or 'b. The cursor moves to the start of the marked line. The
  847. Xspecial mark '' refers to the "previous context".
  848. X.LI +
  849. XSame as carriage return, in command mode.
  850. X.LI ,
  851. XReverse of the last t, T, f, or F command.
  852. X.LI -
  853. XMove to the first non-white character in the previous line.
  854. X.LI .
  855. XRepeat the last edit command.
  856. X.LI /
  857. XStart of a forward string search command. String searches may be
  858. Xoptionally terminated with a closing slash. To search for a slash
  859. Xuse '\\/' in the search string.
  860. X.LI 0
  861. XMove to the start of the current line. Also used within counts.
  862. X.LI 1-9
  863. XUsed to add 'count' prefixes to commands.
  864. X.LI :
  865. XPrefix character for "ex" commands.
  866. X.LI ;
  867. XRepeat last t, T, f, or F command.
  868. X.LI <
  869. XThe 'left shift' operator.
  870. X.LI >
  871. XThe 'right shift' operator.
  872. X.LI ?
  873. XSame as '/', but search backward.
  874. X.LI A
  875. XAppend at the end of the current line.
  876. X.LI B
  877. XBackward one blank-delimited word.
  878. X.LI C
  879. XChange the rest of the current line.
  880. X.LI D
  881. XDelete the rest of the current line.
  882. X.LI E
  883. XEnd of the end of a blank-delimited word.
  884. X.LI F
  885. XFind a character backward on the current line.
  886. X.LI G
  887. XGo to the given line number (end of file, by default).
  888. X.LI H
  889. XMove to the first non-white char. on the top screen line.
  890. X.LI I
  891. XInsert before the first non-white char. on the current line.
  892. X.LI J
  893. XJoin two lines.
  894. X.LI L
  895. XMove to the first non-white char. on the bottom screen line.
  896. X.LI M
  897. XMove to the first non-white char. on the middle screen line.
  898. X.LI N
  899. XReverse the last string search.
  900. X.LI O
  901. XOpen a new line above the current line, and start inserting.
  902. X.LI P
  903. XPut the yank/delete buffer before the current cursor position.
  904. X.LI R
  905. XReplace characters until an "escape" character is received.
  906. XSimilar to insert mode, but replaces instead of inserting.
  907. XTyping a newline in replace mode is the same as in insert mode,
  908. Xbut replacing continues on the new line.
  909. X.LI T
  910. XReverse search 'upto' the given character.
  911. X.LI U
  912. XRestore the current line to its state before you started changing it.
  913. X.LI W
  914. XMove forward one blank-delimited word.
  915. X.LI X
  916. XDelete one character before the cursor.
  917. X.LI Y
  918. XYank the current line. Same as 'yy'.
  919. X.LI ZZ
  920. XExit from the editor, saving changes if necessary.
  921. X.LI [[
  922. XMove backward one C function.
  923. X.LI ]]
  924. XMove forward one C function.
  925. X.LI ^
  926. XMove to the first non-white on the current line.
  927. X.LI `
  928. XMove to the given mark, as with '. The distinction between the two
  929. Xcommands is important when used with operators. I support the
  930. Xdifference correctly. If you don't know what I'm talking about,
  931. Xdon't worry, it won't matter to you.
  932. X.LI a
  933. XAppend text after the cursor.
  934. X.LI b
  935. XBack one word.
  936. X.LI c
  937. XThe change operator.
  938. X.LI d
  939. XThe delete operator.
  940. X.LI e
  941. XMove to the end of a word.
  942. X.LI f
  943. XFind a character on the current line.
  944. X.LI h
  945. XMove left one column.
  946. X.LI i
  947. XInsert text before the cursor.
  948. X.LI j
  949. XMove down one line.
  950. X.LI k
  951. XMove up one line.
  952. X.LI l
  953. XMove right one column.
  954. X.LI m
  955. XSet a mark at the current position (e.g. ma or mb).
  956. X.LI n
  957. XRepeat the last string search.
  958. X.LI o
  959. XOpen a new line and start inserting text.
  960. X.LI p
  961. XPut the yank/delete buffer after the cursor.
  962. X.LI r
  963. XReplace a character.
  964. X.LI s
  965. XReplace characters.
  966. X.LI t
  967. XMove forward 'upto' the given character on the current line.
  968. X.LI u
  969. XUndo the last edit.
  970. X.LI w
  971. XMove forward one word.
  972. X.LI x
  973. XDelete the character under the cursor.
  974. X.LI y
  975. XThe yank operator.
  976. X.LI z
  977. XRedraw the screen with the current line at the top (zRETURN),
  978. Xthe middle (z.), or the bottom (z-).
  979. X.LI |
  980. XMove to the column given by the preceding count.
  981. X.LI ~
  982. XInvert the case of the current character (if alpha) and move to the right.
  983. XIf the parameter "tildeop" is set, this command functions as an operator.
  984. X.LE
  985. X.de TX
  986. X.ce
  987. XSTEVIE - User Guide
  988. X.sp
  989. X..
  990. X.TC
  991. !EOR!
  992. echo extracting - source.doc
  993. sed 's/^X//' > source.doc << '!EOR!'
  994. X
  995. X         Release Notes for STEVIE - Version 3.68
  996. X
  997. X                  Source Notes
  998. X
  999. X                  Tony Andrews
  1000. X
  1001. X                   8/6/89
  1002. X
  1003. X
  1004. XOverview
  1005. X--------
  1006. X
  1007. X    This file provides a brief description of the source code for
  1008. XStevie. The data structures are described later as well. For information
  1009. Xspecific to porting the editor, see the file 'porting.doc'. This document
  1010. Xis more relevant to people who want to hack on the editor apart from doing
  1011. Xa simple port.
  1012. X
  1013. X    Most of this document was written some time ago so a lot of the
  1014. Xdiscussion centers on problems related to the Atari ST environment and
  1015. Xcompilers. Most of this can be ignored for other systems.
  1016. X
  1017. X
  1018. XCruft
  1019. X-----
  1020. X
  1021. X    Older versions of the editor used Henry Spencer's regular
  1022. Xexpression library directly. The current version incorporates a modified
  1023. Xversion of that same library.
  1024. X
  1025. X
  1026. XData Structures
  1027. X---------------
  1028. X
  1029. X    A brief discussion of the evolution of the data structures will
  1030. Xdo much to clarify the code, and explain some of the strangeness you may
  1031. Xsee.
  1032. X
  1033. X    In the original version, the file was maintained in memory as a
  1034. Xsimple contiguous buffer. References to positions in the file were simply
  1035. Xcharacter pointers. Due to the obvious performance problems inherent in
  1036. Xthis approach, I made the following changes.
  1037. X
  1038. X    The file is now represented by a doubly linked list of 'line'
  1039. Xstructures defined as follows:
  1040. X
  1041. Xstruct    line {
  1042. X    struct    line    *prev, *next;    /* previous and next lines */
  1043. X    char    *s;            /* text for this line */
  1044. X    int    size;            /* actual size of space at 's' */
  1045. X    unsigned long    num;        /* line "number" */
  1046. X};
  1047. X
  1048. XThe members of the line structure are:
  1049. X
  1050. Xprev    - pointer to the structure for the prior line, or NULL for the
  1051. X      first line of the file
  1052. X
  1053. Xnext    - like 'prev' but points to the next line
  1054. X
  1055. Xs    - points to the contents of the line (null terminated)
  1056. X
  1057. Xsize    - contains the size of the chunk of space pointed to by s. This
  1058. X      is used so we know when we can add text to a line without getting
  1059. X      more space. When we DO need more space, we always get a little
  1060. X      extra so we don't make so many calls to malloc.
  1061. X
  1062. Xnum    - This is a pseudo line number that makes it easy to compare
  1063. X      positions within the file. Otherwise, we'd have to traverse
  1064. X      all the links to tell which line came first.
  1065. X
  1066. X
  1067. X    Since character pointers served to mark file positions in the
  1068. Xoriginal, a similar data object was needed for the new data structures.
  1069. XThis purpose is served by the 'lptr' structure which is defined as:
  1070. X
  1071. Xstruct    lptr {
  1072. X    struct    line    *linep;        /* line we're referencing */
  1073. X    int    index;            /* position within that line */
  1074. X};
  1075. X
  1076. XThe member 'linep' points to the 'line' structure for the line containing
  1077. Xthe location of interest. The integer 'index' is the offset into the line
  1078. Xdata (member 's') of the character to be referenced.
  1079. X
  1080. XThe following typedef's are more commonly used:
  1081. X
  1082. Xtypedef    struct line    LINE;
  1083. Xtypedef    struct lptr    LPTR;
  1084. X
  1085. XMany operations that were trivial with character pointers had to be
  1086. Ximplemented by functions to manipulate LPTR's. Most of these are in the
  1087. Xfile 'ptrfunc.c'. There you'll find functions to increment, decrement,
  1088. Xand compare LPTR's.
  1089. !EOR!
  1090. echo extracting - porting.doc
  1091. sed 's/^X//' > porting.doc << '!EOR!'
  1092. X
  1093. X         Release Notes for STEVIE - Version 3.68
  1094. X
  1095. X           Atari ST Editor for VI Enthusiasts
  1096. X
  1097. X                    Porting
  1098. X
  1099. X
  1100. X                  Tony Andrews
  1101. X
  1102. X                  8/6/88
  1103. X
  1104. X
  1105. X    Porting the editor is a relatively simple task. Most of the
  1106. Xcode is pretty machine-independent. For each environment, there is
  1107. Xa file of routines that perform various low-level operations that
  1108. Xtend to vary a lot from one machine to another. Another file contains
  1109. Xthe escape sequences to be used for each machine.
  1110. X
  1111. X    The machine-dependent files currently used are:
  1112. X
  1113. Xtos.c:      Atari ST running TOS
  1114. Xunix.c:      UNIX System V or BSD
  1115. Xos2.c:      Microsoft OS/2
  1116. Xdos.c:      MS DOS 3.3
  1117. Xminix.c:  Minix on the Atari ST
  1118. X
  1119. X
  1120. X    Each of these files are around 250 lines long and deal with
  1121. Xlow-level issues like character I/O to the terminal, terminal
  1122. Xinitialization, signal handling (if supported), cursor addressing, and
  1123. Xso on. There are different tradeoffs to be made depending on the
  1124. Xenvironment. For example, the UNIX and Minix versions buffer terminal
  1125. Xoutput because of the relatively high overhead of system calls. A quick
  1126. Xlook at the files will make it clear what needs to be done in a new
  1127. Xenvironment.
  1128. X
  1129. X    The file "env.h" contains macro definitions to customize the
  1130. Xeditor for your particular environment. The macros there select the
  1131. Xmachine/os, enable various optional features, etc.
  1132. X
  1133. X    One of the options in env.h is whether to use the termcap
  1134. Xroutines or hard-wired escape sequences. The hard-wired sequences,
  1135. Xif used, are defined in term.h. The file term.c contains code to access
  1136. Xthe termcap database, if enabled. Termcap is only supported by some of
  1137. Xthe system-dependent files (unix.c and minix.c) but can be added easily
  1138. Xto others, if needed.
  1139. X
  1140. X
  1141. X    The basic process for doing a new port is:
  1142. X
  1143. X    1. Come up with a macro name to use when ifdef'ing your system-
  1144. X       specific changes. Add a line to 'env.h' to define the macro
  1145. X       name you've chosen.
  1146. X
  1147. X    2. Look at the system-dependent files and copy the one that comes
  1148. X       closest to working on your system. Then modify your new file
  1149. X       as needed.
  1150. X
  1151. X    3. Look at term.h and edit the file appropriately adding a new
  1152. X       set of escape sequence definitions for your system.
  1153. X
  1154. X    4. Compile and debug the editor.
  1155. X
  1156. X
  1157. X    In most cases it should really be that simple. Other ports have
  1158. Xbeen done for which I don't have the code, including the Amiga, and a
  1159. XData General machine of some kind (in Australia).
  1160. !EOR!
  1161. echo extracting - ctags.doc
  1162. sed 's/^X//' > ctags.doc << '!EOR!'
  1163. X
  1164. Xctags - first cut at a UNIX ctags re-implementation
  1165. X
  1166. X
  1167. XThis is a public domain rewrite of the standard UNIX ctags command.
  1168. XIt is a simplified version written primarily for use with the 'stevie'
  1169. Xeditor. The command line syntax is:
  1170. X
  1171. X    ctags [file ...]
  1172. X
  1173. XCtags scans the all files given on the command line. If no files are
  1174. Xgiven, the standard input is scanned for a list of file names.
  1175. X
  1176. XFunction declarations and macros are supported. However, only simple
  1177. Xforms of each are recognized. Functions must be of the following form:
  1178. X
  1179. Xtype
  1180. Xfname(...)
  1181. X
  1182. Xwhere "fname" is the name of the function and must come at the beginning
  1183. Xof a line. This is the form I always use, so the limitation doesn't
  1184. Xbother me.
  1185. X
  1186. XMacros (with or without parameters) of the following form are also detected:
  1187. X
  1188. X"#" [white space] "define" [white space] NAME
  1189. X
  1190. XThe white space between the "#" and "define" is optional.
  1191. X
  1192. X
  1193. XOther Limitations and Changes
  1194. X
  1195. XNo sorting or detection of duplicate functions is done.
  1196. X
  1197. XTony Andrews
  1198. XAugust 1987
  1199. !EOR!
  1200. echo extracting - dos_msc.mk
  1201. sed 's/^X//' > dos_msc.mk << '!EOR!'
  1202. X#
  1203. X# Makefile for DOS
  1204. X#
  1205. X# Microsoft make is brain-dead, so please bear with me.
  1206. X#
  1207. X
  1208. X#
  1209. X# Compact model lets us edit large files, but keep small model code
  1210. X#
  1211. XMODEL= /AC
  1212. XCFLAGS = $(MODEL) /DDOS
  1213. X
  1214. XMACH=    dos.obj
  1215. X
  1216. XOBJ=    alloc.obj \
  1217. X    main.obj \
  1218. X    cmdline.obj \
  1219. X    edit.obj \
  1220. X    enveval.obj \
  1221. X    fileio.obj \
  1222. X    help.obj \
  1223. X    hexchars.obj \
  1224. X    linefunc.obj \
  1225. X    mark.obj \
  1226. X    misccmds.obj \
  1227. X    normal.obj \
  1228. X    ops.obj \
  1229. X    param.obj \
  1230. X    ptrfunc.obj \
  1231. X    regexp.obj \
  1232. X    regsub.obj \
  1233. X    screen.obj \
  1234. X    search.obj \
  1235. X    sentence.obj \
  1236. X    tagcmd.obj \
  1237. X    undo.obj \
  1238. X    version.obj \
  1239. X    $(MACH)
  1240. X
  1241. Xall: stevie.exe
  1242. X
  1243. Xalloc.obj : alloc.c
  1244. X    cl -c $(CFLAGS) alloc.c
  1245. X
  1246. Xcmdline.obj : cmdline.c
  1247. X    cl -c $(CFLAGS) cmdline.c
  1248. X
  1249. Xedit.obj : edit.c
  1250. X    cl -c $(CFLAGS) edit.c
  1251. X
  1252. Xenveval.obj : enveval.c
  1253. X    cl -c $(CFLAGS) enveval.c
  1254. X
  1255. Xfileio.obj : fileio.c
  1256. X    cl -c $(CFLAGS) fileio.c
  1257. X
  1258. Xhelp.obj : help.c
  1259. X    cl -c $(CFLAGS) help.c
  1260. X
  1261. Xhexchars.obj : hexchars.c
  1262. X    cl -c $(CFLAGS) hexchars.c
  1263. X
  1264. Xlinefunc.obj : linefunc.c
  1265. X    cl -c $(CFLAGS) linefunc.c
  1266. X
  1267. Xmain.obj:    main.c
  1268. X    cl -c $(CFLAGS) main.c
  1269. X
  1270. Xmark.obj : mark.c
  1271. X    cl -c $(CFLAGS) mark.c
  1272. X
  1273. Xmisccmds.obj : misccmds.c
  1274. X    cl -c $(CFLAGS) misccmds.c
  1275. X
  1276. Xnormal.obj : normal.c
  1277. X    cl -c $(CFLAGS) normal.c
  1278. X
  1279. Xops.obj : ops.c
  1280. X    cl -c $(CFLAGS) ops.c
  1281. X
  1282. Xparam.obj : param.c
  1283. X    cl -c $(CFLAGS) param.c
  1284. X
  1285. Xptrfunc.obj : ptrfunc.c
  1286. X    cl -c $(CFLAGS) ptrfunc.c
  1287. X
  1288. Xregexp.obj : regexp.c
  1289. X    cl -c $(CFLAGS) regexp.c
  1290. X
  1291. Xregsub.obj : regsub.c
  1292. X    cl -c $(CFLAGS) regsub.c
  1293. X
  1294. Xscreen.obj : screen.c
  1295. X    cl -c $(CFLAGS) screen.c
  1296. X
  1297. Xsearch.obj : search.c
  1298. X    cl -c $(CFLAGS) search.c
  1299. X
  1300. Xsentence.obj : sentence.c
  1301. X    cl -c $(CFLAGS) sentence.c
  1302. X
  1303. Xtagcmd.obj : tagcmd.c
  1304. X    cl -c $(CFLAGS) tagcmd.c
  1305. X
  1306. Xundo.obj : undo.c
  1307. X    cl -c $(CFLAGS) undo.c
  1308. X
  1309. Xversion.obj : version.c
  1310. X    cl -c $(CFLAGS) version.c
  1311. X
  1312. Xdos.obj : dos.c
  1313. X    cl -c $(CFLAGS) dos.c
  1314. X
  1315. Xstevie.exe : $(OBJ)
  1316. X    cl $(MODEL) *.obj c:\pmsdk\lib\setargv.obj -o stevie.exe /F 6000 -link /NOE
  1317. !EOR!
  1318. echo extracting - dos_tc.mk
  1319. sed 's/^X//' > dos_tc.mk << '!EOR!'
  1320. X#
  1321. X# Makefile for MSDOS using Turbo C and any GOOD make program.
  1322. X# (Like, forget Microsoft Make; it's a joke.  Use Turbo Make - comes with TC,
  1323. X#  or NDMAKE - shareware, or PolyMake - from Polytron.  There are others...)
  1324. X#
  1325. X
  1326. XMODEL=    -mc
  1327. XDEFS=    -DDOS -DTURBOC -DTAGSTACK
  1328. XCFLAGS=    $(MODEL) $(DEFS)
  1329. XCC=    tcc
  1330. X
  1331. XPROGS=    alloc.c \
  1332. X    cmdline.c \
  1333. X    ctags.c \
  1334. X    dos.c \
  1335. X    edit.c \
  1336. X    enveval.c \
  1337. X    fileio.c \
  1338. X    help.c \
  1339. X    hexchars.c \
  1340. X    linefunc.c \
  1341. X    main.c \
  1342. X    mark.c \
  1343. X    minix.c \
  1344. X    misccmds.c \
  1345. X    normal.c \
  1346. X    ops.c \
  1347. X    os2.c \
  1348. X    param.c \
  1349. X    ptrfunc.c \
  1350. X    regexp.c \
  1351. X    regsub.c \
  1352. X    screen.c \
  1353. X    search.c \
  1354. X    sentence.c \
  1355. X        setenv.c \
  1356. X    tagcmd.c \
  1357. X    term.c \
  1358. X    tos.c \
  1359. X    undo.c \
  1360. X    unix.c \
  1361. X    version.c
  1362. X
  1363. XHDRS=    ascii.h \
  1364. X    env.h \
  1365. X    keymap.h \
  1366. X    ops.h \
  1367. X    param.h \
  1368. X    regexp.h \
  1369. X    regmagic.h \
  1370. X    stevie.h \
  1371. X    term.h
  1372. X
  1373. XMKFS=    dos_msc.mk \
  1374. X    dos_tc.mk \
  1375. X    minix.mk \
  1376. X    os2.mk \
  1377. X    tos.mk \
  1378. X    unix.mk
  1379. X
  1380. XMACH=    dos.obj
  1381. X
  1382. XOBJ=    alloc.obj \
  1383. X    cmdline.obj \
  1384. X    edit.obj \
  1385. X    enveval.obj. \
  1386. X    fileio.obj \
  1387. X    help.obj \
  1388. X    hexchars.obj \
  1389. X    linefunc.obj \
  1390. X    main.obj \
  1391. X    mark.obj \
  1392. X    misccmds.obj \
  1393. X    normal.obj \
  1394. X    ops.obj \
  1395. X    param.obj \
  1396. X    ptrfunc.obj \
  1397. X    screen.obj \
  1398. X    search.obj \
  1399. X    sentence.obj \
  1400. X    tagcmd.obj \
  1401. X    term.obj \
  1402. X    undo.obj \
  1403. X    version.obj
  1404. X
  1405. XOTHER=    regexp.obj regsub.obj \tc\lib\wildargs.obj
  1406. X
  1407. X.c.obj :
  1408. X    $(CC) -c $(CFLAGS) $*
  1409. X
  1410. Xall : stevie.exe stevie.doc
  1411. X
  1412. Xstevie.exe : $(OBJ) $(MACH) $(OTHER)
  1413. X    $(CC) -estevie $(OBJ) $(MACH) $(OTHER)
  1414. X
  1415. Xctags.exe : ctags.c
  1416. X    $(CC) ctags.c
  1417. X
  1418. Xsetenv.exe : setenv.c
  1419. X    $(CC) setenv.c
  1420. X
  1421. Xstevie.doc : stevie.mm
  1422. X    nroff -rB1 -Tlp -mm stevie.mm > stevie.doc
  1423. X
  1424. Xclean :
  1425. X    rm $(OBJ) $(MACH)
  1426. X
  1427. X# Clean out the .OBJs that depend on whether BIOS is defined.
  1428. Xcleanbios :
  1429. X        rm dos.obj screen.obj help.obj
  1430. X
  1431. X# Specific header dependencies.
  1432. X
  1433. X$(OBJ) : stevie.h env.h ascii.h keymap.h param.h term.h
  1434. X$(MACH) : stevie.h env.h ascii.h keymap.h param.h term.h
  1435. Xlinefunc.obj : ops.h
  1436. Xnormal.obj : ops.h
  1437. Xops.obj : ops.h
  1438. Xregexp.obj : regexp.h regmagic.h ops.h
  1439. Xregsub.obj : regexp.h regmagic.h
  1440. Xsearch.obj : regexp.h
  1441. Xsentence.obj : ops.h
  1442. X
  1443. X
  1444. Xzip : stevi369.zip
  1445. Xstevi369.zip : readme readme.dmt stevie.mm stevie.doc stevie.exe \
  1446. X                ctags.exe setenv.exe source.zip
  1447. X    pkzip -u stevi369 $?
  1448. X
  1449. Xsource.zip : $(PROGS) $(HDRS) $(MKFS) porting.doc source.doc stevie.prj
  1450. X    pkzip -u source $?
  1451. X
  1452. !EOR!
  1453. echo extracting - minix.mk
  1454. sed 's/^X//' > minix.mk << '!EOR!'
  1455. X#
  1456. X# Makefile for Atari ST Minix
  1457. X#
  1458. X
  1459. XLDFLAGS=
  1460. XCFLAGS= -O
  1461. X
  1462. XMACH=    minix.o
  1463. X
  1464. XOBJ=    alloc.o \
  1465. X    cmdline.o \
  1466. X    edit.o \
  1467. X    enveval.o \
  1468. X    fileio.o \
  1469. X    help.o \
  1470. X    hexchars.o \
  1471. X    linefunc.o \
  1472. X    main.o \
  1473. X    mark.o \
  1474. X    misccmds.o \
  1475. X    normal.o \
  1476. X    ops.o \
  1477. X    param.o \
  1478. X    ptrfunc.o \
  1479. X    regexp.o \
  1480. X    regsub.o \
  1481. X    screen.o \
  1482. X    search.o \
  1483. X    sentence.o \
  1484. X    tagcmd.o \
  1485. X    term.o \
  1486. X    undo.o \
  1487. X    version.o
  1488. X
  1489. Xall : stevie
  1490. X
  1491. Xstevie : $(OBJ) $(MACH)
  1492. X    $(CC) $(LDFLAGS) $(OBJ) $(MACH) -o stevie
  1493. X    chmem =150000 stevie
  1494. X
  1495. Xclean :
  1496. X    rm $(OBJ) $(MACH)
  1497. !EOR!
  1498. echo extracting - os2.mk
  1499. sed 's/^X//' > os2.mk << '!EOR!'
  1500. X#
  1501. X# Makefile for OS/2
  1502. X#
  1503. X# The make command with OS/2 is really stupid.
  1504. X#
  1505. X
  1506. X#
  1507. X# Compact model lets us edit large files, but keep small model code
  1508. X#
  1509. XMODEL= /AC
  1510. XCFLAGS = $(MODEL)
  1511. X
  1512. XMACH=    os2.obj
  1513. X
  1514. XOBJ=    alloc.obj \
  1515. X    cmdline.obj \
  1516. X    edit.obj \
  1517. X    envevla.obj \
  1518. X    fileio.obj \
  1519. X    help.obj \
  1520. X    hexchars.obj \
  1521. X    linefunc.obj \
  1522. X    main.obj \
  1523. X    mark.obj \
  1524. X    misccmds.obj \
  1525. X    normal.obj \
  1526. X    ops.obj \
  1527. X    param.obj \
  1528. X    ptrfunc.obj \
  1529. X    screen.obj \
  1530. X    search.obj \
  1531. X    sentence.obj \
  1532. X    tagcmd.obj \
  1533. X    undo.obj \
  1534. X    version.obj \
  1535. X    $(MACH)
  1536. X
  1537. Xalloc.obj : alloc.c
  1538. X    cl -c $(CFLAGS) alloc.c
  1539. X
  1540. Xcmdline.obj : cmdline.c
  1541. X    cl -c $(CFLAGS) cmdline.c
  1542. X
  1543. Xedit.obj : edit.c
  1544. X    cl -c $(CFLAGS) edit.c
  1545. X
  1546. Xfileio.obj : fileio.c
  1547. X    cl -c $(CFLAGS) fileio.c
  1548. X
  1549. Xhexchars.obj : hexchars.c
  1550. X    cl -c $(CFLAGS) hexchars.c
  1551. X
  1552. Xlinefunc.obj : linefunc.c
  1553. X    cl -c $(CFLAGS) linefunc.c
  1554. X
  1555. Xmain.obj:    main.c
  1556. X    cl -c $(CFLAGS) main.c
  1557. X
  1558. Xmark.obj : mark.c
  1559. X    cl -c $(CFLAGS) mark.c
  1560. X
  1561. Xmisccmds.obj : misccmds.c
  1562. X    cl -c $(CFLAGS) misccmds.c
  1563. X
  1564. Xnormal.obj : normal.c
  1565. X    cl -c $(CFLAGS) normal.c
  1566. X
  1567. Xhelp.obj : help.c
  1568. X    cl -c $(CFLAGS) help.c
  1569. X
  1570. Xops.obj : ops.c
  1571. X    cl -c $(CFLAGS) ops.c
  1572. X
  1573. Xparam.obj : param.c
  1574. X    cl -c $(CFLAGS) param.c
  1575. X
  1576. Xptrfunc.obj : ptrfunc.c
  1577. X    cl -c $(CFLAGS) ptrfunc.c
  1578. X
  1579. Xregexp.obj : regexp.c
  1580. X    cl -c $(CFLAGS) regexp.c
  1581. X
  1582. Xregsub.obj : regsub.c
  1583. X    cl -c $(CFLAGS) regsub.c
  1584. X
  1585. Xscreen.obj : screen.c
  1586. X    cl -c $(CFLAGS) screen.c
  1587. X
  1588. Xsearch.obj : search.c
  1589. X    cl -c $(CFLAGS) search.c
  1590. X
  1591. Xsentence.obj : sentence.c
  1592. X    cl -c $(CFLAGS) sentence.c
  1593. X
  1594. Xtagcmd.obj : tagcmd.c
  1595. X    cl -c $(CFLAGS) tagcmd.c
  1596. X
  1597. Xundo.obj : undo.c
  1598. X    cl -c $(CFLAGS) undo.c
  1599. X
  1600. Xversion.obj : version.c
  1601. X    cl -c $(CFLAGS) version.c
  1602. X
  1603. Xos2.obj : os2.c
  1604. X    cl -c $(CFLAGS) os2.c
  1605. X
  1606. Xstevie.exe : $(OBJ)
  1607. X    cl $(MODEL) *.obj \pmsdk\lib\setargv.obj -o stevie.exe /F 6000 -link /NOE
  1608. !EOR!
  1609. echo extracting - tos.mk
  1610. sed 's/^X//' > tos.mk << '!EOR!'
  1611. X#
  1612. X# Makefile for the Atari ST - Sozobon C Compiler
  1613. X#
  1614. X
  1615. XCFLAGS = -O
  1616. X
  1617. X.c.o:
  1618. X    $(CC) -c $(CFLAGS) $<
  1619. X    ar rv vi.lib $*.o
  1620. X
  1621. XMACH =    tos.o
  1622. X
  1623. XOBJ =    alloc.o \
  1624. X    cmdline.o \
  1625. X    edit.o \
  1626. X    enveval.o \
  1627. X    fileio.o \
  1628. X    help.o \
  1629. X    hexchars.o \
  1630. X    linefunc.o \
  1631. X    main.o \
  1632. X    mark.o \
  1633. X    misccmds.o \
  1634. X    normal.o \
  1635. X    ops.o \
  1636. X    param.o \
  1637. X    ptrfunc.o \
  1638. X    regexp.o \
  1639. X    regsub.o \
  1640. X    screen.o \
  1641. X    search.o \
  1642. X    sentence.o \
  1643. X    tagcmd.o \
  1644. X    undo.o \
  1645. X    version.o \
  1646. X    $(MACH)
  1647. X
  1648. Xall : stevie.ttp
  1649. X
  1650. Xstevie.ttp : $(OBJ)
  1651. X    $(CC) vi.lib -o stevie.ttp
  1652. X
  1653. Xclean :
  1654. X    $(RM) $(OBJ) vi.lib
  1655. !EOR!
  1656. echo extracting - unix.mk
  1657. sed 's/^X//' > unix.mk << '!EOR!'
  1658. X#
  1659. X# Makefile for UNIX (System V)
  1660. X#
  1661. X
  1662. XLDFLAGS=
  1663. XCFLAGS= -g
  1664. X
  1665. XH=    ascii.h \
  1666. X    env.h \
  1667. X    keymap.h \
  1668. X    ops.h \
  1669. X    param.h \
  1670. X    regexp.h \
  1671. X    regmagic.h \
  1672. X    stevie.h \
  1673. X    term.h
  1674. X
  1675. XMACH=    unix.o
  1676. X
  1677. XOBJ=    alloc.o \
  1678. X    cmdline.o \
  1679. X    edit.o \
  1680. X    enveval.o \
  1681. X    fileio.o \
  1682. X    help.o \
  1683. X    hexchars.o \
  1684. X    linefunc.o \
  1685. X    main.o \
  1686. X    mark.o \
  1687. X    misccmds.o \
  1688. X    normal.o \
  1689. X    ops.o \
  1690. X    param.o \
  1691. X    ptrfunc.o \
  1692. X    regexp.o \
  1693. X    regsub.o \
  1694. X    screen.o \
  1695. X    search.o \
  1696. X    sentence.o \
  1697. X    tagcmd.o \
  1698. X    term.o \
  1699. X    undo.o \
  1700. X    version.o
  1701. X
  1702. XSRC=    $(OBJ:.o=.c) $(MACH:.o=.c)
  1703. X
  1704. Xall : stevie stevie.doc
  1705. X
  1706. Xstevie : $(OBJ) $(MACH)
  1707. X    $(CC) $(LDFLAGS) $(OBJ) $(MACH) -o stevie -lcurses
  1708. X
  1709. Xlint :
  1710. X    lint $(SRC)
  1711. X
  1712. Xtags :
  1713. X    ctags $(SRC) $(H)
  1714. X
  1715. Xstevie.doc : stevie.mm
  1716. X    nroff -rB1 -Tlp -mm stevie.mm > stevie.doc
  1717. X
  1718. Xprint :
  1719. X    @pr $(H) $(SRC)
  1720. X
  1721. Xcflow :
  1722. X    cflow $(SRC) > cflow.for
  1723. X    cflow -r $(SRC) > cflow.rev
  1724. X
  1725. Xclean :
  1726. X    rm $(OBJ) $(MACH)
  1727. !EOR!
  1728. echo extracting - stevie.h
  1729. sed 's/^X//' > stevie.h << '!EOR!'
  1730. X/*
  1731. X * $Header: /nw/tony/src/stevie/src/RCS/stevie.h,v 1.19 89/07/12 21:33:32 tony Exp $
  1732. X *
  1733. X * Main header file included by all source files.
  1734. X */
  1735. X
  1736. X#include "env.h"    /* defines to establish the compile-time environment */
  1737. X
  1738. X#include <stdio.h>
  1739. X#include <ctype.h>
  1740. X
  1741. X#ifdef    BSD
  1742. X
  1743. X#include <strings.h>
  1744. X#define strchr index
  1745. X
  1746. X#else
  1747. X
  1748. X#ifdef    MINIX
  1749. X
  1750. Xextern    char    *strchr();
  1751. Xextern    char    *strrchr();
  1752. Xextern    char    *strcpy();
  1753. Xextern    char    *strcat();
  1754. Xextern    int    strlen();
  1755. X
  1756. X#else
  1757. X#include <string.h>
  1758. X#endif
  1759. X
  1760. X#endif
  1761. X
  1762. X#include "ascii.h"
  1763. X#include "keymap.h"
  1764. X#include "param.h"
  1765. X#include "term.h"
  1766. X
  1767. Xextern    char    *strchr();
  1768. X
  1769. X#define NORMAL 0
  1770. X#define CMDLINE 1
  1771. X#define INSERT 2
  1772. X#define REPLACE 3
  1773. X#define FORWARD 4
  1774. X#define BACKWARD 5
  1775. X
  1776. X/*
  1777. X * Boolean type definition and constants
  1778. X */
  1779. Xtypedef    short    bool_t;
  1780. X
  1781. X#ifndef    TRUE
  1782. X#define    FALSE    (0)
  1783. X#define    TRUE    (1)
  1784. X#endif
  1785. X
  1786. X/*
  1787. X * SLOP is the amount of extra space we get for text on a line during
  1788. X * editing operations that need more space. This keeps us from calling
  1789. X * malloc every time we get a character during insert mode. No extra
  1790. X * space is allocated when the file is initially read.
  1791. X */
  1792. X#define    SLOP    10
  1793. X
  1794. X/*
  1795. X * LINEINC is the gap we leave between the artificial line numbers. This
  1796. X * helps to avoid renumbering all the lines every time a new line is
  1797. X * inserted.
  1798. X */
  1799. X#define    LINEINC    10
  1800. X
  1801. X#define CHANGED        Changed=TRUE
  1802. X#define UNCHANGED    Changed=FALSE
  1803. X
  1804. Xstruct    line {
  1805. X    struct    line    *prev, *next;    /* previous and next lines */
  1806. X    char    *s;            /* text for this line */
  1807. X    int    size;            /* actual size of space at 's' */
  1808. X    unsigned long    num;        /* line "number" */
  1809. X};
  1810. X
  1811. X#define    LINEOF(x)    ((x)->linep->num)
  1812. X
  1813. Xstruct    lptr {
  1814. X    struct    line    *linep;        /* line we're referencing */
  1815. X    int    index;            /* position within that line */
  1816. X};
  1817. X
  1818. Xtypedef    struct line    LINE;
  1819. Xtypedef    struct lptr    LPTR;
  1820. X
  1821. Xstruct charinfo {
  1822. X    char ch_size;
  1823. X    char *ch_str;
  1824. X};
  1825. X
  1826. Xextern struct charinfo chars[];
  1827. X
  1828. Xextern    int    State;
  1829. Xextern    int    Rows;
  1830. Xextern    int    Columns;
  1831. Xextern    char    *Realscreen;
  1832. Xextern    char    *Nextscreen;
  1833. Xextern    char    *Filename;
  1834. Xextern    LPTR    *Filemem;
  1835. Xextern    LPTR    *Filetop;
  1836. Xextern    LPTR    *Fileend;
  1837. Xextern    LPTR    *Topchar;
  1838. Xextern    LPTR    *Botchar;
  1839. Xextern    LPTR    *Curschar;
  1840. Xextern    LPTR    *Insstart;
  1841. Xextern    int    Cursrow, Curscol, Cursvcol, Curswant;
  1842. Xextern    bool_t    set_want_col;
  1843. Xextern    int    Prenum;
  1844. Xextern    bool_t    Changed;
  1845. Xextern    char    Redobuff[], Insbuff[];
  1846. Xextern    char    *Insptr;
  1847. Xextern    int    Ninsert;
  1848. Xextern    bool_t    got_int;
  1849. X
  1850. Xextern    char    *malloc(), *strcpy();
  1851. X
  1852. X/*
  1853. X * alloc.c
  1854. X */
  1855. Xchar    *alloc(), *strsave(), *mkstr();
  1856. Xint    screenalloc();
  1857. Xvoid    filealloc(), freeall();
  1858. XLINE    *newline();
  1859. Xbool_t    bufempty(), buf1line(), lineempty(), endofline(), canincrease();
  1860. X
  1861. X/*
  1862. X * cmdline.c
  1863. X */
  1864. Xvoid    docmdln(), msg(), emsg(), smsg(), gotocmd(), wait_return(), badcmd();
  1865. Xbool_t    doecmd();
  1866. Xchar    *getcmdln();
  1867. X
  1868. X/*
  1869. X * edit.c
  1870. X */
  1871. Xvoid    edit(), insertchar(), getout(), scrollup(), scrolldown(), beginline();
  1872. Xbool_t    oneright(), oneleft(), oneup(), onedown();
  1873. X
  1874. X/*
  1875. X * fileio.c
  1876. X */
  1877. Xvoid    filemess(), renum();
  1878. Xbool_t    readfile(), writeit();
  1879. X
  1880. X/*
  1881. X * help.c
  1882. X */
  1883. Xbool_t    help();
  1884. X
  1885. X/*
  1886. X * linefunc.c
  1887. X */
  1888. XLPTR    *nextline(), *prevline(), *coladvance(), *nextchar(), *prevchar();
  1889. X
  1890. X/*
  1891. X * main.c
  1892. X */
  1893. Xvoid    stuffin(), stuffnum();
  1894. Xvoid    do_mlines();
  1895. Xint    vgetc();
  1896. Xbool_t    anyinput();
  1897. X
  1898. X/*
  1899. X * mark.c
  1900. X */
  1901. Xvoid    setpcmark(), clrall(), clrmark();
  1902. Xbool_t    setmark();
  1903. XLPTR    *getmark();
  1904. X
  1905. X/*
  1906. X * misccmds.c
  1907. X */
  1908. Xvoid    opencmd(), fileinfo(), inschar(), delline();
  1909. Xbool_t    delchar();
  1910. Xint    cntllines(), plines();
  1911. XLPTR    *gotoline();
  1912. X
  1913. X/*
  1914. X * normal.c
  1915. X */
  1916. Xvoid    normal();
  1917. X
  1918. X/*
  1919. X * param.c
  1920. X */
  1921. Xvoid    doset();
  1922. X
  1923. X/*
  1924. X * ptrfunc.c
  1925. X */
  1926. Xint    inc(), dec();
  1927. Xint    gchar();
  1928. Xvoid    pchar(), pswap();
  1929. Xbool_t    lt(), equal(), ltoreq();
  1930. X#if 0
  1931. X/* not currently used */
  1932. Xbool_t    gtoreq(), gt();
  1933. X#endif
  1934. X
  1935. X/*
  1936. X * screen.c
  1937. X */
  1938. Xvoid    updatescreen(), updateline();
  1939. Xvoid    screenclear(), cursupdate();
  1940. Xvoid    s_ins(), s_del();
  1941. Xvoid    prt_line();
  1942. X
  1943. X/*
  1944. X * search.c
  1945. X */
  1946. Xvoid    dosub(), doglob();
  1947. Xbool_t    searchc(), crepsearch(), findfunc(), dosearch(), repsearch();
  1948. XLPTR    *showmatch();
  1949. XLPTR    *fwd_word(), *bck_word(), *end_word();
  1950. X
  1951. X/*
  1952. X * tagcmd.c
  1953. X */
  1954. Xvoid    dotag(), dountag();
  1955. X
  1956. X/*
  1957. X * undo.c
  1958. X */
  1959. Xvoid    u_save(), u_saveline(), u_clear();
  1960. Xvoid    u_lcheck(), u_lundo();
  1961. Xvoid    u_undo();
  1962. X
  1963. X/*
  1964. X * Machine-dependent routines.
  1965. X */
  1966. Xint    inchar();
  1967. Xvoid    flushbuf();
  1968. Xvoid    outchar(), outstr(), beep();
  1969. Xchar    *fixname();
  1970. X#ifndef    OS2
  1971. X#ifndef    DOS
  1972. Xvoid    remove(), rename();
  1973. X#endif
  1974. X#endif
  1975. Xvoid    windinit(), windexit(), windgoto();
  1976. Xvoid    pause();
  1977. Xvoid    doshell();
  1978. !EOR!
  1979. echo extracting - term.h
  1980. sed 's/^X//' > term.h << '!EOR!'
  1981. X/* $Header: /nw/tony/src/stevie/src/RCS/term.h,v 1.7 89/08/01 17:25:18 tony Exp $
  1982. X *
  1983. X * System-dependent escape sequence definitions.
  1984. X */
  1985. X
  1986. X#ifdef    TERMCAP
  1987. X
  1988. Xextern char *T_EL;        /* erase the entire current line */
  1989. Xextern char *T_IL;        /* insert one line */
  1990. Xextern char *T_DL;        /* delete one line */
  1991. Xextern char *T_SC;        /* save the cursor position */
  1992. Xextern char *T_ED;        /* erase display (may optionally home cursor) */
  1993. Xextern char *T_RC;        /* restore the cursor position */
  1994. Xextern char *T_CI;        /* invisible cursor (very optional) */
  1995. Xextern char *T_CV;        /* visible cursor (very optional) */
  1996. X
  1997. Xextern char *T_CM;        /* cursor motion string */
  1998. X
  1999. X#else
  2000. X
  2001. X/*
  2002. X * This file contains the machine dependent escape sequences that
  2003. X * the editor needs to perform various operations. Some of the sequences
  2004. X * here are optional. Anything not available should be indicated by
  2005. X * a null string. In the case of insert/delete line sequences, the
  2006. X * editor checks the capability and works around the deficiency, if
  2007. X * necessary.
  2008. X *
  2009. X * Currently, insert/delete line sequences are used for screen scrolling.
  2010. X * There are lots of terminals that have 'index' and 'reverse index'
  2011. X * capabilities, but no line insert/delete. For this reason, the editor
  2012. X * routines s_ins() and s_del() should be modified to use 'index'
  2013. X * sequences when the line to be inserted or deleted line zero.
  2014. X */
  2015. X
  2016. X/*
  2017. X * The macro names here correspond (more or less) to the actual ANSI names
  2018. X */
  2019. X
  2020. X#ifdef    ATARI
  2021. X#ifdef    MINIX
  2022. X
  2023. X#define    T_EL    "\033[2K"    /* erase the entire current line */
  2024. X#define    T_IL    "\033[L"    /* insert one line */
  2025. X#define    T_DL    "\033[M"    /* delete one line */
  2026. X#define    T_SC    "\0337"        /* save the cursor position */
  2027. X#define    T_ED    "\033[2J"    /* erase display (may optionally home cursor) */
  2028. X#define    T_RC    "\0338"        /* restore the cursor position */
  2029. X#define    T_CI    ""        /* invisible cursor (very optional) */
  2030. X#define    T_CV    ""        /* visible cursor (very optional) */
  2031. X
  2032. X#else
  2033. X
  2034. X#define    T_EL    "\033l"        /* erase the entire current line */
  2035. X#define    T_IL    "\033L"        /* insert one line */
  2036. X#define    T_DL    "\033M"        /* delete one line */
  2037. X#define    T_SC    "\033j"        /* save the cursor position */
  2038. X#define    T_ED    "\033E"        /* erase display (may optionally home cursor) */
  2039. X#define    T_RC    "\033k"        /* restore the cursor position */
  2040. X#define    T_CI    "\033f"        /* invisible cursor (very optional) */
  2041. X#define    T_CV    "\033e"        /* visible cursor (very optional) */
  2042. X
  2043. X#endif
  2044. X#endif
  2045. X
  2046. X#ifdef    UNIX
  2047. X/*
  2048. X * The following sequences are hard-wired for ansi-like terminals. To get
  2049. X * termcap support, define TERMCAP in env.h and these sequences go away.
  2050. X */
  2051. X#define    T_EL    "\033[2K"    /* erase the entire current line */
  2052. X#define    T_IL    "\033[L"    /* insert one line */
  2053. X#define    T_DL    "\033[M"    /* delete one line */
  2054. X#define    T_ED    "\033[2J"    /* erase display (may optionally home cursor) */
  2055. X#define    T_SC    "\0337"        /* save the cursor position */
  2056. X#define    T_RC    "\0338"        /* restore the cursor position */
  2057. X#define    T_CI    ""        /* invisible cursor (very optional) */
  2058. X#define    T_CV    ""        /* visible cursor (very optional) */
  2059. X#endif
  2060. X
  2061. X#ifdef    OS2
  2062. X/*
  2063. X * The OS/2 ansi console driver is pretty deficient. No insert or delete line
  2064. X * sequences. The erase line sequence only erases from the cursor to the end
  2065. X * of the line. For our purposes that works out okay, since the only time
  2066. X * T_EL is used is when the cursor is in column 0.
  2067. X *
  2068. X * The insert/delete line sequences marked here are actually implemented in
  2069. X * the file os2.c using direct OS/2 system calls. This makes the capability
  2070. X * available for the rest of the editor via appropriate escape sequences
  2071. X * passed to outstr().
  2072. X */
  2073. X#define    T_EL    "\033[K"    /* erase the entire current line */
  2074. X#define    T_IL    "\033[L"    /* insert one line - fake (see os2.c) */
  2075. X#define    T_DL    "\033[M"    /* delete one line - fake (see os2.c) */
  2076. X#define    T_ED    "\033[2J"    /* erase display (may optionally home cursor) */
  2077. X#define    T_SC    "\033[s"    /* save the cursor position */
  2078. X#define    T_RC    "\033[u"    /* restore the cursor position */
  2079. X#define    T_CI    ""        /* invisible cursor (very optional) */
  2080. X#define    T_CV    ""        /* visible cursor (very optional) */
  2081. X#endif
  2082. X
  2083. X
  2084. X#ifdef    DOS
  2085. X/*
  2086. X * DOS sequences
  2087. X *
  2088. X * Some of the following sequences require the use of the "nansi.sys"
  2089. X * console driver. The standard "ansi.sys" driver doesn't support
  2090. X * sequences for insert/delete line.
  2091. X */
  2092. X#define    T_EL    "\033[K"    /* erase the entire current line */
  2093. X#define    T_IL    "\033[L"    /* insert line (requires nansi.sys driver) */
  2094. X#define    T_DL    "\033[M"    /* delete line (requires nansi.sys driver) */
  2095. X#define    T_ED    "\033[2J"    /* erase display (may optionally home cursor) */
  2096. X#define    T_SC    "\033[s"    /* save the cursor position */
  2097. X#define    T_RC    "\033[u"    /* restore the cursor position */
  2098. X#define    T_CI    ""        /* invisible cursor (very optional) */
  2099. X#define    T_CV    ""        /* visible cursor (very optional) */
  2100. X#endif
  2101. X
  2102. X#endif
  2103. X
  2104. X/*
  2105. X * Machine-variant screen handling definitions.
  2106. X *
  2107. X * Define some macros which for invoking screen functions, whether by
  2108. X * callling a bios function or outputting an escape sequence to be
  2109. X * interpreted by a PC console driver or terminal.
  2110. X *
  2111. X * At this writing, not all of Stevie has been converted to use these
  2112. X * macros.  So far, only DOS and PC BIOS versions are completely converted.
  2113. X * Other versions are partly converted (because of changes I made in Stevie's
  2114. X * common code), but they have not been tested.  I'll convert others which I'm
  2115. X * in a position to test, but I'll leave any I can't test alone.  Hopefully,
  2116. X * this will minimize any damage to working versions which I can't test. -LAS
  2117. X */
  2118. X
  2119. X#ifdef BIOS
  2120. X
  2121. X#define    CANDL        TRUE        /* Can delete lines */
  2122. X#define    CANIL        TRUE        /* Can insert lines */
  2123. X#define    CLEOL        bios_t_el()    /* Erase to end-of-line */
  2124. X#define    CLS        bios_t_ed()    /* Erase entire display */
  2125. X#define    CRTDL(r,l)    bios_t_dl(r,l)    /* Delete lines from display */
  2126. X#define    CRTIL(r,l)    bios_t_il(r,l)    /* Insert lines in display */
  2127. X#define    CUROFF        bios_t_ci()    /* Make cursor invisible */
  2128. X#define    CURON        bios_t_cv()    /* Make cursor visible */
  2129. X#define    RESCUR        bios_t_rc()    /* Restore saved cursor position */
  2130. X#define    SAVCUR        bios_t_sc()    /* Save cursor position */
  2131. X
  2132. X#else        /* Not BIOS */
  2133. X
  2134. X#define    CANDL        (T_DL[0]!='\0')    /* Determine if can delete lines */
  2135. X#define    CANIL        (T_IL[0]!='\0')    /* Determine if can insert lines */
  2136. X#define    CLEOL        outstr(T_EL)    /* Erase to end-of-line */
  2137. X#define    CLS        outstr(T_ED)    /* Erase entire display */
  2138. X#define    CRTDL(r,l)    DO_DL(r,l)    /* Delete lines from display */
  2139. X#define    CRTIL(r,l)    DO_IL(r,l)    /* Insert lines in display */
  2140. X#define    CUROFF        outstr(T_CI)    /* Make cursor invisible */
  2141. X#define    CURON        outstr(T_CV)    /* Make cursor visible */
  2142. X#define    RESCUR        outstr(T_RC)    /* Restore saved cursor position */
  2143. X#define    SAVCUR        outstr(T_SC)    /* Save cursor position */
  2144. X
  2145. X#define    DO_DL(r,l) {\
  2146. X    int __xx_knt = l;\
  2147. X    while (__xx_knt-- > 0) {outstr(T_DL);}\
  2148. X}
  2149. X
  2150. X#define    DO_IL(r,l) {\
  2151. X    int __xx_knt = l;\
  2152. X    while (__xx_knt-- > 0) {outstr(T_IL);}\
  2153. X}
  2154. X
  2155. X#endif        /* Not BIOS */
  2156. X
  2157. X
  2158. !EOR!
  2159.  
  2160.