Subject: Re: SDL-News: Using the content of a string as a literal
From: Rick Reed TSE (rickreed#tseng.co.uk)
Date: Thu Aug 14 2003 - 09:44:03 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 -----
Margarita de Cabo Pérez at marcab#yllera.tel.uva.es wrote on 14/08/2003
> dcl cadena charstring:='fieldOne';
> synonym fieldOne charstring:='XYZ';
> I need to obtain "XYZ" using variable cadena.
Why don't you just write:
DCL cadena Charstring:=fieldOne;
SYNONYM fieldOne Charstring:='XYZ';
The definition order should not matter,
but it may read better if the SYNONYM comes first.
On the other hand reading:
> I have a charstring containing the name of a literal,
> and I want the value of that literal.
it seems you want a conversion function from a Charstring to the values of a
type defined as a literal set.
The array suggested by Anthony Weber <weberaa#stedeksoftware.com> may be the
most elegant way of doing this in SDL, but an SDL "array" of this type (a
sparse mapping from the unbounded type Charstring to another type) is likely
to be quite inefficient. If there are only a few possible literal values, it
may be more efficient just to write your own OPERATOR or PROCEDURE to do the
conversion. An OPERATOR of the literal set data type seem most appropriate.
-- Rick Reed - rickreed#tseng.co.uk Tel:+44 15394 88462 Mob.:+44 7970 50 96 50
BTW: Charstring should start with a capital letter. The latest versions of SDL are case sensitive. The predefined data types all start with capital letters. As a guideline - start user defined data types with capital letters for ASN.1 compatibility.
--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