FAQ - Hints and tips on SDL






How can I assign a value to an array ?
How is done the correspondance between a VIRTUAL and REDEFINED continous signal ?
How can I force an error during simulation of an SDL system ?
How can I write graphical ADT (NEWTYPE) operators ?
How can I send a signal to another instance of the same process ?
Can I send a signal to a process just indicating its name, not its PID ?
Remote procedures
SYNTYPES of SYNTYPES
How can I access to SEQUENCE OF elements ?
Can I use shift in BIT_STRING ?
Ancestor SIZE lost ?

Z.100

Q. How can I assign a value to an array ?
A. Use T:= (. 25 .), which sets to 25 all the elements of the array T. This is handy for specifying a default value. To assign a single element of an array, use T(3):= 7.

Q. How is done the correspondance between a VIRTUAL and REDEFINED continous signal ?
A. By its priority value (and not by the expression). Thus if several continuous signals in a process under a given state have the same priority, you are not allowed to redefine them in a subtype. Also if several continous signals exist in a process under a given state with no priority, only one is allowed to be VIRTUAL.

Q. How can I force an error during simulation of an SDL system ?
A. Use the ERROR keyword. In SDL88, ERROR! was only allowed in a NEWTYPE. Since SDL92, ERROR (without '!') is allowed also in any expression (ex.: x:=ERROR). Simulation of such a statement raises an exception.

Q. How can I write graphical ADT (NEWTYPE) operators ?
A. ADT operators can be defined graphically (Z.100 5.3.2). For this, provide an operator diagram in which you describe graphically the operator (at the top level, for example at the level of the packages). Then in an ADT, write the operator signature, like in the example below:

     NEWTYPE APCap
       STRUCT
         len Integer;
         data CapList;
       OPERATOR cat_III_eng   /* Do NOT put ';'s in this part */
         FPAR x Integer
         RETURNS Boolean
         REFERENCED;
     ENDNEWTYPE;

Q. How can I send a signal to another instance of the same process ?
A. Use OUTPUT sig TO pid, pid being a variable containing the PID of an instance of the same process, add SIGNALSET sig; in the process, and declare SIGNAL sig; in the parent block or upper. It works !

Q. Can I send a signal to a process just indicating its name, not its PID ?
A. You can use OUTPUT sig TO proc_name, but remenber that the target process must belong to the same block as the sender. And it is safer if the target process has exactly one instance, i.e. it is declared PROCESS proc_name (1,1);

Q. Remote procedures
A. CALL remote_procedure TO process: remember that the target process and the caller must be in the same block (if TO pid, different blocks OK). The signature of a remote procedure must be declared in the remote and import statements, without the parameters names:

     IMPORTED PROCEDURE initFCC; FPAR INTEGER; RETURNS BOOLEAN;
Remote procedures can only be called from a process or a service, so they cannot be called from a procedure which is outside of a process. Several remote procedures with the same signature can be exported. In this case, one of them is arbitrary called (like for an output with multiple receivers). The syntax for EXPORTED AS is:
     EXPORTED AS initFCC PROCEDURE initLRU; FPAR etc.

Q. SYNTYPES of SYNTYPES
A. Only the last constraint is taken into account when a syntype is based on another syntype (Z.100 5.3.1.9 p.134). Example:

     SYNTYPE sy1=INTEGER CONSTANTS 0:255 ENDSYNTYPE;
     SYNTYPE sy2=sy1 CONSTANTS 0:511 ENDSYNTYPE; 
is equivalent to:
     SYNTYPE sy2=NATURAL CONSTANTS 0:511 ENDSYNTYPE; 
The constraint 256 is 'lost'.

Z.105 (SDL + subset of ASN.1)

Q. How can I access to SEQUENCE OF elements ?
A. The notation T(3):=45 is incorrect. Use T:=modifiy(T, 3, 45).

Q. Can I use shift in BIT_STRING ?
A. No. Shift operators are NOT provided for BIT_STRING. In ObjectGEODE, the Hexadecimal extension to Z.100 provides shift operators, plus the addition of Hexadecimal numbers etc.

Q. Ancestor SIZE lost ?
A. In the following example, typ2 can contain more than two NumericString:

     typ1::=SEQUENCE SIZE(2) OF NumericString;
     typ2::=typ1 (WITH COMPONENT (SIZE(3)));
Thus the following statement is legal:
     DCL x typ2:= {"fir","sec","thi"};

Copyright © TransMeth Sud-Ouest 1997-2003