30.07.2013 Views

The Esterel v5 21 System Manual - Courses

The Esterel v5 21 System Manual - Courses

The Esterel v5 21 System Manual - Courses

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

3.4. THE REACTION INTERFACE 43<br />

3.4.3 Output Signals<br />

For each output signal OS, the user must write a void output C function<br />

PROG O OS that takes an argument of the appropriate type if the signal OS<br />

conveys a value. This function is automatically called by the reaction function<br />

if the signal is emitted.<br />

WARNING: <strong>The</strong> order of the output function calls performed<br />

by the reaction function is arbitrary and unspecified 1 .<br />

Assume that a reaction causes the output of a pure signal OS1 and of an<br />

integer signal OS2 with value 4. <strong>The</strong>n PROG calls the user-defined C functions<br />

PROG O OS1 and PROG O OS2 with the appropriate arguments; the following<br />

calls will be executed (in arbitrary order) in the body of PROG:<br />

PROG_O_OS1 ();<br />

PROG_O_OS2 (4);<br />

<strong>The</strong> C functions PROG O OS1 and PROG O OS2 must do whatever is necessary<br />

to communicate with the actual environment.<br />

3.4.4 Inputoutput Signals<br />

For an inputoutput signal IOS, an input C function PROG I IOS is automatically<br />

generated as for an input signal, and the user must write an output<br />

C function PROG O IOS as for an output signal.<br />

An inputoutput signal IOS received by the reactive program behaves as if<br />

it was internally emitted by it, and is therefore re-emitted outside whenever<br />

received in a reaction:<br />

• if IOS is a pure inputoutput signal, then PROG O IOS is called if IOS is<br />

received or emitted by the program. <strong>The</strong>refore, PROG O IOS is always<br />

called by the reaction function if PROG I IOS was called before.<br />

• If IOS is a single signal, then there are two cases:<br />

– If IOS is received by the program, it cannot be emitted by it<br />

in the same reaction, which is detected by the <strong>Esterel</strong> compiler<br />

when option -Icheck is set. <strong>The</strong> function PROG O IOS is called<br />

with argument the value received by PROG I IOS.<br />

1 According to the <strong>Esterel</strong> semantics, this ordering cannot be specified

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!