Add alt code to 1991/ant and format README.md

The alt code will make it a bit less unwieldy for vi(m) users by
changing the following input keys to be like in vi(m):

- Use 0 to go to first column.
- Use $ to go to last column.
- Hit ESC to go back to command mode (instead of form-feed, ctrl-L).
- Use w to go forwards one word.
- Use b to go backwards one word.
- Use q to exit.

The rest of the keys were left unchanged.

Format fix README.md file.

This completes 1991/ant checks unless I'm very much mistaken.
This commit is contained in:
Cody Boone Ferguson committed 2023-11-06 05:08:31 -08:00
1 parent 32a6d4b626
commit 603f989ca7
3 files changed
+60 -12

No files matched your search

+2 -2
View File
@@ -116,8 +116,8 @@ OBJ= ${PROG}.o
DATA= README.md
TARGET= ${PROG} hill mole
#
ALT_OBJ=
ALT_TARGET=
ALT_OBJ= ${PROG}.alt.o
ALT_TARGET= ${PROG}.alt
#################
+43 -10
View File
@@ -4,6 +4,9 @@
make all
```
There is an [alternate version](#alternate-code) that might feel a bit more
familiar to vi(m) users.
## To use:
@@ -28,6 +31,33 @@ make mole
```
## Alternate code:
This version changes the commands slightly so that to go to the first column you
should enter `0`, to go to the last column you should enter `$`, to quit you
should enter `q`, to go back a word you should enter `b` and to go forwards a
word you should enter `w`. Also, and perhaps most useful, rather than having to
hit ctrl-L (form-feed, `\f`) to get back to command mode you can use the usual
ESC (`\x1b`).
These will make it slightly less unwieldy for those familiar with vi(m); the
rest was unchanged.
### Alternate build:
```sh
make alt
```
### Alternate use:
Use `ant.alt` as you would `ant` above with the changes in the input keys. See
the author's remarks for the remaining keys.
## Judges' remarks:
The author was kind enough to supply a list of references below,
@@ -38,7 +68,7 @@ of characters you can put a user unfamiliar with vi(m) in a vi(m) session (in
insert mode) and ask them to exit. Well in this case you're likely to have this
problem if you ARE a vi(m) user! :-) ... especially if you don't read the
information below. This means if you're reading this in vi(m) you'll have to
exit this like in normal vi(m) and then exit `./ant` differently.
exit this like in normal vi(m) and then try the same with `./ant` only to fail. :-)
NOTE: to enter form feed you should be able to hit `ctrl-L`. This will allow you
to exit insert mode rather than ESC like in normal vi(m). See the author's
@@ -55,6 +85,7 @@ Carriage return is mapped to newline on input and ignored on output. Tab stops
are every eight columns. Non-printable characters may have unpredictable
results depending on the implementation of `curses`.
### Commands
- h j k l left, down, up, right cursor movement
@@ -67,6 +98,7 @@ results depending on the implementation of `curses`.
- R refresh the screen
- Q quit
### Exit status
- 0 success
@@ -75,26 +107,26 @@ results depending on the implementation of `curses`.
### About this entry
The BUF size should be set at compile time to 32767. This value was used
The `BUF` size should be set at compile time to 32767. This value was used
because the Sozobon C compiler for the Atari ST has 16 bit ints and a limit on
the size of arrays & structures of 32k. Also the WatCom C compiler for the PC
also has 16 bits ints. On machines that have 32 bit ints (most unix boxes), a
larger value for BUF could be used.
larger value for `BUF` could be used.
It is recommend that compact memory model be used on PC class machines. Small
memory model may work too provided BUF is not too large.
memory model may work too provided `BUF` is not too large.
The character constants `'\b'`, `'\f'`, `'\n'`, `'\r'`, `'\t'` are used in order
to provide more portable code, since the compiler should handle the translation
of them into the native character set. Note that `'\f'` (form-feed) was used to
exit insert mode because K&R C had no escape constant for the escape-key.
My goals for this project were to learn and experiment with the
Buffer Gap Scheme [Fin80][net90], write a useful and *portable*
program, and meet the requirements of the IOCCC. I initially
planned to have a mini `curses` built-in like the IOCCC Tetris entry
from a previous year, however this was not as portable as using a
`curses` library with `TERMINFO`/`TERMCAP` support.
My goals for this project were to learn and experiment with the Buffer Gap
Scheme [Fin80][net90], write a useful and *portable* program, and meet the
requirements of the IOCCC. I initially planned to have a mini `curses` built-in
like the [IOCCC Tetris entry from a previous year](/1989/tromp/README.md),
however this was not as portable as using a `curses` library with
`TERMINFO`/`TERMCAP` support.
I plan to post follow-ups such as unobfuscated versions and bugs fixes to
comp.editors. Reposts of the editor.101, gap.doc, and editor.102 can be found
@@ -103,6 +135,7 @@ in the same group every so often.
This entry will display a file with long lines, but has trouble scrolling the
screen with long lines. Paging up and down should work correctly, however.
### References:
[Fin80] Craig A. Finseth, "Theory and Practice of Text Editors or\
+15
View File
@@ -1084,6 +1084,21 @@ The alt code did NOT have arg checks added as it is actually a copy of the
original code.
## [1991/ant](1991/ant/ant.c) ([README.md](1991/ant/README.md]))
Cody added [alt code](1991/ant/ant.alt.c) that will be a bit easier to use for
those familiar with vim in the following ways:
- Use `0` to go to first column.
- Use `$` to go to last column.
- Hit ESC to go back to command mode (instead of form-feed, ctrl-L).
- Use `w` to go forwards one word.
- Use `b` to go backwards one word.
- Use `q` to exit.
The other keys were left unchanged.
## [1991/brnstnd](1991/brnstnd/brnstnd.c) ([README.md](1991/brnstnd/README.md]))
Cody fixed this for modern systems. There were two invalid operands to binary