4D v14.3Compiler Commands |
||||||||||||||||
|
4D v14.3
Compiler Commands
|
C_BLOB | C_INTEGER | C_REAL |
C_BOOLEAN | C_LONGINT | C_STRING |
C_DATE | C_PICTURE | C_TEXT |
C_GRAPH | C_POINTER | C_TIME |
C_OBJECT | IDLE |
These commands, except IDLE, declare variables and cast them as a specified data type. Declaring variables resolves ambiguities concerning a variable’s data type. If a variable is not declared with one of these commands, the compiler attempts to determine a variable’s data type. The data type of a variable used in a form is often difficult for the compiler to determine. Therefore, it is especially important that you use these commands to declare a variable used in a form.
Note: To save time, you can use the option for generating and updating typing methods (called “Compiler methods”) found in the compiler window. This option automatically creates typing methods that take stock of and assign a type to all of the variables used in the database.
Arrays are variables that must follow the same rules as standard variables with respect to compilation. The array declaration commands are grouped together in the “Arrays” theme.
These principles are detailed in the following sections:
The following are some basic variable declarations for the compiler:
C_BLOB(vxMyBlob) ` The process variable vxMyBlob is declared as a variable of type BLOB
C_BOOLEAN(◊OnWindows) ` The interprocess variable ◊OnWindows is declared as a variable of type Boolean
C_DATE($vdCurDate) ` The local variable $vdCurDate is declared as a variable of type Date
C_GRAPH(vg1;vg2;vg3) ` The 3 process variables vg1, vg2 and vg3 are declared as variables of type Graph
In the following example, the project method OneMethodAmongOthers declares 3 parameters:
` OneMethodAmongOthers Project Method
` OneMethodAmongOthers ( Real ; Integer { ; Long } )
` OneMethodAmongOthers ( Amount ; Percentage { ; Ratio } )
C_REAL($1) ` 1st parameter is of type Real
C_INTEGER($2) ` 2nd parameter is of type Integer
C_LONGINT($3) ` 3rd parameter is of type Long Integer
` ...
In the following example, the project method Capitalize accepts a string parameter and returns a string result:
In the following example, the project method SEND PACKETS accepts a time parameter followed by a variable number of text parameters:
` SEND PACKETS Project Method
` SEND PACKETS ( Time ; Text { ; Text2... ; TextN } )
` SEND PACKETS ( docRef ; Data { ; Data2... ; DataN } )
C_TIME($1)
C_TEXT(${2})
C_LONGINT($vlPacket)
For($vlPacket;2;Count parameters)
SEND PACKET($1;${$vlPacket})
End for
In the following example, the project method COMPILER_Param_Predeclare28 predeclares the syntax of other project methods for the compiler:
` COMPILER_Param_Predeclare28 Project Method
C_REAL(OneMethodAmongOthers;$1) ` OneMethodAmongOthers ( Real ; Integer { ; Long } )
C_INTEGER(OneMethodAmongOthers;$2) ` ...
C_LONGINT(OneMethodAmongOthers;$3) ` ...
C_STRING(Capitalize;255;$0;$1) ` Capitalize ( String ) -> String
C_TIME(SEND PACKETS;$1) ` SEND PACKETS ( Time ; Text { ; Text2... ; TextN } )
C_TEXT(SEND PACKETS;${2}) ` ...
Product: 4D
Theme: Compiler
C_BLOB
C_BOOLEAN
C_DATE
C_GRAPH
C_INTEGER
C_LONGINT
C_PICTURE
C_POINTER
C_REAL
C_STRING
C_TEXT
C_TIME
IDLE
4D Language Reference ( 4D v14 R2)
4D Language Reference ( 4D v14 R3)
4D Language Reference ( 4D v14.3)
4D Language Reference ( 4D v14 R4)
Inherited from : Compiler Commands ( 4D v11 SQL Release 6)