$ProcLoc: Difference between revisions

From m204wiki
Jump to navigation Jump to search
(Automatically generated page update)
Line 12: Line 12:
The sixth argument, available in <var class="product">Sirius Mods</var> 8.1 and later, if set to 'Y', indicates that single (') and double (") quotes are to be considered as matches for each other. This can be useful when searching through procedures that contain code where single and double quotes can be used interchangeably to enclose string literals. Such code includes User Language, Javascript, and XML (including XSLT).  
The sixth argument, available in <var class="product">Sirius Mods</var> 8.1 and later, if set to 'Y', indicates that single (') and double (") quotes are to be considered as matches for each other. This can be useful when searching through procedures that contain code where single and double quotes can be used interchangeably to enclose string literals. Such code includes User Language, Javascript, and XML (including XSLT).  
==Syntax==
==Syntax==
<p class="syntax"><span class="term">%rc</span> = <span class="literal">$ProcLoc</span>(<span class="term">string1</span>, <span class="term">string2</span>, string3, string4, respect, arb_quote)
<p class="syntax"><span class="term">%rc</span> = <span class="literal">$ProcLoc</span>(<span class="term">string1</span>, <span class="term">string2</span>, <span class="term">string3</span>, string4, respect, arb_quote)
</p>
</p>



Revision as of 18:12, 12 April 2013

Locate any of set of strings in procedure

Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for $ProcLoc is Locate, if AppendOpenProcedure is used to retrieve the procedure into a Stringlist.

The $ProcLoc function accepts five arguments and returns a numeric result.

The first four arguments identify strings to be located in the currently open procedure. If any of the specified strings is located in a given line of the procedure the search is terminated. At least one search string must be specified. The total length of the first 4 arguments must be 256 or less.

The fifth argument, if set to 'Y', indicates that the case of the data in a procedure line must match the case of the data in the search strings for a string to be considered "matched". If this argument is not set to 'Y', a lower case character would be considered to match the corresponding upper case character and vice versa.

The sixth argument, available in Sirius Mods 8.1 and later, if set to 'Y', indicates that single (') and double (") quotes are to be considered as matches for each other. This can be useful when searching through procedures that contain code where single and double quotes can be used interchangeably to enclose string literals. Such code includes User Language, Javascript, and XML (including XSLT).

Syntax

%rc = $ProcLoc(string1, string2, string3, string4, respect, arb_quote)

$ProcLoc positions the "current line" in the file so that a subsequent $ProcGet would return the line containing the matched string or strings. If you wish to continue searching through the current procedure for the next occurrence of a string or strings you must issue a $ProcGet to advance the current line. If you do not, $ProcLoc will continue to match on the current line. For example, the following code, displays the line number and contents of every line in procedure BIGPROC that contains either the string REPEAT or the string ARRAY.

%A = $ProcOpn('BIGPROC') %LINE_NUM = 0 %A = 1 REPEAT WHILE %A GT 0 %A = $ProcLoc('REPEAT','ARRAY') IF %A GT 0 THEN %LINE_NUM = %LINE_NUM + %A PRINT %LINE_NUM AND $ProcGet END IF END REPEAT

Return codes

>0 - The number of lines that were tested before the string or strings were located -1 - Current include level not opened by $ProcOpn -2 - Search string or strings not found -3 - No search strings were specified -4 - Total length of search strings > 256

$ProcLoc return codes

Products authorizing $ProcLoc