home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / pc / source / stevie.zoo / stevie.1 next >
Encoding:
Text File  |  1990-03-14  |  58.9 KB  |  2,126 lines

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