Statements
Inline
Interface
ConsumeData
ProduceData
ProduceEvent
NativeLanguage
General
In many models it is usually the case that higher level application domains communicate and form bridges to several lower service domains.
Service domains or domains that interface to the hardware or legacy software packages frequently need to invoke procedural code written in a 3GL language. The Inline statement enables native language code to be inserted into the generated source code.
The Model Compiler looks for the native code language it is designed to handle and ignores languages it does not know about. A code insert may require data input/output and this must be specified in Interface statements.
Inline Statement
Inline
Interface
ConsumeData
Code_Interface.Number
ProduceData
number
NativeLanguage:ANSI_C
<<|>>pdt_number = ent_code_interface->atb_number;
<<:>>
The Inline statement introduces the Interface and one or more NativeLanguage statements.
Interface Statement
Inline
Interface
ConsumeData
Message
ProduceData
number
ProduceEvent
Code_Interface : Wave
This statement introduces one or more of the following statements: ConsumeData, ProduceData and ProduceEvent.
ConsumeData Statement
Inline
Interface
ConsumeData
Code_Interface.Number
NativeLanguage:ANSI_C
<<|>>any_library_procedure(ent_code_interface->atb_number);
<<:>>
The ConsumeData statement specifies which data items are read by the NativeLanguage code fragment. Any data item appearing in this list may also appear in the ProduceData list.
ProduceData Statement
Inline
Interface
ProduceData
number
NativeLanguage:ANSI_C
<<|>>pdt_number = 42;
<<:>>
The ProduceData statement specifies which data items are updated by the NativeLanguage code fragment. Any data item appearing in this list may also appear in the ConsumeData list.
ProduceEvent Statement
Inline
Interface
ProduceEvent
Door : Open
NativeLanguage:ANSI_C
<<|>>adm_send_event_door_open(
<<TabIn>>
<<:>>ent_code,
<<:>>ent_door_0000000001);
<<TabOut>>
The ProduceEvent statement specifies the events that are to be generated inside the native code insert. It is probably better to specify such events at the doman level using the EventContext statement.
NativeLanguage Statement
Inline
Interface
ProduceData
number
NativeLanguage:ANSI_C
<<|>>pdt_number = 42;
<<:>>
NativeLanguage:Ada
<<|>>pdt_number := 42;
<<:>>
This statement provides the means to specify 3GL code in the standard Matrix template format. Each language fragment is given under its own NativeLanguage statement. The Model Compiler will not check the code insert in any way and will ignore any languages it is not designed to handle.
Inline Example
Matrix StateAction Inline code:
Inline
Interface
ConsumeData
Message
Code_Interface.Number
ProduceData
number
ProduceEvent
Code_Interface : Wave
NativeLanguage:ANSI_C
<<|>>pdt_number = ent_code_interface->atb_number;
<<:>>
<<:>>printf("%s\n", dst_call->message);
<<:>>
<<:>>/*
<<TabIn>>
<<:>>adm_send_event_code_interface_wave(
<<TabIn>>
<<:>>ent_code_interface,
<<:>>ent_code_interface,
<<:>>dst_call->message,
<<:>>34, 55);
<<TabOut>>
<<TabOut>>
<<:>>*/
NativeLanguage:Ada
<<|>>pdt_account_number := security.find_checking_account(
<<:>> number => ent_code_interface.number,
<<:>> message => dst_withdrawal.message);
Generated ANSI C code:
/* Inline */
pdt_number = ent_code_interface->atb_number;
printf("%s\n", dst_call->message);
/*
adm_send_event_code_interface_wave(
ent_code_interface,
ent_code_interface,
dst_call->message,
34, 55);
*/
Generated Ada code:
pdt_account_number := security.find_checking_account(
number => ent_code_interface.number,
message => dst_withdrawal.message);
A multi-language Model Compiler will generate more than one language and will incorporate more than Inline statement.
|