home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft_Programmers_Library.7z / MPL / common / msedit.txt < prev    next >
Encoding:
Text File  |  2013-11-08  |  467.4 KB  |  12,078 lines

  1.  Microsoft Editor User's Guide for MS OS/2 and MS-DOS Operating Systems
  2.  
  3.  MICROSOFT CORPORATION Information in this document is subject to change
  4.  without notice and does not represent a commitment on the part of Microsoft
  5.  Corporation. The software described in this document is furnished under a
  6.  license agreement or nondisclosure agreement. The software may be used or
  7.  copied only in accordance with the terms of the agreement. It is against the
  8.  law to copy the software on any medium except as specifically allowed in the
  9.  license or nondisclosure agreement. No part of this manual may be reproduced
  10.  or transmitted in any form or by any means, electronic or mechanical,
  11.  including photocopying and recording, for any purpose without the express
  12.  written permission of Microsoft.
  13.  
  14.  (c)Copyright Microsoft Corporation, 1987-1989. All rights reserved.
  15.  Simultaneously published in the U.S. and Canada.
  16.  
  17.  Printed and bound in the United States of America.
  18.  
  19.  Microsoft, MS, MS-DOS, CodeView, and XENIX are registered trademarks of
  20.  Microsoft Corporation.
  21.  
  22.  BRIEF is a registered trademark of UnderWare, Inc.
  23.  
  24.  Epsilon is a trademark of Lugaru Software, Ltd.
  25.  
  26.  IBM is a registered trademark of International Business Machines
  27.  Corporation.
  28.  
  29.  Tandy is a registered trademark of Tandy Corporation.
  30.  
  31.  UNIX is a registered trademark of American Telephone and Telegraph Company.
  32.  
  33.  WordStar is a registered trademark of MicroPro International Corporation.
  34.  
  35.  Document No. LN0801B-500-R00-0889
  36.  Part No. 07823
  37.  10 9 8 7 6 5 4 3 2 1
  38.  
  39.  
  40.  Table of Contents
  41.  ───────────────────────────────────────────────────────────────────────────
  42.  
  43.  Chapter 1  Introduction
  44.  Chapter 2  Edit Now
  45.  Chapter 3  Command Syntax
  46.  Chapter 4  A Survey of the Editor's Commands
  47.  Chapter 5  Regular Expressions
  48.  Chapter 6  Function Assignments and Macros
  49.  Chapter 7  Switches, Assignments, and the TOOLS.INI File
  50.  Chapter 8  Programming C Extensions
  51.  Chapter 9  C-Extension Functions
  52.  
  53.  Appendixes
  54.  Appendix A  Reference Tables
  55.  Appendix B  Support Programs for the Microsoft Editor
  56.  Appendix C  Microsoft Editor Messages
  57.  
  58.  Glossary
  59.  
  60.  Index
  61.  
  62.  
  63.  Table of Contents Overview
  64.  ───────────────────────────────────────────────────────────────────────────
  65.  
  66.  Chapter 1  Introduction
  67.  1.1  Editing Capabilities
  68.  1.2  System Requirements
  69.  1.3  Using This Manual
  70.  1.4  Introducing the Microsoft(R) Editor
  71.  1.5  Document Conventions
  72.  
  73.  Chapter 2  Edit Now
  74.  2.1  Starting the Editor
  75.  2.2  The Microsoft Editor's Screen
  76.  2.3  Sample Session
  77.        2.3.1  Inserting Text with the Insertmode Function
  78.        2.3.2  Removing Text with the Delete Function
  79.        2.3.3  Using the Arg Function to Specify Text
  80.        2.3.4  Canceling and Undoing Commands
  81.        2.3.5  Using Delete to Move Text
  82.        2.3.6  Finding Strings with the Psearch Function
  83.        2.3.7  Inserting Spaces and Lines
  84.        2.3.8  Exiting the Editor
  85.  2.4  Getting Help
  86.        2.4.1  Starting On-Line Help
  87.        2.4.2  Moving through On-Line Help
  88.        2.4.3  Leaving On-Line Help
  89.  2.5  The Microsoft Editor's Command Line
  90.  2.6  Hints for Using the Editor
  91.  
  92.  Chapter 3  Command Syntax
  93.  3.1  Entering a Command
  94.  3.2  Naming Conventions for Functions
  95.  3.3  Argument Types
  96.  3.4  Text Arguments (numarg, markarg, textarg)
  97.        3.4.1  The numarg Type
  98.        3.4.2  The markarg Type
  99.        3.4.3  The textarg Type
  100.  3.5  Highlighting a Text Argument
  101.  3.6  Cursor-Movement Arguments (linearg, boxarg, streamarg)
  102.        3.6.1  The linearg Type
  103.        3.6.2  The boxarg Type
  104.        3.6.3  The streamarg Type
  105.  
  106.  Chapter 4  A Survey of the Editor's Commands
  107.  4.1  Basic File Operations
  108.        4.1.1  File Commands
  109.        4.1.2  Special Syntax for Setfile
  110.        4.1.3  Pseudo Files
  111.  4.2  Moving through a File
  112.        4.2.1  Scrolling at the Screen's Edge
  113.        4.2.2  Scrolling a Page at a Time
  114.        4.2.3  Moving to the Top or Bottom of the File
  115.        4.2.4  Other File-Navigation Functions
  116.  4.3  Inserting, Copying, and Deleting Text
  117.        4.3.1  Inserting and Deleting Text
  118.        4.3.2  Copying Text
  119.        4.3.3  Other Insert Commands
  120.        4.3.4  Reading a File into the Current File
  121.  4.4  Using File Markers
  122.        4.4.1  Functions That Use Markers
  123.        4.4.2  Related Functions: Savecur and Restcur
  124.  4.5  Searching and Replacing
  125.        4.5.1  Searching for a Pattern of Text
  126.        4.5.2  Searching the File Globally
  127.        4.5.3  Searching a Series of Files
  128.        4.5.4  Search-and-Replace Functions
  129.  4.6  Compiling
  130.        4.6.1  Invoking Compilers and Other Utilities
  131.        4.6.2  Viewing Error Output
  132.        4.6.3  Viewing the Dynamic-Compile Log
  133.  4.7  Using Editing Windows
  134.  4.8  Working with Multiple Files
  135.  4.9  Printing a File
  136.  
  137.  Chapter 5  Regular Expressions
  138.  5.1  Choosing the Syntax
  139.  5.2  UNIX(R) Regular-Expression Syntax
  140.        5.2.1  UNIX Regular Expressions as Simple Strings
  141.        5.2.2  UNIX Special Characters
  142.        5.2.3  Combining UNIX Special Characters
  143.        5.2.4  Tagged Expressions in the UNIX Search String
  144.        5.2.5  Tagged Expressions in the UNIX Replacement String
  145.  5.3  M 1.0 Regular-Expression Syntax
  146.        5.3.1  M 1.0 Regular Expressions as Simple Strings
  147.        5.3.2  M 1.0 Special Characters
  148.        5.3.3  Combining M 1.0 Special Characters
  149.        5.3.4  M 1.0 Matching Method
  150.        5.3.5  Tagged Expressions in the M 1.0 Search String
  151.        5.3.6  Tagged Expressions in the M 1.0 Replacement String
  152.        5.3.7  Predefined M 1.0 Regular Expressions
  153.  
  154.  Chapter 6  Function Assignments and Macros
  155.  6.1  The Four Techniques for Customizing the Editor
  156.  6.2  Assigning Functions to Keystrokes
  157.        6.2.1  Making Function Assignments
  158.        6.2.2  Viewing and Changing Function Assignments
  159.        6.2.3  Disabling a Keystroke
  160.        6.2.4  Making a Keystroke Literal
  161.  6.3  Creating Macros within the Editor
  162.        6.3.1  Recording a Macro
  163.        6.3.2  Entering a Macro Directly
  164.        6.3.3  Building the Macro List
  165.        6.3.4  Executing a Macro List Directly
  166.        6.3.5  Building Macros from Other Macros
  167.        6.3.6  Handling Prompts within Macros
  168.        6.3.7  Macros That Take Arguments
  169.        6.3.8  Macros That Use Conditionals
  170.  
  171.  Chapter 7  Switches, Assignments, and the TOOLS.INI File
  172.  7.1  Syntax for Switch Settings
  173.  7.2  Using Switches to Configure the Editor
  174.        7.2.1  Changing Start-Up Conditions
  175.        7.2.2  Changing Scrolling Behavior
  176.        7.2.3  Setting Screen Colors with fgcolor
  177.        7.2.4  Setting Colors for Other Parts of the Screen
  178.        7.2.5  Changing the Look and Feel of Help
  179.        7.2.6  Controlling Use of Tabs
  180.        7.2.7  Changing How the Editor Handles Trailing Spaces
  181.        7.2.8  Changing Screen Height
  182.  7.3  Special Syntax for Text Switches
  183.        7.3.1  Special Syntax for extmake and readonly
  184.        7.3.2  Special Syntax for load, markfile, and helpfiles
  185.  7.4  Sample TOOLS.INI File
  186.  7.5  The Structure of the TOOLS.INI File
  187.        7.5.1  Creating Sections with Tags
  188.        7.5.2  Using Comments
  189.        7.5.3  Line Continuation
  190.        7.5.4  Assignments and Macros
  191.  7.6  Configuring On-Line Help
  192.        7.6.1  Controlling Search Order
  193.        7.6.2  Default Help File Search
  194.  
  195.  Chapter 8  Programming C Extensions
  196.  8.1  Requirements
  197.  8.2  How C Extensions Work
  198.  8.3  Writing a C Extension
  199.        8.3.1  Required Objects
  200.        8.3.2  The Switch Table
  201.        8.3.3  The Command Table
  202.        8.3.4  The WhenLoaded Function
  203.        8.3.5  Defining the Editing Function
  204.  8.4  Programming Your Function
  205.        8.4.1  Getting a File Handle
  206.        8.4.2  Interpreting the User-Defined Argument
  207.        8.4.3  The NOARG Type
  208.        8.4.4  The NULLARG Type
  209.        8.4.5  The TEXTARG Type
  210.        8.4.6  The LINEARG Type
  211.        8.4.7  The STREAMARG Type
  212.        8.4.8  The BOXARG Type
  213.        8.4.9  Modifying the Current File
  214.  8.5  Compiling and Linking
  215.        8.5.1  Compiling and Linking for Real Mode
  216.        8.5.2  Compiling and Linking for Protected Mode
  217.        8.5.3  Loading Your Extension
  218.  8.6  A C-Extension Sample Program
  219.  8.7  Calling Library Functions
  220.  
  221.  Chapter 9  C-Extension Functions
  222.  AddFile
  223.  BadArg
  224.  CopyBox
  225.  CopyLine
  226.  CopyStream
  227.  DelBox
  228.  DelFile
  229.  DelLine
  230.  DelStream
  231.  Display
  232.  DoMessage
  233.  fExecute
  234.  FileLength
  235.  FileNameToHandle
  236.  FileRead
  237.  FileWrite
  238.  GetCursor
  239.  GetLine
  240.  KbHook
  241.  KbUnHook
  242.  MoveCur
  243.  pFileToTop
  244.  PutLine
  245.  ReadChar
  246.  ReadCmd
  247.  RemoveFile
  248.  Replace
  249.  SetKey
  250.  
  251.  Appendix A  Reference Tables
  252.  A.1  Categories of Editing Functions
  253.  A.2  Key Assignments for Editing Functions
  254.  A.3  Comprehensive Listing of Editing Functions
  255.  A.4  Return Values of Editing Functions
  256.  A.5  Editor Switches
  257.  
  258.  Appendix B  Support Programs for the Microsoft Editor
  259.  B.1  UNDEL.EXE
  260.  B.2  EXP.EXE
  261.  
  262.  Appendix C  Microsoft Editor Messages
  263.  C.1  Messages Starting with Placeholders
  264.  C.2  Other Messages
  265.  
  266.  Glossary
  267.  
  268.  Index
  269.  
  270.  
  271.  Listing of Tables
  272.  
  273.  Table 5.1  Predefined Expressions
  274.  Table 6.1  Macro Conditionals
  275.  Table 7.1  Colors and Numeric Values
  276.  Table 8.1  Meaning of cmdTable Flags
  277.  Table 8.2  Summary of Extension Functions by Category
  278.  Table A.1  Summary of Editing Functions by Category
  279.  Table A.2  Function Assignments
  280.  Table A.3  Comprehensive List of Functions
  281.  Table A.4  Editor Functions and Return Values
  282.  Table A.5  Editor Switches
  283.  
  284.  
  285.  Chapter 1  Introduction
  286.  ───────────────────────────────────────────────────────────────────────────
  287.  
  288.  The Microsoft(R) Editor is the first full-screen editor to run under both
  289.  OS/2 systems and DOS (Versions 2.1 and above). You can use the editor to
  290.  write programs, modify text files, and, under OS/2, run language translators
  291.  and other utilities in the background.
  292.  
  293.  The Microsoft Editor was specially developed as a programmer's editor. It
  294.  offers an unsurpassed ability to work efficiently with many different files
  295.  in different directories, to interact with the environment, and to undo or
  296.  redo a whole series of commands. As a programmer, you can work faster and
  297.  more efficiently by using some of these features:
  298.  
  299.    ■  Compile and link programs from within the editor
  300.  
  301.       Improve your productivity. The Microsoft Editor is more than a text
  302.       editor; it is a development environment. Develop programs more quickly
  303.       by compiling from within the editor. If the compilation fails, view the
  304.       errors, rewrite the program, and recompile──all without leaving the
  305.       editor.
  306.  
  307.    ■  Create new editing functions in C or assembly language
  308.  
  309.       Extend the editor's power by writing new functions. If you know how to
  310.       program in C or assembly language, you can quickly learn how to write
  311.       new modules for the Microsoft Editor. These modules involve no
  312.       preprocessing; they become part of the editor itself and therefore run
  313.       as fast as standard editing commands.
  314.  
  315.    ■  Customize the editor to suit your needs
  316.  
  317.       Control how the editor behaves. The editor uses a special
  318.       initialization file, TOOLS.INI, in which you can easily specify your
  319.       own preferences for function keystrokes, screen colors, tabs, margins,
  320.       and many other kinds of editor behavior. You can even specify
  321.       preferences specific to type of file so that as you move between .C and
  322.       .FOR files, the editor alters its settings.
  323.  
  324.  This manual is a substantial revision of the Microsoft Editor User's Guide
  325.  for Version 1.0 of the editor. This manual has an expanded index, more
  326.  examples, detailed instructions for configuring the editor, and complete
  327.  documentation for writing editing functions in C.
  328.  
  329.  A Note about Operating-System Terms
  330.  
  331.  Microsoft documentation uses the term "OS/2" to refer to the OS/2
  332.  systems──Microsoft Operating System/2 (MS(R) OS/2) and IBM(R) OS/2.
  333.  Similarly, the term "DOS" refers to both the MS-DOS(R) and IBM Personal
  334.  Computer DOS operating systems. The name of a specific operating system is
  335.  used when it is necessary to note features unique to that system.
  336.  
  337.  
  338.  1.1  Editing Capabilities
  339.  
  340.  Not only can the editor be customized, but it also supports many powerful
  341.  editing features:
  342.  
  343.    ■  Use a full range of file-editing commands
  344.  
  345.       The editor supports a comprehensive range of file operations. You can
  346.       load, merge, or save files, with or without exiting. You can execute
  347.       the DOS or OS/2 shell, send highlighted areas to the printer, or insert
  348.       program output directly into a file. The editor also supports a wide
  349.       range of pattern-search and replacement functions.
  350.  
  351.    ■  Save time with powerful block operations
  352.  
  353.       You can manipulate different kinds of text blocks. For example, you can
  354.       insert or delete ordinary sequences of characters between two file
  355.       positions. You can also insert or delete rectangular areas, called
  356.       "boxes." Box-shaped regions are highly useful for indenting paragraphs
  357.       or moving columns of text.
  358.  
  359.    ■  Save typing effort with macros
  360.  
  361.       The Microsoft Editor includes a convenient macro language. A macro is a
  362.       command that performs a series of predefined actions; for example, a
  363.       macro can insert a given phrase or word or perform an entire series of
  364.       editing commands. Define a macro, then invoke it with one keystroke.
  365.  
  366.    ■  Edit complex files with windows
  367.  
  368.       When editing a large file, you may want to view different parts of the
  369.       file simultaneously. With the Microsoft Editor, you can split up your
  370.       screen into as many as eight windows──each displaying a different part
  371.       of the file (or parts of different files).
  372.  
  373.    ■  Handle multiple source files
  374.  
  375.       A simple command switches you among the files you are working on──you
  376.       never have to leave the editor and start it up again to work on a
  377.       different file. As the editor moves between files, it saves the last
  378.       cursor position and other relevant information.
  379.  
  380.  
  381.  1.2  System Requirements
  382.  
  383.  To use the Microsoft Editor, you need OS/2 1.0 or DOS 2.1 or later and at
  384.  least 128 kilobytes (K) of available memory. A minimum of 150K of available
  385.  memory is required to use the C extensions described in Chapter 8.
  386.  
  387.  
  388.  1.3  Using This Manual
  389.  
  390.  The following list gives the chapter or section you should read to learn
  391.  about a particular topic:
  392.  
  393. ╓┌────────────────────────────────────┌──────────────────────────────────────╖
  394.  Topic                                Chapter or Section
  395.  
  396.  Using the editor right away          Chapter 2, "Edit Now"
  397.  
  398.  Starting the editor using options    Section 2.5, "The Microsoft
  399.  and file names                       Editor's Command Line"
  400.  
  401.  Topic                                Chapter or Section
  402.  
  403. 
  404.  Entering arguments to editing        Chapter 3, "Command Syntax"
  405.  functions
  406.  
  407.  Using the most common editing        Chapter 4, "A Survey of the
  408.  commands, including file             Editor's Commands"
  409.  operations, compiling, and
  410.  windows
  411.  
  412.  Using regular expressions with       Chapter 5, "Regular Expressions"
  413.  the editor
  414.  
  415.  Customizing the editor by            Chapter 6, "Function Assignments
  416.  changing function-to-key             and Macros," and Chapter 7,
  417.  assignments and basic conditions,    "Switches, Assignments, and the
  418.  such as screen colors                TOOLS.INI File"
  419.  
  420.  Writing new editing functions in     Chapter 8, "Programming C
  421.  C or assembly language               Extensions," and Chapter 9,
  422.  Topic                                Chapter or Section
  423.  
  424. C or assembly language               Extensions," and Chapter 9,
  425.                                       "C-Extension Functions"
  426.  
  427.  Getting quick reference to           Appendix A, "Reference Tables,"
  428.  commands and switches                and the index
  429.  
  430.  Using the accompanying utilities:    Appendix B, "Support Programs for
  431.  UNDEL and EXP                        the Microsoft Editor"
  432.  
  433.  
  434.  
  435.  1.4  Introducing the Microsoft(R) Editor
  436.  
  437.  You'll find the Microsoft Editor easy to use once you understand the
  438.  function-argument model it uses for executing commands. Each command
  439.  consists of a function that may or may not be given input in the form of an
  440.  "argument."
  441.  
  442.  The Microsoft Editor uses a "reverse Polish" command structure. That is, you
  443.  specify the argument first, then give the command function. For example, if
  444.  you want to load a file, you first specify the file name, then invoke the
  445.  file loading function.
  446.  
  447.  All Microsoft Editor functions work in this fashion. This arrangement is
  448.  different from that of conventional editors where you would choose the file
  449.  loading function first, then specify the desired file. This "argument first,
  450.  function second" sequence gives the Microsoft Editor unique advantages:
  451.  
  452.    ■  A single function can process different types of arguments, such as
  453.       high-lighted blocks of text, a word or number typed on the dialog line,
  454.       or the word at the current cursor position. Almost all functions work
  455.       with all data types, so there aren't too many arbitrary details to
  456.       memorize.
  457.  
  458.    ■  It's easy to write macros because almost every action can be expressed
  459.       as a function name. Macros are likewise easy to understand──you won't
  460.       have trouble understanding another person's macro, or a macro you wrote
  461.       six months ago.
  462.  
  463.  Function names follow a consistent pattern. For example, functions that
  464.  involve forward movement usually start with P (for "plus"). Functions that
  465.  involve backward movement usually start with M (for "minus").
  466.  
  467.  Before using the Microsoft Editor, run the installation program for your
  468.  Microsoft language product. The installation program sets up the powerful
  469.  on-line Help, which provides on-line information for editing functions and
  470.  the standard C library. It is recommended that you select the default
  471.  keystroke configuration in order to work through the early chapters of this
  472.  manual.
  473.  
  474.  ───────────────────────────────────────────────────────────────────────────
  475.  NOTE
  476.     If you choose to customize the Microsoft Editor during installation, its
  477.     function-key assignments will match those of BRIEF(R), Epsilon(TM), or
  478.     the Microsoft "Quick" Environment. This book describes the uncustomized
  479.     version of the Microsoft Editor, so the commands described will not
  480.     always match those on your version of the editor.
  481.  ───────────────────────────────────────────────────────────────────────────
  482.  
  483.  
  484.  1.5  Document Conventions
  485.  
  486.  The following document conventions are used throughout this manual and apply
  487.  in particular to syntax displays for commands and switches:
  488.  
  489. ╓┌──────────────────────────────┌────────────────────────────────────────────╖
  490.  Example of
  491.  Convention                     Description
  492.  
  493.  AddFile                        Boldface type always marks
  494.                                 standard features of programming
  495.                                 languages (keywords, operators,
  496.                                 and functions) and editor
  497.                                 switches.
  498.  
  499.  $INIT: tools.ini               This font is used to indicate all
  500.                                 example programs, user input, and
  501.                                 screen output.
  502.  
  503.  placeholders                   Words in italics indicate a
  504.                                 Microsoft Editor function, a
  505.                                 field, or a general kind of
  506.  Example of
  507.  Convention                     Description
  508.  
  509.                                field, or a general kind of
  510.                                 information; you must supply the
  511.                                 particular value. For example,
  512.                                 numarg represents a numerical
  513.                                 argument that you type in from
  514.                                 the keyboard. You could type in a
  515.                                 number, such as 15, but you would
  516.                                 not type in the word"numarg"
  517.                                 itself.
  518.  
  519.  Repeating elements...          Three dots following an item
  520.                                 indicate more items having the
  521.                                 same form may appear.
  522.  
  523.  Program                        A column of three dots tells you
  524.      .                          part of a program has been
  525.      .                          intentionally omitted.
  526.      .
  527.  Example of
  528.  Convention                     Description
  529.  
  530.     .
  531.  Fragment
  532.  
  533.  SHIFT                          Names of keys on the keyboard
  534.                                 appear in small capital letters.
  535.                                 Notice that a plus (+) indicates
  536.                                 a combination of keys. For
  537.                                 example, CTRL+E means to hold
  538.                                 down the CTRL key while pressing
  539.                                 the E key.
  540.  
  541.                                 The names of the keys in this
  542.                                 manual correspond to the key
  543.                                 names printed on the IBM Personal
  544.                                 Computer keyboard. If you are
  545.                                 using a different machine, these
  546.                                 keys may have slightly different
  547.                                 names.
  548.  Example of
  549.  Convention                     Description
  550.  
  551.                                names.
  552.  
  553.                                 The cursor-movement keys
  554.                                 (sometimes called "arrow" keys)
  555.                                 located on the numeric keypad to
  556.                                 the right of the main keypad are
  557.                                 called the DIRECTION keys.
  558.                                 Individual DIRECTION keys are
  559.                                 called either by the direction of
  560.                                 the arrow on the key top (LEFT,
  561.                                 RIGHT, UP, DOWN) or the name on
  562.                                 the key top (PGUP, PGDN).
  563.  
  564.                                 Some of the Microsoft Editor's
  565.                                 functions use the +, -, or number
  566.                                 keys on the numeric keypad rather
  567.                                 than the ones on the top row of
  568.                                 the main keyboard. At each
  569.  Example of
  570.  Convention                     Description
  571.  
  572.                                the main keyboard. At each
  573.                                 instance, the text notes the use
  574.                                 of keys from the numeric keypad.
  575.  
  576.                                 The carriage-return key,
  577.                                 sometimes unnamed but marked with
  578.                                 a bent arrow, is called the ENTER
  579.                                 key.
  580.  
  581.  "Commands"                     The first time a new term is
  582.                                 defined, it is enclosed in
  583.                                 quotation marks.
  584.  
  585.  
  586.  
  587.  Chapter 2  Edit Now
  588.  ───────────────────────────────────────────────────────────────────────────
  589.  
  590.  This chapter shows you how to use the Microsoft Editor right away by
  591.  focusing on the functions you need to create a simple text file. "Functions"
  592.  are built-in editing capabilities you invoke to perform actions. Most of the
  593.  chapter consists of a tutorial that uses a specific example and features the
  594.  following functions:
  595.  
  596.  Function                              Default Keystroke
  597.  
  598.  Cursor movement                       DIRECTION keys, HOME, END
  599.  
  600.  Insertmode                            INS
  601.  Delete                                DEL
  602.  Arg (introduce argument)              ALT+A
  603.  Cancel                                ESC
  604.  Undo                                  ALT+BKSP
  605.  Paste                                 SHIFT+INS
  606.  Psearch (forward search)              F3
  607.  Linsert (insert new line)             CTRL+N
  608.  Exit                                  F8
  609.  Help                                  F1
  610.  
  611.  You can use this tutorial either by starting the editor and typing in each
  612.  command as shown, or you can simply read along. Because the results are
  613.  explained at each stage, you can get a good understanding of the editor just
  614.  by reading.
  615.  
  616.  The chapter ends by presenting the complete command line for the editor with
  617.  all the possible options you may use, a complete list of items on the status
  618.  line, and some hints for learning the editor.
  619.  
  620.  
  621.  2.1  Starting the Editor
  622.  
  623.  Copy the file M.EXE into your current directory or a directory listed in the
  624.  PATH environment variable. To run the editor in OS/2 protected mode, copy
  625.  the file MEP.EXE. (You may want to rename the file as M.EXE.) Then start the
  626.  editor with this command:
  627.  
  628.       M NEW.TXT
  629.  
  630.  The Microsoft Editor responds by asking if you want to create a new file
  631.  with this name. Press Y to indicate yes. The editor creates the file and
  632.  places it in the current directory. You are now ready to enter text.
  633.  
  634.  ───────────────────────────────────────────────────────────────────────────
  635.  NOTE
  636.     If the editor cannot start correctly, it reports an error message. If you
  637.     receive an error message on start-up, consult the list of error messages
  638.     in Appendix C. This list of error messages provides explanations,
  639.     along with suggestions for solving the problem.
  640.  ───────────────────────────────────────────────────────────────────────────
  641.  
  642.  When you want to exit, press F8. Whenever you want to save your work without
  643.  exiting, type the following keystrokes:
  644.  
  645.       ALT+A  ALT+A  F2
  646.  
  647.  
  648.  2.2  The Microsoft Editor's Screen
  649.  
  650.  When starting the editor with a new file, you see a blank screen, as shown
  651.  in Figure 2.1 below.
  652.  
  653.  The cursor first appears at the upper-left corner of the screen. Even though
  654.  the file is empty, you can use the DIRECTION keys──denoted as UP, DOWN,
  655.  LEFT, and RIGHT──to move the cursor anywhere on the screen. (The DIRECTION
  656.  keys are the arrow keys on the numeric keypad. Newer keyboards may have an
  657.  additional set of arrow keys to the left of the numeric keypad.) Try
  658.  experimenting with cursor movement.
  659.  
  660.  ───────────────────────────────────────────────────────────────────────────
  661.  NOTE
  662.     The DIRECTION keys on the numeric keypad do not respond unless NUMLOCK is
  663.     off. Press the NUMLOCK key to toggle the numeric keypad lock on and off.
  664.  ───────────────────────────────────────────────────────────────────────────
  665.  
  666.  The next-to-bottom line is called the "dialog line," which is reserved for
  667.  displaying messages from the editor and letting you enter text arguments.
  668.  The bottom line is called the "status line." It always displays the
  669.  following fields:
  670.  
  671.  Field                       Description
  672.  
  673.  c:\m\new.txt                File name, with complete path
  674.  
  675.  (text)                      Type of file
  676.  
  677.  Length=1                    Length of file, in number of lines (minimum
  678.                              value is 1)
  679.  
  680.  Window=(1,1)                Window or cursor position
  681.  
  682.  
  683.  The field Window=(1,1) indicates that the upper-left corner of the screen
  684.  corresponds to the first row and column of the file. As you scroll through
  685.  files larger then one screen, the numbers in this field change. See Section
  686.  7.2.1, "Changing Start-Up Conditions," to learn how to alter this field
  687.  so that it displays cursor position instead of window position.
  688.  
  689.  
  690.  2.3  Sample Session
  691.  
  692.  Once the Microsoft Editor is started, you can enter text immediately. Simply
  693.  start typing and press ENTER when you want to begin a new line. By default,
  694.  the editor starts in "overtype" mode, which means that anything you type
  695.  replaces the text at the cursor position.The editor also has an "insert"
  696.  mode for adding new material without replacing the current text. Insert mode
  697.  is explained in the next section.
  698.  
  699.  To begin, type in the following text. There are some intentional errors
  700.  you'll correct in a few moments.
  701.  
  702.       It's mind over matter.
  703.       What is mind?
  704.       No mat matter.
  705.       Wh is matter?
  706.       Mever mind.
  707.  
  708.  The third, fourth, and fifth lines have errors near the beginning of each
  709.  line. To get to the beginning of the fifth line, you can press the LEFT key
  710.  until you move to the beginning of the line. However, you can get there
  711.  faster by pressing the HOME key. This key moves the cursor to the first
  712.  nonblank character in the line.
  713.  
  714.  Now move the cursor to the beginning of the fifth line and correct the error
  715.  by typing the letter N:
  716.  
  717.       Never mind.
  718.  
  719.  
  720.  2.3.1  Inserting Text with the Insertmode Function
  721.  
  722.  To insert text in this example, move the cursor to the third position in the
  723.  fourth line:
  724.  
  725.       Wh is matter?
  726.  
  727.  The letters at need to be inserted at the end of the first word. Press the
  728.  INS key to invoke the Insertmode function, which toggles between overtype
  729.  and insert mode. You'll see the word insert appear at the end of the status
  730.  line. Type the letters at to produce the following line:
  731.  
  732.       What is matter?
  733.  
  734.  To return to overtype mode, press INS again.
  735.  
  736.  
  737.  2.3.2  Removing Text with the Delete Function
  738.  
  739.  So far, you've used editing functions to replace old text and insert new
  740.  text. The third line requires text deletion, so move the cursor to the
  741.  beginning of the second word in the third line:
  742.  
  743.       No mat matter.
  744.  
  745.  Invoke the Delete function by pressing the DEL key. Each time you press the
  746.  DEL key, the character at the cursor position is erased.
  747.  
  748.  It is inconvenient to delete a large amount of text one character at a time.
  749.  The Delete function can also remove blocks of text that are specified as
  750.  arguments. The next section explains deleting a large block of text.
  751.  
  752.  
  753.  2.3.3  Using the Arg Function to Specify Text
  754.  
  755.  The Arg function is assigned to ALT+A; hold down the ALT key and press A to
  756.  invoke it. The Arg function does nothing by itself. Rather, it tells the
  757.  editor that you are about to introduce an argument that another function
  758.  will operate on. (An "argument" is input, such as text or highlighted
  759.  characters.)
  760.  
  761.  In this example you'll use the Arg function to highlight the group of
  762.  characters you wish to delete. After pressing ALT+A, move the cursor to the
  763.  beginning of the third word, as shown in Figure 2.2 below. Now press DEL,
  764.  and the high-lighted characters are removed.
  765.  
  766.  
  767.  2.3.4  Canceling and Undoing Commands
  768.  
  769.  If you pressed ALT+A at the wrong time but did not complete the command you
  770.  were typing, you can cancel the argument by pressing the ESC key. This
  771.  key-stroke invokes the Cancel function. The Cancel function lets you start a
  772.  command sequence over again.
  773.  
  774.  If you complete an incorrect command, reverse it by pressing ALT+BKSP (hold
  775.  down the ALT key and then press the backspace key). This keystroke invokes
  776.  the Undo function. If you invoke Undo again, it reverses the next-to-last
  777.  editing command. Invoke Undo a third time, and it reverses the
  778.  second-to-last editing command, and so on. The number of commands that the
  779.  editor remembers is controlled by the undocount switch. The default number
  780.  of commands remembered is 10. See Chapter 7, "Switches, Assignments, and
  781.  the TOOLS.INI File," for information on how to set switches.
  782.  
  783.  The Meta function (F9) is a prefix, similar to r Arg, which reverses or
  784.  alters the effect of a function. You can cancel the effect of the Undo
  785.  function with the command sequence MetaUndo:
  786.  
  787.       F9 ALT+BKSP
  788.  
  789.  This variation on the Undo function is often called "Redo." If you undo a
  790.  series of commands, you can recall each of these commands by using Meta Undo
  791.  repeatedly. Undo walks backward through the history of the file (it restores
  792.  an earlier state); Meta Undo walks forward.
  793.  
  794.  
  795.  2.3.5  Using Delete to Move Text
  796.  
  797.  The Delete function can be used to move text as well as delete it. The last
  798.  text deleted is placed on the "Clipboard." The Clipboard holds text selected
  799.  by either the Copy or Delete function. Pressing SHIFT+INS invokes the Paste
  800.  function, which inserts the contents of the Clipboard into the file at the
  801.  present cursor position.
  802.  
  803.  In this section, Delete will be used to move two complete lines of text.
  804.  Consider the current text:
  805.  
  806.       It's mind over matter.
  807.       What is mind?
  808.       No matter.
  809.       What is matter?
  810.       Never mind.
  811.  
  812.  Move the cursor to the beginning of the fourth line. Select the bottom two
  813.  lines by pressing ALT+A and then pressing the DOWN key twice. You should see
  814.  the bottom two lines highlighted, as shown in Figure 2.3 below.
  815.  
  816.  Now invoke the Delete function by pressing DEL. The two lines disappear. The
  817.  Delete function deletes the characters you highlight.
  818.  
  819.  Having deleted a block of characters, you are ready to use the Paste
  820.  function (SHIFT+INS) to insert the deleted text at a new location. Move the
  821.  cursor to the beginning of the top line and press SHIFT+INS. You should see
  822.  the following text:
  823.  
  824.       What is matter?
  825.       Never mind.
  826.       It's mind over matter.
  827.       What is mind?
  828.       No matter.
  829.  
  830.  You can change the shape of the highlighted region by using the Boxstream
  831.  function (CTRL+B), which changes the region into a rectangular area. See
  832.  Chapter 3 for more information.
  833.  
  834.  
  835.  2.3.6  Finding Strings with the Psearch Function
  836.  
  837.  The Psearch function takes different kinds of arguments but performs the
  838.  same general operation with each──searching for a string of text. The term
  839.  Psearch stands for "plus search," and means the same thing as "forward
  840.  search." This function, which is assigned to the F3 key, takes both text
  841.  arguments and cursor-movement arguments. You can ask the editor to locate
  842.  the next occurrence of the word mind by typing the word in as a text
  843.  argument. Move the cursor to the beginning of the file, then try the
  844.  following sequence of keystrokes:
  845.  
  846.    1. Press ALT+A
  847.    2. Type the following text: mind
  848.    3. Press F3
  849.  
  850.  As you type the word, it appears on the dialog line──the line just above the
  851.  status line at the bottom of the screen. As soon as you press ALT+A and type
  852.  the first character, the prompt Arg: appears on the dialog line. You can
  853.  retype  characters on the dialog line by pressing BKSP (the backspace key).
  854.  
  855.  You can achieve the same result by moving the cursor to the beginning of the
  856.  word mind on the screen, then highlighting the word with the following
  857.  sequence of keystrokes:
  858.  
  859.       ALT+A RIGHT RIGHT RIGHT RIGHT F3
  860.  
  861.  An even easier way of selecting the word is to give the keystroke sequence
  862.  ALT+A F3, which selects the word at the current cursor location. This word
  863.  (all characters up to the first blank or new-line character) becomes the
  864.  search string.
  865.  
  866.  Often when you use the Psearch function, you want to look repeatedly for
  867.  some text string. To search for the text string most recently specified,
  868.  press F3 by itself.
  869.  
  870.  
  871.  2.3.7  Inserting Spaces and Lines
  872.  
  873.  You'll sometimes need to insert blank lines. There are two ways to do this:
  874.  
  875.    1. Press ENTER. When insert mode is on, pressing ENTER inserts a new-line
  876.       character. (Recall that you turn insert mode on and off by pressing
  877.       INS.) Any text to the right of the cursor moves down into the newly
  878.       created line.
  879.  
  880.    2. Invoke Linsert (line insert) by pressing CTRL+N. Regardless of cursor
  881.       position, the Linsert function inserts a blank line directly above the
  882.       current line.
  883.  
  884.  Linsert also accepts an argument. Invoke Arg (ALT+A), move the cursor, and
  885.  then invoke Linsert (CTRL+N). Linsert inserts as many blank spaces in front
  886.  of the highlighted area as the number of characters you highlighted.
  887.  
  888.  
  889.  2.3.8  Exiting the Editor
  890.  
  891.  Press F8 to leave the editor. The F8 key sequence invokes the Exit function,
  892.  which automatically saves any changes you have made to the file and exits.
  893.  The sequence F9 F8 exits without saving, and the sequence ALT+A ALT+A F2
  894.  saves your most recent changes to the file without exiting.
  895.  
  896.  See Section 4.1, "Basic File Operations," for more information on
  897.  loading and saving files.
  898.  
  899.  
  900.  2.4  Getting Help
  901.  
  902.  One of the outstanding features of the editor is on-line Help. On-line Help
  903.  displays the information you need directly on the screen without your having
  904.  to exit the editor. You can quickly get information about any editing
  905.  function.
  906.  
  907.  To use the basic on-line Help, you must first run the installation procedure
  908.  for the editor and follow all directions. The setup program for this
  909.  Microsoft language product should install the editor for you. Installing the
  910.  editor is important because it copies the Help files to your directories and
  911.  properly configures the editor's initialization file, TOOLS.INI.
  912.  
  913.  
  914.  2.4.1  Starting On-Line Help
  915.  
  916.  Press SHIFT+F1 to bring up the first Help screen. On-line Help is largely
  917.  self-explanatory. The first screen gives a list of the basic Help commands
  918.  and provides access to other parts of the Help system.
  919.  
  920.  Press F1 for context-sensitive Help. "Context-sensitive Help" displays a
  921.  Help screen for the word at the current cursor position. The entire word is
  922.  used──even if the cursor is in the middle of the word. If the cursor is on a
  923.  space, the Help system uses the word immediately preceding the space. Thus
  924.  you can type a word, press F1, and get Help for that word.
  925.  
  926.  The editor searches through its list of Help files for a screen
  927.  corresponding to the word at the cursor position. If no screen exists for
  928.  the topic, the editor displays the first Help screen.
  929.  
  930.  
  931.  2.4.2  Moving through On-Line Help
  932.  
  933.  The first Help screen explains how to move between Help screens on different
  934.  topics. To move around within a Help topic, use the same keys (DIRECTION
  935.  keys, HOME, END, F3) that you use to move through a file. You can use PGUP
  936.  and PGDN  to move up or down a page at a time.
  937.  
  938.  
  939.  2.4.3  Leaving On-Line Help
  940.  
  941.  By default, the editor splits the screen into two windows when you bring up
  942.  a Help screen. You can move between windows by pressing F6. Moving from the
  943.  Help window to the editing window lets you continue editing while still
  944.  viewing Help information. To close the Help window, press ESC.
  945.  
  946.  Section 7.2.5, "Changing the Look and Feel of Help," explains how to
  947.  use Help without splitting the screen. If you use this technique, you leave
  948.  Help by press-ing F2 or ESC.
  949.  
  950.  
  951.  2.5  The Microsoft Editor's Command Line
  952.  
  953.  Use the following command line to start up the editor (the options are case
  954.  sensitive):
  955.  
  956.       M «/D» «/e command» «/t» «files»
  957.  
  958.  Begin the command line with the base of the editor's actual file name. For
  959.  example, if you are using the protected-mode version, the editor's file name
  960.  is MEP.EXE. (However, you can rename this file to M.EXE.)
  961.  
  962.  The /D option prevents the editor from examining TOOLS.INI for
  963.  initialization settings (see Chapter 7, "Switches, Assignments, and the
  964.  TOOLS.INI File," for more information).
  965.  
  966.  The /e option enables you to specify a command upon start-up. The command
  967.  argument is a string that follows the same syntax rules as those given for
  968.  macros in Chapter 6, "Function Assignments and Macros." If command contains
  969.  a space, the entire string should be enclosed in quotation marks. To
  970.  represent embedded quotation marks, precede each quotation mark by a
  971.  backslash (\"). To represent a literal backslash, use two backslashes (\\).
  972.  For example, the system-level command
  973.  
  974.       M /e "arg \"search \\\" string\" psearch" FILE.TXT
  975.  
  976.  causes the editor to start up and execute the following command:
  977.  
  978.       arg "search \" string" psearch
  979.  
  980.  The /t option specifies that the names of any files following this option
  981.  are not retained in the editor's information file when the session
  982.  terminates. When you use the Information command at the next editing session
  983.  to list the most recently edited files, these names will not appear.
  984.  
  985.  If a single file is specified, the editor attempts to load the file. If the
  986.  file does not yet exist, the editor asks you if you want to create the file.
  987.  If you type Y (yes), the editor creates the file. If you type another
  988.  character, the editor does not create the file, but loads the most recently
  989.  edited file or (if no files have been previously edited) exits.
  990.  
  991.  If multiple files are specified, the first file is loaded; then, when you
  992.  invoke the Exit function, the editor saves the current file and loads the
  993.  next file in the list. If no files are specified, the editor attempts to
  994.  load the file you were editing when you last exited the editor.
  995.  
  996.  You can specify multiple files by either typing in different file names
  997.  explicitly or by using the DOS wildcard characters, ? and *. For example,
  998.  the following command line causes the editor to load every file in the
  999.  current directory with a .TXT extension:
  1000.  
  1001.       M *.txt
  1002.  
  1003.  On start-up, the status line displays at least four fields. The status line
  1004.  can display up to thirteen fields. The first four fields listed below are
  1005.  always displayed:
  1006.  
  1007.    1. Name of the file being edited.
  1008.  
  1009.    2. Type of file (based on extension).
  1010.  
  1011.    3. The length of the file in lines.
  1012.  
  1013.    4. Cursor position or window position of upper-left corner.
  1014.  
  1015.    5. The word modified if the file has been changed.
  1016.  
  1017.    6. The letters NL if no carriage returns were found when the file was
  1018.       loaded (that is, if the file did not contain carriage returns to denote
  1019.       the end of each line, but used only line feeds).
  1020.  
  1021.    7. The word insert if you are in insert mode.
  1022.  
  1023.    8. The word meta if you have invoked the Meta function.
  1024.  
  1025.    9. The word No-Edit if the file cannot be changed at any time during the
  1026.       editing session. Some of the internal files created by the editor, such
  1027.       as <information> and <assign>, fall into this category.
  1028.  
  1029.   1    . The word RO-File if the file has the read-only attribute. (This
  1030.       attribute is set outside of the editor.) The file can be modified, but
  1031.       after being modified, it can be saved only under a different file name.
  1032.  
  1033.   11. The word cancel if you recently invoked the Cancel function.
  1034.  
  1035.   12. The letters BC if a background compilation is in progress under OS/2
  1036.       protected mode (or XX if the background compilation failed to begin).
  1037.  
  1038.   13. The letters REC while a macro is being recorded.
  1039.  
  1040.  
  1041.  2.6  Hints for Using the Editor
  1042.  
  1043.  Here are two hints to keep in mind as you learn to use the editor:
  1044.  
  1045.    1. The Microsoft Editor names functions in a consistent way. Section 3.2,
  1046.       "Naming Conventions for Functions," explains the conventions. Table A.1
  1047.       lists editing functions by category.
  1048.  
  1049.    2. If you forget which keystroke is associated with a function, use
  1050.       on-line Help for quick reference. If Help is installed, you can get
  1051.       function assignments by pressing SHIFT+F1 and then choosing the Current
  1052.       Assignments screen. If Help is not installed, pressing F1 takes you
  1053.       directly to this screen.
  1054.  
  1055.  
  1056.  Chapter 3  Command Syntax
  1057.  ───────────────────────────────────────────────────────────────────────────
  1058.  
  1059.  If you've worked through Chapter 2, you have seen the flexibility of
  1060.  Microsoft Editor commands. Many of the functions accept a variety of
  1061.  arguments──text arguments, cursor-movement arguments──or no argument at all.
  1062.  This chapter describes each argument type in detail. The chapter also
  1063.  presents the syntax and naming conventions used throughout the manual.
  1064.  
  1065.  Topics are covered in the following order:
  1066.  
  1067.    ■  Entering a command
  1068.    ■  Function naming conventions
  1069.    ■  Argument types
  1070.    ■  Text arguments (numarg, markarg, textarg)
  1071.    ■  Highlighting a text argument
  1072.    ■  Cursor-movement arguments (streamarg, linearg, boxarg)
  1073.  
  1074.  
  1075.  3.1  Entering a Command
  1076.  
  1077.  Commands take two basic forms. You can invoke a function by itself, or you
  1078.  can introduce an argument and then invoke a function.
  1079.  
  1080.  Use the Arg prefix to introduce an argument. By default, Arg is assigned to
  1081.  ALT+A (hold down the ALT key and press A). You can then type characters or
  1082.  move the cursor to highlight part of the screen.
  1083.  
  1084.  Finally, invoke the function you want by pressing the corresponding
  1085.  keystroke. If you forget the keystroke, you can look it up in on-line Help.
  1086.  
  1087.  The two basic forms of a command are summarized below:
  1088.  
  1089.       Function
  1090.       Arg argument Function
  1091.  
  1092.  Some functions also let you form a command in one or more of the following
  1093.  three ways:
  1094.  
  1095.    1. Some functions accept Arg with no argument: ArgFunction.
  1096.  
  1097.    2. Some functions accept Arg Arg (press ALT+A twice). The sequence Arg Arg
  1098.       can introduce a function just as Arg does.
  1099.  
  1100.    3. Some functions work differently when given the Meta prefix. You can
  1101.       toggle Meta on and off by pressing F9. When Meta is on, the word meta
  1102.       appears on the status line.
  1103.  
  1104.  See Chapter 4, "A Survey of the Editor's Commands," and Table A.3 for
  1105.  information on what syntax is accepted by each function.
  1106.  
  1107.  Once you begin entering a command, you can cancel Arg and any argument by
  1108.  invoking the Cancel function (ESC). The Cancel function is also useful for
  1109.  clearing the dialog line.
  1110.  
  1111.  ───────────────────────────────────────────────────────────────────────────
  1112.  NOTE
  1113.     Throughout this manual, function names are given in italics and are
  1114.     initial capped (for example: Paste). Argument types are given in italics
  1115.     and are lowercase (for example: textarg).
  1116.  ───────────────────────────────────────────────────────────────────────────
  1117.  
  1118.  
  1119.  3.2  Naming Conventions for Functions
  1120.  
  1121.  The Microsoft Editor follows a consistent pattern of function names.
  1122.  Function names often begin with the letters P, M, S, L, or Cur, which can
  1123.  have the following meanings:
  1124.  
  1125.  Initial Letter(s)           Usage
  1126.  
  1127.  
  1128.  P                           Plus. Indicates forward movement of some kind.
  1129.                              For example, Psearch is the forward-search
  1130.                              command, and Pword moves the cursor forward one
  1131.                              word.
  1132.  
  1133.  M                           Minus. Indicates backward movement of some kind.
  1134.                              For example, Msearch is the backward-search
  1135.                              command, and Mword moves the cursor backward one
  1136.                              word.
  1137.  
  1138.  S                           Stream. Indicates a stream-oriented,
  1139.                              block-of-text function. This category includes
  1140.                              Sinsert, which inserts spaces in the stream of
  1141.                              text between two cursor positions, and Sdelete,
  1142.                              which deletes the stream. Without an argument,
  1143.                              these functions insert or delete a single space.
  1144.  
  1145.  L                           Line. Indicates a line-and-box-oriented
  1146.                              function. This category includes Linsert, which
  1147.                              inserts spaces in the exact area highlighted on
  1148.                              screen, and Ldelete, which deletes it. Without
  1149.                              an argument, these functions insert or delete a
  1150.                              line.
  1151.  
  1152.  Cur                         Current. Indicates one of the special insertion
  1153.                              functions, such as Curdate (insert current date)
  1154.                              and Curfile (insert current file name).
  1155.  
  1156.  
  1157.  3.3  Argument Types
  1158.  
  1159.  There are two basic ways to enter arguments: you can enter text directly as
  1160.  part of the command (text argument), or you can use cursor movement to
  1161.  highlight characters on the screen (cursor-movement argument). Each of these
  1162.  two methods has several variations, as shown in the following list:
  1163.  
  1164.    1. Text argument. After you invoke Arg (ALT+A), continue to type
  1165.       characters. These characters appear on the dialog line (the line next
  1166.       to the bottom of the screen). You can give three different kinds of
  1167.       text arguments:
  1168.  
  1169.       a.   A numarg, which consists of a string of digits.
  1170.  
  1171.       b.   A markarg, which is a string containing the name of a previously
  1172.            defined file marker.
  1173.  
  1174.       c.   A textarg, which is any text argument not recognized as a numarg
  1175.            or markarg.
  1176.  
  1177.    2. Cursor-movement argument. After you invoke Arg (ALT+A), the current
  1178.       cursor position is highlighted. Highlight more characters by moving the
  1179.       cursor to a new position. You can give three different kinds of
  1180.       cursor-movement arguments:
  1181.  
  1182.       a.   A linearg, in which the old and new cursor positions are in
  1183.            different lines but the same column.
  1184.  
  1185.       b.   A boxarg, in which the old and new cursor positions are in
  1186.            different columns.
  1187.  
  1188.       c.   A streamarg, which can consist of any cursor movement.
  1189.  
  1190.  
  1191.  3.4  Text Arguments (numarg, markarg, textarg)
  1192.  
  1193.  After you invoke Arg (ALT+A), you can enter a text argument by typing any
  1194.  printable characters, including blank spaces. The first time you invoke Arg,
  1195.  the following characters appear on the dialog line (the line next to the
  1196.  bottom of the screen):
  1197.  
  1198.       Arg [1]
  1199.  
  1200.  If you press ALT+A again, the number in the brackets changes. Any characters
  1201.  you type appear on the dialog line after Arg [1].
  1202.  
  1203.  When entering a text argument, you can edit, move through, or modify the
  1204.  text argument in the following ways:
  1205.  
  1206.    1. Erase a character by pressing BKSP.
  1207.  
  1208.    2. Erase the character at the current cursor position with the Sdelete
  1209.       function (DEL).
  1210.  
  1211.    3. Move back and forth nondestructively with LEFT and RIGHT. If you use
  1212.       RIGHT to move past the end of current input, the editor inserts the
  1213.       character from the corresponding position in the previous text
  1214.       argument.
  1215.  
  1216.    4. Insert a space at the cursor position with the Sinsert function
  1217.       (CTRL+J).
  1218.  
  1219.    5. Move to the beginning of the text with Begline (HOME) and to the end of
  1220.       the text with Endline (END).
  1221.  
  1222.    6. Clear characters from the current cursor position to the end of the
  1223.       line with the Arg function (ALT+A).
  1224.  
  1225.  To repeat the most recently entered text argument, invoke the Lasttext
  1226.  function, which by default is assigned to CTRL+O. When you use Lasttext, the
  1227.  Arg prefix is unnecessary.
  1228.  
  1229.  
  1230.  3.4.1  The numarg Type
  1231.  
  1232.  A numarg is a string of digits that you enter as a text argument. Each of
  1233.  the three following examples is a numarg:
  1234.  
  1235.       3
  1236.       11
  1237.       45
  1238.  
  1239.  The number must be a valid decimal integer. A numarg is evaluated as a
  1240.  number and not as literal text. Typically, it is used to indicate a range of
  1241.  lines starting with the cursor position. For example, the following command
  1242.  sequence deletes 10 lines starting with the cursor position:
  1243.  
  1244.    1. Invoke Arg (press ALT+A)
  1245.  
  1246.    2. Type the following text: 10
  1247.  
  1248.    3. Invoke Ldelete (press CTRL+Y)
  1249.  
  1250.  Some functions accept text arguments but do not recognize a numarg. These
  1251.  functions treat a numarg as an ordinary textarg.
  1252.  
  1253.  
  1254.  3.4.2  The markarg Type
  1255.  
  1256.  A markarg is a file-marker name you have previously defined with the Mark
  1257.  function (CTRL+M). See Section 4.4, "Using File Markers," for information
  1258.  about Mark.
  1259.  
  1260.  Once defined, you can enter the marker name as a markarg. The name is not
  1261.  treated as literal text, but is interpreted as an actual file position. For
  1262.  example, the following command sequence copies all text between the cursor
  1263.  position and the file position previously marked as P1:
  1264.  
  1265.    1. Invoke Arg (press ALT+A)
  1266.  
  1267.    2. Enter the following text: P1
  1268.  
  1269.    3. Invoke Copy(press CTRL+INS)
  1270.  
  1271.  Many functions accept text arguments but do not recognize a markarg. In
  1272.  these cases, the markarg is treated as an ordinary textarg.
  1273.  
  1274.  
  1275.  3.4.3  The textarg Type
  1276.  
  1277.  A textarg is similar to a numarg or markarg. The only difference is that the
  1278.  textarg has no special meaning; it is interpreted by the function as literal
  1279.  text. For example, the following sequence finds the next occurrence of the
  1280.  string HappyNew Year:
  1281.  
  1282.    1. Invoke Arg (press ALT+A)
  1283.  
  1284.    2. Type the following: Happy New Year
  1285.  
  1286.    3. Invoke Psearch (press F3)
  1287.  
  1288.  A textarg can either be typed in directly or highlighted on the screen. The
  1289.  next section describes how to highlight a text argument.
  1290.  
  1291.  
  1292.  3.5  Highlighting a Text Argument
  1293.  
  1294.  If the text argument already appears in the editing screen, you can save
  1295.  typing by highlighting the text. You can highlight all or part of one line;
  1296.  a text argument cannot consist of multiple lines.
  1297.  
  1298.  To highlight a text argument:
  1299.  
  1300.    1. Move the cursor to the first character in the text argument.
  1301.  
  1302.    2. Invoke Arg (press ALT+A).
  1303.  
  1304.       The current cursor position defines the "initial cursor position." As
  1305.       you move the cursor, characters between the initial cursor position and
  1306.       the new cursor position are highlighted.
  1307.  
  1308.    3. Move the cursor to the right until all the desired text is highlighted.
  1309.  
  1310.    4. Invoke the desired function. The editor passes the highlighted
  1311.       characters to this function, just as if you had directly typed in the
  1312.       highlighted characters.
  1313.  
  1314.  For example, the highlighted area in Figure 3.1 defines the text argument
  1315.  pascal MoveCur.
  1316.  
  1317.  Even if the highlighted text represents a legitimate numarg or markarg, it
  1318.  will be interpreted by the function as a straight textarg. That is, a numarg
  1319.  or markarg must be typed in on the status line; it cannot be selected from
  1320.  the body of text.
  1321.  
  1322.  Highlighting a textarg is a special case of a cursor-movement argument. The
  1323.  next section discusses the other kinds of cursor-movement arguments.
  1324.  
  1325.  
  1326.  3.6  Cursor-Movement Arguments (linearg, boxarg, streamarg)
  1327.  
  1328.  You enter a cursor-movement argument by invoking Arg (ALT+A) and moving the
  1329.  cursor. When you invoke Arg, the current cursor position is marked with a
  1330.  reverse-video highlight. This position is called the "initial cursor
  1331.  position." As you move the cursor, characters between the initial cursor
  1332.  position and the new cursor position are highlighted.
  1333.  
  1334.  When the initial and new cursor positions are on different lines, you can
  1335.  high-light regions by one of two different modes:
  1336.  
  1337.    ■  In "box mode," the editor highlights either complete lines (if the new
  1338.       and initial cursor position are in the same column) or rectangular
  1339.       areas. In box mode, you can select complete lines, or highlight,
  1340.       delete, and insert columns without affecting the surrounding text. In
  1341.       box mode, a cursor-movement argument is either a linearg or boxarg, as
  1342.       explained in Sections 3.6.1 and 3.6.2.
  1343.  
  1344.    ■  In "stream mode," the editor highlights text the way most text editors
  1345.       do. The highlighted region includes all text between the two positions,
  1346.       according to their sequence in the file. This region is usually not
  1347.       rectangular. In stream mode, a cursor-movement argument is always a
  1348.       streamarg, as explained in Section 3.6.3, "The streamarg Type."
  1349.  
  1350.  By default, the editor uses stream mode. You can toggle back and forth
  1351.  between the two modes by invoking the Boxstream function (CTRL+B). You can
  1352.  even invoke Boxstream while in the middle of creating a cursor-movement
  1353.  argument──doing so changes the highlighting instantly.
  1354.  
  1355.  To repeat the most recently entered cursor-movement argument, invoke the
  1356.  Lastselect function, which by default is assigned to CTRL+U. When you use
  1357.  Lastselect, the Arg prefix is unnecessary.
  1358.  
  1359.  If you create a cursor-movement argument and then type a character, the
  1360.  editor removes the highlighted area and replaces it with the character
  1361.  typed. A similar result occurs when you create a cursor-movement argument
  1362.  and then invoke the Paste function──the highlighted area is replaced by the
  1363.  contents of the Clipboard.
  1364.  
  1365.  
  1366.  3.6.1  The linearg Type
  1367.  
  1368.  A linearg is defined when the new cursor position is in the same column but
  1369.  on a different line from the initial cursor position. The editor must be in
  1370.  box mode. The editor responds by highlighting all lines between the two
  1371.  cursor positions, including the lines that the cursor positions are on. For
  1372.  example, the display in Figure 3.2 is produced by invoking Arg (ALT+A) and
  1373.  then pressing DOWN three times.
  1374.  
  1375.  
  1376.  3.6.2  The boxarg Type
  1377.  
  1378.  A boxarg is a rectangular area on the screen. The two corners of the area
  1379.  are determined by the initial and new cursor positions. A boxarg is defined
  1380.  when the two positions are in different columns (and possibly different
  1381.  lines). The editor must be in box mode.
  1382.  
  1383.  After invoking Arg (ALT+A), you can move the cursor left or right. The left
  1384.  edge of the box includes the leftmost of the two cursor positions. The right
  1385.  edge of the box includes the column just to the left of other cursor
  1386.  positions. The box contains parts of all lines, inclusive, between the two
  1387.  positions.
  1388.  
  1389.  For example, the display shown in Figure 3.3 is produced by invoking Arg
  1390.  and then moving the cursor 3 lines down and 16 columns over.
  1391.  
  1392.  
  1393.  3.6.3  The streamarg Type
  1394.  
  1395.  A streamarg consists of text between the initial cursor and the new cursor
  1396.  positions. When the editor is in stream mode, every cursor-movement argument
  1397.  is a streamarg. You toggle between box and stream mode by invoking Boxstream
  1398.  (CTRL+B).
  1399.  
  1400.  After pressing ALT+A, you can move the cursor in any direction to create a
  1401.  streamarg. The streamarg is shown as highlighted characters.
  1402.  
  1403.  If you move the cursor forward (that is, to the right or down), the
  1404.  streamarg includes the character at the initial cursor position. If you move
  1405.  the cursor backward (that is, to the left or up), the streamarg does not
  1406.  include the character at the initial cursor position; the streamarg starts
  1407.  at the preceding character.
  1408.  
  1409.  When a streamarg spans multiple lines, it includes some characters that a
  1410.  boxarg does not. Specifically, a multiline streamarg includes the following:
  1411.  
  1412.    1. All characters from the first cursor position to the end of the line
  1413.  
  1414.    2. All characters on the lines between the two cursor positions
  1415.  
  1416.    3. All characters on the line of the second cursor position, up to but not
  1417.       including the cursor position itself
  1418.  
  1419.  For example, the display shown in Figure 3.4 is produced with the same
  1420.  cursor movement used in Figure 3.3, but with stream mode on.
  1421.  
  1422.  
  1423.  Chapter 4  A Survey of the Editor's Commands
  1424.  ───────────────────────────────────────────────────────────────────────────
  1425.  
  1426.  The Microsoft Editor has all the standard features of a programmer's editor.
  1427.  It lets you move quickly through a file, move blocks of text, search for
  1428.  strings, and handle multiple files. In addition, the Microsoft Editor allows
  1429.  you to use different windows for viewing more than one file or more than one
  1430.  part of the same file. The Microsoft Editor can also invoke compilers and
  1431.  assemblers, then display each compilation error.
  1432.  
  1433.  This chapter expands on the editing topics introduced in Chapter 2. For a
  1434.  complete list of the command syntax for every function, see Appendix A,
  1435.  "Reference Tables." This chapter covers topics in the following order:
  1436.  
  1437.    ■  Basic file operations
  1438.    ■  Moving through a file
  1439.    ■  Inserting, copying, and deleting text
  1440.    ■  Using file markers
  1441.    ■  Searching and replacing
  1442.    ■  Compiling
  1443.    ■  Using editing windows
  1444.    ■  Working with multiple files
  1445.    ■  Printing all or part of a file
  1446.  
  1447.  
  1448.  4.1  Basic File Operations
  1449.  
  1450.  This section discusses how to work with files in general and how to use
  1451.  internal files called "pseudo files."
  1452.  
  1453.  
  1454.  4.1.1  File Commands
  1455.  
  1456.  File operations are basic to all work with the editor. You use file
  1457.  operations to save your work, load in a new text file, or completely exit
  1458.  from the editor.
  1459.  
  1460.  Chapter 2 described how to save the current file and exit from the editor.
  1461.  However, the Microsoft Editor supports a number of other file operations.
  1462.  The list below shows how to use some of the most common file operations:
  1463.  
  1464. ╓┌─────────────────────────────────────────┌─────────────────────────────────╖
  1465.  Command
  1466.  (and Default Keystrokes)                  Description
  1467.  
  1468.  Exit (F8)                                 Exits editor after saving current
  1469.                                            file
  1470.  
  1471.  Meta Exit (F9  F8)                        Exits editor without saving
  1472.  Command
  1473.  (and Default Keystrokes)                  Description
  1474. Meta Exit (F9  F8)                        Exits editor without saving
  1475.  
  1476.  Arg Arg Setfile (ALT+A ALT+A F2)          Saves current file without exiting
  1477.  
  1478.  Arg Arg textarg Setfile                   Saves current file under the file
  1479.  (ALT+A ALT+A textarg F2)                  name (textarg) without exiting
  1480.  
  1481.  Arg textarg Setfile (ALT+A textarg F2)    Loads another file (entered as
  1482.                                            textarg) into the editing window
  1483.  
  1484.  Arg Arg textarg Paste                     Merges (copies) another file
  1485.  (ALT+A ALT+A textarg SHIFT+INS)           (entered astextarg) into current
  1486.                                            file──the new file is inserted at
  1487.                                            the cursor position
  1488.  
  1489.  Refresh (SHIFT+F7)                        Discards most recent changes to
  1490.                                            current file and rereads file from
  1491.                                            disk
  1492.  
  1493.  
  1494.  
  1495.  Example
  1496.  
  1497.  As explained in Chapter 3, a textarg is simply an argument you type in
  1498.  directly. For example, to load the file SAMPLE.TXT, you would follow these
  1499.  steps:
  1500.  
  1501.    1. Invoke the Arg function (press ALT+A)
  1502.    2. Type the following file name: SAMPLE.TXT
  1503.    3. Invoke the Setfile function (press F2)
  1504.  
  1505.  Each of the operations listed above is frequently useful, yet some should be
  1506.  used with caution. For example, you should only exit without saving when you
  1507.  have accidentally altered a file you do not want to change, or when you have
  1508.  made many mistakes during the editing session. When you exit without saving,
  1509.  all the work you did since the last save operation is discarded.
  1510.  
  1511.  Conversely, you may wish to save without leaving the editor. This operation
  1512.  is usually safe, unless the current file is one that should not be changed.
  1513.  Saving a file writes all the changes you made out to the disk. If your
  1514.  system is vulnerable to power failures or other kinds of system failure, it
  1515.  is a good idea to save your work often.
  1516.  
  1517.  Merging and loading a file are not the same. Merging a file copies the
  1518.  contents of another file and inserts it into the current file. Loading a
  1519.  file first saves the current file (assuming the autosave switch is on), then
  1520.  restarts the editing session with a new file.
  1521.  
  1522.  The editor supports other variations of these operations described above.
  1523.  See Table A.3, under the Exit and Setfile functions, for more information.
  1524.  
  1525.  
  1526.  4.1.2  Special Syntax for Setfile
  1527.  
  1528.  A text argument passed to Setfile can take a number of different forms: a
  1529.  file name, a file name with a DOS  wildcard character (* or ?), the name of
  1530.  a directory, or the name of a disk drive. If the text argument is a
  1531.  directory name, the editor changes the current directory. If the argument is
  1532.  a drive name, the editor changes the current drive.
  1533.  
  1534.  File names can be complete path names and can include environment variables
  1535.  defined with the system-level SET command. The Setfile function interprets
  1536.  an environment variables as a list of directories to search for a file. You
  1537.  enter an environment variable using the syntax
  1538.  
  1539.       $environ:filename
  1540.  
  1541.  in which environ is the name of an environment variable. For example, the
  1542.  following actions cause the editor to search the INIT environment variable
  1543.  to find the TOOLS.INI file and load it:
  1544.  
  1545.    1. Invoke the Arg function (press ALT+A)
  1546.    2. Type the following file name: $INIT:tools.ini
  1547.    3. Invoke the Setfile function (press F2)
  1548.  
  1549.  You can also use the environment-variable syntax with the Paste function
  1550.  when you use this function to merge a file.
  1551.  
  1552.  Finally, you can switch to a recently edited file by using a short name. A
  1553.  "short name" is a file name with no path or extension . The editor searches
  1554.  its list of recently edited files to find a name that matches the short
  1555.  name.
  1556.  
  1557.  
  1558.  4.1.3  Pseudo Files
  1559.  
  1560.  A "pseudo file" is an internal editing file. It exists only in the
  1561.  computer's memory and does not correspond to any disk file. The editor
  1562.  treats a pseudo file just like any other file except for two important
  1563.  differences:
  1564.  
  1565.    1. The name of a pseudo file always appears in angle brackets (<>).
  1566.    2. A pseudo file may not be saved to disk under its own name.
  1567.  
  1568.  Why use pseudo files? Pseudo files are useful for temporary storage. Pseudo
  1569.  files are updated almost instantaneously because writing to RAM is much
  1570.  faster than writing to disk. You can also insert the contents of a pseudo
  1571.  file into the current file with the Paste command.
  1572.  
  1573.  The editor creates several pseudo files of its own and gives them special
  1574.  meaning. You can open these files just like any other with the Setfile
  1575.  function.
  1576.  
  1577. ╓┌───────────────────────────┌───────────────────────────────────────────────╖
  1578.  Pseudo File                 Description
  1579.  
  1580.  <clipboard>                 Stores text selected by a copy or deletion. This
  1581.                              file can be modified; the modified file is then
  1582.                              inserted when you invoke Paste.
  1583.  
  1584.                              However, if you copy or delete text while
  1585.                              editing this file, the selected text is not
  1586.                              saved to the Clipboard but simply discarded.
  1587.  
  1588.  <assign>                    Shows an updated list of function and switch
  1589.                              assignments. You can create new function and
  1590.                              switch assignments by directly modifying this
  1591.                              file; however, the assignments you make must
  1592.                              follow the syntax described in Chapter 6,
  1593.                              "Function Assignments and Macros."
  1594.  
  1595.  <information-file>          Shows a list of files that have been previously
  1596.                              edited. This file cannot be modified. Each file
  1597.                              currently open for editing is listed along with
  1598.  Pseudo File                 Description
  1599.                             currently open for editing is listed along with
  1600.                              its length in lines.
  1601.  
  1602.  <compile>                   Shows error messages from the last compilation
  1603.                              executed from within the editor. If the editor
  1604.                              is running under protected mode, the error
  1605.                              messages are dynamically updated while the
  1606.                              compilation is running.
  1607.  
  1608.  <file-list>                 Shows a list of each file specified on the
  1609.                              editor's command line that has not yet been
  1610.                              opened. This file cannot be modified.
  1611.  
  1612.  <record>                    Records each editing command when you record a
  1613.                              macro. The file is dynamic; it changes while you
  1614.                              view it. You cannot directly modify this file.
  1615.                              See Chapter 6, "Function Assignments and
  1616.                              Macros."
  1617.  
  1618.  
  1619.  4.2  Moving through a File
  1620.  
  1621.  Chapter 2, "Edit Now," described how to the use DIRECTION keys to move
  1622.  through a file one space at a time. The DIRECTION keys correspond to the
  1623.  functions Up, Down, Right, and Left, to which you can assign different keys
  1624.  if you wish. Chapter 2 also presented the Begline function (HOME), which
  1625.  moves the cursor to the first printable character in the current line.
  1626.  Similar to the Begline function is the Endline function (END), which moves
  1627.  the cursor just to the right of the last  printable character in the current
  1628.  line.
  1629.  
  1630.  Each of the four direction functions in the following list has a variation
  1631.  that uses the Meta function as a prefix. Each function, when used in a
  1632.  command with the Meta prefix, moves the cursor as far as possible within the
  1633.  displayed screen (or window) without changing column position or causing the
  1634.  screen to scroll.
  1635.  
  1636.  
  1637.  Command
  1638.  (and Default Keystrokes)     Description
  1639.  
  1640.  Meta Up (F9  UP)             Moves the cursor to the top of the screen
  1641.  
  1642.  Meta Down (F9  DOWN)         Moves the cursor to the bottom of the screen
  1643.  
  1644.  Meta Left (F9  LEFT)         Moves the cursor to the left-most position on
  1645.                               the current line
  1646.  
  1647.  Meta Right (F9  RIGHT)       Moves the cursor to the right-most position on
  1648.                               the current line
  1649.  
  1650.  Meta Begline (F9  HOME)      Moves the cursor to column 1
  1651.  
  1652.  
  1653.  4.2.1  Scrolling at the Screen's Edge
  1654.  
  1655.  You can use the four direction functions (Up,  Down, Right , Left) to cause
  1656.  scrolling. The screen (or current window) can scroll in all four
  1657.  directions. Although the editor does not wrap lines that are wider than the
  1658.  screen, you can have lines of text that are up to 250 characters wide. Use
  1659.  the DIRECTION keys to scroll right and left when your text lines are wider
  1660.  than the screen or current window.
  1661.  
  1662.  Unlike some editors, the Microsoft Editor does not automatically scroll by
  1663.  only one column or one line. Instead, the internal switches hscroll
  1664.  (horizontal-scroll) and vscroll (vertical-scroll) control how fast the
  1665.  editor scrolls. For example, if vscroll is set to 7, the editor advances the
  1666.  screen position seven lines when you attempt to move the cursor off the
  1667.  bottom of the screen. See Chapter 7 for more information on these switches.
  1668.  
  1669.  
  1670.  4.2.2  Scrolling a Page at a Time
  1671.  
  1672.  The editor provides the Ppage (PGDN) and Mpage (PGUP) functions to move
  1673.  through a file more quickly than you can by using the DIRECTION keys to move
  1674.  one line or one column at a time.
  1675.  
  1676.  The term "page" is defined as the amount of text that can be displayed in
  1677.  the current window or screen. To advance one page forward through a file,
  1678.  invoke the function Ppage (PGDN), which stands for "plus page."
  1679.  
  1680.  The function Mpage (PGUP), which stands for "minus page," is the inverse of
  1681.  Ppage, and it moves back through the file one page at a time.
  1682.  
  1683.  ───────────────────────────────────────────────────────────────────────────
  1684.  NOTE
  1685.     In Version 1.0 of the editor, the Ppage and Mpage functions took
  1686.     arguments. You can use them to help build a cursor-movement argument;
  1687.     they do not cancel the current argument. The editor also provides two new
  1688.     functions──Begfile and Endfile──that move to the beginning and end of the
  1689.     file. The next section describes these functions.
  1690.  ───────────────────────────────────────────────────────────────────────────
  1691.  
  1692.  
  1693.  4.2.3  Moving to the Top or Bottom of the File
  1694.  
  1695.  The Begfile and Endfile functions provide the fastest cursor movement.
  1696.  
  1697.  To move the cursor to the beginning of the file, invoke the Begfile function
  1698.  by pressing CTRL+UP (the up-arrow key on the numeric keypad).
  1699.  
  1700.  To move the cursor to the end of the file, invoke the Endfile function by
  1701.  pressing CTRL+DOWN (the down-arrow key on the numeric keypad).
  1702.  
  1703.  
  1704.  4.2.4  Other File-Navigation Functions
  1705.  
  1706.  The following functions are useful for moving through a file:
  1707.  
  1708.  Function
  1709.  (and Default Keystrokes)    Description
  1710.  
  1711.  Pword  (CTRL+RIGHT)         Moves the cursor forward (plus) one word
  1712.  
  1713.  Mword (CTRL+LEFT)           Moves the cursor backward (minus) one word
  1714.  
  1715.  Ppara                       Moves the cursor forward (plus) one paragraph
  1716.  
  1717.  Mpara                       Moves the cursor backward (minus) one paragraph
  1718.  
  1719.  Mark (CTRL+M)               Defines or moves to a marker, or moves to a
  1720.                              specified line number
  1721.  
  1722.  With the Mark function, you can define a marker or move to a marker. Markers
  1723.  constitute a special topic that is discussed in Section 4.4, "Using File
  1724.  Markers."
  1725.  
  1726.  
  1727.  4.3  Inserting, Copying, and Deleting Text
  1728.  
  1729.  You may often need to move, copy, or delete blocks of text. The Microsoft
  1730.  Editor is particularly powerful because it provides a variety of ways to
  1731.  define a block of characters.
  1732.  
  1733.  For example, you can delete a highlighted box, a range of lines, or a stream
  1734.  of text between any two file positions. Sections 4.3.1-4.3.4 discuss how to
  1735.  work with blocks of text.
  1736.  
  1737.  
  1738.  4.3.1  Inserting and Deleting Text
  1739.  
  1740.  Chapter 2, "Edit Now," described how to use the Paste, Insertmode, and
  1741.  Delete functions to insert, move, and delete text.
  1742.  
  1743.  The following list presents some of the most common commands that use the
  1744.  Delete function:
  1745.  
  1746.  Command
  1747.  (and Default Keystrokes)     Description
  1748.  
  1749.  Delete (DEL)                Deletes the character at the cursor position.
  1750.                              (This command does not join two lines of text,
  1751.                              even if the cursor is at the end of the line.)
  1752.  
  1753.  Arg Delete (ALT+A DEL)      Deletes all text from the cursor position to the
  1754.                              end of the line and joins the current line of
  1755.                              text with the next line.
  1756.  
  1757.  Arg cursor-movement         Deletes the highlighted area, whether it is a
  1758.  Delete (ALT+A               linearg, streamarg, or boxarg. You can toggle
  1759.  cursor-movement DEL)        between stream and box selection with the
  1760.                              Boxstream function (CTRL+B).
  1761.  
  1762.  The Delete function copies all deleted text (except single-character
  1763.  deletions) to the Clipboard. For any argument, the Meta Delete function
  1764.  discards the text without copying it to the Clipboard.
  1765.  
  1766.  To deal with whole lines of text, the Microsoft Editor provides the
  1767.  following functions:
  1768.  
  1769.  Function
  1770.  (and Default Keystrokes)    Description
  1771.  
  1772.  Ldelete (CTRL+Y)            Deletes a line of text or a boxarg
  1773.  
  1774.  Linsert (CTRL+N)            Inserts a line of text or a boxarg
  1775.  
  1776.  You can use these functions in commands without an argument or prefix. These
  1777.  functions also take cursor-movement arguments. They produce the same results
  1778.  that Delete and Insert do, but they always act as if the editor were in box
  1779.  mode.
  1780.  
  1781.  ───────────────────────────────────────────────────────────────────────────
  1782.  NOTE
  1783.     When you want to delete or copy large areas of text, you may find the
  1784.     DIRECTION keys move too slowly. However, you can define a highlighted
  1785.     area with any cursor-movement function that does not take an argument.
  1786.     Mpage (PGUP) and Ppage (PGDN) can be used this way. The Ppara and Mpara
  1787.     functions can also be used this way, but they do not have default key
  1788.     assignments.
  1789.  
  1790.     To delete large amounts of text, you can also use a markarg or a numarg
  1791.     with a delete function. See Table A.3 for more information.
  1792.  ───────────────────────────────────────────────────────────────────────────
  1793.  
  1794.  
  1795.  4.3.2  Copying Text
  1796.  
  1797.  To copy text without first deleting it, use the Copy function (CTRL+INS),
  1798.  which copies a range of text into the <clipboard> pseudo file. Text in the
  1799.  Clipboard is then inserted into the file when you invoke the Paste function.
  1800.  The following list presents different commands that use the Copy function:
  1801.  
  1802.  Command
  1803.  (and Default Keystrokes)             Description
  1804.  
  1805.  Arg cursor-movementCopy              Copies the highlighted area into the
  1806.  (ALT+A cursor-movement CTRL+INS)     Clipboard.
  1807.  
  1808.  Arg numarg Copy                      Copies the specified number of lines
  1809.  (ALT+A numarg CTRL+INS)              into the Clipboard, beginning with the
  1810.                                       line that the cursor is on.
  1811.  
  1812.  Arg markarg Copy                     Copies the text between the specified
  1813.  (ALT+A markarg CTRL+INS)             marker and the cursor into the
  1814.                                       Clipboard. The shape of this region
  1815.                                       changes depending on whether the editor
  1816.                                       is in box or stream mode.
  1817.  
  1818.  The Paste function (SHIFT+INS) is useful both for moving and copying text.
  1819.  To move text, first delete it and then invoke Paste after moving the cursor
  1820.  to the destination.
  1821.  
  1822.  ───────────────────────────────────────────────────────────────────────────
  1823.  NOTE
  1824.     If you highlight an area on the screen and then invoke Paste, the editor
  1825.     deletes the highlighted area and replaces it with the contents of the
  1826.     Clipboard.
  1827.  ───────────────────────────────────────────────────────────────────────────
  1828.  
  1829.  See Section 4.4 for more information on markers.
  1830.  
  1831.  
  1832.  4.3.3  Other Insert Commands
  1833.  
  1834.  The following functions insert specific items at the current cursor position
  1835.  (each function is a complete command). These functions do not have
  1836.  preassigned keys; see Chapter 6, "Function Assignments and Macros," for
  1837.  information on how to assign keys to functions.
  1838.  
  1839.  Function                     Description
  1840.  
  1841.  Curdate                     Inserts current date
  1842.  
  1843.  Curday                      Inserts current day of the week
  1844.  
  1845.  Curfile                     Inserts current file name
  1846.  
  1847.  Curfileext                  Inserts current file extension
  1848.  
  1849.  Curfilenam                  Inserts base name of current file
  1850.  
  1851.  Curtime                     Inserts current time
  1852.  
  1853.  These functions all use time of execution, rather than time of editor
  1854.  start-up, as the current time.
  1855.  
  1856.  Although the functions above are not preassigned to any keystrokes, you can
  1857.  assign them to keystrokes by using the technique described in Chapter 6.
  1858.  You can also execute a function by giving its name as input to Execute (F7).
  1859.  
  1860.  For example, the following sequence inserts the date at the cursor position:
  1861.  
  1862.    1. Invoke Arg (press ALT+A)
  1863.    2. Type the following string: curdate
  1864.    3. Invoke Execute (press F7)
  1865.  
  1866.  
  1867.  4.3.4  Reading a File into the Current File
  1868.  
  1869.  The Paste function can be used in commands that read a file into the current
  1870.  file, as shown below:
  1871.  
  1872.  
  1873.  Command
  1874.  (and Default Keystrokes)             Description
  1875.  
  1876.  Arg Arg textarg Paste                Reads the contents of the file
  1877.  (ALT+A ALT+A textarg SHIFT+INS)      specified by the textarg and inserts
  1878.                                       these contents into the current file.
  1879.                                       The insertion occurs at the cursor
  1880.                                       position.
  1881.  
  1882.  Arg Arg !textarg Paste               Reads the output of the system-level
  1883.  (ALT+A ALT+A !textarg SHIFT+INS)     command line given as the textarg. The
  1884.                                       output is inserted at the cursor
  1885.                                       position. For example, if the textarg
  1886.                                       is DIR, then a directory listing is
  1887.                                       inserted into the file.
  1888.  
  1889.  
  1890.  4.4  Using File Markers
  1891.  
  1892.  File markers help you move back and forth through large files. Once you have
  1893.  defined a file marker, you can move quickly to the location marked. You can
  1894.  also use a file marker as input to certain commands. For example, instead of
  1895.  moving the cursor to a marked location, you simply give the name of the
  1896.  marker.
  1897.  
  1898.  The Microsoft Editor allows you to create any number of file markers. You
  1899.  identify each with a name consisting of alphanumeric characters.
  1900.  
  1901.  Use the Mark function (CTRL+M) to create or go to a marker. The command Mark
  1902.  (CTRL+M with no argument) takes you back to the beginning of the file, just
  1903.  as Arg Mpage does. The command Arg Mark (ALT+A CTRL+M) moves you back to the
  1904.  previous cursor position. This last use of Mark is useful for switching back
  1905.  and forth quickly between two locations.
  1906.  
  1907.  Some of the most powerful uses of the Mark function involve commands with
  1908.  arguments, as shown below:
  1909.  
  1910.  Command
  1911.  (and Default Keystrokes)       Description
  1912.  
  1913.  Arg numarg Mark                Moves the cursor to the line that you
  1914.  (ALT+A numarg CTRL+M)          specify. The Microsoft Editor numbers lines
  1915.                                 beginning with the number 1, so the first
  1916.                                 line of the file is line 1, the second is
  1917.                                 line 2, and so forth.
  1918.  
  1919.  Arg Arg textarg Mark           Defines a marker at the current location.
  1920.  (ALT+A ALT+A textarg CTRL+M)   This command sets a marker which in turn can
  1921.                                 be used as input to other functions.
  1922.  
  1923.  Arg textarg Mark               Moves the cursor directly to a marker you
  1924.  (ALT+A textarg CTRL+M)         have already defined as a textarg.
  1925.  
  1926.  The marker name may include digits, but must include at least one nondigit
  1927.  character as well.
  1928.  
  1929.  
  1930.  4.4.1  Functions That Use Markers
  1931.  
  1932.  The following functions also make use of markers by accepting a previously
  1933.  defined marker name (a markarg) as an argument. These functions all use the
  1934.  area in the file defined by the cursor position and the marker. This area,
  1935.  in turn, is interpreted as a stream argument, or linearg or boxarg,
  1936.  depending on whether the editor is in stream mode or box mode. Recall that
  1937.  the Boxstream function (CTRL+B) toggles between these two modes.
  1938.  
  1939.  Function
  1940.  (and Default Keystrokes)    Description
  1941.  
  1942.  Assign (ALT+=)              Executes all assignment statements in the
  1943.                              defined area (see Chapters 6 and 7 for more
  1944.                              information)
  1945.  
  1946.  Copy (CTRL+INS)             Copies the defined area into the Clipboard
  1947.  
  1948.  Ldelete (CTRL+Y)            Deletes the defined area
  1949.  
  1950.  Linsert (CTRL+N)            Fills the defined area with spaces
  1951.  
  1952.  Qreplace (CTRL+\)           Executes search and replace over the defined
  1953.                              area, with query for confirmation
  1954.  
  1955.  Replace (CTRL+L)            Executes search and replace over the defined
  1956.                              area
  1957.  
  1958.  If you specify a marker the editor cannot find, the editor automatically
  1959.  checks the file listed in the markfile switch. See Table A.5 for more
  1960.  information on the markfile switch.
  1961.  
  1962.  
  1963.  4.4.2  Related Functions: Savecur and Restcur
  1964.  
  1965.  The Savecur and Restcur  functions are similar to Mark but do not take
  1966.  arguments. Use Savecur to save the current cursor position and Restcur to
  1967.  return to that position later. With these two functions, you can save only
  1968.  one position at a time.
  1969.  
  1970.  No keys are preassigned to Savecur or Restcur. See Chapter 6, "Function
  1971.  Assignments and Macros," for information on how to assign keys. You can also
  1972.  use Savecur and Restcur by giving them as input to the Arg textarg Execute
  1973.  command, in which textarg is the name of the function to execute:
  1974.  
  1975.    1. Invoke arg (press ALT + A)
  1976.    2. Type Savecur or Restcur
  1977.    3. Invoke Execute (press F7)
  1978.  
  1979.  
  1980.  4.5  Searching and Replacing
  1981.  
  1982.  The Psearch function (F3) directs the editor to conduct a forward search (a
  1983.  "plus search") for the next occurrence of the specified string. All searches
  1984.  take place from the current cursor position to the end of the file.
  1985.  
  1986.  The most common uses of Psearch consist of the following commands:
  1987.  
  1988.  Command
  1989.  (and Default Keystrokes)     Description
  1990.  
  1991.  Arg textarg Psearch         Directs the editor to look for the string given
  1992.  (ALT+A textarg F3)          as textarg. The editor scrolls the screen, if
  1993.                              necessary, and moves the cursor to the next
  1994.                              occurrence of textarg in the file.
  1995.  
  1996.  Psearch (F3)                Directs the editor to look for the most recently
  1997.                              specified search string.
  1998.  
  1999.  Arg Psearch (ALT+A F3)      Directs the editor to take the word at the
  2000.                              current cursor position as the search string.
  2001.                              (In other words, the search string consists of
  2002.                              all charac-ters from the cursor to the first
  2003.                              blank or new line.)
  2004.  
  2005.  You can search backward with Msearch  (a "minus search"). The Msearch
  2006.  function (F4) uses syntax identical to Psearch. Backward searches take place
  2007.  from the current cursor position to the beginning of the file. In addition,
  2008.  Msearch with no argument assumes the same search string that was specified
  2009.  with Psearch. Therefore, after searching forward for a string, you can
  2010.  search backward for the same string just by pressing F4.
  2011.  
  2012.  All versions of the Psearch and Msearch commands are affected by case
  2013.  sensitivity. By default, case sensitivity is off, so the editor carries out
  2014.  searches for strings without distinguishing between uppercase and lowercase
  2015.  letters. How-ever, you can change this behavior by turning the case switch
  2016.  on, using the syntax for switch settings explained in Chapter 7, "Switches,
  2017.  Assignments, and the TOOLS.INI File."
  2018.  
  2019.  You can also temporarily reverse the setting of the case switch by turning
  2020.  on the Meta prefix. Therefore, if case sensitivity is off, you can conduct a
  2021.  case-sensitive search with the MetaPsearch (F9 F3) or Meta Msearch (F9 F4)
  2022.  command.
  2023.  
  2024.  
  2025.  4.5.1  Searching for a Pattern of Text
  2026.  
  2027.  The commands described above search for an exact match of the string you
  2028.  specify. However, sometimes you may want to search for a set of different
  2029.  strings: for example, any word that begins with "B" and ends with "ing."
  2030.  
  2031.  You can search for a pattern of text by specifying a "regular expression." A
  2032.  regular expression is a string that specifies a pattern of text by using
  2033.  certain special characters. Chapter 5 describes how to specify regular
  2034.  expressions.
  2035.  
  2036.  The command Arg Arg textarg Psearch (ALT+A ALT+A textarg F3) searches
  2037.  forward for a string that matches the regular expression specified as the
  2038.  textarg. The command Arg Arg textarg Msearch (ALT+A ALT+A textarg F4)
  2039.  searches backward for a string that matches the regular expression specified
  2040.  as the textarg.
  2041.  
  2042.  Regular-expression searches are affected by case sensitivity, as explained
  2043.  in the previous section.
  2044.  
  2045.  
  2046.  4.5.2  Searching the File Globally
  2047.  
  2048.  The Searchall function (SHIFT+F6) takes the same syntax that Psearch does,
  2049.  but instead of finding the next occurrence of a string, the Searchall
  2050.  function high-lights every string in the file that matches the search
  2051.  string. For example, to highlight every occurrence of the word float in a
  2052.  file, follow these steps:
  2053.  
  2054.    1. Invoke Arg (press ALT+A)
  2055.    2. Type the following search string: float
  2056.    3. Invoke Searchall by pressing SHIFT+F6
  2057.  
  2058.  Any action other than cursor movement removes the highlight. The color of
  2059.  the highlight is normally different from the highlight color in
  2060.  cursor-movement arguments.
  2061.  
  2062.  
  2063.  4.5.3  Searching a Series of Files
  2064.  
  2065.  You can search a series of files without leaving the editor. The Mgrep
  2066.  command takes the same syntax that Psearch and Msearch do. For example, the
  2067.  command Arg Arg textarg Mgrep searches for a regular expression. The editor
  2068.  responds to Mgrep by placing all strings found in the <compile> pseudo file.
  2069.  You can look at the file by using Setfile or invoking the Nextmsg function.
  2070.  
  2071.  Before using Mgrep, place the list of files to search in a macro named
  2072.  mgreplist. This list can contain DOS wildcards and environment variables.
  2073.  For example, the following steps direct Mgrep to search the following files:
  2074.  the file JUNK.TXT; files that have a .C extension and are in the current
  2075.  directory; and files that have a .H extension and are in any directory
  2076.  listed in the INCLUDE environment varible:
  2077.  
  2078.    1. Invoke Arg (press ALT+A)
  2079.  
  2080.    2. Define the value of mgreplist by typing the following:
  2081.  
  2082.         mgreplist:="JUNK.TXT *.C $INCLUDE:*.H"
  2083.  
  2084.    3. Invoke Assign by pressing ALT+= (hold down the ALT key and press the
  2085.       equals sign)
  2086.  
  2087.  You refer to an environment variable with the following syntax, in which
  2088.  ENVAR is the name of the variable. The name must be entered in uppercase
  2089.  characters:
  2090.  
  2091.       $ENVAR:
  2092.  
  2093.  
  2094.  4.5.4  Search-and-Replace Functions
  2095.  
  2096.  To replace repeated occurrences of one text string by another, use the
  2097.  search-and-replace function Replace (CTRL+L). By default, the replacement
  2098.  happens from the cursor position to the end of the file. However, as
  2099.  described below, you can restrict the range over which the replacement
  2100.  happens.
  2101.  
  2102.  No matter what command syntax you use with Replace, the editor reacts by
  2103.  prompting you for a search string and a replacement string, and then
  2104.  executing the search and replace. If you have used Replace or Qreplace
  2105.  ("query replace") before, the previous value of the search or replace string
  2106.  appears on the dialog line. To use the string displayed, press ENTER.
  2107.  
  2108.  The identical commands Replace and Arg Replace execute replacement from the
  2109.  current cursor position to the end of the file. You can also specify a range
  2110.  for the replacement by using one of the following commands:
  2111.  
  2112.  Command                     Default Keystrokes
  2113.  
  2114.  Arg linearg Replace         ALT+A linearg CTRL+L
  2115.  
  2116.  Arg numarg Replace          ALT+A numarg CTRL+L
  2117.  
  2118.  Arg boxarg Replace          ALT+A boxarg CTRL+L
  2119.  
  2120.  Arg streamarg Replace       ALT+A streamarg CTRL+L
  2121.  
  2122.  Arg markarg Replace         ALT+A markarg CTRL+L
  2123.  
  2124.  If you specify a numarg, the replacement operation is limited to the
  2125.  specified number of lines, beginning with the current line. If you specify a
  2126.  linearg, streamarg, or boxarg, the replacement occurs only within the
  2127.  highlighted area. If you specify a markarg, the replacement occurs in the
  2128.  region of text between the cursor position and the marker. The shape of the
  2129.  region changes depending on whether the editor is in box mode or stream
  2130.  mode.
  2131.  
  2132.  The Replace function is most efficient when you are sure you want the
  2133.  replacement to be executed in every case. If you want to regulate how often
  2134.  the replacement occurs, use Qreplace (CTRL+\). This function takes the same
  2135.  syntax as Replace, but prompts you for confirmation before each replacement.
  2136.  Qreplace asks you to press Y for yes, N for no, or A for all, which causes
  2137.  replacement to proceed without further confirmation. Pressing Q (quit)
  2138.  terminates replacement.
  2139.  
  2140.  The Replace and Qreplace functions both take regular expressions as search
  2141.  strings when you introduce the argument with Arg Arg instead of Arg. (See
  2142.  Chapter 5 for information on regular expressions.) Otherwise, syntax is
  2143.  identical, and the functions accept the same arguments.
  2144.  
  2145.  Search and replacing is affected by case sensitivity, as explained in
  2146.  Section 4.5.1.
  2147.  
  2148.  You can use the Mreplace function to execute replacements throughout a
  2149.  series of files. See Appendix A, "Reference Tables," for more information.
  2150.  
  2151.  
  2152.  4.6  Compiling
  2153.  
  2154.  One of the strengths of the Microsoft Editor is its capability as a
  2155.  development environment. You can write a program and compile (or assemble)
  2156.  from within the editor. If the compilation fails, you can make corrections
  2157.  to the source file when you view the errors and then compile again.
  2158.  
  2159.  Ordinarily, a compiler sends error messages directly to the screen while you
  2160.  are outside the editor. When you compile from within the Microsoft Editor,
  2161.  however, the error messages are displayed on the dialog line. The Nextmsg
  2162.  function (SHIFT+F3) displays the error messages in sequence and positions
  2163.  the cursor at the beginning of the line with the next error. You can make
  2164.  corrections immediately.
  2165.  
  2166.  The Compile function (CTRL+F3) appears in a variety of commands, as shown in
  2167.  Section 4.6.1.
  2168.  
  2169.  
  2170.  4.6.1  Invoking Compilers and Other Utilities
  2171.  
  2172.  When you run the protected-mode version of the editor under OS/2,
  2173.  compilations run in the background and the editor beeps when the compilation
  2174.  is completed. (While a background compilation is running, the letters BP
  2175.  appear on the status line.) When running the real-mode version of the editor
  2176.  (under DOS or the OS/2 3.x compatibility box), you cannot edit again until
  2177.  the compilation has completed.
  2178.  
  2179.  With the Microsoft Editor's compilation capability, you can invoke any
  2180.  program or utility and specify any command-line options. To invoke a program
  2181.  directly, use one of the following commands:
  2182.  
  2183.  Command
  2184.  (and Default Keystrokes)             Description
  2185.  
  2186.  Arg Arg textarg Compile              Runs the system-level command described
  2187.  (ALT+A ALT+A textarg CTRL+F3)        by textarg. Typically, this command
  2188.                                       runs the compiler.
  2189.  
  2190.  Arg Compile                          Runs a compilation according to the
  2191.  (ALT+A CTRL+F3)                      extmake switch.
  2192.  
  2193.  Arg textarg Compile                  Runs a compilation according to the
  2194.  (ALT+A CTRL+F3)                      "text" setting of the extmake switch.
  2195.                                       This version of the command is
  2196.                                       typically used with the NMAKE utility.
  2197.  
  2198.  Arg Meta Compile                     Kills any compilation running in the
  2199.  (ALT+A F9 CTRL+F3)                   background after prompting for
  2200.                                       confirmation (OS/2 only).
  2201.  
  2202.  Usually, it is more convenient to set your compile command once by setting
  2203.  the extmake switch and giving the Arg Compile command each time you compile.
  2204.  
  2205.  A "switch" is a variable that you can set to control the editor's behavior.
  2206.  See Chapter 7, "Switches, Assignments, and the TOOLS.INI File," for more
  2207.  information on switches and how to set them.
  2208.  
  2209.  The Arg Compile command examines the file extension of the current file and
  2210.  executes the corresponding extmake setting. The extmake switch can have a
  2211.  different setting for each file extension. The general form of an extmake
  2212.  assignment is
  2213.  
  2214.       extmake:ext command-line
  2215.  
  2216.  in which ext is a file extension and command-line is the compile command to
  2217.  invoke for files with this extension. For example, suppose you want to
  2218.  invoke the following compile command for use with .C files:
  2219.  
  2220.       cl /AL /Zi /Ox %s
  2221.  
  2222.  The characters %s represent the name of the current file. To automatically
  2223.  invoke this compile command with Arg Compile, you would first follow these
  2224.  steps to set the extmake switch:
  2225.  
  2226.    1. Invoke Arg (press ALT+A)
  2227.  
  2228.    2. Type the following text: extmake:c cl /AL /Zi /Ox %s
  2229.  
  2230.    3. Press ALT+= to invoke Assign (hold down the ALT key and press the
  2231.       equals sign)
  2232.  
  2233.  The editor then invokes the desired command line whenever you give the Arg
  2234.  Compile command and are editing a .C file.
  2235.  
  2236.  To use the Arg textarg Compile command, first set extmake with a text
  2237.  extension:
  2238.  
  2239.       extmake:text command-line
  2240.  
  2241.  If the symbol %s appears in command-line, it is replaced with the text
  2242.  argument to Compile. For example, if extmake has the setting
  2243.  
  2244.       extmake:text nmake %s
  2245.  
  2246.  and you pass the text argument projectx to the Compile function, the editor
  2247.  executes the following system-level command:
  2248.  
  2249.       nmake projectx
  2250.  
  2251.  
  2252.  4.6.2  Viewing Error Output
  2253.  
  2254.  To generate error output that you can view from within the editor, the
  2255.  compiler or assembler must output errors in one of the following formats:
  2256.  
  2257.       filename row column: message
  2258.       filename (row, column): message
  2259.       filename (row):message
  2260.       filename: row: message
  2261.       "filename", row column: message
  2262.  
  2263.  The Microsoft Editor, in turn, reads the error output directly and responds
  2264.  by moving the cursor to each location where an error was reported while
  2265.  displaying the message on the dialog line. (The method for moving between
  2266.  error locations is described below.) The following programs output error
  2267.  messages in a format readable by the Microsoft Editor:
  2268.  
  2269.    ■  Microsoft C Optimizing Compiler
  2270.    ■  Microsoft Macro Assembler
  2271.    ■  Microsoft Pascal Compiler 4.0
  2272.    ■  Microsoft BASIC Compiler 6.0
  2273.    ■  Microsoft FORTRAN Optimizing Compiler 4.1
  2274.  
  2275.  ───────────────────────────────────────────────────────────────────────────
  2276.  NOTE
  2277.     With the Pascal and BASIC compilers, you must use the /Z command-line
  2278.     option with either the PL or BC driver to generate error output that the
  2279.     Microsoft Editor can read. (The extmake switch, discussed in Chapter 7,
  2280.     uses the /Z option by default.)
  2281.  ───────────────────────────────────────────────────────────────────────────
  2282.  
  2283.  When a compilation fails in real mode, the editor displays the first error
  2284.  message and positions the cursor at the line with the error. The Nextmsg
  2285.  function (SHIFT+F3) displays the next error message and repositions the
  2286.  cursor at the appropriate line.  ;Nextmsg
  2287.  
  2288.  When a compilation fails in protected mode, the editor beeps rather than
  2289.  interrupts your current activity. If you had previously viewed the results
  2290.  of an earlier compilation, give the Arg Meta Nextmsg command (ALT+A  F9
  2291.  SHIFT+F3) to advance to the current set of error messages. Then, regardless
  2292.  of how many compilations you are running, press SHIFT+F3 to display the
  2293.  first error message and move the cursor to the line with that error.
  2294.  
  2295.  Some common ways to use the Nextmsg function are shown below:
  2296.  
  2297.  Command
  2298.  (and Default Keystrokes)    Description
  2299.  
  2300.  Nextmsg (SHIFT+F3)          Moves cursor to location of next error message
  2301.                              and displays text of error message on the dialog
  2302.                              line.
  2303.  
  2304.  Arg numarg Nextmsg          Moves forward or backward by  numarg error
  2305.  (ALT+A numarg SHIFT+F3)     messages. For example, if numarg is -1, moves
  2306.                              the cursor to the previous error message.
  2307.  
  2308.  Arg Meta Nextmsg            OS/2 only. Advances to next set of error
  2309.  (ALT+A A SHIFT+F3)          messages. Under OS/2, the editor maintains error
  2310.                              messages for all compilations. This command
  2311.                              directs the editor to advance to the error
  2312.                              messages for the subsequent compilation.
  2313.  
  2314.                              This feature supports simultaneous background
  2315.                              compilations. No matter how many compilations
  2316.                              you exe-cuted, you can view every set of error
  2317.                              messages.
  2318.  
  2319.  
  2320.  4.6.3  Viewing the Dynamic-Compile Log
  2321.  
  2322.  Reviewing error messages as described in the previous section is useful when
  2323.  each error message corresponds to a location in your source file. However,
  2324.  some messages (such as linker errors) do not correspond to specific lines of
  2325.  code. To review these errors, as well as general compilation errors, you may
  2326.  want to view the actual error-message text.
  2327.  
  2328.  The editor keeps the complete error output of each compilation──including
  2329.  output from any utilities that were invoked──in the <compile> pseudo file.
  2330.  If the editor is running in real mode, you can view the <compile> pseudo
  2331.  file after a compilation is complete by following these steps:
  2332.  
  2333.    1. Invoke Arg (press ALT+A)
  2334.    2. Type the following text: <compile>
  2335.    3. Invoke Setfile (press F2)
  2336.  
  2337.  If the editor is running in OS/2 protected mode, you can view the  error
  2338.  output in the same manner described above. You can also view the <compile>
  2339.  pseudo file as the compilation is running. Under protected mode, the
  2340.  <compile> pseudo file is updated dynamically; as each error message is
  2341.  produced by the compiler or utility, the editor adds the message to the end
  2342.  of this file.
  2343.  
  2344.  Using the techniques described in the next section, you can open <compile>
  2345.  as a separate window. This lets you continue to edit your source file while
  2346.  watching error messages appear the instant an error is detected. The command
  2347.  Arg Meta Compile kills the compilation.
  2348.  
  2349.  
  2350.  4.7  Using Editing Windows
  2351.  
  2352.  An "editing window" is a division of the screen that functions independently
  2353.  from other portions of the screen. When you have two or more windows
  2354.  present, each functions as a miniature screen. For example, one window can
  2355.  view lines 5-15 while another window views lines 90-97. You can even use
  2356.  windows to view two or more files simultaneously.
  2357.  
  2358.  Although windows are tiled, they can view overlapping areas of text. Changes
  2359.  and highlighting are reflected simultaneously in all windows that view the
  2360.  area of altered text.
  2361.  
  2362.  You can have up to eight windows on the screen and create either horizontal
  2363.  or vertical divisions between windows. The command Window (F6 with no
  2364.  arguments) moves the cursor between windows.To create or merge a window,
  2365.  move the cursor to the row or column at which you want to create a new
  2366.  division, and give one of the following commands:
  2367.  
  2368.  Command
  2369.  (and Default Keystrokes)      Description
  2370.  
  2371.  Arg Window                    Creates a horizontal window (split at the
  2372.  (ALT+A F6)                    cursor row)
  2373.  
  2374.  Arg Arg Window                Creates a vertical window (split at the
  2375.  (ALT+A ALT+A F6)              cursor column)
  2376.  
  2377.  Meta Window                   Closes the current window by merging it with
  2378.  (F9 F6)                       the window to the right or below
  2379.  
  2380.  Each window must have a minimum of 5 lines and 10 columns. If you try to
  2381.  create a window of a smaller size, the command fails.
  2382.  
  2383.  
  2384.  4.8  Working with Multiple Files
  2385.  
  2386.  You can load a new file in the screen or current window with the Setfile
  2387.  function.
  2388.  
  2389.  Command
  2390.  (and Default Keystrokes)     Description
  2391.  
  2392.  Arg textarg Setfile         Loads the file specified in the textarg.
  2393.  (ALT+A textarg F2)
  2394.  
  2395.  Setfile (F2)                Loads the previous file. You can use Setfile to
  2396.                              move back and forth between two files.
  2397.  
  2398.  You can also use Setfile by following these steps:
  2399.  
  2400.    1. Bring up the information file with the Information function  (press
  2401.       F10).
  2402.  
  2403.    2. Move the cursor to the beginning of the name of a file.
  2404.  
  2405.    3. Select the file that the cursor is on by giving the command Arg Setfile
  2406.       (press ALT+A F2).
  2407.  
  2408.  The information file contains the names of all files that you have edited
  2409.  before, up to the limit specified by the tmpsav switch. (See Table A.5 for
  2410.  more information on switches.) Active files──files that have been edited
  2411.  during this session──are listed with their current lengths. This file also
  2412.  tells whether the text in the Clipboard was copied in line (box) or stream
  2413.  mode.
  2414.  
  2415.  When an old file is reloaded, the editor remembers cursor and window
  2416.  information from the last time you edited the file. The editor stores this
  2417.  information in the file M.TMP (or MEP.TMP, if the editor is named MEP).
  2418.  
  2419.  The Arg textarg Setfile command accepts wild-card characters (? matches any
  2420.  character and * matches any string) in the textarg. The command responds by
  2421.  displaying a list of files that match the textarg. You can then select a
  2422.  file by using the steps outlined above. For example, the following sequence
  2423.  causes the editor to list all files with a .C extension:
  2424.  
  2425.    1. Invoke the Arg function (press ALT+A)
  2426.    2. Type the following: *.c
  2427.    3. Invoke the Setfile function (press F2)
  2428.  
  2429.  
  2430.  4.9  Printing a File
  2431.  
  2432.  You can print a file without leaving the Microsoft Editor. You can also
  2433.  print a highlighted area or a series of files. Use the Print function
  2434.  (CTRL+F8) to perform each of these actions:
  2435.  
  2436.  Command
  2437.  (and Default Keystrokes)          Description
  2438.  
  2439.  Print (CTRL+F8)                   Prints all of the current file.
  2440.  
  2441.  Arg cursor-movement Print         Prints the highlighted area.
  2442.  (ALT+A cursor-movement CTRL+F8)
  2443.  
  2444.  Arg textarg Print                 Prints the file or files specified in
  2445.  (ALT+A textarg CTRL+F8)           textarg. If there is more than one file,
  2446.                                    separate them with a space.
  2447.  
  2448.  By default, the Print function responds by sending the specified output to
  2449.  the LPT1 device. However, you can specify a different print command by
  2450.  setting the printcmd switch.
  2451.  
  2452.  For example, suppose you want to print a file by using the following
  2453.  command:
  2454.  
  2455.       COPY %s LPT2
  2456.  
  2457.  The characters %s represent the file name (in the case of highlighted
  2458.  regions, the editor creates a temporary file). To invoke this command each
  2459.  time you use the Print function, you first follow these steps to set the
  2460.  printcmd switch:
  2461.  
  2462.    1. Invoke Arg (press ALT+A)
  2463.  
  2464.    2. Type the following text: printcmd:COPY %s LPT2
  2465.  
  2466.    3. Press ALT+= to invoke Assign (hold down the ALT key and type the equals
  2467.       sign)
  2468.  
  2469.  When printing from within the protected-mode editor under OS/2, the printing
  2470.  occurs as a background operation and BP is displayed at the lower-right-hand
  2471.  corner of the screen. The <print> pseudo file maintains a log of the printed
  2472.  output.
  2473.  
  2474.  ───────────────────────────────────────────────────────────────────────────
  2475.  NOTE
  2476.     A "switch" is a variable you can set to control the editor's behavior.
  2477.     See Chapter 7, "Switches, Assignments, and the TOOLS.INI File," for more
  2478.     information on switches and how to set them.
  2479.  ───────────────────────────────────────────────────────────────────────────
  2480.  
  2481.  
  2482.  Chapter 5  Regular Expressions
  2483.  ───────────────────────────────────────────────────────────────────────────
  2484.  
  2485.  A "regular expression" is a special search string that matches a pattern of
  2486.  text rather than a specific sequence of characters. With regular
  2487.  expressions, you can search for such targets as every five-digit number, or
  2488.  every string in quotes, without having to specify the exact text to search
  2489.  for.
  2490.  
  2491.  In a regular expression, certain characters lose their literal meaning,
  2492.  becoming symbols or placeholders that specify the text pattern you want to
  2493.  match. In a regular expression such as a[123], the a is still the literal
  2494.  character "a". The brackets, however, are not search targets. Rather, they
  2495.  enclose a set of characters, any one of which is a match. Therefore, the
  2496.  regular expression a[123] matches any of these strings:
  2497.  
  2498.       a1
  2499.       a2
  2500.       a3
  2501.  
  2502.  The Microsoft Editor supports two versions of regular-expression syntax:
  2503.  UNIX(R) and M 1.0. The UNIX syntax provides compatibility with the syntax
  2504.  used by programming utilities for the UNIX and XENIX(R) operating systems
  2505.  and CodeView(R). M 1.0 syntax does not provide this compatibility; however,
  2506.  it offers more power.
  2507.  
  2508.  This chapter examines three aspects of regular-expression syntax:
  2509.  
  2510.    ■  Choosing the syntax
  2511.    ■  Using UNIX syntax
  2512.    ■  Using M 1.0 syntax
  2513.  
  2514.  You can use regular expressions with the search functions (Psearch, Msearch,
  2515.  Replace, and Qreplace). Each of these functions recognizes a regular
  2516.  expression (rather than an ordinary text string) when you use Arg Arg to
  2517.  introduce the string.
  2518.  
  2519.  
  2520.  5.1  Choosing the Syntax
  2521.  
  2522.  The Microsoft Editor supports two forms of regular-expression syntax: the
  2523.  M 1.0 form and the UNIX standard. If you know the UNIX standard, you can use
  2524.  it immediately. However, the slightly different M 1.0 syntax of the
  2525.  Microsoft Editor is more powerful.
  2526.  
  2527.  By default, the editor recognizes the UNIX syntax for regular expressions.
  2528.  To use the M 1.0 syntax instead, follow these steps:
  2529.  
  2530.    1. Invoke Arg (press ALT+A)
  2531.    2. Type the following: unixre:no
  2532.    3. Invoke Assign (press ALT+=)
  2533.  
  2534.  To enable the standard UNIX syntax, follow the same steps but type unixre:
  2535.  instead of unixre:no.
  2536.  
  2537.  If you would like the editor to run automatically in M 1.0 mode, rather than
  2538.  having to manually invoke the Assign function, add a unixre:no entry to the
  2539.  TOOLS.INI file. See Chapter 7, "Switches, Assignments, and the TOOLS.INI
  2540.  File," for more information.
  2541.  
  2542.  
  2543.  5.2  UNIX(R) Regular-Expression Syntax
  2544.  
  2545.  The UNIX regular-expression syntax is compatibile with UNIX utilities and
  2546.  CodeView. By default, the editor uses UNIX syntax for regular expressions.
  2547.  The M 1.0 syntax offers the same capabilities as the UNIX syntax, plus a few
  2548.  additional features.
  2549.  
  2550.  
  2551.  5.2.1  UNIX Regular Expressions as Simple Strings
  2552.  
  2553.  The power of regular expressions comes from the use of the special
  2554.  characters and character sequences listed below. A regular expression that
  2555.  does not contain these special characters or character sequences acts as a
  2556.  literal text string:
  2557.  
  2558.       \(  \)  [  ]  !  .  ^  $  *
  2559.  
  2560.  For example, the regular expression match me precisely matches only a
  2561.  literal occurrence of itself because it contains no special characters.
  2562.  
  2563.  
  2564.  5.2.2  UNIX Special Characters
  2565.  
  2566.  The UNIX operators offer the standard pattern-matching capabilities found in
  2567.  many other editors and utilities that use regular expressions.
  2568.  
  2569.  The list below describes the special characters that have a simple usage.
  2570.  The term class has a special meaning defined below. All other characters
  2571.  should be interpreted literally.
  2572.  
  2573.  Expression                  Description
  2574.  
  2575.  \                           Escape. Causes the editor to ignore the special
  2576.                              meaning of the next character. For example, the
  2577.                              expression \. matches . in the text file; the
  2578.                              expression \^ matches  ^; and the expression \\
  2579.                              matches \.
  2580.  
  2581.  .                           Wildcard. Matches any single character. For
  2582.                              example, the expression a.a matches aaa, aBa,
  2583.                              and a1a, but not aBBBa.
  2584.  
  2585.  ^                           Beginning of line. For example, ^The matches the
  2586.                              word The only when it occurs at the beginning of
  2587.                              a line.
  2588.  
  2589.  $                           End of line. For example, end$ matches the word
  2590.                              end only when it occurs at the end of a line.
  2591.  
  2592.  [class]                     Character class. Matches any one character in
  2593.                              the class. Use a dash (-) to specify a
  2594.                              contiguous range of ASCII values. For example,
  2595.                              [a-zA-Z0-9] matches any letter or digit, and
  2596.                              [abc]  matches a, b, or c.
  2597.  
  2598.  [^class]                    Inverse of character class. Matches any
  2599.                              character not specified in the class.
  2600.  
  2601.  The special characters with more complex usage are described in the
  2602.  following list. The expression X is a placeholder representing a regular
  2603.  expression that is either a single character, a group of characters enclosed
  2604.  in brackets ([]), or the regular-expression delimiters \( and \). The letter
  2605.  n represents a one-digit number.
  2606.  
  2607.  Expression                  Description
  2608.  
  2609.  X*                          Repeat operator. Matches zero or more
  2610.                              occurrences of X. For example, the regular
  2611.                              expression ba*b matches baaab, bab, and bb. This
  2612.                              operator always matches as many characters as
  2613.                              possible.
  2614.  
  2615.  \( ... \)                   Tagged expression. A marked substring which you
  2616.                              can refer to elsewhere in the search string, or
  2617.                              in a replacement string, as \n. When a tagged
  2618.                              expression is referred to in a search string,
  2619.                              the editor finds text with the tagged expression
  2620.                              repeated. When a tagged expression is referred
  2621.                              to in a replacement string, the editor reuses
  2622.                              part of the text it is replacing.
  2623.  
  2624.                              The exact use of tags is explained in Sections
  2625.                              5.2.4 and 5.2.5. Characters falling between
  2626.                              \( and \) are treated as a group.
  2627.  
  2628.  \n                          Reference to the characters matched by a tagged
  2629.                              expression. The number n indicates which
  2630.                              expression. The first tagged expression is
  2631.                              represented as \1, the second as \2, and so
  2632.                              on.
  2633.  
  2634.  The procedure below uses some of the special characters presented in this
  2635.  section. To find the next occurrence of a number (that is, a string of
  2636.  digits) beginning with a digit 1 or 2, perform the following sequence of
  2637.  keystrokes:
  2638.  
  2639.    1. Invoke Arg twice (press ALT+A twice)
  2640.    2. Type the following characters: [12][0-9]*
  2641.    3. Invoke Psearch (press F3)
  2642.  
  2643.  
  2644.  5.2.3  Combining UNIX Special Characters
  2645.  
  2646.  Special characters are most powerful when used in combination. For example,
  2647.  the wildcard (.) and repeat (*) characters are often used together:
  2648.  
  2649.       .*
  2650.  
  2651.  The expression above means "match any string of characters." Although this
  2652.  expression is not useful by itself, it is quite useful when part of a larger
  2653.  expression. For example,
  2654.  
  2655.       B.*ing
  2656.  
  2657.  means "match any string beginning with B and ending with ing".
  2658.  
  2659.  In cases where a single character is surrounded by two operators, regular
  2660.  expressions are interpreted from left to right. For example, suppose the
  2661.  following is part of a regular expression:
  2662.  
  2663.       \1*
  2664.  
  2665.  In the expression above, the repeat operator (*) applies to the characters
  2666.  \1 as a single unit.
  2667.  
  2668.  If you want the repeat operator to apply to a group, enclose the group
  2669.  inside the symbols \( and \). These characters tag an expression (as
  2670.  explained in the next section) and are useful for treating a series of
  2671.  characters as a group.
  2672.  
  2673.  
  2674.  5.2.4  Tagged Expressions in the UNIX Search String
  2675.  
  2676.  A "tagged expression" is a substring delimited by the symbols \ (and \). You
  2677.  can enter any regular-expression characters between these delimiters. Tagged
  2678.  expressions are used to specify text patterns that contain repeated elements
  2679.  and to mark a string for reuse.
  2680.  
  2681.  The editor first searches for a character string that matches the entire
  2682.  regular expression. It then tags each substring specified in a tagged
  2683.  expression. Up to nine substrings at a time may be tagged.
  2684.  
  2685.  Once a tagged expression has been matched, you can refer to the specific
  2686.  string of characters that matched that expression. Use the syntax
  2687.  
  2688.       \n
  2689.  
  2690.  in which n is a number that selects the expression. The symbol \1
  2691.  represents the first tagged expression, the symbol \2 represents the second
  2692.  tagged expression, and so on. The use of \n does not search for a new match
  2693.  for the tagged expression. Rather, it matches only an occurrence of the same
  2694.  characters that the tagged expression itself matched.
  2695.  
  2696.  For example, consider the following expression:
  2697.  
  2698.       \(.\)\1\1
  2699.  
  2700.  The expression above means, "match any character, then see if it's followed
  2701.  by two occurrences of the same character." The following strings all satisfy
  2702.  this requirement:
  2703.  
  2704.       aaa
  2705.       XXX
  2706.       111
  2707.  
  2708.  Note that this regular expression is not equivalent to ... (three wild
  2709.  cards).  The expression ... matches any three characters; the characters do
  2710.  not need to be the same.
  2711.  
  2712.  The next expression is more complex:
  2713.  
  2714.       \([A-Za-z]*\)==\1
  2715.  
  2716.  This expression means "match any number of letters, then see if the letters
  2717.  are followed by two equals signs (==) and a repetition of the original
  2718.  group." This expression matches the first two strings below but not the
  2719.  third:
  2720.  
  2721.       ABCxyz==ABCxyz
  2722.       i==i
  2723.       ABCxyz==KBCxjj
  2724.  
  2725.  
  2726.  5.2.5  Tagged Expressions in the UNIX Replacement String
  2727.  
  2728.  You can refer to tagged expressions in replacement strings as well as in
  2729.  search strings. Parts of the string to be replaced may be reused by
  2730.  referring to the tagged expressions that originally matched those parts. Use
  2731.  the syntax described in the previous section.
  2732.  
  2733.  For example, suppose you want to find all occurrences of hexdigitsH and
  2734.  replace them with strings of the form 16#hexdigits. You can search for
  2735.  strings of the form hexdigitsH by specifying the regular expression
  2736.  
  2737.       \([0-9a-fA-F]*\)H
  2738.  
  2739.  and then specifying the following replacement string:
  2740.  
  2741.       16#\1
  2742.  
  2743.  The result is that the Microsoft Editor searches for any occurrence of one
  2744.  or more hexadecimal digits (digits 0-9 and the letters a-f) followed by the
  2745.  letter H. Each matching string is replaced by a new string that consists of
  2746.  the original digits (which were tagged so they could be reused) and the
  2747.  prefix 16#. For example, the string 1a000H is replaced with the string
  2748.  16#1a000.
  2749.  
  2750.  Use two backslashes (\\) to represent a literal backslash (\). Within
  2751.  replacement strings, all characters except the backslashes are literals. The
  2752.  backslash is considered to be the first character of a regular-expression
  2753.  reference, such as \4.
  2754.  
  2755.  
  2756.  5.3  M 1.0 Regular-Expression Syntax
  2757.  
  2758.  The M 1.0 syntax is fully compatible with the regular-expression syntax used
  2759.  by Version 1.0 of the Microsoft Editor. This syntax offers all the features
  2760.  of UNIX regular-expression syntax (though sometimes using different
  2761.  characters), plus additional features.
  2762.  
  2763.  To choose M 1.0 syntax, you must set the unixre switch to off, as described
  2764.  in Section 5.1, "Choosing the Syntax."
  2765.  
  2766.  
  2767.  5.3.1  M 1.0 Regular Expressions as Simple Strings
  2768.  
  2769.  The power of regular expressions comes from the use of the special
  2770.  characters listed below. A regular expression that does not contain these
  2771.  special characters acts as if it were a literal text string:
  2772.  
  2773.       \  {  }  (  )  [  ]  !  ~  :  ?  ^  $  +  *  @  #
  2774.  
  2775.  For example, the regular expression match me precisely matches only a
  2776.  literal occurrence of itself because it contains no special characters.
  2777.  
  2778.  
  2779.  5.3.2  M 1.0 Special Characters
  2780.  
  2781.  The M 1.0 syntax offers a rich set of pattern-matching capabilities. Most of
  2782.  the special characters described below have analogs in other editors and
  2783.  utilities that use regular expressions.
  2784.  
  2785.  The list below describes the special characters that have a simple usage.
  2786.  The term class has a special meaning defined below. All other characters
  2787.  should be interpreted literally.
  2788.  
  2789.  Expression                  Description
  2790.  
  2791.  \                           Escape. Causes the editor to ignore the special
  2792.                              meaning of the next character. For example, the
  2793.                              expression \? matches ? in the text file; the
  2794.                              expression \^ matches  ^; and the expression \\
  2795.                              matches \.
  2796.  
  2797.  ?                           Wildcard. Matches any single character. For
  2798.                              example, the expression a?a matches aaa, aBa,
  2799.                              and a1a, but not aBBBa.
  2800.  
  2801.  ^                           Beginning of line. For example, ^The matches the
  2802.                              word The only when it occurs at the beginning of
  2803.                              a line.
  2804.  
  2805.  $                           End of line. For example, end$ matches the word
  2806.                              end only when it occurs at the end of a line.
  2807.  
  2808.  [class]                     Character class. Matches any one character in
  2809.                              the class. Use a dash (-) to specify ranges. For
  2810.                              example, [a-zA-Z0-9] matches any character or
  2811.                              digit, and [abc] matches a, b, or c.
  2812.  
  2813.  [~class]                    Noncharacter class. Matches any character not
  2814.                              specified in the class.
  2815.  
  2816.  The special characters with more complex usage are described in the
  2817.  following list. The expression X is a placeholder representing a regular
  2818.  expression that is either a single character or a group of characters
  2819.  enclosed in parentheses (()), brackets ([]), or braces ({}). The
  2820.  placeholders X1, X2, and so on, represent any regular expression.
  2821.  
  2822.  Expression                  Description
  2823.  
  2824.  X*                          Minimal matching. Matches zero or more
  2825.                              occurrences of X. For example: the regular
  2826.                              expression ba*b matches baaab, bab, and bb.
  2827.  
  2828.  X+                          Minimal matching plus (shorthand for XX*).
  2829.                              Matches one or more occurrences of X. The
  2830.                              regular expression ba+b matches baab and bab
  2831.                              but not bb.
  2832.  
  2833.  X@                          Maximal matching. Identical to X*, except for
  2834.                              differences in matching method explained in
  2835.                              Section 5.3.4.
  2836.  
  2837.  X#                          Maximal matching plus. Identical to X+, except
  2838.                              for differences in matching method explained in
  2839.                              Section 5.3.4.
  2840.  
  2841.  (X1!X2!...!Xn)              Alternation. Matches either X1, X2, and so
  2842.                              forth. It tries to match them in that order and
  2843.                              switches from Xi to Xi+1 only if the rest of the
  2844.                              expression fails to match. For example, the
  2845.                              regular expression (ww!xx!xxyy)zz matches xxzz
  2846.                              on the second alternative and xxyyzz on the
  2847.                              third.
  2848.  
  2849.  ~X                          Not function. Matches nothing, but checks to see
  2850.                              if the string matches X at this point and fails
  2851.                              if it does. For example, ^~(if!while)?*$ matches
  2852.                              all lines that do not begin with if or while.
  2853.  
  2854.  X^n                         Power function. Matches exactly n copies of X.
  2855.                              For example, w^4 matches wwww and (a?)^3 matches
  2856.                              a#aba5.
  2857.  
  2858.  {...}                       Tagged expression, which is a string of
  2859.                              characters you identify so that you can refer to
  2860.                              them elsewhere, as $n. By referring to a tagged
  2861.                              expression in a search string, you cause the
  2862.                              editor to look for patterns involving
  2863.                              duplication. By referring to a tagged expression
  2864.                              in a replacement string, you cause the editor to
  2865.                              reuse part of the text that it is replacing.
  2866.  
  2867.                              The exact use of tags is explained in Sections
  2868.                              5.3.5 and 5.3.6. Characters within braces are
  2869.                              treated as a group.
  2870.  
  2871.  $n                          Reference to a previously tagged substring. The
  2872.                              number n indicates which substring. The first
  2873.                              tagged substring is represented as $ 1, the
  2874.                              second as $ 2, and so on. $ 0 represents the
  2875.                              entire matched string.
  2876.  
  2877.  :letter                     Predefined string. The list of predefined
  2878.                              strings is given in Section 5.3.7.
  2879.  
  2880.  The procedure below uses some of the special characters presented in this
  2881.  section. To find the next occurrence of a number (that is, a string of
  2882.  digits) beginning with a digit 1 or 2, perform the following sequence of
  2883.  keystrokes:
  2884.  
  2885.    1. Invoke Arg twice(press ALT + A twice)
  2886.    2. Type the following characters: [12][0-9]*
  2887.    3. Invoke Psearch (press F3)
  2888.  
  2889.  
  2890.  5.3.3  Combining M 1.0 Special Characters
  2891.  
  2892.  Special characters are most powerful when used in combination. For example,
  2893.  the ? and * characters are often used together:
  2894.  
  2895.       ?*
  2896.  
  2897.  The expression above means "match any string of characters." Although this
  2898.  expression is not useful by itself, it is quite useful when part of a larger
  2899.  expression. For example,
  2900.  
  2901.       B?*ing
  2902.  
  2903.  means "match any characters beginning with B and ending with ing".
  2904.  
  2905.  Many of the special characters in the previous section (such as + and *) are
  2906.  operators; they work with other characters to form expressions. These
  2907.  operators usually apply to the previous character or an expression enclosed
  2908.  in braces, brackets, or parentheses. However, it is possible to find
  2909.  exceptions to this rule. For example, the following expression is
  2910.  meaningful:
  2911.  
  2912.       S^2+
  2913.  
  2914.  The plus sign (+) applies to the entire expression S^2. In effect, this
  2915.  expression means, "match any even number of occurrences of the letter S."
  2916.  Therefore, this expression means the same as this:
  2917.  
  2918.       (S^2)+
  2919.  
  2920.  Precedence is left to right in cases where a single character is surrounded
  2921.  by two operators. If there is any doubt about the precedence of operators,
  2922.  use parentheses.
  2923.  
  2924.  
  2925.  5.3.4  M 1.0 Matching Method
  2926.  
  2927.  The matching method you use is significant only when you use a
  2928.  search-and-replace function. The term "matching method" refers to the
  2929.  technique used to match repeated expressions. For example, does a* match as
  2930.  few or as many characters as it can? The answer depends on the matching
  2931.  method. There are two matching methods:
  2932.  
  2933.  Method                      Description
  2934.  
  2935.  Minimal                     The minimal method matches as few characters as
  2936.                              possible in order to find a match. For example,
  2937.                              a+ matches only the first character in aaaaaa.
  2938.                              However, ba+b matches the entire string
  2939.                              baaaaaab, since it is necessary to match every
  2940.                              occurrence of a in order to match both
  2941.                              occurrences of b.
  2942.  
  2943.  Maximal                     The maximal method always matches as many
  2944.                              characters as it can. For example, a# matches
  2945.                              the entire string aaaaaa.
  2946.  
  2947.  The significance of these two methods may not be apparent until you use
  2948.  search and replace. For example, if a+ (minimal matching plus) is the search
  2949.  string and EE is the replacement string,
  2950.  
  2951.       aaaaa
  2952.  
  2953.  is replaced with
  2954.  
  2955.       EEEEEEEEEE
  2956.  
  2957.  because each occurrence of a is immediately replaced by EE. However, if a#
  2958.  (maximal matching plus) is the search string, the same string is replaced
  2959.  with
  2960.  
  2961.       EE
  2962.  
  2963.  because the entire string aaaaa is matched at once and replaced with EE.
  2964.  
  2965.  
  2966.  5.3.5  Tagged Expressions in the M 1.0 Search String
  2967.  
  2968.  A "tagged expression" is a substring delimited by curly braces ({ }). You
  2969.  can enter any regular-expression characters between these delimiters. Tagged
  2970.  expressions are used to specify text patterns that contain repeated elements
  2971.  and to mark a string for reuse.
  2972.  
  2973.  The editor first searches for a character string that matches the entire
  2974.  regular expression. It then tags each substring specified in a tagged
  2975.  expression. Up to nine substrings at a time may be tagged.
  2976.  
  2977.  Once an expression is tagged, you can refer to the specific string of
  2978.  characters that matched the expression. Use the syntax
  2979.  
  2980.       $n
  2981.  
  2982.  in which n is a number that selects the expression. The symbol $1
  2983.  represents the first tagged expression, the symbol $2 represents the second
  2984.  tagged expression, and so on. The use of $n does not search for a new match
  2985.  for the tagged expression. Rather, it matches only an occurrence of the same
  2986.  characters that the tagged expression itself matched.
  2987.  
  2988.  For example, consider the following expression:
  2989.  
  2990.       {?}$1$1
  2991.  
  2992.  The expression above means, "match any character, then see if it's followed
  2993.  by two occurrences of the same character." The following strings all satisfy
  2994.  this requirement:
  2995.  
  2996.       aaa
  2997.       XXX
  2998.       111
  2999.  
  3000.  Note that this regular expression is not equivalent to ??? (three wild
  3001.  cards). The expression ??? matches any three characters; the characters do
  3002.  not need to be the same.
  3003.  
  3004.  The next expression is more complex:
  3005.  
  3006.       {[A-Za-z]*}==$1
  3007.  
  3008.  This expression means "match any number of letters, then see if the letters
  3009.  are followed by two equals signs (==) and a repetition of the original
  3010.  group." This expression matches the first two strings below but not the
  3011.  third:
  3012.  
  3013.       ABCxyz==ABCxyz
  3014.       i==i
  3015.       ABCxyz==KBCxjj
  3016.  
  3017.  
  3018.  5.3.6  Tagged Expressions in the M 1.0 Replacement String
  3019.  
  3020.  You can refer to tagged expressions in replacement strings as well as in
  3021.  search strings. Parts of the string to be replaced may be reused by
  3022.  referring to the tagged expressions that originally matched those parts. Use
  3023.  the syntax described in the previous section.
  3024.  
  3025.  For example, suppose you want to find all occurrences of hexdigitsH and
  3026.  replace them with strings of the form 16#hexdigits. You can search for
  3027.  strings of the form hexdigitsH by specifying the regular expression
  3028.  
  3029.       {[0-9a-fA-F]+}H
  3030.  
  3031.  and then specifying the following replacement string:
  3032.  
  3033.       16#$1
  3034.  
  3035.  The result is that the Microsoft Editor searches for any occurrence of one
  3036.  or more hexadecimal digits (digits 0-9 and the letters a-f) followed by the
  3037.  letter H. Each matching string is replaced by a new string that consists of
  3038.  the original digits (which were tagged so they could be reused) and the
  3039.  prefix 16#. For example, the string 1a000H is replaced with the string
  3040.  16#1a000.
  3041.  
  3042.  The editor recognizes six special characters──$  (  ,  )  -\──within
  3043.  replacement strings. Each of these characters should be preceded by a
  3044.  backslash (\) if you want to use a literal occurrence of one of them in a
  3045.  replacement string. The # sign in the replacement string shown above is not
  3046.  treated as a regular-expression character.
  3047.  
  3048.  You can also use the expression
  3049.  
  3050.       $(w,n)
  3051.  
  3052.  in which w is a field length. This number can be positive or negative. A
  3053.  negative number indicates left justification.
  3054.  
  3055.  If w is greater than the length of the tagged expression, the editor right
  3056.  justifies the tagged expression within the field and pads the field with
  3057.  leading spaces. If w is greater than the length of the expression but is
  3058.  preceded by a negative sign, the editor left justifies the expression and
  3059.  pads the field with trailing spaces. If w is equal or less than the length
  3060.  of the expression, the editor prints the whole expression but does not pad
  3061.  with spaces.
  3062.  
  3063.  
  3064.  5.3.7  Predefined M 1.0 Regular Expressions
  3065.  
  3066.  Several M 1.0 regular expressions are defined in Table 5.1 for your
  3067.  convenience. You can use them by entering :letter in a regular expression.
  3068.  
  3069.  Table 5.1  Predefined Expressions
  3070. ╓┌───────────┌─────────────────────────────────────────┌─────────────────────╖
  3071.  Letter      Meaning                                   Description
  3072.  
  3073.  :a          [a-zA-Z0-9]                               Alphanumeric
  3074.  
  3075.  :b          ([\t]#)                                   White space
  3076.  
  3077.  :c          [a-zA-Z]                                  Alphabetic
  3078.  
  3079.  :d          [0-9]                                     Digit
  3080.  
  3081.  :f          ([~"\[\]\:<|>+=;,.\\/]#)                  Portion of a file name
  3082.  
  3083.  :h          ([0-9a-fA-F]#)                            Hexadecimal number
  3084.  
  3085.  :i          ([a-zA-Z_$][a-zA-Z0-9_$]@)                C-language identifier
  3086.  
  3087.  :n          ([0-9]#[0-9]@![0-9]@.[0-9]#![0-9]#)       Number
  3088.  
  3089.  Letter      Meaning                                   Description
  3090. 
  3091.  :p          (([a-z]\:!)(\\!)(:f(:f!)\\)@:f(.:f!))     Path
  3092.  
  3093.  :q          ("[~"]@"!'[~']@')                         Quoted string
  3094.  
  3095.  :w          ([a-zA-Z]#)                               Word
  3096.  
  3097.  :z          ([0-9]#)                                  Integer
  3098.  
  3099.  
  3100.  
  3101.  Chapter 6  Function Assignments and Macros
  3102.  ───────────────────────────────────────────────────────────────────────────
  3103.  
  3104.  One of the strengths of the Microsoft Editor is you can customize it to your
  3105.  own needs. You can change screen characteristics, select default behavior,
  3106.  and specify which functions are connected to which keystrokes. You can also
  3107.  create new editing functions. The editor supports four techniques for
  3108.  customization, described in Section 6.1.
  3109.  
  3110.  This chapter discusses two of those techniques: function assignments and
  3111.  macros. Function assignments alter the action of keystrokes. Macros are
  3112.  editing commands that you create using a simple syntax. The other two
  3113.  methods for customizing the editor, switch settings and C extensions, are
  3114.  described in Chapters 7, 8, and 9.
  3115.  
  3116.  This chapter covers the following topics:
  3117.  
  3118.    ■  Techniques for customizing the editor
  3119.    ■  Assigning functions to keystrokes
  3120.    ■  Creating macros
  3121.  
  3122.  
  3123.  6.1  The Four Techniques for Customizing the Editor
  3124.  
  3125.  Each of the four techniques for customizing the editor has a distinct
  3126.  purpose. Yet you can use these techniques in combination. For example, an
  3127.  extension can execute a macro, and a macro can make an assignment. Each
  3128.  technique is described below:
  3129.  
  3130.  Technique                   Description
  3131.  
  3132.  Function assignment         Assigns a function to a particular keystroke.
  3133.                              This capability lets you control the meaning of
  3134.                              all recognized keystrokes.
  3135.  
  3136.  Macro assignment            Creates a new editing command out of strings of
  3137.                              text and existing editing functions. Macros use
  3138.                              a simple syntax and can be created very fast.
  3139.                              Use macros when you need to quickly define a new
  3140.                              command or repetitive activity.
  3141.  
  3142.  Switch assignment           Alters a specific editor condition, for example,
  3143.                              screen colors, screen height, scrolling
  3144.                              behavior, tab behavior, and many other
  3145.                              conditions. These conditions are adjusted by
  3146.                              setting various editing "switches," as explained
  3147.                              in Chapter 7.
  3148.  
  3149.  C extension                 Generates a new editing function compiled with
  3150.                              Microsoft C or assembled with the Macro
  3151.                              Assembler. Extensions take longer to create than
  3152.                              macros, but they run faster and are more
  3153.                              flexible. See Chapter 8 for more information.
  3154.  
  3155.  
  3156.  6.2  Assigning Functions to Keystrokes
  3157.  
  3158.  A function assignment lets you alter the meaning of any keystroke. In this
  3159.  context, a "keystroke" is any recognized function key, special key, or ALT+,
  3160.  SHIFT+, or CTRL+key combination. You can also alter the meaning of
  3161.  alphanumeric keys, but doing so can interfere with your ability to type
  3162.  characters.
  3163.  
  3164.  ───────────────────────────────────────────────────────────────────────────
  3165.  NOTE
  3166.     Any editing function, macro, or extension function can be assigned to a
  3167.     keystroke as described in this chapter.
  3168.  ───────────────────────────────────────────────────────────────────────────
  3169.  
  3170.  When a new assignment has been made, you can use that keystroke to invoke
  3171.  the function at any time during the editing session. Take into account the
  3172.  following points when assigning functions to keystrokes:
  3173.  
  3174.    1. The function assignments you make during the editing session are lost
  3175.       when you exit the editor. See Chapter 7, "Switches, Assignments, and
  3176.       the TOOLS.INI File," for information on making assignments that are
  3177.       automatically recognized in each editing session.
  3178.  
  3179.       When using the assignments screen to view and alter assignments, you
  3180.       have the option of automatically saving your changes. See Section
  3181.       6.2.2, "Viewing and Changing Function Assignments," for more
  3182.       information.
  3183.  
  3184.    2. A function can be assigned to more than one keystroke at the same time.
  3185.  
  3186.    3. Each keystroke can have only one function assigned to it at any one
  3187.       time. Therefore, a new function assignment to a given keystroke cancels
  3188.       any previous meaning the keystroke may have had. Assigning the
  3189.       Unassigned function, as explained in Section 6.2.3, cancels the
  3190.       keystroke's previous meaning without substituting a new meaning.
  3191.  
  3192.  
  3193.  6.2.1  Making Function Assignments
  3194.  
  3195.  There are two ways to make a function assignment. You can use the Assign
  3196.  function, or edit the assignments screen as described in the next section.
  3197.  
  3198.  To assign a function to a keystroke with the Assign command, issue the Arg
  3199.  textarg Assign command (ALT+A textarg ALT+=), where textarg uses the
  3200.  following syntax:
  3201.  
  3202.       functionname:keystroke
  3203.  
  3204.  Here, keystroke may be any of the following:
  3205.  
  3206.    1. Numeric keys: 0 through 9
  3207.  
  3208.    2. Lowercase letter keys: a through z
  3209.  
  3210.    3. Uppercase letter keys: A through Z
  3211.  
  3212.    4. Function keys: F1 through F10 (F11 and F12 recognized for enhanced
  3213.       keyboards)
  3214.  
  3215.    5. Lowercase punctuation: ` - = [ ] \ ; ' , . /
  3216.  
  3217.    6. Uppercase punctuation: ~ ! @ # $ % ^ & * ( ) _ + { } | : " ?
  3218.  
  3219.    7. Numeric-keypad white keys when NUMLOCK is turned off: HOME, END, LEFT,
  3220.       RIGHT, UP, DOWN, PGUP, PGDN, INS, and GOTO, which corresponds to the
  3221.       numeric-keypad 5 key.
  3222.  
  3223.    8. Numeric-keypad white keys when NUMLOCK is turned on: 0 through 9. To
  3224.       assign a function to the 4 key on the numeric keypad, enter the
  3225.       following as the keystroke:
  3226.  
  3227.           NUM4
  3228.  
  3229.    9. Numeric-keypad gray keys: NUM-, NUM+, and NUM*
  3230.  
  3231.   10. Other named keys: BKSP, TAB, ESC, SPACEBAR, and ENTER
  3232.  
  3233.   11. Combinations:
  3234.  
  3235.       a.   ALT+ followed by items 1, 2, 4, 5, 9, or 10
  3236.       b.   CTRL+ followed by items 2, 4, 7, 8, 9, or 10
  3237.       c.   SHIFT+ followed by items 4, 7, 8, 9, or 10
  3238.  
  3239.  If you have a Tandy(R) 1000, the following additional keystrokes are
  3240.  recognized:
  3241.  
  3242.    1. Function keys: F11 and F12
  3243.  
  3244.    2. CTRL+ followed by UP and DOWN
  3245.  
  3246.    3. ALT+ followed by UP, DOWN, LEFT, and RIGHT
  3247.  
  3248.    4. SHIFT+ followed by UP, DOWN, LEFT, and RIGHT
  3249.  
  3250.  If you have a 101-key enhanced keyboard, all the keystrokes recognized for
  3251.  the Tandy 1000 are supported, as well as the following: NUMENTER, NUM\, and
  3252.  all CTRL, ALT, and SHIFT combinations of these two keys. In addition, the
  3253.  enhanced keyboard has a duplicate set of item 7 above, which is not affected
  3254.  by the state of NUMLOCK. All CTRL, ALT, and SHIFT combinations of these keys
  3255.  are recognized.
  3256.  
  3257.  Example
  3258.  
  3259.  For example, the function Savecur is assigned to the keystroke CTRL+B in
  3260.  this manner:
  3261.  
  3262.    1. Invoke the Arg function (press ALT+A)
  3263.  
  3264.    2. Enter the function and keystroke as the textarg by typing the
  3265.       following:
  3266.  
  3267.           savecur:CTRL+W
  3268.  
  3269.    3. Invoke the Assign function (press ALT+=)
  3270.  
  3271.       Note that function names are not case-sensitive, so you can enter them
  3272.       as all lowercase.
  3273.  
  3274.  From this point on, pressing CTRL+W invokes the Savecur function and saves
  3275.  the current cursor position. You can make this assignment automatic by
  3276.  placing it in the TOOLS.INI file, as explained in Chapter 7.
  3277.  
  3278.  
  3279.  6.2.2  Viewing and Changing Function Assignments
  3280.  
  3281.  The <assign> pseudo file shows you what function assignments and switch
  3282.  values are in effect at any time during the editing session. This file lists
  3283.  all functions in alphabetical order along with the keys to which they are
  3284.  assigned. Use any of the following methods to get to this screen:
  3285.  
  3286.    ■  Press SHIFT+F1 to get the initial Help screen. Then select Current
  3287.       Assignments.
  3288.  
  3289.    ■  Use the Setfile function (F2), giving <assign> as a text argument.
  3290.  
  3291.    ■  Give the Assign command (ALT+A), entering a question mark (?) as a text
  3292.       argument.
  3293.  
  3294.  Once you get to the assignments screen, you can scroll through the
  3295.  information as you would through any file.  Use the Setfile function (F2) to
  3296.  return to your original file.
  3297.  
  3298.  You can also change assignments from within this file by following these
  3299.  steps:
  3300.  
  3301.    1. Move the cursor to the line that contains the function assignment you
  3302.       wish to change.
  3303.  
  3304.    2. Edit the line so that it contains a new function assignment.
  3305.  
  3306.    3. Move the cursor to a different line. If the assignment you entered is
  3307.       syntactically correct, the editor highlights the line to show that the
  3308.       new assignment was accepted. If the assignment was incorrect, the
  3309.       editor restores the line to its previous state and reports an error
  3310.       message.
  3311.  
  3312.  You can execute a save operation while in the <assign> pseudo file by giving
  3313.  the Arg Arg Setfile command. This command (which normally saves a file to
  3314.  disk under its own name) directs the editor to write any new assignments you
  3315.  have made to the TOOLS.INI file. Each time it starts, the editor
  3316.  automatically recognizes function assignments placed in this file. See
  3317.  Chapter 7, "Switches, Assignments, and the TOOLS.INI File," for more
  3318.  information about TOOLS.INI.
  3319.  
  3320.  The Tell function (CTRL+T) gives you an alternative way of seeing what
  3321.  function is assigned to any given keystroke. Give the command Arg Tell
  3322.  (ALT+A CTRL+T), then enter a keystroke. The editor prints the name of the
  3323.  function assigned to this keystroke on the dialog line.
  3324.  
  3325.  For more information on the Tell function, see Appendix A, "Reference
  3326.  Tables."
  3327.  
  3328.  
  3329.  6.2.3  Disabling a Keystroke
  3330.  
  3331.  To disable a keystroke so it invokes no function at all, assign the function
  3332.  Unassigned to the keystroke. As with other function assignments, use the
  3333.  Arg textarg Assign command. The argument textarg uses the following syntax:
  3334.  
  3335.       unassigned:key
  3336.  
  3337.  Here, key is the keystroke you want to remove.
  3338.  
  3339.  For example, to disable the keystroke CTRL+A, perform the following steps:
  3340.  
  3341.    1. Invoke the Arg function (press ALT+A)
  3342.  
  3343.    2. Enter the function name as Unassigned and the keystroke by typing the
  3344.       following: unassigned:CTRL+A
  3345.  
  3346.    3. Invoke the Assign function (press ALT+=)
  3347.  
  3348.  After these steps are carried out, pressing CTRL+A does not invoke any
  3349.  functions. (Disabling a keystroke is temporary if you have set the key
  3350.  assignment in the TOOLS.INI file. For permanent results, change the
  3351.  TOOLS.INI file.)
  3352.  
  3353.  
  3354.  6.2.4  Making a Keystroke Literal
  3355.  
  3356.  Many text editors allow you to enter only alphanumeric characters and
  3357.  punctuation into a file. However, the Microsoft Editor makes it easy for you
  3358.  to insert special characters.
  3359.  
  3360.  Each keystroke corresponds to an ASCII value. When a keystroke is considered
  3361.  a "literal" or "graphic," pressing the key causes the editor to place the
  3362.  corresponding value into the file.  For example, if you make the keystroke
  3363.  CTRL+D a literal key, the editor places a character with the decimal value 4
  3364.  into the file each time you press CTRL+D.
  3365.  
  3366.  ───────────────────────────────────────────────────────────────────────────
  3367.  NOTE
  3368.     When you use a special keystroke (such as F1 or ALT+A) as a literal, it
  3369.     loses any special meaning it would otherwise have and will not invoke a
  3370.     function. If the special value is one that can be printed (for example,
  3371.     if it is a printable extended-ASCII character), the editor displays the
  3372.     corresponding character on the screen.
  3373.  ───────────────────────────────────────────────────────────────────────────
  3374.  
  3375.  The Microsoft Editor provides two methods for converting a keystroke to a
  3376.  literal character. The first method is to use the Quote function. When you
  3377.  invoke the Quote function (CTRL+P),  the next key that you press──regardless
  3378.  of what-ever special meaning it may otherwise have──is regarded as a literal
  3379.  character.
  3380.  
  3381.  The second method is to assign the Graphic function to the keystroke.  This
  3382.  uses the same syntax as any other function assignment: Arg textarg Assign.
  3383.  Assigning Graphic cancels any previous assignment to the keystroke, and
  3384.  causes the editor to consider the keystroke a literal character. For
  3385.  example, to insert a form-feed character in the file whenever CTRL+L is
  3386.  pressed, first follow these steps:
  3387.  
  3388.    1. Invoke the Arg function (press ALT+A)
  3389.  
  3390.    2. Enter the function Graphic and the keystroke as the textarg by typing
  3391.       the following: graphic:CTRL+L
  3392.  
  3393.    3. Invoke the Assign function (press ALT+=)
  3394.  
  3395.  The choice between assigning the Graphic function or invoking the Quote
  3396.  function depends on the situation. If you want to enter a special value into
  3397.  the file repeatedly, it is often easier to assign the Graphic function to
  3398.  the keystroke──since you only need to do it once. However, use of the Quote
  3399.  function provides you with more control.
  3400.  
  3401.  By default, the Graphic function is assigned to all alphanumeric characters.
  3402.  
  3403.  
  3404.  6.3  Creating Macros within the Editor
  3405.  
  3406.  The fastest way to create a new editing function for the Microsoft Editor is
  3407.  to create a macro. This editing function can be as simple as inserting a
  3408.  long word or phrase, or it can involve complex operations.
  3409.  
  3410.  There are two ways to create a macro. The easiest is to use the Record
  3411.  function to automatically record a series of actions. You can also enter a
  3412.  macro directly. The second method requires more knowledge of syntax, but
  3413.  allows you to use sophisticated features, such as conditionals.
  3414.  
  3415.  After you have used the editor for awhile, you may want to use both methods.
  3416.  You can create a simple function by recording a macro, then increase the
  3417.  macro's power by editing it directly, using the techniques described in
  3418.  Sections 6.3.2-6.3.8.
  3419.  
  3420.  Once a macro is defined and assigned to a keystroke, you can see how the
  3421.  macro is defined by using the Tell function. Give the Argtextarg Tell
  3422.  command (ALT+A textarg CTRL+T), in which textarg is the name of the macro.
  3423.  For more information on the Tell function, see Appendix A, "Reference
  3424.  Tables."
  3425.  
  3426.  The maximum number of macros that can be defined at one time is 1,024.
  3427.  
  3428.  
  3429.  6.3.1  Recording a Macro
  3430.  
  3431.  Much like a tape recorder, the Record (ALT+R) function tells the editor,
  3432.  "make a record of all editing commands until I tell you to stop." After you
  3433.  stop the recording, the editor creates a macro function consisting of all
  3434.  the editing commands you just gave. When you invoke this macro, the editor
  3435.  plays back these commands in the order you gave them.
  3436.  
  3437.  While the editor is recording commands, the letters REC appear at the end of
  3438.  the status line.
  3439.  
  3440.  The Record function starts a recording and gives the macro the default name
  3441.  recordvalue when the recording is done. Invoking Record again turns the
  3442.  recording off.
  3443.  
  3444.  The following steps are the quickest way to create a macro:
  3445.  
  3446.    1. Invoke the Record function (ALT+R) to start the recording.
  3447.  
  3448.    2. Execute the series of actions you wish to record.
  3449.  
  3450.    3. Turn off the recording by invoking Record (ALT+R) again.
  3451.  
  3452.    4. If recordvalue is not already assigned, assign it to a keystroke as
  3453.       described in Section 6.2, "Assigning Functions to Keystrokes."
  3454.  
  3455.  After you complete these steps, the editor associates the new macro with the
  3456.  keystroke that recordvalue is assigned to. Whenever you press this key, the
  3457.  editor plays back the editing commands you gave in Step 2 above.
  3458.  
  3459.  Other variations of the Record function are shown below:
  3460.  
  3461.  Command
  3462.  (and Default Keystrokes)    Description
  3463.  
  3464.  Arg textarg Record          Turns on a recording. When the recording is
  3465.  (ALT+A textarg ALT+R)       finished, the macro is given the name specified
  3466.                              in the text argument.
  3467.  
  3468.  Meta Record (F9 ALT+R)      Turns on a recording in which commands you give
  3469.                              are recorded but not executed. This is in effect
  3470.                              a silent recording.
  3471.  
  3472.  Arg Arg textarg Record      Turns on a recording, but if the specified macro
  3473.  (ALT+A ALT+A textarg        already exists, the editor appends editing
  3474.  ALT+R)                      commands to the macro instead of replacing it.
  3475.  
  3476.  By using the window and file commands described in Chapter 4, you can open
  3477.  a second window and load the <record> pseudo file. This file dynamically
  3478.  displays the value of the current recording.
  3479.  
  3480.  By opening the <record> pseudo file in a separate window, you can watch the
  3481.  editor record the macro as you create it. The macro writes out the actual
  3482.  name of each editing command you give. As a result, the editor displays a
  3483.  macro definition using the syntax described in the next section.
  3484.  
  3485.  
  3486.  6.3.2  Entering a Macro Directly
  3487.  
  3488.  A macro is nothing more than a predefined series of functions and/or literal
  3489.  text. This fact makes the syntax of most macros almost self-evident: you
  3490.  build a macro by using the same syntax used throughout this manual. The most
  3491.  advanced macros, however, use the return value of functions to alter control
  3492.  flow. This special feature is presented in Section 6.3.8, "Macros That Use
  3493.  Conditionals."
  3494.  
  3495.  To define a macro directly, follow these steps:
  3496.  
  3497.    1. Choose a name. The name should not be a macro or function name already
  3498.       in use.
  3499.  
  3500.    2. Enter the macro definition by using the Arg textarg Assign command
  3501.       (ALT+A textarg ALT+=), in which textarg has the following syntax:
  3502.  
  3503.       macroname:=list
  3504.  
  3505.       No spaces should separate macroname from the definition symbol (:=).
  3506.       The list contains function names and text strings enclosed in double
  3507.       quotes, as explained in the next section.
  3508.  
  3509.    3. Assign the macro with the command Arg textarg Assign, in which the
  3510.       textarg has the following form:
  3511.  
  3512.       macroname:keystroke
  3513.  
  3514.  The last step is optional. If you want to build a nested macro as described
  3515.  in Section 6.3.5, only the last macro defined needs to be assigned to a
  3516.  keystroke.
  3517.  
  3518.  Instead of assigning a macro to a keystroke, you can execute the macro by
  3519.  giving its name as input to the Execute function, as explained in Section
  3520.  6.3.4.
  3521.  
  3522.  Example
  3523.  
  3524.  The following sequence of actions defines a macro called InsPhrase, which
  3525.  inserts a certain sentence. The simplest macros insert a fixed string of
  3526.  text──these macros are useful because they can save you a lot of typing.
  3527.  This macro is then assigned to the key CTRL+F10. After you do the following
  3528.  action, the editor inserts the words "This is a sentence." at the current
  3529.  cursor position, every time you press CTRL+F10.
  3530.  
  3531.    1. Invoke the Arg function (press ALT+A)
  3532.  
  3533.    2. Enter the macro name and definition by typing the following:
  3534.  
  3535.          InsPhrase:="This is a sentence."
  3536.  
  3537.    3. Invoke the Assign function (press ALT+=)
  3538.  
  3539.    4. Invoke the Arg function (press ALT+A)
  3540.  
  3541.    5. Assign this macro to a keystroke by typing the following:
  3542.  
  3543.          InsPhrase:CTRL+F10
  3544.  
  3545.    6. Invoke the Assign function (press ALT+=)
  3546.  
  3547.  
  3548.  6.3.3  Building the Macro List
  3549.  
  3550.  Each item in a macro-definition list is either a function name or a string
  3551.  of text. The function names are the same as used throughout this manual but
  3552.  are not case sensitive. You can enter them all lowercase, all uppercase, or
  3553.  any combination.
  3554.  
  3555.  Each string of text must be enclosed in quotes. Embedded quote marks are
  3556.  represented as \", and embedded backslashes are represented as \\.
  3557.  
  3558.  Example
  3559.  
  3560.  The following text arguments are all valid macro definitions:
  3561.  
  3562.       Callfun:="x = QuadCalc(a, b, c);"
  3563.       Callfun2:=linsert begline "x = QuadCalc(a, b, c);"
  3564.       Movedown:=arg "15" plines
  3565.       Putcomm:=begline "/*  " endline " */"
  3566.       Join:=endline right arg sdelete
  3567.       Del3:=arg right right right ldelete
  3568.       Join2:=savecur endline right arg sdelete restcur
  3569.       endword:=arg arg "( !.!$!\\:!;!\\)!\\(!,)" psearch
  3570.  
  3571.  The rest of this section examines each of these macro definitions.
  3572.  
  3573.       Callfun:="x = QuadCalc(a, b, c);"
  3574.  
  3575.  The example above defines a macro that inserts the text "x = QuadCalc(a, b,
  3576.  c);" whenever invoked. This macro is simple, yet useful. It replaces the
  3577.  typing of a phrase with a single editing function.
  3578.  
  3579.  Executing this macro has the same effect as typing the phrase. The precise
  3580.  effect of this macro therefore depends on whether insert mode is on or off.
  3581.  
  3582.       Callfun2:=linsert begline "x = QuadCalc(a, b, c);"
  3583.  
  3584.  The example above uses both function names and text to define a new editing
  3585.  function. The effect of invoking this macro is precisely the same as the
  3586.  effect of invoking Linsert, invoking Begline, and then typing the text
  3587.  inside the quotes. The macro inserts a new line and places the text at the
  3588.  beginning of this line.
  3589.  
  3590.       Movedown:=arg "15" plines
  3591.  
  3592.  Like the example before it, the example above uses a combination of
  3593.  functions and a string of text. However, because the Arg function precedes
  3594.  the text, the text does not appear on screen. Instead, the text becomes an
  3595.  argument to the Plines function. This macro moves the window down 15 lines.
  3596.  
  3597.       Putcomm:=begline "/*  " endline " */"
  3598.  
  3599.  The example above uses a combination of functions and text to insert
  3600.  C-language comment marks at the beginning and end of a line.
  3601.  
  3602.       Join:=endline right arg sdelete
  3603.  
  3604.  The example above defines a macro that joins the current line to the next
  3605.  line. Recall that the sequence Arg Sdelete deletes all text to the right of
  3606.  the cursor, then joins lines.  This macro does not delete any text. First,
  3607.  it moves the cursor to the end of the line. Next, it moves one space to the
  3608.  right to leave a space before the next line. It then executes Arg Sdelete.
  3609.  
  3610.  You can use the cursor-movement functions (Up, Down, Right, Left) within
  3611.  macros.  The next macro uses these functions to build an on-screen argument.
  3612.  
  3613.       Del3:=arg right right right ldelete
  3614.  
  3615.  The example above deletes three characters. The middle three arguments
  3616.  create a cursor-movement argument that is passed to the Ldelete function.
  3617.  
  3618.       Join2:=savecur endline right arg sdelete restcur
  3619.  
  3620.  The example above performs almost the same activity as the Join macro
  3621.  presented earlier. However, this macro begins by saving the cursor position
  3622.  with Savecur. After the lines are joined, the macro restores the original
  3623.  cursor position by executing Restcur. This macro works even if Savecur and
  3624.  Restcur have not been assigned to keystrokes.
  3625.  
  3626.       endword:=arg arg "( !.!$!\\:!;!\\)!\\(!,)" psearch
  3627.  
  3628.  This last example uses the regular-expression syntax described in Chapter
  3629.  5. The Arg Arg syntax directs the Psearch function to treat the text
  3630.  argument as a regular-expression pattern. This pattern, in turn, causes the
  3631.  editor to find the next space, period (.), end of line ($), colon (:),
  3632.  semicolon (;), right parenthesis ()), left parenthesis ((), or comma (,).
  3633.  Some characters must be preceded by a backslash (\) in order to be
  3634.  interpreted literally. Furthermore, when you give a text argument inside a
  3635.  macro list, you must use two backslashes in a row (\\) to indicate a single
  3636.  backslash.
  3637.  
  3638.  The effect of this macro is to go to the end of the current word. By
  3639.  rewriting the regular expression, you control what constitutes the end of a
  3640.  word. This macro can be especially useful when nested inside other macros,
  3641.  as described in Section 6.3.5.
  3642.  
  3643.  
  3644.  6.3.4  Executing a Macro List Directly
  3645.  
  3646.  Instead of defining a macro and then assigning it to a keystroke, you can
  3647.  execute a macro-definition list directly, by using the Execute function.
  3648.  This function, which by default is assigned to F7, takes a function name,
  3649.  macro name, or macro-definition command list as a text argument.
  3650.  
  3651.  For example, the following sequence finds the next occurrence of the word
  3652.  fluke:
  3653.  
  3654.    1. Invoke Arg (press ALT+A)
  3655.    2. Type the following string: arg "fluke" psearch
  3656.    3. Invoke Execute (press F7)
  3657.  
  3658.  You can also give the name of a macro as input to the Execute command.
  3659.  
  3660.  
  3661.  6.3.5  Building Macros from Other Macros
  3662.  
  3663.  Macros can contain references to previously defined macros.  Since a macro
  3664.  definition must be contained on one line (except in the TOOLS.INI file,
  3665.  where you can use a line-continuation character), you may need to break up a
  3666.  macro definition into several smaller macros as shown in the example below.
  3667.  Only the final macro definition need be assigned to a keystroke. Each of the
  3668.  following lines is entered one at a time using the Arg textarg Assign
  3669.  command:
  3670.  
  3671.       head1:=arg "3" linsert "/************************"
  3672.       head2:=newline "** Routine:"
  3673.       head3:=newline "*************************/"
  3674.       header:=head1 head2 head3
  3675.       header:alt+h
  3676.  
  3677.  The example above inserts three blank lines (by passing the argument 3 to
  3678.  the Linsert function), and then inserts the given strings of text. The macro
  3679.  is then assigned to ALT+H. This macro is an example of one that automates
  3680.  the creation of comment blocks for C programs.
  3681.  
  3682.  ───────────────────────────────────────────────────────────────────────────
  3683.  NOTE
  3684.     Nested macros are cumbersome to enter while running the editor. Usually,
  3685.     you'll want to enter them once in your TOOLS.INI file so that they are
  3686.     available automatically, as explained in Chapter 7.
  3687.  ───────────────────────────────────────────────────────────────────────────
  3688.  
  3689.  
  3690.  6.3.6  Handling Prompts within Macros
  3691.  
  3692.  Some commands prompt the user for confirmation. For example, the MetaExit
  3693.  command (exit without saving) asks the user if he really wants to exit.
  3694.  These questions take the answer yes (Y) or no (N).
  3695.  
  3696.  By default, macros assume an answer of yes. For example, if you assigned
  3697.  Meta Exit to a macro and then executed the macro, the editor would not
  3698.  prompt for confirmation. Instead, the editor would assume an answer of yes
  3699.  and proceed to exit without saving.
  3700.  
  3701.  You can control the answers to prompts within macros by using the following
  3702.  operators, each of which applies to the immediately preceding function:
  3703.  
  3704.  Operator                    Description
  3705.  
  3706.  <                           Asks the user for confirmation. (If not followed
  3707.                              by another < character, prompts user for all
  3708.                              further questions.)
  3709.  
  3710.  <Y                          Assumes an answer of yes.
  3711.  
  3712.  <N                          Assumes an answer of no.
  3713.  
  3714.  You can use a series of operators. For example, consider the following
  3715.  macro:
  3716.  
  3717.       newfile:=arg "newfile.txt" setfile <y <n
  3718.  
  3719.  The macro newfile assumes an answer of yes for the first prompt, and no for
  3720.  the second. If newfile requires only one prompt, it ignores the second
  3721.  operator, <n.
  3722.  
  3723.  If the last prompt character that appears is <, the editor prompts the user
  3724.  directly for all remaining yes/no questions.
  3725.  
  3726.  You can use the prompt characters throughout your macro. For example:
  3727.  
  3728.       newfile:=refresh < arg "newfile.txt" setfile <y <n <
  3729.  
  3730.  
  3731.  6.3.7  Macros That Take Arguments
  3732.  
  3733.  Macros have no explicit syntax for accepting user-defined arguments.
  3734.  However, if you enter an argument and then invoke a macro, the argument is
  3735.  passed to the first function that accepts an argument:
  3736.  
  3737.       tripleit:=copy paste paste
  3738.  
  3739.  In the example above, you can invoke Arg and use cursor movement to
  3740.  highlight an argument. Then invoke tripleit. Your highlighted argument is
  3741.  passed to the Copy function, which copies the argument to the Clipboard. The
  3742.  macro then executes the Paste function two times. As a result, two
  3743.  additional copies of the argument are added to the file.
  3744.  
  3745.  If you do not highlight an argument before invoking tripleit, the macro
  3746.  responds by printing two more copies of the current line. By default,
  3747.  tripleit works on the current line because Copy selects the current line
  3748.  when no argument is given.
  3749.  
  3750.  When you execute the Copy or Delete function at the beginning of a macro,
  3751.  the highlighted argument is stored in the Clipboard. You can then load the
  3752.  <clipboard> pseudo file and manipulate the argument itself, as in the
  3753.  following macro:
  3754.  
  3755.       addto1:=copy arg "<clipboard>" setfile
  3756.       addto2:=arg arg "TMP.TXT" setfile
  3757.       addto3:=arg "type TMP.TXT >>> BIG.TXT" shell
  3758.       addto4:=arg "del TMP.TXT" shell setfile
  3759.       addto:=addto1 addto2 addto3 addto4
  3760.  
  3761.  The addto macro appends the highlighted argument to the file BIG.TXT. If you
  3762.  do not give an argument, the macro appends the current line. The addto macro
  3763.  works by executing addto1, addto2, addto3, and addto4, each of which does
  3764.  some of the work of adding to the highlighted area. The following list
  3765.  describes the steps of the addto macro:
  3766.  
  3767.    1. Copy argument to the Clipboard, then load the <clipboard> pseudo file.
  3768.  
  3769.    2. Save the contents of the current file (which is now <clipboard>) to the
  3770.       file TMP.TXT.
  3771.  
  3772.    3. Execute a DOS shell that appends TMP.TXT to BIG.TXT.
  3773.  
  3774.    4. Execute a DOS shell that deletes TMP.TXT, then use Setfile to return to
  3775.       the original file.
  3776.  
  3777.  Another way to respond to an argument is to put the Replace function at the
  3778.  beginning of your macro. Replacements then take place throughout the
  3779.  highlighted area. For example, the following macro replaces each occurrence
  3780.  of the period (.) with a blank space:
  3781.  
  3782.       blankout:=replace "." newline " " newline
  3783.  
  3784.  The Newline function is necessary because the Replace function prompts for
  3785.  search-and-replace strings.
  3786.  
  3787.  To use the macro above in a practical way, invoke Arg twice to enable
  3788.  regular expressions, highlight an area of text, and then execute blankout.
  3789.  Assuming that the editor is using Unix regular-expression syntax, the effect
  3790.  is that each character in the highlighted area is replaced by a blank space.
  3791.  The effect is different from Delete because the space occupied by the text
  3792.  is not removed, simply replaced with blanks.
  3793.  
  3794.  ───────────────────────────────────────────────────────────────────────────
  3795.  WARNING
  3796.     Using Arg twice and then executing blankout without a highlighted region
  3797.     replaces the rest of your file with blank spaces. Make sure you use a
  3798.     highlighted argument.
  3799.  ───────────────────────────────────────────────────────────────────────────
  3800.  
  3801.  
  3802.  6.3.8  Macros That Use Conditionals
  3803.  
  3804.  You can write macros that execute different actions depending on certain
  3805.  conditions. These macros take advantage of function return values. A "return
  3806.  value" is simply a piece of information that a function passes back after it
  3807.  is executed. Editing functions always return the value TRUE (nonzero) or
  3808.  FALSE (zero).
  3809.  
  3810.  Each editing function has different criteria for determining what to return,
  3811.  but usually an editing function returns TRUE if the function is successful,
  3812.  or FALSE if it fails. For example, a cursor-movement function fails if the
  3813.  cursor does not move.
  3814.  
  3815.  Table A.4, in Appendix A, gives a complete list of function return values.
  3816.  You use these return values with the syntax described in Table 6.1.
  3817.  
  3818.  Table 6.1  Macro Conditionals
  3819. ╓┌─────────────────┌─────────────────────────────────────────────────────────
  3820.  Conditional       Description
  3821.  
  3822.  :>label           Defines a label that can be referenced by other macro
  3823.                    conditionals.
  3824.  Conditional       Description
  3825.                   conditionals.
  3826.  
  3827.  =>label           Causes a direct transfer to label. If label is omitted,
  3828.                    then the current macro exits.
  3829.  
  3830.  ->label           Causes a direct transfer to label if the previous function
  3831.                    returns FALSE. If label is omitted, then the current macro
  3832.                    exits on FALSE.
  3833.  
  3834.  +>label           Causes a direct transfer to label if the previous function
  3835.                    returns TRUE. If label is omitted, then the current macro
  3836.                    exits on TRUE.
  3837.  
  3838.  
  3839.  The table above refers to a macro exiting. In this context, exiting a macro
  3840.  only affects the current macro. If macro doall executes macro submacro, when
  3841.  submacro exits, control returns to doall, which continues execution.
  3842.  
  3843.  Examples
  3844.  
  3845.  The first example turns insert mode on. The only function that turns insert
  3846.  mode on or off is the Insertmode function. This function toggles between the
  3847.  on and off condition, and returns the new state of insert mode:
  3848.  
  3849.  Initial state               Effect of Insertmode
  3850.  
  3851.  Off                         Turn insert mode on; return TRUE.
  3852.  
  3853.  On                          Turn insert mode off; return FALSE.
  3854.  
  3855.  Unfortunately, testing the state of insert mode may turn insert mode off,
  3856.  even though the goal is to leave it on. Fortunately, a conditional macro can
  3857.  turn insert mode back on again as appropriate:
  3858.  
  3859.       turnon:=insertmode +> insertmode
  3860.  
  3861.  This macro consists of three simple steps:
  3862.  
  3863.    1. insertmode toggles the state of insert mode. This function returns TRUE
  3864.       if insert mode is now on.
  3865.  
  3866.    2. The +> operator exits the macro if the last function executed returned
  3867.       TRUE. In this case, a return value of TRUE indicates that insert mode
  3868.       is now on, so the macro exits on TRUE.
  3869.  
  3870.    3. If the last function returned FALSE, the macro continues to the last
  3871.       step, which executes insertmode again. If the macro reaches this step,
  3872.       insert mode was initially on but the first step turned it off. This
  3873.       step turns insert mode back on again.
  3874.  
  3875.  The macro defined above, turnon, is highly useful when used within nested
  3876.  macros. Define turnon first. Then place turnon at the beginning of a macro
  3877.  definition whenever the macro needs to assume that insert mode is on.
  3878.  
  3879.  ───────────────────────────────────────────────────────────────────────────
  3880.  NOTE
  3881.     In the next chapter, you'll learn how to use the enterinsmode switch to
  3882.     achieve the same result as the macro defined above.
  3883.  ───────────────────────────────────────────────────────────────────────────
  3884.  
  3885.  The next example turns insert mode on temporarily, executes the predefined
  3886.  macro cmd, and then leaves the editor in the same state that it was in
  3887.  before the macro was executed.
  3888.  
  3889.       icmd:=insertmode +>on insertmode cmd => :>on cmd insertmode
  3890.  
  3891.  The macro executes the commands in the following order:
  3892.  
  3893.    1. insertmode toggles the state of insert mode, so if insert mode was off,
  3894.       it is now on, and vice versa. This function returns TRUE if insert mode
  3895.       is on after the function is executed, and FALSE otherwise.
  3896.  
  3897.    2. +>on transfers control to the label on if the previous function
  3898.       returned TRUE──in other words, if insert mode is now on.
  3899.  
  3900.    3. insertmode turns insert on. If the macro reaches this point, insert
  3901.       mode was originally on but the first step turned it off and returned
  3902.       FALSE. This step turns insert mode back on.
  3903.  
  3904.    4. cmd executes the predefined macro.
  3905.  
  3906.    5. => exits the macro. Insert mode was on when the macro started, it is
  3907.       now back on, and cmd has been executed. Therefore the macro is done.
  3908.  
  3909.    6. :>on defines a label. Execution transfers here directly from the item
  3910.       +>on if insert mode was turned on.
  3911.  
  3912.    7. cmd executes the predefined macro.
  3913.  
  3914.    8. insertmode turns insert mode back off. Since execution flowed through
  3915.       to this point, insert mode must have been off when the macro
  3916.       began──insert mode is turned back off now.
  3917.  
  3918.  
  3919.  Chapter 7  Switches, Assignments, and the TOOLS.INI File
  3920.  ───────────────────────────────────────────────────────────────────────────
  3921.  
  3922.  A "switch" is a variable that controls some condition of the editor. For
  3923.  example, changing the fgcolor switch alters the foreground color of the
  3924.  editor, and changing the height switch alters the number of lines on the
  3925.  screen. Although switches come in three varieties (numeric, text, and
  3926.  Boolean), all three kinds of switches can be controlled with the Assign
  3927.  function.
  3928.  
  3929.  Usually, the most convenient way to work with switches is to set them in the
  3930.  initialization file, named TOOLS.INI. This file contains switch values,
  3931.  function assignments, and macros for the Microsoft Editor to automatically
  3932.  assume at the beginning of each session. This file can be used to initialize
  3933.  settings for other products. Therefore, all the settings for the editor have
  3934.  to be put under a special heading called a "tag."
  3935.  
  3936.  If you are interested in using TOOLS.INI right away to make the editor
  3937.  automatically start up with your own function assignments and macros, turn
  3938.  to Section 7.4, "Sample TOOLS.INI File."
  3939.  
  3940.  This chapter covers the following topics:
  3941.  
  3942.    ■  Syntax for switch settings
  3943.    ■  Using switches to configure the editor
  3944.    ■  Special syntax for text switches
  3945.    ■  Sample TOOLS.INI file
  3946.    ■  The structure of the TOOLS.INI file
  3947.    ■  Configuring on-line Help
  3948.  
  3949.  
  3950.  7.1  Syntax for Switch Settings
  3951.  
  3952.  To change the behavior of the editor, set a switch with the Assign function
  3953.  or in the TOOLS.INI file. You set a switch differently depending on the type
  3954.  of the switch. Each switch is one of three types: numeric, text, or Boolean.
  3955.  
  3956.  To set a numeric or text switch, give the assignment
  3957.  
  3958.       switch:value
  3959.  
  3960.  in which switch is the name of the switch and value is either a string of
  3961.  digits (in the case of a numeric switch), or any string of text (in the case
  3962.  of a text switch). Most numeric switches use decimal digits. However, the
  3963.  color switches use hexadecimal digits, as described in Section 7.2.3.
  3964.  
  3965.  Boolean switches can be off or on. To turn a Boolean switch on, give either
  3966.  of the following assignments:
  3967.  
  3968.       switch:
  3969.       switch:yes
  3970.  
  3971.  To turn a Boolean switch off, prefix the letters no to the assignment or
  3972.  type no after the colon:
  3973.  
  3974.       noswitch:
  3975.       switch:no
  3976.  
  3977.  A switch assignment looks similar to a function assignment.  However, a
  3978.  switch assignment has a different effect. A function assignment changes the
  3979.  meaning of a keystroke, whereas a switch assignment alters a basic
  3980.  condition, such as screen color.
  3981.  
  3982.  Examples
  3983.  
  3984.  The following examples show a numeric, text, and four Boolean assignments,
  3985.  respectively:
  3986.  
  3987.       tabstops:8
  3988.       backup:none
  3989.       case:
  3990.       nocase:
  3991.       case:yes
  3992.       case:no
  3993.  
  3994.  You could make any of these assignments by placing them in the TOOLS.INI
  3995.  file, or by using the Arg textarg Assign command. For example, to set
  3996.  tabstops to 8, follow these steps:
  3997.  
  3998.    1. Invoke the Arg function (press ALT+A)
  3999.    2. Type the following switch assignment: tabstops:8
  4000.    3. Invoke the Assign function (press ALT+= )
  4001.  
  4002.  ───────────────────────────────────────────────────────────────────────────
  4003.  NOTE
  4004.     Some text switches recognize special characters. These characters are
  4005.     never required, but can be convenient. See Section 7.3, "Special Syntax
  4006.     for Text Switches," for more information.
  4007.  ───────────────────────────────────────────────────────────────────────────
  4008.  
  4009.  
  4010.  7.2  Using Switches to Configure the Editor
  4011.  
  4012.  This section explains how to use some of the more common switches. You can
  4013.  follow the instructions to get a feel for how to adjust conditions within
  4014.  the editor. For example, you may want to change screen colors, screen
  4015.  height, or tab behavior. Sections 7.4 and 7.5 explain how to make these
  4016.  settings automatic by placing them in the TOOLS.INI file.
  4017.  
  4018.  Sections 7.2.1-7.2.8 cover the following topics:
  4019.  
  4020.    ■  Changing start-up conditions
  4021.    ■  Changing scrolling behavior
  4022.    ■  Setting screen colors with fgcolor
  4023.    ■  Setting colors for other parts of the screen
  4024.    ■  Changing the look and feel of Help
  4025.    ■  Controlling use of tabs
  4026.    ■  Changing how the editor handles trailing spaces
  4027.    ■  Changing screen height
  4028.  
  4029.  
  4030.  7.2.1  Changing Start-Up Conditions
  4031.  
  4032.  By default, the editor starts with insert mode off and status line
  4033.  displaying window position (rather than cursor position). To start with
  4034.  insert mode on, place the following statement in the [M] section of your
  4035.  TOOLS.INI file:
  4036.  
  4037.       enterinsmode:
  4038.  
  4039.  You can also set this switch by executing these steps:
  4040.  
  4041.    1. Invoke the Arg function (press ALT+A)
  4042.    2. Type the following switch assignment: enterinsmode:
  4043.    3. Invoke the Assign function (press ALT+=)
  4044.  
  4045.  Setting this switch while in an editing session turns insert mode on
  4046.  regardless of the current state of insert mode.
  4047.  
  4048.  The status line at the bottom of the screen displays window position by
  4049.  default. The window position gives the file coordinates (by line and column)
  4050.  of the top left corner. To change this field so that it displays cursor
  4051.  position instead, follow these steps:
  4052.  
  4053.    1. Invoke the Arg function (press ALT+A)
  4054.    2. Type the following switch assignment: displaycursor:
  4055.    3. Invoke the Assign function (press ALT+=)
  4056.  
  4057.  The editor numbers rows and columns beginning with the number one. Cursor
  4058.  position is (1,1) when the cursor is at the very beginning of the file.
  4059.  
  4060.  The enterinsmode and displaycursor switches are both examples of Boolean
  4061.  switches. To turn these switches off, follow the directions above but
  4062.  precede the switch with the word no.
  4063.  
  4064.  
  4065.  7.2.2  Changing Scrolling Behavior
  4066.  
  4067.  Two switches control scrolling behavior in the Microsoft Editor: vscroll and
  4068.  hscroll. Each time you attempt to move the cursor off the top or bottom of
  4069.  the screen, the editor moves the editing window up or down a certain
  4070.  distance. This distance is set by the value of vscroll.
  4071.  
  4072.  For smooth vertical scrolling, set vscroll to 1:
  4073.  
  4074.    1. Invoke the Arg function (press ALT+A)
  4075.    2. Type the following switch assignment: vscroll:1
  4076.    3. Invoke the Assign function (press ALT+=)
  4077.  
  4078.  For smooth horizontal scrolling, set hscroll to 1. Give the Arg textarg
  4079.  Assign command (ALT+A textarg ALT+=), in which textarg is hscroll:1.
  4080.  
  4081.  
  4082.  7.2.3  Setting Screen Colors with fgcolor
  4083.  
  4084.  The fgcolor switch controls the most important screen colors: background
  4085.  and foreground colors of editing windows. The background color is the
  4086.  primary color of a region of the screen. The foreground color is the color
  4087.  of characters that appear in this region.
  4088.  
  4089.  The fgcolor switch uses one numeric value to control both background and
  4090.  foreground colors. The other color switches (errcolor, hgcolor, infcolor,
  4091.  and stacolor) all work in the same way: each sets a background and
  4092.  foreground color according to a single numeric value.
  4093.  
  4094.  The editor reads a color switch as a two-digit hexadecimal number. The first
  4095.  digit sets the background color; the second sets the foreground color. Table
  4096.  7.1 states the digits that correspond to each color.
  4097.  
  4098.  In the case of background colors, the digits 8-F correspond to the digits
  4099.  0-7, except that they make the foreground text blink on and off.
  4100.  
  4101.  Table 7.1  Colors and Numeric Values
  4102. ╓┌───────────────────────┌───────────────────────────────────────────────────╖
  4103.  Color                   Value
  4104.  
  4105.  Black                   0
  4106.  
  4107.  Blue                    1
  4108.  
  4109.  Green                   2
  4110.  
  4111.  Cyan                    3
  4112.  
  4113.  Red                     4
  4114.  
  4115.  Magenta                 5
  4116.  
  4117.  Brown                   6
  4118.  Color                   Value
  4119. Brown                   6
  4120.  
  4121.  Light Gray              7
  4122.  
  4123.  Dark Gray               8
  4124.  
  4125.  Light Blue              9
  4126.  
  4127.  Light Green             A
  4128.  
  4129.  Light Cyan              B
  4130.  
  4131.  Light Red               C
  4132.  
  4133.  Light Magenta           D
  4134.  
  4135.  Light Yellow            E
  4136.  
  4137.  White                   F
  4138.  
  4139.  
  4140.  Each two-digit number describes some combination of background and
  4141.  foreground colors. The list below gives a few examples:
  4142.  
  4143.  Number                      Meaning
  4144.  
  4145.  17                          Blue (1) background, light gray (7) foreground
  4146.  
  4147.  07                          Black (0) background, light gray (7) foreground
  4148.  
  4149.  2F                          Green (2) background, white (F) foreground
  4150.  
  4151.  24                          Green (2) background, red (4) foreground
  4152.  
  4153.  ───────────────────────────────────────────────────────────────────────────
  4154.  NOTE
  4155.     Only color adapter cards support all the colors listed above. If you have
  4156.     a monochrome adapter or monochrome monitor, the only colors available are
  4157.     white (F), black (0), and light gray (7). All other colors are treated as
  4158.     white.
  4159.  ───────────────────────────────────────────────────────────────────────────
  4160.  
  4161.  Example
  4162.  
  4163.  At any time during the editing session, you can set new screen colors
  4164.  (although to set these colors permanently, you should use TOOLS.INI). To set
  4165.  a blue background with a light gray foreground, execute the following steps:
  4166.  
  4167.    1. Invoke the Arg function (press ALT+A)
  4168.    2. Type the following switch assignment: fgcolor:17
  4169.    3. Invoke the Assign function (press ALT+=)
  4170.  
  4171.  
  4172.  7.2.4  Setting Colors for Other Parts of the Screen
  4173.  
  4174.  All color switches interpret digits in the same way. However, each color
  4175.  switch controls a different region of the screen, as described in the list
  4176.  below:
  4177.  
  4178. ╓┌───────────────────────────┌───────────────────────────────────────────────╖
  4179.  Switch                      Description
  4180.  
  4181.  Switch                      Description
  4182.  
  4183.  errcolor                    Controls the colors used to display error
  4184.                              messages on the dialog line.
  4185.  
  4186.  hgcolor                     Controls the colors in a region of text
  4187.                              highlighted by a search command.
  4188.  
  4189.  infcolor                    Controls the colors used for informative text:
  4190.                              messages (other than error messages) that the
  4191.                              editor displays on the dialog line, as well as
  4192.                              strings to be replaced that are located by
  4193.                              Qreplace. The editor displays messages after
  4194.                              executing an operation, such as saving a file or
  4195.                              loading a new file. These colors provide the
  4196.                              default background for the dialog line, and also
  4197.                              control the color of "insert" and "meta" when
  4198.                              they appear on the status line.
  4199.  
  4200.  selcolor                    Controls the color of text that the user
  4201.                              highlights as a cursor-movement argument.
  4202.  Switch                      Description
  4203.  
  4204.                             highlights as a cursor-movement argument.
  4205.  
  4206.  stacolor                    Controls the colors of most items on the status
  4207.                              line.
  4208.  
  4209.  wdcolor                     Controls the color used to draw window borders.
  4210.  
  4211.  
  4212.  The following procedure sets a black (0) background for error messages,
  4213.  combined with a red (4) foreground. Error messages will appear in red
  4214.  letters against a black background:
  4215.  
  4216.    1. Invoke the Arg function (press ALT+A)
  4217.    2. Type the following switch assignment: errcolor:04
  4218.    3. Invoke the Assign function (press ALT+=)
  4219.  
  4220.  
  4221.  7.2.5  Changing the Look and Feel of Help
  4222.  
  4223.  The information in this section applies only to systems configured to use
  4224.  the powerful Microsoft Help engine. If Help is not installed when you press
  4225.  SHIFT+F1, a message appears saying that you have not installed Help yet. Run
  4226.  the installation program for your Microsoft language, or follow the
  4227.  directions in Section 7.6, "Configuring On-Line Help."
  4228.  
  4229.  By default, Help splits the screen and displays Help information in a
  4230.  separate window. This behavior has the advantage of letting you view both
  4231.  the current file and Help information at the same time. You can move the
  4232.  cursor between windows by pressing F6. You can also copy examples from the
  4233.  Help window and paste them into an editing window.
  4234.  
  4235.  You can change the behavior of Help so that it does not split the screen.
  4236.  Instead, Help will save the current file (if the autosave switch is on) and
  4237.  load Help information into the current editing window. This behavior has the
  4238.  advantage of using more room to display Help information.
  4239.  
  4240.  The split-screen behavior is controlled by the helpwindow switch. This
  4241.  switch is a Boolean switch; it can be either on or off. Turning the switch
  4242.  off prevents the editor from splitting the screen to display Help
  4243.  information:
  4244.  
  4245.    1. Invoke Arg (press ALT+A)
  4246.  
  4247.    2. Type the following switch assignment: nohelpwindow:
  4248.  
  4249.    3. Invoke the Assign function (press ALT+=)
  4250.  
  4251.  Conversely, to turn the split-screen behavior back on, give the Arg textarg
  4252.  Assign command, in which textarg is helpwindow:.
  4253.  
  4254.  ───────────────────────────────────────────────────────────────────────────
  4255.  NOTE
  4256.     When helpwindow is on, use the Cancel function (ESC) to close the Help
  4257.     window. When helpwindow is off, use the Cancel function (ESC) to return
  4258.     to the previous file.
  4259.  ───────────────────────────────────────────────────────────────────────────
  4260.  
  4261.  You can also control the colors used in the Help window. The writer of a
  4262.  help file can designate text as foreground, bold, italicized, underlined, or
  4263.  as warning text. You cannot change these designations. However, you can
  4264.  easily change the choice of colors used to illustrate each kind of text:
  4265.  
  4266.  Switch                      Meaning
  4267.  
  4268.  fgcolor                     Foreground color, which controls the color of
  4269.                              normal text. This switch also controls the
  4270.                              foreground color of editing windows.
  4271.  
  4272.  helpboldcolor               Color of text designated as bold.
  4273.  
  4274.  helpitalcolor               Color of text designated as italicized.
  4275.  
  4276.  helpundcolor                Color of text designated as underlined.
  4277.  
  4278.  helpwarncolor               Color of text used for a "warning" note. Also
  4279.                              controls color of highlighted cross-references.
  4280.  
  4281.  All of the switches above are set the same way the fgcolor switch is, as
  4282.  explained in Section 7.2.3.
  4283.  
  4284.  
  4285.  7.2.6  Controlling Use of Tabs
  4286.  
  4287.  The Microsoft Editor provides two basic ways of working with tab characters:
  4288.  you can either treat tabs as real characters, or you can have the editor
  4289.  convert each tab into a series of spaces. This behavior is controlled by the
  4290.  realtabs switch.
  4291.  
  4292.  The realtabs switch is a Boolean switch that by default is on, causing the
  4293.  editor to treat each tab (ASCII 9) as an independent character. Unlike other
  4294.  characters, a tab may correspond to several positions on the screen. If you
  4295.  place the cursor on a tab character and press RIGHT, the cursor jumps to the
  4296.  next tab column. Tab columns occur at regular intervals, as determined by
  4297.  the filetab switch.
  4298.  
  4299.  As you add and delete characters, the editor maintains the tab-column
  4300.  alignment of the text.
  4301.  
  4302.  Whether or not realtabs is on, the Tab function is simply a movement
  4303.  function, and it does not insert tabs into a file. To use the TAB key to
  4304.  directly insert tabs, put the following assignment in your TOOLS.INI file,
  4305.  or give it as input to the Assign command:
  4306.  
  4307.       graphic:tab
  4308.  
  4309.  This assignment makes the TAB key a graphic character. Each time you press
  4310.  TAB, you directly place an actual tab character into the file.
  4311.  
  4312.  If you turn the realtabs switch off, the Microsoft Editor translates tab
  4313.  characters into spaces. This behavior only affects the individual lines that
  4314.  you modify. If you read a file but make no changes, the tab-to-space
  4315.  conversion does not alter the file on disk, even if you execute a save
  4316.  operation.
  4317.  
  4318.  The editor may also convert spaces to tabs, according to the setting of the
  4319.  entab switch, described below. This behavior also only affects the
  4320.  individual lines that you modify.
  4321.  
  4322.  The tabdisp switch is useful for viewing the effect of writing to a disk
  4323.  file. If you set tabdisp to a number other than 0 or 32, the editor shows
  4324.  you which spaces will be compressed into a tab character at the next write
  4325.  to the disk file. All such spaces are displayed as the ASCII equivalent of
  4326.  the value of tabdisp.
  4327.  
  4328.  If realtabs is on, each position in a tab field displays this same
  4329.  character.
  4330.  
  4331.  For example, the following steps set tabdisp to 249:
  4332.  
  4333.    1. Invoke Arg (press ALT+A)
  4334.    2. Type the following switch assignment: tabdisp:249
  4335.    3. Invoke the Assign function (press ALT+=)
  4336.  
  4337.  After you carry out these steps, the editor displays the ASCII equivalent of
  4338.  249 in place of each position in a tab field.
  4339.  
  4340.  The following list describes the meaning of the four tab-handling switches:
  4341.  
  4342. ╓┌───────────────────────────┌───────────────────────────────────────────────╖
  4343.  Switch                      Description
  4344.  
  4345.  realtabs                    Controls whether or not tabs are treated as real
  4346.                              characters, as described above. If on, tab
  4347.                              columns are aligned according to the filetab
  4348.                              switch. If realtabs is off, every tab read is
  4349.  Switch                      Description
  4350.  
  4351.                             switch. If realtabs is off, every tab read is
  4352.                              treated as a series of spaces, according to the
  4353.                              filetab switch.
  4354.  
  4355.  entab                       Controls the extent to which the editor converts
  4356.                              a series of tabs and spaces to tabs when saving
  4357.                              a file. Only the lines you modify during the
  4358.                              editing session are affected by space-to-tab
  4359.                              conversion.
  4360.  
  4361.                              A value of 0 means the editor does not replace
  4362.                              spaces by tabs. A value of 1 (the default) means
  4363.                              the editor can replace a series of tabs and
  4364.                              spaces by tabs when the spaces fall outside of
  4365.                              quoted strings. A value of 2 means all series of
  4366.                              tabs and spaces can be replaced by tabs.
  4367.  
  4368.                              The entab switch determines what kind of
  4369.                              space-to-tab replacements are possible. Whether
  4370.  Switch                      Description
  4371.  
  4372.                             space-to-tab replacements are possible. Whether
  4373.                              a replacement is made in any given case depends
  4374.                              on the position of the spaces, and on the
  4375.                              filetab switch, described next.
  4376.  
  4377.  filetab                     Controls the physical (disk-file) meaning of tab
  4378.                              characters. If realtabs is on, the filetab
  4379.                              switch determines tab alignment. Ifrealtabs is
  4380.                              off, the filetab switch determines how the
  4381.                              editor translates tab characters to spaces when
  4382.                              a line of text is modified. If entab is set to 1
  4383.                              or 2, filetab also determines how the editor
  4384.                              translates spaces to tabs when you save the file
  4385.                              to disk. (Only modified lines are affected.)
  4386.  
  4387.                              The value of the switch gives the number of
  4388.                              spaces associated with each tab column. For
  4389.                              example, the setting "filetab:4" assumes a tab
  4390.                              column every 4 positions on each line. Every
  4391.  Switch                      Description
  4392.  
  4393.                             column every 4 positions on each line. Every
  4394.                              time the editor finds a tab character (ASCII 9),
  4395.                              it loads the buffer with the number of spaces
  4396.                              necessary to get to the next tab column. The
  4397.                              default value of filetab is 8.
  4398.  
  4399.  tabalign                    If realtabs and tabalign are both set, the
  4400.                              cursor automatically moves to the first column
  4401.                              position of a tab character when it is placed
  4402.                              anywhere within a tab character. Cursor movement
  4403.                              corresponds to the actual characters in the
  4404.                              file.
  4405.  
  4406.                              When not set (the default), the cursor may be
  4407.                              placed anywhere in any column of a tab
  4408.                              character. If a character is typed at this
  4409.                              position, sufficient leading blanks will be
  4410.                              inserted to assure that the character actually
  4411.                              appears in this column position. Cursor movement
  4412.  Switch                      Description
  4413.  
  4414.                             appears in this column position. Cursor movement
  4415.                              is independent of the actual characters in the
  4416.                              file.
  4417.  
  4418.  tabstops                    Determines the size of columns associated with
  4419.                              the Tab and Backtab cursor-movement functions.
  4420.                              It has no affect on actual tab characters. The
  4421.                              default value of tabstops is 4.
  4422.  
  4423.  
  4424.  7.2.7  Changing How the Editor Handles Trailing Spaces
  4425.  
  4426.  A "trailing space" is a space character located to the right of the last
  4427.  printable character on a line. A trailing space is normally invisible. By
  4428.  default, the editor deletes all trailing spaces on each line you modify.
  4429.  
  4430.  However, you can change this behavior by resetting the value of the
  4431.  trailspace switch. This switch is Boolean switch; it can be either on or
  4432.  off. To turn this switch on, give the Arg textarg Assign command (ALT+A
  4433.  textarg ALT+=), in which trailspace: is the textarg. When you wish to turn
  4434.  this switch off, give the Arg textarg Assign command, in which notrailspace:
  4435.  is the textarg.
  4436.  
  4437.  When this switch is on, any space you type at the end of a line remains in
  4438.  the file as a trailing space. You can verify the existence of trailing
  4439.  spaces by invoking the Endline function (press END). If the cursor moves
  4440.  past the last printable character when you invoke Endline, the line contains
  4441.  trailing spaces.
  4442.  
  4443.  To display trailing spaces, set the traildisp switch to a number greater
  4444.  than 0. The editor displays the ASCII-character equivalent of the number you
  4445.  choose, in place of each trailing space. For example, invoke the Arg textarg
  4446.  Assign command in which textarg is traildisp:1.
  4447.  
  4448.  The example above displays the ASCII equivalent of the number 1 in place of
  4449.  each trailing space. To restore normal display, set traildisp back to 0.
  4450.  
  4451.  
  4452.  7.2.8  Changing Screen Height
  4453.  
  4454.  Change the screen height by setting the height switch. This switch takes
  4455.  only a few values that are limited by the kind of graphics adapter card you
  4456.  are using:
  4457.  
  4458.  Graphics Card               Legal Values
  4459.  
  4460.  CGA or monochrome           23  (25-line mode)
  4461.  
  4462.  EGA                         23  (25-line mode) 41  (43-line mode)
  4463.  
  4464.  VGA                         23  (25-line mode) 41  (43-line mode) 48
  4465.                              (50-line mode)
  4466.  
  4467.  Note that you assign to height a number two less than the desired mode. That
  4468.  is because height refers to the height of the editing window, not the full
  4469.  screen. (Two lines at the bottom of the screen are reserved for dialog and
  4470.  status.)
  4471.  
  4472.  
  4473.  7.3  Special Syntax for Text Switches
  4474.  
  4475.  The following text switches recognize special characters for referring to
  4476.  file names or directories:
  4477.  
  4478.    ■  extmake, which can be repeatedly assigned to different compilation
  4479.       commands
  4480.  
  4481.    ■  readonly, which gives a system-level command, executed whenever you
  4482.       attempt to overwrite a read-only file
  4483.  
  4484.    ■  load, which loads a C extension as described in Chapter 8
  4485.  
  4486.    ■  markfile, which loads file markers from a specially prepared file
  4487.  
  4488.    ■  helpfiles, which specifies which .HLP files should be used by on-line
  4489.       Help
  4490.  
  4491.  This syntax presented in the next two sections is never required, but is
  4492.  provided for convenience.
  4493.  
  4494.  
  4495.  7.3.1  Special Syntax for extmake and readonly
  4496.  
  4497.  The text switches extmake and readonly each interpret the following
  4498.  characters as the name of the current file:
  4499.  
  4500.       %s
  4501.  
  4502.  You can also use a more comprehensive syntax that lets you specify drive,
  4503.  file name, base name, or file extension. The syntax consists of the
  4504.  characters
  4505.  
  4506.       %|lettersF
  4507.  
  4508.  where letters consists of any of the following: p for path, d for drive, f
  4509.  for file base name, or e for file extension. For example, if you are editing
  4510.  the file c:\dir1\sample.c, and you make the switch assignment
  4511.  
  4512.       extmake:c cl /Fod:%|pfF %|dfeF
  4513.  
  4514.  then each time you give the command Arg Compilation, the editor performs the
  4515.  following system-level command:
  4516.  
  4517.       cl /Fod:\dir1\sample c:sample.c
  4518.  
  4519.  The expression %s is equivalent to %|feF except that the former is only
  4520.  accepted once in each assignment, whereas the latter can appear any number
  4521.  of times in the extmake switch assignment. The expression %|F is equivalent
  4522.  to %|dpfeF.
  4523.  
  4524.  
  4525.  7.3.2  Special Syntax for load, markfile, and helpfiles
  4526.  
  4527.  The load, markfile, and helpfiles switches each search for a file. These
  4528.  switches can also take the syntax
  4529.  
  4530.       $environ:
  4531.  
  4532.  in which environ is the name of an environment variable recognized by the
  4533.  operating system. The editor will search directories listed in the
  4534.  environment variable to find the file. Environment variables are created
  4535.  with the system-level SET command. See your operating-system documentation
  4536.  for more information on the SET command.
  4537.  
  4538.  For example, the following assignment causes the editor to search
  4539.  directories in the INIT environment variable for the file MARKERS.DAT:
  4540.  
  4541.       markfile:$INIT:markers.dat
  4542.  
  4543.  Note that the environment variable should be entered in uppercase letters.
  4544.  
  4545.  
  4546.  7.4  Sample TOOLS.INI File
  4547.  
  4548.  Each time you start the editor, it checks the [M] section of the TOOLS.INI
  4549.  file for any function assignments, switch assignments, and macro definitions
  4550.  you have placed there. (However, the editor may check a different section if
  4551.  the editor is not named M.EXE.)
  4552.  
  4553.  You can change these settings at any time during the editing session by
  4554.  using the Assign command. However, using TOOLS.INI is more convenient for
  4555.  settings you want to use every time. Use TOOLS.INI to make the editor
  4556.  automatically start up with all the screen colors, tab behavior, function
  4557.  assignments, and special editing functions you want to make available for
  4558.  all editing sessions.
  4559.  
  4560.  The editor loads settings from TOOLS.INI when it starts and when you invoke
  4561.  the Initialize function (SHIFT+F8) during the editing session. By giving a
  4562.  text argument, you can also use Initialize to load specific sections within
  4563.  TOOLS.INI.
  4564.  
  4565.  ───────────────────────────────────────────────────────────────────────────
  4566.  NOTE
  4567.     The editor checks the directories listed in the INIT environment variable
  4568.     for the location of the TOOLS.INI file. For example, if the TOOLS.INI
  4569.     file is in the directory C:\BIN, place the following statement in your
  4570.     AUTOEXEC.BAT file: SET INIT=C:\BIN.
  4571.  ───────────────────────────────────────────────────────────────────────────
  4572.  
  4573.  The example below shows a sample TOOLS.INI file. The next section explains
  4574.  each section of this file in depth. Note that text following the semicolon
  4575.  (;) is a comment.
  4576.  
  4577.       [M MEP]                       ; Settings for both M and MEP
  4578.  
  4579.               enterinsmode:         ; Start up in insert mode
  4580.               backup:none           ; Perform no backup
  4581.               displaycursor:        ; Display cursor on status line
  4582.               fgcolor:17            ; Set primary and error colors
  4583.               errcolor:04
  4584.  
  4585.               join:=savecur endline right arg sdelete savecur   ; Macro
  4586.  
  4587.               savecur:ctrl+f5       ; Assignments to keys
  4588.               restcur:ctrl+f6
  4589.               join:alt+j
  4590.  
  4591.       [M-C MEP-C]                   ; C specific section - enable with Initial
  4592.  
  4593.               tabstops:3            ; Tab columns 3 wide within editor
  4594.               case:                 ; Case-sensitive searches
  4595.  
  4596.       [NMAKE]
  4597.  
  4598.       #  This is a comment line recognized by NMAKE
  4599.  
  4600.  
  4601.  7.5  The Structure of the TOOLS.INI File
  4602.  
  4603.  To create a TOOLS.INI file for the editor, you need to follow a few simple
  4604.  rules:
  4605.  
  4606.    1. You must precede your editor settings by a tag, or they will not be
  4607.       recognized. A "tag" is a heading within the TOOLS.INI file that divides
  4608.       the file into sections.
  4609.  
  4610.       For example, you can use tags to create a section for the editor ([M]
  4611.       or [MEP], unless you have renamed the editor) and a section for another
  4612.       utility such as NMAKE, which looks for a section headed by the [NMAKE]
  4613.       tag. Each utility has its own syntax for interpreting TOOLS.INI
  4614.       statements, but all utilities must recognize tags. See the Microsoft
  4615.       CodeView and Utilities User's Guide for more information on NMAKE.
  4616.  
  4617.    2. A semicolon (;) indicates that all text from the semicolon to the end
  4618.       of the line is a comment, and is ignored by the editor. To mark the
  4619.       beginning of a comment, a semicolon must either appear at the beginning
  4620.       of a line or be preceded by a space.
  4621.  
  4622.    3. All macro definitions, function assignments, and switch assignments use
  4623.       exactly the same syntax used with the Assign command.
  4624.  
  4625.       However, you do not invoke Arg or Assign; simply enter the assignment
  4626.       itself. (See the sample TOOLS.INI file for clarification.)
  4627.  
  4628.    4. You can use the backslash (\) as a line-continuation character to
  4629.       continue  statements too long for one line. The backslash must be
  4630.       preceded by a space and can be followed only by trailing spaces and an
  4631.       optional comment. Normally, you should precede the backslash by two
  4632.       spaces.
  4633.  
  4634.  The next few sections explain each part of the file──tags, comments, and
  4635.  assignments.
  4636.  
  4637.  
  4638.  7.5.1  Creating Sections with Tags
  4639.  
  4640.  Tags divide the TOOLS.INI file into sections.  All statements are associated
  4641.  only with the tag they immediately follow. This feature allows programs
  4642.  other than the Microsoft Editor to use this file for configuration
  4643.  information. The most common way to use a tag is to simply include all
  4644.  assignments and macro definitions after an M or MEP tag (depending on the
  4645.  name of the editor):
  4646.  
  4647.       [M]
  4648.  
  4649.  When you run the Microsoft Editor under DOS 2.x, the editor always responds
  4650.  to the tag [M]. Otherwise, the tag should use the base file name of the
  4651.  editor. If the editor is named MEP.EXE, use the tag [MEP]. Use [M MEP] if
  4652.  you have both M.EXE and MEP.EXE.
  4653.  
  4654.  ───────────────────────────────────────────────────────────────────────────
  4655.  IMPORTANT
  4656.     The name you use for the main editor tag should appear in all other
  4657.     editor tags as well. For example, if the main editor tag is [EDIT]
  4658.     (because you renamed the editor to EDIT.EXE), all editor tags should
  4659.     begin with the word EDIT. Instead of using [M-3.20], you would use
  4660.     [EDIT-3.20].
  4661.  ───────────────────────────────────────────────────────────────────────────
  4662.  
  4663.  When the Microsoft Editor is started, the tagged sections are loaded in the
  4664.  following order:
  4665.  
  4666.    1. Information used for all editing sessions.
  4667.  
  4668.       All of the statements in the [M] section are loaded. Remember to use a
  4669.       different tag if you rename the editor.
  4670.  
  4671.    2. Information specific to the operating system.
  4672.  
  4673.       Depending upon the operating system you are running, one of the
  4674.       following tagged sections is loaded (if present):
  4675.  
  4676.         ■  [M-3.20] (MS-DOS)
  4677.         ■  [M-10.0] (OS/2 protected mode)
  4678.         ■  [M-10.0R] (OS/2 real mode)
  4679.  
  4680.       With the DOS or OS/2 version tag, you should insert the version number
  4681.       you are using. (OS/2 1.10 uses the tag 10.10.) You can combine
  4682.       operating-system tags by grouping them together within the brackets:
  4683.  
  4684.            [M-3.20 M-3.30]                      ; For DOS versions
  4685.            [MEP-10.0 MEP-10.10]                 ; For OS/2 versions
  4686.            [M-3.20 M-3.30 M-10.0R M-10.10R]     ; For real mode
  4687.  
  4688.    3. Information specific to the display.
  4689.  
  4690.       Depending on the video display you are using, one of the following
  4691.       tagged sections is loaded (if present):
  4692.  
  4693.         ■  [M-mono]
  4694.         ■  [M-cga]
  4695.         ■  [M-ega]
  4696.         ■  [M-vga]
  4697.  
  4698.       You can also put statements for setting the screen dimensions and
  4699.       colors in these tagged sections.
  4700.  
  4701.       All tags can be combined so one section of statements applies to more
  4702.       than one tag:
  4703.  
  4704.          [M-mono M-cga MEP-mono MEP-cga]
  4705.  
  4706.       The example above begins a section that is loaded if your computer has
  4707.       either a monochrome adapter or a CGA adapter.
  4708.  
  4709.  You can also create a tag with statements specific to a file extension. The
  4710.  form is
  4711.  
  4712.       [M-.ext]
  4713.  
  4714.  where .ext is an extension of up to three characters. Whenever you load a
  4715.  new file, or switch to editing a different file, the editor automatically
  4716.  searches TOOLS.INI for a tag that matches the new file extension. If it
  4717.  finds a matching tag, the statements following that tag are executed. If
  4718.  not, the existing configuration is retained.
  4719.  
  4720.  This feature can be used to create operating environments that are specific
  4721.  to a particular type of text file or programming language. For example, the
  4722.  tag [M-.FOR] could precede a set of statements for editing .FOR (FORTRAN)
  4723.  files:  a blue background, the right margin at column 72, and tabs set every
  4724.  three columns. C-language files with the .C extension could have their own
  4725.  set of statements following a [M-.C] tag: a magenta background, the right
  4726.  margin at column 128, and tabs set every five columns.
  4727.  
  4728.  You can also use a tag to create a special section that is loaded manually
  4729.  with the Arg textarg Initialize command. These tags use the following
  4730.  syntax:
  4731.  
  4732.       [M-textarg]
  4733.  
  4734.  This feature lets you make special key assignments, load rarely used macros,
  4735.  or switch the operating environment to a special configuration, only when
  4736.  required.
  4737.  
  4738.  
  4739.  7.5.2  Using Comments
  4740.  
  4741.  The Microsoft Editor considers text from a semicolon (;) to the end of a
  4742.  line to be a comment. Comments are for documentation purposes only and are
  4743.  ignored by the editor.
  4744.  
  4745.  To be considered part of a comment, the semicolon must either appear at the
  4746.  beginning of a line or else be preceded by a space. Thus, in the following
  4747.  line, the first semicolon is considered part of a command, and the second
  4748.  begins a comment:
  4749.  
  4750.       extmake:asm masm /Zi /MX %s; ; "Compile" setting for MASM
  4751.  
  4752.  Semicolons inside a quoted string do not begin a comment.
  4753.  
  4754.  
  4755.  7.5.3  Line Continuation
  4756.  
  4757.  Use the backslash (\) to continue a long macro definition to the next line.
  4758.  To be interpreted as the line-continuation character, the backslash must be
  4759.  preceded by a space. It should be the last character on the line except for
  4760.  spaces and comments. The editor does not interpret the backslash as the
  4761.  line-continuation char-acter in the following statement:
  4762.  
  4763.       qreplace:ctrl+\
  4764.  
  4765.  The following statement illustrates valid use of line continuation:
  4766.  
  4767.       findswitch:=psearch ->skip arg mark :>skip arg "<assign>"  \
  4768.                   setfile begfile psearch
  4769.  
  4770.  Note that the backslash should be followed by at least two spaces, unless
  4771.  you want the end of one line to be concatenated without a break to the
  4772.  beginning of the next. In the example above, two spaces are necessary to
  4773.  prevent the editor from viewing "<assign>"setfile as one item.
  4774.  
  4775.  You can use line continuation to extend a single assignment statement over
  4776.  several lines.
  4777.  
  4778.  
  4779.  7.5.4  Assignments and Macros
  4780.  
  4781.  Function assignments, switch assignments, and macro definitions all use the
  4782.  same syntax within the TOOLS.INI file as they do with the Arg textarg Assign
  4783.  command. The only difference is you do not need to invoke the Arg or Assign
  4784.  functions.
  4785.  
  4786.  The TOOLS.INI file is convenient for defining complicated macros, especially
  4787.  nested macros. By placing macro definitions in the TOOLS.INI file, you can
  4788.  view how you wrote a macro. Furthermore, you can easily modify a macro that
  4789.  doesn't work correctly by loading the TOOLS.INI file, making changes to your
  4790.  macro definitions, and reinitializing.
  4791.  
  4792.  If you customized your copy of the Microsoft Editor when you installed it, a
  4793.  special TOOLS.INI was created that contains the special key assignments.
  4794.  This TOOLS.INI file also contains a number of useful macros from the
  4795.  TOOLS.PRE file. You may want to study TOOLS.PRE to see how macros are
  4796.  entered and which macros might be useful to you.
  4797.  
  4798.  Use the Initialize function (SHIFT+F8) to reload your TOOLS.INI settings.
  4799.  When you give the Initialize function a textarg, it attempts to use settings
  4800.  from the following section:
  4801.  
  4802.       [M-textarg]
  4803.  
  4804.  However, when you invoke Initialize with no argument, the editor reloads
  4805.  settings in the TOOLS.INI file in the same way that it does on start-up.
  4806.  
  4807.  You can create a macro to be executed whenever the editor starts up. Simply
  4808.  define a macro and assign it the name autostart. For example, when you place
  4809.  the following macro in the [M] section of the TOOLS.INI file, the editor
  4810.  transfers to the Clipboard and returns, thus making the Clipboard the
  4811.  previous file:
  4812.  
  4813.       autostart:=arg "<clipboard>" setfile setfile
  4814.  
  4815.  
  4816.  7.6  Configuring On-Line Help
  4817.  
  4818.  The installation program for your Microsoft language is the recommended
  4819.  method for configuring on-line Help. The procedure varies, depending on
  4820.  whether you use OS/2 (supporting protected mode and real mode) or DOS (real
  4821.  mode only).
  4822.  
  4823.    1. If you are running under DOS or real-mode OS/2 only, copy the M.HLP and
  4824.       MHELP.MXT files to any directory specified in the PATH environment
  4825.       variable in your AUTOEXEC.BAT file (DOS) or STARTUP.CMD file (OS/2).
  4826.  
  4827.    2. If you are running under protected-mode OS/2 only, copy the M.HLP and
  4828.       MHELP.PXT files to any directory specified in the PATH environment
  4829.       variable. Also copy MSHELP.DLL to any directory listed in the LIBPATH
  4830.       variable in the CONFIG.SYS file. MHELP.DLL is an extension to the
  4831.       editor. MSHELP.DLL is a support library that implements the standard
  4832.       Microsoft Help engine.
  4833.  
  4834.    3. If you are setting up for both real- and protected-mode OS/2, perform
  4835.       both the preceding steps.
  4836.  
  4837.  Other Microsoft products include .HLP files that the Microsoft Editor can
  4838.  read. If you want to add additional .HLP files to Help, you need to include
  4839.  the following tagged section in your TOOLS.INI file:
  4840.  
  4841.       [M-MHELP.MXT MEP-MHELP.MXT]
  4842.       helpfiles:path\file.hlp
  4843.  
  4844.  in which path is the directory of the Help file. The tag [M-MHELP.MXT
  4845.  MEP-MHELP.MXT] is the heading for the section in the TOOLS.INI file executed
  4846.  whenever Help is loaded. If this section is missing, the editor looks for
  4847.  the file M.HLP in your PATH directories. To install more than one Help file,
  4848.  you must have this tagged section in TOOLS.INI.
  4849.  
  4850.  Whenever you use context-sensitive Help, the editor searches the files
  4851.  specified in the helpfiles switch in the order listed. The search is slower
  4852.  if the topics you most often inquire about are in files at the end of the
  4853.  list. You can alter the helpfiles switch at any time with the Assign
  4854.  command.
  4855.  
  4856.  
  4857.  7.6.1  Controlling Search Order
  4858.  
  4859.  Context-sensitive Help searches all the Help files for the selected topic.
  4860.  The order in which files are searched is important. Two different Help files
  4861.  may have an entry for the same topic. Furthermore, searching the appropriate
  4862.  file first speeds up Help.
  4863.  
  4864.  You can use the file extension of the current file to change the order in
  4865.  which .HLP files are searched. Precede files specified in the helpfiles
  4866.  switch by a file extension and a colon (:):
  4867.  
  4868.       helpfiles: M.HLP .BAS:QB.HLP .C.H:C.HLP .ASM:OS2.HLP
  4869.  
  4870.  In the example above, Help searches QB.HLP first when the current file has a
  4871.  .BAS extension, C.HLP when the current file has a .C or .H extension, and
  4872.  OS2.HLP when the current file has a .ASM extension. In all cases, all of the
  4873.  files listed are searched before Help concludes it cannot find a topic.
  4874.  
  4875.  
  4876.  7.6.2  Default Help File Search
  4877.  
  4878.  The editor looks for .HLP files according to the following rules:
  4879.  
  4880.    1. If the helpfiles switch is set, the editor uses the files specified in
  4881.       this switch.
  4882.  
  4883.    2. If helpfiles is not set, the editor checks next to see if the HELPFILES
  4884.       environment variable is set. If it is, this environment variable is
  4885.       evaluated the same way the helpfiles switch is.
  4886.  
  4887.    3. If neither the helpfiles switch nor the HELPFILES environment variable
  4888.       is set, the editor searches for the file M.HLP. The editor finds M.HLP
  4889.       if this file is in a directory listed in the PATH environment variable.
  4890.  
  4891.  
  4892.  Chapter 8  Programming C Extensions
  4893.  ───────────────────────────────────────────────────────────────────────────
  4894.  
  4895.  C extensions provide the most powerful means of customizing the Microsoft
  4896.  Editor. A "C extension" is a C-language module containing new editing
  4897.  functions you program. Your functions can be attached to a key, given
  4898.  arguments, or used in macros just as standard editing functions are. The
  4899.  module can also define new switches. The user can adjust these switches to
  4900.  modify the behavior of your functions.
  4901.  
  4902.  With C extensions, you can use the power of the C language──data structures,
  4903.  control-flow structures, and C operators. Furthermore, C extensions are much
  4904.  faster than macros because they are compiled.
  4905.  
  4906.  ───────────────────────────────────────────────────────────────────────────
  4907.  NOTE
  4908.     This chapter assumes you already know how to program in C. Before you
  4909.     read the chapter, make sure you understand the following C-language
  4910.     programming concepts: functions, pointers, structures, and unions. You
  4911.     also need to know how to compile and link a C source file.
  4912.     You can also write extensions with the Microsoft Macro Assembler if you
  4913.     simulate the C memory model specified in Section 8.5.1, "Compiling and
  4914.     Linking in Real Mode." However, this chapter is primarily addressed to C
  4915.     programmers.
  4916.  ───────────────────────────────────────────────────────────────────────────
  4917.  
  4918.  This chapter gradually develops concepts for writing C extensions. The first
  4919.  time you read the chapter, read the sections in order. The chapter first
  4920.  describes requirements for writing C extensions and explains how C
  4921.  extensions work. It then explains how to create the required objects in a C
  4922.  extension, to program your editing functions, to compile and link your
  4923.  module, and to use the editor's low-level functions to read and write to
  4924.  files.
  4925.  
  4926.  
  4927.  8.1  Requirements
  4928.  
  4929.  To create C extensions, you need to have the following files and software
  4930.  present in your current directory (or directories listed in the PATH or
  4931.  INCLUDE environment variables, as appropriate):
  4932.  
  4933.    ■  The Microsoft C Optimizing Compiler, Version 5.1 or later. You can use
  4934.       Version 4.0 or 5.0 of the compiler, but the files you need are provided
  4935.       with Version 5.1 and later. You also get these files with the Microsoft
  4936.       Macro Assembler, Version 5.1 and later.
  4937.  
  4938.    ■  The Microsoft Overlay Linker, Version 3.60 or later; the OS/2 version
  4939.       of the linker; or the Microsoft Segmented-Executable Linker, Version
  4940.       5.01.
  4941.  
  4942.    ■  EXTHDR.OBJ (supplied with the C compiler) or EXTHDRP.OBJ (a file
  4943.       supplied with the C compiler for creating protected-mode extensions).
  4944.  
  4945.    ■  EXT.H (supplied with the C compiler).
  4946.  
  4947.    ■  SKEL.C (a template supplied with the C compiler you can replace with
  4948.       your own code).
  4949.  
  4950.  You need a minimum of 220K of available memory for the editor to load a C
  4951.  extension at run time, plus the size of the extension itself.
  4952.  
  4953.  
  4954.  8.2  How C Extensions Work
  4955.  
  4956.  A C-extension module is similar in the following respects to an OS/2 or
  4957.  Windows dynamic-link library:
  4958.  
  4959.    ■  There is no function called main in your module. Instead, you use
  4960.       certain names and structures the editor recognizes.
  4961.  
  4962.    ■  You compile and link to create an executable file, but this executable
  4963.       file is separate from the "main program," M.EXE or MEP.EXE.
  4964.  
  4965.    ■  The editor loads your executable file into memory at run time and uses
  4966.       a table-driven method for enabling your module to call functions within
  4967.       the editor.
  4968.  
  4969.  Once your executable file is loaded, it resides in memory along with the
  4970.  editor. The editor can call your functions, and your functions can call the
  4971.  Microsoft Editor's low-level functions that perform input and output
  4972.  operations.
  4973.  
  4974.  The following list summarizes the process of developing and using a C
  4975.  extension:
  4976.  
  4977.    1. Compile a C module with a special memory-model option, then link the
  4978.       resulting object file to create an executable file.
  4979.  
  4980.       You also link in the object file EXTHDR.OBJ  (or EXTHDRP.OBJ, if
  4981.       linking for protected mode) to the beginning of your executable file.
  4982.       This object file contains a special table that enables your functions
  4983.       to effectively call functions within the editor.
  4984.  
  4985.    2. Start up the Microsoft Editor. Set the load switch  to look for the
  4986.       executable file you created. (As discussed in Chapter 7, the load
  4987.       switch can be set in the TOOLS.INI file or manually with the Assign
  4988.       function.)
  4989.  
  4990.       The editor loads your executable file into memory.
  4991.  
  4992.    3. As soon as the executable file is loaded, the Microsoft Editor calls
  4993.       the function WhenLoaded──a special function your module must define.
  4994.       At the same time, the editor examines the table cmdTable, which is an
  4995.       array of structures your module must declare. The editor examines this
  4996.       table to recognize the editing functions you created. The table
  4997.       contains function names and pointers to functions.
  4998.  
  4999.    4. You can assign keys to call your functions. Assign a key manually or in
  5000.       the WhenLoaded function, then press the assigned key. You can also call
  5001.       an editing function indirectly by placing it in a macro and calling the
  5002.       macro.
  5003.  
  5004.    5. When you invoke a C-extension function, the editor responds by calling
  5005.       your module.
  5006.  
  5007.    6. Your editing function is executed. It calls the Microsoft Editor's
  5008.       low-level functions to read from the text file, read output to the text
  5009.       file, and print messages.
  5010.  
  5011.  
  5012.  8.3  Writing a C Extension
  5013.  
  5014.  To create a successful C extension, you need to follow these guidelines:
  5015.  
  5016.    1. Include the file EXT.H.
  5017.  
  5018.       This file declares all structures and types required to establish an
  5019.       interface to the editor.
  5020.  
  5021.    2. Include the standard items that are described in Section 8.3.1,
  5022.       "Required Objects," and write your functions by following the steps in
  5023.       Section 8.4, "Programming Your Function." Then compile and link as
  5024.       directed in Section 8.5, "Compiling and Linking."
  5025.  
  5026.    3. Call the low-level extension functions to do most any operation with
  5027.       files, such as read from a file, write to a file, delete or add files,
  5028.       and move the cursor. These functions are completely described in
  5029.       Chapter 9, "C-Extension Functions," (an alphabetical reference), and
  5030.       summarized by topic at the end of this chapter.
  5031.  
  5032.       Do not call functions from the C library routine, except for the ones
  5033.       specifically listed in Section 8.7, "Calling Library Functions."
  5034.       Futhermore, floating-point arithmetic is not supported.
  5035.  
  5036.  
  5037.  8.3.1  Required Objects
  5038.  
  5039.  A C-extension module must have at minimum the three objects described below:
  5040.  
  5041.  Object Name                 Description
  5042.  
  5043.  swiTable                    An array of structures that declares internal
  5044.                              switches you wish to create
  5045.  
  5046.  cmdTable                    An array of structures that declares editing
  5047.                              functions you have coded
  5048.  
  5049.  WhenLoaded                  A function that the editor calls as soon as the
  5050.                              C-extension module is loaded
  5051.  
  5052.  Each of these items can be as short or long as you wish. Each table can be
  5053.  as short as a single row of entries. The WhenLoaded function can return
  5054.  immediately, or it can perform useful initialization tasks, such as
  5055.  assigning keys to functions or printing a message.
  5056.  
  5057.  
  5058.  8.3.2  The Switch Table
  5059.  
  5060.  The switch table, swiTable, consists of a series of structures in which each
  5061.  structure describes a switch you wish to create. The table ends with a
  5062.  structure that has all null (all zero) values. Though you may choose not to
  5063.  create any switches, the table must still be present. The simplest table
  5064.  allowed is therefore
  5065.  
  5066.       struct swiDesc swiTable[] =
  5067.       {
  5068.            { (void *) 0, (void *) 0, 0 }
  5069.       };
  5070.  
  5071.  The structure type swiDesc is defined in EXT.H. This structure contains the
  5072.  following three fields that define a switch for the editor to recognize:
  5073.  
  5074.    1. A pointer to the name of the switch.
  5075.  
  5076.    2. A pointer to the switch itself or to a function. If the switch is
  5077.       Boolean, this field must point to the switch (an integer which assumes
  5078.       the value -1 or 0). If the switch is text, this field must point to a
  5079.       function, as explained below. If the switch is numeric, this field
  5080.       points to switch itself──an integer.
  5081.  
  5082.    3. A flag that indicates the type of switch: either SWI_BOOLEAN,
  5083.       SWI_NUMERIC, or SWI_SPECIAL.
  5084.  
  5085.  If the third field has value SWI_NUMERIC, you must combine it with the value
  5086.  RADIX10 or RADIX16 by using binary or (|). (See the second example below.)
  5087.  If you specify RADIX10, the editor interprets user-assigned values as
  5088.  decimal digits. If you specify RADIX16, the editor interprets these values
  5089.  as hexadecimal.
  5090.  
  5091.  If the third field has value SWI_SPECIAL, the second field must be a pointer
  5092.  to a function of type int far pascal. You define this function in your code.
  5093.  Each time the value of the switch changes, the editor calls your function
  5094.  and passes the updated value in a character string. Your function should
  5095.  declare exactly one parameter: a far pointer to a character string.
  5096.  Typically, this function might set a global variable:
  5097.  
  5098.       char globalstr[BUFLEN];
  5099.  
  5100.       int far pascal setstr (char far *p)
  5101.       {
  5102.            strcpy (globalstr, p);
  5103.       }
  5104.  
  5105.  The table may have any number of rows (each row being a structure), and must
  5106.  at least include the final row of all null values. Here is an example of a
  5107.  table that creates a numeric switch with a default value of 27:
  5108.  
  5109.       int n = 27;
  5110.  
  5111.       struct swiDesc swiTable [] =
  5112.       {
  5113.            { "newswitch", &n, SWI_NUMERIC|RADIX10  } ,
  5114.            { (void *) 0, (void *) 0, 0 }
  5115.       }
  5116.  
  5117.  
  5118.  8.3.3  The Command Table
  5119.  
  5120.  The command table, cmdTable, is similar to the switch table, swiTable, in
  5121.  its construction. Each "row" of the table consists of a structure that
  5122.  describes an editing function you want the editor to recognize. The last row
  5123.  must contain all null values. The simplest table allowed is the following:
  5124.  
  5125.       struct cmdDesc cmdTable[] =
  5126.       {
  5127.            { (void *) 0, (void *) 0, 0, 0 }
  5128.       }
  5129.  
  5130.  Usually you'll want to declare at least one new editing function. The
  5131.  structure type cmdDesc is defined in EXT.H. This structure contains the
  5132.  following four fields that make an editing function recognizable to the
  5133.  editor:
  5134.  
  5135.    1. A pointer to the name of the function, in ASCII format. This name could
  5136.       appear in assignments and macros.
  5137.  
  5138.    2. The address of the function itself. Give the function name but do not
  5139.       follow it with parentheses.
  5140.  
  5141.    3. A field used internally by the editor. Always declare this field as
  5142.       null.
  5143.  
  5144.    4. Flags indicating the type of the function. Function types are described
  5145.       below and define what type of argument the function will accept.
  5146.  
  5147.  Here is an example of a command table declaring a function that takes no
  5148.  arguments and a second function that takes either a linearg or a boxarg or
  5149.  can be entered without arguments:
  5150.  
  5151.       struct cmdDesc cmdTable[] =
  5152.       {
  5153.            { "newfun", newfun, 0, NOARG } ,
  5154.            { "fun2",  fun2,     0, LINEARG | BOXARG | NOARG } ,
  5155.            { (void *) 0, (void *) 0, 0, 0 }
  5156.       }
  5157.  
  5158.  In the fourth field of the command table, use one or more of the values
  5159.  described in Table 8.1 below.
  5160.  
  5161.  The first column of Table 8.1 contains a flag you can enter in the fourth
  5162.  field of cmdTable. The second column describes the associated behavior. The
  5163.  third column indicates which of the six data formats the editor uses to pass
  5164.  information. Your function determines the format at run time by testing the
  5165.  value of pArg->argType. Sections 8.4.3-8.4.8 give complete descriptions of
  5166.  these formats.
  5167.  
  5168.  Many of the descriptions below state that the editor responds by passing
  5169.  certain information. However, these responses only apply when the editor
  5170.  detects the associated condition. For example, the BOXARG flag controls the
  5171.  editor's behavior only when a boxarg is detected. However, KEEPMETA,
  5172.  MODIFIES, and CURSORFUNC apply regardless of argument type.
  5173.  
  5174.  Table 8.1  Meaning of cmdTable Flags
  5175. ╓┌─────────────┌──────────────────────────────────────────────────┌──────────╖
  5176.  cmdTable                                                         argType
  5177.  Flag          Behavior                                           Format
  5178.  
  5179.  KEEPMETA      Preserves the state of the Meta prefix, which is   Not
  5180.                normally reset upon completion of the function.    applicable
  5181.  
  5182.  MODIFIES      Prevents execution of the function when the        Not
  5183.                current file is No-Edit.                           applicable
  5184.  
  5185.  WINDOWFUNC    Does not cancel highlight resulting from a         Not
  5186.                previous command, such as Psearch. This flag is    applicable
  5187.                useful for window-movement functions.
  5188.  
  5189.  cmdTable                                                         argType
  5190.  Flag          Behavior                                           Format
  5191.  
  5192. 
  5193.  CURSORFUNC    Does not recognize or cancel Arg prefix. The       NOARG
  5194.                function is useful for helping define
  5195.                cursor-movement arguments, since it preserves the
  5196.                preexisting argument. Conflicts with all flags
  5197.                except KEEPMETA and MODIFIES.
  5198.  
  5199.  NOARG         Accepts absence of the Arg prefix. The editor      NOARG
  5200.                passes location of the cursor.
  5201.  
  5202.  NULLARG       Accepts Arg without an argument. The editor        NULLARG
  5203.                passes location of the cursor. Conflicts with
  5204.                NULLEOL and NULLEOW.
  5205.  
  5206.  NULLEOL       Accepts Arg without an argument. The editor        TEXTARG
  5207.                passes the string of text from the cursor
  5208.                position up to the end of the line. Conflicts
  5209.                with NULLARG and NULLEOW.
  5210.  cmdTable                                                         argType
  5211.  Flag          Behavior                                           Format
  5212.  
  5213.               with NULLARG and NULLEOW.
  5214.  
  5215.  NULLEOW       Accepts Arg without an argument. The editor        TEXTARG
  5216.                passes the string of text from the cursor
  5217.                position up to the next white space. Conflicts
  5218.                with NULLARG and NULLEOL.
  5219.  
  5220.  TEXTARG       Accepts a text argument that the user types in     TEXTARG
  5221.                directly.
  5222.  
  5223.  BOXSTR        Accepts a one-line box argument. The editor        TEXTARG
  5224.                passes the highlighted string as a text argument.
  5225.  
  5226.  LINEARG       Accepts a linearg. The editor passes location of   LINEARG
  5227.                first and last lines.
  5228.  
  5229.  BOXARG        Accepts a boxarg. The editor passes location of    BOXARG
  5230.                the four edges of the box.
  5231.  cmdTable                                                         argType
  5232.  Flag          Behavior                                           Format
  5233.  
  5234.               the four edges of the box.
  5235.  
  5236.  STREAMARG     Interprets any cursor-movement argument as a       STREAMARG
  5237.                stream of text. The stream may span more than one
  5238.                line. The editor passes location of beginning and
  5239.                ending points.
  5240.  
  5241.  NUMARG        Interprets a numeric text argument as a file       Any cursor-
  5242.                position exactly numarg lines down from the        movement
  5243.                cursor. This position and the cursor position      type
  5244.                then define a region in the file. (The two
  5245.                positions form the end points of the region.) Use
  5246.                this flag in conjunction with other
  5247.                cursor-movement-argument flags, especially
  5248.                LINEARG.
  5249.  
  5250.  MARKARG       Interprets a valid file-marker name as a file      Any cursor-
  5251.                position. This position and the cursor position    movement
  5252.  cmdTable                                                         argType
  5253.  Flag          Behavior                                           Format
  5254.  
  5255.               position. This position and the cursor position    movement
  5256.                then define a region in the file. (The two         type
  5257.                positions form the end points of the region.) Use
  5258.                this flag in conjunction with other
  5259.                cursor-movement-argument flags.
  5260.  
  5261.  
  5262.  The descriptions also refer to the passing of information to the function;
  5263.  you'll see how the function receives information in Section 8.3.5,
  5264.  "Defining the Editing Function."
  5265.  
  5266.  The flags are bit masks; each turns a specific bit within an unsigned
  5267.  integer. You can combine these bit masks with binary or ( | ). For example,
  5268.  you can specify a function that accepts a boxarg, linearg, or numarg as:
  5269.  
  5270.       BOXARG | LINEARG | NUMARG
  5271.  
  5272.  
  5273.  8.3.4  The WhenLoaded Function
  5274.  
  5275.  The function WhenLoaded takes no arguments and can return immediately.
  5276.  However, you must include the function because the editor expects it to be
  5277.  present. The simplest version of WhenLoaded is this:
  5278.  
  5279.       WhenLoaded()
  5280.       {
  5281.            return TRUE;
  5282.       }
  5283.  
  5284.  In Section 8.7, "Calling Library Functions," you'll learn how to call
  5285.  functions that assign keys to functions and print a message on the message
  5286.  line. These functions are often useful to call from within WhenLoaded.
  5287.  
  5288.  
  5289.  8.3.5  Defining the Editing Function
  5290.  
  5291.  This section describes how to define an editing function. The section also
  5292.  gives an overview of the information the editor passes to every function.
  5293.  Section 8.4, "Programming Your Function," gives specific information on how
  5294.  to interpret user-defined arguments.
  5295.  
  5296.  The editing function must be declared flagType pascal EXPORT. The flagType
  5297.  declaration indicates that your function returns one of two values: TRUE
  5298.  (nonzero) or FALSE (zero). (Returning a value is recommended, because once
  5299.  loaded, your function can be used within a macro. However, returning a value
  5300.  is not a strict requirement.) The pascal keyword indicates that your
  5301.  function uses the Pascal calling convention. Finally, your function must be
  5302.  of type EXPORT to be properly accessed through the editor's dynamic-link
  5303.  calls.
  5304.  
  5305.  The sample function Skel is declared as follows:
  5306.  
  5307.       #define TRUE  -1
  5308.       #define FALSE 0
  5309.  
  5310.       flagType pascal EXPORT Skel (argData, pArg, fMeta)
  5311.       unsigned int argData;
  5312.       ARG far *pArg;
  5313.       flagType fMeta;
  5314.       {
  5315.            return TRUE;
  5316.       }
  5317.  
  5318.  Replace the name Skel by the name of your function. This same name should
  5319.  appear in the second field of the cmdTable data structure.
  5320.  
  5321.  The parameter list is described below:
  5322.  
  5323.  Parameter                   Description
  5324.  
  5325.  argData                     The value of the keystroke used to invoke the
  5326.                              function. This parameter is generally not used.
  5327.  
  5328.  pArg                        A pointer to a structure that contains almost
  5329.                              all the information passed by the editor. This
  5330.                              structure is discussed in detail below.
  5331.  
  5332.  fMeta                       An integer that describes whether or not a Meta
  5333.                              prefix is present. This integer has value true
  5334.                              (nonzero) if Meta is present and value false (0)
  5335.                              if not.
  5336.  
  5337.  The parameter pArg points to a structure whose first member is argType. This
  5338.  variable contains one of six values: NOARG, TEXTARG, NULLARG, LINEARG,
  5339.  STREAMARG, or TEXTARG. Each of these values is defined in Section 8.3.3,
  5340.  "The Command Table." For example, you could test for the presence of a
  5341.  boxarg with the following code:
  5342.  
  5343.       if( pArg->argType == BOXARG )
  5344.       {
  5345.           /* take appropriate action for boxarg */
  5346.       }
  5347.  
  5348.  The rest of the structure consists of a union of smaller structures. The C
  5349.  union type is necessary here; it enables the editor to pass data in a
  5350.  variety of formats. The choice of format depends on what kind of argument
  5351.  the user defined.
  5352.  
  5353.  The declaration of the ARG structure is:
  5354.  
  5355.       struct argType
  5356.       {
  5357.           int   argType;
  5358.           union
  5359.           {
  5360.               struct  noargType      noarg;
  5361.               struct  textargType    textarg;
  5362.               struct  nullargType    nullarg;
  5363.               struct  lineargType    linearg;
  5364.               struct  streamargType  streamarg;
  5365.               struct  boxargType     boxarg;
  5366.           } arg;
  5367.       }
  5368.  
  5369.       typedef struct argType ARG;
  5370.  
  5371.  The editor returns argument information in one of the nested structures. The
  5372.  next section describes the contents of each of these structures and provides
  5373.  examples showing how to use each data format.
  5374.  
  5375.  
  5376.  8.4  Programming Your Function
  5377.  
  5378.  When you write an editing function, you have two basic tasks. First, you
  5379.  interpret information that the editor passes you. Second, you call the
  5380.  editor's lower-level functions to execute basic editing tasks.
  5381.  
  5382.  This section focuses on the most typical class of editing functions:
  5383.  functions that analyze the user-defined argument and modify only the current
  5384.  file. This class of functions, although huge in scope, depends on only a few
  5385.  lower-level functions. Once you learn how to write these functions, you can
  5386.  progress to more advanced operations──such as working on several files at
  5387.  once or reading keyboard input. Chapter 9 describes the whole range of
  5388.  low-level functions available.
  5389.  
  5390.  A typical editing function might execute the following sequence of steps:
  5391.  
  5392.    1. Get a handle to the current file by calling FileNameToHandle.
  5393.  
  5394.    2. Use information about the user-defined argument to initialize local
  5395.       variables.
  5396.  
  5397.    3. Process the argument. Modify the current file by calling GetLine and
  5398.       Putline.
  5399.  
  5400.    4. Return TRUE or FALSE.
  5401.  
  5402.  The order above is recommended, but you do not have to follow it strictly.
  5403.  You can perform Step 2 before Step 1. However, you must get a handle to the
  5404.  current file before you can modify it.
  5405.  
  5406.  Sections 8.4.1-8.4.9 discuss each step.
  5407.  
  5408.  
  5409.  8.4.1  Getting a File Handle
  5410.  
  5411.  The Microsoft Editor has its own file system. A "file system" is a group of
  5412.  integrated structures and function calls for modifying files. The editor's
  5413.  file system is not compatible with that of the C library.
  5414.  
  5415.  The editor has its own file-handle type, PFILE. This type, along with other
  5416.  types needed for extensions, is defined in the include file EXT.H. For
  5417.  example, you can create a file handle pFile with the declaration:
  5418.  
  5419.       PFILE   pFile;
  5420.  
  5421.  Usually, your editing work involves the current file; that is, the file that
  5422.  now appears in the current editing window. Because the current file is
  5423.  already open for editing, you do not need to open or initialize the current
  5424.  file in any way. You simply assign the existing file handle to one of your
  5425.  own variables.
  5426.  
  5427.  The FileNameToHandle function returns a handle to a file that is already
  5428.  open for editing. (More than one file may be open for editing, particularly
  5429.  if the user has worked on more than one file during the editing session.)
  5430.  
  5431.  To get a handle to the current file, simply pass two empty strings to the
  5432.  function:
  5433.  
  5434.       pFile = FileNameToHandle( "", "" );
  5435.  
  5436.  The first argument to FileNameToHandle takes a file name. The second
  5437.  argument takes a "short name," which is a base name the editor searches for
  5438.  in its list of open files. If the first string is empty, the function
  5439.  returns a handle to the current file.
  5440.  
  5441.  The AddFile function is the other function that returns a file handle.
  5442.  AddFile causes the editor to open a file for editing──either a new file or a
  5443.  file that exists on disk but is not yet open for editing.
  5444.  
  5445.  See Chapter 9 for complete information on each function.
  5446.  
  5447.  
  5448.  8.4.2  Interpreting the User-Defined Argument
  5449.  
  5450.  After getting a handle to the current file, you need to interpret the
  5451.  user-defined argument.
  5452.  
  5453.  You determine the type of the user's argument by testing the value of
  5454.  pArg->argType. If you declare a function that takes only one type of
  5455.  argument, testing pArg->argType is not necessary. You know in advance what
  5456.  kind of argument was given, since the editor rejects invalid arguments.
  5457.  Table 8.1, "Meaning of cmdTable Flags," explains how to declare what
  5458.  arguments your function accepts.
  5459.  
  5460.  If your function accepts more than one kind of argument, you can use either
  5461.  if-then-else blocks or switch-case statements to evaluate the user's
  5462.  argument:
  5463.  
  5464.       switch( pArg->argType )
  5465.       {
  5466.          case( NULLARG ):    /* Take action for empty arg */
  5467.          .
  5468.          .
  5469.          .
  5470.          case( BOXARG ):     /* Take action for boxarg */
  5471.          .
  5472.          .
  5473.          .
  5474.          case( LINEARG ):   /* Take action for linearg */
  5475.          .
  5476.          .
  5477.          .
  5478.       }
  5479.  
  5480.  The value of pArg->argType is always equal to one of six values:
  5481.  
  5482.    ■  NOARG
  5483.    ■  NULLARG
  5484.    ■  TEXTARG
  5485.    ■  LINEARG
  5486.    ■  STREAMARG
  5487.    ■  BOXARG
  5488.  
  5489.  The next six sections consider each of these argument types in detail,
  5490.  giving declarations and examples for each.
  5491.  
  5492.  
  5493.  8.4.3  The NOARG Type
  5494.  
  5495.  When pArg->argType is equal to NOARG, the editor passes information in the
  5496.  pArg->arg.noarg structure, which has the format:
  5497.  
  5498.       struct  noargType
  5499.       {
  5500.           LINE    y;   /* Line number of cursor */
  5501.           COL     x;   /* Column of cursor */
  5502.       };
  5503.  
  5504.  Description
  5505.  
  5506.  The NOARG type indicates that the user did not invoke the Arg prefix, and
  5507.  therefore did not enter an argument. The cursor coordinates are zero-based;
  5508.  in other words, the start of the file is position (0,0).
  5509.  
  5510.  This argument type is possible if you declared your function with the flag
  5511.  NOARG or CURSORFUNC.
  5512.  
  5513.  Example
  5514.  
  5515.  The following example initializes the coordinates (yCur, xCur) with the row
  5516.  and column of the cursor position:
  5517.  
  5518.       COL   xCur;
  5519.       LINE  yCur;
  5520.       .
  5521.       .
  5522.       .
  5523.       if( pArg->argType == NOARG )
  5524.       {
  5525.            xCur = pArg->arg.noarg.x;
  5526.            yCur = pArg->arg.noarg.y;
  5527.       }
  5528.  
  5529.  
  5530.  8.4.4  The NULLARG Type
  5531.  
  5532.  When pArg->argType is equal to NULLARG, the editor passes information in the
  5533.  pArg->arg.nullarg structure, which has the format:
  5534.  
  5535.       struct  nullargType
  5536.       {
  5537.           int     cArg;   /* Number of times Arg was invoked */
  5538.           LINE    y;      /* Line number of cursor */
  5539.           COL     x;      /* Column of cursor */
  5540.       };
  5541.  
  5542.  Description
  5543.  
  5544.  The NULLARG type indicates that the user invoked the Arg prefix but did not
  5545.  enter an argument. The argument is therefore empty, or null. The cursor
  5546.  coordinates are zero-based; in other words, the start of the file is
  5547.  position (0,0).
  5548.  
  5549.  This argument type is possible if you declared your function with the flag
  5550.  NULLARG.
  5551.  
  5552.  Example
  5553.  
  5554.  The following example initializes the coordinates (yCur, xCur) with the row
  5555.  and column of the cursor position, and sets cArg equal to the number of
  5556.  times that the user invoked the Arg prefix:
  5557.  
  5558.       COL   xCur;
  5559.       LINE  yCur;
  5560.       int   cArg;
  5561.       .
  5562.       .
  5563.       .
  5564.       if( pArg->argType == NULLARG )
  5565.       {
  5566.            xCur = pArg->arg.nullarg.x;
  5567.            yCur = pArg->arg.nullarg.y;
  5568.            cArg = pArg->arg.nullarg.cArg;
  5569.       }
  5570.  
  5571.  
  5572.  8.4.5  The TEXTARG Type
  5573.  
  5574.  When pArg->argType is equal to TEXTARG, the editor passes information in the
  5575.  pArg->arg.textarg structure, which has the format:
  5576.  
  5577.       struct  textargType
  5578.       {
  5579.           int     cArg;   /* Number of times Arg was invoked */
  5580.           LINE    y;      /* Line number of cursor */
  5581.           COL     x;      /* Column of cursor */
  5582.           char far *pText /* Pointer to textarg string */
  5583.       };
  5584.  
  5585.  Description
  5586.  
  5587.  The TEXTARG type indicates that the user's argument defined a string of
  5588.  text. The cursor coordinates are zero-based, and pText points to a
  5589.  null-terminated string.
  5590.  
  5591.  This argument type is possible if you declared your function with the flag
  5592.  TEXTARG, BOXSTR, NULLEOL, or NULLEOW. Each of these argument types selects a
  5593.  string of text in a different way (for example, BOXSTR uses a
  5594.  cursor-movement argument); however, the format used for all these cases is
  5595.  the same.
  5596.  
  5597.  Example
  5598.  
  5599.  The following example initializes the coordinates (yCur, xCur) with the row
  5600.  and column of the cursor position, and sets cArg equal to the number of
  5601.  times that the user invoked the Arg prefix. Finally, the user-defined
  5602.  textarg is copied into the character array buf.
  5603.  
  5604.       COL   xCur;
  5605.       LINE  yCur;
  5606.       int   cArg;
  5607.       char  buf[BUFLEN]; .
  5608.       .
  5609.       .
  5610.       if( pArg->argType == TEXTARG )
  5611.       {
  5612.            xCur = pArg->arg.textarg.x;
  5613.            yCur = pArg->arg.textarg.y;
  5614.            cArg = pArg->arg.textarg.cArg;
  5615.            strcpy (buf, pArg->arg.textarg.pText);
  5616.       }
  5617.  
  5618.  
  5619.  8.4.6  The LINEARG Type
  5620.  
  5621.  When pArg->argType is equal to LINEARG, the editor passes information in the
  5622.  pArg->arg.linearg structure, which has the format:
  5623.  
  5624.       struct  lineargType
  5625.       {
  5626.           int     cArg;   /* Number of times Arg was invoked */
  5627.           LINE    yStart; /* Line number of first line */
  5628.           LINE    yEnd;   /* Line number of last line */
  5629.       };
  5630.  
  5631.  Description
  5632.  
  5633.  The LINEARG type indicates that the user defined a range of lines by
  5634.  aligning the cursor and arg position in the same column but different rows.
  5635.  The range of lines includes yStart and yEnd, as well as all lines in
  5636.  between. Line numbers are zero-based, so that line 0 is the first line in
  5637.  the file.
  5638.  
  5639.  This argument type is possible if you declared your function with the flag
  5640.  LINEARG.
  5641.  
  5642.  Example
  5643.  
  5644.  The following example sets cArg equal to the number of times that the user
  5645.  invoked the Arg prefix, and sets yStart and yEnd equal to the line numbers
  5646.  of the first and last lines:
  5647.  
  5648.       int   cArg;
  5649.       LINE  yStart;
  5650.       LINE  yEnd;
  5651.       .
  5652.       .
  5653.       .
  5654.       if( pArg->argType == LINEARG )
  5655.       {
  5656.            cArg   = pArg->arg.linearg.cArg;
  5657.            yStart = pArg->arg.linearg.yStart;
  5658.            yEnd   = pArg->arg.linearg.yEnd;
  5659.       }
  5660.  
  5661.  
  5662.  8.4.7  The STREAMARG Type
  5663.  
  5664.  When pArg->argType is equal to STREAMARG, the editor passes information in
  5665.  the pArg->arg.linearg structure, which has the format:
  5666.  
  5667.       struct streamargType
  5668.       {
  5669.           int   cArg;     /* Number of times Arg was invoked */
  5670.           LINE  yStart;   /* Coordinates of first byte in */
  5671.           COL   xStart;   /*   the stream of text */
  5672.           LINE  yEnd;     /* Coordinates of byte just after */
  5673.           COL   xEnd;     /*   the last byte of the stream */
  5674.       };
  5675.  
  5676.  Description
  5677.  
  5678.  The STREAMARG type indicates that the user defined a cursor-movement
  5679.  argument, which the function interprets as a stream of text rather than as a
  5680.  boxarg or linearg. The stream of text includes yStart and xStart but not
  5681.  yEnd and xEnd, which gives the location of the character just to the right
  5682.  of the last character in the stream.
  5683.  
  5684.  This argument type is possible if you declared your function with the flag
  5685.  STREAMARG.
  5686.  
  5687.  Example
  5688.  
  5689.  The following example sets cArg equal to the number of times that the user
  5690.  invoked the Arg prefix. Then the example initializes variables for the
  5691.  beginning and end of the stream.
  5692.  
  5693.       int   cArg;
  5694.       LINE  yStart;
  5695.       COL   xStart;
  5696.       LINE  yEnd;
  5697.       COL   xEnd;
  5698.       .
  5699.       .
  5700.       .
  5701.       if( pArg-argType == LINEARG )
  5702.       {
  5703.            cArg   = pArg->arg.streamarg.cArg;
  5704.            yStart = pArg->arg.streamarg.yStart;
  5705.            xStart = pArg->arg.streamarg.xStart;
  5706.            yEnd   = pArg->arg.streamarg.yEnd;
  5707.            xEnd   = pArg->arg.streamarg.xEnd;
  5708.       }
  5709.  
  5710.  
  5711.  8.4.8  The BOXARG Type
  5712.  
  5713.  When pArg->argType is equal to BOXARG, the editor passes information in the
  5714.  pArg->arg.boxarg structure, which has the format:
  5715.  
  5716.       struct  boxargType
  5717.       {
  5718.           int     cArg;        /* Number of times Arg was invoked */
  5719.           LINE    yTop;        /* Line number of first line */
  5720.           LINE    yBottom;     /* Line number of last line */
  5721.           COL     xLeft;       /* Leftmost column in box */
  5722.           COL     xRight;      /* Rightmost column in box */
  5723.       };
  5724.  
  5725.  Description
  5726.  
  5727.  The BOXARG type indicates that the user defined a rectangular area on the
  5728.  screen. Row and column numbers are zero-based; in other words, the start of
  5729.  the file is position (0,0). The lines and column edges, yTop, yBottom,
  5730.  xLeft, and xRight, are all included in the area itself.
  5731.  
  5732.  This argument type is possible if you declared your function with the flag
  5733.  BOXARG.
  5734.  
  5735.  Example
  5736.  
  5737.  The following example sets cArg equal to the number of times that the user
  5738.  invoked the Arg prefix. Then the example initializes variables for the four
  5739.  borders of the box.
  5740.  
  5741.       int   cArg;
  5742.       LINE  yTop;
  5743.       LINE  yBottom;
  5744.       COL   xLeft;
  5745.       COL   xRight;
  5746.       .
  5747.       .
  5748.       .
  5749.       if( pArg-argType == LINEARG )
  5750.       {
  5751.            cArg    = pArg->arg.boxarg.cArg;
  5752.            yTop    = pArg->arg.boxarg.yTop;
  5753.            yBottom = pArg->arg.boxarg.yBottom;
  5754.            xLeft   = pArg->arg.boxarg.xLeft;
  5755.            xRight  = pArg->arg.boxarg.xRight;
  5756.       }
  5757.  
  5758.  
  5759.  8.4.9  Modifying the Current File
  5760.  
  5761.  This section deals with the core of an editing function──reading and
  5762.  altering the file.
  5763.  
  5764.  After you have analyzed the user's argument and got a handle to the current
  5765.  file, you are ready to work on the file. At this stage, two functions are
  5766.  most relevant: GetLine and Putline.
  5767.  
  5768.  The GetLine function reads one line from the file:
  5769.  
  5770.       len = GetLine (yStart, buffer, pFile);
  5771.  
  5772.  The first argument is a line number, the second a pointer to a buffer, and
  5773.  the third a file handle. With extension functions, line numbers are
  5774.  consistently indexed (they are all zero-based so that the first line in the
  5775.  file is numbered 0), so you can use a line number previously passed by the
  5776.  editor. The buffer is a previously declared string of characters. GetLine
  5777.  fills this string with characters and a terminating null byte. Since you are
  5778.  working on the current file, pass the file handle you received when you
  5779.  called FileNameToHandle.
  5780.  
  5781.  Finally, GetLine returns the length of the line copied.
  5782.  
  5783.  The PutLine function is the flip side of GetLine and takes almost exactly
  5784.  the same arguments:
  5785.  
  5786.       PutLine (yStart, buffer, pFile);
  5787.  
  5788.  The first argument is a zero-based line number. The second argument points
  5789.  to a buffer containing text that you want to write to the file. The third
  5790.  argument is a file handle. Again, you can use a handle to the current file.
  5791.  
  5792.  Both GetLine and PutLine deal with null-terminated strings. You should not
  5793.  add a new-line character to the string you pass to PutLine. The editor adds
  5794.  or strips new-line characters as appropriate.
  5795.  
  5796.  The following section of code demonstrates the use of GetLine and PutLine in
  5797.  a loop that numbers the lines yStart to yEnd:
  5798.  
  5799.       for( curLine = yStart, i = 1; curLine <= yEnd; curLine++, i++ )
  5800.       {
  5801.           GetLine( curLine, buffer, pFile ); /* Get line */
  5802.  
  5803.           itoa( i, digits, 10 );             /* Convert i to digit string */
  5804.           strcat( digits, ". " );
  5805.           strcat( digits, buffer );          /* Prefix buffer with digits */
  5806.  
  5807.           PutLine( curLine, digits, pFile ); /* Put line back */
  5808.       }
  5809.  
  5810.  
  5811.  8.5  Compiling and Linking
  5812.  
  5813.  After writing your C module, you're ready to compile and link. The
  5814.  procedures for compiling and linking in protected mode are slightly
  5815.  different from compiling and linking in real mode. Sections 8.5.1 and
  5816.  8.5.2 consider both environments.
  5817.  
  5818.  ───────────────────────────────────────────────────────────────────────────
  5819.  NOTE
  5820.     If you created C-extension modules for Version 1.0 of the Microsoft
  5821.     Editor, you do not have to recompile or relink your C extensions.
  5822.     However, if you do recompile your extensions, make sure that you use the
  5823.     new version of the EXT.H include file.
  5824.  ───────────────────────────────────────────────────────────────────────────
  5825.  
  5826.  
  5827.  8.5.1  Compiling and Linking for Real Mode
  5828.  
  5829.  To create a C extension for real mode (DOS or the OS/2 3.x compability box),
  5830.  follow these steps:
  5831.  
  5832.    1. Compile with command line options /Gs and /Asfu. These mandatory
  5833.       options establish the proper memory model and calling convention. (If
  5834.       you are programming in the Microsoft Macro Assembler (MASM), use near
  5835.       code and far data segments, in which SS is not assumed equal to DS.)
  5836.       For example:
  5837.  
  5838.           CL /c /Gs /Asfu myext.c
  5839.  
  5840.    2. Link the file EXTHDR.OBJ to your extension. The EXTHDR.OBJ file must be
  5841.       the first object module on the command line:
  5842.  
  5843.           CL /AC /Femyext.mxt exthdr myext
  5844.  
  5845.       Use the /AC option if your extension calls C library functions. The /AC
  5846.       option directs the linker to use the compact-model library.
  5847.  
  5848.  ───────────────────────────────────────────────────────────────────────────
  5849.  IMPORTANT
  5850.     Strictly speaking, the .MXT file extension is not required; the editor
  5851.     can load modules with any file extension name. However, using a file
  5852.     extension of .MXT is strongly recommended so that your extensions are not
  5853.     confused with true executable (.EXE) files, which can be run directly
  5854.     from DOS. Trying to execute an extension as if it were an .EXE file will
  5855.     bring the system to its knees.
  5856.  ───────────────────────────────────────────────────────────────────────────
  5857.  
  5858.  
  5859.  8.5.2  Compiling and Linking for Protected Mode
  5860.  
  5861.  To create a C extension for protected mode, follow these steps:
  5862.  
  5863.    1. Compile with command-line options /Gs and /Asfu. These mandatory
  5864.       options establish the proper memory model and calling convention. (If
  5865.       you are programming in MASM, use near code and far data segments in
  5866.       which SS is not assumed equal to DS.) For example:
  5867.  
  5868.            CL /c /Gs /Asfu myext.c
  5869.  
  5870.       The same object module can be used for both real and protected mode, so
  5871.       you do not have to recompile if you want an extension for both modes.
  5872.       However, you do have to relink, as explained below.
  5873.  
  5874.    2. Link with the file EXTHDRP.OBJ to your extension along with a
  5875.       module-definitions file. The EXTHDRP.OBJ file must be the first object
  5876.       module on the command line:
  5877.  
  5878.            LINK /NOI exthdrp myext, myext.dll,, doscalls, myext.def;
  5879.  
  5880.       If your extension calls C library functions, link in the compact-model
  5881.       library. Link with the /NOI option, since the OS/2 loader is
  5882.       case-sensitive.
  5883.  
  5884.  The file MYEXT.DEF can be created by copying the file SKEL.DEF (provided
  5885.  with the editor). No modification is necessary. You can also link with
  5886.  SKEL.DEF itself.
  5887.  
  5888.  
  5889.  8.5.3  Loading Your Extension
  5890.  
  5891.  Compiling and linking your module with the correct options produces an .MXT
  5892.  file (for real mode) or a .DLL file (for OS/2 protected mode) the editor can
  5893.  load and execute on demand.
  5894.  
  5895.  To use a real-mode extension, set the load switch with the full path name
  5896.  for your C extension. For example, after you have created the file
  5897.  MYEXT.MXT, you could place the following statement in the TOOLS.INI file:
  5898.  
  5899.       load:path\myext.mxt
  5900.  
  5901.  in which path is the location of the extension. The editor responds by
  5902.  automatically loading your C-extension module into memory upon start-up. You
  5903.  can also set the load switch with the Assign command.
  5904.  
  5905.  ───────────────────────────────────────────────────────────────────────────
  5906.  NOTE
  5907.     The load switch can be assigned a number of times, each assignment
  5908.     causing the editor to load another extension. All of the extensions
  5909.     reside in memory together; no extension is removed from memory until the
  5910.     editor terminates.
  5911.  ───────────────────────────────────────────────────────────────────────────
  5912.  
  5913.  The load switch can accept an environment variable as described in Section
  5914.  7.3, "Special Syntax for Text Switches."
  5915.  
  5916.  To use a protected-mode extension, place your .DLL file in a directory
  5917.  specified in the LIBPATH variable. You can set the load switch in the same
  5918.  way described above; however, when running under protected mode, the editor
  5919.  ignores the path and the file extension. Therefore, for protected-mode-only
  5920.  extensions, the only declaration you need is the following:
  5921.  
  5922.       load:myext
  5923.  
  5924.  To load an extension for both real and protected modes, follow these steps:
  5925.  
  5926.    1. Compile the source file once.
  5927.  
  5928.    2. Link two times, once for real mode and once for protected mode.
  5929.  
  5930.    3. Place the protected-mode module (a .DLL file) in a LIBPATH directory.
  5931.  
  5932.    4. Use the real-mode load setting. The editor uses the full text of the
  5933.       switch setting when in real mode, but ignores the path and file
  5934.       extension when in protected mode.
  5935.  
  5936.  Whenever the editor successfully loads an extension, it checks the TOOLS.INI
  5937.  file for the tag
  5938.  
  5939.       [M-mxt]
  5940.  
  5941.  in which mxt is the base name of the extension. If the tag exists, the
  5942.  editor recognizes the settings immediately following the tag.
  5943.  
  5944.  Special Considerations for OS/2
  5945.  
  5946.  Under OS/2 Version 1.1 and later, protected-mode editor extensions may have
  5947.  file extensions other than .DLL and may be placed in directories other than
  5948.  those specified in LIBPATH. The editor searches for the extensions specified
  5949.  in the load statement in the following sequence:
  5950.  
  5951.    1. If an environment variable or a full path is specified, the editor
  5952.       searches the appropriate directories, as in the following examples:
  5953.  
  5954.           load:$LIB:yourext.mxt
  5955.  
  5956.           load:drive:\dir\ yourext.mxt
  5957.  
  5958.       The editor searches the current directory if there is no environment
  5959.       variable or full-path specification.
  5960.  
  5961.    2. If the desired extension is not found, and its name is only a base name
  5962.       without a file extension, the editor appends the appropriate file
  5963.       extension (.MXT for real mode, .PXT for protected mode) and repeats
  5964.       Step 1.
  5965.  
  5966.    3. If the editor extension still cannot be located, the editor searches
  5967.       for basename.DLL in the directories specified in LIBPATH, where
  5968.       basename is the base name of the extension.
  5969.  
  5970.  In real mode (DOS or the OS/2 3.x compatibility box), only Steps 1 and 2 are
  5971.  preformed. Under OS/2 Version 1.0, only Step 3 is performed.
  5972.  
  5973.  Within TOOLS.INI tag declarations, only the base name is significant, not
  5974.  the file extension. For example, the statements following
  5975.  
  5976.       [M-YOUREXT]
  5977.  
  5978.  would always be used, regardless of the file extension that was used to
  5979.  locate YOUREXT.
  5980.  
  5981.  The "autoload" feature automatically loads extensions without a load
  5982.  statement in TOOLS.INI. The editor searches the directories in the PATH
  5983.  environment variable for file names with the following patterns, and loads
  5984.  as many of them as it finds:
  5985.  
  5986.  Operating System            Extension Autoloaded
  5987.  
  5988.  DOS or OS/2 real mode       M*.MXT
  5989.  
  5990.  OS/2 protected mode         M*.PXT
  5991.  
  5992.  The file names for the on-line Help extensions supplied with this version of
  5993.  the Microsoft Editor have the correct form for autoloading. Therefore, they
  5994.  only need to be placed in any directory in the PATH environment variable;
  5995.  you do not have to add a load statement to TOOLS.INI.
  5996.  
  5997.  Autoloading occurs after TOOLS.INI has been read, so any extension-specific
  5998.  sections still take effect.
  5999.  
  6000.  ───────────────────────────────────────────────────────────────────────────
  6001.  NOTE
  6002.     Autoloading does not work under OS/2 Version 1.0.
  6003.  ───────────────────────────────────────────────────────────────────────────
  6004.  
  6005.  You can load extensions in both real and protected mode by using a single
  6006.  load statement of the following form:
  6007.  
  6008.       load:$PATH:basename
  6009.  
  6010.  The extensions must have the same basename and the default extension (.MXT
  6011.  for DOS or OS/2 real mode, .PXT for OS/2 protected mode) for the appropriate
  6012.  operating system. The extensions can go anywhere in the specified path.
  6013.  Since the file extension is omitted in this load statement, the editor will
  6014.  append the appropriate extension to basename (be sure the name has no
  6015.  trailing period) and load the correct file.
  6016.  
  6017.  You can also give your extension a name of the form M*.MXT or M*.PXT
  6018.  (according to the operating system). The extension will be autoloaded
  6019.  without requiring a load statement in TOOLS.INI. It is also possible to
  6020.  specify the editor extension for one mode in a load statement, while giving
  6021.  the extension for the other mode an autoload default name.
  6022.  
  6023.  
  6024.  8.6  A C-Extension Sample Program
  6025.  
  6026.  The following C-extension sample program features a function named tglcase.
  6027.  This function converts uppercase letters to lowercase, and lowercase letters
  6028.  to uppercase. It acts on the file according to the argument type:
  6029.  
  6030.  Argument                    Effect
  6031.  
  6032.  NOARG                       Acts on entire current line.
  6033.  
  6034.  NULLARG                     Acts on current line, from the cursor position
  6035.                              (inclusive) up to the end of the line.
  6036.  
  6037.  BOXARG                      Acts on the highlighted region.
  6038.  
  6039.  LINEARG                     Acts on the highlighted region (containing a
  6040.                              range of complete lines).
  6041.  
  6042.  TEXTARG                     Argument not accepted.
  6043.  
  6044.  STREAMARG                   Not recognized. The argument is treated as
  6045.                              BOXARG or LINEARG.
  6046.  
  6047.  In each case, the function responds to the argument by initializing the
  6048.  limits of an imaginary box. In the case of a LINEARG, the column limits are
  6049.  set at 0 and BUFLEN (the maximum length of a text line in M). NOARG and
  6050.  NULLARG are handled in a similar fashion. Once the limits of the area are
  6051.  initialized, one small section of code does the actual work. This section
  6052.  calls GetLine and PutLine repeatedly to read and replace lines in the
  6053.  current file.
  6054.  
  6055.  This extension calls C library functions. To successfully link this
  6056.  extension, include the compact-model library.
  6057.  
  6058.       /*** tglcase.c - case toggling editor extension
  6059.       */
  6060.       #define ID      " tglcase ver 1.00 "##__DATE__##" "##__TIME__
  6061.       #define NULL    ((void *) 0)
  6062.  
  6063.       #include <stdlib.h>                     /* min macro definition */
  6064.       #include <string.h>                     /* prototypes for string fcns*/
  6065.       #include "ext.h"
  6066.       /*
  6067.       ** Internal function prototypes
  6068.       */
  6069.       void     pascal          id         (char *);
  6070.       void     WhenLoaded (void);
  6071.       flagType pascal EXPORT tglcase    (unsigned int, ARG far *, flagType);
  6072.  
  6073.       /********************************************************************
  6074.       **
  6075.       ** tglcase
  6076.       ** Toggle the case of alphabetics contained within the selected argument
  6077.       **
  6078.       **  NOARG       - Toggle case of entire current line
  6079.       **  NULLARG     - Toggle case of current line from cursor to end of line
  6080.       **  LINEARG     - Toggle case of range of lines
  6081.       **  BOXARG      - Toggle case of characters with the selected box
  6082.       **  NUMARG      - Converted to LINEARG before extension is called
  6083.       **  MARKARG     - Converted to Appropriate ARG form above before extensi
  6084.       **                called
  6085.       **
  6086.       **  STREAMARG   - Not Allowed; treated as BOXARG
  6087.       **  TEXTARG     - Not Allowed
  6088.       **
  6089.       */
  6090.       flagType pascal EXTERNAL tglcase (argData, pArg, fMeta)
  6091.       unsigned int argData;                   /* keystroke invoked with */
  6092.       ARG far *pArg;                          /* argument data */
  6093.       flagType fMeta;                         /* indicates preceded by meta */
  6094.       {
  6095.           PFILE   pFile;                  /* file handle of current file */
  6096.           COL     xStart;                 /* left border of arg area */
  6097.           LINE    yStart;                 /* starting line of arg area */
  6098.           COL     xEnd;                   /* right border of arg area */
  6099.           LINE    yEnd;                   /* ending line of arg area */
  6100.           int     cbLine;                 /* byte count of current line */
  6101.           COL     xCur;                   /* current column being toggled */
  6102.           char    buf[BUFLEN];            /* buffer for line being toggled*/
  6103.           register char c;                /* character being analyzed */
  6104.  
  6105.           id( "" );
  6106.           pFile = FileNameToHandle( "", NULL );
  6107.           switch( pArg->argType )
  6108.           {
  6109.       /*
  6110.       ** For the various argument types, set up a box
  6111.       ** (xStart, yStart) - (xEnd, yEnd)
  6112.       ** over which the case conversion code below can operate
  6113.       */
  6114.               case NOARG:                         /* case switch entire line *
  6115.                   xStart = 0;
  6116.                   xEnd = BUFLEN;
  6117.                   yStart = yEnd = pArg->arg.noarg.y;
  6118.                   break;
  6119.  
  6120.               case NULLARG:                       /* case switch to EOL */
  6121.                   xStart = pArg->arg.nullarg.x;
  6122.                   xEnd = BUFLEN;
  6123.                   yStart = yEnd = pArg->arg.nullarg.y;
  6124.                   break;
  6125.  
  6126.               case LINEARG:                       /* case switch line range */
  6127.                   xStart = 0;
  6128.                   xEnd = BUFLEN;
  6129.                   yStart = pArg->arg.linearg.yStart;
  6130.                   yEnd = pArg->arg.linearg.yEnd;
  6131.                   break;
  6132.  
  6133.               case BOXARG:                        /* case switch box */
  6134.                   xStart = pArg->arg.boxarg.xLeft;
  6135.                   xEnd   = pArg->arg.boxarg.xRight;
  6136.                   yStart = pArg->arg.boxarg.yTop;
  6137.                   yEnd   = pArg->arg.boxarg.yBottom;
  6138.                   break;
  6139.           }
  6140.       /*
  6141.       ** Within range of lines yStart to yEnd, get each line, and if non-null,
  6142.       ** check each character. If alphabetic, replace with its case-converted
  6143.       ** value. After all characters have been checked, replace line in file.
  6144.       */
  6145.           while( yStart <= yEnd )
  6146.           {
  6147.            if( cbLine = GetLine( yStart, buf, pFile ))
  6148.               {
  6149.                for( xCur = xStart; (xCur <= min( cbLine, xEnd )); xCur++ )
  6150.                   {
  6151.                       c = buf[xCur];
  6152.                 if( (c >= 'A' ) && (c <= 'Z'))
  6153.                           c += 'a'-'A';
  6154.                 else if( (c >= 'a' ) && (c <= 'z'))
  6155.                           c += 'A'-'a';
  6156.                       buf[xCur] = c;
  6157.                   }
  6158.                PutLine( yStart++, buf, pFile );
  6159.               }
  6160.           }
  6161.           return 1;
  6162.       }
  6163.       /***********************************************************************
  6164.       **
  6165.       ** WhenLoaded
  6166.       ** Executed when extension gets loaded. Identify self & assign default
  6167.       ** keystroke.
  6168.       **
  6169.       ** Entry:
  6170.       **  none
  6171.       */
  6172.       void WhenLoaded ()
  6173.       {
  6174.       id("case conversion extension:");
  6175.       SetKey ("tglcase",  "alt+c");
  6176.       } /* end WhenLoaded */
  6177.  
  6178.       /***********************************************************************
  6179.       **
  6180.       ** id
  6181.       ** identify ourselves, along with any passed informative message
  6182.       **
  6183.       ** Entry:
  6184.       **  pszMsg      = Pointer to asciiz message to which the extension name
  6185.       **                and version are appended prior to display
  6186.       */
  6187.       void pascal id (pszFcn)
  6188.       char *pszFcn;                                   /* function name */
  6189.       {
  6190.           char    buf[80];                                /* message buffer */
  6191.  
  6192.           strcpy (buf,pszFcn);                    /* start with message */
  6193.           strcat (buf,ID);                                /* append version */
  6194.           DoMessage (buf);
  6195.       } /* end id */
  6196.  
  6197.  
  6198.       /***********************************************************************
  6199.       **
  6200.       ** Switch communication table to the editor
  6201.       ** This extension defines no switches
  6202.       */
  6203.       struct swiDesc  swiTable[] =
  6204.       {
  6205.           { NULL, NULL, 0 }
  6206.       };
  6207.  
  6208.       /***********************************************************************
  6209.       **
  6210.       ** Command communication table to the editor
  6211.       ** Defines the name, location and acceptable argument types
  6212.       */
  6213.       struct cmdDesc  cmdTable[] =
  6214.       {
  6215.           {"tglcase",tglcase,0, KEEPMETA | NOARG | BOXARG | NULLARG | LINEARG
  6216.       |
  6217.                                 MARKARG | NUMARG | MODIFIES},
  6218.           { NULL, NULL, 0, 0 }
  6219.       };
  6220.  
  6221.  
  6222.  8.7  Calling Library Functions
  6223.  
  6224.  This section lists compatible C library functions as well as low-level
  6225.  extension functions you can call.
  6226.  
  6227.  You should call the editor's own low-level functions in preference to
  6228.  functions in the standard C library whenever possible. Using the editor's
  6229.  low-level functions guarantees that all file operations are compatible with
  6230.  the editor.
  6231.  
  6232.  Furthermore, not all functions in the C library are compatible with
  6233.  extensions. The following list summarizes which functions from the
  6234.  compact-model library should work when called by a C-extension module. Link
  6235.  with a compact-memory-model C library if you want to call these functions.
  6236.  The list refers to the function categories from Chapter 4 of the Microsoft C
  6237.  Optimizing Compiler Run-Time Library Reference (Version 4.0 or later).
  6238.  
  6239.  Note that floating-point arithmetic is not supported because it involves
  6240.  calls to low-level, floating-point math routines.
  6241.  
  6242. ╓┌───────────────────────────┌───────────────────────────────────────────────╖
  6243.  Category                    Compatible Functions
  6244.  
  6245.  Buffer manipulation         All functions can be called.
  6246.  
  6247.  Character                   All functions can be called.
  6248.  classification and
  6249.  conversion
  6250.  
  6251.  Data conversion             All functions can be called except strtod.
  6252.  
  6253.  Directory control           All functions can be called except getcwd.
  6254.  
  6255.  Graphics                    None.
  6256.  
  6257.  File handling               All functions can be called.
  6258.  
  6259.  Stream routines             None.
  6260.  Category                    Compatible Functions
  6261.  
  6262. Stream routines             None.
  6263.  
  6264.  Low-level I/O routines      None.
  6265.  
  6266.  Console and port I/O        All functions can be called except cgets,
  6267.                              cprintf, and cscanf.
  6268.  
  6269.  Math                        None.
  6270.  
  6271.  Memory allocation           None.
  6272.  
  6273.  Process control             None.
  6274.  
  6275.  Searching and sorting       All functions can be called except qsort.
  6276.  
  6277.  String manipulation         All functions can be called except strdup.
  6278.  
  6279.  BIOS interface              All functions can be called.
  6280.  
  6281.  Category                    Compatible Functions
  6282.  
  6283. 
  6284.  MS-DOS interface            All functions can be called except int86 and
  6285.                              int86x.
  6286.  
  6287.  Time                        None.
  6288.  
  6289.  Miscellaneous               All functions can be called except assert,
  6290.                              getenv, perror, putenv, and _searchenv.
  6291.  
  6292.  
  6293.  Table 8.2 lists the low-level extension functions by category. Your
  6294.  extension can call any of these functions. The next chapter gives an
  6295.  alphabetical reference to all of the functions, including declarations and
  6296.  examples.
  6297.  
  6298.  Table 8.2  Summary of Extension Functions by Category
  6299.  
  6300. ╓┌──────────────────┌───────────────────┌────────────────────────────────────╖
  6301.  Category           Functions           Description
  6302.  Category           Functions           Description
  6303.  
  6304.  File Handle        AddFile             Opens new file and gets file handle
  6305.                     FileNameToHandle    Gets handle to already opened file
  6306.                     Remove File         Removes file structure from memory
  6307.  
  6308.  Line-Oriented      FileLength          Returns number of lines in file
  6309.                     GetLine             Gets contents of one line
  6310.                     PutLine             Replaces a line
  6311.  
  6312.  Cursor             GetCursor           Gets cursor position
  6313.                     MoveCur             Moves cursor to new location
  6314.  
  6315.  Display            BadArg              Reports that argument was invalid
  6316.                     Display             Forces immediate update of screen
  6317.                     DoMessage           Puts message on the dialog line
  6318.  
  6319.  File-Oriented      DelFile             Deletes contents of a file buffer
  6320.                     FileRead            Copies disk file to file buffer
  6321.                     FileWrite           Copies file buffer to disk file
  6322.                     pFileToTop          Makes specified file the current file
  6323.  Category           Functions           Description
  6324.                    pFileToTop          Makes specified file the current file
  6325.  
  6326.  Block Operations   CopyBox             Inserts rectangular area
  6327.                     CopyLine            Inserts range of lines
  6328.                     CopyStream          Inserts stream of text
  6329.                     DelBox              Deletes rectangular area
  6330.                     DelLine             Deletes range of lines
  6331.                     DelStream           Deletes stream of text
  6332.  
  6333.  Keyboard           KbHook              Restores keyboard control to M
  6334.                     KbUnHook            Removes keyboard control from M
  6335.                     ReadChar            Returns information on next keystroke
  6336.                     ReadCmd             Returns keystroke info in CmdDesc
  6337.                                         format
  6338.  
  6339.  Miscellaneous      fExecute            Executes a macro
  6340.                     Replace             Replaces one character in a file
  6341.                     SetKey              Assigns a function to a keystroke
  6342.  
  6343.  
  6344.  
  6345.  Chapter 9  C-Extension Functions
  6346.  ───────────────────────────────────────────────────────────────────────────
  6347.  
  6348.  Most of the real work of an extension is done by the editor. Your extension
  6349.  provides program logic and decision making. Yet it relies on the editor to
  6350.  interact with the environment. Specifically, an extension calls low-level
  6351.  functions within the editor itself to alter a file, update the screen, read
  6352.  keyboard input, and perform many other useful functions.
  6353.  
  6354.  This chapter describes these low-level functions in alphabetical order. Most
  6355.  descriptions contain a summary, description, return value, cross-reference
  6356.  ("See Also"), and example. The summary is a description of syntax, showing
  6357.  you the number and type of arguments to give when calling the function. The
  6358.  description explains the effects of the function and gives further
  6359.  information about arguments. The return value typically indicates whether or
  6360.  not the function was successful. In addition, some functions return a file
  6361.  handle or a length.
  6362.  
  6363.  Finally, the cross-reference refers you to other functions that you may need
  6364.  to use in combination with the function described. For example, many
  6365.  functions cannot be performed unless you first call the FileNameToHandle
  6366.  function.
  6367.  
  6368.  For a topical listing of these functions, see Table 8.2 in the previous
  6369.  chapter.
  6370.  
  6371.  
  6372.  AddFile
  6373.  
  6374.  ■  Summary
  6375.  
  6376.       #include <ext.h>
  6377.  
  6378.       PFILE pascal AddFile (p)
  6379.       char far *p;
  6380.  
  6381.  ■  Description
  6382.  
  6383.  The AddFile function opens a file for editing. The parameter p points to a
  6384.  null-terminated string of text containing the name of the file to open.
  6385.  
  6386.  The file can be new or one that currently exists on disk; however, the file
  6387.  should not already be open for editing. Therefore, to open an existing file,
  6388.  first check to see if it is already open by calling FileNameToHandle.
  6389.  
  6390.  After you open an existing file, you should immediately call the FileRead
  6391.  function to properly initialize the internal file buffer. If you open a new
  6392.  file, the file will not be added to the disk until you call FileWrite.
  6393.  
  6394.  ■  Return value
  6395.  
  6396.  The function returns a handle to the file.
  6397.  
  6398.  ■  See also
  6399.  
  6400.       FileNameToHandle, FileRead, FileWrite
  6401.  
  6402.  ■  Example
  6403.  
  6404.  The following example checks to see if the file MYDATA.FIL is currently open
  6405.  for editing; if not, AddFile is called to open the file. In either case, the
  6406.  file handle is assigned to pFile.
  6407.  
  6408.       char *p = "MYDATA.FIL";
  6409.  
  6410.       if( (pFile = FileNameToHandle( p, NULL )) == 0 )
  6411.       {
  6412.            pFile = AddFile( p );
  6413.            FileRead( p, pFile );
  6414.       }
  6415.  
  6416.  
  6417.  BadArg
  6418.  
  6419.  ■  Summary
  6420.  
  6421.       #include <ext.h>
  6422.  
  6423.       flagType pascal BadArg (void)
  6424.  
  6425.  ■  Description
  6426.  
  6427.  The BadArg function reports an error message stating that the user's
  6428.  argument is invalid. Usually you do not need to call this function because
  6429.  the editor looks at the type of your function as declared in cmdTable and
  6430.  rejects commands with the wrong argument type.
  6431.  
  6432.  This function is primarily useful if your editing function does some
  6433.  additional tests for valid input, beyond argument type. For example, you may
  6434.  want to exclude each numarg larger than a certain value.
  6435.  
  6436.  ■  Return value
  6437.  
  6438.  The function does not return a value.
  6439.  
  6440.  ■  See also
  6441.  
  6442.       DoMessage
  6443.  
  6444.  ■  Example
  6445.  
  6446.  The following example causes the editor to report an invalid-argument
  6447.  message if the range of lines is greater than 10. Normally this condition is
  6448.  not an error, but you may want to write a function that restricts the size
  6449.  of an argument.
  6450.  
  6451.       if( yEnd > yStart == 10 )
  6452.       {
  6453.           BadArg( );
  6454.           return 0;
  6455.       }
  6456.  
  6457.  
  6458.  CopyBox
  6459.  
  6460.  ■  Summary
  6461.  
  6462.       #include <ext.h>
  6463.  
  6464.       void pascal CopyBox (pFileSrc, pFileDst, xLeft, yTop, xRight, yBottom, x
  6465.       PFILE pFileSrc, pFileDst;
  6466.       COL xLeft, xRight, xDst;
  6467.       LINE yTop, yBottom, yDst;
  6468.  
  6469.  ■  Description
  6470.  
  6471.  The CopyBox function copies the box delimited by the edges xLeft, yTop,
  6472.  xRight, and yBottom in the source file and inserts this box just before
  6473.  position (xDst, yDst) in the destination file. If the pFileSrc is null (0),
  6474.  the function inserts a box of blank spaces of the size implied by the
  6475.  coordinate parameters.
  6476.  
  6477.  The parameters pFileSrc and pFileDst are handles to the source and
  6478.  destination files. The parameters xLeft, xRight, yTop, and yBottom specify
  6479.  the boundaries of the box, inclusive, of the text to be copied. The text is
  6480.  inserted into the destination file just before the location specified by
  6481.  xDst, yDst.
  6482.  
  6483.  The same file can serve as source and destination. However, in that case the
  6484.  source and destination regions must not overlap.
  6485.  
  6486.  All coordinates in lower-level functions are zero based.
  6487.  
  6488.  ■  Return value
  6489.  
  6490.  The function does not return a value.
  6491.  
  6492.  ■  See also
  6493.  
  6494.       CopyBox, CopyLine, CopyStream, FileNameToHandle
  6495.  
  6496.  ■  Example
  6497.  
  6498.  The following example copies a box from the file A.TXT and inserts this
  6499.  region into the file B.TXT:
  6500.  
  6501.       pAFILE = FileNameToHandle( "A.TXT", NULL );
  6502.       pBFILE = FileNameToHandle( "B.TXT", NULL );
  6503.       .
  6504.       .
  6505.       .
  6506.       CopyBox( pAFILE, pBFILE, Left, Top, Right, End, xBFILE, yBFILE );
  6507.  
  6508.  
  6509.  CopyLine
  6510.  
  6511.  ■  Summary
  6512.  
  6513.       #include <ext.h>
  6514.  
  6515.       void pascal CopyLine (pFileSrc, pFileDst, yStart, yEnd, yDst)
  6516.       PFILE pFileSrc, pFileDst;
  6517.       LINE yStart, yEnd, yDst;
  6518.  
  6519.  ■  Description
  6520.  
  6521.  The CopyLine function can be used either to copy a group of lines from one
  6522.  region to another or to insert a blank line.
  6523.  
  6524.  The pFileSrc and pFileDst parameters are handles to the source and
  6525.  destination files. If pFileSrc is null (0), the function inserts one or more
  6526.  blanks lines, the number of lines being determined by the relative values of
  6527.  yStart andyEnd. (The number of blank lines is equal to the difference
  6528.  between yStart and yEnd plus one.) Otherwise, the function copies the lines
  6529.  from yStart to yEnd, inclusive, in the destination file. Lines are inserted
  6530.  directly before line yDst in the destination file.
  6531.  
  6532.  The CopyLine function should not be confused with the PutLine function.
  6533.  PutLine replaces a line and does not affect the total number of lines.
  6534.  CopyLine inserts one or more lines and therefore increases the length of the
  6535.  file.
  6536.  
  6537.  The same file cannot serve as both source and destination. To copy text from
  6538.  one part of the file to another, copy to a temporary file, such as
  6539.  <clipboard>.
  6540.  
  6541.  All line numbers in low-level functions are zero based.
  6542.  
  6543.  ■  Return value
  6544.  
  6545.  The function does not return a value.
  6546.  
  6547.  ■  See also
  6548.  
  6549.       CopyBox, CopyStream, FileNameToHandle, PutLine
  6550.  
  6551.  ■  Example
  6552.  
  6553.  The following code inserts a blank line at the beginning of the file:
  6554.  
  6555.       cfile = FileNameToHandle( "", NULL );
  6556.       CopyLines( NULL, cfile, 0, 0, 0 );
  6557.  
  6558.  
  6559.  CopyStream
  6560.  
  6561.  ■  Summary
  6562.  
  6563.       #include <ext.h>
  6564.  
  6565.       void pascal CopyStream (pFileSrc, pFileDst, xStart,yStart, xEnd, yEnd, x
  6566.       PFILE pFileSrc, pFileDst;
  6567.       COL xStart, xEnd, xDst;
  6568.       LINE yStart, yEnd, yDst;
  6569.  
  6570.  ■  Description
  6571.  
  6572.  The CopyStream function copies the stream of text (including new lines)
  6573.  beginning at position (xStart, yStart), up to but not including position
  6574.  (xEnd, yEnd).  The stream of text is inserted into the destination file just
  6575.  before position (xDst,yDst).  If pFileSrc is null (0), a blank space is
  6576.  inserted.
  6577.  
  6578.  The pFileSrc and pFileDst parameters are file handles to the source and
  6579.  destination files.
  6580.  
  6581.  The same file cannot serve as both source and destination. To copy text from
  6582.  one part of the file to another, copy to a temporary file, such as
  6583.  <clipboard>.
  6584.  
  6585.  ■  Return value
  6586.  
  6587.  The function does not return a value.
  6588.  
  6589.  ■  See also
  6590.  
  6591.       CopyBox, CopyLine, FileNameToHandle
  6592.  
  6593.  ■  Example
  6594.  
  6595.  The following example copies a stream from the file A.TXT and inserts this
  6596.  region into the file B.TXT:
  6597.  
  6598.       pAFILE = FileNameToHandle( "A.TXT", "" );
  6599.       pBFILE = FileNameToHandle( "B.TXT", "" );
  6600.       .
  6601.       .
  6602.       .
  6603.       CopyStream( pAFILE, pBFILE, xStart, yStart, xEnd, yEnd, xBFILE, yBFILE )
  6604.  
  6605.  
  6606.  DelBox
  6607.  
  6608.  ■  Summary
  6609.  
  6610.       #include <ext.h>
  6611.  
  6612.       void pascal DelBox (pFile, xLeft, yTop, xRight, yBottom)
  6613.       PFILE pFile;
  6614.       COL xLeft, xRight;
  6615.       LINE yTop, yBottom;
  6616.  
  6617.  ■  Description
  6618.  
  6619.  The DelBox function deletes all spaces in the box delimited by the positions
  6620.  (xLeft, yTop) and (xRight, yBottom). The box includes all four edges in the
  6621.  parameter list. The pFile parameter is a handle to the file to be modified.
  6622.  
  6623.  All line and column coordinates are zero based.
  6624.  
  6625.  ■  Return value
  6626.  
  6627.  The function does not return a value.
  6628.  
  6629.  ■  See also
  6630.  
  6631.       DelLine, DelStream, FileNameToHandle
  6632.  
  6633.  ■  Example
  6634.  
  6635.  The following example deletes the user-defined box argument:
  6636.  
  6637.       pFile = FileNameToHandle( "", NULL );
  6638.       .
  6639.       .
  6640.       .
  6641.       Left   = pArg->arg.boxarg.xLeft;
  6642.       Right  = pArg->arg.boxarg.xRight;
  6643.       Top    = pArg->arg.boxarg.yTop;
  6644.       Bottom = pArg->arg.boxarg.yBottom;
  6645.       .
  6646.       .
  6647.       .
  6648.       DelBox( pFile, Left, Top, Right, Bottom );
  6649.  
  6650.  
  6651.  DelFile
  6652.  
  6653.  ■  Summary
  6654.  
  6655.       #include <ext.h>
  6656.  
  6657.       void pascal DelFile (pFile)
  6658.       PFILE pFile;
  6659.  
  6660.  ■  Description
  6661.  
  6662.  The DelFile function deletes the entire contents of an internal file buffer.
  6663.  The effect of deleting contents can be made permanent by calling the
  6664.  FileWrite function, which replaces the contents of the file on disk with the
  6665.  contents of the internal file buffer.
  6666.  
  6667.  The  parameter pFile is the handle of the file to be cleared.
  6668.  
  6669.  ■  Return value
  6670.  
  6671.  The function does not return a value.
  6672.  
  6673.  ■  See also
  6674.  
  6675.       AddFile, FileNameToHandle, FileWrite
  6676.  
  6677.  ■  Example
  6678.  
  6679.  The following example deletes the contents of the file JUNK.TXT, then calls
  6680.  FileWrite to make the change permanent:
  6681.  
  6682.       if( (pFile = FileNameToHandle( "JUNK.TXT", NULL)) == 0 )
  6683.            pFile = AddFile(  "JUNK.TXT"  );
  6684.  
  6685.       DelFile( pFile );
  6686.       FileWrite( "JUNK.TXT", pFile );
  6687.  
  6688.  
  6689.  DelLine
  6690.  
  6691.  ■  Summary
  6692.  
  6693.       #include <ext.h>
  6694.  
  6695.       void pascal DelLine (pFile, yStart, yEnd)
  6696.       PFILE pFile;
  6697.       LINE yStart, yEnd;
  6698.  
  6699.  ■  Description
  6700.  
  6701.  The DelLine function deletes lines yStart through yEnd, inclusive, in the
  6702.  file pFile.
  6703.  
  6704.  The pFile parameter is a handle to a file from which lines are to be
  6705.  deleted. yStart is the first line to be deleted, and yEnd is the last line
  6706.  to be deleted.
  6707.  
  6708.  All line coordinates for low-level functions are zero based.
  6709.  
  6710.  ■  Return value
  6711.  
  6712.  The function does not return a value.
  6713.  
  6714.  ■  See also
  6715.  
  6716.       DelBox, DelStream, FileNameToHandle
  6717.  
  6718.  ■  Example
  6719.  
  6720.  The following example deletes the user-defined line argument:
  6721.  
  6722.       cfile = FileNameToHandle( "", NULL );
  6723.       .
  6724.       .
  6725.       .
  6726.       Start  = pArg->arg.linearg.xStart;
  6727.       End    = pArg->arg.linearg.xEnd;
  6728.       .
  6729.       .
  6730.       .
  6731.       DelLine( cfile, Start, End );
  6732.  
  6733.  
  6734.  DelStream
  6735.  
  6736.  ■  Summary
  6737.  
  6738.       #include <ext.h>
  6739.  
  6740.       void pascal DelStream (pFile, xStart, yStart, xEnd, yEnd)
  6741.       PFILE pFile;
  6742.       COL xStart, xEnd
  6743.       LINE yStart, yEnd;
  6744.  
  6745.  ■  Description
  6746.  
  6747.  The DelStream function deletes a stream of text beginning with a starting
  6748.  coordinate up to but not including the ending coordinate.
  6749.  
  6750.  The xStart and yStart parameters give the coordinates of the beginning of
  6751.  the stream. The xEnd and yEnd parameters give the coordinates of the byte
  6752.  just after the end of the stream.
  6753.  
  6754.  All column and line coordinates for low-level functions are zero based.
  6755.  
  6756.  ■  Return value
  6757.  
  6758.  The function does not return a value.
  6759.  
  6760.  ■  See also
  6761.  
  6762.       DelBox, DelLine, FileNameToHandle
  6763.  
  6764.  ■  Example
  6765.  
  6766.  The following example deletes the user-defined stream of text:
  6767.  
  6768.       cfile = FileNameToHandle( "", NULL );
  6769.       .
  6770.       .
  6771.       .
  6772.       xStart = pArg->arg.streamarg.xStart;
  6773.       yStart = pArg->arg.streamarg.yStart;
  6774.       xEnd   = pArg->arg.streamarg.xEnd;
  6775.       yEnd   = pArg->arg.streamarg.yEnd;
  6776.       .
  6777.       .
  6778.       .
  6779.       DelStream( cfile, xStart, yStart, xEnd, yEnd );
  6780.  
  6781.  
  6782.  Display
  6783.  
  6784.  ■  Summary
  6785.  
  6786.       #include <ext.h>
  6787.  
  6788.       void pascal Display ()
  6789.  
  6790.  ■  Description
  6791.  
  6792.  The Display function refreshes the screen by examining editing changes and
  6793.  making the minimum screen changes necessary. A keystroke interrupts the
  6794.  function and causes immediate return.
  6795.  
  6796.  The editor normally updates the display whenever the editing session is
  6797.  "idle"; that is, when the editor is waiting for the next command from the
  6798.  user. Therefore, it is usually not necessary to call the Display function.
  6799.  However, if your function runs for an extended period of time, call Display
  6800.  periodically to show the user the stage of any intermediate changes.
  6801.  Otherwise, the results of these changes are not displayed until completion
  6802.  of the function.
  6803.  
  6804.  ■  Return value
  6805.  
  6806.  The function does not return a value.
  6807.  
  6808.  ■  Example
  6809.  
  6810.       Display();
  6811.  
  6812.  
  6813.  DoMessage
  6814.  
  6815.  ■  Summary
  6816.  
  6817.       #include <ext.h>
  6818.  
  6819.       int pascal DoMessage (pStr)
  6820.       char far *pStr;
  6821.  
  6822.  ■  Description
  6823.  
  6824.  The DoMessage function writes a message to the dialog line. The pStr
  6825.  parameter points to a null-terminated string of text containing the message
  6826.  to be written.
  6827.  
  6828.  ■  Return value
  6829.  
  6830.  The function returns the number of characters written.
  6831.  
  6832.  ■  Example
  6833.  
  6834.  The following example outputs a message on the dialog line as part of the
  6835.  initialization procedure WhenLoaded:
  6836.  
  6837.       WhenLoaded ()
  6838.       {
  6839.            .
  6840.            .
  6841.            .
  6842.  
  6843.               DoMessage( "My extension now loaded" );
  6844.       }
  6845.  
  6846.  
  6847.  fExecute
  6848.  
  6849.  ■  Summary
  6850.  
  6851.       #include <ext.h>
  6852.  
  6853.       flagType pascal fExecute (pStr)
  6854.       char far *pStr;
  6855.  
  6856.  ■  Description
  6857.  
  6858.  The fExecute function executes a macro, using the standard rules for macro
  6859.  execution. The pointer pStr points to a null-terminated string of text
  6860.  containing the macro to be executed.
  6861.  
  6862.  You may sometimes find it convenient to invoke a predefined editing function
  6863.  by calling fExecute. For example, to search for the next occurrence of a
  6864.  given string, you can either write a loop that examines each line in the
  6865.  file, or simply invoke Psearch by calling fExecute. Macros are especially
  6866.  convenient when you want to look for a regular expression.
  6867.  
  6868.  ■  Return value
  6869.  
  6870.  The function passes along the value TRUE (nonzero) or FALSE (zero) returned
  6871.  by the last function the macro executed.
  6872.  
  6873.  ■  Example
  6874.  
  6875.  The following example invokes a macro in order to search for the next
  6876.  occurrence of the regular expression RegEx:
  6877.  
  6878.       strcpy( buf, "arg arg \"" );
  6879.       strcat( buf, RegEx );
  6880.       strcat( buf, "\" psearch" );
  6881.  
  6882.       if( fExecute (buf) )
  6883.       {
  6884.           GetCursor( xCur, yCur );    /* Get new coordinates */
  6885.       }
  6886.       else
  6887.       {
  6888.       .
  6889.       .
  6890.       .
  6891.        /* Take action for item not found */
  6892.       .
  6893.       .
  6894.       .
  6895.       }
  6896.  
  6897.  
  6898.  FileLength
  6899.  
  6900.  ■  Summary
  6901.  
  6902.       #include <ext.h>
  6903.  
  6904.       LINE pascal FileLength (pFile)
  6905.       PFILE pFile;
  6906.  
  6907.  ■  Description
  6908.  
  6909.  The FileLength function determines the length of the file pointed to by
  6910.  pFile.
  6911.  
  6912.  This function is useful for global operations in which it is necessary to
  6913.  know when you have reached the end of the file.
  6914.  
  6915.  ■  Return value
  6916.  
  6917.  The function returns the number of lines in the given file.
  6918.  
  6919.  ■  See also
  6920.  
  6921.       FileNameToHandle
  6922.  
  6923.  ■  Example
  6924.  
  6925.  The following example determines the number of lines in the current file:
  6926.  
  6927.       LINE fileLen;
  6928.  
  6929.       cfile = FileNameToHandle( "", NULL );
  6930.       fileLen = FileLength( cfile );
  6931.  
  6932.  
  6933.  FileNameToHandle
  6934.  
  6935.  ■  Summary
  6936.  
  6937.       #include <ext.h>
  6938.  
  6939.       PFILE pascal FileNameToHandle (pname, pShortName)
  6940.       char *pname, *pShortName;
  6941.  
  6942.  ■  Description
  6943.  
  6944.  The FileNameToHandle function returns the handle of a file already opened
  6945.  for editing.
  6946.  
  6947.  The pname parameter points to a null-terminated string of text containing a
  6948.  complete file name. FileNameToHandle looks for an exact match in its list of
  6949.  open files. The full path name must match. If the string does not specify a
  6950.  path to a directory, the current directory is assumed.
  6951.  
  6952.  If the function cannot find a match to pname, it attempts to match the
  6953.  pShortName parameter. This parameter points to a null-terminated string of
  6954.  text containing only a base file name──the function ignores any path name or
  6955.  extension in the short name. The editor selects the first file name with a
  6956.  base name matching the short name.
  6957.  
  6958.  If the first string is empty, the function returns a handle to the current
  6959.  file. The editor does not try to match a short name if the second parameter
  6960.  is a null pointer or points to an empty string.
  6961.  
  6962.  ■  Return value
  6963.  
  6964.  The FileNameToHandle function returns the handle to the given file. If the
  6965.  given file is not open for editing, the function returns NULL.
  6966.  
  6967.  ■  Example
  6968.  
  6969.  The following example returns a handle to the current file:
  6970.  
  6971.       PFILE  curfile;
  6972.  
  6973.       curfile = FileNameToHandle( "", NULL );
  6974.  
  6975.  
  6976.  FileRead
  6977.  
  6978.  ■  Summary
  6979.  
  6980.       #include <ext.h>
  6981.  
  6982.       flagType pascal FileRead (name, pFile)
  6983.       char far *name;
  6984.       PFILE pFile;
  6985.  
  6986.  ■  Description
  6987.  
  6988.  The FileRead function reads the contents of the specified disk file and
  6989.  stores them in the internal file buffer specified by the pFile. The old
  6990.  contents of the file buffer are lost.
  6991.  
  6992.  The parameter name is a pointer to a null-terminated string containing the
  6993.  name of the disk file to be read. The pFile parameter is the handle of the
  6994.  internal file buffer to write the data to.
  6995.  
  6996.  When you open a file for editing with AddFile, the file buffer is initially
  6997.  empty. Call FileRead to initialize the buffer with the current contents of
  6998.  the file.
  6999.  
  7000.  ■  Return value
  7001.  
  7002.  The function returns TRUE (nonzero) if the copy is successful and FALSE
  7003.  (zero) if not.
  7004.  
  7005.  ■  See also
  7006.  
  7007.       AddFile, FileWrite, FileNameToHandle
  7008.  
  7009.  ■  Example
  7010.  
  7011.  The following example opens the file MYTEXT.FIL for editing and then
  7012.  initializes the buffer with the current contents of the file:
  7013.  
  7014.       if( (pFile = FileNameToHandle("MYTEXT.FIL",NULL)) == 0 )
  7015.       {
  7016.            pFile = AddFile( "MYTEXT.FIL" );
  7017.            FileRead( "MYTEXT.FIL", pFile );
  7018.       }
  7019.  
  7020.  
  7021.  FileWrite
  7022.  
  7023.  ■  Summary
  7024.  
  7025.       #include <ext.h>
  7026.  
  7027.       flagType pascal FileWrite (savename, pFile)
  7028.       char far *savename;
  7029.       PFILE pFile;
  7030.  
  7031.  ■  Description
  7032.  
  7033.  The FileWrite function writes the contents of the specified file buffer out
  7034.  to a disk file.
  7035.  
  7036.  The pFile parameter is the handle to the file buffer. The savename parameter
  7037.  points to the name of the disk file. If savename points to an empty string,
  7038.  the function writes to the disk file with the name as the file pFile. (Note
  7039.  that a file handle points to an internal structure that contains the name of
  7040.  the file as well as other data.)
  7041.  
  7042.  The function first writes contents to a temporary file. If the write
  7043.  operation is successful, the temporary file is renamed to the destination
  7044.  file.
  7045.  
  7046.  You need not use FileWrite with the current file. Since the user is
  7047.  currently editing this file, you can let the user decide when to save the
  7048.  file to disk. However,FileWrite should be used with other files that you
  7049.  open for editing.
  7050.  
  7051.  ■  Return value
  7052.  
  7053.  The function returns TRUE (nonzero) if the copy was successful and FALSE
  7054.  (zero) if not.
  7055.  
  7056.  ■  See also
  7057.  
  7058.       AddFile, FileRead, FileNameToHandle
  7059.  
  7060.  ■  Example
  7061.  
  7062.  The following example alters the contents of the file JUNK.TXT, then makes
  7063.  the deletion permanent by calling FileWrite:
  7064.  
  7065.       char *p = "JUNK.TXT";
  7066.  
  7067.       if( (pFile = FileNameToHandle(p, NULL)) == 0 )
  7068.       {
  7069.           pFile = AddFile( p );
  7070.           FileRead( p, pFile );
  7071.       }
  7072.       .
  7073.       .
  7074.       .
  7075.       /* Manipulate data in the file */
  7076.       .
  7077.       .
  7078.       .
  7079.       FileWrite( p, pFile );
  7080.  
  7081.  
  7082.  GetCursor
  7083.  
  7084.  ■  Summary
  7085.  
  7086.       #include <ext.h>
  7087.  
  7088.       void pascal GetCursor (px, py);
  7089.       COL far *px;
  7090.       LINE far *py;
  7091.  
  7092.  ■  Description
  7093.  
  7094.  The GetCursor function indicates current cursor position by modifying the
  7095.  variables to which px and py point. The function sets *px to the current
  7096.  cursor column, and *py to the current cursor line.
  7097.  
  7098.  Upon return, the numbers pointed to by px and py indicate the column and
  7099.  row, respectively, of the current cursor position.
  7100.  
  7101.  ■  Return value
  7102.  
  7103.  The function does not return a value.
  7104.  
  7105.  ■  See also
  7106.  
  7107.       MoveCur
  7108.  
  7109.  ■  Example
  7110.  
  7111.       LINE  yCur;
  7112.       COL   xCur;
  7113.       .
  7114.       .
  7115.       .
  7116.            GetCursor( &xCur, &yCur );
  7117.  
  7118.  
  7119.  GetLine
  7120.  
  7121.  ■  Summary
  7122.  
  7123.       #include <ext.h>
  7124.  
  7125.       int pascal GetLine (line, buf, pFile)
  7126.       LINE line;
  7127.       char far *buf
  7128.       PFILE pFile;
  7129.  
  7130.  ■  Description
  7131.  
  7132.  The GetLine function is the principal means for reading text from a file
  7133.  buffer.
  7134.  
  7135.  The function reads a specified line of text and copies the line into a
  7136.  character string pointed to by buf. The editor terminates the string with a
  7137.  null value. The line parameter contains a line number to read. In
  7138.  extensions, line numbers are always zero based. The pFile parameter is the
  7139.  handle to the file.
  7140.  
  7141.  If the realtabs switch is off, the function expands tabs to spaces (as
  7142.  indicated by the entab and filetab switches) before copying the text to buf.
  7143.  
  7144.  ■  Return value
  7145.  
  7146.  The function returns the number of characters in the line after any tab
  7147.  conversion.
  7148.  
  7149.  ■  See also
  7150.  
  7151.       CopyLine, PutLine, FileNameToHandle
  7152.  
  7153.  ■  Example
  7154.  
  7155.  The following example reads the line of text that includes the initial
  7156.  cursor position and copies it into buf:
  7157.  
  7158.       PFILE cfile;
  7159.       LINE  yCur;
  7160.       COL   xCur;
  7161.        char  buf[BUFLEN];
  7162.       int   len; .
  7163.       .
  7164.       .
  7165.           cfile = FileNameToHandle( "", NULL );
  7166.           GetCursor( &xCur, &yCur );
  7167.           len = GetLine( yCur, buf, cfile );
  7168.  
  7169.  
  7170.  KbHook
  7171.  
  7172.  ■  Summary
  7173.  
  7174.       #include <ext.h>
  7175.  
  7176.       void pascal KbHook();
  7177.  
  7178.  ■  Description
  7179.  
  7180.  The KbHook function reverses the effect of the KbUnHook function and
  7181.  restores normal keyboard-input reading by the editor.
  7182.  
  7183.  ■  Return value
  7184.  
  7185.  The function does not return a value.
  7186.  
  7187.  ■  See also
  7188.  
  7189.       KhUnHook
  7190.  
  7191.  ■  Example
  7192.  
  7193.       KbHook( );
  7194.  
  7195.  
  7196.  KbUnHook
  7197.  
  7198.  ■  Summary
  7199.  
  7200.       #include <ext.h>
  7201.  
  7202.       void pascal KbUnHook();
  7203.  
  7204.  ■  Descripti on
  7205.  
  7206.  The KbUnHook function changes the focus of the keyboard so that keyboard
  7207.  input is no longer read by the editor.  When attempting to use system-level
  7208.  calls to read from the keyboard, it is necessary to first call this
  7209.  function.
  7210.  
  7211.  In particular, it is necessary to call the KbUnHook function before
  7212.  transferring control to a program that reads directly from the keyboard by
  7213.  using operating-system or BIOS calls, or by working directly with hardware.
  7214.  
  7215.  You normally do not need to call this function. For most work with the
  7216.  keyboard, use the ReadChar function. ReadChar lets the editor read the
  7217.  keyboard for you, but allows you to intercept the keystroke and evaluate it
  7218.  in any way you choose. Use KbUnHook only for situations that ReadChar cannot
  7219.  accommodate.
  7220.  
  7221.  ■  Return value
  7222.  
  7223.  The function does not return a value.
  7224.  
  7225.  ■  See also
  7226.  
  7227.       KbHook
  7228.  
  7229.  ■  Example
  7230.  
  7231.       KbUnHook( );
  7232.  
  7233.  
  7234.  MoveCur
  7235.  
  7236.  ■  Summary
  7237.  
  7238.       #include <ext.h>
  7239.  
  7240.       void pascal MoveCur (x, y)
  7241.       COL x;
  7242.       LINE y;
  7243.  
  7244.  ■  Description
  7245.  
  7246.  The MoveCur function moves the cursor to the specified position within the
  7247.  current file. If the cursor is within the same window, no window movement
  7248.  occurs. Otherwise, the window scrolls as needed, and the cursor is placed at
  7249.  a common position specified by the numeric switch hike.
  7250.  
  7251.  After the function is called, the cursor moves to column x, line y of the
  7252.  current file. The editing window scrolls, if necessary, to display this
  7253.  position within the window.
  7254.  
  7255.  ■  Return value
  7256.  
  7257.  The function does not return a value.
  7258.  
  7259.  ■  See also
  7260.  
  7261.       GetCursor
  7262.  
  7263.  ■  Example
  7264.  
  7265.  The following example edits the file but restores the initial cursor
  7266.  position:
  7267.  
  7268.       GetCursor( &xCur, &yCur );
  7269.       .
  7270.       .
  7271.       .
  7272.       /* Modify the file */
  7273.       .
  7274.       .
  7275.       .
  7276.       MoveCur( xCur, yCur );
  7277.  
  7278.  
  7279.  pFileToTop
  7280.  
  7281.  ■  Summary
  7282.  
  7283.       #include <ext.h>
  7284.  
  7285.       void pascal pFileToTop (pFileTmp)
  7286.       PFILE pFileTmp;
  7287.  
  7288.  ■  Description
  7289.  
  7290.  The pFileToTop function selects a file as the current file and makes it
  7291.  visible in the current window.  The function accomplishes this operation by
  7292.  moving the specified file handle to the top of the file list for the current
  7293.  window. (This list is stored in the <information-file> pseudo file.)
  7294.  
  7295.  The parameter pFileTmp is the file handle to move to the top of the file
  7296.  list.
  7297.  
  7298.  ■  Return value
  7299.  
  7300.  The function does not return a value.
  7301.  
  7302.  ■  See also
  7303.  
  7304.       AddFile, FileNameToHandle
  7305.  
  7306.  ■  Example
  7307.  
  7308.       pFileToTop( pFile );
  7309.  
  7310.  
  7311.  PutLine
  7312.  
  7313.  ■  Summary
  7314.  
  7315.       #include <ext.h>
  7316.  
  7317.       void pascal PutLine (line, buf, pFile)
  7318.       LINE line;
  7319.       char far *buf;
  7320.       PFILE pFile;
  7321.  
  7322.  ■  Description
  7323.  
  7324.  The PutLine function is the principal means for writing text to a file
  7325.  buffer.
  7326.  
  7327.  The function replaces a single line of text. The parameter buf points to the
  7328.  string that contains the new line of text. This string should terminate with
  7329.  a null value, but it should not contain a new-line character.
  7330.  
  7331.  The parameter line contains the line number at which the replacement is to
  7332.  take place. Line numbers start at 0; if line has the value 0, the new line
  7333.  of text is inserted at the beginning of the file.
  7334.  
  7335.  If line is greater than the number of lines in the file, PutLine inserts
  7336.  empty lines at the end of the file.
  7337.  
  7338.  ■  Return value
  7339.  
  7340.  The function does not return a value.
  7341.  
  7342.  ■  See also
  7343.  
  7344.       CopyLine, GetLine, FileLength, FileNameToHandle
  7345.  
  7346.  ■  Example
  7347.  
  7348.  The following code replaces the first line of the current file with the
  7349.  string pointed to by buf:
  7350.  
  7351.       PutLine( 0, buf, cfile );
  7352.  
  7353.  
  7354.  ReadChar
  7355.  
  7356.  ■  Summary
  7357.  
  7358.       #include <ext.h>
  7359.  
  7360.       long pascal ReadChar();
  7361.  
  7362.  ■  Description
  7363.  
  7364.  The ReadChar function returns the next keystroke typed. The editor does not
  7365.  echo the keystroke or invoke a function. Once intercepted, the keystroke
  7366.  cannot be placed back into the keyboard buffer for execution. The function
  7367.  returns a long integer composed of four bytes containing information about
  7368.  the keystroke:
  7369.  
  7370.  Byte                        Description
  7371.  
  7372.  0                           ASCII character
  7373.  
  7374.  1                           scan-code character
  7375.  
  7376.  2                           shift information, in xxNxACxS format described
  7377.                              below
  7378.  
  7379.  3                           null character (0), which is unused
  7380.  
  7381.  Byte 2 provides information about the shift-key conditions (N)UMLOCK, (A)LT,
  7382.  (C)TRL, and (S)HIFT, in the format xxNxACxS. Each x indicates an unused bit.
  7383.  The bits N, A, C, and S are each on or off, depending on the associated
  7384.  condition.  For example, if the ALT, CTRL, and SHIFT conditions are all on,
  7385.  but the NUMLOCK condition is off, byte 2 is returned as 00001101.  Note: the
  7386.  N bit is 0 unless the key pressed is on the numeric keypad.
  7387.  
  7388.  ■  Return value
  7389.  
  7390.  The function returns a long integer containing the keystroke information.
  7391.  
  7392.  ■  See also
  7393.  
  7394.       ReadCmd, KbHook
  7395.  
  7396.  ■  Example
  7397.  
  7398.       #define ASCIIBYTE  0x000000FF
  7399.       #define SCANBYTE   0x0000FF00
  7400.       #define CTRLBIT    0x00040000
  7401.       #define SHIFTBIT   0x00010000
  7402.       #define NUMLKBIT   0x00200000
  7403.  
  7404.       long keystroke;
  7405.       int  ascii_key, scan_byte;
  7406.       int  contrl_on, shift_on, numlk_on;
  7407.  
  7408.            keystroke = ReadChar();
  7409.            ascii_key = keystroke & ASCIIBYTE;
  7410.            scan_byte = (keystroke & SCANBYTE) >>> 8;
  7411.            contrl_on = (keystroke & CTRLBIT) > 0;
  7412.            shift_on  = (keystroke & SHIFTBIT) > 0;
  7413.            numlk_on  = (keystroke & NUMLKBIT) > 0;
  7414.  
  7415.  
  7416.  ReadCmd
  7417.  
  7418.  ■  Summary
  7419.  
  7420.       #include <ext.h>
  7421.  
  7422.       PCMD pascal ReadCmd(  );
  7423.  
  7424.  ■  Description
  7425.  
  7426.  The ReadCmd function waits for input from the user. The next keystroke is
  7427.  translated into a function reference (according to current assignments), but
  7428.  the function is not executed. Instead, the editor passes information about
  7429.  the function in the form of a structure of type cmdDesc. Once intercepted,
  7430.  the keystroke cannot be placed back for execution.
  7431.  
  7432.  ■  Return value
  7433.  
  7434.  The return value is a structure of type cmdDesc. The structure describes the
  7435.  command corresponding to the keystroke pressed.
  7436.  
  7437.  ■  See also
  7438.  
  7439.       ReadChar
  7440.  
  7441.  
  7442.  RemoveFile
  7443.  
  7444.  ■  Summary
  7445.  
  7446.       #include <ext.h>
  7447.  
  7448.       flagType pascal RemoveFile (pFileRem)
  7449.       PFILEpFileRem;
  7450.  
  7451.  ■  Description
  7452.  
  7453.  The RemoveFile function removes a file handle from memory, along with the
  7454.  file buffer and all other memory-resident information about the file.
  7455.  Calling this function helps to free up main memory, but it has no effect on
  7456.  the file as stored on disk.
  7457.  
  7458.  This function is the converse of the AddFile function. RemoveFile closes a
  7459.  file. In other words, the file is no longer open for editing. However,
  7460.  unlike the C function fclose, the RemoveFile function does not force the
  7461.  writing of the file buffer to disk.
  7462.  
  7463.  The parameter pFileRem is the file handle of the file to be removed.
  7464.  
  7465.  ■  Return value
  7466.  
  7467.  The function does not return a value.
  7468.  
  7469.  ■  See also
  7470.  
  7471.       AddFile, FileNameToHandle
  7472.  
  7473.  ■  Example
  7474.  
  7475.       RemoveFile( pNewFile );
  7476.  
  7477.  
  7478.  Replace
  7479.  
  7480.  ■  Summary
  7481.  
  7482.       #include <ext.h>
  7483.  
  7484.       flagType pascal Replace (c, x, y, pFile, fInsert)
  7485.       char c;
  7486.       COL x;
  7487.       LINE y;
  7488.       PFILE pFile;
  7489.       flagType fInsert;
  7490.  
  7491.  ■  Description
  7492.  
  7493.  The Replace function inserts or replaces characters one at a time. The c
  7494.  parameter contains the new character. The x and y parameters indicate the
  7495.  file position──by column and line──where the edit is to take place. Line
  7496.  numbers are zero based.
  7497.  
  7498.  The pFile parameter is a file parameter handle returned by the
  7499.  FileNameToHandle function. To specify insertion, set fInsert to TRUE
  7500.  (nonzero). To specify replacement, set fInsert to FALSE (zero).
  7501.  
  7502.  ■  Return value
  7503.  
  7504.  The function returns TRUE (nonzero) if the edit is successful and FALSE
  7505.  (zero) otherwise.
  7506.  
  7507.  ■  See also
  7508.  
  7509.       PutLine
  7510.  
  7511.  ■  Example
  7512.  
  7513.  The following code inserts the word "Hello" at line y and column x of the
  7514.  current file:
  7515.  
  7516.       #define  TRUE  -1
  7517.       char    *p; PFILE   cfile;  /* handle to current file */
  7518.       .
  7519.       .
  7520.       .
  7521.       cfile = FileNameToHandle( "", NULL );  /* initialize cfile */
  7522.       for ( p = "Hello"; *p; p++, y++ )
  7523.           Replace( *p, x, y, cfile, TRUE );
  7524.  
  7525.  
  7526.  SetKey
  7527.  
  7528.  ■  Summary
  7529.  
  7530.       #include <ext.h>
  7531.  
  7532.       flagType pascal SetKey (name, p)
  7533.       char far *name, far *p;
  7534.  
  7535.  ■  Description
  7536.  
  7537.  The SetKey function assigns an editing function to a key.
  7538.  
  7539.  The name parameter points to a string containing the name of the function,
  7540.  and the p parameter points to a string that names the key.
  7541.  
  7542.  ■  Return value
  7543.  
  7544.  The function returns TRUE (nonzero) if the assignment is successful and
  7545.  FALSE (zero) otherwise.
  7546.  
  7547.  ■  See also
  7548.  
  7549.       RemoveFile, Replace
  7550.  
  7551.  ■  Example
  7552.  
  7553.  The following code assigns the CTRL+X key to the newly defined function
  7554.  NewFunc:
  7555.  
  7556.       SetKey( "NewFunc", "ctrl+x" );
  7557.  
  7558.  
  7559.  Appendix A  Reference Tables
  7560.  ───────────────────────────────────────────────────────────────────────────
  7561.  
  7562.  
  7563.  A.1  Categories of Editing Functions
  7564.  
  7565.  Table A.1 lists the editing functions by category and gives a brief
  7566.  description of each function.
  7567.  
  7568.  Table A.1  Summary of Editing Functions by Category
  7569.  
  7570.  Command Manipulation      Description
  7571.  
  7572.  Arg                       Introduces an argument or function
  7573.  Assign                    Assigns function to a keystroke
  7574.  Boxstream                 Toggles between box and stream mode
  7575.  Cancel                    Cancels current operation
  7576.  Execute                   Executes an editor function or macro list
  7577.  Graphic                   Inserts the ASCII value of the key into the file
  7578.  Lastselect                Recalls the last cursor-movement argument
  7579.  Lasttext                  Recalls the last textarg entered
  7580.  Meta                      Turns on the Meta command prefix
  7581.  Quote                     Treats next character literally
  7582.  Repeat                    Repeats the previous command
  7583.  Undo                      Reverses the effect of the last editing change
  7584.  
  7585.  File Operations           Description
  7586.  
  7587.  Exit                      Exits the editor, with or without saving
  7588.  Noedit                    Toggles the no-edit restriction
  7589.  Paste                     Merges file or program output
  7590.  Refresh                   Rereads file, discarding edits
  7591.  Saveall                   Saves all modified files
  7592.  Setfile                   Saves current file or loads a new file
  7593.  
  7594.  Cursor Movement           Description
  7595.  
  7596.  Backtab                   Moves cursor left to previous tab stop
  7597.  Begfile                   Moves cursor to beginning of file
  7598.  Begline                   Moves cursor left to beginning of line
  7599.  Down                      Moves cursor down one line
  7600.  Endfile                   Moves cursor to end of file
  7601.  Endline                   Moves cursor to right of last character of line
  7602.  Home                      Moves cursor to upper-left corner of window
  7603.  Left                      Moves cursor left one character
  7604.  Mpage                     Moves cursor back by one page
  7605.  Mpara                     Moves cursor back by paragraphs
  7606.  Mword                     Moves cursor back by words
  7607.  Newline                   Moves cursor down to next line
  7608.  Ppage                     Moves cursor forward by one page
  7609.  Ppara                     Moves cursor forward by paragraphs
  7610.  Pword                     Moves cursor forward by words
  7611.  Right                     Moves cursor right one character
  7612.  Tab                       Moves cursor right to next tab stop
  7613.  Up                        Moves cursor up one line
  7614.  
  7615.  Mark/Goto Position        Description
  7616.  
  7617.  Mark                      Moves cursor to specified position in file
  7618.  Restcur                   Restores cursor position saved with Savecur
  7619.  Savecur                   Saves cursor position for use with Restcur
  7620.  Mlines                    Moves window back by lines
  7621.  Plines                    Moves window forward by lines
  7622.  Setwindow                 Redisplays window
  7623.  Window                    Creates, removes, or moves between windows
  7624.  
  7625.  Searching/Replacing       Description
  7626.  
  7627.  Mgrep                     Searches a series of files
  7628.  Mreplace                  Replaces throughout a series of files
  7629.  Msearch                   Searches backward
  7630.  Psearch                   Searches forward
  7631.  Qreplace                  Replaces with confirmation
  7632.  Replace                   Replaces without confirmation
  7633.  Searchall                 Highlights all occurrences of a string
  7634.  
  7635.  Special Insert            Description
  7636.  
  7637.  Curdate                   Inserts current date (e.g., 28-Nov-1988)
  7638.  Curday                    Inserts current day (Sun...Sat)
  7639.  Curfile                   Inserts name of current file
  7640.  Curfileext                Inserts extension of current file
  7641.  Curfilenam                Inserts base name of current file
  7642.  Curtime                   Inserts current time (e.g., 13:45:55)
  7643.  
  7644.  Inserting/Deleting Text   Description
  7645.  
  7646.  Cdelete                   Deletes character to left, excluding line breaks
  7647.  Copy                      Copies lines to the Clipboard
  7648.  Delete                    Deletes the highlighted area
  7649.  Emacscdel                 Deletes character to left, including line breaks
  7650.  Emacsnewl                 Starts new line, breaking current line
  7651.  Insert                    Inserts spaces into the highlighted area
  7652.  Ldelete                   Deletes lines into the Clipboard
  7653.  Linsert                   Inserts blank lines
  7654.  Paste                     Inserts text from the Clipboard
  7655.  Sdelete                   Deletes stream of text, including line breaks
  7656.  Sinsert                   Inserts blanks, breaking lines if necessary
  7657.  
  7658.  Programming               Description
  7659.  
  7660.  Argcompile                Performs the Arg Compile command
  7661.  Compile                   Executes compile or build command
  7662.  Nextmsg                   Moves cursor to next error message
  7663.  Pbal                      Balances parentheses and brackets
  7664.  
  7665.  Macro Creation            Description
  7666.  
  7667.  Assign                    Defines a macro
  7668.  Message                   Displays message on the dialog line
  7669.  Record                    Turns macro recording on or off
  7670.  Tell                      Displays assignment or macro definition
  7671.  
  7672.  Miscellaneous             Description
  7673.  
  7674.  Environment               Executes and views environment settings
  7675.  Information               Displays list of previously edited files
  7676.  Initialize                Rereads initialization file
  7677.  Insertmode                Toggles insert mode on and off
  7678.  Print                     Prints all or part of a file
  7679.  Shell                     Spawns a system-level shell or command line
  7680.  
  7681.  
  7682.  A.2  Key Assignments for Editing Functions
  7683.  
  7684.  Table A.2 lists the editing functions and the assigned keys for each of the
  7685.  configurations provided with the setup program.
  7686.  
  7687.  Table A.2  Function Assignments
  7688. ╓┌────────────────┌────────────┌────────────┌───────────┌────────────────────╖
  7689.                                Quick/
  7690.  Function         Default      WordStar     BRIEF       Epsilon
  7691.  
  7692.  Arg              ALT+A        ALT+A        ALT+A       CTRL+U or CTRL+X
  7693.  
  7694.  Argcompile       ---          F5           ALT+F10     F5
  7695.  
  7696.  Assign           ALT+=        ALT+=        F7          F1
  7697.  
  7698.  Backtab          SHIFT+TAB    SHIFT+TAB    SHIFT+TAB   SHIFT+TAB
  7699.  
  7700.  Begfile          CTRL+PGUP ---             ---         ---
  7701.  
  7702.  Begline          HOME         HOME or      HOME        CTRL+A
  7703.                                CTRL+QS
  7704.  
  7705.  Boxstream        CTRL+B       ---          ---         ---
  7706.  
  7707.  Cancel           ESC or       ESC          ESC         CTRL+C
  7708.                   CTRL+BREAK
  7709.                                Quick/
  7710.  Function         Default      WordStar     BRIEF       Epsilon
  7711.  
  7712.                  CTRL+BREAK
  7713.  
  7714.  Cdelete          CTRL+G       CTRL+G       BKSP        ---
  7715.  
  7716.  Compile          CTRL+F3      SHIFT+F3     CTRL+N      SHIFT+F3
  7717.  
  7718.  Copy             CTRL+INS     CTRL+INS     + (keypad)  ALT+W
  7719.                   or press +
  7720.                   (keypad)
  7721.  
  7722.  Curdate          ---          ---          ---         ---
  7723.  
  7724.  Curday           ---          ---          ---         ---
  7725.  
  7726.  Curfile          ---          ---          ---         ---
  7727.  
  7728.  Curfileext       ---          ---          ---         ---
  7729.  
  7730.                                Quick/
  7731.  Function         Default      WordStar     BRIEF       Epsilon
  7732.  
  7733. 
  7734.  Curfilenam       ---          ---          ---         ---
  7735.  
  7736.  Curtime          ---          ---          ---         ---
  7737.  
  7738.  Delete           DEL          ---          ---         ---
  7739.  
  7740.  Down             DOWN or      DOWN or      DOWN        DOWN or CTRL+N
  7741.                   CTRL+X       CTRL+X
  7742.  
  7743.  Emacscdel        BKSP         BKSP         ---         BKSP or CTRL+H
  7744.  
  7745.  Emacsnewl        ENTEREND     END or       END         CTRL+E
  7746.  
  7747.  Endfile          CTRL+PGDN    ---          CTRL+QD     ---
  7748.  
  7749.  Endline          END          END or       END         CTRL+E
  7750.                                CTRL+QD
  7751.                                Quick/
  7752.  Function         Default      WordStar     BRIEF       Epsilon
  7753.  
  7754.                               CTRL+QD
  7755.  
  7756.  Environment      ---          ---          ---         ---
  7757.  
  7758.  Execute          F7           F10          F10         ALT+X
  7759.  
  7760.  Exit             F8           ALT+X        ALT+X       F8
  7761.  
  7762.  Home             CTRL+HOME    CTRL+HOME    CTRL+HOME   HOME
  7763.  
  7764.  Information      SHIFT+F10    SHIFT+F1     ALT+B       SHIFT+F1
  7765.  
  7766.  Initialize       SHIFT+F8     ALT+F10      SHIFT+F10   ALT+F10
  7767.  
  7768.  Insert           ---          ---          ---         ---
  7769.  
  7770.  Insertmode       INS or       INS or       ALT+I       CTRL+V
  7771.                   CTRL+V       CTRL+V
  7772.                                Quick/
  7773.  Function         Default      WordStar     BRIEF       Epsilon
  7774.  
  7775.                  CTRL+V       CTRL+V
  7776.  
  7777.  Lastselect       CTRL+U       ---          ---         ---
  7778.  
  7779.  Lasttext         CTRL+O       ALT+L        ALT+L       ALT+L
  7780.  
  7781.  Ldelete          CTRL+Y       CTRL+Y       ALT+D       CTRL+K
  7782.  
  7783.  Left             LEFT or      LEFT         LEFT        LEFT or CTRL+B
  7784.                   CTRL+S
  7785.  
  7786.  Linsert          CTRL+N       CTRL+N       CTRL+ENTER  CTRL+O
  7787.  
  7788.  Mark             CTRL+M       ALT+M        ALT+M       CTRL+@
  7789.  
  7790.  Message          ---          ---          ---         ---
  7791.  
  7792.  Meta             F9           F9           F9          F9
  7793.                                Quick/
  7794.  Function         Default      WordStar     BRIEF       Epsilon
  7795.  
  7796. Meta             F9           F9           F9          F9
  7797.  
  7798.  Mgrep            ---          ---          ---         ---
  7799.  
  7800.  Mlines           CTRL+W       CTRL+W       ALT+U       CTRL+W
  7801.  
  7802.  Mpage            PGUP         PGUP or      PGUP        PGUP or ALT+V
  7803.                   CTRL+R       CTRL+R
  7804.  
  7805.  Mpara            ---          CTRL+PGUP    CTRL+PGUP   ALT+UP
  7806.  
  7807.  Mreplace         ---          ---          ---         ---
  7808.  
  7809.  Msearch          F4           F4           ALT+F5      CTRL+R
  7810.  
  7811.  Mword            CTRL+LEFT    CTRL+LEFT    CTRL+LEFT   CTRL+LEFT or
  7812.                   or CTRL+A                             ALT+B
  7813.  
  7814.                                Quick/
  7815.  Function         Default      WordStar     BRIEF       Epsilon
  7816.  
  7817. 
  7818.  Newline          ---          ---          ENTER       ---
  7819.  
  7820.  Nextmsg          SHIFT+F3     ---          ---         ---
  7821.  
  7822.  Noedit           ---          ---          ---         ---
  7823.  
  7824.  Paste            SHIFT+INS    SHIFT+INS    INS         CTRL+Y or INS
  7825.  
  7826.  Pbal             CTRL+[       CTRL+[       CTRL+[      CTRL+[
  7827.  
  7828.  Plines           CTRL+Z       CTRL+Z       CTRL+Z      CTRL+Z
  7829.  
  7830.  Ppage            PGDN or      PGDN or      PDGN        PDGN
  7831.                   CTRL+C       CTRL+C
  7832.  
  7833.  Ppara            ---          CTRL+PGDN    CTRL+PDGN   ALT+DOWN
  7834.  
  7835.                                Quick/
  7836.  Function         Default      WordStar     BRIEF       Epsilon
  7837.  
  7838. 
  7839.  Print            CTRL+F8      ---          ---         ---
  7840.                   or ALT+F2
  7841.  
  7842.  Psearch          F3           F3           F5          F4 or CTRL+S
  7843.  
  7844.  Pword            CTRL+RIGHT   CTRL+RIGHT   CTRL+RIGHT  CTRL+RIGHT
  7845.                   or CTRL+F                             or ALT+F
  7846.  
  7847.  Qreplace         CTRL+\       ALT+F3       F6          ALT+F3 or ALT+5 or
  7848.                                                         ALT+8
  7849.  
  7850.  Quote            CTRL+P       ALT+Q        ALT+Q       CTRL+Q
  7851.  
  7852.  Record           ALT+R        ---          ---         ---
  7853.  
  7854.  Refresh          SHIFT+F7     ALT+R        CTRL+]      ALT+R
  7855.  
  7856.                                Quick/
  7857.  Function         Default      WordStar     BRIEF       Epsilon
  7858.  
  7859. 
  7860.  Repeat           ---          ---          ---         ---
  7861.  
  7862.  Replace          CTRL+L       CTRL+L       SHIFT+F6    ---
  7863.  
  7864.  Restcur          ---          ---          ---         ---
  7865.  
  7866.  Right            RIGHT or     RIGHT or     RIGHT       RIGHT or CTRL+F
  7867.                   CTRL+D       CTRL+D
  7868.  
  7869.  Saveall          ---          ---          ---         ---
  7870.  
  7871.  Savecur          ---          ---          ---         ---
  7872.  
  7873.  Sdelete          ---          DEL          DEL or      DEL or
  7874.                                             press       CTRL+D
  7875.                                             - (keypad)
  7876.  
  7877.                                Quick/
  7878.  Function         Default      WordStar     BRIEF       Epsilon
  7879.  
  7880. 
  7881.  Searchall        SHIFT+F6     ---          ---         ---
  7882.  
  7883.  Setfile          F2           F2           ALT+N       F2
  7884.  
  7885.  Setwindow        CTRL+]       CTRL+]       F2          CTRL+]
  7886.  
  7887.  Shell            SHIFT+F9     SHIFT+F9     ALT+Z       ALT+Z
  7888.  
  7889.  Sinsert          CTRL+J       ALT+INS      CTRL+INS    ALT+INS
  7890.  
  7891.  Tab              TAB          TAB          TAB         TAB or CTRL+I
  7892.  
  7893.  Tell             CTRL+T       ---          ---         ---
  7894.  
  7895.  Undo             ALT+BKSP     ALT+BKSP     * (keypad)  CTRL+BKSP
  7896.  
  7897.  Up               UP or        UP or        UP          UP or CTRL+P
  7898.                                Quick/
  7899.  Function         Default      WordStar     BRIEF       Epsilon
  7900.  
  7901. Up               UP or        UP or        UP          UP or CTRL+P
  7902.                   CTRL+E       CTRL+E
  7903.  
  7904.  Window           F6           F6           F1          ALT+PGDN
  7905.  
  7906.  
  7907.  A.3  Comprehensive Listing of Editing Functions
  7908.  
  7909.  Table A.3 gives a comprehensive listing of the editing functions and syntax
  7910.  for each command. Default keystrokes, if available, are given in
  7911.  parentheses.
  7912.  
  7913.  Table A.3  Comprehensive List of Functions
  7914. ╓┌───────────────┌──────────────────────────────┌────────────────────────────
  7915.  Function
  7916.  (and Default
  7917.  Keysrokes)      Syntax                         Description
  7918.  
  7919.  Function
  7920.  (and Default
  7921.  Keysrokes)      Syntax                         Description
  7922.  
  7923.  Arg             Arg                            Introduces a function or an ar
  7924.  (ALT+A)                                        function.
  7925.  
  7926.  Argcompile      Argcompile                     Performs the Arg Compile comma
  7927.                                                 this function appears in the T
  7928.  
  7929.  Assign          Assign                         Treats the entire line (except
  7930.  (ALT+=)                                        break) on which the cursor is
  7931.                                                 function assignment or macro d
  7932.  
  7933.                  Arg Assign                     Treats the text from the initi
  7934.                                                 position to the end of the lin
  7935.                                                 the line break) as a function
  7936.                                                 macro definition.
  7937.  
  7938.                  Arg boxarg Assign              Treats each line of the boxarg
  7939.                  Arg markarg Assign             individual function assignment
  7940.  Function
  7941.  (and Default
  7942.  Keysrokes)      Syntax                         Description
  7943.  
  7944.                 Arg markarg Assign             individual function assignment
  7945.                  Arg numarg Assign              definition.
  7946.  
  7947.                  Arg linearg Assign             Treats each line as a separate
  7948.                                                 assignment or macro definition
  7949.                                                 lines.
  7950.  
  7951.                  Arg textarg Assign             Treats textarg as a function a
  7952.                                                 macro definition.
  7953.  
  7954.                  Arg ? Assign                   Displays the current function
  7955.                                                 all functions and macros.
  7956.  
  7957.  Backtab         Backtab                        Moves the cursor to the previo
  7958.  (SHIFT+TAB)                                    stops are defined to be every
  7959.                                                 where n is defined by the tabs
  7960.  
  7961.  Function
  7962.  (and Default
  7963.  Keysrokes)      Syntax                         Description
  7964.  
  7965. 
  7966.  Begfile         Begfile                        Places the cursor at the begin
  7967.  (CTRL+PGUP)                                    file.
  7968.  
  7969.  Begline         Begline                        Places the cursor on the first
  7970.  (HOME)                                         character on the line.
  7971.  
  7972.                  Meta Begline                   Places the cursor in the first
  7973.                                                 position of the line.
  7974.  
  7975.  Boxstream       Boxstream                      Toggles between box mode and s
  7976.  (CTRL+B)                                       box mode, each
  7977.                                                 cursor-movement is interpreted
  7978.                                                 rectangular-shaped linearg or
  7979.                                                 boxarg. In stream mode, the ed
  7980.                                                 all file positions between ini
  7981.                                                 cursor position.
  7982.  Function
  7983.  (and Default
  7984.  Keysrokes)      Syntax                         Description
  7985.  
  7986.                                                cursor position.
  7987.  
  7988.  Cancel          Cancel                         Cancels the current operation
  7989.  (ESC)                                          progress.
  7990.  
  7991.  Cdelete         Cdelete                        Deletes the previous character
  7992.  (CTRL+G)                                       breaks. If the cursor is in co
  7993.                                                 moves the cursor to the end of
  7994.                                                 line. If issued in insert mode
  7995.                                                 deletes the previous character
  7996.                                                 length of the line by 1; other
  7997.                                                 the previous character and rep
  7998.                                                 blank. If the cursor is beyond
  7999.                                                 line when the function is invo
  8000.                                                 is moved to the immediate righ
  8001.                                                 character on the line.
  8002.  
  8003.  Function
  8004.  (and Default
  8005.  Keysrokes)      Syntax                         Description
  8006.  
  8007. 
  8008.  Compile         Compile                        Displays status of the current
  8009.  (CTRL+F3)                                      any) on the dialog line.
  8010.  
  8011.                  Arg Compile                    Compiles the current file. Use
  8012.                                                 command line that matches the
  8013.                                                 extension of the current file.
  8014.  
  8015.                  Arg textarg Compile            Uses the command line specifie
  8016.                                                 extmake:text. The textarg repl
  8017.                                                 command line. See Table A.5 f
  8018.                                                 information on
  8019.                                                 extmake.
  8020.  
  8021.                  Arg Arg textarg Compile        Invokes the specified text as
  8022.                                                 program is assumed to display
  8023.                                                 the following format: file row
  8024.  Function
  8025.  (and Default
  8026.  Keysrokes)      Syntax                         Description
  8027.  
  8028.                                                the following format: file row
  8029.  
  8030.                  Arg Meta Compile               OS/2 only. Kills a protected-m
  8031.                                                 running in the background, aft
  8032.                                                 confirmation.
  8033.  
  8034.  Copy            Copy                           Copies the current line into t
  8035.  (CTRL+INS, or                                  Clipboard.
  8036.  press + on
  8037.  numeric keypad)
  8038.  
  8039.                  Arg Copy                       Copies text from the initial c
  8040.                                                 to the end of the line and pla
  8041.                                                 Clipboard. Note that the line
  8042.                                                 picked up.
  8043.  
  8044.                  Arg boxarg Copy                Copies the highlighted text in
  8045.  Function
  8046.  (and Default
  8047.  Keysrokes)      Syntax                         Description
  8048.  
  8049.                 Arg boxarg Copy                Copies the highlighted text in
  8050.                  Arg linearg Copy               Clipboard.
  8051.                  Arg streamarg Copy
  8052.                  Arg textarg Copy
  8053.  
  8054.                  Arg markarg Copy               Copies the range of text betwe
  8055.                                                 and the location of the file m
  8056.                                                 Clipboard. In stream mode, a s
  8057.                                                 selected. In box mode, the tex
  8058.                                                 a boxarg or linearg depending
  8059.                                                 relative positions of the init
  8060.                                                 the file marker.
  8061.  
  8062.                  Arg numarg Copy                Copies the specified number
  8063.                                                 of lines into the Clipboard, s
  8064.                                                 current line.
  8065.  
  8066.  Function
  8067.  (and Default
  8068.  Keysrokes)      Syntax                         Description
  8069.  
  8070. 
  8071.  Curdate         Curdate                        Inserts the current date at th
  8072.                                                 format of 28-Nov-1988.
  8073.  
  8074.  Curday          Curday                         Inserts the current day at the
  8075.                                                 format of Sun...Sat.
  8076.  
  8077.  Curfile         Curfile                        Inserts the fully qualified pa
  8078.                                                 current file at the cursor.
  8079.  
  8080.  Curfileext      Curfileext                     Inserts the extension of the c
  8081.                                                 the cursor.
  8082.  
  8083.  Curfilenam      Curfilenam                     Inserts the base name of the c
  8084.                                                 the cursor.
  8085.  
  8086.  Curtime         Curtime                        Inserts the current time at th
  8087.  Function
  8088.  (and Default
  8089.  Keysrokes)      Syntax                         Description
  8090.  
  8091. Curtime         Curtime                        Inserts the current time at th
  8092.                                                 format of 13:45:55.
  8093.  
  8094.  Delete          Delete                         Deletes the single character u
  8095.  (DEL)                                          excluding line breaks. The del
  8096.                                                 is not placed into the Clipboa
  8097.  
  8098.                  Arg Delete                     Deletes all text from the curr
  8099.                                                 position to the end of the lin
  8100.                                                 text (including the line break
  8101.                                                 the Clipboard. This command ha
  8102.                                                 joining lines.
  8103.  
  8104.                  Arg boxarg Delete              Deletes the highlighted text.
  8105.                  Arg linearg Delete             deleted text is placed into th
  8106.                  Arg streamarg Delete
  8107.  
  8108.  Function
  8109.  (and Default
  8110.  Keysrokes)      Syntax                         Description
  8111.  
  8112. 
  8113.                  Arg Meta Delete                Performs the deletions as desc
  8114.                  Arg boxarg Meta Delete         except the deleted text is not
  8115.                  Arg linearg Meta Delete        Clipboard.
  8116.                  Arg streamarg Meta Delete
  8117.  
  8118.  Down            Down                           Moves the cursor down one line
  8119.  (DOWN or                                       result in the cursor moving ou
  8120.  CTRL+X)                                        the window is adjusted downwar
  8121.                                                 of lines specified by the vscr
  8122.                                                 less if in a small window.
  8123.  
  8124.                  Meta Down                      Moves the cursor to the bottom
  8125.                                                 without changing the column po
  8126.  
  8127.  Emacscdel       Emacscdel                      Performs similarly to Cdelete,
  8128.  (BKSP)                                         the beginning of a line while
  8129.  Function
  8130.  (and Default
  8131.  Keysrokes)      Syntax                         Description
  8132.  
  8133. (BKSP)                                         the beginning of a line while
  8134.                                                 Emacscdel deletes the line bre
  8135.                                                 current line and the previous
  8136.                                                 the two lines together.
  8137.  
  8138.  Emacsnewl       Emacsnewl                      Performs similarly to Newline,
  8139.  (ENTER)                                        when in insert mode, it breaks
  8140.                                                 line at the cursor position.
  8141.  
  8142.  Endfile         Endfile                        Places the cursor at the end o
  8143.  (CTRL+PGDN)
  8144.  
  8145.  Endline         Endline                        Moves the cursor to the immedi
  8146.  (END)                                          last nonblank character on the
  8147.  
  8148.                  Meta Endline                   Moves the cursor one character
  8149.                                                 column corresponding to the ri
  8150.  Function
  8151.  (and Default
  8152.  Keysrokes)      Syntax                         Description
  8153.  
  8154.                                                column corresponding to the ri
  8155.                                                 the window.
  8156.  
  8157.  Environment     Environment                    Executes the current line as a
  8158.                                                 environment-variable setting.
  8159.                                                 assume the current line contai
  8160.                                                 text:
  8161.  
  8162.                                                 PATH=C:\BIN;C:\DOS
  8163.  
  8164.                                                 The editor responds by adding
  8165.                                                 the operating system environme
  8166.                                                 function is essentially the sa
  8167.                                                 system-level SET command. The
  8168.                                                 recognizes the setting during
  8169.                                                 editing session, but the setti
  8170.                                                 you exit the editor.
  8171.  Function
  8172.  (and Default
  8173.  Keysrokes)      Syntax                         Description
  8174.  
  8175.                                                you exit the editor.
  8176.  
  8177.                  Arg boxarg Environment         Executes each highlighted line
  8178.                  Arg linearg Environment        fragment as an environment-
  8179.                                                 variable setting.
  8180.  
  8181.                  Arg textarg Environment        Executes the text argument as
  8182.                                                 environment-variable setting.
  8183.  
  8184.                  Arg ? Environment              Displays all current environme
  8185.                                                 settings.
  8186.  
  8187.                  Meta Environment               Performs environment "mappings
  8188.                                                 environment variables found on
  8189.                                                 line, whenever the variable ap
  8190.                                                 following
  8191.                                                 syntax:
  8192.  Function
  8193.  (and Default
  8194.  Keysrokes)      Syntax                         Description
  8195.  
  8196.                                                syntax:
  8197.  
  8198.                                                 $(environment-variable)
  8199.  
  8200.                                                 For each such environment vari
  8201.                                                 on the line, the editor replac
  8202.                                                 with the corresponding setting
  8203.                                                 example, if PATH is set to C:\
  8204.                                                 replaces each occurrence of th
  8205.                                                 with the text C:\BIN.
  8206.  
  8207.                  Arg Meta Environment           Performs environment mappings
  8208.                                                 above) for all text from the c
  8209.                                                 to the end of line.
  8210.  
  8211.                  Arg linearg Meta Environment   Performs environment mappings
  8212.                  Arg boxarg Meta Environment    above) for all highlighted tex
  8213.  Function
  8214.  (and Default
  8215.  Keysrokes)      Syntax                         Description
  8216.  
  8217.                 Arg boxarg Meta Environment    above) for all highlighted tex
  8218.                  Arg streamarg Meta Environment
  8219.  
  8220.  Execute         Arg Execute                    Treats the line from the initi
  8221.  (F7)                                           position to the end as a serie
  8222.                                                 Microsoft Editor commands and
  8223.  
  8224.                  Arg linearg Execute            Treats the specified text as M
  8225.                  Arg textarg Execute            commands and executes them, fo
  8226.                                                 standard rules of macro execut
  8227.  
  8228.  Exit            Exit                           Saves the current file. If mul
  8229.  (F8)                                           specified on the command line,
  8230.                                                 advances to the next file. Oth
  8231.                                                 editor quits and returns contr
  8232.                                                 operating system.
  8233.  
  8234.  Function
  8235.  (and Default
  8236.  Keysrokes)      Syntax                         Description
  8237.  
  8238. 
  8239.                  Meta Exit                      Performs similarly to Exit, ex
  8240.                                                 current file is not saved.
  8241.  
  8242.                  Arg Exit                       Performs similarly to Exit, ex
  8243.                                                 multiple files are specified o
  8244.                                                 line, the editor exits without
  8245.                                                 the next file.
  8246.  
  8247.                  Arg Meta Exit                  Performs similarly to Arg Exit
  8248.                                                 the editor does not save the c
  8249.  
  8250.  Home            Home                           Places the cursor in the upper
  8251.  (CTRL+HOME)                                    the current window.
  8252.  
  8253.  Information     Information                    Saves the current file and loa
  8254.  (F10)                                          information file that contains
  8255.  Function
  8256.  (and Default
  8257.  Keysrokes)      Syntax                         Description
  8258.  
  8259. (F10)                                          information file that contains
  8260.                                                 files in memory along with the
  8261.                                                 files that you have edited. Th
  8262.                                                 list is con-trolled by the tmp
  8263.                                                 which has a default value of 2
  8264.  
  8265.  Initialize      Initialize                     Reads all the editor statement
  8266.  (SHIFT+F8)                                     section of TOOLS.INI.
  8267.  
  8268.                  Arg Initialize                 Reads the editor statements fr
  8269.                                                 file, using the continuous str
  8270.                                                 characters, starting with the
  8271.                                                 position, as the tag name.
  8272.  
  8273.                  Arg textarg Initialize         Reads all the editor statement
  8274.                                                 [M-textarg] section of TOOLS.I
  8275.  
  8276.  Function
  8277.  (and Default
  8278.  Keysrokes)      Syntax                         Description
  8279.  
  8280. 
  8281.  Insert          Insert                         Inserts a single blank space a
  8282.                                                 cursor position.
  8283.  
  8284.                  Arg Insert                     Inserts a carriage return at t
  8285.                                                 cursor position, splitting the
  8286.  
  8287.                  Arg streamarg Insert           Inserts blank spaces into the
  8288.                  Arg linearg Insert             area.
  8289.                  Arg boxarg Insert
  8290.  
  8291.  Insertmode      Insertmode                     Toggles between insert mode an
  8292.  (INS or                                        If insert mode is on, insert a
  8293.  CTRL+V)                                        status line. While in insert m
  8294.                                                 character that is entered is i
  8295.                                                 cursor position, shifting the
  8296.                                                 line one position to the right
  8297.  Function
  8298.  (and Default
  8299.  Keysrokes)      Syntax                         Description
  8300.  
  8301.                                                line one position to the right
  8302.                                                 replaces the character at the
  8303.                                                 with the character you type.
  8304.  
  8305.  Lastselect      Lastselect                     Recalls the last cursor-moveme
  8306.  (CTRL+U)                                       This function produces the sam
  8307.                                                 returning to the last Arg posi
  8308.                                                 the Arg function, and then rec
  8309.                                                 cursor-movement argument.
  8310.  
  8311.  Lasttext        Lasttext                       Recalls the last textarg. This
  8312.  (CTRL+O)                                       produces the same result as in
  8313.                                                 function and then retyping the
  8314.                                                 textarg.
  8315.  
  8316.  Ldelete         Ldelete                        Deletes the current line and p
  8317.  (CTRL+Y)                                       the Clipboard.
  8318.  Function
  8319.  (and Default
  8320.  Keysrokes)      Syntax                         Description
  8321.  
  8322. (CTRL+Y)                                       the Clipboard.
  8323.  
  8324.                  Arg Ldelete                    Deletes text, starting with th
  8325.                                                 position through the end of th
  8326.                                                 places it into the Clipboard.
  8327.                                                 does not join the current line
  8328.                                                 line.
  8329.  
  8330.                  Arg boxarg Ldelete             Deletes the specified text fro
  8331.                  Arg linearg Ldelete            places it into the Clipboard,
  8332.                                                 argument as a linearg or boxar
  8333.                                                 what mode the editor is in.
  8334.  
  8335.  Left            Left                           Moves the cursor one character
  8336.  (LEFT or                                       this would result in the curso
  8337.  CTRL+S)                                        the window, the window is adju
  8338.                                                 by the number of columns speci
  8339.  Function
  8340.  (and Default
  8341.  Keysrokes)      Syntax                         Description
  8342.  
  8343.                                                by the number of columns speci
  8344.                                                 hscroll switch or less if in a
  8345.  
  8346.                  Meta Left                      Moves the cursor to the left-m
  8347.                                                 the window on the same line.
  8348.  
  8349.  Linsert         Linsert                        Inserts one blank line above t
  8350.  (CTRL+N)
  8351.  
  8352.                  Arg Linsert                    Inserts or deletes blanks at t
  8353.                                                 a line to make the first nonbl
  8354.                                                 appear under the cursor.
  8355.  
  8356.                  Arg boxarg Linsert             Fills the specified area with
  8357.                  Arg linearg Linsert            the argument as a linearg or b
  8358.                                                 of the editor's mode.
  8359.  
  8360.  Function
  8361.  (and Default
  8362.  Keysrokes)      Syntax                         Description
  8363.  
  8364. 
  8365.  Mark            Mark                           Moves the window to the beginn
  8366.  (CTRL+M)
  8367.  
  8368.                  Arg Mark                       Restores the window to its pre
  8369.                                                 The editor remembers only the
  8370.                                                 to the last scrolling operatio
  8371.  
  8372.                  Arg numarg Mark                Moves the cursor to the beginn
  8373.                                                 where numarg specifies the pos
  8374.                                                 line in the file.
  8375.  
  8376.                  Arg textarg Mark               Moves the cursor to the specif
  8377.                                                 If the file marker was not pre
  8378.                                                 the editor uses the markfile s
  8379.                                                 the file that contains file ma
  8380.                                                 definitions.
  8381.  Function
  8382.  (and Default
  8383.  Keysrokes)      Syntax                         Description
  8384.  
  8385.                                                definitions.
  8386.  
  8387.                  Arg Arg textarg Mark           Deletes a marker definition.
  8388.  
  8389.                  Arg Arg textarg Meta Mark      Defines a file marker at the i
  8390.                                                 position. This does not record
  8391.                                                 in the file specified by the m
  8392.                                                 but allows you to refer to thi
  8393.                                                 textarg.
  8394.  
  8395.  Message         Message                        Clears the dialog line.
  8396.  
  8397.                  Arg textarg Message            Prints the text argument on th
  8398.  
  8399.  Meta            Meta                           Modifies the action of the fun
  8400.  (F9)                                           with. Refer to the individual
  8401.                                                 specific information.
  8402.  Function
  8403.  (and Default
  8404.  Keysrokes)      Syntax                         Description
  8405.  
  8406.                                                specific information.
  8407.  
  8408.  Mgrep           Mgrep                          Searches for the previously de
  8409.                                                 pattern. The editor searches a
  8410.                                                 in the mgreplist macro, which
  8411.                                                 wildcards and environment vari
  8412.                                                 following example:
  8413.  
  8414.                                                 megreplist:="DATA.FIL *.FOR  $
  8415.  
  8416.                                                 The editor places all strings
  8417.                                                 <compile> pseudo file.
  8418.  
  8419.                  Arg Mgrep                      Searches files for the string
  8420.                                                 characters from the initial cu
  8421.                                                 the first blank character.
  8422.  
  8423.  Function
  8424.  (and Default
  8425.  Keysrokes)      Syntax                         Description
  8426.  
  8427. 
  8428.                  Arg textarg Mgrep              Searches files for the specifi
  8429.  
  8430.                  Arg Arg Mgrep                  Searches files for the regular
  8431.                                                 defined as the characters from
  8432.                                                 cursor position to the first b
  8433.  
  8434.                  Arg Arg textarg Mgrep          Searches files for a regular e
  8435.                                                 defined by textarg.
  8436.  
  8437.                  Meta Mgrep                     Performs similarly to command
  8438.                  Arg Meta Mgrep                 except that value of the case
  8439.                  Arg textarg Meta Mgrep         temporarily reversed.
  8440.                  Arg Arg Meta Mgrep
  8441.                  Arg Arg textarg Meta Mgrep
  8442.  
  8443.  Mlines          Mlines                         Moves the window back by the n
  8444.  Function
  8445.  (and Default
  8446.  Keysrokes)      Syntax                         Description
  8447.  
  8448. Mlines          Mlines                         Moves the window back by the n
  8449.  (CTRL+W)                                       specified by the vscroll switc
  8450.                                                 a small window.
  8451.  
  8452.                  Arg Mlines                     Moves the window until the lin
  8453.                                                 cursor is on is at the bottom
  8454.  
  8455.                  Arg numarg Mlines              Moves the window back by the s
  8456.                                                 of lines.
  8457.  
  8458.  Mpage           Mpage                          Moves the window backward in t
  8459.  (PGUP or                                       window's worth of lines.
  8460.  CTRL+R)
  8461.  
  8462.  Mpara           Mpara                          Moves the cursor to the first
  8463.                                                 preceding the current paragrap
  8464.                                                 currently on a blank line, the
  8465.  Function
  8466.  (and Default
  8467.  Keysrokes)      Syntax                         Description
  8468.  
  8469.                                                currently on a blank line, the
  8470.                                                 positioned before the previous
  8471.  
  8472.                  Meta Mpara                     Moves the cursor to the first
  8473.                                                 that has text.
  8474.  
  8475.  Mreplace        Mreplace                       Performs a simple search-and-
  8476.                                                 replace operation, prompting y
  8477.                                                 search and replacement strings
  8478.                                                 at each occurrence for confirm
  8479.                                                 function searches all the file
  8480.                                                 mgreplist macro, which can con
  8481.                                                 wildcards and environment vari
  8482.                                                 following example:
  8483.  
  8484.                                                 megreplist:="DATA.FIL *.FOR
  8485.  
  8486.  Function
  8487.  (and Default
  8488.  Keysrokes)      Syntax                         Description
  8489.  
  8490. 
  8491.                  Arg Arg Mreplace               Performs the same action as
  8492.                                                 Mreplace, but uses regular-
  8493.                                                 expression syntax.
  8494.  
  8495.  Msearch         Msearch                        Searches backward for the prev
  8496.  (F4)                                           string or pattern. If the stri
  8497.                                                 found, the window is moved to
  8498.                                                 the matched string or pattern
  8499.                                                 If no match is found, no curso
  8500.                                                 place and a message is display
  8501.  
  8502.                  Arg Msearch                    Searches backward in the file
  8503.                                                 defined as the characters from
  8504.                                                 cursor position to the first b
  8505.  
  8506.                  Arg textarg Msearch            Searches backward for the spec
  8507.  Function
  8508.  (and Default
  8509.  Keysrokes)      Syntax                         Description
  8510.  
  8511.                 Arg textarg Msearch            Searches backward for the spec
  8512.  
  8513.                  Arg Arg Msearch                Searches backward in the file
  8514.                                                 expression defined as the char
  8515.                                                 initial cursor position to the
  8516.                                                 character.
  8517.  
  8518.                  Arg Arg textarg Msearch        Searches backward for a regula
  8519.                                                 defined by textarg.
  8520.  
  8521.                  Meta Msearch                   Performs similarly to command
  8522.                  Arg Meta Msearch               except that value of the case
  8523.                  Arg textarg Meta Msearch       temporarily reversed.
  8524.                  Arg Arg Meta Msearch
  8525.                  Arg Arg textarg Meta Msearch
  8526.  
  8527.  Mword           Mword                          Moves the cursor to the beginn
  8528.  Function
  8529.  (and Default
  8530.  Keysrokes)      Syntax                         Description
  8531.  
  8532. Mword           Mword                          Moves the cursor to the beginn
  8533.  (CTRL+LEFT                                     If not in a word or at the fir
  8534.  or CTRL+A)                                     uses the previous word; otherw
  8535.                                                 current word.
  8536.  
  8537.                  Meta Mword                     Moves the cursor to the immedi
  8538.                                                 previous word.
  8539.  
  8540.  Newline         Newline                        Moves the cursor to a new line
  8541.                                                 switch is set, the editor trie
  8542.                                                 cursor in an appropriate posit
  8543.                                                 type of file. If the file is a
  8544.                                                 editor tries to tab in based o
  8545.                                                 of lines and on open blocks. I
  8546.                                                 is blank, the editor places th
  8547.                                                 column corresponding to the fi
  8548.                                                 character of the previous line
  8549.  Function
  8550.  (and Default
  8551.  Keysrokes)      Syntax                         Description
  8552.  
  8553.                                                character of the previous line
  8554.                                                 the above is true, the editor
  8555.                                                 cursor on the first nonblank c
  8556.                                                 line.
  8557.  
  8558.                  Meta Newline                   Moves the cursor to column 1 o
  8559.  
  8560.  Nextmsg         Nextmsg                        Advances to next error message
  8561.  (SHIFT+F3)
  8562.  
  8563.                  Arg numarg Nextmsg             Moves forward or backward numa
  8564.                                                 messages. A numarg value of 1
  8565.                                                 message; a value of -1 moves t
  8566.                                                 message.
  8567.  
  8568.                  Arg Nextmsg                    Moves to the next error messag
  8569.                                                 current set of messages) that
  8570.  Function
  8571.  (and Default
  8572.  Keysrokes)      Syntax                         Description
  8573.  
  8574.                                                current set of messages) that
  8575.                                                 to current file.
  8576.  
  8577.                  Arg Arg Nextmsg                Positions the text-file cursor
  8578.                                                 with the error described in th
  8579.                                                 at the current cursor position
  8580.                                                 <compile> pseudo file. This me
  8581.                                                 the current error message. The
  8582.                                                 Nextmsg command displays the n
  8583.                                                 message from the <compile> pse
  8584.  
  8585.                  Meta Nextmsg                   OS/2 only. Advance to next "se
  8586.                                                 messages, in which a set corre
  8587.                                                 the error messages for a singl
  8588.                                                 After executing this command,
  8589.                                                 is deleted (though you can sti
  8590.                                                 subsequent sets of error messa
  8591.  Function
  8592.  (and Default
  8593.  Keysrokes)      Syntax                         Description
  8594.  
  8595.                                                subsequent sets of error messa
  8596.                                                 <compile> pseudo file, until d
  8597.  
  8598.  Noedit          Noedit                         Reverses the no-edit condition
  8599.                                                 editor was started with the /R
  8600.                                                 option, this command removes t
  8601.                                                 limitation. If the editor is n
  8602.                                                 no-edit state, this command di
  8603.                                                 editing commands that alter a
  8604.  
  8605.                  Meta Noedit                    Reverses the no-edit condition
  8606.                                                 file.
  8607.  
  8608.  Paste           Paste                          Inserts the contents of the Cl
  8609.  (SHIFT+INS)                                    the current line if the conten
  8610.                                                 there in a line-oriented way,
  8611.                                                 linearg or numarg. Otherwise,
  8612.  Function
  8613.  (and Default
  8614.  Keysrokes)      Syntax                         Description
  8615.  
  8616.                                                linearg or numarg. Otherwise,
  8617.                                                 the Clipboard are inserted at
  8618.                                                 cursor position.
  8619.  
  8620.                  Arg Paste                      Inserts the text from the init
  8621.                                                 position to the end of the lin
  8622.                                                 cursor position.
  8623.  
  8624.                  Arg textarg Paste              Places the specified text into
  8625.                                                 and inserts that text at the i
  8626.                                                 position.
  8627.  
  8628.                  Arg Arg textarg Paste          Interprets textarg as a file n
  8629.                                                 and inserts the contents of th
  8630.                                                 current file above the current
  8631.  
  8632.                  Arg Arg !textarg Paste         Treats the text as a DOS comma
  8633.  Function
  8634.  (and Default
  8635.  Keysrokes)      Syntax                         Description
  8636.  
  8637.                 Arg Arg !textarg Paste         Treats the text as a DOS comma
  8638.                                                 its output to stdout into the
  8639.                                                 the initial cursor position. T
  8640.                                                 mark must be entered as shown.
  8641.  
  8642.  Pbal            Pbal                           Scans backward through the fil
  8643.  (CTRL+[)                                       parentheses and brackets. The
  8644.                                                 one is highlighted when found.
  8645.                                                 and is not visible, the editor
  8646.                                                 matching line on the dialog li
  8647.                                                 highlighted matching character
  8648.                                                 corresponding character is pla
  8649.                                                 file at the current cursor pos
  8650.                                                 that the search does not inclu
  8651.                                                 cursor position and that the s
  8652.                                                 for more left brackets or pare
  8653.                                                 right, not just an unequal amo
  8654.  Function
  8655.  (and Default
  8656.  Keysrokes)      Syntax                         Description
  8657.  
  8658.                                                right, not just an unequal amo
  8659.  
  8660.                  Arg Pbal                       Performs similarly to Pbal exc
  8661.                                                 scans forward in the file and
  8662.                                                 right brackets or parentheses
  8663.  
  8664.                  Meta Pbal                      Performs similarly to Pbal exc
  8665.                                                 file is not updated.
  8666.  
  8667.                  Arg Meta Pbal                  Performs similarly to Arg Pbal
  8668.                                                 file is not updated.
  8669.  
  8670.  Plines          Plines                         Adjusts the window forward by
  8671.  (CTRL+Z)                                       lines specified by the vscroll
  8672.                                                 if in a small window.
  8673.  
  8674.                  Arg Plines                     Moves the window downward so t
  8675.  Function
  8676.  (and Default
  8677.  Keysrokes)      Syntax                         Description
  8678.  
  8679.                 Arg Plines                     Moves the window downward so t
  8680.                                                 cursor is on is at the top of
  8681.  
  8682.                  Arg numarg Plines              Moves the window forward the s
  8683.                                                 of lines.
  8684.  
  8685.  Ppage           Ppage                          Moves the window forward in th
  8686.  (PGDN or                                       window's worth of lines.
  8687.  CTRL+C)
  8688.  
  8689.  Ppara           Ppara                          Moves the cursor forward one p
  8690.                                                 places the cursor on the first
  8691.                                                 paragraph.
  8692.  
  8693.                  Meta Ppara                     Moves the cursor to the first
  8694.                                                 following the current paragrap
  8695.  
  8696.  Function
  8697.  (and Default
  8698.  Keysrokes)      Syntax                         Description
  8699.  
  8700. 
  8701.  Print           Print                          Prints the current file. If th
  8702.  (CTRL+F8)                                      switch is set, this function u
  8703.                                                 system-level command given in
  8704.                                                 Otherwise, the function copies
  8705.  
  8706.                  Arg textarg Print              Prints all the files listed in
  8707.                                                 argument. File names should be
  8708.                                                 with a space.
  8709.  
  8710.                  Arg linearg Print              Prints the highlighted area.
  8711.                  Arg boxarg Print
  8712.                  Arg streamarg Print
  8713.  
  8714.  Psearch         Psearch                        Searches forward for the previ
  8715.  (F3)                                           string or pattern. If the stri
  8716.                                                 found, the window is moved to
  8717.  Function
  8718.  (and Default
  8719.  Keysrokes)      Syntax                         Description
  8720.  
  8721.                                                found, the window is moved to
  8722.                                                 the matched string or pattern
  8723.                                                 If it is not found, no cursor
  8724.                                                 place and a message is display
  8725.  
  8726.                  Arg Psearch                    Searches forward in the file f
  8727.                                                 defined as the characters from
  8728.                                                 cursor position to the first b
  8729.  
  8730.                  Arg textarg Psearch            Searches forward for the speci
  8731.  
  8732.                  Arg Arg Psearch                Searches forward in the file f
  8733.                                                 expression defined as the char
  8734.                                                 initial cursor position to the
  8735.                                                 character.
  8736.  
  8737.                  Arg Arg textarg Psearch        Searches forward for a regular
  8738.  Function
  8739.  (and Default
  8740.  Keysrokes)      Syntax                         Description
  8741.  
  8742.                 Arg Arg textarg Psearch        Searches forward for a regular
  8743.                                                 defined by textarg.
  8744.  
  8745.                  Meta Psearch                   Performs similarly to command
  8746.                  Arg Meta Psearch               except that value of the case
  8747.                  Arg textarg Meta Psearch       temporarily reversed.
  8748.                  Arg Arg Meta Psearch
  8749.                  Arg Arg textarg Meta Psearch
  8750.  
  8751.  Pword           Pword                          Moves the cursor forward one w
  8752.  (CTRL+RIGHT                                    the cursor on the beginning of
  8753.  or CTRL+F)
  8754.  
  8755.                  Meta Pword                     Moves cursor to immediate righ
  8756.                                                 word or, if not in a word, to
  8757.                                                 next word.
  8758.  
  8759.  Function
  8760.  (and Default
  8761.  Keysrokes)      Syntax                         Description
  8762.  
  8763. 
  8764.  Qreplace        Qreplace                       Performs a simple search-and-
  8765.  (CTRL+\)                                       replace operation, prompting y
  8766.                                                 search and replacement strings
  8767.                                                 at each occurrence for confirm
  8768.                                                 search begins at the cursor po
  8769.                                                 continues through the end of t
  8770.  
  8771.                  Arg boxarg Qreplace            Perform the search-and-replace
  8772.                  Arg linearg Qreplace           the highlighted area, promptin
  8773.                  Arg streamarg Qreplace         occurrence for confirmation.
  8774.  
  8775.                  Arg markarg Qreplace           Performs the search-and-replac
  8776.                                                 between the initial cursor pos
  8777.                                                 specified file marker, prompti
  8778.                                                 occurrence for confirmation.
  8779.  
  8780.  Function
  8781.  (and Default
  8782.  Keysrokes)      Syntax                         Description
  8783.  
  8784. 
  8785.                  Arg numarg Qreplace            Performs the search-and-replac
  8786.                                                 the specified number of lines,
  8787.                                                 the current line, prompting at
  8788.                                                 for confirmation.
  8789.  
  8790.                  Arg Arg Qreplace               Performs the same as the corre
  8791.                  Arg Arg boxarg Qreplace        listed above, except that the
  8792.                  Arg Arg linearg Qreplace       is a regular expression and th
  8793.                  Arg Arg streamarg Qreplace     pattern can select special tag
  8794.                  Arg Arg markarg Qreplace       the search for selective repla
  8795.                  Arg Arg numarg Qreplace        Chapter 5 for more informatio
  8796.  
  8797.  
  8798.  Quote           Quote                          Reads one keystroke from the k
  8799.  (CTRL+P)                                       treats it literally. This is u
  8800.                                                 inserting text into a file tha
  8801.  Function
  8802.  (and Default
  8803.  Keysrokes)      Syntax                         Description
  8804.  
  8805.                                                inserting text into a file tha
  8806.                                                 assigned to an editor function
  8807.  
  8808.  Record          Record                         Turns on macro recording if of
  8809.  (ALT+R)                                        on. When a recording is stoppe
  8810.                                                 assigns all the recorded comma
  8811.                                                 default macro name recordvalue
  8812.                                                 recording, the name of each co
  8813.                                                 to the <record> pseudo file, w
  8814.                                                 placed in a window and viewed
  8815.                                                 dynamically updated.
  8816.  
  8817.                  Arg textarg Record             Turns on macro recording if of
  8818.                                                 recording the name specified i
  8819.                                                 argument or turns recording of
  8820.  
  8821.                  Meta Record                    Turns recording on if recordin
  8822.  Function
  8823.  (and Default
  8824.  Keysrokes)      Syntax                         Description
  8825.  
  8826.                 Meta Record                    Turns recording on if recordin
  8827.                                                 but no editing commands are ex
  8828.                                                 recording is turned off. Turns
  8829.                                                 if it is on.
  8830.  
  8831.                  Arg Arg Record                 Performs identically to the co
  8832.                  Arg Arg textarg Record         command listed above, but if t
  8833.                  Arg Arg Meta Record            already exists, editing comman
  8834.                                                 to the end of the macro.
  8835.  
  8836.  Refresh         Refresh                        Asks for confirmation and then
  8837.  (SHIFT+F7)                                     file from disk, discarding all
  8838.                                                 file was last saved.
  8839.  
  8840.                  Arg Refresh                    Asks for confirmation and then
  8841.                                                 file from memory, loading the
  8842.                                                 in its place.
  8843.  Function
  8844.  (and Default
  8845.  Keysrokes)      Syntax                         Description
  8846.  
  8847.                                                in its place.
  8848.  
  8849.  Repeat          Repeat                         Repeats the last editing comma
  8850.                                                 precisely the same arguments a
  8851.                                                 condition used by the last com
  8852.                                                 the command is executed relati
  8853.                                                 cursor position. (Note: if the
  8854.                                                 command had a cursor-movement
  8855.                                                 text actually high-lighted is
  8856.                                                 argument.)
  8857.  
  8858.  Replace         Replace                        Performs a simple search-and-
  8859.  (CTRL+L)                                       replace operation without conf
  8860.                                                 prompting you for the search s
  8861.                                                 replacement string. The search
  8862.                                                 the cursor position and contin
  8863.                                                 the end of the file.
  8864.  Function
  8865.  (and Default
  8866.  Keysrokes)      Syntax                         Description
  8867.  
  8868.                                                the end of the file.
  8869.  
  8870.                  Arg boxarg Replace             Performs the search-and-replac
  8871.                  Arg linearg Replace            the highlighted area.
  8872.                  Arg streamarg Replace
  8873.  
  8874.                  Arg markarg Replace            Performs the search-and-replac
  8875.                                                 between the cursor and the spe
  8876.                                                 marker.
  8877.  
  8878.                  Arg numarg Replace             Performs the search-and-replac
  8879.                                                 the specified number of lines,
  8880.                                                 the current line.
  8881.  
  8882.                  Arg Arg Replace                Performs the same as the corre
  8883.                  Arg Arg boxarg Replace         listed above except that the s
  8884.                  Arg Arg linearg Replace        a regular expression and the r
  8885.  Function
  8886.  (and Default
  8887.  Keysrokes)      Syntax                         Description
  8888.  
  8889.                 Arg Arg linearg Replace        a regular expression and the r
  8890.                  Arg Arg streamarg Replace      pattern can select special tag
  8891.                  Arg Arg markarg Replace        the search for selective repla
  8892.                  Arg Arg numarg Replace         Chapter 5 for more informatio
  8893.  
  8894.  
  8895.  Restcur         Restcur                        Restores the cursor position s
  8896.                                                 Savecur.
  8897.  
  8898.  Right (RIGHT    Right                          Moves the cursor one character
  8899.  or CTRL+D)                                     If this would result in the cu
  8900.                                                 of the window,  the window is
  8901.                                                 right the number of columns sp
  8902.                                                 hscroll switch or less if in a
  8903.  
  8904.                  Meta Right                     Moves the cursor to the right-
  8905.                                                 the window.
  8906.  Function
  8907.  (and Default
  8908.  Keysrokes)      Syntax                         Description
  8909.  
  8910.                                                the window.
  8911.  
  8912.  Saveall         Saveall                        Saves all files that have been
  8913.                                                 the current editing session wi
  8914.                                                 saved.
  8915.  
  8916.  Savecur         Savecur                        Saves the current cursor posit
  8917.                                                 restored with Restcur.
  8918.  
  8919.  Sdelete         Sdelete                        Deletes the single character u
  8920.  (DEL)                                          excluding line breaks. It does
  8921.                                                 deleted character into the Cli
  8922.                                                 command has the effect of join
  8923.  
  8924.                  Arg Sdelete                    Deletes from the current line
  8925.                                                 the cursor position. The text
  8926.                                                 (including the line break) is
  8927.  Function
  8928.  (and Default
  8929.  Keysrokes)      Syntax                         Description
  8930.  
  8931.                                                (including the line break) is
  8932.                                                 Clipboard.
  8933.  
  8934.                  Arg streamarg Sdelete          Deletes the stream of text fro
  8935.                                                 cursor position up to the curr
  8936.                                                 position and places it into th
  8937.  
  8938.  Searchall       Searchall                      Highlights all occurrences of
  8939.  (SHIFT+F6)                                     defined string or pattern. If
  8940.                                                 occurrence is found, the curso
  8941.                                                 first occurrence in the file.
  8942.  
  8943.                  Arg Searchall                  Highlights all occurrences of
  8944.                                                 defined as the characters from
  8945.                                                 cursor position to the first b
  8946.  
  8947.                  Arg textarg Searchall          Highlights all occurrences of
  8948.  Function
  8949.  (and Default
  8950.  Keysrokes)      Syntax                         Description
  8951.  
  8952.                 Arg textarg Searchall          Highlights all occurrences of
  8953.                                                 text.
  8954.  
  8955.                  Arg Arg Searchall              Highlights all occurrences of
  8956.                                                 expression defined as the char
  8957.                                                 the initial cursor position to
  8958.                                                 character.
  8959.  
  8960.                  Arg Arg textarg Searchall      Highlights all occurrences of
  8961.                                                 expression as defined by texta
  8962.  
  8963.                  Meta Searchall                 Performs similarly to command
  8964.                  Arg Meta Searchall             except that the value of the c
  8965.                  Arg textarg Meta Searchall     temporarily reversed.
  8966.                  Arg Arg Meta Searchall
  8967.                  Arg Arg textarg Meta Searchall
  8968.  
  8969.  Function
  8970.  (and Default
  8971.  Keysrokes)      Syntax                         Description
  8972.  
  8973. 
  8974.  Setfile         Setfile                        Switches to the most recently
  8975.  (F2)                                           saving any changes made to the
  8976.                                                 disk.
  8977.  
  8978.                  Arg Setfile                    Switches to the file name that
  8979.                                                 initial cursor position and en
  8980.                                                 first blank.
  8981.  
  8982.                  Arg textarg Setfile            Switches to the file specified
  8983.                                                 text argument may be a drive o
  8984.                                                 which case the editor changes
  8985.                                                 drive or directory.
  8986.  
  8987.                  Meta Setfile                   Performs similarly to the corr
  8988.                  Arg Meta Setfile               command listed above, but disa
  8989.                  Arg textarg Meta Setfile       of changes for the current fil
  8990.  Function
  8991.  (and Default
  8992.  Keysrokes)      Syntax                         Description
  8993.  
  8994.                 Arg textarg Meta Setfile       of changes for the current fil
  8995.  
  8996.                  Arg Arg textarg Setfile        Saves the current file under t
  8997.                                                 specified by textarg.
  8998.  
  8999.                  Arg Arg Setfile                Saves the current file.
  9000.  
  9001.  Setwindow       Setwindow                      Redisplays the entire screen.
  9002.  (CTRL+])
  9003.  
  9004.                  Arg Setwindow                  Adjusts the window so that the
  9005.                                                 position becomes the home posi
  9006.                                                 corner).
  9007.  
  9008.                  Meta Setwindow                 Redisplays the current line.
  9009.  
  9010.  Shell           Shell                          Saves the current file and run
  9011.  Function
  9012.  (and Default
  9013.  Keysrokes)      Syntax                         Description
  9014.  
  9015. Shell           Shell                          Saves the current file and run
  9016.  (SHIFT+F9)                                     shell.
  9017.  
  9018.                  Meta Shell                     Runs the command shell without
  9019.                                                 current file.
  9020.  
  9021.                  Arg Shell                      Uses the text on the screen fr
  9022.                                                 to the end of line as a comman
  9023.  
  9024.                  Arg boxarg Shell               Treats each line of either arg
  9025.                  Arg linearg Shell              separate command to the shell
  9026.  
  9027.                  Arg textarg Shell              Uses textarg as a command to t
  9028.  
  9029.  Sinsert         Sinsert                        Inserts a single blank space a
  9030.  (CTRL+J)                                       cursor position.
  9031.  
  9032.  Function
  9033.  (and Default
  9034.  Keysrokes)      Syntax                         Description
  9035.  
  9036. 
  9037.                  Arg Sinsert                    Inserts a carriage return at t
  9038.                                                 cursor position, splitting the
  9039.  
  9040.                  Arg streamarg Sinsert          Insert a stream of blanks betw
  9041.                                                 cursor position and the curren
  9042.                                                 position.
  9043.  
  9044.  Tab             Tab                            Moves the cursor to the next t
  9045.  (TAB)                                          stops are defined to be every
  9046.                                                 where n is defined by the tabs
  9047.  
  9048.  Tell            Tell                           Prompts for a keystroke, then
  9049.  (CTRL+T)                                       name of the keystroke and the
  9050.                                                 assigned to it in the format f
  9051.  
  9052.                  Arg Tell                       Identical to Tell, but if the
  9053.  Function
  9054.  (and Default
  9055.  Keysrokes)      Syntax                         Description
  9056.  
  9057.                 Arg Tell                       Identical to Tell, but if the
  9058.                                                 attached, displays
  9059.                                                 MacroName:=MacroValue.
  9060.  
  9061.                  Arg Arg Tell                   Prompts for a keystroke, then
  9062.                                                 value of the macro attached to
  9063.                                                 function is assigned to the ke
  9064.                                                 displays the name of the funct
  9065.  
  9066.                  Arg textarg Tell               Like Arg Tell but obtains the
  9067.                                                 a textarg rather than a keystr
  9068.  
  9069.                  Meta Tell                      Performs the same as the comma
  9070.                  Arg Meta Tell                  except the editor inserts the
  9071.                  Arg Arg Meta Tell              file rather than on the dialog
  9072.                  Arg textarg Meta Tell
  9073.  
  9074.  Function
  9075.  (and Default
  9076.  Keysrokes)      Syntax                         Description
  9077.  
  9078. 
  9079.  Undo            Undo                           Reverses the last editing chan
  9080.  (ALT+BKSP)                                     number of times this can be pe
  9081.                                                 by the undocount switch.
  9082.  
  9083.                  Meta Undo                      Recalls a command previously c
  9084.                                                 Undo. This command is often ca
  9085.  
  9086.  Up              Up                             Moves the cursor up one line.
  9087.  (UP or                                         result in the cursor moving ou
  9088.  CTRL+E)                                        the window is adjusted upward
  9089.                                                 lines specified by the vscroll
  9090.                                                 if in a small window.
  9091.  
  9092.                  Meta Up                        Moves the cursor to the top of
  9093.                                                 without changing the column po
  9094.  
  9095.  Function
  9096.  (and Default
  9097.  Keysrokes)      Syntax                         Description
  9098.  
  9099. 
  9100.  Window          Window                         Moves the cursor to the next w
  9101.  (F6)                                           multiple windows, the next win
  9102.                                                 as being to the right of or be
  9103.                                                 window.
  9104.  
  9105.                  Arg Window                     Splits the current window hori
  9106.                                                 initial cursor position. Note
  9107.                                                 must be at least five lines hi
  9108.  
  9109.                  Arg Arg Window                 Splits the current window vert
  9110.                                                 initial cursor position. Note
  9111.                                                 must be at least 10 columns wi
  9112.  
  9113.                  Meta Window                    Closes the window.
  9114.  
  9115.  
  9116.  A.4  Return Values of Editing Functions
  9117.  
  9118.  Table A.4 gives an alphabetical listing of editing functions along with the
  9119.  conditions under which each function returns TRUE or FALSE. These return
  9120.  values are useful in conditional macros.
  9121.  
  9122.  Table A.4  Editor Functions and Return Values
  9123. ╓┌─────────────────┌───────────────────────────┌─────────────────────────────╖
  9124.  Function          Returns TRUE               Returns FALSE
  9125.  
  9126.  Arg               Always                     Never
  9127.  
  9128.  Argcompile        Compile successful         Bad argument/compiler not found
  9129.  
  9130.  Assign            Assignment successful      Invalid assignment
  9131.  
  9132.  Backtab           Cursor moved               Cursor at left margin
  9133.  
  9134.  Begfile           Cursor moved               Cursor not moved
  9135.  
  9136.  Begline           Cursor moved               Cursor not moved
  9137.  Function          Returns TRUE               Returns FALSE
  9138.  
  9139. Begline           Cursor moved               Cursor not moved
  9140.  
  9141.  Boxstream         New mode is box mode       New mode is stream mode
  9142.  
  9143.  Cancel            Always                     Never
  9144.  
  9145.  Cdelete           Cursor moved               Cursor not moved
  9146.  
  9147.  Compile           Compilation                Compilation unsuccessfully
  9148.                    successfully initiated     initiated or background
  9149.                    or background              compilation not
  9150.                    compilation running        running
  9151.  
  9152.  Copy              Always                     Never
  9153.  
  9154.  Curdate           Date inserted              Insertion would make line
  9155.                                               too long
  9156.  
  9157.  Curday            Day inserted               Insertion would make line
  9158.  Function          Returns TRUE               Returns FALSE
  9159.  
  9160. Curday            Day inserted               Insertion would make line
  9161.                                               too long
  9162.  
  9163.  Curfile           File inserted              Insertion would make line
  9164.                                               too long
  9165.  
  9166.  Curfileext        File extension inserted    Insertion would make line
  9167.                                               too long
  9168.  
  9169.  Curfilenam        File name inserted         Insertion would make line
  9170.                                               too long
  9171.  
  9172.  Curtime           Time inserted              Insertion would make line
  9173.                                               too long
  9174.  
  9175.  Delete            Always                     Never
  9176.  
  9177.  Down              Cursor moved               Cursor not moved
  9178.  
  9179.  Function          Returns TRUE               Returns FALSE
  9180.  
  9181. 
  9182.  Emacscdel         Cursor moved               Cursor not moved
  9183.  
  9184.  Emacsnewl         Always                     Never
  9185.  
  9186.  Endfile           Cursor moved               Cursor not moved
  9187.  
  9188.  Endline           Cursor moved               Cursor not moved
  9189.  
  9190.  Environment       Successful set or map      Syntax error or line too long
  9191.  
  9192.  Execute           Last command successful    Last command failed
  9193.  
  9194.  Exit              No return condition        No return condition
  9195.  
  9196.  Graphic           Character inserted         Insertion would make line
  9197.                                                           too long
  9198.  
  9199.  Home              Cursor moved               Cursor not moved
  9200.  Function          Returns TRUE               Returns FALSE
  9201.  
  9202. Home              Cursor moved               Cursor not moved
  9203.  
  9204.  Information       Always                     Never
  9205.  
  9206.  Initialize        Found tagged section       Did not find tagged section in
  9207.                    in TOOLS.INI               TOOLS.INI
  9208.  
  9209.  Insert            Always                     Never
  9210.  
  9211.  Insertmode        Insert mode turned on      Insert mode turned off
  9212.  
  9213.  Lastselect        Selection recreated        Arg already selected
  9214.  
  9215.  Lasttext          Value of function          Bad argument
  9216.                    eventually executed
  9217.  
  9218.  Ldelete           Always                     Never
  9219.  
  9220.  Left              Cursor moved               Cursor not moved
  9221.  Function          Returns TRUE               Returns FALSE
  9222.  
  9223. Left              Cursor moved               Cursor not moved
  9224.  
  9225.  Linsert           Always                     Never
  9226.  
  9227.  Mark              Definition/move            Bad argument/not found
  9228.                    successful
  9229.  
  9230.  Message           Always                     Never
  9231.  
  9232.  Meta              Meta turned on             Meta turned off
  9233.  
  9234.  Mgrep             String found               String not found or specified,
  9235.                                               or search terminated by
  9236.                                               CTRL+BREAK, or background
  9237.                                               compilation in progress
  9238.  
  9239.  Mlines            Movement occurred          Bad argument
  9240.  
  9241.  Mpage             Movement occurred          Bad argument
  9242.  Function          Returns TRUE               Returns FALSE
  9243.  
  9244. Mpage             Movement occurred          Bad argument
  9245.  
  9246.  Mpara             String found               Bad argument/string not found
  9247.  
  9248.  Mreplace          Replacement successful     Replacement failed or was
  9249.                                               aborted
  9250.  
  9251.  Msearch
  9252.  
  9253.  Mword             Cursor moved               Cursor not moved
  9254.  
  9255.  Newline           Always                     Never
  9256.  
  9257.  Nextmsg           Message found              No more messages
  9258.  
  9259.  Noedit            File or editor in          File or editor is not in
  9260.                    no-edit state              no-edit state
  9261.  
  9262.  Paste             Almost always              Tried Arg Arg filename Paste
  9263.  Function          Returns TRUE               Returns FALSE
  9264.  
  9265. Paste             Almost always              Tried Arg Arg filename Paste
  9266.                                               and file didn't exist
  9267.  
  9268.  Pbal              Balance successful         Bad argument/not balanced
  9269.  
  9270.  Plines            Movement occurred          Bad argument
  9271.  
  9272.  Ppage             Cursor moved               Cursor not moved
  9273.  
  9274.  Ppara             Cursor moved               Cursor not moved
  9275.  
  9276.  Print             Print successfully         Could not start print job
  9277.                    submitted
  9278.  
  9279.  Psearch           String found               Bad argument/string not found
  9280.  
  9281.  Pword             Cursor moved               Cursor not moved
  9282.  
  9283.  Qreplace          At least one               String not found/invalid
  9284.  Function          Returns TRUE               Returns FALSE
  9285.  
  9286. Qreplace          At least one               String not found/invalid
  9287.                    replacement                pattern
  9288.  
  9289.  Quote             Almost always              Insertion would make line
  9290.                                               too long
  9291.  
  9292.  Record            Recording turned on        Recording turned off
  9293.  
  9294.  Refresh           File read in/deleted       Canceled, bad argument
  9295.  
  9296.  Repeat            Function repeated and      Function repeated and returned
  9297.                    returned TRUE              FALSE, or no function to repeat
  9298.  
  9299.  Replace           At least one               String not found/invalid
  9300.                    replacement                pattern
  9301.  
  9302.  Restcur           Position previously        Position not saved with
  9303.                    saved with Savecur         Savecur
  9304.  
  9305.  Function          Returns TRUE               Returns FALSE
  9306.  
  9307. 
  9308.  Right             Cursor over text of line   Cursor beyond end of line
  9309.  
  9310.  Saveall           Always                     Never
  9311.  
  9312.  Savecur           Always                     Never
  9313.  
  9314.  Sdelete           Always                     Never
  9315.  
  9316.  Searchall         Something found            Nothing found
  9317.  
  9318.  Setfile           File-switch successful     No alternate file, or current
  9319.                                               file needs to be saved and
  9320.                                               can't be
  9321.  
  9322.  Setwindow         Always                     Never
  9323.  
  9324.  Shell             Shell successful           Bad argument/program not found
  9325.  
  9326.  Function          Returns TRUE               Returns FALSE
  9327.  
  9328. 
  9329.  Sinsert           Always                     Never
  9330.  
  9331.  Tab               Cursor moved               Cursor not moved
  9332.  
  9333.  Tell              Key pressed has            Key pressed has no function
  9334.                    function assigned          assigned
  9335.  
  9336.  Undo              Almost always              If nothing to undo
  9337.  
  9338.  Up                Cursor moved               Cursor not moved
  9339.  
  9340.  Window            Successful split,          Any error
  9341.                    join, or move
  9342.  
  9343.  
  9344.  A.5  Editor Switches
  9345.  
  9346.  Table A.5 gives an alphabetical listing of editor switches along with
  9347.  descriptions and default values. The first word in each description
  9348.  identifies the switch as a text, numeric, or Boolean switch.
  9349.  
  9350.  Table A.5  Editor Switches
  9351. ╓┌─────────────────┌─────────────────────────────────────────────────────────╖
  9352.  Switch            Description (and Default Value)
  9353.  
  9354.  askexit           Boolean. Prompts for confirmation when you exit from the
  9355.                    editor. (Default value: No)
  9356.  
  9357.  askrtn            Boolean. Prompts you to press ENTER when returning from a
  9358.                    Shell command. (Default value: Yes)
  9359.  
  9360.  autosave          Boolean. Saves the current file whenever you switch away
  9361.                    from it. If this switch is off, contents of file buffer
  9362.                    are maintained, but subsequent actions, such as exiting,
  9363.                    may lose edits. (Default value: Yes)
  9364.  
  9365.  backup            Text. Determines what happens to the old copy of a file
  9366.                    when a new version is saved to disk. A value of none
  9367.                    specifies that no backup operation is to be performed; the
  9368.  Switch            Description (and Default Value)
  9369.  
  9370.                   specifies that no backup operation is to be performed; the
  9371.                    editor simply overwrites the old file. A value of undel
  9372.                    specifies that the old file is to be moved so that
  9373.                    UNDEL.EXE can retrieve it. A value of bak specifies that
  9374.                    the file name of the old version of the file will be
  9375.                    changed to .BAK. (Default value: bak)
  9376.  
  9377.  case              Boolean. Considers case to be significant for search and
  9378.                    replace operations. For example if case is on, the string
  9379.                    Procedure is not found as a match for the string
  9380.                    procedure. (Default value: No)
  9381.  
  9382.  displaycursor     Boolean. Shows a position on the status line in the
  9383.                    (row,column) format. When off, the position listed is that
  9384.                    of the upper-left corner. When on, the current cursor
  9385.                    position is given. (Default value: No)
  9386.  
  9387.  editreadonly      Boolean. Allows read-only files to be edited. If off, a
  9388.                    read-only file is marked no-edit in the editor. (Default
  9389.  Switch            Description (and Default Value)
  9390.  
  9391.                   read-only file is marked no-edit in the editor. (Default
  9392.                    value: Yes)
  9393.  
  9394.  entab             Numeric. Controls the degree to which the Microsoft Editor
  9395.                    converts multiple spaces to tabs when reading or writing a
  9396.                    file. A value of 0 means tabs are not used to represent
  9397.                    white space; 1 means all multiple spaces outside of quoted
  9398.                    strings are converted; 2 means all multiple spaces are
  9399.                    converted to tabs. (Default value: 1)
  9400.  
  9401.  enterinsmode      Boolean. Starts the editor up in insert mode instead of
  9402.                    overtype mode, or switches to insert mode in the middle of
  9403.                    an editing session. (Default value: No)
  9404.  
  9405.  errcolor          Numeric, using hexadecimal radix. Controls the color used
  9406.                    for error messages. The default is red text on a black
  9407.                    background. (Default value: 04)
  9408.  
  9409.  errprompt         Boolean. Controls the "Press any key" prompt. When On, the
  9410.  Switch            Description (and Default Value)
  9411.  
  9412. errprompt         Boolean. Controls the "Press any key" prompt. When On, the
  9413.                    editor stops at each error message and waits for a
  9414.                    keystroke. (Default value: Yes)
  9415.  
  9416.  extmake           Text. Associates a command line with a particular file
  9417.                    extension for use by the Compile function. The text after
  9418.                    the switch has this form:
  9419.  
  9420.                    extmake:extension commandline
  9421.  
  9422.                    Here, extension is the extension of the file to match, and
  9423.                    commandline is a command line to be executed. If there is
  9424.                    a %s in the command line, it is replaced with the name of
  9425.                    the current file or with the textarg in the Arg textarg
  9426.                    Compile command. This switch may appear more than once in
  9427.                    the TOOLS.INI file.
  9428.  
  9429.                    For example, you could have the following lines in
  9430.                    TOOLS.INI:
  9431.  Switch            Description (and Default Value)
  9432.  
  9433.                   TOOLS.INI:
  9434.  
  9435.                    extmake:bc /Z %s;
  9436.                    extmake:for fl /c %s
  9437.                    extmake:pas pl /c /h %s
  9438.                    extmake:asm masm -Mx %s;
  9439.                    extmake:c cl /c /Zep /D LINT_ARGS %s
  9440.                    extmake:text make %s
  9441.  
  9442.                    The Arg Compile command spawns a system-level command line
  9443.                    based on extension of current file; the editor selects the
  9444.                    corresponding extmake setting. The Arg textarg Compile
  9445.                    command spawns the command line for text extension, in
  9446.                    which textarg replaces %s.
  9447.  
  9448.                    This switch can also use the %|F syntax described in
  9449.                    Section 7.3.
  9450.  
  9451.  fgcolor           Numeric. Controls the color used for the editing window.
  9452.  Switch            Description (and Default Value)
  9453.  
  9454. fgcolor           Numeric. Controls the color used for the editing window.
  9455.                    The default is light gray text on a black background.
  9456.                    (Default value: 07)
  9457.  
  9458.  filetab           Numeric. Determines how the editor translates tabs to
  9459.                    spaces when reading or writing a disk file. This switch
  9460.                    also determines how the editor translates spaces to tabs
  9461.                    for modified lines, when entab > 0. The value of the
  9462.                    switch gives the number of spaces associated with each tab
  9463.                    column. For example, the setting "filetab:4" assumes a tab
  9464.                    column every 4 positions on each line. Every time the
  9465.                    editor finds a tab character in a file, it loads the
  9466.                    buffer with the number of spaces necessary to get to the
  9467.                    next tab column. (Default value: 8)
  9468.  
  9469.  height            Numeric. Controls the number of lines that the Microsoft
  9470.                    Editor uses in the editing window, not including the
  9471.                    dialog and status lines. This is useful with a nonstandard
  9472.                    display device. Enhanced Graphics Adapter (EGA) in 43-line
  9473.  Switch            Description (and Default Value)
  9474.  
  9475.                   display device. Enhanced Graphics Adapter (EGA) in 43-line
  9476.                    mode on the IBM PC uses a value of 41. Video Graphics
  9477.                    Array (VGA) in 50-line mode uses a value of 48. (Default
  9478.                    value: 23)
  9479.  
  9480.  helpboldcolor     Numeric. Controls the color of text designated as
  9481.                    boldface. (Default value: 0F)
  9482.  
  9483.  helpfiles         Text. Specifies which .HLP files should be used by on-line
  9484.                    Help.
  9485.  
  9486.  helpitalcolor     Numeric. Controls the color of text designated as italic.
  9487.                    (Default value: 0A)
  9488.  
  9489.  helpundcolor      Numeric. Controls the color of text designated as
  9490.                    underlined. (Default value: 0C)
  9491.  
  9492.  helpwarncolor     Numeric. Controls the color of text used for a "warning"
  9493.                    note. Also controls the color of highlighted
  9494.  Switch            Description (and Default Value)
  9495.  
  9496.                   note. Also controls the color of highlighted
  9497.                    cross-references. (Default value: 07)
  9498.  
  9499.  helpwindow        Boolean. Controls split-screen behavior. When off, the
  9500.                    editor cannot split the screen to display Help
  9501.                    information. (Default value: Yes)
  9502.  
  9503.  hgcolor           Numeric; hexadecimal value. Controls the color of text
  9504.                    highlighted by a search command. (See selcolor.) The
  9505.                    default is green. (Default value: 02)
  9506.  
  9507.  hike              Numeric. Specifies the cursor's new-line position (from
  9508.                    the top of the screen) when the cursor is moved out of the
  9509.                    current window by more than vscroll lines. (Default value:
  9510.                    4)
  9511.  
  9512.  hscroll           Numeric. Controls the number of columns shifted left or
  9513.                    right when the cursor is scrolled out of the editing
  9514.                    window. (Default value: 10)
  9515.  Switch            Description (and Default Value)
  9516.  
  9517.                   window. (Default value: 10)
  9518.  
  9519.  infcolor          Numeric, using hexadecimal radix. Controls the color used
  9520.                    for informative text. The default is dark yellow text on a
  9521.                    black background. (On some monitors, this may appear
  9522.                    brown.) (Default value: 06)
  9523.  
  9524.  keyboard          Text. Set to "compatible" if you have a 101-key enhanced
  9525.                    keyboard and wish to use keyboard-enhancer programs that
  9526.                    do not fully support the enhanced keyboard. Set to
  9527.                    "enhanced" to restore normal operation after using
  9528.                    "compatible." If no option is used, the editor makes its
  9529.                    own decision about type of keyboard in use. This switch
  9530.                    works only under DOS or real-mode OS/2.
  9531.  
  9532.  load              Text. Specifies the name of a C-extension executable file
  9533.                    to be loaded. Whenever this switch is assigned a new
  9534.                    value, the extension file named is loaded into memory and
  9535.                    initialized by calling the WhenLoaded function. The file
  9536.  Switch            Description (and Default Value)
  9537.  
  9538.                   initialized by calling the WhenLoaded function. The file
  9539.                    named must be a full name, including base name and file
  9540.                    extension (unless extension module is for OS/2 protected
  9541.                    mode). See Chapter 8, "Programming C Extensions," for
  9542.                    more information.
  9543.  
  9544.  markfile          Text. Specifies the name of the file the Microsoft Editor
  9545.                    searches when looking for a marker that is not in the
  9546.                    in-memory set. This file can be created by entering lines
  9547.                    of the following form:
  9548.  
  9549.                    markername filename line column
  9550.  
  9551.                    Here, line and column specify the position in the file
  9552.                    filename where the marker markername appears.
  9553.  
  9554.  noise             Numeric. Controls the number of lines counted at a time
  9555.                    when searching or loading a file. This value is displayed
  9556.                    in the lower-right corner of the screen and may be turned
  9557.  Switch            Description (and Default Value)
  9558.  
  9559.                   in the lower-right corner of the screen and may be turned
  9560.                    off by setting noise to 0. (Default value: 50)
  9561.  
  9562.  printcmd          Text. Specifies a system-level command that the editor
  9563.                    invokes when you issue the Print command. For example, the
  9564.                    following setting copies output to LPT2:
  9565.  
  9566.                    COPY %s LPT2
  9567.  
  9568.                    By default, the Print command sends output directly to
  9569.                    LPT1.
  9570.  
  9571.  readonly          Text. Specifies the DOS command invoked when the Microsoft
  9572.                    Editor attempts to overwrite a read-only file. The current
  9573.                    file name is appended to the command, as shown in the
  9574.                    following example:
  9575.  
  9576.                    readonly:attrib -r %s
  9577.  
  9578.  Switch            Description (and Default Value)
  9579.  
  9580. 
  9581.                    This command removes the read-only attribute from the
  9582.                    current file so the file can be overwritten. If no command
  9583.                    is specified, you are prompted to enter a new name under
  9584.                    which to save the file.
  9585.  
  9586.  realtabs          Boolean. Preserves actual tab characters instead of
  9587.                    converting them to spaces. When this switch is on, the
  9588.                    editor preserves tab alignment as characters are added and
  9589.                    deleted, and cursor-movement functions treat each tab as a
  9590.                    single character. (Default value: Yes)
  9591.  
  9592.  rmargin           Numeric. Controls the right column margin used in wordwrap
  9593.                    mode. A space typed to the right of this margin causes a
  9594.                    line break. Wordwrap mode is turned on and off with the
  9595.                    wordwrap switch. (Default value: 72)
  9596.  
  9597.  savescreen        Boolean. Saves and restores the DOS screen (used with the
  9598.                    Shell and Exit functions). (Default value: Yes)
  9599.  Switch            Description (and Default Value)
  9600.  
  9601.                   Shell and Exit functions). (Default value: Yes)
  9602.  
  9603.  searchwrap        Boolean. Causes search and replace commands to wrap past
  9604.                    the end of the file and continue searching from the
  9605.                    beginning. Unsuccessful searches stop after the entire
  9606.                    file is searched once. When this switch is off, searches
  9607.                    stop at the end of the file. (Default value: No)
  9608.  
  9609.  selcolor          Numeric. Controls the color of text highlighted by an
  9610.                    on-screen argument (linearg, boxarg, streamarg). The
  9611.                    default is black text on a white background. Do not
  9612.                    confuse with hgcolor. (Default value: 70)
  9613.  
  9614.  shortnames        Boolean. Allows you to load a file by giving only the base
  9615.                    name, which the editor searches for in the
  9616.                    <information-file>. (Default value: Yes)
  9617.  
  9618.  snow              Boolean. Eliminates snow on a CGA, at a penalty to speed.
  9619.                    Turn this switch off if you have a CGA-compatible that
  9620.  Switch            Description (and Default Value)
  9621.  
  9622.                   Turn this switch off if you have a CGA-compatible that
  9623.                    doesn't generate snow. (Default value: Yes)
  9624.  
  9625.  softcr            Boolean. Attempts to indent based upon the format of the
  9626.                    surrounding text when you invoke the Newline or Emacsnewl
  9627.                    function. (Default value: Yes)
  9628.  
  9629.  stacolor          Numeric. Controls the color used for the status-line
  9630.                    information. The default is cyan text on a black
  9631.                    background. (Default value: 03)
  9632.  
  9633.  tabalign          Boolean. Determines where the cursor may be placed in a
  9634.                    tab field. When off, the cursor may be placed anywhere in
  9635.                    a tab field. When on (and if realtabs is also on), the
  9636.                    cursor must align with the column position of the tab.
  9637.                    (Default value: No)
  9638.  
  9639.  tabdisp           Numeric. Specifies the ASCII value of the character used
  9640.                    to display tabs. Normally, a space is used, but a graphic
  9641.  Switch            Description (and Default Value)
  9642.  
  9643.                   to display tabs. Normally, a space is used, but a graphic
  9644.                    character can be used to show which spaces correspond to
  9645.                    tabs. (Default value: 32)
  9646.  
  9647.  tabstops          Numeric. Controls the number of spaces between each
  9648.                    logical tab stop for the Tab and Backtab movement
  9649.                    functions. Note that this switch has no relation to the
  9650.                    interpretation of actual tabs. (Default value: 4)
  9651.  
  9652.  tmpsav            Numeric. Controls the maximum number of recently edited
  9653.                    files listed in the information file. If this switch is
  9654.                    set to 0, the editor lets the information file grow
  9655.                    without limit; all files ever edited appear in the
  9656.                    information file until M.TMP is altered or deleted.
  9657.                    (Default value: 20)
  9658.  
  9659.  traildisp         Numeric. Specifies the ASCII value of the character to be
  9660.                    displayed as trailing spaces. Note that this switch has no
  9661.                    effect unless the trailspace switch is turned on. (Default
  9662.  Switch            Description (and Default Value)
  9663.  
  9664.                   effect unless the trailspace switch is turned on. (Default
  9665.                    value: 0)
  9666.  
  9667.  trailspace        Boolean. Preserves trailing spaces in each line you
  9668.                    modify. (Default value: No)
  9669.  
  9670.  undelcount        Numeric. Controls the number of backup copies of a file
  9671.                    that are saved when the backup switch is set to undel.
  9672.                    When the limit is exceeded, the editor discards the oldest
  9673.                    backup. (Default value: no limit)
  9674.  
  9675.  undocount         Numeric. Controls the number of edit functions that you
  9676.                    can undo. (Default value: 10)
  9677.  
  9678.  unixre            Boolean. Specifies the use of UNIX regular-expression
  9679.                    syntax rather than the syntax used inVersion 1.0 of the
  9680.                    editor. (Default value: Yes)
  9681.  
  9682.  viewonly          Boolean. Identical to the /r command-line switch and the
  9683.  Switch            Description (and Default Value)
  9684.  
  9685. viewonly          Boolean. Identical to the /r command-line switch and the
  9686.                    Noedit function. When set, no file can be edited. (Default
  9687.                    value: No)
  9688.  
  9689.  vscroll           Numeric. Controls the number of lines shifted up or down
  9690.                    when the cursor is scrolled out of the editing window. The
  9691.                    Mlines and Plines functions also use this value. (Default
  9692.                    value: 7)
  9693.  
  9694.  wdcolor           Numeric. Controls the color of the border line created
  9695.                    when you split a window. (Default value: 07).
  9696.  
  9697.  width             Numeric. Controls the width of the display mode for
  9698.                    displays that are capable of showing more than 80 columns.
  9699.                    Values other than 80 are supported only for a limited
  9700.                    number of monitors. (Default value: 80)
  9701.  
  9702.  wordwrap          Boolean. Breaks lines of text when you edit them beyond
  9703.                    the margin specified
  9704.  Switch            Description (and Default Value)
  9705.  
  9706.                   the margin specified
  9707.  
  9708.  
  9709.  
  9710.  Appendix B  Support Programs for the Microsoft Editor
  9711.  ───────────────────────────────────────────────────────────────────────────
  9712.  
  9713.  This appendix discusses two programs that work in conjunction with the
  9714.  Microsoft Editor:
  9715.  
  9716.    ■  UNDEL.EXE
  9717.  
  9718.    ■  EXP.EXE
  9719.  
  9720.  Both programs work with backup files. When a file is updated and the backup
  9721.  switch is set to undel, the old version of the file is copied to a hidden
  9722.  subdirectory called DELETED. UNDEL.EXE and EXP.EXE manipulate the files in
  9723.  the DELETED subdirectory.
  9724.  
  9725.  
  9726.  B.1  UNDEL.EXE
  9727.  
  9728.  Use this program to move a file from the DELETED subdirectory to the parent
  9729.  directory. Its command-line syntax is as follows:
  9730.  
  9731.       undel «filename»
  9732.  
  9733.  If filename is not given, the contents of the DELETED subdirectory are
  9734.  listed. If there is more than one version of the file, you are given a list
  9735.  to choose from. If the file already exists in the parent directory, the two
  9736.  files are swapped.
  9737.  
  9738.  
  9739.  B.2  EXP.EXE
  9740.  
  9741.  Use this program to remove all of the files in the hidden DELETED
  9742.  subdirectory of the specified directory. Use the following command-line
  9743.  syntax:
  9744.  
  9745.       exp «/r» «/q» «directory»
  9746.  
  9747.  If no directory is specified, the current directory's DELETED subdirectory
  9748.  is used. If the /r option is given, EXP.EXE recursively operates on all
  9749.  subdirectories. The /q option specifies quiet mode; the deleted file names
  9750.  are not displayed on the screen.
  9751.  
  9752.  
  9753.  Appendix C  Microsoft Editor Messages
  9754.  ───────────────────────────────────────────────────────────────────────────
  9755.  
  9756.  This appendix lists the messages that the editor can report on the dialog
  9757.  line, along with explanations. Some of these messages represent error
  9758.  conditions; in that case, the explanation given describes what went wrong
  9759.  and what action to take to correct the error. Other messages prompt you for
  9760.  information or report what operation is taking place. For example, the
  9761.  editor displays a message whenever it saves a file.
  9762.  
  9763.  The messages are listed in two sections. The first section consists of
  9764.  messages that begin with a placeholder. A "placeholder" is a piece of
  9765.  information──such as a number or a file name──that varies with the
  9766.  situation. This section is organized alphabetically by the placeholder type.
  9767.  The second section consists of messages that do not begin with a
  9768.  placeholder. These messages are organized alphabetically by first symbol or
  9769.  word.
  9770.  
  9771.  
  9772.  C.1  Messages Starting with Placeholders
  9773.  
  9774.  driveletter is an invalid drive
  9775.  
  9776.                 You attempted to use Setfile to change the current drive to a
  9777.                 drive not recognized by your system. Use a different drive
  9778.                 letter.
  9779.  
  9780.  file does not exist
  9781.  
  9782.                 You gave the Arg Arg filename Paste command, but the file
  9783.                 specified does not exist. Make sure you give the complete
  9784.                 path name of the file if it is not in the current directory.
  9785.  
  9786.  file does not exist. Create?
  9787.  
  9788.                 When you started the editor, you specified a file that does
  9789.                 not exist. Type Y to create the file or N to avoid creating
  9790.                 the file, in which case the editor loads the most recently
  9791.                 edited file.
  9792.  
  9793.  file has been changed.  Refresh?
  9794.  
  9795.                 One of the files opened for editing was altered by a program
  9796.                 other than the editor. This change has not yet been reflected
  9797.                 in the file buffer. You should either type Y to discard
  9798.                 recent edits and have the editor reread the file from disk,
  9799.                 or type N to preserve your edits. If you answer N, you should
  9800.                 execute a save operation so that the file buffer is copied to
  9801.                 the file stored on disk.
  9802.  
  9803.  file has changed. Save changes (Y/N)?
  9804.  
  9805.                 You have attempted to exit, and the file you are currently
  9806.                 working on has been changed since it was last saved. If you
  9807.                 respond Y, the changes will be saved; if N, they will be
  9808.                 discarded.
  9809.  
  9810.  file is read-only
  9811.  
  9812.                 You attempted to overwrite a file that has the read-only
  9813.                 attribute. After displaying this message, the editor prompts
  9814.                 for a new file name under which to save the file. If you
  9815.                 assigned a command line to the readonly switch, the editor
  9816.                 asks if you want to execute this command.
  9817.  
  9818.  'keystroke' is an unknown key
  9819.  
  9820.                 You gave an unrecognized keystroke in an assignment. Some
  9821.                 keyboards may support keystroke combinations that the editor
  9822.                 does not accept.
  9823.  
  9824.  keystroke is not assigned to any editor function
  9825.  
  9826.                 The keystroke you pressed has no editing function assigned to
  9827.                 it (not even the Graphic function, which makes keystrokes
  9828.                 literal). You must assign a function to a keystroke before
  9829.                 using it.
  9830.  
  9831.  name is not an editor function
  9832.  
  9833.                 You attempted to assign an undefined function to a keystroke.
  9834.                 You may have mistyped the function name, or you may have used
  9835.                 the colon (:) instead of the definition symbol (:=) to enter
  9836.                 a macro definition.
  9837.  
  9838.  name is not an editor switch
  9839.  
  9840.                 You entered an assignment in which the left side did not
  9841.                 contain a recognized function, macro, or switch name. You may
  9842.                 have mistyped the name or used the wrong syntax.
  9843.  
  9844.  number occurrences found
  9845.  
  9846.                 The Searchall function found number occurrences of the search
  9847.                 string.
  9848.  
  9849.  number occurrences replaced
  9850.  
  9851.                 The Replace or Qreplace function replaced number occurrences
  9852.                 of the search string.
  9853.  
  9854.  number: Undefined opcode
  9855.  
  9856.                 The editor detected an internal error in the way it analyzed
  9857.                 a regular expression. Please note the circumstances of this
  9858.                 error and notify Microsoft Corporation by following the
  9859.                 directions in the Microsoft Product Assistance Request form
  9860.                 at the back of one of your manuals.
  9861.  
  9862.  +'string' not found
  9863.  
  9864.                 The Psearch function failed to find an occurrence of string.
  9865.                 This message may be reported for both ordinary and
  9866.                 regular-expression searches.
  9867.  
  9868.  value is an illegal setting
  9869.  
  9870.                 You attempted to give an illegal value in a switch
  9871.                 assignment.
  9872.  
  9873.  
  9874.  C.2  Other Messages
  9875.  
  9876.  <ZFormat???>
  9877.  
  9878.                 You used the percent sign (%) in a text switch (such as
  9879.                 extmake) without following it by correct syntax such as %s or
  9880.                 |F. To include a literal use of the percent sign, enter two
  9881.                 percent signs in a row (%%).
  9882.  
  9883.  **PANIC EXIT** Really exit and lose edits?
  9884.  
  9885.                 The editor appeared to be "hung" (non-functioning) and you
  9886.                 pressed CTRL+BREAK five times to exit. If you answer Y, the
  9887.                 editing session will be terminated and any unsaved changes
  9888.                 will be lost. The editor sometimes has so many operations to
  9889.                 perform that it appears to be hung, but is actually
  9890.                 functioning normally. If you think this is the case, answer N
  9891.                 to return to the editing session.
  9892.  
  9893.  - floating point not loaded
  9894.  
  9895.                 The editor encountered an internal error. Please note the
  9896.                 circumstances of this error and notify Microsoft Corporation
  9897.                 by following the directions in the Microsoft Product
  9898.                 Assistance Request form at the back of one of your manuals.
  9899.  
  9900.  - integer divide by zero
  9901.  
  9902.                 The editor encountered an internal error. Please note the
  9903.                 circumstances of this error and notify Microsoft Corporation
  9904.                 by following the directions in the Microsoft Product
  9905.                 Assistance Request form at the back of one of your manuals.
  9906.  
  9907.  - not enough memory on exec
  9908.  
  9909.                 The editor encountered an internal error. Please note the
  9910.                 circumstances of this error and notify Microsoft Corporation
  9911.                 by following the directions in the Microsoft Product
  9912.                 Assistance Request form at the back of one of your manuals.
  9913.  
  9914.  - not enough space for arguments
  9915.  
  9916.                 You attempted to start the editor with more file names than
  9917.                 can be stored in free memory. This error should be impossible
  9918.                 to get unless you use a wildcard expression (such as *.c)
  9919.                 with an extraordinarily large directory.
  9920.  
  9921.  - not enough space for environment
  9922.  
  9923.                 The editor has insufficient free memory to store the
  9924.                 environment variables for the current session. This error
  9925.                 should be impossible to get unless you have severely
  9926.                 restricted the amount of memory granted to the editor.
  9927.  
  9928.  - null pointer assignment
  9929.  
  9930.                 The editor encountered an internal error. Please note the
  9931.                 circumstances of this error and notify Microsoft Corporation
  9932.                 by following the directions in the Microsoft Product
  9933.                 Assistance Request form at the back of one of your manuals.
  9934.  
  9935.  -Search for 'string'
  9936.  
  9937.                 The Msearch function is currently searching for string.
  9938.  
  9939.  - stack overflow
  9940.  
  9941.                 Internal function calls required a larger stack than is
  9942.                 available to the editor. If you receive this error, it is
  9943.                 most likely because you are using an extension that makes
  9944.                 extensive use of local variables or function calls. Rewrite
  9945.                 the extension so that it uses fewer or smaller local
  9946.                 variables; then recompile and relink.
  9947.  
  9948.  -'string' not found
  9949.  
  9950.                 The Msearch function failed to find an occurrence of string.
  9951.                 This message may be reported for both ordinary and
  9952.                 regular-expression searches.
  9953.  
  9954.  +Search for 'string'
  9955.  
  9956.                 The Psearch function is currently searching for string.
  9957.  
  9958.  All edits lost (Sorry)
  9959.  
  9960.                 The editor lost information as a result of an internal error.
  9961.                 Please note the circumstances of this error and notify
  9962.                 Microsoft Corporation by following the directions in the
  9963.                 Microsoft Product Assistance Request form at the back of one
  9964.                 of your manuals.
  9965.  
  9966.  Are you sure you want to exit? (y/n):
  9967.  
  9968.                 You gave the Meta Exit command (exit without saving), or the
  9969.                 autosave switch is not on and you tried to exit. Type Y to
  9970.                 exit or N to continue the editing session.
  9971.  
  9972.  Arg [number]:
  9973.  
  9974.                 You invoked the Arg function, which is used to introduce an
  9975.                 argument or modify a function. The number placeholder
  9976.                 indicates the number of times you invoked Arg. Complete the
  9977.                 command or type Cancel to escape. Any textarg s you type in
  9978.                 are displayed after the colon.
  9979.  
  9980.  Arg list too long
  9981.  
  9982.                 The editor encountered an internal error. Please note the
  9983.                 circumstances of this error and notify Microsoft Corporation
  9984.                 by following the directions in the Microsoft Product
  9985.                 Assistance Request form at the back of one of your manuals.
  9986.  
  9987.  Argument cancelled
  9988.  
  9989.                 You invoked the Cancel function, which removes arguments. To
  9990.                 clear this message from the dialog line, invoke Cancel again.
  9991.  
  9992.  Argument required
  9993.  
  9994.                 The function you just invoked requires an argument.
  9995.  
  9996.  Bad Assignment!
  9997.  
  9998.                 The editor could not perform the assignment requested. You
  9999.                 may have mistyped your entry or requested nonexistent
  10000.                 functions.
  10001.  
  10002.  bad environment on exec
  10003.  
  10004.                 OS/2 only. You gave a Compile or Shell command that could not
  10005.                 be executed.
  10006.  
  10007.  Bad file number
  10008.  
  10009.                 The editor encountered an internal error. Please note the
  10010.                 circumstances of this error and notify Microsoft Corporation
  10011.                 by following the directions in the Microsoft Product
  10012.                 Assistance Request form at the back of one of your manuals.
  10013.  
  10014.  bad format on exec
  10015.  
  10016.                 OS/2 only. You gave a Compile or Shell command that could not
  10017.                 be executed.
  10018.  
  10019.  Bookmark not found
  10020.  
  10021.                 You attempted to go to a file marker that does not exist or
  10022.                 mistyped the marker name.
  10023.  
  10024.  Can't delete file -messagetext
  10025.  
  10026.                 The editor could not delete the given file, for the reason
  10027.                 given in messagetext.
  10028.  
  10029.  Can't delete old version of file
  10030.  
  10031.                 The editor attempted to write a file to disk during the UNDEL
  10032.                 backup procedure (the old version of the file is stored in
  10033.                 the DELETED subdirectory), but the editor could not do the
  10034.                 necessary file deletion. Attempt saving to an alternate file.
  10035.  
  10036.  Can't rename srcfile to destfile - messagetext
  10037.  
  10038.                 The editor attempted to write a file to disk during the BAK
  10039.                 backup procedure (the old version of the file is stored as
  10040.                 srcfile.BAK), but the editor could not do the necessary
  10041.                 renaming. Attempt saving to an alternate file.
  10042.  
  10043.  Cannot access file - messagetext
  10044.  
  10045.                 You tried to load file, but were denied access by the system
  10046.                 for the reason given in messagetext.
  10047.  
  10048.  Cannot allocate mpPnPage - number
  10049.  
  10050.                 OS/2 only. The editor encountered an internal error. Please
  10051.                 note the circumstances of this error and notify Microsoft
  10052.                 Corporation by following the directions in the Microsoft
  10053.                 Product Assistance Request form at the back of one of your
  10054.                 manuals.
  10055.  
  10056.  Cannot allocate pageTmp - number
  10057.  
  10058.                 OS/2 only. The editor encountered an internal error. Please
  10059.                 note the circumstances of this error and notify Microsoft
  10060.                 Corporation by following the directions in the Microsoft
  10061.                 Product Assistance Request form at the back of one of your
  10062.                 manuals.
  10063.  
  10064.  Cannot change screen parameters when windows present
  10065.  
  10066.                 You attempted to reset the height switch when multiple
  10067.                 windows were present. Close all windows but one before
  10068.                 attempting to set height. (The editor can give this message
  10069.                 when attempting to read TOOLS.INI.)
  10070.  
  10071.  Cannot close this window
  10072.  
  10073.                 You attempted to close a window that cannot be merged with
  10074.                 another window. Two windows can be merged only if the windows
  10075.                 share one complete side. A window could not be merged with
  10076.                 two smaller windows if each shared part of one side adjoining
  10077.                 the larger window.
  10078.  
  10079.                 The editor closes the window if it can find at least one
  10080.                 adjoining window that can be properly merged. If the editor
  10081.                 cannot close the window, move to another window and close it
  10082.                 first.
  10083.  
  10084.  Cannot create file - messagetext
  10085.  
  10086.                 The editor was unable to create file, for the reason given in
  10087.                 messagetext.
  10088.  
  10089.  Cannot create printer intermediate file
  10090.  
  10091.                 OS/2 only. The editor was unable to create the intermediate
  10092.                 file needed for printer queuing.
  10093.  
  10094.  Cannot duplicate: errormessage
  10095.  
  10096.                 In attempting to perform a shell command or compile action,
  10097.                 the editor was unable to redirect output. The C run-time
  10098.                 error message indicates the nature of the problem.
  10099.  
  10100.  Cannot find label name
  10101.  
  10102.                 The given name was the target of a jump-to-label instruction
  10103.                 (+>, ->, or =>) within a macro, but the label was not
  10104.                 defined. Place :> name in the macro to define the label.
  10105.  
  10106.  Cannot load file - messagetext
  10107.  
  10108.                 You attempted to load file as an extensions module, but it
  10109.                 cannot be loaded for the reason given in messagetext.
  10110.  
  10111.  Cannot mgrep to <compile> during background compile
  10112.  
  10113.                 OS/2 only. You cannot start an mgrep during a background
  10114.                 compile.
  10115.  
  10116.  Cannot open file
  10117.  
  10118.                 The file was specified as an argument to the Setfile or Paste
  10119.                 command, but the file cannot be opened.
  10120.  
  10121.  Cannot open file - errormessage
  10122.  
  10123.                 The specified file could not be opened. The C run-time error
  10124.                 message indicates the nature of the problem.
  10125.  
  10126.  Cannot open file: errormessage
  10127.  
  10128.                 The specified file could not be opened. The C run-time error
  10129.                 message indicates the nature of the problem.
  10130.  
  10131.  Cannot open PRN: file
  10132.  
  10133.                 The editor could not locate or access a printer port to print
  10134.                 file.
  10135.  
  10136.  Cannot read file
  10137.  
  10138.                 A file to be read was located but could not be read.
  10139.  
  10140.  Cannot save to directory: directory
  10141.  
  10142.                 You attempted to save to a directory that has the read-only
  10143.                 attribute.
  10144.  
  10145.  Cannot unlink file file: messagetext
  10146.  
  10147.                 The temporary file used for printing could not be deleted.
  10148.                 The file placeholder is the name of the file, and messagetext
  10149.                 is a C run-time error message.
  10150.  
  10151.  Cannot write on PRN: file
  10152.  
  10153.                 The editor was unable to output the specified file to the
  10154.                 printer.
  10155.  
  10156.  Cannot write printer intermediate file
  10157.  
  10158.                 OS/2 only. The editor was unable to write to the intermediate
  10159.                 file used for printer queuing.
  10160.  
  10161.  Changed directory to file
  10162.  
  10163.                 The Setfile command successfully changed the current
  10164.                 directory.
  10165.  
  10166.  Changed drive to file
  10167.  
  10168.                 The Setfile command successfully changed the current drive.
  10169.  
  10170.  Command could not be executed - command
  10171.  
  10172.                 You passed a system-level command line that could not be
  10173.                 executed to the Shell or Compile command. This command line
  10174.                 is displayed in the message as command.
  10175.  
  10176.  Command failed to begin, messagetext
  10177.  
  10178.                 OS/2 only. A background compilation could not begin for the
  10179.                 reason stated in messagetext.
  10180.  
  10181.  Compilation complete - return code is number
  10182.  
  10183.                 DOS or real mode only. A compilation has completed with the
  10184.                 return code shown. A nonzero return code usually indicates an
  10185.                 error.
  10186.  
  10187.  Compile Action number: Internal Error
  10188.  
  10189.                 The editor detected an internal error in the way it analyzed
  10190.                 a regular expression. Please note the circumstances of this
  10191.                 error and notify Microsoft Corporation by following the
  10192.                 directions in the Microsoft Product Assistance Request form
  10193.                 at the back of one of your manuals.
  10194.  
  10195.  Compile failed to begin, file - messagetext
  10196.  
  10197.                 OS/2 only. The Compile command could not execute the command
  10198.                 line that it was given for the reason stated in messagetext.
  10199.  
  10200.  Compile list full, try later
  10201.  
  10202.                 OS/2 only. You tried to execute too many compilations at
  10203.                 once. The limit to the number that can be queued (that is,
  10204.                 waiting to execute) is 16.
  10205.  
  10206.  Cross-device link
  10207.  
  10208.                 The editor encountered an internal error. Please note the
  10209.                 circumstances of this error and notify Microsoft Corporation
  10210.                 by following the directions in the Microsoft Product
  10211.                 Assistance Request form at the back of one of your manuals.
  10212.  
  10213.  Delete current contents of compile log?
  10214.  
  10215.                 OS/2 only. The compile log still contains the results of a
  10216.                 previous compilation. Type Y to delete the contents before
  10217.                 starting another compilation.
  10218.  
  10219.  Do you want to delete this file from the current window?
  10220.  
  10221.                 You gave the Arg Refresh command, which removes the file from
  10222.                 the current window. Type Y to remove the file, or N to
  10223.                 continue editing the file.
  10224.  
  10225.  Do you want to replace this occurrence (Yes/No/All/Quit) :
  10226.  
  10227.                 The Qreplace function has found an occurrence of the search
  10228.                 string and is prompting you for confirmation before
  10229.                 substituting the replacement string. Type Y to make the
  10230.                 replacement, N to avoid replacement, A to proceed with making
  10231.                 replacements without confirmation, or Q to quit the Qreplace
  10232.                 function.
  10233.  
  10234.  Do you want to reread this file?
  10235.  
  10236.                 You invoked the Refresh function. Type Y to discard the most
  10237.                 recent edits and reread the file from disk. Type any other
  10238.                 character to cancel the function.
  10239.  
  10240.  Do you want to save this file as filename?
  10241.  
  10242.                 You gave the Arg Arg textarg Setfile command, which saves the
  10243.                 current file under a new file name. Type Y to proceed with
  10244.                 the save or any other character to cancel the command.
  10245.  
  10246.  Empty replacement string, confirm:
  10247.  
  10248.                 The Replace or Qreplace function has been invoked with an
  10249.                 empty replacement string. Type Y to confirm or any other
  10250.                 character to cancel. Confirming an empty replacement string
  10251.                 means that the editor simply deletes each occurrence of the
  10252.                 search string that it finds.
  10253.  
  10254.  error on scratch file.
  10255.  
  10256.                 The drive on which the scratch (temporary) file resides is
  10257.                 full. Exit the editor, change the setting of the TMP
  10258.                 environment variable to a directory on a different drive, or
  10259.                 free up space on the drive listed in TMP.
  10260.  
  10261.  EstimateAction number: Internal Error
  10262.  
  10263.                 The editor detected an internal error in the way it analyzed
  10264.                 a regular expression. Please note the circumstances of this
  10265.                 error and notify Microsoft Corporation by following the
  10266.                 directions in the Microsoft Product Assistance Request form
  10267.                 at the back of one of your manuals.
  10268.  
  10269.  Exec format error
  10270.  
  10271.                 You attempted to load an extension module that does not have
  10272.                 the correct format for this version of the editor. Rewrite
  10273.                 the extension, relink, and recompile.
  10274.  
  10275.  File file is dirty, do you want to save it?
  10276.  
  10277.                 You are trying to exit without saving a file that has been
  10278.                 altered since it was last saved. If you answer N, the changes
  10279.                 will be lost.
  10280.  
  10281.  File has been deleted
  10282.  
  10283.                 The current file has been deleted by a program other than the
  10284.                 editor, another process running under OS/2, another computer
  10285.                 on the network, or a shelled or compiled program.
  10286.  
  10287.  File to edit:
  10288.  
  10289.                 You started the editor without specifying a file, and there
  10290.                 is no previously edited file. Enter a file name or press
  10291.                 ENTER to exit back to the operating-system level.
  10292.  
  10293.  Flushing file from memory
  10294.  
  10295.                 The specified file has been cleared from memory.
  10296.  
  10297.  Illegal Extension Interface Called
  10298.  
  10299.                 An extension function attempted to call a low-level function
  10300.                 that is not supported by this version of the editor. Consult
  10301.                 Chapters 8 and 9 for a list of low-level functions
  10302.                 supported by the editor.
  10303.  
  10304.  Illegal setting
  10305.  
  10306.                 You attempted to set a switch to an invalid setting.
  10307.  
  10308.  Internal Error: RE error number, line number
  10309.  
  10310.                 The editor detected an internal error in the way it analyzed
  10311.                 a regular expression. Please note the circumstances of this
  10312.                 error and notify Microsoft Corporation by following the
  10313.                 directions in the Microsoft Product Assistance Request form
  10314.                 at the back of one of your manuals.
  10315.  
  10316.  Invalid argument
  10317.  
  10318.                 The function just invoked does not accept the argument given.
  10319.                 Try reentering the command using a valid argument.
  10320.  
  10321.  Invalid drive
  10322.  
  10323.                 You attempted to execute a command with a drive letter not
  10324.                 recognized by your system. Use a different drive letter.
  10325.  
  10326.  Invalid pattern
  10327.  
  10328.                 You specified a regular-expression search command but gave a
  10329.                 search string that is not a valid regular expression. Check
  10330.                 the syntax rules for regular expressions and reenter.
  10331.  
  10332.  Invalid replacement pattern
  10333.  
  10334.                 You specified a regular-expression search and replace command
  10335.                 but gave an invalid replacement string. Check the syntax
  10336.                 rules for regular-expression replacement strings and reenter.
  10337.  
  10338.  Invoke: "command" (y/n)?
  10339.  
  10340.                 You attempted to overwrite a file on disk that has the
  10341.                 read-only attribute set, and the readonly switch has been
  10342.                 assigned a command. The editor asks you for confirmation
  10343.                 before executing this command.
  10344.  
  10345.  Kill background compile?
  10346.  
  10347.                 OS/2 only. You gave the Arg Arg Meta Compile command, which
  10348.                 kills a background compilation after prompting for
  10349.                 confirmation. Type Y to terminate the compilation or any
  10350.                 other key to cancel the command.
  10351.  
  10352.  Line linenumber too long
  10353.  
  10354.                 The indicated line exceeds the maximum of 251 characters. The
  10355.                 editor ignores edits that exceed this limit.
  10356.  
  10357.  line linenumber too long; replacement skipped
  10358.  
  10359.                 The replacement requested would have caused the indicated
  10360.                 line to be greater than the maximum line length, so the
  10361.                 replacement was not performed.
  10362.  
  10363.  List Error: 'listmacro' does not exist
  10364.  
  10365.                 The specified list macro did not exist. You may have mistyped
  10366.                 its name or used the wrong syntax.
  10367.  
  10368.  List Error: Nested too deeply at 'macroname'
  10369.  
  10370.                 Macros may be nested no more than 20 deep. You tried to
  10371.                 execute a macro that has more than 20 nesting levels; the
  10372.                 macroname placeholder indicates the macro which tried to call
  10373.                 a macro at the 21st level.
  10374.  
  10375.  M internal error - file, continue?
  10376.  
  10377.                 The editor encountered an internal error. Please note the
  10378.                 circumstances of this error and notify Microsoft Corporation
  10379.                 by following the directions in the Microsoft Product
  10380.                 Assistance Request form at the back of one of your manuals.
  10381.  
  10382.  macro file is in use
  10383.  
  10384.                 A macro attempted to redefine itself during execution (by
  10385.                 using the Assign command), or a macro called a second macro
  10386.                 that attempted to redefine the first macro.
  10387.  
  10388.  Macros nested too deep
  10389.  
  10390.                 You created a macro that used too many levels of nesting. A
  10391.                 macro is nested when it is executed inside another macro.
  10392.                 Macros can be nested to 20 levels.
  10393.  
  10394.  Mapped line number too long
  10395.  
  10396.                 You used the Environment function to replace the names of
  10397.                 environment variables in a text string with their actual
  10398.                 values; the resulting string was greater than 251 characters.
  10399.  
  10400.  Math argument
  10401.  
  10402.                 The editor encountered an internal error. Please note the
  10403.                 circumstances of this error and notify Microsoft Corporation
  10404.                 by following the directions in the Microsoft Product
  10405.                 Assistance Request form at the back of one of your manuals.
  10406.  
  10407.  mGetCmd called with no macros in effect
  10408.  
  10409.                 The editor encountered an internal error. Please note the
  10410.                 circumstances of this error and notify Microsoft Corporation
  10411.                 by following the directions in the Microsoft Product
  10412.                 Assistance Request form at the back of one of your manuals.
  10413.  
  10414.  missing ':' in string
  10415.  
  10416.                 You gave an argument to the Assign command without including
  10417.                 an assignment symbol (:).
  10418.  
  10419.  Missing key assignment for 'function'
  10420.  
  10421.                 You attempted to assign the given function to a keystroke but
  10422.                 did not enter a keystroke name.
  10423.  
  10424.  New file name:
  10425.  
  10426.                 You attempted to overwrite a file on disk that has the
  10427.                 read-only attribute set, and the readonly switch has not been
  10428.                 assigned a command. The editor asks for a new file name under
  10429.                 which to save the file so your edits are not lost. Respond
  10430.                 with the name of a file that can be overwritten.
  10431.  
  10432.  Next file is file...
  10433.  
  10434.                 You invoked the Setfile function, and the editor is now
  10435.                 loading the given file.
  10436.  
  10437.  no alternate file
  10438.  
  10439.                 You gave the Setfile command file with no arguments, but
  10440.                 there was no alternate file to load. The Setfile command with
  10441.                 no arguments normally switches to the previous file.
  10442.  
  10443.  No command to repeat
  10444.  
  10445.                 You executed the Repeat function to repeat the previous
  10446.                 function, but no previous function had been executed.
  10447.  
  10448.  No compile command known
  10449.  
  10450.                 You executed Arg textarg Compile, but there was no
  10451.                 corresponding extmake:text definition.
  10452.  
  10453.  No compile command known for .ext
  10454.  
  10455.                 No extmake definition has been created for the extension of
  10456.                 the file you are currently editing.
  10457.  
  10458.  No compile command known for extension file
  10459.  
  10460.                 You invoked the Arg Compile command, which uses the extension
  10461.                 of the current file, but the extmake switch has no setting
  10462.                 for this file extension. Before invoking Arg Compile, make
  10463.                 the assignment
  10464.  
  10465.                 extmake: ext command-line
  10466.  
  10467.                 in which ext is the extension of the current file.
  10468.  
  10469.  No compile in progress
  10470.  
  10471.                 You executed a Compile command without arguments, which
  10472.                 returns the current compilation status. No compilation was in
  10473.                 progress.
  10474.  
  10475.  No-Edit file may not be modified
  10476.  
  10477.                 You attempted to execute an editing command that would change
  10478.                 a No-Edit file. No-Edit files cannot be modified, even in
  10479.                 memory.
  10480.  
  10481.  No matching files
  10482.  
  10483.                 You invoked the Setfile function with a string containing the
  10484.                 wildcards ? or *, but no file names matched this string.
  10485.  
  10486.  No more compilation messages
  10487.  
  10488.                 The Compile function was given with no arguments. This
  10489.                 function moves the cursor to the next error message. However,
  10490.                 there are no further error messages.
  10491.  
  10492.  No search string specified
  10493.  
  10494.                 You invoked Psearch or Msearch without a search string, and
  10495.                 there is no previously defined search string to use as a
  10496.                 default. Use an argument the first time you use Psearch or
  10497.                 Msearch.
  10498.  
  10499.  No space left on device
  10500.  
  10501.                 You attempted to save a file to a device (usually a disk
  10502.                 drive) that has no room left. Execute a shell and make room
  10503.                 on the drive, or else save to a different device.
  10504.  
  10505.  No such file or directory
  10506.  
  10507.                 You attempted to use the Setfile function to change to a file
  10508.                 or directory that does not exist.
  10509.  
  10510.  No unbalanced characters found
  10511.  
  10512.                 You invoked the Pbal function, but there are no unbalanced
  10513.                 braces, brackets, or parentheses.
  10514.  
  10515.  No-Execute Record Mode - Press keystroke to resume normal editing
  10516.  
  10517.                 You have completed the special macro recording function (Meta
  10518.                 Record) that records the macro without executing the
  10519.                 keystrokes. This message reminds you that the editor is not
  10520.                 hung. You may continue normal editing after pressing the
  10521.                 specified key.
  10522.  
  10523.  Not enough core
  10524.  
  10525.                 The editor encountered an internal error. Please note the
  10526.                 circumstances of this error and notify Microsoft Corporation
  10527.                 by following the directions in the Microsoft Product
  10528.                 Assistance Request form at the back of one of your manuals.
  10529.  
  10530.  Not enough free memory
  10531.  
  10532.                 DOS or real mode only. The editor was unable to allocate
  10533.                 enough memory for all the files that were opened and was
  10534.                 unable to recover. Normally, the editor recovers from lack of
  10535.                 memory by closing files if it can. Terminate the editing
  10536.                 session immediately.
  10537.  
  10538.  Not enough memory for pattern
  10539.  
  10540.                 You specified a regular-expression pattern too complicated
  10541.                 for the editor to implement. Specify a simpler pattern.
  10542.  
  10543.  not enough memory on exec
  10544.  
  10545.                 OS/2 only. You gave a Compile or Shell command that could not
  10546.                 be executed.
  10547.  
  10548.  Not enough room for macro macroname
  10549.  
  10550.                 You defined 1,024 macros and cannot add another. To reduce
  10551.                 the number of macros, exit the editor and restart.
  10552.  
  10553.  Not supported by video display
  10554.  
  10555.                 You attempted to assign the height switch to a value not
  10556.                 supported by the video adapter card. Only the following
  10557.                 values are supported: 23 for CGA and monochrome; 23 and 41
  10558.                 for EGA; and 23, 41, and 48 for VGA.
  10559.  
  10560.  Nothing to ReDo
  10561.  
  10562.                 You have repeated the last command in the editing command
  10563.                 list; there are no more commands that can be repeated.
  10564.  
  10565.  Nothing to UnDo
  10566.  
  10567.                 You have reversed every editing command that remains in the
  10568.                 UnDo list; there are no more editing commands to reverse.
  10569.  
  10570.  Out of disk space for VM swap file - recovering
  10571.  
  10572.                 DOS or real mode only. An insufficient amount of space was
  10573.                 available for swapping. Exit the editor and reset the TMP
  10574.                 environment variable to a disk drive with more space, if
  10575.                 possible.
  10576.  
  10577.  Out of far memory - recovering
  10578.  
  10579.                 The editor has insufficient memory to support all the files
  10580.                 open and is now trying to recover memory so that no
  10581.                 information is lost.
  10582.  
  10583.  Out of local heap - recovering
  10584.  
  10585.                 The editor has insufficient memory to support all the files
  10586.                 open and is now trying to recover memory so that no
  10587.                 information is lost.
  10588.  
  10589.  Out of local memory
  10590.  
  10591.                 DOS or real mode only. The editor was unable to allocate
  10592.                 enough memory for all the files that were opened and was
  10593.                 unable to recover. Normally, the editor recovers from lack of
  10594.                 memory by closing files if it can. Terminate the editing
  10595.                 session and do not open as many files at the same time.
  10596.  
  10597.  Out of space on device
  10598.  
  10599.                 You attempted to save a file to a device (usually a disk
  10600.                 drive) with no room left. Create free space on the drive, or
  10601.                 else save to a different device.
  10602.  
  10603.  Packed file is corrupt
  10604.  
  10605.                 DOS or real mode only. You used the Shell or Compile function
  10606.                 to execute a corrupted packed file.
  10607.  
  10608.  Permission denied
  10609.  
  10610.                 You attempted to write to a locked file.
  10611.  
  10612.  Please strike any key to continue
  10613.  
  10614.                 The Shell command has terminated, and the editor is ready to
  10615.                 continue the normal editing session.
  10616.  
  10617.  Press any key...
  10618.  
  10619.                 The editor has completed some operation and is waiting for
  10620.                 you to press a key before resuming the editing session.
  10621.  
  10622.  Print list full, try later
  10623.  
  10624.                 OS/2 only. There is no space in the printing queue for
  10625.                 another file. Wait, then submit your print request again.
  10626.  
  10627.  Printing file... Press Esc to abort
  10628.  
  10629.                 Your print request has been accepted. Press ESC to cancel the
  10630.                 printing.
  10631.  
  10632.  Printing: file
  10633.  
  10634.                 The specified file will be printed.
  10635.  
  10636.  Query search string:
  10637.  
  10638.                 You invoked the Qreplace function. Enter a new search string,
  10639.                 press ENTER (or invoke the Emacsnewl function) to accept the
  10640.                 old search string, or invoke Cancel to exit.
  10641.  
  10642.  Queued: 'file'
  10643.  
  10644.                 OS/2 only. You gave a new compile command before the last
  10645.                 compilation was complete. The editor will not spawn more than
  10646.                 one compilation at a time but can hold up to 16 compile
  10647.                 commands to be executed sequentially.
  10648.  
  10649.  RE emulator stack overflow
  10650.  
  10651.                 The editor encountered an internal error while evaluating a
  10652.                 regular expression. Please note the circumstances of this
  10653.                 error and notify Microsoft Corporation by following the
  10654.                 directions in the Microsoft Product Assistance Request form
  10655.                 at the back of one of your manuals.
  10656.  
  10657.  RemoveFile can't find file
  10658.  
  10659.                 An extension module passed a nonexistent file to the
  10660.                 RemoveFile low-level function.
  10661.  
  10662.  Removing file filename
  10663.  
  10664.                 The RemoveFile low-level function has removed a file buffer
  10665.                 from memory. This is not an error unless you need to have the
  10666.                 file open for editing.
  10667.  
  10668.  Replace string:
  10669.  
  10670.                 You invoked the Replace function. Enter a new replacement
  10671.                 string, press ENTER (or invoke the Emacsnewl function) to
  10672.                 accept the old replacement string, or invoke Cancel to exit.
  10673.  
  10674.  Replace this occurrence (Yes/No/All/Quit):
  10675.  
  10676.                 You executed the Qreplace function, which prompts for the
  10677.                 replacement rather than performing the replacement
  10678.                 automatically. You can choose not to replace the text, to
  10679.                 replace the text for this occurrence only, to replace all
  10680.                 following occurrences, or to quit the Qreplace function.
  10681.  
  10682.  Resource deadlock would occur
  10683.  
  10684.                 The editor encountered an internal error. Please note the
  10685.                 circumstances of this error and notify Microsoft Corporation
  10686.                 by following the directions in the Microsoft Product
  10687.                 Assistance Request form at the back of one of your manuals.
  10688.  
  10689.  Result too large
  10690.  
  10691.                 The editor encountered an internal error. Please note the
  10692.                 circumstances of this error and notify Microsoft Corporation
  10693.                 by following the directions in the Microsoft Product
  10694.                 Assistance Request form at the back of one of your manuals.
  10695.  
  10696.  run-time error
  10697.  
  10698.                 The editor encountered an internal error. Please note the
  10699.                 circumstances of this error and notify Microsoft Corporation
  10700.                 by following the directions in the Microsoft Product
  10701.                 Assistance Request form at the back of one of your manuals.
  10702.  
  10703.  Save all remaining changed files (Y/N)?
  10704.  
  10705.                 This prompt appears when there are one or more changed files
  10706.                 in addition to the file you were working on when you
  10707.                 attempted to exit. If you respond Y, all the remaining
  10708.                 changed files will be saved. If you respond N, you will be
  10709.                 prompted about saving each file individually.
  10710.  
  10711.  Save file file before flushing (y/n/p)
  10712.  
  10713.                 The editor is running low on memory and needs to remove file
  10714.                 buffers. No saved files are available for removal, and the
  10715.                 editor must remove unsaved files. Type Y to save changes to
  10716.                 file before it is removed, or N to remove file without saving
  10717.                 changes. Type P to save all files that have unsaved changes.
  10718.                 Invoke the Cancel function to prevent file from being
  10719.                 removed. This last option causes the editor to try to remove
  10720.                 a different file if one is available.
  10721.  
  10722.  Saving file ...
  10723.  
  10724.                 You invoked the Setfile function, and the editor is now
  10725.                 saving file.
  10726.  
  10727.  Search string:
  10728.  
  10729.                 You invoked the Replace function. Enter a new search string,
  10730.                 press ENTER (or invoke the Emacsnewl function) to accept the
  10731.                 old search string, or invoke Cancel to exit.
  10732.  
  10733.  Source file not found: file
  10734.  
  10735.                 The Arg Compile command was invoked but could not find one of
  10736.                 the files specified. Reset the extmake switch so that
  10737.                 compilations can run successfully.
  10738.  
  10739.  Spawn failed on command - messagetext
  10740.  
  10741.                 The Shell or Compile function was given a command that could
  10742.                 not be executed for the reason given in messagetext.
  10743.  
  10744.  Swapping file file already exists.
  10745.  
  10746.                 DOS or real mode only. When you started the editor, the
  10747.                 virtual-memory swapping file already existed. (On start-up,
  10748.                 the editor assumes that this file has been deleted.) Delete
  10749.                 file and restart the editor.
  10750.  
  10751.  Testing VM error at address error on scratch file. This usually indicates a
  10752.  full-disk on the scratch file device. Please attempt to free some space on
  10753.  it.
  10754.  
  10755.                 The editor encountered an internal error. Please note the
  10756.                 circumstances of this error and notify Microsoft Corporation
  10757.                 by following the directions in the Microsoft Product
  10758.                 Assistance Request form at the back of one of your manuals.
  10759.  
  10760.  This program cannot be run in DOS mode.
  10761.  
  10762.                 OS/2 only. You invoked the Shell or Compile command, which
  10763.                 can be run in real mode only (DOS or 3.x compatibility box).
  10764.  
  10765.  Too many open files
  10766.  
  10767.                 The editor tried to open more files at the operating-system
  10768.                 level, but the system cannot open any more files. Typically,
  10769.                 this error occurs when an extension opens many files, or the
  10770.                 FILES setting in CONFIG.SYS is too small. Increase the FILES
  10771.                 setting in CONFIG.SYS if this setting is not already at the
  10772.                 system maximum, then reboot. (This maximum is 20 in most
  10773.                 versions of DOS.)
  10774.  
  10775.  Too many windows
  10776.  
  10777.                 You tried to open more than eight windows, which is the
  10778.                 maximum number supported by the editor.
  10779.  
  10780.  Unable to create pipe:
  10781.  
  10782.                 OS/2 only. This message appears only on start-up. The editor
  10783.                 cannot generate the pipes it needs for background compiling
  10784.                 and printing. These features will not be available during the
  10785.                 current editing session. This problem is probably the result
  10786.                 of a lack of memory or file handles.
  10787.  
  10788.  Unable to open swapping file file - messagetext
  10789.  
  10790.                 DOS or real mode only. When you started the editor, it was
  10791.                 unable to recreate the virtual-memory swapping file. Make
  10792.                 sure your TMP environment variable lists an accessible
  10793.                 location.
  10794.  
  10795.  Unable to read TOOLS.INI
  10796.  
  10797.                 The editor could not read the TOOLS.INI file upon start-up.
  10798.                 Make sure that the TOOLS.INI file read permission is in the
  10799.                 proper format.
  10800.  
  10801.  Unable to recover - abort now?
  10802.  
  10803.                 The editor has run out of memory and exhausted all possible
  10804.                 roads to recovery. (The editor takes a number of measures to
  10805.                 recover memory before it reports this error.) If you have
  10806.                 files you need to save, type N to save them now before the
  10807.                 editor terminates. Otherwise, type Y to terminate
  10808.                 immediately.
  10809.  
  10810.  Unable to set up compile pipe
  10811.  
  10812.                 OS/2 only. The editor encountered an internal error. Please
  10813.                 note the circumstances of this error and notify Microsoft
  10814.                 Corporation by following the directions in the Microsoft
  10815.                 Product Assistance Request form at the back of one of your
  10816.                 manuals.
  10817.  
  10818.  Unable to start compile thread
  10819.  
  10820.                 OS/2 only. The editor encountered an internal error. Please
  10821.                 note the circumstances of this error and notify Microsoft
  10822.                 Corporation by following the directions in the Microsoft
  10823.                 Product Assistance Request form at the back of one of your
  10824.                 manuals.
  10825.  
  10826.  Unable to start Idle thread
  10827.  
  10828.                 OS/2 only. The editor encountered an internal error. Please
  10829.                 note the circumstances of this error and notify Microsoft
  10830.                 Corporation by following the directions in the Microsoft
  10831.                 Product Assistance Request form at the back of one of your
  10832.                 manuals.
  10833.  
  10834.  Unable to start printing thread
  10835.  
  10836.                 OS/2 only. The editor encountered an internal error. Please
  10837.                 note the circumstances of this error and notify Microsoft
  10838.                 Corporation by following the directions in the Microsoft
  10839.                 Product Assistance Request form at the back of one of your
  10840.                 manuals.
  10841.  
  10842.  Unknown error
  10843.  
  10844.                 The editor encountered an internal error. Please note the
  10845.                 circumstances of this error and notify Microsoft Corporation
  10846.                 by following the directions in the Microsoft Product
  10847.                 Assistance Request form at the back of one of your manuals.
  10848.  
  10849.  unknown function name
  10850.  
  10851.                 You attempted to execute a macro-definition list containing
  10852.                 an undefined function or macro name. Make sure that name is
  10853.                 defined before appearing in a macro or as an argument to
  10854.                 Execute.
  10855.  
  10856.  Unsupported video mode.  Please change modes and restart.
  10857.  
  10858.                 You started the editor in an unrecognized video mode. Please
  10859.                 exit the editor and reset the operating system video mode.
  10860.  
  10861.  VM: Alloc  Free
  10862.  
  10863.                 OS/2 only. The editor encountered an internal error. Please
  10864.                 note the circumstances of this error and notify Microsoft
  10865.                 Corporation by following the directions in the Microsoft
  10866.                 Product Assistance Request form at the back of one of your
  10867.                 manuals.
  10868.  
  10869.  Warning: continuation character on last line!
  10870.  
  10871.                 The last line from the appropriate section of TOOLS.INI ended
  10872.                 in a continuation character but there was no following line.
  10873.  
  10874.  Window too small to split
  10875.  
  10876.                 You attempted to create a window smaller than 5 lines or 5
  10877.                 columns. Choose a different cursor position to split the
  10878.                 window.
  10879.  
  10880.  You have more files to edit. Are you sure you want to exit? (y/n):
  10881.  
  10882.                 You specified more than one file when you started the editor,
  10883.                 but you are quitting without having edited all of them. Type
  10884.                 Y to exit or N to continue editing.
  10885.  
  10886.  You have unsaved files.  Are you sure you want to exit? (y/n):
  10887.  
  10888.                 You gave the Meta Exit command, and the editor has detected
  10889.                 at least one file open with unsaved changes. Type Y to exit
  10890.                 without saving, or any other key to continue editing.
  10891.  
  10892.  
  10893.  
  10894.  Glossary
  10895.  ───────────────────────────────────────────────────────────────────────────
  10896.  
  10897.  This glossary defines terms in this manual used in a technical or unique
  10898.  way.
  10899.  
  10900.  Arg
  10901.    A function modifier that introduces an argument or an editing function.
  10902.    The argument may be of any type and is passed to the next function as
  10903.    input. For example, the command Arg textarg Copy passes the argument
  10904.    textarg to the function Copy.
  10905.  
  10906.  argument
  10907.    An input to a function. The Microsoft Editor uses two classes of
  10908.    arguments: cursor-movement arguments and text arguments. Cursor-movement
  10909.    arguments (boxarg, linearg, and streamarg) specify a range of characters
  10910.    on the screen. Text arguments (markarg, numarg, and textarg) are typed in
  10911.    directly. Arguments are introduced by using the Arg function.
  10912.  
  10913.  assignment
  10914.    See "function assignment."
  10915.  
  10916.  box mode
  10917.    The editing mode that lets you highlight cursor-movement arguments as
  10918.    rectangular areas of text.
  10919.  
  10920.  boxarg
  10921.    A rectangular area on the screen, defined by the two opposite corners: the
  10922.    initial cursor position and the current cursor position. The editor must
  10923.    be in box mode, and the two cursor positions must be on separate rows and
  10924.    separate columns. A boxarg is generated by invoking the Arg function and
  10925.    then moving the cursor to a new location.
  10926.  
  10927.  buffer
  10928.    An area in memory in which a copy of the file is kept and changed as you
  10929.    edit. This buffer is copied to disk when you do a save operation.
  10930.  
  10931.  C extension
  10932.    A C-language module that defines new editing functions and switches. See
  10933.    Chapter 8.
  10934.  
  10935.  Clipboard
  10936.    A pseudo file that holds text selected with the Copy, Ldelete, or Sdelete
  10937.    functions. You can use the Paste function to insert text from the
  10938.    Clipboard into a file.
  10939.  
  10940.  configuration
  10941.    A description of the specific assignments of functions to keys. For
  10942.    example, a BRIEF configuration implies that the Microsoft Editor uses keys
  10943.    similar to those that the BRIEF editor uses to invoke similar functions.
  10944.  
  10945.  cursor
  10946.    The blinking white underline character that defines current position. When
  10947.    you type characters into the file, they appear at the cursor position.
  10948.  
  10949.  default
  10950.    A setting assumed by the editor until you specify otherwise. The Microsoft
  10951.    Editor uses two categories of default settings: function assignments and
  10952.    switches.
  10953.  
  10954.  dialog line
  10955.    The line just above the status line. The dialog line reports editor
  10956.    messages. You enter text arguments on this line.
  10957.  
  10958.  emacs
  10959.    A popular mainframe editor from which the functions Emacscdel and
  10960.    Emacsnewl were taken.
  10961.  
  10962.  file history
  10963.    A list of the most recently edited files, including any files currently
  10964.    open for editing. The file history is displayed in the <information-file>
  10965.    pseudo file.
  10966.  
  10967.  function assignment
  10968.    A method of assigning an editor function to a specific keystroke so that
  10969.    pressing the keystroke invokes the function. Use the Argtextarg Assign
  10970.    command to make an assignment for a single editing session, or you can
  10971.    enter the assignment in the TOOLS.INI file so that it may be used during
  10972.    any editing session. See Chapter 6.
  10973.  
  10974.  graphic
  10975.    See "literal."
  10976.  
  10977.  initial cursor position
  10978.    The position the cursor is in when the Arg function is invoked.
  10979.  
  10980.  insert mode
  10981.    An input mode that inserts rather than replaces characters in the file as
  10982.    they are entered.
  10983.  
  10984.  linearg
  10985.    A range of complete lines, including all the lines from the initial cursor
  10986.    position to the current cursor position. The editor must be in box mode.
  10987.    You define a linearg by invoking the Arg function (pressing ALT+A), then
  10988.    moving the cursor to a different line but same column as the initial
  10989.    cursor position.
  10990.  
  10991.  literal
  10992.    The corresponding ASCII value of a keystroke.  When a keystroke is
  10993.    considered literal or graphic, pressing the key causes the editor to place
  10994.    the corresponding value in a file.
  10995.  
  10996.  macro
  10997.    A function made up of arguments and previously defined functions. For
  10998.    example, you can create a macro that contains a set of repeatedly
  10999.    performed functions and assign the macro to a keystroke. Those functions
  11000.    can be carried out much more quickly and simply by invoking the macro. See
  11001.    Chapter 6.
  11002.  
  11003.  markarg
  11004.    A special type of textarg that has been previously defined to be a
  11005.    marker──that is, it is associated with a particular position in the file.
  11006.  
  11007.  marker
  11008.    A name assigned to a cursor position in a file so that this position can
  11009.    be referred to within a command by using this name. For example, the Arg
  11010.    markarg Copy command selects the text between the cursor position and the
  11011.    marker position. A marker is assigned using the Arg Arg textarg Mark
  11012.    command.
  11013.  
  11014.  Meta
  11015.    A function that modifies other functions so they perform differently. The
  11016.    effect of Meta varies with each function.
  11017.  
  11018.  nested macro
  11019.    A macro executed by another macro.
  11020.  
  11021.  numarg
  11022.    A numerical value you enter on the dialog line, which is passed to a
  11023.    function. A numarg is introduced by the Arg function.
  11024.  
  11025.  overtype mode
  11026.    The input mode that replaces characters at the cursor position instead of
  11027.    inserting them. Unlike insert mode, this mode does not preserve existing
  11028.    text at the cursor position.
  11029.  
  11030.  pseudo file
  11031.    A file kept in memory that does not correspond to a disk file. The name of
  11032.    a pseudo file is always enclosed in angle brackets (<>). You can create
  11033.    your pseudo files for fast saving of temporary information. In addition,
  11034.    the editor creates several pseudo files of its own and gives them special
  11035.    meaning. See Chapter 4.
  11036.  
  11037.  recorded macro
  11038.    A macro you create with the Record function. The Record function turns
  11039.    record mode on and off. All actions you execute while in record mode are
  11040.    by default assigned to the RECORDVALUE macro. See Chapter 6.
  11041.  
  11042.  regular expression
  11043.    A pattern specifying a set of one or more character strings to search for.
  11044.    It may be a simple string or a more complex arrangement of characters and
  11045.    special symbols that specify a variety of strings to be matched. See
  11046.    Chapter 5.
  11047.  
  11048.  return value
  11049.    A value returned by an editing function. The value may be true or false,
  11050.    depending on whether the function was successful. This value can be used
  11051.    to create complex macros that perform differently depending upon the
  11052.    results of individual functions within the macro. See Chapter 6.
  11053.  
  11054.  short name
  11055.    A file name without a path or file extension. The Setfile and Paste
  11056.    functions can take a short name as input and search for a full-length file
  11057.    name in the file history that contains the short name.
  11058.  
  11059.  status line
  11060.    The bottom line of the screen. This line contains useful information about
  11061.    the current editing session.
  11062.  
  11063.  stream mode
  11064.    The editing mode that lets you highlight cursor-movement arguments as
  11065.    continuous streams of text, rather than rectangular areas.
  11066.  
  11067.  streamarg
  11068.    The contiguous stream of characters between two positions──the initial
  11069.    cursor position and the new cursor position. The editor must be in stream
  11070.    mode. You define a streamarg by invoking Arg, moving the cursor to any new
  11071.    location, and then invoking Sinsert or Sdelete.
  11072.  
  11073.  switch
  11074.    A variable that modifies the way the editor performs. The Microsoft Editor
  11075.    uses three kinds of switches: Boolean switches, which turn a certain
  11076.    editor feature on or off; numeric switches, which specify numeric
  11077.    constants; and text switches, which specify a string of characters. See
  11078.    Chapter 7.
  11079.  
  11080.  tag
  11081.    An identifier enclosed in brackets ([]) that marks the beginning of a
  11082.    section in the TOOLS.INI file. For example, unless you rename the editor,
  11083.    the principal section for editor settings starts at the [M] tag. See
  11084.    Chapter 7.
  11085.  
  11086.  textarg
  11087.    A string of text that you enter on the dialog line after invoking the Arg
  11088.    function. The text that you enter is passed as input to the next function.
  11089.  
  11090.  TOOLS.INI
  11091.    A file that contains initialization information for the Microsoft Editor
  11092.    and other programs. The file is divided into sections with the use of
  11093.    tags. These sections can be loaded automatically when the editor is
  11094.    started or by command from within the editor. See Chapter 7.
  11095.  
  11096.  window
  11097.    An area on the screen used to display part of a file. Unless a file is
  11098.    extremely small, it is impossible to see all of it on the screen at once.
  11099.    Therefore you see a portion of the file through the main editing window at
  11100.    any one time. It is possible to see any part of the file by moving or
  11101.    scrolling this window. The Microsoft Editor allows you to open multiple
  11102.    windows on the screen, using the Window function, for viewing different
  11103.    parts of the same file or different files.
  11104.  
  11105.  
  11106.  Index
  11107.  ───────────────────────────────────────────────────────────────────────────
  11108.  
  11109.  %|F parameter
  11110.  %s parameter
  11111.  
  11112.  A
  11113.  ───────────────────────────────────────────────────────────────────────────
  11114.  
  11115.  Abandoning edits
  11116.  AddFile function
  11117.  Adding lines
  11118.  Arg function
  11119.  Argcompile function
  11120.  Arguments
  11121.       canceling
  11122.       cmdTable flags
  11123.       cursor-movement type
  11124.            boxarg
  11125.            defined
  11126.            linearg
  11127.            streamarg
  11128.       introducing
  11129.       text type
  11130.            defined
  11131.            markarg
  11132.            numarg
  11133.            textarg
  11134.  Arrow keys
  11135.  askexit switch
  11136.  askrtn switch
  11137.  Assign command
  11138.  Assign function
  11139.  Assign pseudo file
  11140.  Assignments
  11141.       functions
  11142.       keystrokes
  11143.       macros
  11144.       switches and functions contrasted
  11145.  Automatic command execution at start-up
  11146.  autosave switch
  11147.  Autostart macro
  11148.  
  11149.  B
  11150.  ───────────────────────────────────────────────────────────────────────────
  11151.  
  11152.  backslash (\), regular expressions
  11153.       M 1.0 syntax
  11154.  backslash, regular expressions
  11155.  Backtab function
  11156.  backup switch
  11157.  BadArg function
  11158.  Base names, inserting into text
  11159.  Begfile function
  11160.  Beginning of file, moving to
  11161.  Beginning of line, moving to
  11162.  Begline function
  11163.  Block operations
  11164.       moving
  11165.       copying
  11166.       deleting
  11167.       inserting
  11168.       merging
  11169.       moving
  11170.       multiple files
  11171.       replacing
  11172.       searching
  11173.  Blocks of text, large
  11174.  Boolean switches
  11175.  Bottom of file, moving to
  11176.  Box mode
  11177.  BOXARG argument type
  11178.  boxarg, argument type
  11179.  BOXARG, cmdTable flag
  11180.  BOXSTR, cmdTable flag
  11181.  Boxstream function
  11182.  Brackets (\lb\rb), finding
  11183.  
  11184.  C
  11185.  ───────────────────────────────────────────────────────────────────────────
  11186.  
  11187.  C extensions
  11188.       compiling and linking
  11189.       defined
  11190.       editing functions, low level
  11191.            Addfile
  11192.            AddFile
  11193.            BadArg
  11194.            CopyBox
  11195.            CopyLine
  11196.            CopyStream
  11197.            DelBox
  11198.            DelFile
  11199.            DelLine
  11200.            DelStream
  11201.            Display
  11202.            DoMessage
  11203.            fExecute
  11204.            FileLength
  11205.            FileNameToHandle
  11206.            FileRead
  11207.            FileWrite
  11208.            GetCursor
  11209.            GetLine
  11210.            KbHook
  11211.            KbUnHook
  11212.            MoveCur
  11213.            pFileToTop
  11214.            PutLine
  11215.            Putline
  11216.            PutLine
  11217.            ReadChar
  11218.            ReadCmd
  11219.            RemoveFile
  11220.            Replace
  11221.            SetKey
  11222.       editing
  11223.       functions, declaring
  11224.       guidelines for creating
  11225.       loading
  11226.       programming
  11227.       sample program
  11228.       steps for development
  11229.       switches, declaring
  11230.       types, function
  11231.  C library functions
  11232.  Cancel function
  11233.  Cancelling arguments
  11234.  carat (^), regular expressions
  11235.       M 1.0 syntax
  11236.       UNIX syntax
  11237.  Carriage return
  11238.       Emacsnewl function
  11239.       Newline function
  11240.  case switch
  11241.  Cdelete function
  11242.  Clipboard pseudo file
  11243.  Closing a window
  11244.  cmdTable flags
  11245.       (table)
  11246.       arguments
  11247.  cmdTable, described
  11248.  Color switches
  11249.       errcolor
  11250.       fgcolor
  11251.       hgcolor
  11252.       infcolor
  11253.       selcolor
  11254.       stacolor
  11255.       wdcolor
  11256.  Colors. See Setting screen colors
  11257.  Command line
  11258.  Commands, Assign
  11259.  Comments
  11260.  Compile function
  11261.  Compile pseudo file
  11262.  Compilers supported
  11263.  Compiling
  11264.       compilers, invoking
  11265.       editor, with
  11266.       error output
  11267.       extensions
  11268.       utilities, invoking
  11269.  Conditional macros
  11270.  Configuring the editor
  11271.       switches, with
  11272.       TOOLS.INI file, with
  11273.  Context-sensitive Help
  11274.  Copy function
  11275.  CopyBox function
  11276.  Copying
  11277.  CopyLine function
  11278.  CopyStream function
  11279.  Curdate function
  11280.  Curday function
  11281.  Curfile function
  11282.  Curfileext function
  11283.  Curfilenam function
  11284.  Cursor-movement type arguments
  11285.       boxarg
  11286.       defined
  11287.       linearg
  11288.       streamarg
  11289.  Cursor
  11290.       displaying position of
  11291.       initial position
  11292.       movement
  11293.            backtab
  11294.            down
  11295.            left
  11296.            macros, in
  11297.            right
  11298.            tab
  11299.            up
  11300.  CURSORFUNC, cmdTable flag
  11301.  Curtime function
  11302.  Customizing editor
  11303.       assignments
  11304.       See also C extensions
  11305.       described
  11306.       macros
  11307.       TOOLS.INI, using
  11308.  
  11309.  D
  11310.  ───────────────────────────────────────────────────────────────────────────
  11311.  
  11312.  Date, inserting into text
  11313.  Day, inserting into text
  11314.  Default, TOOLS.INI, using to set
  11315.  DelBox function
  11316.  Delete function
  11317.  Deleting
  11318.       canceling deletion
  11319.       lines
  11320.       text
  11321.       words
  11322.  DelFile function
  11323.  DelLine function
  11324.  DelStream function
  11325.  Direction keys
  11326.  Disabling keystrokes
  11327.  Discarding edits
  11328.  Display function
  11329.  displaycursor switch
  11330.  Displaying the cursor
  11331.  Document conventions
  11332.  dollar sign ($), regular expressions
  11333.       M 1.0 syntax
  11334.       UNIX syntax
  11335.  DoMessage function
  11336.  DOS environment variable. See Environment variable
  11337.  DOS shell. See Shell function
  11338.  DOS wildcards
  11339.  DOS-specific initialization
  11340.  Down function
  11341.  Drawing window borders, color
  11342.  Dynamic compile log
  11343.  
  11344.  E
  11345.  ───────────────────────────────────────────────────────────────────────────
  11346.  
  11347.  Editing
  11348.       copying
  11349.       deleting
  11350.            cancelling deletion
  11351.            lines
  11352.            text
  11353.            words
  11354.       exiting andsaving
  11355.       inserting
  11356.       merging
  11357.       moving
  11358.            text
  11359.            through files
  11360.       multiple files
  11361.       overtype mode
  11362.       pasting
  11363.       replacing
  11364.       scrolling
  11365.            control
  11366.            edge of screen
  11367.            page
  11368.            switches
  11369.            See also Switches
  11370.       search and replace
  11371.       searching
  11372.       starting editor
  11373.       text arguments
  11374.       windows
  11375.  editreadonly switch
  11376.  Edits, discarding
  11377.  Emacsdel function
  11378.  Emacsnewl function
  11379.  End of file, moving to
  11380.  End of line, moving to
  11381.  Endfile function
  11382.  Endline function
  11383.  entab switch
  11384.  enterinsmode switch
  11385.  Environment function
  11386.  Environment variable
  11387.       loading a file, used for
  11388.       merging a file, used for
  11389.       switch settings, in
  11390.       switches,used with
  11391.  errcolor switch
  11392.  Error messages
  11393.  Error output
  11394.  errprompt switch
  11395.  Execute function
  11396.  Execution of commands at start-up
  11397.  Exit function
  11398.  Exiting and saving
  11399.  Exiting without saving
  11400.  Exiting
  11401.       completely
  11402.       Help
  11403.       moving to next file, and
  11404.  EXP.EXE file
  11405.  Expressions
  11406.       predefined regular
  11407.       regular
  11408.       tagged
  11409.  EXT.H file
  11410.  Extensions, file
  11411.  Extensions. See C extensions
  11412.  EXTHDR.OBJ file
  11413.  EXTHDRP.OBJ file
  11414.  extmake switch
  11415.  
  11416.  F
  11417.  ───────────────────────────────────────────────────────────────────────────
  11418.  
  11419.  fExecute function
  11420.  fgcolor switch
  11421.  File extensions
  11422.       inserting into text
  11423.       syntax
  11424.  File history. See Information-file pseudo-file
  11425.  File markers
  11426.       commands
  11427.       defined
  11428.       functions used with
  11429.  File name, inserting into text
  11430.  File operations
  11431.  File position, displaying
  11432.  File-list pseudo file
  11433.  FileLength function
  11434.  FileNameToHandle function
  11435.  FileRead function
  11436.  Files
  11437.       EXTHDR.OBJ
  11438.       EXP.EXE
  11439.       EXT.H
  11440.       EXTHDR.OBJ
  11441.       EXTHDRP.OBJ
  11442.       loading
  11443.       M.EXE
  11444.       M.TMP
  11445.       MEP.EXE
  11446.       multiple
  11447.       SKEL.C
  11448.       TOOLS.INI
  11449.            comments
  11450.            defined
  11451.            line continuation
  11452.            sample
  11453.            structure
  11454.       UNDEL.EXE
  11455.  filetab switch
  11456.  FileWrite function
  11457.  Function assignments
  11458.       graphic
  11459.       keys, numeric-keypad
  11460.       making
  11461.       removing
  11462.       viewing
  11463.  Functions, C library
  11464.  Functions
  11465.       AddFile
  11466.       Arg
  11467.       Argcompile
  11468.       Assign
  11469.       assignment of
  11470.       Backtab
  11471.       BadArg
  11472.       Begfile
  11473.       Begline
  11474.       Boxstream
  11475.       Cancel
  11476.       Cdelete
  11477.       Compile
  11478.       Copy
  11479.       copy
  11480.       Copy
  11481.       CopyBox
  11482.       CopyLine
  11483.       CopyStream
  11484.       Curdate
  11485.       Curday
  11486.       Curfile
  11487.       Curfileext
  11488.       Curfilenam
  11489.       Curtime
  11490.       declaring
  11491.       defined
  11492.       DelBox
  11493.       Delete
  11494.       DelFile
  11495.       DelLine
  11496.       DelStream
  11497.       Display
  11498.       DoMessage
  11499.       Down
  11500.       Emacscdel
  11501.       Emacsnewl
  11502.       Endfile
  11503.       Endline
  11504.       Environment
  11505.       Execute
  11506.       Exit
  11507.       fExecute
  11508.       FileLength
  11509.       FileNameToHandle
  11510.       FileRead
  11511.       FileWrite
  11512.       GetCursor
  11513.       GetLine
  11514.       Graphic
  11515.       Home
  11516.       Information
  11517.       Initialize
  11518.       Insert
  11519.       Insertmode
  11520.       KbHook
  11521.       KbUnHook
  11522.       Lastselect
  11523.       Lasttext
  11524.       Ldelete
  11525.       Left
  11526.       Linsert
  11527.       Mark
  11528.       Message
  11529.       Meta
  11530.       Mgrep
  11531.       Mgreplist
  11532.       Mlines
  11533.       MoveCur
  11534.       Mpage
  11535.       Mpara
  11536.       Mreplace
  11537.       Msearch
  11538.       Mword
  11539.       Newline
  11540.       Nextmsg
  11541.       Noedit
  11542.       Paste
  11543.       Pbal
  11544.       pFileToTop
  11545.       Plines
  11546.       Ppage
  11547.       Ppara
  11548.       Print
  11549.       Psearch
  11550.       PutLine
  11551.       Pword
  11552.       Qreplace
  11553.       Quote
  11554.       ReadChar
  11555.       ReadCmd
  11556.       Record
  11557.       Refresh
  11558.       RemoveFile
  11559.       Repeat
  11560.       Replace
  11561.            editing function
  11562.            extension function
  11563.       Restcur
  11564.       Right
  11565.       Saveall
  11566.       Savecur
  11567.       Sdelete
  11568.       Searchall
  11569.       Setfile
  11570.       SetKey
  11571.       Setwindow
  11572.       Shell
  11573.       Sinsert
  11574.       Tab
  11575.       Tell
  11576.       Unassigned
  11577.       Undo
  11578.       Up
  11579.       Whenloaded
  11580.       Window
  11581.  
  11582.  G
  11583.  ───────────────────────────────────────────────────────────────────────────
  11584.  
  11585.  GetCursor function
  11586.  GetLine function
  11587.  Graphic function
  11588.  
  11589.  H
  11590.  ───────────────────────────────────────────────────────────────────────────
  11591.  
  11592.  Height of screen
  11593.  height switch
  11594.  Help function
  11595.  Help, configuring
  11596.  helpboldcolor switch
  11597.  helpfiles switch
  11598.  helpitalcolor switch
  11599.  helpundcolor switch
  11600.  helpwarncolor switch
  11601.  helpwindow switch
  11602.  helpwindow switches
  11603.  hgcolor switch
  11604.  Highlighting
  11605.  hike switch
  11606.  Home function
  11607.  horizontal scrolling
  11608.  hscroll switch
  11609.  
  11610.  I
  11611.  ───────────────────────────────────────────────────────────────────────────
  11612.  
  11613.  infcolor switch
  11614.  Information function
  11615.  Information-file pseudo file
  11616.  Initial cursor position
  11617.  Initialization file. See TOOLS.INI file
  11618.  Initialize function
  11619.  Initializing editor
  11620.  Insert function
  11621.  Insert mode
  11622.  Inserting
  11623.       another file
  11624.       lines
  11625.       program output
  11626.       spaces
  11627.       text
  11628.  Insertmode, setting on start-up
  11629.  Insertmode
  11630.       function
  11631.       macro
  11632.  Installing editor
  11633.  
  11634.  K
  11635.  ───────────────────────────────────────────────────────────────────────────
  11636.  
  11637.  KbHook function
  11638.  KbUnHook function
  11639.  KEEPMETA, cmdTable flag
  11640.  keyboard switch
  11641.  Keys, numeric-keypad
  11642.  Keystrokes
  11643.       default
  11644.       disabling
  11645.       function assignments
  11646.       macros
  11647.       making literal
  11648.       recognized by editor
  11649.  
  11650.  L
  11651.  ───────────────────────────────────────────────────────────────────────────
  11652.  
  11653.  Languages, customizing files for
  11654.  Large blocks of text, marking
  11655.  Lastselect function
  11656.  Lasttext function
  11657.  Ldelete function
  11658.  Leaving Help
  11659.  Left function
  11660.  Library functions, C
  11661.  Line continuation
  11662.  Line number, moving to
  11663.  linearg, argument type
  11664.  LINEARG, argument type
  11665.  LINEARG, cmdTable flag
  11666.  Linking extensions
  11667.  Linsert function
  11668.  List of assignments
  11669.  Literal keystrokes
  11670.       defined
  11671.       defining keys as
  11672.  load switch
  11673.  Loading
  11674.       extensions
  11675.       files
  11676.  
  11677.  M
  11678.  ───────────────────────────────────────────────────────────────────────────
  11679.  
  11680.  M 1.0 syntax, regular expression
  11681.  M 1.0 syntax
  11682.       regular expressions
  11683.  M.EXE file
  11684.  M.TMP file
  11685.  Macros
  11686.       autostart
  11687.       conditional operations
  11688.       defining
  11689.       entering
  11690.       handling prompts
  11691.       insertmode
  11692.       lists
  11693.       mgreplist
  11694.       record and playback
  11695.       RECORDVALUE
  11696.       references to other macros
  11697.  Mark function
  11698.  markarg, argument type
  11699.  MARKARG, cmdTable flag
  11700.  markfile switch
  11701.  Marking large amounts of text
  11702.  Matching
  11703.       maximal
  11704.       method
  11705.       minimal
  11706.  MEP.EXE file
  11707.  Merging
  11708.  Message function
  11709.  Messages
  11710.  Meta function
  11711.  Mgrep function
  11712.  Mgreplist
  11713.       function
  11714.       macro
  11715.  Mlines function
  11716.  Mode
  11717.       box
  11718.       stream
  11719.  MODIFIES, cmdTable flag
  11720.  MoveCur function
  11721.  Moving cursor. See Cursor movement
  11722.  Moving
  11723.       backward one paragraph
  11724.       backward one word
  11725.       beginning of line, to
  11726.       between windows
  11727.       end of file, to
  11728.       end of line, to
  11729.       file markers, using
  11730.       files, through
  11731.       forward one paragraph
  11732.       Help, through
  11733.       line numbers, to
  11734.       text
  11735.       top of file, to
  11736.       window down
  11737.       window up
  11738.  Mpage function
  11739.  Mpara function
  11740.  Mreplace function
  11741.  Msearch function
  11742.  Multiple files
  11743.  Mword function
  11744.  
  11745.  N
  11746.  ───────────────────────────────────────────────────────────────────────────
  11747.  
  11748.  Newline function
  11749.       See Also Emacsnewl function
  11750.  Nextmsg function
  11751.  NOARG, cmdTable flag
  11752.  Noedit function
  11753.  noise switch
  11754.  NULLARG, cmdTable flag
  11755.  NULLEOL, cmdTable flag
  11756.  NULLEOW, cmdTable flag
  11757.  numarg, argument type
  11758.  NUMARG, cmdTable flag
  11759.  Numeric switches
  11760.  Numeric-keypad keys
  11761.  
  11762.  O
  11763.  ───────────────────────────────────────────────────────────────────────────
  11764.  
  11765.  Options, command line
  11766.  OS/2-specific initialization
  11767.  OS/2. See Protected mode
  11768.  Overtype mode
  11769.  
  11770.  P
  11771.  ───────────────────────────────────────────────────────────────────────────
  11772.  
  11773.  Page
  11774.       moving down by
  11775.       moving up by
  11776.  Paragraph
  11777.       moving backward by
  11778.       moving forward by
  11779.  Paste function
  11780.  Pbal function
  11781.  pFileToTop function
  11782.  Plines function
  11783.  Position of cursor, displaying
  11784.  Ppage function
  11785.  Ppara function
  11786.  Predefined regular expressions
  11787.  Print function
  11788.  printcmd switch
  11789.  Programming languages. See Languages, customizing files for
  11790.  Prompts, handling within macros
  11791.  Protected mode
  11792.       creating extensions for
  11793.       dynamic compile log
  11794.  Psearch function
  11795.  Pseudo files
  11796.  PutLine function
  11797.  Pword function
  11798.  
  11799.  Q
  11800.  ───────────────────────────────────────────────────────────────────────────
  11801.  
  11802.  Qreplace function
  11803.  question mark (?), regular expressions
  11804.       M 1.0 syntax
  11805.  Quitting. See Exiting
  11806.  Quote function
  11807.  
  11808.  R
  11809.  ───────────────────────────────────────────────────────────────────────────
  11810.  
  11811.  ReadChar function
  11812.  ReadCmd function
  11813.  Reading from files
  11814.  readonly switch
  11815.  realtabs switch
  11816.  Record function
  11817.  Record pseudo file
  11818.  Recording a macro
  11819.  RECORDVALUE macro
  11820.  Redoing a command
  11821.  Refresh function
  11822.  Regular expressions
  11823.       defined
  11824.       M 1.0 syntax
  11825.       predefined
  11826.       searching
  11827.       special characters and
  11828.       tagged
  11829.       UNIX syntax
  11830.  Reinitializing, TOOLS.INI
  11831.  RemoveFile function
  11832.  Repeat function
  11833.  Repeating
  11834.       cursor-movement arguments
  11835.       on-screen arguments
  11836.       text arguments
  11837.  Replace function
  11838.  Replacing
  11839.       forward
  11840.       overtype mode
  11841.       repeated
  11842.       search and replace
  11843.  Restcur function
  11844.  Right function
  11845.  rmargin switch
  11846.  
  11847.  S
  11848.  ───────────────────────────────────────────────────────────────────────────
  11849.  
  11850.  Saveall function
  11851.  Savecur function
  11852.  savescreen switch
  11853.  Saving
  11854.       cursor position
  11855.       exiting, without
  11856.  Screen
  11857.       height
  11858.       setting colors
  11859.            background and foreground
  11860.            error messages
  11861.            foreground and background
  11862.            in TOOLS.INI file[TOOLS.INI]
  11863.            status line
  11864.            text
  11865.            user-selected text
  11866.       windows
  11867.  Scrolling
  11868.       control
  11869.       controlling with switches
  11870.       See also Switches
  11871.       direction keys, using
  11872.       horizontal
  11873.       page
  11874.       vertical
  11875.       window down
  11876.       window up
  11877.  Sdelete function
  11878.  Search-and-Replace functions
  11879.  Searchall function
  11880.  Searching a series of files
  11881.  Searching
  11882.       forward
  11883.       patterns, for
  11884.       regular expressions, with [regular expressions]
  11885.       repeated
  11886.  searchwrap switch
  11887.  selcolor switch
  11888.  Setfile function
  11889.  SetKey function
  11890.  Setting screen colors
  11891.       background and foreground
  11892.       error messages
  11893.       foreground and background
  11894.       highlighted text
  11895.       in TOOLS.INI file[TOOLS.INI]
  11896.       status line
  11897.       text
  11898.       user-selected text
  11899.  Setting up
  11900.       editor
  11901.       Help
  11902.  Setwindow function
  11903.  Shell function
  11904.  Short name, in extensions
  11905.  shortnames switch
  11906.  Sinsert function
  11907.  SKEL.C file
  11908.  SKEL.DEF file
  11909.  snow switch
  11910.  softcr switch
  11911.  stacolor switch
  11912.  Start-up, execution of commands at
  11913.  Starting
  11914.       editor
  11915.       Help
  11916.  Status line, fields, described
  11917.  Stream mode
  11918.  STREAMARG, argument type
  11919.  STREAMARG, cmdTable flag
  11920.  streamarg
  11921.       argument type
  11922.  SwiDesc structure types
  11923.  swiTable
  11924.  Switches
  11925.       askexit
  11926.       askrtn
  11927.       autosave
  11928.       backup
  11929.       case
  11930.       defined
  11931.       displaycursor
  11932.       editreadonly
  11933.       entab
  11934.       enterinsmode
  11935.       errcolor
  11936.       errprompt
  11937.       extmake
  11938.       fgcolor
  11939.       filetab
  11940.       height
  11941.       helpboldcolor
  11942.       helpfiles
  11943.       helpitalcolor
  11944.       helpundcolor
  11945.       helpwarncolor
  11946.       helpwindow
  11947.       hgcolor
  11948.       hike
  11949.       hscroll
  11950.       in extensions
  11951.       infcolor
  11952.       keyboard
  11953.       load
  11954.       markfile
  11955.       noise
  11956.       printcmd
  11957.       readonly
  11958.       realtabs
  11959.       rmargin
  11960.       savescreen
  11961.       scrolling and
  11962.       searchwrap
  11963.       selcolor
  11964.       setting screen color and
  11965.       shortnames
  11966.       snow
  11967.       softcr
  11968.       special syntax for
  11969.       stacolor
  11970.       tabalign
  11971.       tabdisp
  11972.       tabstops
  11973.       tmpsav
  11974.       traildisp
  11975.       trailspace
  11976.       undelcount
  11977.       undocount
  11978.       unixre
  11979.       viewonly
  11980.       vscroll
  11981.       wdcolor
  11982.       width
  11983.       wordwrap
  11984.  System requirements
  11985.  System-specific initialization
  11986.  
  11987.  T
  11988.  ───────────────────────────────────────────────────────────────────────────
  11989.  
  11990.  Tab function
  11991.  tabalign switch
  11992.  tabdisp switch
  11993.  Tables
  11994.       cmdTable
  11995.       swiTable
  11996.  Tabs
  11997.       meaning within editor
  11998.       reading from files
  11999.       setting with switches
  12000.       writing to disk
  12001.  tabstops switch
  12002.  Tagged expressions
  12003.  Tags
  12004.  Tell function
  12005.  Terminating sessions. See Exiting
  12006.  Text arguments, editing
  12007.  Text switches
  12008.  Text type arguments
  12009.       defined
  12010.       markarg
  12011.       numarg
  12012.       textarg
  12013.  TEXTARG, argument type
  12014.  TEXTARG, cmdTable flag
  12015.  tmpsav switch
  12016.  TOOLS.INI file
  12017.       comments
  12018.       defined
  12019.       dividing into sections
  12020.       line continuation
  12021.       reinitializing
  12022.       sample
  12023.       structure
  12024.       using tags in
  12025.  Top of file, moving to
  12026.  traildisp switch
  12027.  Trailing space
  12028.  trailspace switch
  12029.  Translate. See Search-and-Replace functions
  12030.  
  12031.  U
  12032.  ───────────────────────────────────────────────────────────────────────────
  12033.  
  12034.  Unassigned function
  12035.  UNDEL.EXE file
  12036.  undelcount switch
  12037.  Undo function
  12038.  undocount switch
  12039.  UNIX syntax, regular expression
  12040.  unixre switch
  12041.  Up function
  12042.  
  12043.  V
  12044.  ───────────────────────────────────────────────────────────────────────────
  12045.  
  12046.  Vertical scrolling
  12047.  Video modes supported
  12048.  Video-specific initialization
  12049.  Viewing
  12050.       current assignments
  12051.       function assignments
  12052.  viewonly switch
  12053.  vscroll switch
  12054.  
  12055.  W
  12056.  ───────────────────────────────────────────────────────────────────────────
  12057.  
  12058.  wdcolor switch
  12059.  Whenloaded function
  12060.  width switch
  12061.  Wildcards
  12062.       DOS
  12063.       regular expressions
  12064.  Window function
  12065.  WINDOWFUNC, cmdTable flag
  12066.  Windows
  12067.       closing
  12068.       creating
  12069.       moving
  12070.            between
  12071.            down
  12072.            up
  12073.  Word, moving forward by
  12074.  Word
  12075.       moving backward by
  12076.  wordwrap switch
  12077.  
  12078.