Description

Directs the compiler to take action prior to the main compilation of a stored procedure.

Syntax

#PRAGMA keyword option

Parameters

The #PRAGMA statement has the following parameters.

ParameterDescription
keywordThe directive to be sent to the PRECOMPILER. The possible keywords are PRECOMP and OUTPUT.
option

Options to be sent to the precompiler based on the keyword sent.

KeywordOption
PRECOMPThe Name of a stored procedure that should be executed prior to final compilation.

Note: The Stored Procedure to be called will automatically be passed the contents of procedure being compiled and name of the procedure as defined on the Compile statement of the Stored Procedure being precompiled.

OUTPUTThe name of the file and the name of the record to which the processed Precompiled source should be written.

Example

function My_Precompile_Test(void)

#PRAGMA PRECOMP My_Precompiler
#PRAGMA OUTPUT SYSLISTS My_Precompiled_Code

retval = 0

/*
Code specific to the stored procedure
....
*/

return retval

***
* Prior to the calling of the main compiler, OpenInsight will call MY_PRECOMPILER.
* MY_PRECOMPILER will be passed two parameters, ROUTINE (the actual source code)
* and ID (the name as defined in the compile statement of the stored procedure.
* The code produced in the My_Precompiler routine will be saved to the SYSLISTS file
* with a key of My_Precompiled Code
***

Subroutine My_Precompiler(routine, id)

insertThis = "Declare Function Get_Property" : @fm : "Declare Subroutine Msg"
routine = Insert(routine,5,0,0,insertThis)

return

* My_Precompiled_Code in the SYSLISTS fill will contain:

Declare Function Get_Property
Declare Subroutine Msg

retval = 0

/*
Code specific to the stored procedure
....
*/

return retval

 

 
  • No labels