home *** CD-ROM | disk | FTP | other *** search
/ Black Box 4 / BlackBox.cdr / wordperf / macade41.arj / MCOMPILE.DOC < prev    next >
Text File  |  1991-08-15  |  16KB  |  323 lines

  1.  
  2.                            MCompile.exe
  3.               A Utility for Compiling ASCII Text File
  4.                 Listings of WordPerfect 5.1 Macros
  5.                 into Executable Macro (.wpm) Files
  6.  
  7.                                 by
  8.  
  9.                       Jeffrey S. Kane, Ph.D.
  10.                 Performance Sciences International
  11.                           Summerfield, NC
  12.  
  13. 1.   Read the REGISTER.doc, LICENSE.doc, and WARRANTY.doc files distributed
  14.      with this macro.
  15.  
  16. 2.   Requires:
  17.      
  18.      A.   WordPerfect 5.1 (for use of compiled macros)
  19.  
  20.      B.   MS/PC-DOS 3.0 or higher
  21.  
  22.      C.   An ASCII source file that conforms to the compiler's
  23.           structure and syntax specifications.
  24.  
  25. 3.   Features:
  26.  
  27.      A.   Fast    (e.g., less than 4 seconds for a 10K source file
  28.           on 386DX-20 machine).
  29.  
  30.  
  31.      B.   Compact .exe file size (10.5 KBytes)
  32.  
  33.      C.   Accurate
  34.  
  35.      D.   Powerful: accepts source files of unlimited size.
  36.  
  37.      E.   Handles either spaces or tabs as formatting characters
  38.           at the beginnings of lines (up to first significant
  39.           character on any line).
  40.  
  41.      F.   Case insensitive: accepts commands in whatever case you
  42.           feel like entering them.
  43.  
  44. 4.   Installation:
  45.  
  46.      No installation is required other than to copy the
  47.      MCompile.exe file to the directory where your WordPerfect
  48.      macros reside.  As in the case of Macrolst, we recommend
  49.      locating MCompile in this directory for the sake of
  50.      convenience, there being no inherent technical requirement to
  51.      do so.
  52.  
  53. 5.   Operation:
  54.  
  55.      A.   Structure of Source Files
  56.  
  57.                ASCII text file listings of macros, which we'll
  58.           refer to as source files from this point onward, must
  59.           conform to an easily achieved structure in order to be
  60.           successfully compiled.  The structure of a source file
  61.           consists of three separate components, as follows:
  62.  
  63.           1)   Header:  all characters from the start of the file
  64.            to the 'STARTMACRO:' code delimiter.
  65.           2)   Code Delimiter:  the word 'STARTMACRO:', including
  66.                its terminating colon.
  67.           3)   Source Code:  all characters from the end of the
  68.                code delimiter to the end of the file.
  69.  
  70.                The compiler will first search through the Header to
  71.           find the phrase,
  72.  
  73.               Macro Description:
  74.  
  75.       All the characters up to a maximum of 39 that occur between
  76.       the colon at the end of the above phrase and the first end of
  77.       line sequence (ASCII 13ASCII 10, produced by pressing your
  78.       [ENTER] key) encountered before the beginning of the
  79.       'STARTMACRO:' code delimiter will be used as the macro
  80.       description.    Thus, if you intend there to be no description
  81.       for the macro, either leave out the 'Macro Description:'
  82.       phrase altogether, or follow it with an immediate press of
  83.       your [ENTER] key.
  84.  
  85.                The compiler then looks for the 'STARTMACRO:' code
  86.           delimiter.  This delimiter MUST appear before the start
  87.           of the source code, or no compilation will occur.  Every
  88.           character after the code delimiter to the end of the
  89.           source file will be compiled into macro code.
  90.  
  91.                To generate an example of how the structure of a
  92.           source file should look, use the Macrolst program to
  93.           create a source file from one of your existing macros. 
  94.           Macrolst creates files which are directly recompilable
  95.           back to macros (i.e., .wpm files).
  96.  
  97.      B.   Syntax of Source Files
  98.  
  99.       1)   All macro and keystroke commands must begin with an
  100.            opening French brace ({) and end with a closing
  101.            French brace (}).
  102.  
  103.       2)   In earlier versions of MacroAde the MCompile program
  104.            required that the case (i.e., upper or lower) of every
  105.            letter between the braces in all macro and keystroke
  106.            commands exactly match that used in the display format
  107.            of the commands.  However, several macro enthusiasts
  108.            have suggested that the goal of any external editing
  109.            capability is ease of use.  To have to observe the
  110.            proper case of command characters conflicts with that
  111.            goal.  Consequently, in this version any mix of cases
  112.            may be used in entering any command.  However, MacroLst
  113.            will continue to translate the commands in a macro in
  114.            accordance with WordPerfect's case format conventions.
  115.            in WordPerfect.
  116.  
  117.       3)   Most of the macro commands are listed and explained in
  118.            detail in Appendix K of the WordPerfect 5.1 manual.
  119.            The complete list of the commands is presentedd for
  120.            syntax reference purposes in the COMMANDS.ref file
  121.            contained in the MacroAde package.
  122.  
  123.       4)   WordPerfect furnishes no list of the keystroke commands
  124.            in the form in which they actually appear in WordPerfect's
  125.            macro editor.  MacroAde provides the needed list of these
  126.            commands in their correct form in its COMMANDS.ref file,
  127.            following the list of macro commands.  Next to each
  128.            keystroke command its WordPerfect code is listed,
  129.            which is needed for some macro commands.  These
  130.            commands must be entered exactly as they appear in
  131.            this list EXCEPT for their case or a syntax error will
  132.            occur and halt compilation.
  133.  
  134.       5)   One special syntax rule that is unique to creating
  135.                source files compilable by MCompile concerns the
  136.                manner in which non-keyboard characters are entered
  137.                to correspond to the use of WordPerfect's 'Compose'
  138.                feature.  This feature is used to access characters
  139.                in WordPerfect character sets above Set 0 (i.e.,
  140.                Sets 1-12), although it can also be used for Set 0
  141.            if there is some reason to do so (e.g., see below for
  142.            the special case of specifying braces as literal
  143.            characters, not parts of commands).  You can specify
  144.                any of these characters in the 13 Character Sets
  145.                (see Appendix P of WordPerfect manual) by entering
  146.            its code using the following syntax:
  147.  
  148.                     [:S,C]
  149.                where:
  150.  
  151.                      S =  the WordPerfect Character Set number (0-
  152.                           12)
  153.                      C =  the number of the character within the
  154.                           specified Character Set
  155.                For example, to specify the copyright symbol, which
  156.                is character 23 in set 4, you could enter:
  157.  
  158.                     [:4,23]
  159.  
  160.            NOTE: Even though the compiler accepts certain high
  161.            ASCII codes in the above form (e.g., [:0,250]) for
  162.            various purposes in the construction of .wpm files,
  163.            do not use any other high ASCII characters (i.e., >126)
  164.            in your macro if they aren't specifically allowed in
  165.            these instructions.  WordPerfect's character set 0 only
  166.            contains the first 126 ASCII characters; use of others
  167.            not authorized here will not be recognized in WordPerfect.
  168.  
  169.           6)   The easiest approach to handling spaces and tabs in the
  170.                compilation process would be to merely interpret them
  171.                directly.  However, this approach would make it very
  172.                difficult to use editors which expand all tabs into spaces.
  173.                One of the most widely used editors--QEDIT--offers a choice
  174.                of either the latter sort of tab expansion or a literal
  175.                treatment of tabs which displays the tab character but
  176.                doesn't execute it.  The result of the latter approach is
  177.                a very unreadable display since none of the indentation
  178.                actually appears.  The tab expansion option produces a
  179.                readable display but eliminates all the tabs, which would
  180.                leave the compiled macro without any indentation formatting.
  181.                This can be slightly alleviated by using QEDIT's Tabs Out
  182.                configuration option, but that only applies to new lines
  183.                inserted in a macro and only deals with space sequences of
  184.                one fixed length.  A similar problem arises in using the
  185.                EDITWP macro to edit macros as WordPerfect documents.  This
  186.                macro saves the documents via WordPerfect's Text Out feature,
  187.                which converts all tabs to spaces, thereby eliminating all
  188.                indentation formatting information if the compiler were
  189.                designed to interpret all spaces literally.  Clearly, an
  190.                approach other than literal interpretation of tabs and
  191.                spaces is needed.
  192.  
  193.                MCompile intelligently parses all instances of the space
  194.                character into either tabs or literal spaces.  This enables
  195.                MacroLst to produce source files using the expansion of tabs
  196.                to spaces (ASCII 32) that are highly readable in any editor.
  197.                MCompile will then convert all sequences of 3 or 4 spaces
  198.                back to tabs.
  199.  
  200.                The cost of this approach is that with one exception, all
  201.                spaces intended to be retained as literal spaces within
  202.                the macro must be represented by the ASCII 250 character
  203.                or by the [:0,250] character code (if your editor won't
  204.                represent ASCII 250).  The exception is any space that
  205.                occurs between two non-space (i.e., not ASCII 32) characters
  206.                and not at the start of a line,  as in those separating the
  207.                words in comment.  These singly-occurring spaces will be
  208.                compiled as literal spaces in the macro.
  209.  
  210.                Many editors offer a keyboard macro capability that will
  211.                make the use of ASCII 250 much easier.  For example, in
  212.                QEDIT you can simply edit your keyboard configuration file
  213.                (QCONFIG.DAT is its default name if you haven't renamed it)
  214.                and assign the following line to any key that you want to
  215.                use for ASCII 250:
  216.  
  217.                                 macro_begin '·'
  218.  
  219.                The character between the single quotes is ASCII 250, which
  220.                you can access in QEDIT by holding down the ALT key and
  221.                typing 250 on the numeric keypad (actually, on my keyboard
  222.                I have to hold down both CTRL and ALT).  Once you've changed
  223.                the keyboard configuration file, you'll then have to run
  224.                the QCONFIG.EXE program, select the Keys option, and then save
  225.                the setup in order for the new key assignment to take effect.
  226.  
  227.           7)   Tabs and spaces may be used at the beginning of each line
  228.                to indent it for formatting purposes.  The compiler
  229.                interprets all space (ASCII 32) characters that occur
  230.                before any other characters at the beginning of a line as
  231.                formatting characters and translates all sequences of 3 or
  232.                4 such spaces to tabs.  If you need to continue a line
  233.                containing a sequence of literal spaces (i.e., spaces that
  234.                actually need to be in the macro) in such a manner that
  235.                would cause one of the literal spaces to start the next
  236.                line, and for some reason you can use the ASCII 250
  237.                character (e.g., your editor won't allow you access to it),
  238.                then represent it and all other such literal spaces with
  239.                the [:0,250] character code.
  240.  
  241.           8)   After the first non-formatting character on each line
  242.            use only tabs, not spaces, to do all spacing for purely
  243.            formatting purposes to make the source code easier to
  244.            read.  The use of spaces for this purpose after the
  245.            first non-formatting character in a line will result
  246.            in the macro actually entering those spaces in the
  247.            document in which the macro is executed.
  248.  
  249.           9)   Ensure that the editor you use to create or modify
  250.                the source file does not replace tabs with spaces
  251.                when its saves the file.  Many editors provide
  252.                configuration options to control this.  For
  253.                example, with QEDIT you must set the configuration
  254.                for tabs (i.e., by executing QCONFIG and selecting
  255.                'Tab Settings' from the menu) to start in Physical
  256.                Tab Expansion Mode and in Tabs Out Mode.  These are
  257.                the first two questions asked in the Tab Setting
  258.                configuration process.  You should also answer 'No'
  259.                to the last question in this part of the
  260.                configuration process--'Do you want to start in
  261.                Smart Tabs Mode?'.
  262.  
  263.          10)   If you want to visibly mark spaces (e.g., for ease
  264.            of counting), use ASCII character 250 (FA Hex) or
  265.            [:0,250] if your editor doesn't allow entry of high
  266.            ASCII characters.  This character will be properly
  267.            compiled as a space character (ASCII 32).
  268.  
  269.          11)   Do NOT use the "{" and "}" characters in any way other
  270.            than to enclose a macro or keystroke command within the
  271.            macro source code.  The compiler assumes that all
  272.            occurrences of these characters are meant to enclose
  273.            commands and will generate an error and terminate
  274.            compilation if they occur without enclosing commands.
  275.            This is the only difference from WordPerfect's internal
  276.            macro editor, which allows you to use these French braces
  277.            as characters having nothing to do with commands.
  278.            You can, however, enter non-command related braces
  279.            in character code form.    Specifically, you can insert
  280.            literal braces anywhere in a macro by using the following
  281.            codes:
  282.                  "{" = [:0,123]
  283.                  "}" = [:0,125]
  284.  
  285.          12)   A violation of any of these syntax rules or the
  286.                occurrence of an illegal or misspelled command will
  287.                cause MCompile to issue an error message and halt
  288.                execution.  It also assigns a value from 11 to 17
  289.                to the DOS Errorlevel variable to designate the
  290.                occurrence of a particular error.  Checking
  291.                Errorlevel is a useful way of checking the
  292.                compilation process when MCompile is executed
  293.                within a batch file.
  294.  
  295.      C.   Once a source file is ready for compiling, the actual
  296.           compilation process is invoked by the following command:
  297.  
  298.               MCompile macro(.lst)
  299.  
  300.       Note that the name of the source file on the MCompile
  301.           command line may exclude the .lst extension, but will
  302.           accept the name with this extension if it is given. 
  303.           MCompile assumes that any source file has the .lst
  304.           extension, but this assumption may be overridden by
  305.           explicitly specifying a different extension.
  306.  
  307.      D.   If for some reason the compilation fails and a macro of
  308.           that name previously existed, the prior version of the
  309.           macro will be preserved.
  310.  
  311. 6.   Technical support:
  312.  
  313.      Free technical support will be furnished to any licensed user
  314.      who calls on weekdays during the hours from 9:00 a.m. to 5:00 p.m.
  315.      (Eastern) at the following number:  (919) 643-3492
  316.  
  317.      We may also be reached by mail at:
  318.  
  319.      Performance Sciences International
  320.      Suite 1250
  321.      3001 Latta Drive
  322.      Summerfield, NC  27358
  323.