Navigation:  Software Configuration Tab > General Configuration > Crew Pricing > Scripted Crew Method >

C++

Previous pageReturn to chapter overviewNext page
Show/Hide Hidden Text
hmtoggle_plus1Syntax

Program -> [UsesClause]

          [DeclSection]...

          CompoundStmt

 

UsesClause -> '#' INCLUDE (String/,)...

 

DeclSection -> ConstSection

           -> ProcedureDeclSection

           -> VarStmt ';'

 

ConstSection -> '#' DEFINE ConstantDecl

 

ConstantDecl -> Ident Expression

 

VarStmt -> Ident Ident [Array] [InitValue] /','...

 

ArrayDef -> '[' ArrayDim/','... ']'

 

ArrayDim -> Expression

 

InitValue -> '=' Expression

 

Expression -> SimpleExpression [RelOp SimpleExpression]...

 

SimpleExpression -> ['-'] Term [AddOp Term]...

 

Term -> Factor [MulOp Factor]...

 

Factor -> Designator

      -> UnsignedNumber                

      -> String

      -> '(' Expression ')'            

      -> '!' Factor

      -> '[' SetConstructor ']'        

      -> NewOperator

 

SetConstructor -> SetNode/','...  

 

SetNode -> Expression ['..' Expression]  

 

NewOperator -> NEW Designator

 

RelOp -> '>'  

     -> '<'

     -> '<='  

     -> '>='

     -> '!='  

     -> '=='

     -> IN    

     -> IS

 

AddOp -> '+'

     -> '-'  

     -> '||'

     -> '^'

 

MulOp -> '*'    

     -> '/'

     -> '%'

     -> '&&'

     -> '<<'  

     -> '>>'

 

Designator -> ['&'] Ident ['.' Ident | '[' ExprList ']' | '(' ExprList ')']...

 

ExprList -> Expression/','...

 

Statement -> [SimpleStatement ';' | StructStmt | EmptyStmt]

 

EmptyStmt -> ';'

 

StmtList -> (Statement...)

 

SimpleStatement -> DeleteStmt

               -> AssignStmt

               -> VarStmt                    

               -> CallStmt                    

               -> ReturnStmt

               -> (BREAK | CONTINUE | EXIT)  

 

DeleteStmt -> DELETE Designator

 

AssignStmt -> Designator ['+'|'-'|'*'|'/']'=' Expression  

 

CallStmt -> Designator ['+''+'|'-''-']  

 

ReturnStmt -> RETURN [Expression]  

 

StructStmt -> CompoundStmt        

          -> ConditionalStmt

          -> LoopStmt            

          -> TryStmt

 

CompoundStmt -> '{' [StmtList] '}'

 

ConditionalStmt -> IfStmt

               -> CaseStmt  

 

IfStmt -> IF '(' Expression ')' Statement [ELSE Statement]  

 

CaseStmt -> SWITCH '(' Expression ')' '{' (CaseSelector)... [DEFAULT ':' Statement] '}'  

 

CaseSelector -> CASE SetConstructor ':' Statement

 

LoopStmt -> RepeatStmt  

        -> WhileStmt

        -> ForStmt    

 

RepeatStmt -> DO Statement [';'] WHILE '(' Expression ')' ';'  

 

WhileStmt -> WHILE '(' Expression ')' Statement  

 

ForStmt -> FOR '(' ForStmtItem ';' Expression ';' ForStmtItem ')' Statement  

 

ForStmtItem -> AssignStmt  

           -> VarStmt

           -> CallStmt

           -> Empty      

 

TryStmt -> TRY CompoundStmt (FINALLY | EXCEPT) CompoundStmt  

 

FunctionDecl -> FunctionHeading CompoundStmt

 

FunctionHeading -> Ident Ident [FormalParameters]

 

FormalParameters -> '(' [FormalParam/';'...] ')'

 

FormalParam -> TypeIdent (['&'] Ident [InitValue]/',')...

hmtoggle_plus1Structure

#language C++Script // this is optional

#include "unit1.cpp", "unit2.cpp"  

 

 

int i, j;              // var section

 

#DEFINE pi = 3.14159   // const section

 

void p1()              // procedures and function

{                      // there is no nested procedures in C++Script

}

 

{                      // main procedure that will be executed.

}

hmtoggle_plus1Data Types

C++Script maps some types to standard types:

int, long = Integer

void = Integer

bool = Boolean

float = Extended

Note: Not all of these types can be assign-compatible. Like in Object Pascal, you can't assign Extended or String to an Integer. Only one type - the Variant - can be assigned to all the types and can get value from any type.