Using the SPFTest Program


The use of Regular Expressions, Mapping Strings and Mapping Calculation Operands involves the use of command operands and command codes that can be cryptic and unfamiliar, especially if you don't use them frequently.   As extensively as these features are documented, they could fail or could produce results you may not understand or did not expect.  In many cases, you may only observe these features seemingly doing nothing, with no explanation as to what went wrong.


The SPFTest program was design to provide you with a 'scratch pad' for experimenting with these features, and immediately see results, without having to set up test data in an SPFLite edit session.   Since these tests don't involve actual data, you can't harm anything by running these tests, and you can quickly repeat tests without having to issue SPFLite primary commands.


The SPFTest program can be accessed in two ways:





The SPFTest program, once started, runs independently of SPFLite itself, and is not dependent on it, so you can switch between the two without one program affecting or interfering with the other.


There are three complex operand types in SPFLite which the SPFTest program provides interfaces to experiment with.


Regular Expression Strings



This is the interface for testing Regular Expression strings.   The top half of the screen contains three input fields.


Default Case

Regex character matching can be defaulted to Case Sensitive or Case Insensitive.  This input field is where you can specify the default you wish.  Enter  for case sensitive or T for Case insensitive.   Note: within a Regex string, this default can be overridden with a special code.  See the Specifying a Regular Expression article for more information.


Some aspects of regular expressions will behave differently, based on what the current CASE setting is within SPFLite.  This field is used to simulate whether CASE C or CASE T is in effect when you execute the given regular expression.


Source string

This is the text string against which the Regex test will be performed.  Think of it as being a sample line from the Edit file.


Regex Expression

The Regex expression to be tested.   Note: In an actual SPFLite command, this would be included within the quotes of an R-Type literal.   In SPFTest, do not specify this string with the R"xxx" format.  Leave the R and quote marks off, and only enter the regular expression itself.



Complete these three fields and Press Enter, or click the Run Test button.   The results will be displayed in the bottom half of the screen.   If a matching string is found, it will be displayed in the upper box, surrounded by | characters.  (like the |ghi| in the image above)   The lower box will contain information about the located match string, or it will contain any error messages if the test is unsuccessful.


Starting in SPFLite release 8.3, a new version of Regular Expression syntax is now accepted, based on the well-known, open-source PCRE regular expression engine.  This RegEx engine is more powerful than what was previously available with SPFLite, but you should be mindful that there are a few, minor inconsistencies between the two systems.  This should not cause you any difficulties, but you should be aware of how they differ.


For a full explanation of Regular Expressions, see Specifying a Regular Expression.

Mapping Strings



This is the interface for testing Mapping strings.   The top half of the screen contains three input fields.


Default Case

Certain mapping subcommands are sensitive to character case.  The default handling can be set  to Case Sensitive or Case Insensitive.  This input field is where you can specify the default you wish.  Enter C for case sensitive or T for Case insensitive.


Some aspects of mapping commands will behave differently, based on what the current CASE setting is within SPFLite.  This field is used to simulate whether CASE C or CASE T is in effect when you execute the given mapping string.


Source string

This is the text string against which the Mapping test will be performed.  Think of it as being the string which was located by the search operand of a CHANGE command.


Mapping String

The Mapping expression to be tested.   Note: in an actual SPFLite command, this would be included within the quotes of an M-Type literal.   In SPFTest, do not specify this string with the M"xxx" format.  Leave the M and quote marks off, and only enter the mapping string itself.



Complete these three fields and Press Enter or click the Run Test button.   The results will be displayed in the bottom half of the screen.   If a matching string is found, it will be displayed in the upper box, surrounded by | characters.  (like the |dcba| in the image above)   The lower box will contain information about the located match string, or it will contain any error messages if the test is unsuccessful.


This description is not intended to explain Mapping strings in detail.  For that please see Full Mapping String Documentation.


Calculator Strings



This is the interface for testing Calculator strings.  Calculator strings  are a part of Mapping strings, but are of sufficient complexity to be separated out here for experimentation. The top half of the screen contains three input fields.


Initial S variable value

The initial value that you wish to be established for the Calculator S variable.  The S variable is intended to represent a 'sequence number' or 'serial number' for each instance of a string found by a CHANGE ALL primary command that involves mapping strings.  When you issue such a primary command, the first string found has a sequence number of 1, the second has 2, and so on.  The value here is used to simulate such sequence numbers, if you have a calculator expression that has a reference to variable S.


Increment value before test

If this option is selected, the value in the Initial box will be incremented by one before each test.  You might use this if you were testing a calculator expression that has a reference to variable S.


Initial value for R and X variables

The initial value to be established for the R and X variables.


Calculation string

The actual calculation string to be evaluated.   This string will become a portion of a full Mapping string.   Calculator expression operands are permitted on the Mapping String commands DD, DX, XD, XX, SD and SX.



Complete these three fields and Press Enter or click the Run Test button.  


The results will be displayed as a decimal number and its Hex equivalent in the bottom half of the screen.   Note that mapping string calculation operands use a leading dot to signify a hex number.


The lower box will contain the result including any generated error messages.


For a complete description of mapping string calculation operations, see Mapping String Calculation Operands.





Created with the Personal Edition of HelpNDoc: Create iPhone web-based documentation