Show/Hide Toolbars

XSharp

Purpose

Mark the end of a #text .. #endtext region

Syntax

#text := <varname>
First Line
Second Line
#endtext

Description

The language supports the TEXT .. ENDTEXT construct. These commands are converted by the preprocessor into a #text .. #endtext constract.

#endtext always appears "alone" on a line of code and will be replaced by a call to the (optional) endfunction that is declared with the #text directive and when the block is assigned to a variable then the assignment will be performed on the #endtext line.

 

Example

Please note that the 2 UDCs below are already defined in XSharpDefs.xh

#xcommand ENDTEXT => #endtext
 
#xcommand TEXT TO FILE <(file)> ;
     =>  _TextSave( <(file)> ) ;;
         #text QOut, _TextRestore
 
TEXT TO FILE EXAMPLE.TXT
line 1
line 2
line 3
line 4
ENDTEXT

The TEXT TO FILE command is translated into a call to the function _TextSave(), followed by the #text directive, that specifies that each line must be sent to the QOut() function and that also declares that the #endtext line must be replaced by a call to the _TextRestore() function. The QOut() and _TextRestore function names are specified without parameters. Each line in the block will be sent to the QOut() function as parameter.

 

So this code is converted to

_TextSave("EXAMPLE.TXT");
QOut("line 1")
QOut("line 2")
QOut("line 3")
QOut("line 4")
_TextRestore()

See also

TEXT command

#text Directive