Re: SDL-News: how to define a Queue?

Subject: Re: SDL-News: how to define a Queue?
From: Rick Reed TSE (
Date: Thu Aug 10 2000 - 11:47:54 GMT

Become an SDL Forum Society member <>
The originator of this message is responsible for its content.
-----From Rick Reed TSE <> to sdlnews -----

Bi Hai at wrote on 10/08/2000 03:01:

> I now have little knowledge about how to define a Queue newtype in SDL.
> The declaration of Queue used for storing PDUs as they arrive. I know the PDU
> can be defined as Octet_String type. So I wonder whether I can define a Queue
> as :
> newtype Queue array(integer,Octet_String)
> endnewtype
> Can anyone give me some sugestions and more details about how to define a
> Queue in SDL?

The string construct is more suitable than an Array.

NEWTYPE QueueS String(Octet_String, EmptyOctetString)

SDL-92 has build in operators: first, last, length, mkstring and substring

The "//" infix operator concatenates Strings.

DCL os Octet_String, osq QueueS;
TASK osq := EmptyOctetString; /*intuitively obvious?*/
TASK osq := osq // mkstring (os ); /* add to end */

TASK os := osq(3); /* get 3rd item */
TASK os(i) := os; /* set i'th item */

You will probably want to define additional operators or procedures.
SDL-2000 has the following additional operator: remove.

TASK os:=remove(os,i,j);

which is defined as equivalent to

WARNING: For Octet_String as defined by Z.105 indexing starts at 1 (just
like any other SDL String). At least one tool incorrectly implemented these
strings to start at 0. For Bit_String indexing starts at zero.

Rick Reed -
Tel:+44 1455 55 96 55 Fax:+44 1455 55 96 58 Mob.:+44 7970 50 96 50

-----End text from Rick Reed TSE <> to sdlnews ----- For extra SDL Forum Society benefits, join at <>

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