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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

3.4. THE REACTION INTERFACE 41<br />

can be implemented by<br />

void STORE_CHAR (s, i, c)<br />

char *s;<br />

int i;<br />

CHAR c;<br />

{<br />

s[i] = c;<br />

}<br />

where CHAR is a user type implemented by char. <strong>The</strong> declaration “char *s”<br />

is used instead of “string *s” as would be the case for user types.<br />

3.4 <strong>The</strong> Reaction Interface<br />

<strong>The</strong> reaction function provided by the <strong>Esterel</strong> compiler for a program PROG<br />

is also called PROG. In addition, for input and output, the generated code<br />

provides a function for each input signal, and the user must provide an<br />

output function per output signal and a sensor function per sensor.<br />

3.4.1 Input Signals<br />

For each input signal IS, the <strong>Esterel</strong> compiler generates an input C function<br />

called PROG I IS, which takes an argument of the appropriate type if the<br />

signal IS conveys a value. For example, from the <strong>Esterel</strong> declarations<br />

input WATCH_MODE_COMMAND;<br />

input WATCH_TIME (WATCH_TIME_TYPE);<br />

return R;<br />

appearing in a module named DISPLAY, the compiler generates the following<br />

functions:<br />

void DISPLAY_I_WATCH_MODE_COMMAND () {...}<br />

void DISPLAY_I_WATCH_TIME (__V) WATCH_TIME_TYPE __V; {...}<br />

void DISPLAY_I_R () {...}<br />

When a program PROG should react to an input event composed of one or<br />

more simultaneous input signals, the associated input C function(s) should<br />

be called before calling the main execution function PROG.<br />

If several input functions are called before calling PROG, the corresponding<br />

input signals are considered as forming the current input event of the<br />

reaction. <strong>The</strong> input signals are considered as being simultaneous. <strong>The</strong>refore,<br />

the notion of “simultaneous signals” is a purely logical one at the C

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

Saved successfully!

Ooh no, something went wrong!