home *** CD-ROM | disk | FTP | other *** search
- TURBO EDITOR MACRO COMPILER (TEMC)
- ----------------------------------
-
- This file explains how to use TEMC.EXE, the Turbo Editor Macro Compiler,
- and documents the Turbo Editor Macro Language, TEML.
-
- Table of Contents
- -----------------
- 1. What is TEMC?
- 2. The TEMC Command line
- 3. TEMC Syntax
- 4. Predefined editor commands
-
-
- 1. What is TEMC?
- -----------------
-
- TEMC is an editor macro compiler for the Turbo Pascal for Windows IDE.
- It processes a script file that defines editor macros and key bindings
- and produces a command file that is read by the IDE to define the effects
- of keyboard commands in the editor.
-
- Anytime the IDE is set to use the Alternate Command Set (using menu
- item <Options><Preferences><Command Set>, it looks for a file called
- TPWALT.CMD in the same directory as the program file, TPW.EXE. If this
- command file is found, its contents are read into memory to replace the
- default editor key bindings.
-
- The file TPWALT.TEM contains the factory default macro definitions
- and key bindings that are built into the IDE editor. It serves as an
- example script, as well as a base from which to customize the editor.
-
-
- 2. The TEMC command line
- -------------------------
-
- TEMC is invoked from the DOS command line using
-
- temc [-c] <script file> <command file>
-
- The extension of the script file is assumed to be .TEM if it is not
- specified. The command file need not exist. It will be created if it does
- not. The optional -c switch can also be specified as /c, and can
- appear in any argument position on the command line. If it appears, it
- specifies that any existing commands the command file are to
- be thrown away before processing the script file. When -c is not used,
- the key bindings in the script file are merged with those already
- defined in the command file.
-
-
- 3. TEMC syntax
- ---------------
-
- Comments are in C style /* ... */ pairs.
-
- A statement defines either a named macro or a key binding.
-
- The syntax to define a macro is
-
- MACRO <macroname> <command1>; [ <command2>; ... ] END;
-
- Spaces and newlines are optional. The macroname can consist of anything
- that is a legal symbol in C. Note, that unlike C, TEMC's language is
- case insensitive. A command can be either the name of another macro
- that has already been defined, or an editor command that has been
- predefined in TEMC. A list of those and what they do is below.
-
- Some of the predefined editor commands have a syntax that looks like
- a C function call with one argument, for example
-
- SetMark(5);
-
- Depending on the command, the argumenmt is either a decimal integer constant,
- a character constant, or a string literal. All are specified using C syntax.
-
- Here's an example of a macro definition from the TPWALT.TEM file:
-
- MACRO MacPageUp
- FixScreenPos;
- PageUp;
- FixCursorPos;
- END;
-
- The syntax to define a key binding is:
-
- <key-sequence>: <command>;
-
- or
-
- <key-sequence>: BEGIN <command1>; [ <comand2>; ... ] END;
-
- The <key-sequence> is either a key, which is a character optionally
- preceded by "ctrl-" (not in quotes), or a series of keys
- separated by the character "+". Note that the specification of the
- key characters themselves is case sensitive, e.g. ctrl-k+B is different
- than ctrl-k+b, even though the latter is the same as CTRL-K+b.
-
- Any key in a sequence, other than the first one may be preceded by
- one of the characters "^" or "@". The "^" indicates that any combination
- of case and ctrl can be used to type the key, i.e., lower case, upper
- case, or control characters. The "@" is used to indicate that the
- case does not matter for that character, although ctrl will not
- be accepted. For example, ctrl-k+b specifies a Ctrl-K followed by a
- lower case b. ctrl-k+^b specifies a ctrl-K followed by any of b, B,
- or ctrl-B. ctrl-k+@b specifies ctrl-K followed by either b or B.
-
- Whitespace is allowed between the key-sequence and the ":".
-
- Each <command> can be either the name of a previously defined macro,
- or one of the predefined editor commands listed below.
-
-
-
- 4. Predefined editor commands
- ------------------------------
-
- The following is the list of all editor commands that are predefined in
- TEMC. TEMC allows you to use built-in editor commands and user-defined
- macros as commands within macros interchangeably, as long as you do not
- create any loops by having two macros calling each other, even via
- intermediate macros. Note that some commands cause an escape from the
- editor to the surrounding IDE. There is no provision for returning
- control to the editor once that is done. Thus, if one of those
- commands is part of a macro, it must be the last command in the
- macro. TEMC will produce an error message if a macro definition
- violates this restriction. Commands that cause an escape from the
- editor are grouped at the end of the following list.
-
-
- TEMC editor command name What it causes the editor to do
- ------------------------ -------------------------------
-
- BackspaceDelete Delete the character before the cursor
-
- BottomOfScreen Move cursor to the bottom line
- currently displayed in the window,
- leaving column unchanged
-
- CenterFixScreenPos Adjust the screen display to ensure that the
- cursor location is visible. If any adjustment
- is necessary, adjust the display so the cursor
- is close to being centered in the window.
-
- CursorCharLeft Move cursor left over one character.
- This will skip over a tab character and
- will move to the end of the previous
- line from the beginning of a line.
-
- CursorCharRight Move cursor right over one character.
- This will skip over a tab character and
- will advance to the beginning of the next
- line from the end of a line.
-
- CursorDown Move cursor down one row
-
- CursorLeft Move cursor left one screen column
-
- CursorRight Move cursor right one screen column
-
- CursorUp Move cursor up one row
-
- CursorSwitchedLeft Like CursorLeft, but pays attention to
- Cursor Through Tab option setting
-
- CursorSwitchedRight Like CursorRight, but pays attention to
- Cursor Through Tab option setting
-
- DeleteChar Delete the character at the current
- cursor location
-
- DeleteLine Delete the current line
-
- DeleteToEOL Delete from the current column to the end
- of the current line
-
- DeleteWord Delete from cursor to beginning of next word
-
- EndCursor Move cursor to end of file buffer
-
- FixCursorPos Insure that cursor value specifies a
- row between 1 and the number of lines in
- the buffer, a column greater than 0, and
- that if the cursor through tabs option is
- not set, that it is not placed in the
- middle of a tab character.
-
- FixScreenPos Adjust the screen display to ensure that the
- cursor location is visible
-
- FullPaintScreen Redraw the entire window, making no
- assumptions about what is on the screen
-
- HomeCursor Move cursor to beginning of file buffer
-
- IndentBlock Insert a space at the beginning of each
- line in the selected text.
-
- InsertText Called using the syntax InsertText("string")
- Inserts the literal "string" in the buffer
- at the current cursor location.
-
- LeftOfLine Move cursor to beginning of current line
-
- LiteralChar Called using the syntax LiteralChar('c'),
- where 'c' is a character or integer value.
- Inserts the character at the current cursor
- location, without doing any special processing
- for newline, tab characters, etc.
-
- MarkBufModified Set a flag indicating that the contents
- of the buffer are different than what is
- in the corresponding disk file
-
- MarkBufUnmodified Clear a flag, thus indicating that the
- contents of the buffer can be assumed
- to be identical to what is in the disk file
-
- MatchPairBackward Same as MatchPairForward, except that if the
- cursor is on a ' or " then search backward
- for the matching one.
-
- MatchPairForward If the cursor is on one of the characters
- (, ), {, }, [, ], or on the first character
- of one of the pairs (*, *), (. or .), then
- search in the appropriate direction for the
- closest instance of the matching delimiter.
- If the cursor is on the character ' or ",
- then search forward for the matching one.
- If a match is found, place the cursor there.
-
- MoveToMark Called using the syntax MoveToMark(n),
- where "n" is a one digit number, 0-9.
- Moves the cursor to the location saved with
- SetMark(n) command.
-
- MoveToTempPos Move the cursor to the saved temporary marker.
-
- OutdentBlock Delete a leading space from the beginning
- of each line in the selected text
- that begins with a space.
-
- PageScreenDown Scroll screen down by number of lines in the
- window, leaving cursor position unchanged
-
- PageScreenUp Scroll screen up by number of lines in the
- window, leaving cursor position unchanged
-
- PaintScreen Redraw the entire window, assuming that
- the screen still correctly displays what
- the editor last drew on it
-
- PageDown Move cursor down by number of lines in
- the window
-
- PageUp Move cursor up by number of lines in
- the window
-
- ReDo Perform an Redo operation. Exactly what
- happens depends on the option settings
-
- RightOfLine Move cursor to end of current line
-
- RightOfWord Move cursor to the next column that follows
- the end of a word
-
- ScrollScreenDown Scroll screen down one line, leaving cursor
- position unchanged
-
- ScrollScreenUp Scroll screen up one line, leaving cursor
- position unchanged
-
- SetMark Called using the syntax SetMark(n),
- where "n" is one digit number, 0-9.
- Sets a marker to point to the character at
- the current cursor location, so a later
- MoveToMark(n) comand can restore the cursor
-
- SetTempPos Save the cursor location in a temporary
- marker that may be used by some internal
- editor commands. This is not usually practical
- to use in user-defined macros, which should
- instead use SetMark.
-
- SmartRefreshScreen Redraw the window, skipping any portions
- that the editor is sure are unmodified
- since it was last drawn.
-
- SmartTab Insert space and/or tab characters in
- accordance with the current settings of
- the Use Tab Char option, and Tab Width
-
- ToggleInsert Toggle state of insert/overwrite option
-
- TopOfScreen Move cursor to the top line
- currently displayed in the window,
- leaving column unchanged
-
- UnDo Perform an Undo operation. Exactly what
- happens depends on the option settings
-
- WordLeft Move cursor to beginning of previous word,
- or to end of previous line, whichever is
- found first
-
- WordRight Move cursor to beginning of next word,
- or to the end of a line, whichever is
- found first
-
-
- The following commands cause an exit from the editor, and so can
- only appear as the last command of a macro:
-
-
- ClipClear Delete selected text
-
- ClipCopy Copy selected text to clipboard
-
- ClipCut Cut selected text to clipboard
-
- ClipPaste Paste clipboard into buffer at cursor
-
- CompilerOptions Insert the current compiler options at the
- start of the edit buffer
-
- GetFindString Open a dialog for a text search operation
-
- QuoteChar Next control character typed by user will
- be directly inserted into buffer
-
- ReadBlock Open dialog requesting a file name
- which will be read into the buffer
- at the cursor location
-
- RepeatSearch Search again, using previous parameters
-
- Replace Open an dialog for a search/replace operation
-
- SaveFile Save current editor buffer
-
- ShiftOff Turn off text selection mode and clear
- current block, if any
-
- ShiftOffWithCopy Copy current block to clipboard and turn
- off text selection mode
-
- ShiftOffWithCut Cut current block to clipboard and turn
- off text selection mode
-
- ShiftOn Turn on text selection mode
-
- ShowLastError Redisplay the last compiler error reported
-
- ToggleAutoIndent Toggle the state of the Auto Indent option
-
- ToggleAutoOutdent Toggle the state of the Backspace Unindents
- option
-
- ToggleCursorThroughTabMode Toggle the state of the Cursor Through Tabs
- option
-
- ToggleOptimalFillMode Toggle state of Optimal Fill option
-
- ToggleTabbingMode Toggle state of Use Tab Char option
-
- WriteBlock Open dialog requesting a file name to
- which the selected text will be written
-