Function PreProcessLine() Professional

Preprocesses one line

Syntax
PreProcessLine( <cInputLine>, <cOutputLine>, [<nOutLen>]) --> nErrNum
Parameters
<cInputLine>
The parameter <cInputLine> is a character string to be translated.
<cOutputLine>
The parameter <cOutputLine> receives the translated output as a character string. This parameter must be passed by reference.
<nOutLen>
The parameter <nOutLen> tells how many byte are available in the output buffer. The default value for this optional parameter equals to len(<cOutputLine>).
Return

The return value of PreProcessLine() is is a numerical value indicating the success or error of the function. If no error occured, the returned value is XPP_ERR_NONE.

Description

The function PreProcessLine() processes the input, using all previously defined #commands, #translates or #defines. It can be used to define a new command, translate or define constant or to apply the defined set of commands, translates or defines to the input string. The output string will be empty if the input string contains a definition, the translation of the input otherwise.

Examples
Pre-process user input
// This sample shows how to use PreProcessLine() 
// to execute user input 
#include "xpppp.ch" 
#pragma library("aspapib.lib") 
PROCEDURE Main(cInput) 
LOCAL nError 
LOCAL cOutput 
LOCAL aCmds 
LOCAL i 

      // install PP   
      nError := PreprocessorInstall("std.ch") 
      IF nError != XPP_ERR_NONE 
           ? PPGetMessage(nError) 
           QUIT 
      ENDIF 
      // pre-process line 
      cOutput := "" //space() 
      nError := PreProcessLine(cInput, @cOutput) 
      IF nError != XPP_ERR_NONE 
           ? PPGetMessage(nError) 
      ELSE 
           ? cOutput 
           // split translated line into array 
           aCmds := PPSplitLine(cOutput) 
           FOR i:=1 TO len(aCmds) 
               // sequentially execute the statements 
               &(aCmds[i]) 
           NEXT             
      ENDIF         
      // uninstall PP         
      PreprocessorUninstall() 
RETURN 
Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.