Re: SDL-News: SDL Quries


Subject: Re: SDL-News: SDL Quries
From: Rick Reed TSE (rickreed#tseng.co.uk)
Date: Fri Jun 15 2001 - 14:21:44 GMT


Become an SDL Forum Society member <http://www.sdl-forum.org/Society/members.htm>
The originator of this message is responsible for its content.
-----From Rick Reed TSE <rickreed#tseng.co.uk> to sdlnews -----

> BASIC SDL QUERIES: -
>
> 1) How to convert an integer value to CharString?
>
PACKAGE print;
PROCEDURE int2charstring REFERENCED;
ENDPACKAGE;

PROCEDURE int2charstring;
FPAR i integer;RETURNS charstring;
START;
RETURN IF i<0 THEN '-'//(CALL int2charstring(-i))ELSE IF i>=10 THEN(CALL
int2charstring(i/10))ELSE '' FI//mkstring(chr(num('0')+(i mod 10)))FI;
ENDPROCEDURE;
>
> 2) Consider the following SDL/PR code:
>
> When I gave the signal second('Hello', 'World'), I got
> Result('A = ,B= ') instead of Result('A = ,B
> =World')? Why does I received this behavior?
>
There is nothing wrong your SDL, but with Cinderella I got the same result.
This seems to be a bug in Cinderella when the first parameter is omitted in
a signal.

> 3) What is the use of specifying multiple names for a
> state
>

This is used when the same transition should be taken for a signal on
several states.

For example,

STATE s1, s2, s3,
INPUT i4;

....

STATE s1;
INPUT i1;
....

Note that the same state name can appear in several places, as long as the
state/signal combination is not mentioned more than once.

>
> 4) What is the use of informal task?
>
This is used when you want to produce an informal specification. To a reader
it is an indication that the system should really do something and maybe
change some variables - however it cannot (of course) be simulated or
compiled because there is no way for a tool to know exactly what was
intended. On the other hand a reader should be able to "interpret" (i.e.
mentally execute) the informal text.
>
> 5) How to use 'any'? I read, it is used to assign an
> arbitary value to a variable.
> When I tried,
> dcl x CharString;
> task x := any; --> It didn't work! WHY?
>
First: the syntax is ANY(<sortname>).

However, I tried this on my version of Cinderella for x:=ANY(Charstring) and
it crashed every time - I suggest you report a bug.
>
> 6) Now expression provides the current system time,
> isn't it? When I tried to execute the following code,
> I got 806.248000. What does this real number indicate?

It is not a "real" number but a "time" value (Note "duration" also has the
same notation).

This the number of time units since the system was started.
What the unit of time represents is not defined by Z.100 and could vary from
system to system.

I have proposed (more than once) that we change this so that one unit is one
second - but there does not seem to any great enthusiasm for Z.100 to be
more specific on this issue.

--End text from Rick Reed TSE <rickreed#tseng.co.uk> to sdlnews ---
For extra SDL Forum Society benefits join at <http://www.sdl-forum.org/Society/members.htm>



This archive was generated by hypermail 2a23 : Thu May 09 2013 - 16:05:49 GMT