CSPro has two logic versions, and the version you select (using
Logic Settings) controls several aspects of how logic is compiled and executed. The primary differences are summarized in the following table, and then described in more detail.
Feature | Original Version | CSPro 8.0+ Version |
Multiline comments | { } | /* */ |
Verbatim string literals | ✗ | supported |
Escape sequences in string literals | ✗ | supported |
String comparisons | Ignores trailing spaces | Exact string comparison |
When using logic version CSPro 8.0+, multiline comments start with /* and end with */: /* ... commented code ... */.
The original version of
string literals does not allow for escape sequences. A few functions have special processing for characters following backslashes; for example,
"\n" introduces a
new line in an
errmsg;
"\f" introduces a form feed by
filewrite. However, this can lead to unintended results; for example, it is not possible to display the error message "eight\nine\ten" on a single line because the backspace character preceding "nine" would be interpreted as a newline character.
With logic version CSPro 8.0+,
escape sequences are processed. An escape sequence begins with a backslash character and is followed by a valid character. Because a backslash begins an escape sequence, if taking an older CSPro application and using a newer logic version, look throughout the code for backslash characters and escape them accordingly. For example, a string like
"a\b\c" would be rewritten as
"a\\b\\c". Note that the text editor colors escape sequences slightly differently than the other characters in a string literal.
Because escape sequences allow characters to exist in CSPro that were previously not allowed, review how CSPro
handles newline characters.
In addition to escape sequences, with logic version CSPro 8.0+, you can use
verbatim string literals, which are useful for specifying text that may contain many backslash characters. For example, these two strings are identical:
"C:\\Program Files (x86)\\CSPro 8.0\\html\\images\\cspro-logo-medium.png" // string literal
@"C:\Program Files (x86)\CSPro 8.0\html\images\cspro-logo-medium.png" // verbatim string literal
The original routine to
compare strings right-pads strings with space (blank) characters as necessary so that the length of the string does not factor into the comparison. This applies to comparisons using:
With logic version CSPro 8.0+, strings are compared without any padding. This is desirable for most strings, but when comparing strings against
alphanumeric dictionary items, which are right-padded to match the
dictionary item length, you will likely want to use the
strip function when comparing strings; for example:
if BIRD_NAME = "Bobolink" then // Original logic version
if strip(BIRD_NAME) = "Bobolink" then // CSPro 8.0+ logic version
- The hash function returns the hash value in uppercase when using the original logic version, but in lowercase with logic version CSPro 8.0+.