4D v15.4Compiler Commands |
||||||||||||||||
|
4D v15.4
Compiler Commands
|
C_BLOB | _o_C_INTEGER | C_REAL |
C_BOOLEAN | C_LONGINT | _o_C_STRING |
C_DATE | C_PICTURE | C_TEXT |
C_GRAPH | C_POINTER | C_TIME |
C_OBJECT | IDLE |
Compatibility note: The obsolete _o_C_INTEGER and _o_C_STRING commands must no longer be used; they are replaced, respectively, by the C_LONGINT and C_TEXT commands.
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 OneMethodAmongOthers project method declares 3 parameters:
In the following example, the Capitalize project method accepts a text parameter and returns a text 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 COMPILER_Param_Predeclare28 project method predeclares the syntax of other project methods for the compiler:
// COMPILER_Param_Predeclare28 Project Method
C_REAL(OneMethodAmongOthers;$1) // OneMethodAmongOthers ( Real ; Integer { ; Long } )
C_DATE(OneMethodAmongOthers;$2) // ...
C_LONGINT(OneMethodAmongOthers;$3) // ...
C_TEXT(Capitalize;$0;$1) // Capitalize ( Text) -> Text
C_TIME(SEND PACKETS;$1) // SEND PACKETS ( Time ; Text { ; Text2... ; TextN } )
C_TEXT(SEND PACKETS;${2}) // ...
_o_C_INTEGER
_o_C_STRING
C_BLOB
C_BOOLEAN
C_DATE
C_GRAPH
C_LONGINT
C_PICTURE
C_POINTER
C_REAL
C_TEXT
C_TIME
IDLE
Product: 4D
Theme: Compiler
4D Language Reference ( 4D v15.4)
4D Language Reference ( 4D v15)
4D Language Reference ( 4D v15.3)