[SDL Forum Society - Logo] Tutorial on SDL-88
Belina, Hogrefe (edits Reed)

3.7 Procedures

Back Home Up Next

The procedure construct in SDL is similar to the one known from programming languages. For that reason, the emphasis is put on the differences in the following presentation.

A procedure definition can appear in a process definition or in another procedure definition. It is defined by a procedure diagram. It can have formal parameters in the usual manner. A procedure diagram is similar to a process diagram, with some exceptions. For example the start symbol is replaced by the procedure start symbol:

wpe14.gif (1362 bytes)

and a return symbol is introduced:

wpe15.gif (1295 bytes)

To include a procedure in a process diagram or a procedure diagram, a procedure reference symbol with the procedure name is used:

To call a procedure in a process diagram or a procedure diagram, a procedure call symbol containing the procedure name and parameters (if any) is used in place of a task symbol:

A procedure is a dynamic part of the finite state machine of a process. It is created when a procedure call is interpreted, and it dies when the return construct is interpreted. The procedure has the same complete valid input signal set as the enclosing process, but a separate set of states. When a procedure is running, the calling process or procedure is suspended in the transition containing the procedure call. This transition is continued when the procedure terminates.

Note - In a procedure normally only some of the signals in the complete valid input signal set are consumed. All other signals should be saved in all states in order not to be lost unintentionally because of implicit transition (see §7.3 for implicit transition and §4.1 for save). This can be achieved by using the combination of asterisk state and the asterisk save short-hands. as follows:

wpe16.gif (1517 bytes)

Back Home Up Next

Contact the webmaster with questions or comments about this web site.
Copyright © 1997-May, 2013 SDL Forum Society