home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-07-28 | 51.3 KB | 1,129 lines |
- Newsgroups: comp.editors
- Path: sparky!uunet!math.fu-berlin.de!wolff
- From: wolff@inf.fu-berlin.de (Thomas Wolff)
- Subject: Editor mined (Unix, VMS, MSDOS) - easy, solid, non-8-bit-obstructing (1/4)
- Message-ID: <42I54HD@math.fu-berlin.de>
- Sender: news@math.fu-berlin.de (Math Department)
- Organization: Free University of Berlin, Germany
- Date: Tue, 28 Jul 1992 15:02:39 GMT
- Lines: 1118
-
- #! /bin/sh
- : This is a sharchive -- extract the files by running through sh
-
- echo ---------------------- extracting mined.txt -----------------
- sed 's/^,//' << \EOSED > mined.txt
- ,
- ,In response to recent requests for a free, simple, and solid editor
- ,(where the problem is: emacs is not simple, most public domain
- ,contributions are not solid, and vi is not an editor),
- ,I wish to contribute my adaptation of mined.
- ,
- ,Some notes about mined: Its original version is the editor that comes along
- ,with Andrew S. Tanenbaum's freely available operating system minix.
- ,It is small, quick, and easy to use. However, when I found the version one
- ,of my work-mates had adapted to vt100 terminals for use on Sun machines,
- ,it was not solid either nor was it flexible enough to meet my needs.
- ,So I spent some effort into mined (enabling arbitrary terminals, windows
- ,with dynamic size changes, full 8 bit compatibility and support, function
- ,keys, etc), improved its user interface, and made it behave safely (removed
- ,many bugs and crash situations).
- ,
- ,The result has the following basic characteristics:
- ,- type in as you'd imagine, no mode switching, logical positioning, i.e. the
- , text appears where the cursor is, not at some funny other place like in vi
- ,- cursor movement: basic functions available in (Wordmaster-/Wordstar-like)
- , graphic control key layout as well as the keyboards cursor movement keys;
- , use of a "hop key" for fortifying movement commands, thus making it easy
- , to remember twice the amount of basic functions (similar to Wordstar's ^Q)
- ,- two key commands (starting with escape) for the less frequent functions
- ,- fully functioning with all terminals (using termcap/terminfo); also works
- , with curses but that was only built in for a quick port to VMS; curses
- , should not be selected in unix versions for two reasons: the output
- , behaviour seems to be clumsier than with direct terminal control and
- , many unix curses implementations still dare to obstruct the use of
- , 8-bit character sets
- ,- fully functioning in windows which may be resized at any time and the
- , editor will react immediately and install a correct screen image; the
- , cursor stays at the point of text where it was
- ,- multi-file editing
- ,- can be positioned on screen with mouse if terminal sends control sequence
- ,- no accidental quit without save or overwrite of file not read before without
- , prior prompting in any way of exiting/writing
- ,- search functions, replacement functions with or without confirmation dialogue
- ,- suspend command with automatic file saving
- ,- ability to read text from standard input or to write it to standard output
- ,- change working directory / change file name commands
- ,- cut/copy/paste/write-paste-buffer-to-file commands with appending versions
- , and an inter-window paste (actually paste between invocations of mined)
- ,- most significant error messages (as a contrast to usual unix commands)
- ,- start at specified line number possible; view only mode available
- ,- panic handling on external interrupts with attempts to save text
- ,- runs on Unix, VMS, and MSDOS. The VMS and MSDOS adaptations are not yet
- , perfect. The MSDOS version needs an extended ANSI driver with line insert
- , and delete line functions (e.g. NNANSI)
- ,
- ,This version of mined is from July, 1992.
- ,
- ,Thomas Wolff
- ,Freie Universit:at Berlin
- ,Institut f:ur Informatik
- ,D-1000 Berlin
- ,wolff@inf.fu-berlin.de
- ,
- EOSED
-
- echo ---------------------- extracting mined.help -----------------
- sed 's/^,//' << \EOSED > mined.help
- ,MINED EDITOR MINED
- ,
- ,
- ,NAME
- , mined - a text editor
- ,
- ,SYNTAX
- , mined [ -v ] [ +linenumber ] [ filename ] [ more filenames ... ]
- ,
- ,
- ,DESCRIPTION
- , An easy-to-use and natural in appearance text editor.
- , Its original version was designed for Andrew S Tanenbaum's operating
- , system Minix.
- ,
- , Startup features:
- , - with given file name (as usual) or multiple file names
- , - without given file name
- , - reading from a pipe (reading text from standard input)
- , - writing into a pipe (writing edited text to standard output)
- , Examples:
- , mined x - edits the file x
- , cmd | mined - edits the output of "cmd", file name for saving
- , can be given later
- , mined x > y - takes the contents of file x and edits it
- , for writing into y
- , mined | mail nn - edits a text to be mailed
- , cmd1 | mined | cmd2 - modifies text in between a pipe from
- , program cmd1 (output) to cmd2 (as input)
- , Startup options:
- , -v Mined starts in view only mode. The text cannot be modified.
- , +number Mined positions to the given line number.
- ,
- , Basic functionality
- , Mined is always in insert mode. Commands are single control characters,
- , double key commands starting with ESCAPE, and a collection of function
- , keys (currently installed for the VT220, SUN, and Iris terminals).
- , As a specialty, note the prefixing 'HOP KEY' which stretches the effect
- , of some cursor and screen motion commands just as you would expect; this
- , provides for more command flexibility without too much key remembering.
- , Control key layout in the current version is 'geographically' oriented
- , on the left side of the keyboard for the main motion commands, an idea
- , probably originating from the 'WordMaster' and 'WordStar' editors.
- , On SUN terminals, also the right-hand cursor block is assigned the
- , most important movement functions as follows:
- , +------+-------+------+
- , | LnDn | ^ | PgUp |
- , +------+-------+------+
- , | <- | HOP | -> |
- , +------+-------+------+
- , | LnUp | v | PgDn |
- , +------+-------+------+
- ,
- , Note that line-feeds (end-of-line character) are treated like any
- , ordinary character except that they cannot occur in search strings.
- , This drawback (not to be able to search / replace lineends naturally)
- , seems to be a tradition of line-oriented unix tools and I was not
- , willing to spend that much time going into very special parts of mined.
- ,
- , Every care has been taken to prevent loss of the edited text in case
- , of save errors or accidental quit commands etc. Also, if a command is
- , given to overwrite a file not previously read in, mined prompts for
- , confirmation.
- , In the "write to standard output" mode, only one save to standard output
- , can be performed, so there is a problem in the case that more than one
- , saving actions occur; the first save (whether by a write, edit,
- , or suspend command) of the buffer is written to standard output,
- , any subsequent one is treated as usual (with empty file name).
- ,
- , Before regarding the command keys and their functions,
- , note the following general remarks:
- ,
- , The HOP function
- , This function, triggered by any of the HOP keys, fortifies (or modifies)
- , functions as follows. To achieve the combined function, first press
- , any key that is assigned the HOP function, then any key assigned
- , the second function:
- ,
- , HOP - char left move cursor to start of current line
- , HOP - char right move cursor to end of current line
- , HOP - line up move cursor to top of screen
- , HOP - line down move cursor to bottom of screen
- , HOP - scroll up scroll half a screen up
- , HOP - scroll down scroll half a screen down
- , HOP - page up move to start of file
- , HOP - page down move to end of file
- , HOP - word left move cursor to previous ";" or "."
- , HOP - word right move cursor to next ";" or "."
- , HOP - set mark go to mark
- , HOP - copy/cut copy or cut, but append to buffer
- , HOP - save buffer save buffer, but append to file
- , HOP - paste buffer paste "inter-window buffer",
- , which is the last saved buffer by any invocation of mined on the
- , same machine by the same user.
- , HOP - edit next file edit last file
- , HOP - edit previous file edit first file
- , HOP - suspend suspend without writing file
- ,
- , Typing in 8-bit characters in absence of appropriate keyboard
- , Some function keys can be used as prefix keys to change the character
- , assigned to the following key to a diacritic or special character:
- , On a SUN terminal, six diacritic prefix keys are provided:
- , R1 (grave): adds grave accent where applicable: αΦ∞≥∙ └╚╠╥┘
- , R2 (circumflex): adds circumflex accent where applicable: ΓΩε⌠√ ┬╩╬╘█
- , R3 (acute): adds acute accent where applicable: ßΘφ≤·² ┴╔═╙┌▌
- , R4 (diaeresis): adds diaeresis where applicable: Σδ∩÷ⁿ ─╦╧╓▄
- , R5 (tilde): adds tilde where applicable: π±⌡ ├╤╒
- , R6 (angstrom): a╗σ, A╗┼, e╗µ, E╗╞, o╗°, O╗╪
- , Where these rules do not apply, any of these prefix keys makes the
- , following default transformations:
- , s╗▀, c╗τ, C╗╟, n╗±, N╗╤, d╗≡, D╗╨, p╗■, P╗▐, m╗╡,
- , l╗ú, L╗ú, /╗ó, $╗ó, Y╗Ñ, X╗ñ, &╗º, #╗╢, !╗í, ?╗┐,
- , <╗½, >╗╗, x╗╫, :╗≈, +╗▒, 0╗░, 1╗╣, 2╗▓, 3╗│,
- , *╗╖, .╗╖, ,╗╕, "╗¿, '╗┤, _╗», -╗¡, \╗¼, |╗ª
- , On a VT100 terminal, the F6-key is assigned the diaeresis
- , prefix function (including the default transformations).
- , If you have an appropriate keyboard, you can of course also type in
- , any 8-bit character directly or using the Compose/Combine key.
- ,
- ,
- , Summary of mined commands
- , =========================
- , Alternative commands or functions keys are listed in further lines
- , with an indentation for better orientation.
- ,
- , Cursor and screen motion
- , ------------------------
- , ^E Move cursor 1 line up
- , up-arrow
- , ^X Move cursor 1 line down
- , down-arrow
- , ^S ^H Move cursor 1 character left
- , left-arrow
- , ^D Move cursor 1 character right
- , right-arrow
- , ^A Move backward to start of previous word
- , ^F Move forward to start of next word
- , ^R Scroll backward 1 page (Top line becomes bottom line)
- , PrevScreen (vt100)
- , PgDn (R9, sun)
- , ^C Scroll forward 1 page (Bottom line becomes top line)
- , NextScreen
- , PgDn (R15, sun)
- , ^W Scroll screen backward 1 line
- , PF2 (vt100)
- , Home (R7, sun)
- , ^Z Scroll screen forward 1 line
- , PF3 (vt100)
- , End (R13, sun)
- , ^Gnn Move to a line (prompts for line number)
- , ^Gnn% Move to position in text determined by percentage
- , if ^G is not immediately followed by a digit, it works as HOP key
- , for the following command if applicable.
- , ESC ] ^G ^] Move to the position previously marked by ^]
- , ^Q HOP key
- , ^G (if not followed by a digit)
- , PF1 (vt100)
- , "5" (R11, sun)
- ,
- , On terminals or windows which can transform mouse button pressings into
- , key sequences, direct positioning on the current screen is also available:
- , (e.g. crttool)
- , left button position only
- , middle button position and set mark (^] command)
- , right button position and copy text (^Y command)
- ,
- , Modifying text
- , --------------
- , <printable char> Insert the character,
- , <RET or LF char> linefeed (newline),
- , <TAB char> or tab at cursor position
- , ^V <char> Enter control character (also in prompted input)
- , ^O Make new line at current position
- , <DEL char> Delete previous character
- , ^B Delete next character
- , ^T Delete next word
- , ^^ Delete previous word
- , ^K Delete tail of line; if at end of line, delete linefeed
- ,
- , Text block and buffer operations
- , --------------------------------
- , ^] Set mark (to remember the current location)
- , Select (vt100)
- , Stop (L1, sun)
- , ^U Cut text between and current position; save in buffer
- , Remove (vt100)
- , Cut (L10, sun)
- , ^Y Copy text between mark and current position into buffer
- , Do (vt100)
- , Copy (L6, sun)
- , ^P Paste contents of buffer to current position
- , InsertHere (vt100)
- , Paste (L8, sun)
- , Ins (sun)
- , ESC b Copy contents of buffer into a file
- , ESC i Insert file at current position
- , ESC p Print contents of buffer (to default printer)
- , ESC c Perform command (prompted for) with buffer as input
- , For modifications of the "cut", "copy", "paste" and
- , "copy buffer to file" commands by the HOP function see above.
- ,
- , Search
- , ------
- , ESC / Find Search forward (prompt for regular expression)
- , ESC \ Search backward (prompt for regular expression)
- , ^N Search for next occurence (previous expression and direction)
- , Find (vt100)
- , Find (L9, sun)
- , ESC s (Global) Substitute str1 by str2 (prompts for each string)
- , ESC r (Global) Replace str1 by str2 with confirmation prompting
- , ESC l (Line) Substitute string1 by string2
- ,
- , Special functions in a search string:
- , . matches any character.
- , ^ (at begin of pattern) restricts match to the begin of a line.
- , $ (at end of pattern) restricts match to the end of a line.
- , [<cset>] matches any one of a set of characters;
- , the set may be given by listing elements,
- , denoting a range <c1>-<c2>,
- , or negating the whole set [^<cset>].
- , \<c> matches character <c> literally.
- , <pat>* where <pat> is any one of the defined patterns,
- , matches a (zero or more times) repetition of this pattern.
- , Special function in a replacement string:
- , & is replaced by the matched pattern to be replaced.
- ,
- , Miscellaneous
- , -------------
- , ESC w Save (write back) current text to file
- , ESC e Edit another file (prompt for save if current text changed)
- , ESC v View another file (prompt for save if current text changed)
- , ESC q Quit the editor (prompt for save if current text changed)
- , ESC ESC Exit the editor (save if current text changed)
- , ESC + Edit the next file in the list of file names
- , ESC - Edit the previous file in the list of file names
- , ESC # Ask for index into the list of file names and edit that file
- , ESC = count Repeat a command count times (prompts for count)
- , ESC count Repeat a command count times (prompts for rest of count)
- , ^\ Abort current command (also while prompting or searching)
- , ESC Abort current command only if prompting
- , ESC ? Print the current status of the file
- , ESC d Show working directory / change to another one
- , ESC n Change file name associated with edited text (does not
- , affect the file previously being edited)
- , ESC . Redraw the screen
- , ESC z Suspend editor process; first write back file if modified
- , (no write if HOPped or given empty file name on prompting)
- , ESC ! Fork off a shell and wait for it to finish
- , ESC h Show (this) help file
- , Help (vt100 / sun)
- , When entering file names, the leading ~/ notation is accepted.
- ,
- ,ENVIRONMENT
- , Concerning some especially stupid terminal drivers
- , If there is a need to ignore ^S and ^Q keys (in case of stupid keyboard
- , drivers which use them, but don't filter them out), the environment
- , variable NoCtrlSQ or NoControlSQ must be set.
- ,
- , Help display selection
- , Mined looks up the environment variable PAGER or uses 'more' for showing
- , the help file. The complete command to show it can be changed by setting
- , the environment variable MINEDHELP (e.g. to 'less .../mined.help').
- ,
- , Print direction
- , The environment variable MINEDPRINT may contain a print command to be
- , used instead of the default (which is operating system dependant). The
- , variable must contain the string %s in the place for the filename.
- ,
- , Line contents indications
- , Lines which are too long for the screen are usually indicated by a
- , '╗' or '>' character. This can be changed by setting the environment
- , variable MINEDSHIFT. If this variable contains a second character,
- , that one will be used to indicate lines shifted out left off the screen.
- , However, moving to and operating on that position will not be changed.
- ,
- , If an environment variable MINEDRET is set, its contents (one character)
- , is placed as an indicator at the end of every text line on screen.
- , If MINEDRET contains another character it is used to fill the rest of
- , the screen lines, leaving out the position for the MINEDSHIFT mark,
- , which can however be filled with a third character from MINEDRET.
- , I recommend to set MINEDRET to '½' for people who want to see line ends
- , or '╖╖' (or '╖╖╖' or '╖╖½') for people who like Siemens terminals.
- , Other nice variations are '½░', '½¿', or '╢¼'.
- , If a third MINEDRET character is used, in some cases of line length the
- , appearance at the end of the screen line is a matter of taste.
- ,
- , If visible display of TAB characters is desired, the environment
- , variable MINEDTAB can be set (e.g. to '╖').
- ,
- , Buffer file names
- , For the paste buffer, the inter-window paste buffer, and the panic file,
- , environment information as usual on the respective operating system is
- , used to build the names. (Unix: TMPDIR, USER; VMS: SYS$SCRATCH, SYS$LOGIN,
- , USER; MSDOS: TEMP, TMP)
- ,
- , Terminal type
- , The Unix terminal type is determined over the environment variable TERM.
- ,
- , Behaviour modification
- , If the environment variable MINEDMULT exists the exit command (Esc Esc)
- , continues with editing the next file (like Esc +).
- ,
- , Highlight mode (MSDOS only)
- , The ANSI codes for selecting normal and exposed display can be chosen
- , with the environment variable MINEDCOL. The two selections are separated
- , by a space. Each selection is a semicolon-separated list of the code
- , values. The default behaviour corresponds to the setting
- , set MINEDCOL=7 27
- , Example: Green on red text, red on green status: set MINEDCOL=34;42 32;44
- ,
- ,More special MSDOS notes:
- , The default colour setting depends on an extended ANSI driver
- , (like NNANSI) as does the scroll down function anyway. Unfortunately,
- , there is no way to find out the current colour setting nor is there an
- , inverse video mode (only a fixed black on white mode) so that it is
- , impossible to implement just inverse display for highlighting.
- ,
- , Mined finds out the current screen size on startup. Unfortunately, some
- , part of the Turbo-C runtime system sets the screen into text mode, so
- , that no editing in the extended size modes (e.g., 44x132 etc) is possible.
- ,
- , PCDOS has this well-hated memory limitation which limits the size of
- , editable files to currently ca. 200K. If its maximal size is exceeded
- , it ungratefully terminates but saves all your text into the panic-file.
- , These two restrictions (whole file in memory, no smooth memory overflow
- , handling) do not matter in the Unix and VMS versions so they have not
- , been taken care of so far; sorry.
- ,
- ,DIAGNOSTICS
- , In all cases where it is considered sensible, the appropriate message
- , of a system error occurred is displayed (instead of printing numerical
- , hieroglyphs or indistinguished commonplace messages as many other
- , UNIX commands do).
- ,
- ,BUGS
- , When lines are shifted on the display while moving around in a very
- , small window, positioning errors and display garbage may occur.
- ,
- , Mined cannot edit a pipe file and hangs if you try to do so. (But it
- , can insert or write to a pipe and is interruptable by ^\ then.)
- , Mined can neither edit nor insert or write to device files such as tty.
- ,
- ,FILES
- , /usr/man/catl/mined.l This help file
- , /tmp/mined.$$[a-z] Temporary file for buffer
- , /tmp/mined.$USER File for inter-window buffer
- EOSED
-
- echo ---------------------- extracting mined.hilf -----------------
- sed 's/^,//' << \EOSED > mined.hilf
- ,
- , Kurzeinfⁿhrung in die Benutzung des Editors MINED
- , und ErlΣuterung der wichtigsten Kommandos
- ,
- ,
- , Aufruf
- ,
- , In der Kommandozeile tippe:
- , mined <Dateiname>
- , , wobei anstelle von <Dateiname> der Name der vorhandenen oder
- , zu erstellenden Datei einzugeben ist.
- ,
- ,
- , Einfⁿhrende Beschreibung
- ,
- , Nach Start des Editors wird der (leere oder aus einer Datei
- , geladene) Text im internen Buffer des Editors am Bildschirm
- , angezeigt. An der Stelle, wo sich der Cursor befindet, kann
- , in natⁿrlicher Weise beliebiger Text eingefⁿgt werden und
- , mit den Positionierungstasten sowie Control-Tasten kann sich
- , ⁿber den Text der gesamten Datei nach Belieben bewegt werden.
- , Hat die Tastatur eine 9er-Cursorblock, so sollten dessen Tasten
- , mit folgenden Funktionen belegt sein:
- ,
- , +------+-------+------+
- , | LnDn | ^ | PgUp |
- , +------+-------+------+
- , | <- | Hop | -> |
- , +------+-------+------+
- , | LnUp | v | PgDn |
- , +------+-------+------+
- ,
- , Mit Hilfe der (mit Richtungs-Pfeilen bezeichneten) Tasten
- , des Cursor-Blocks kann sich ⁿber den Text der
- , gesamten Datei nach Belieben bewegt werden. Die Tasten
- , orientieren sich dabei am Inhalt der Datei (und nicht am
- , Bildschirm). Das hei▀t:
- , Wenn die Zeile ⁿber den Bildschirmrand hinausgeht und ich
- , mich dorthin bewegen will, wird die Anzeige dieser Zeile
- , entsprechend verschoben. Bin ich wirklich am Ende der Zeile,
- , so geht die 'Pfeil-rechts'-Taste an den Anfang der nΣchsten
- , Zeile. Bin ich in der letzten Bildschirmzeile und will nach
- , unten, so wird der Bildschirminhalt zu diesem Zweck nach
- , oben verschoben und so weiter.
- ,
- , Natⁿrlich kann ich auch mit den Tasten 'PgDn' und 'PgUp'
- , seitenweise in der Datei blΣttern.
- , Praktisch ist das wortweise Weitergehen mit Control-F
- , (nΣchstes Wort) oder Control-A (vorheriges Wort).
- , Au▀erdem kann ich mit den Tasten des Cursor-Blocks, die
- , 'Home' bzw. 'End' beschrieben sind, den Dateiinhalt am
- , Bildschirm nach unten bzw. oben verschieben.
- ,
- , Jetzt zum Editieren: Wenn ich an der Stelle, wo ich gerade bin,
- , etwas einfⁿgen m÷chte, dann tippe ich das einfach da hin.
- ,
- , Die M÷glichkeiten zu positionieren, werden auf einfache Weise
- , vervielfΣltigt durch die 'VerstΣrkertaste', die jede danach
- , betΣtigte Positioniertaste in ihrer Wirkung verstΣrkt. Auf den
- , PCs wurde diese Funktion auf die Taste 'Ins' gelegt. Die
- , genauen Funktionen in Kombination mit der VerstΣrkertaste
- , entnehme bitte der Zusammenfassung der Kommandos weiter unten.
- ,
- , Von Wichtigkeit ist auch das L÷schen von Text: ein Zeichen
- , links vom Cursor (meist das zuletzt getippte Zeichen) wird mit
- , der Taste 'Del' gel÷scht (auch z.B. wenn es ein Zeilenwechsel
- , war). Das ganze nΣchste Wort kann mit Control-T gel÷scht werden.
- , Control-K l÷scht alles bis zum Ende der Zeile; wenn ich bereits
- , dort bin, l÷scht es jedoch den Zeilenwechsel und fⁿgt somit
- , zwei Zeilen zusammen.
- ,
- , Um das Editieren zu beenden und den Editor zu verlassen,
- , drⁿcke zweimal die 'Escape'-Taste: Esc Esc . Der (geΣnderte)
- , Dateiinhalt wird automatisch in die Datei zurⁿckgeschrieben.
- , Will ich nur den Inhalt wegschreiben, danach aber weiter
- , editieren, so drⁿcke ich Esc w (w wie write). Schlie▀lich
- , kann ich noch mit Esc q (q wie quit) den Editor verlassen,
- , ohne den neuen Inhalt wegzuschreiben, werde jedoch nochmal
- , gefragt, ob ich das nicht doch lieber m÷chte.
- ,
- , Zum Suchen eines Textstⁿckes ist das Kommando Esc / geeignet.
- , Es fragt nach der zu suchenden Zeichenfolge, die mit einem
- , Return abzuschlie▀en ist. Will ich dasselbe nochmal suchen,
- , so drⁿcke ich einfach Control-N.
- ,
- ,
- , Umlaute und Sonderzeichen
- , werden am SUN-Terminal mit den PrΣfixtasten R1 bis R6 eingegeben
- , (R4 fⁿr Umlaut oder ▀); am VT100-Terminal nimm F6.
- ,
- , SonderfΣlle
- , Ist beim Wegschreiben des editierten Textes kein Dateiname
- , bekannt (Mined kann auch ohne Dateiname aufgerufen werden)
- , oder liegt fⁿr die bearbeitete Datei keine Schreibberechtigung
- , vor, so wird zunΣchst nach einem Dateinamen gefragt.
- , Gibt es beim Schreiben irgendeinen Fehler, so wird dieser
- , mitgeteilt und das Kommando abgebrochen, Mined also nicht beendet.
- ,
- , ▄brigens:
- , Wird mined von einem Terminal aus benutzt, das die dumme
- , Angewohnheit hat, ^S und ^Q als Steuerzeichen zu benutzen,
- , so mu▀ unbedingt die Umgebungsvariable NoControlSQ gesetzt
- , werden, bevor mit mined gearbeitet wird.
- ,
- , Kommandoⁿbersicht (Control- wird mit ^ abgekⁿrzt)
- ,
- , Positionierung
- , Pfeil nach links geht ein Zeichen nach links
- , Pfeil nach rechts geht ein Zeichen nach rechts
- , Pfeil nach oben geht eine Zeile nach oben
- , Pfeil nach unten geht eine Zeile nach unten
- , ^A geht ein Wort nach links
- , ^F geht ein Wort nach rechts
- , PgUp geht eine Seite zurⁿck
- , PdDn geht eine Seite vor
- , Home rollt eine Zeile runter
- , End rollt eine Zeile rauf
- , Hop Pfeil links geht an den Anfang der Zeile
- , Hop Pfeil rechts geht an das Ende der Zeile
- , Hop Pfeil oben geht an den Anfang des Bildschirms
- , Hop Pfeil unten geht an das Ende des Bildschirms
- , Hop PgUp geht an den Anfang der Datei
- , Hop PgDn geht an das Ende der Datei
- , Hop Home rollt eine halbe Seite runter
- , Hop End rollt eine halbe Seite rauf
- , ^G geht in eine bestimmte Zeile, deren
- , Nummer einzugeben ist (auch Hop-Taste)
- ,
- , Einfⁿgen
- , Zeichen,
- , Tab-Taste oder
- , Zeilenwechsel fⁿgt dieses Zeichen an der aktuellen Position ein
- , ^O fⁿgt einen Zeilenwechsel ein, bleibt jedoch davor stehen
- , ^P siehe unten
- , Esc i fⁿgt den Inhalt einer Datei an der aktuellen Stelle ein
- ,
- , L÷schen
- , Del l÷scht ein Zeichen nach links
- , ^B l÷scht ein Zeichen nach rechts
- , ^T l÷scht ein Wort nach rechts
- , ^K l÷scht bis Zeilenende oder l÷scht dieses alleine
- ,
- , Textabschnitte bearbeiten
- , ^] markiert die aktuelle Stelle
- , ^Y (copY) kopiert den Abschnitt zwischen der aktuellen Stelle
- , und der vorher mit ^] gesetzten Marke in einen Puffer
- , ^U (cUt) entfernt (l÷scht) selbigen Abschnitt, hinterlΣ▀t ihn
- , jedoch ebenfalls im Puffer
- , ^P (Paste) fⁿgt Inhalt des Puffers an der aktuellen Stelle ein
- , Esc b kopiert den Inhalt des Puffers in eine Datei
- ,
- , Suchen
- , Esc / sucht vorwΣrts nach einem einzugebenden Ausdruck
- , Esc \ sucht rⁿckwΣrts nach einem einzugebenden Ausdruck
- , ^N wiederholt den letzten Suchvorgang (Richtung und Ausdruck)
- , Esc s ersetzt (substituiert) bis zum Dateiende einen Ausdruck
- , durch einen anderen (beide sind einzugeben)
- , Esc r desgleichen mit Nachfrage fⁿr jede Ersetzung
- ,
- , Sonstiges
- , Esc Esc schreibt Dateiinhalt in Datei und beendet Mined
- , Esc w schreibt nur Dateiinhalt in Datei
- , Esc q beendet Mined, eventuell ohne Wegschreiben
- , Esc e editiert eine andere Datei
- , Esc + editiert nΣchste Datei (bei Aufruf mined Dat1 Dat2 ...)
- , Esc - editiert vorige Datei
- , Esc # editiert durch Index anzugebende Datei
- , Esc <Zahl> <Kommando>
- , wiederholt das <Kommando> <Zahl>-Mal
- , ^\ bricht das laufende Kommando ab
- , Esc ? zeigt Status der Datei an
- , Esc . baut den Bildschirminhalt neu auf
- , Esc h zeigt eine Hilfstext-Datei an
- EOSED
-
- echo ---------------------- extracting mkmined -----------------
- sed 's/^,//' << \EOSED > mkmined
- ,#! /bin/csh -f
- ,# m÷gliche Parameter:
- ,# -O (gro▀ O!) zum Optimieren, wenn neue Gebrauchsversion erzeugt wird
- ,# -DCURSES , wenn `curses' benutzt werden soll
- ,# -Bstatic , wenn statisches Binden erzwungen werden soll
- ,
- ,set newest=newest # ~wolff/bin/newest
- ,if (! $?cc) then
- , set cc=cc
- ,endif
- ,
- ,set arch=$HOSTTYPE
- ,if "$arch" == vax then
- , set arch=mvax
- ,endif
- ,set suff=.$arch
- ,set opt=($*)
- ,
- ,set opt=($opt -DTERMIO)
- ,
- ,foreach param ($*)
- , switch ($param)
- , case -O*:
- , set optimize=$param; echo optimizing; breaksw;
- , case -DCURSES:
- , set curses; echo using curses; breaksw;
- , case -B*:
- , set bind; echo using bind option; breaksw;
- , endsw
- ,end
- ,if $?optimize then
- , set suff="$suff$optimize"
- ,endif
- ,
- ,if "$arch" == mvax then
- , set suff= # the stupid ╡vax C compiler won't accept -c and -o
- ,endif
- ,if "$suff" == "" then
- , alias compile 'echo Compiling mined\!*.c: ; $cc $opt -c mined\!*.c'
- ,else
- , alias compile 'echo Compiling mined\!*.c: ; $cc $opt -c mined\!*.c -o mined\!*$suff.o'
- ,endif
- ,
- ,if ! { $newest mined1$suff.o mined1.c mined.h } then
- , compile 1
- ,endif
- ,if ! { $newest mined2$suff.o mined2.c mined.h } then
- , compile 2
- ,endif
- ,if ! { $newest minedio$suff.o minedio.c mined.h } then
- , compile io
- ,endif
- ,if ! { $newest minedmp$suff.o minedmp.c mined.h } then
- , compile mp
- ,endif
- ,
- ,set OBJ=(mined1$suff.o mined2$suff.o minedio$suff.o minedmp$suff.o)
- ,if ( $?bind || ! { $newest mined.$arch $OBJ } || ! -x mined.$arch ) then
- , echo -n "linking "
- , if $?curses then
- , echo "with curses"
- , $cc $opt $OBJ -lcurses -ltermcap -o mined.$arch
- , else
- , echo "without curses"
- , $cc $opt $OBJ -ltermcap -o mined.$arch
- , endif
- , echo -n 'Stripping.. '
- , strip mined.$arch
- , echo mkmined done.
- ,endif
- EOSED
-
- echo ---------------------- extracting Makefile -----------------
- sed 's/^,//' << \EOSED > Makefile
- ,SOURCES = mined1.c mined2.c minedio.c minedmp.c
- ,
- ,all: mined
- ,
- ,mined:
- , cc -O -DTERMIO $(SOURCES) -ltermcap -o mined
- , strip mined
- ,
- ,sgtty:
- , cc -O -DSGTTY $(SOURCES) -ltermcap -o mined
- , strip mined
- ,
- ,cursed:
- , cc -O -DCURSES $(SOURCES) -lcurses -ltermcap -o mined.cursed
- , strip mined.cursed
- EOSED
-
- echo ---------------------- extracting mined.doc -----------------
- sed 's/^,//' << \EOSED > mined.doc
- ,+=====================================================================+
- ,| Documentation file of the Mined editor. |
- ,+=====================================================================+
- ,
- , Author: Michiel Huisjes.
- ,
- , Modified by Achim Mⁿller to run on a Unix machine with VT100-like
- , terminals attached and to recognize function key character sequences.
- ,
- , Modifications and corrections made by Thomas Wolff:
- , Basic capabilities:
- , Runs with arbitrary terminals on UNIX (using termcap).
- , Responds correctly to changes of window size, including
- , redisplay of status line; keeps position in text.
- , Accepts and displays an 8 bit character set.
- , User interface:
- , Two letter ESCAPE commands are used for less frequent functions.
- , The concept of a HOP key prefix was introduced which fortifies
- , any positioning function that follows. This provides more
- , command flexibility without too much need of key remembering.
- , Command key layout changed to resemble WordMaster/WordStar.
- , Improved behaviour:
- , Stripping off lines too long for the screen implemented
- , also on status line output. If status line input overflows
- , the screen and wraps/scrolls, the screen is redisplayed.
- , Search displays a "wrap around end of file" message for
- , better orientation.
- , In case of system errors, the appropriate error message
- , is fetched and displayed instead of printing
- , numerical hieroglyphs or indistinguished
- , commonplace messages (as many UNIX commands do).
- , Additional features and commands:
- , A HELP command.
- , A SUSPEND command with automatic file saving.
- , A repeat search command.
- , A replace command with confirmation dialogue.
- , A change working directory command.
- , A change file name reference command.
- , Reading from standard input and writing to standard output.
- , Starting up at a given line number.
- , Appending versions of the buffer cut/copy/write commands.
- , Process-independent version of the paste command, thus enabling
- , inter-window paste operations.
- , A view only version of the edit command (not yet very well developed).
- , Commands to print buffer / to perform command with buffer as input.
- , Positioning to a percentage within the text.
- , Accepts control char sequence for absolute positioning (by mouse)
- , Multi-file edit
- , External interrupt handling with attempts to save the text
- , Configurable indicators for line shift left/right, line end, tab.
- , Improved text security:
- , Doesn't quit if a file save fails or even if the question for
- , a filename isn't answered. So you have a chance
- , to try another filename or something.
- , Asks whether to overwrite file whenever a file is to be
- , written to which was not previously read in.
- , Removed abort_mined since no one wants to kill an editor
- , unconditionally without attempt to save the text.
- , Corrections:
- , Some screen positioning errors and inconsistencies
- , have been eliminated, for example:
- , The EF function now really positions to the end of the text, not
- , to the beginning of the last line,
- , The HIGH and LOW functions now stay in the current screen column,
- , as UP and DN do now more consistently.
- , Input routine detects overflow of input buffer.
- , Doesn't crash if a file loaded or inserted contains NULL chars.
- , Scratch file counting and deleting was corrected.
- , The Readonly flag and status message is now based on the really
- , effective circumstances (could show wrong state before if
- , real and effective user id were different).
- , Several minor modifications, e.g.: XBREAK (the screen column limit)
- , was increased by 1, since two columns were left blank on
- , the right screen border.
- , Missing modification:
- , The rightmost screen column is currently unused because
- , linefeed is used as a line positioner. If absolute
- , positioning would be added for each text line output,
- , the screen column limit XBREAK could again be increased by 1.
- ,
- ,
- , 1. General remarks.
- ,
- , Mined is a screen editor designed for the minix operating system.
- , It is meant to be used on files not larger than 50K and to be fast.
- , When mined starts up, it reads the file into its memory to minimize
- , disk access. The only time that disk access is needed is when certain
- , save, write or copy commands are given.
- ,
- , Mined has the style of Emacs or Jove, that means that there are no modes.
- , Each character has its own entry in an 256 pointer to function array,
- , which is called when that character is typed. Only ASCII characters are
- , connected with a function that inserts that character at the current
- , location in the file. Two exceptions are <linefeed> and <tab> which are
- , inserted as well. Note that the mapping between commands and functions
- , called is implicit in the table. Changing the mapping just implies
- , changing the pointers in this table.
- ,
- , The display consists of SCREENMAX + 1 lines and XMAX + 1 characters. When
- , a line is larger (or gets larger during editing) than XBREAK characters,
- , the line is either shifted SHIFT_SIZE characters to the left (which means
- , that the first SHIFT_SIZE characters are not printed) or the end of the
- , line is marked with the SHIFT_MARK character and the rest of the line is
- , not printed. A line can never exceed MAX_CHARS characters. Mined will
- , always try to keep the cursor on the same line and same (relative)
- , x-coordinate if nothing changed. So if you scroll one line up, the cursor
- , stays on the same line, or when you move one line down, the cursor will
- , move to the same place on the line as it was on the previous.
- , Every character on the line is available for editing including the
- , linefeed at the the of the line. When the linefeed is deleted, the current
- , line and the next line are joined. The last character of the file (which
- , is always a linefeed) can never be deleted.
- , The bottomline (as indicated by YMAX + 1) is used as a status line during
- , editing. This line is usually blank or contains information mined needs
- , during editing. This information (or rather questions) is displayed in
- , reverse video.
- ,
- , The terminal modes are changed completely. All signals like start/stop,
- , interrupt etc. are unset. The only signal that remains is the quit signal.
- , The quit signal (^\) is the general abort signal for mined. Typing a ^\
- , during searching or when mined is asking for filenames, etc. will abort
- , the function and mined will return to the main loop.
- , Sending a quit signal during the main loop will abort the session
- , (after confirmation) and the file is not (!) saved. *removed*
- , The session will also be aborted when an unrecoverable error occurs, e.g.
- , when there is no more memory available. If the file has been modified,
- , mined will ask if the file has to be saved or not.
- , If there is no more space left on the disk, mined will just give an error
- , message and continue.
- ,
- , The number of system calls are minimized. This is done to keep the editor
- , as fast as possible. I/O is done in SCREEN_SIZE reads/writes. Accumulated
- , output is also flushed at the end of each character typed.
- ,
- , 2. Regular expressions
- ,
- , Mined has a built in regular expression matcher, which is used for
- , searching and replace routines. A regular expression consists of a
- , sequence of:
- ,
- , 1. A normal character matching that character.
- , 2. A . matching any character.
- , 3. A ^ matching the begin of a line.
- , 4. A $ (as last character of the pattern) mathing the end of a line.
- , 5. A \<character> matching <character>.
- , 6. A number of characters enclosed in [] pairs matching any of these
- , characters. A list of characters can be indicated by a '-'. So
- , [a-z] matches any letter of the alphabet. If the first character
- , after the '[' is a '^' then the set is negated (matching none of
- , the characters).
- , A ']', '^' or '-' can be escaped by putting a '\' in front of it.
- , Of course this means that a \ must be represented by \\.
- , 7. If one of the expressions as described in 1-6 is followed by a
- , '*' than that expressions matches a sequence of 0 or more of
- , that expression.
- ,
- , Parsing of regular expression is done in two phases. In the first phase
- , the expression is compiled into a more comprehensible form. In the second
- , phase the actual matching is done. For more details see 3.6.
- ,
- ,
- , 3. Implementation of mined.
- ,
- , 3.1 Data structures.
- ,
- , The main data structures are as follows. The whole file is kept in a
- , double linked list of lines. The LINE structure looks like this:
- ,
- , typedef struct Line {
- , struct Line * next;
- , struct Line * prev;
- , char * text;
- , unsigned char shift_count;
- , } LINE;
- ,
- , Each line entry contains a pointer to the next line, a pointer to the
- , previous line and a pointer to the text of that line. A special field
- , shift_count contains the number of shifts (in units of SHIFT_SIZE)
- , that is performed on that line. The total size of the structure is 7
- , bytes so a file consisting of 1000 empty lines will waste a lot of
- , memory. A LINE structure is allocated for each line in the file. After
- , that the number of characters of the line is counted and sufficient
- , space is allocated to store them (including a linefeed and a '\0').
- , The resulting address is assigned to the text field in the structure.
- ,
- , A special structure is allocated and its address is assigned to the
- , variable header as well as the variable tail. The text field of this
- , structure is set to NIL_PTR. The tail->prev of this structure points
- , to the last LINE of the file and the header->next to the first LINE.
- , Other LINE * variables are top_line and bot_line which point to the
- , first line resp. the last line on the screen.
- , Two other variables are important as well. First the LINE * cur_line,
- , which points to the LINE currently in use and the char * cur_text,
- , which points to the character at which the cursor stands.
- , Whenever an ASCII character is typed, a new line is build with this
- , character inserted. Then the old data space (pointed to by
- , cur_line->text) is freed, data space for the new line is allocated and
- , assigned to cur_line->text.
- ,
- , Two global variables called x and y represent the x and y coordinates
- , from the cursor. The global variable nlines contains the number of
- , lines in the file. Last_y indicates the maximum y coordinate of the
- , screen (which is usually SCREENMAX).
- ,
- , A few strings must be initialized by hand before compiling mined.
- , These string are enter_string, which is printed upon entering mined,
- , rev_video (turn on reverse video), normal_video, rev_scroll (perform a
- , reverse scroll) and pos_string. The last string should hold the
- , absolute position string to be printed for cursor motion. The #define
- , X_PLUS and Y_PLUS should contain the characters to be added to the
- , coordinates x and y (both starting at 0) to finish cursor positioning.
- ,
- , 3.2 Starting up.
- ,
- , Mined can be called with or without argument and the function
- , load_file() is called with these arguments. load_file() checks
- , if the file exists if it can be read and if it is writable and
- , sets the writable flag accordingly. If the file can be read,
- , load_file() reads a line from the file and stores this line into
- , a structure by calling install_line() and line_insert() which
- , installs the line into the double linked list, until the end of the
- , file is reached.
- , Lines are read by the function get_line(), which buffers the
- , reading in blocks of SCREEN_SIZE. Load_file() also initializes the
- , LINE * variables described above.
- ,
- , 3.3 Moving around.
- ,
- , Several commands are implemented for moving through the file.
- , Moving up (UP), down (DN) left (LF) and right (RT) are done by the
- , arrow keys. Moving one line below the screen scrolls the screen one
- , line up. Moving one line above the screen scrolls the screen one line
- , down. The functions forward_scroll() and reverse_scroll() take care
- , of that.
- , Several other move functions exist: move to begin of line (BL), end of
- , line (EL) top of screen (HIGH), bottom of screen (LOW), top of file
- , (HO), end of file (EF), scroll one page down (PD), scroll one page up
- , (PU), scroll one line down (SD), scroll one line up (SU) and move to a
- , certain line number (GOTO).
- , Two functions called MN() and MP() each move one word further or
- , backwards. A word is a number of non-blanks seperated by a space, a
- , tab or a linefeed.
- ,
- , 3.4 Modifying text.
- ,
- , The modifying commands can be separated into two modes. The first
- , being inserting text, and the other deleting text. Two functions are
- , created for these purposes: insert() and delete(). Both are capable
- , of deleting or inserting large amounts of text as well as one
- , character. Insert() must be given the line and location at which
- , the text must be inserted. Is doesn't make any difference whether this
- , text contains linefeeds or not. Delete() must be given a pointer to
- , the start line, a pointer from where deleting should start on that
- , line and the same information about the end position. The last
- , character of the file will never be deleted. Delete() will make the
- , necessary changes to the screen after deleting, but insert() won't.
- , The functions for modifying text are: insert one char (S), insert a
- , file (file_insert(fd)), insert a linefeed and put cursor back to
- , end of line (LIB), delete character under the cursor (DCC), delete
- , before cursor (even linefeed) (DPC), delete next word (DNW), delete
- , previous word (DPW) and delete to end of line (if the cursor is at
- , a linefeed delete line) (DLN).
- ,
- , 3.5 Yanking.
- ,
- , A few utilities are provided for yanking pieces of text. The function
- , MA() marks the current position in the file. This is done by setting
- , LINE * mark_line and char * mark_text to the current position. Yanking
- , of text can be done in two modes. The first mode just copies the text
- , from the mark to the current position (or visa versa) into a buffer
- , (YA) and the second also deletes the text (DT). Both functions call
- , the function set_up() with the delete flag on or off. Set_up()
- , checks if the marked position is still a valid one (by using
- , check_mark() and legal()), and then calls the function yank() with
- , a start and end position in the file. This function copies the text
- , into a scratch_file as indicated by the variable yank_file. This
- , scratch_file is made unique by the function scratch_file(). At the end
- , of copying yank will (if necessary) delete the text. A global flag
- , called yank_status keeps track of the buffer (or file) status. It is
- , initialized on NOT_VALID and set to EMPTY (by set_up()) or VALID (by
- , yank()). Several things can be done with the buffer. It can be
- , inserted somewhere else in the file (PT) or it can be copied into
- , another file (WB), which will be prompted for.
- ,
- , 3.6 Search and replace routines.
- ,
- , Searching for strings and replacing strings are done by regular
- , expressions. For any expression the function compile() is called
- , with as argument the expression to compile. Compile() returns a
- , pointer to a structure which looks like this:
- ,
- , typedef struct regex {
- , union {
- , char * err_mess;
- , int * expression;
- , } result;
- , char status;
- , char * start_ptr;
- , char * end_ptr;
- , } REGEX;
- ,
- , If something went wrong during compiling (e.g. an illegal expression
- , was given), the function reg_error() is called, which sets the status
- , field to REG_ERROR and the err_mess field to the error message. If the
- , match must be anchored at the beginning of the line (end of line), the
- , status field is set to BEGIN_LINE (END_LINE). If none of these special
- , cases are true, the field is set to 0 and the function finished() is
- , called. Finished() allocates space to hold the compiled expression
- , and copies this expression into the expression field of the union
- , (bcopy()). Matching is done by the routines match() and line_check().
- , Match() takes as argument the REGEX * program, a pointer to the
- , startposition on the current line, and a flag indicating FORWARD or
- , REVERSE search. Match() checks out the whole file until a match is
- , found. If match is found it returns a pointer to the line in which the
- , match was found else it returns a NIL_LINE. Line_check() takes the
- , same arguments, but return either MATCH or NO_MATCH.
- , During checking, the start_ptr and end_ptr fields of the REGEX
- , structure are assigned to the start and end of the match.
- , Both functions try to find a match by walking through the line
- , character by character. For each possibility, the function
- , check_string() is called with as arguments the REGEX * program and the
- , string to search in. It starts walking through the expression until
- , the end of the expression or the end of the string is reached.
- , Whenever a * is encountered, this position of the string is marked,
- , the maximum number of matches are performed and the function star()
- , is called in order to try to find the longest match possible. Star()
- , takes as arguments the REGEX program, the current position of the
- , string, the marked position and the current position of the expression
- , Star() walks from the current position of the string back to the
- , marked position, and calls string_check() in order to find a match.
- , It returns MATCH or NO_MATCH, just as string_check() does.
- , Searching is now easy. Both search routines (forward (SF) and
- , backwards search (SR)) call search() with an apropiate message and a
- , flag indicating FORWARD or REVERSE search. Search() will get an
- , expression from the user by calling get_expression(). Get_expression()
- , returns a pointer to a REGEX structure or NIL_REG upon errors and
- , prompts for the expression. If no expression if given, the previous is
- , used instead. After that search will call match(), and if a match is
- , found, we can move to that place in the file by the functions find_x()
- , and find_y() which will find display the match on the screen.
- , Replacing can be done in two ways. A global replace (GR) or a line
- , replace (LR). Both functions call change() with a message and a flag
- , indicating global or line replacement. Change() will prompt for the
- , expression and for the replacement. Every & in the replacement pattern
- , means substitute the match instead. An & can be escaped by a \. When
- , a match is found, the function substitute() will perform the
- , substitution.
- ,
- , 3.6 Miscellaneous commands.
- ,
- , A few commands haven't be discussed yet. These are redraw the screen
- , (RD) fork a shell (SH), print file status (FS), write file to disc
- , (WT), insert a file at current position (IF), leave editor (XT) and
- , visit another file (VI). The last two functions will check if the file
- , has been modified. If it has, they will ask if you want to save the
- , file by calling ask_save().
- , The function REPT() will repeat a command n times. It will prompt for
- , the number. Aborting the loop can be done by sending the ^\ signal.
- ,
- , 3.7 Utility functions.
- ,
- , Several functions exists for internal use. First allocation routines:
- , alloc(bytes) and newline() will return a pointer to free data space
- , if the given size. If there is no more memory available, the function
- , panic() is called.
- , Signal handling: The only signal that can be sent to mined is the
- , SIGQUIT signal. This signal, functions as a general abort command.
- , Mined will abort if the signal is given during the main loop. The
- , function abort_mined() takes care of that.
- , Panic() is a function with as argument a error message. It will print
- , the message and the error number set by the kernel (errno) and will
- , ask if the file must be saved or not. It resets the terminal
- , (raw_mode()) and exits.
- , String handling routines like copy_string(to, from), length_of(string)
- , and build_string(buffer, format, arg1, arg2, ...). The latter takes
- , a description of the string out out the format field and puts the
- , result in the buffer. (It works like printf (3), but then into a
- , string). The functions status_line(string1, string2), error(string1,
- , string2), clear_status() and bottom_line() all print information on
- , the status line.
- , Get_string(message, buffer) reads a string and getchar() reads one
- , character from the terminal.
- , Num_out((long) number) prints the number into a 11 digit field
- , without leading zero's. It returns a pointer to the resulting string.
- , File_status() prints all file information on the status line.
- , Set_cursor(x, y) prints the string to put the cursor at coordinates
- , x and y.
- , Output is done by four functions: writeline(fd,string), clear_buffer()
- , write_char(fd, c) and flush_buffer(fd). Three defines are provided
- , to write on filedescriptor STD_OUT (terminal) which is used normally:
- , string_print(string), putchar(c) and flush(). All these functions
- , use the global I/O buffer screen and the global index for this array
- , called out_count. In this way I/O can be buffered, so that reads or
- , writes can be done in blocks of SCREEN_SIZE size.
- , The following functions all handle internal line maintenance. The
- , function proceed(start_line, count) returns the count'th line after
- , start_line. If count is negative, the count'th line before the
- , start_line is returned. If header or tail is encountered then that
- , will be returned. Display(x, y, start_line, count) displays count
- , lines starting at coordinates [x, y] and beginning at start_line. If
- , the header or tail is encountered, empty lines are displayed instead.
- , The function reset(head_line, ny) reset top_line, last_y, bot_line,
- , cur_line and y-coordinate. This is not a neat way to do the
- , maintenance, but it sure saves a lot of code. It is usually used in
- , combination with display().
- , Put_line(line, offset, clear_line), prints a line (skipping characters
- , according to the line->shift_size field) until XBREAK - offset
- , characters are printed or a '\n' is encountered. If clear_line is
- , TRUE, spaces are printed until XBREAK - offset characters.
- , Line_print(line) is a #define from put_line(line, 0, TRUE).
- , Moving is done by the functions move_to(x, y), move_addres(address)
- , and move(x, adress, y). This function is the most important one in
- , mined. New_y must be between 0 and last_y, new_x can be about
- , anything, address must be a pointer to an character on the current
- , line (or y). Move_to() first adjust the y coordinate together with
- , cur_line. If an address is given, it finds the corresponding
- , x-coordinate. If an new x-coordinate was given, it will try to locate
- , the corresponding character. After that it sets the shift_count field
- , of cur_line to an apropiate number according to new_x. The only thing
- , left to do now is to assign the new values to cur_line, cur_text, x
- , and y.
- ,
- , 4. Summary of commands.
- ,
- , See seperate file mined.help .
- ,
- ,+===========================================================================+
- EOSED
-
- exit 0
-
-