home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / l / l038 / 1.img / DOC.PAK / TEMC.DOC < prev    next >
Encoding:
Text File  |  1991-03-14  |  12.4 KB  |  368 lines

  1.                  TURBO EDITOR MACRO COMPILER (TEMC)
  2.                  ----------------------------------
  3.  
  4. This file explains how to use TEMC.EXE, the Turbo Editor Macro Compiler,
  5. and documents the Turbo Editor Macro Language, TEML.
  6.  
  7. Table of Contents
  8. -----------------
  9. 1.  What is TEMC?
  10. 2.  The TEMC Command line
  11. 3.  TEMC Syntax
  12. 4.  Predefined editor commands
  13.  
  14.  
  15. 1.  What is TEMC?
  16. -----------------
  17.  
  18. TEMC is an editor macro compiler for the Turbo Pascal for Windows IDE.
  19. It processes a script file that defines editor macros and key bindings
  20. and produces a command file that is read by the IDE to define the effects
  21. of keyboard commands in the editor.
  22.  
  23. Anytime the IDE is set to use the Alternate Command Set (using menu
  24. item <Options><Preferences><Command Set>, it looks for a file called
  25. TPWALT.CMD in the same directory as the program file, TPW.EXE.  If this
  26. command file is found, its contents are read into memory to replace the
  27. default editor key bindings.
  28.  
  29. The file TPWALT.TEM contains the factory default macro definitions
  30. and key bindings that are built into the IDE editor. It serves as an
  31. example script, as well as a base from which to customize the editor.
  32.  
  33.  
  34. 2.  The TEMC command line
  35. -------------------------
  36.  
  37. TEMC is invoked from the DOS command line using
  38.  
  39.   temc [-c] <script file> <command file>
  40.  
  41. The extension of the script file is assumed to be .TEM if it is not
  42. specified. The command file need not exist. It will be created if it does
  43. not. The optional -c switch can also be specified as /c, and can
  44. appear in any argument position on the command line. If it appears, it
  45. specifies that any existing commands the command file are to
  46. be thrown away before processing the script file. When -c is not used,
  47. the key bindings in the script file are merged with those already
  48. defined in the command file.
  49.  
  50.  
  51. 3.  TEMC syntax
  52. ---------------
  53.  
  54. Comments are in C style /* ... */ pairs.
  55.  
  56. A statement defines either a named macro or a key binding.
  57.  
  58. The syntax to define a macro is
  59.  
  60.  MACRO <macroname> <command1>; [ <command2>; ... ] END;
  61.  
  62. Spaces and newlines are optional. The macroname can consist of anything
  63. that is a legal symbol in C. Note, that unlike C, TEMC's language is
  64. case insensitive. A command can be either the name of another macro
  65. that has already been defined, or an editor command that has been
  66. predefined in TEMC. A list of those and what they do is below.
  67.  
  68. Some of the predefined editor commands have a syntax that looks like
  69. a C function call with one argument, for example
  70.  
  71.   SetMark(5);
  72.  
  73. Depending on the command, the argumenmt is either a decimal integer constant,
  74. a character constant, or a string literal. All are specified using C syntax.
  75.  
  76. Here's an example of a macro definition from the TPWALT.TEM file:
  77.  
  78. MACRO    MacPageUp
  79.         FixScreenPos;
  80.         PageUp;
  81.         FixCursorPos;
  82. END;
  83.  
  84. The syntax to define a key binding is:
  85.  
  86.  <key-sequence>: <command>;
  87.  
  88. or
  89.  
  90.  <key-sequence>: BEGIN <command1>; [ <comand2>; ... ] END;
  91.  
  92. The <key-sequence> is either a key, which is a character optionally
  93. preceded by "ctrl-" (not in quotes), or a series of keys
  94. separated by the character "+". Note that the specification of the
  95. key characters themselves is case sensitive, e.g. ctrl-k+B is different
  96. than ctrl-k+b, even though the latter is the same as CTRL-K+b.
  97.  
  98. Any key in a sequence, other than the first one may be preceded by
  99. one of the characters "^" or "@". The "^" indicates that any combination
  100. of case and ctrl can be used to type the key, i.e., lower case, upper
  101. case, or control characters. The "@" is used to indicate that the
  102. case does not matter for that character, although ctrl will not
  103. be accepted. For example, ctrl-k+b specifies a Ctrl-K followed by a
  104. lower case b. ctrl-k+^b specifies a ctrl-K followed by any of b, B,
  105. or ctrl-B. ctrl-k+@b specifies ctrl-K followed by either b or B.
  106.  
  107. Whitespace is allowed between the key-sequence and the ":".
  108.  
  109. Each <command> can be either the name of a previously defined macro,
  110. or one of the predefined editor commands listed below.
  111.  
  112.  
  113.  
  114. 4.  Predefined editor commands
  115. ------------------------------
  116.  
  117. The following is the list of all editor commands that are predefined in
  118. TEMC. TEMC allows you to use built-in editor commands and user-defined
  119. macros as commands within macros interchangeably, as long as you do not
  120. create any loops by having two macros calling each other, even via
  121. intermediate macros. Note that some commands cause an escape from the
  122. editor to the surrounding IDE. There is no provision for returning
  123. control to the editor once that is done. Thus, if one of those
  124. commands is part of a macro, it must be the last command in the
  125. macro. TEMC will produce an error message if a macro definition
  126. violates this restriction. Commands that cause an escape from the
  127. editor are grouped at the end of the following list.
  128.  
  129.  
  130.  TEMC editor command name          What it causes the editor to do
  131.  ------------------------    -------------------------------
  132.  
  133.  BackspaceDelete        Delete the character before the cursor
  134.  
  135.  BottomOfScreen            Move cursor to the bottom line
  136.                 currently displayed in the window,
  137.                 leaving column unchanged
  138.  
  139.  CenterFixScreenPos        Adjust the screen display to ensure that the
  140.                 cursor location is visible. If any adjustment
  141.                 is necessary, adjust the display so the cursor
  142.                 is close to being centered in the window.
  143.  
  144.  CursorCharLeft            Move cursor left over one character.
  145.                 This will skip over a tab character and
  146.                 will move to the end of the previous
  147.                 line from the beginning of a line.
  148.  
  149.  CursorCharRight        Move cursor right over one character.
  150.                 This will skip over a tab character and
  151.                 will advance to the beginning of the next
  152.                 line from the end of a line.
  153.  
  154.  CursorDown            Move cursor down one row
  155.  
  156.  CursorLeft            Move cursor left one screen column
  157.  
  158.  CursorRight            Move cursor right one screen column
  159.  
  160.  CursorUp            Move cursor up one row
  161.  
  162.  CursorSwitchedLeft        Like CursorLeft, but pays attention to
  163.                 Cursor Through Tab option setting
  164.  
  165.  CursorSwitchedRight        Like CursorRight, but pays attention to
  166.                 Cursor Through Tab option setting
  167.  
  168.  DeleteChar            Delete the character at the current
  169.                 cursor location
  170.  
  171.  DeleteLine            Delete the current line
  172.  
  173.  DeleteToEOL            Delete from the current column to the end
  174.                 of the current line
  175.  
  176.  DeleteWord            Delete from cursor to beginning of next word
  177.  
  178.  EndCursor            Move cursor to end of file buffer
  179.  
  180.  FixCursorPos            Insure that cursor value specifies a
  181.                 row between 1 and the number of lines in
  182.                 the buffer, a column greater than 0, and
  183.                 that if the cursor through tabs option is
  184.                 not set, that it is not placed in the
  185.                 middle of a tab character.
  186.  
  187.  FixScreenPos            Adjust the screen display to ensure that the
  188.                 cursor location is visible
  189.  
  190.  FullPaintScreen        Redraw the entire window, making no
  191.                 assumptions about what is on the screen
  192.  
  193.  HomeCursor            Move cursor to beginning of file buffer
  194.  
  195.  IndentBlock            Insert a space at the beginning of each
  196.                 line in the selected text.
  197.  
  198.  InsertText            Called using the syntax InsertText("string")
  199.                 Inserts the literal "string" in the buffer
  200.                 at the current cursor location.
  201.  
  202.  LeftOfLine            Move cursor to beginning of current line
  203.  
  204.  LiteralChar            Called using the syntax LiteralChar('c'),
  205.                 where 'c' is a character or integer value.
  206.                 Inserts the character at the current cursor
  207.                 location, without doing any special processing
  208.                 for newline, tab characters, etc.
  209.  
  210.  MarkBufModified        Set a flag indicating that the contents
  211.                 of the buffer are different than what is
  212.                 in the corresponding disk file
  213.  
  214.  MarkBufUnmodified        Clear a flag, thus indicating that the
  215.                 contents of the buffer can be assumed
  216.                 to be identical to what is in the disk file
  217.  
  218.  MatchPairBackward        Same as MatchPairForward, except that if the
  219.                 cursor is on a ' or " then search backward
  220.                 for the matching one.
  221.  
  222.  MatchPairForward         If the cursor is on one of the characters
  223.                 (, ), {, }, [, ], or on the first character
  224.                 of one of the pairs (*, *), (. or .), then
  225.                 search in the appropriate direction for the
  226.                 closest instance of the matching delimiter.
  227.                 If the cursor is on the character ' or ",
  228.                 then search forward for the matching one.
  229.                 If a match is found, place the cursor there.
  230.  
  231.  MoveToMark            Called using the syntax MoveToMark(n),
  232.                 where "n" is a one digit number, 0-9.
  233.                 Moves the cursor to the location saved with
  234.                 SetMark(n) command.
  235.  
  236.  MoveToTempPos            Move the cursor to the saved temporary marker.
  237.  
  238.  OutdentBlock            Delete a leading space from the beginning
  239.                 of each    line in the selected text
  240.                 that begins with a space.
  241.  
  242.  PageScreenDown            Scroll screen down by number of lines in the
  243.                 window, leaving cursor position unchanged
  244.  
  245.  PageScreenUp            Scroll screen up by number of lines in the
  246.                 window, leaving cursor position unchanged
  247.  
  248.  PaintScreen            Redraw the entire window, assuming that
  249.                 the screen still correctly displays what
  250.                 the editor last drew on it
  251.  
  252.  PageDown            Move cursor down by number of lines in
  253.                 the window
  254.  
  255.  PageUp                Move cursor up by number of lines in
  256.                 the window
  257.  
  258.  ReDo                Perform an Redo operation. Exactly what
  259.                 happens depends on the option settings
  260.  
  261.  RightOfLine            Move cursor to end of current line
  262.  
  263.  RightOfWord            Move cursor to the next column that follows
  264.                 the end of a word
  265.  
  266.  ScrollScreenDown        Scroll screen down one line, leaving cursor
  267.                 position unchanged
  268.  
  269.  ScrollScreenUp            Scroll screen up one line, leaving cursor
  270.                 position unchanged
  271.  
  272.  SetMark            Called using the syntax SetMark(n),
  273.                 where "n" is one digit number, 0-9.
  274.                 Sets a marker to point to the character at
  275.                 the current cursor location, so a later
  276.                 MoveToMark(n) comand can restore the cursor
  277.  
  278.  SetTempPos            Save the cursor location in a temporary
  279.                 marker that may be used by some internal
  280.                 editor commands. This is not usually practical
  281.                 to use in user-defined macros, which should
  282.                 instead use SetMark.
  283.  
  284.  SmartRefreshScreen        Redraw the window, skipping any portions
  285.                 that the editor is sure are unmodified
  286.                 since it was last drawn.
  287.  
  288.  SmartTab            Insert space and/or tab characters in
  289.                 accordance with the current settings of
  290.                 the Use Tab Char option, and Tab Width
  291.  
  292.  ToggleInsert            Toggle state of insert/overwrite option
  293.  
  294.  TopOfScreen            Move cursor to the top line
  295.                 currently displayed in the window,
  296.                 leaving column unchanged
  297.  
  298.  UnDo                Perform an Undo operation. Exactly what
  299.                 happens depends on the option settings
  300.  
  301.  WordLeft            Move cursor to beginning of previous word,
  302.                 or to end of previous line, whichever is
  303.                 found first
  304.  
  305.  WordRight            Move cursor to beginning of next word,
  306.                 or to the end of a line, whichever is
  307.                 found first
  308.  
  309.  
  310. The following commands cause an exit from the editor, and so can
  311. only appear as the last command of a macro:
  312.  
  313.  
  314.  ClipClear                  Delete selected text
  315.  
  316.  ClipCopy                   Copy selected text to clipboard
  317.  
  318.  ClipCut                    Cut selected text to clipboard
  319.  
  320.  ClipPaste                  Paste clipboard into buffer at cursor
  321.  
  322.  CompilerOptions        Insert the current compiler options at the
  323.                 start of the edit buffer
  324.  
  325.  GetFindString            Open a dialog for a text search operation
  326.  
  327.  QuoteChar            Next control character typed by user will
  328.                 be directly inserted into buffer
  329.  
  330.  ReadBlock            Open dialog requesting a file name
  331.                 which will be read into the buffer
  332.                 at the cursor location
  333.  
  334.  RepeatSearch            Search again, using previous parameters
  335.  
  336.  Replace            Open an dialog for a search/replace operation
  337.  
  338.  SaveFile            Save current editor buffer
  339.  
  340.  ShiftOff            Turn off text selection mode and clear
  341.                 current block, if any
  342.  
  343.  ShiftOffWithCopy        Copy current block to clipboard and turn
  344.                 off text selection mode
  345.  
  346.  ShiftOffWithCut        Cut current block to clipboard and turn
  347.                 off text selection mode
  348.  
  349.  ShiftOn            Turn on text selection mode
  350.  
  351.  ShowLastError            Redisplay the last compiler error reported
  352.  
  353.  ToggleAutoIndent        Toggle the state of the Auto Indent option
  354.  
  355.  ToggleAutoOutdent        Toggle the state of the Backspace Unindents
  356.                 option
  357.  
  358.  ToggleCursorThroughTabMode    Toggle the state of the Cursor Through Tabs
  359.                 option
  360.  
  361.  ToggleOptimalFillMode        Toggle state of Optimal Fill option
  362.  
  363.  ToggleTabbingMode        Toggle state of Use Tab Char option
  364.  
  365.  WriteBlock            Open dialog requesting a file name to
  366.                 which the selected text will be written
  367.  
  368.