Click or drag to resize

MCompile Function (String, Boolean)

Macro compile a string.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.4a
Syntax
 FUNCTION MCompile(
	cString AS STRING,
	lAllowSingleQuotes AS LOGIC
) AS _Codeblock
View Source

Parameters

cString
Type: String
The string to compile.
lAllowSingleQuotes
Type: Boolean
Should single quotes be allowed as string delimiters

Return Value

Type: _Codeblock
The string in a macro-compiled form.
Remarks
MCompile() allows you to use the macro compiler to compile a string and store the compiled results for later execution.  Instead of invoking the macro compiler each time an expression is evaluated, you could speed up your application by compiling an expression only once and executing the compiled form as often as desired.
Examples
This examples show typical uses of MCompile():
X#
1LOCAL cComp AS STRING
2cComp := MCompile("2+3")
3? MExec(cComp)                // 5
4nResult := MExec(cComp)        // Assigning
5? MExec(cComp) = 5            // Comparing
6Two := 2                        // Private variable
7cComp := MCompile("Two+3")
8? MExec(cComp)                // 5
See Also