INDEX 4 106 HPDPIC
24 30 Compiler optimizations
2589 106 Editor Searching
6619 27 String search
1604 21 User defined commands
%Compiler optimizations
An "optimization" is a transformation performed by the compiler on
a program to make it smaller and/or faster.

The compiler performs many optimizations, some automatically, some
only when requested.  The Optimization dialog box allows selection
of optimizations to be performed when compiling:

Global:         Global optimization is performed one function at
                a time and aims to optimize the use of registers
                within whole functions.  When used, this allocates
                variables to registers based on analysis of which
                variables will benefit most. This optimization can
                be quite time consuming on large functions.  It is
                possible for the code generator to run out of
                memory when performing global optimization. The
                function size should be reduced if this occurs.

Peephole:       Peephole optimization is a process of examining
                generated assembler code and "improving" it. This
                includes redundant load/store optimization, branch
                optimization, and substitution of faster or shorter
                instructions.  Whole functions are optimized at a
                time, and it is possible for the optimizer to run
                out of memory on large functions.

Assembler:      The assembler attempts to turn long branches or
                jumps into short branches when this is used. This
                does not use extra memory, but can increase the
                compile time.

%User defined commands
The "User command setup" dialog allows four user defined external
commands to be added to the Utility menu.  Each user defined command
entry consists of two strings; the menu entry which will be displayed
in the Utility menu, and the command line which will be executed by
DOS when the menu item is selected.  Typically the user commands will
be used to interface to external debuggers and editors.

A number of macros may be used within user defined commands to allow
substitution of useful filenames.  The available macros are:

        $(EDIT)       Current HPD edit file
        $(OUTFILE)    Current output file name
        $(CWD)        Current working directory
        $(LIB)        Compiler LIB directory path
        $(INC)        Compiler INCLUDE directory path
        $(PROJ)       Name of current project file

For example, a user defined command which passes the current HPD
edit file to an external editor called EDIT would be:

        EDIT $(EDIT)
%Editor Searching
The editor allows search and search/replace forwards or backwards, using
either simple strings, or "regular expressions".  The search/replace dialog
can be accessed via several paths:

1.      by using the WordStar style commands Ctrl-Q A and Ctrl-Q F.
2.      by clicking the "Search" button in the editor window.
3.      by pressing F2 in the editor window.
4.      by the "Search ..." or "Replace ..." items in the "Edit" menu.

The search/replace dialog allows both search and replace operations to be
selected, starting from any of the search/replace commands.  The settings
in the dialog will default to appropriate values based on the previous
operation and the method used to activate the dialog.  Selection between
search and replace operations is performed using the "Replace - F3" check
box.  If performing a replace operation, the check box "Global - F5" allows
an interactive global search/replace to be performed.  The "Replace all - F6"
check box allows all instances of the search string to be replaced without
asking.  You can select between case sensitive and case insensitive searching
using the "Case sensitive - F4" check box.

In addition to the search/replace commands which display the dialog, the
editor also allows the previous search/replace operation to be repeated
in either a forward or backward direction.  This can be achieved using the
following key or mouse strokes:

Search for NEXT:          Ctrl-L or Shift-F2 or click the NEXT button.
Search for PREVIOUS:      Ctrl-L or Ctrl-F2 or click the PREV button.

REGULAR EXPRESSION MATCHING

Regular expressions are a generalization of "wild card" matching.  A
regular expression can include literal text (e.g. "abcdef") or various
special characters that are interepreted specially when comparing the
search string with the text in the editor.  In brief, the special
characters are:

^       Match start of line
$       Match end of line
?       Match any character
*       Repeat previous expression
\( \)   Group a sequence
[ ]     Specify a range or set of characters to match
\       Escape a special character

In more detail:

^       Use at the beginning of a search string to anchor the search
        to the beginning of the line, e.g.

           ^#define

        will match #define only if it is at the beginning of a line.

$       Matches the end of a line, e.g.

           0);$

        will match "0);" only at the end of a line.

?       matches any character, e.g. 

          ??xyz?

        would match any of:

          "12xyzb", "..xyz1" or "AAxyzA"

*       means any number of repetitions of the previous regular
        expression.  The previous regular expression is either a
        single character, or a parenthesized expression or range
        as below. For example:

           ab*

        will match the letter 'a' followed by zero or more letters 'b'.

\(  \)  These two character pairs enclose a regular expression that
        can be the subject of the * repetition character, e.g

           ab\(ab\)*

        will match one or more sequences of "ab", e.g. "ababab". Note
        that the first "ab" must be matched with "ab", and the sequence
        inside the parentheses can match zero or more sequences of "ab".

[   ]   These brackets are used to enclose a character range or set.
        Within the brackets can be any number of single characters,
        or pairs of characters separated by a dash. For example:

          [ABCDEF0-9]

        will match any upper case alphabetic from A to F, or any digit.
        If it is desired to include a dash in the set, make it the first
        or last character. Similarly, the right bracket (]) must be first
        if it is to be part of the set. For example:

          []a-f-]

        will match any lower case alphabetic, ] or -.

\       Escape any special character. Precede any of ?, *, $, ^ or [
        to force them to be treated literally. For example:

          \*\**

        will match one or more asterisks in sequence.
%String search
The string search dialog is used to access a "grep" like utility which
will perform a search of one or more files for a specified target string.
The search string may consist of any sequence of characters, including
spaces.  The default behaviour is to perform a case insensitive search
where lower case and upper case characters are treated as equivalent.
If the "Case sensitive - F4" check box is selected, a case sensitive
search may be performed.

The list of files to search may be specified either by typing a list
of wildcards in the "File list:" edit line, or by selecting the check
box: "Current project - F6".  The file list entered may consist of one
or more file names or wildcards.  If the same file is selected by more
than one wildcard, the file will only be searched once.  If "Current
project" is selected, all source files in the current HPD project will be
searched for the target string.  If you wish to search a user specified
file list, select the "File list - F5" check box.

The results of the search will be displayed in the "String search:" window.
You may move between entries in this window using the mouse, window scroll
bar, or the arrow/cursor keys on the keypad.  To select a search result,
double click the mouse in its entry, or press enter when the desired line
is highlighted.  When a selection is made, the selected file will be loaded
into the HPD editor with the cursor and search highlight positioned on
the selected text.

The "Search F2" button in the "String search:" window may be used to search
again without using the menu.
