![]() |
![]() |
![]() |
![]() |
![]() |
Translation of ASN.1 to SDL
This section describes the detailed translation rules from ASN.1 to SDL that are implemented in the ASN.1 Utilities. The translation rules all conform to Z.105, except for the cases described in Restrictions to Z.105.
General
- Case sensitivity is according to Z.105, i.e. ASN.1 names are converted directly to SDL names. This implies that in rare cases, correct ASN.1 modules may cause name conflicts when used in SDL.
Since named numbers, named bits, and integer values are all mapped to integer synonyms, the same name should not be used more than once, because this will lead to name conflicts in SDL.
- `-' (dash) in ASN.1 names is transformed to `_' (underscore), e.g. long-name in ASN.1 is transformed to long_name in SDL.
- In accordance with Z.105, tag information is ignored in the translation to SDL.
- As SDL does not have "in-line types", one ASN.1 type may be mapped to more than one SDL type. The generated in-line types get dummy names.
- External type/value references are mapped to qualifiers. For example A.a is mapped to <<package A>> a. Also a use clause (use A;) is generated.
Keywords substitution
ASN.1 generators can be configured to be sensitive to a certain number of identifiers. There is a special text file named `asn1util_kwd.txt' that contains a list of identifiers and a list of their substitution during mapping. By default this file is used to configure target languages keywords substitution. It can be edited to get another functionality or another set of keywords to be replaced.
`asn1util_kwd.txt' should contain pairs of identifiers where the first one is the identifier from original ASN.1 specification that will be replaced by the second identifier during generation. `asn1util_kwd.txt' should conform to the following syntax:
Example 33 Configuration file syntax
<identifier1> <identifier1 substitution><identifier2> <identifier2 substitution>...<identifierN> <identifierN substitution>ASN.1 Utility reads the first configuration file it finds. It searches for the `asn1util_kwd.txt' file first in the current folder, then in the home folder and finally in the installation. If a configuration file named `asn1util_kwd.txt' is put in the home folder or in the current working folder, it will override the default configuration file from the installation. The configuration file to be used can also be specified in the Analyze dialog or from the command line with the `-K' option (see Command-Line Interface).
`asn1util_kwd.txt' is always present in the installation and it is configured to replace keywords from SDL, TTCN, C and C++ languages: the ASN.1 identifier name, that is a keyword in SDL, TTCN or C++, is replaced by name_SDL_KEYWORD, name_TTCN_KEYWORD or name_CPP_KEYWORD to avoid syntax errors in the target languages (see Appendix A: List of recognized keywords). If an original ASN.1 identifier has been modified, a warning message is reported. See ERROR 2077 ASN.1 identifier #1 is a keyword, it will be replaced by #2).
Example 34 Keywords default substitution
CASE ::= ENUMERATED { upper, lower }T ::= SEQUENCE {int INTEGER,explicit BOOLEAN,case CASE,signal INTEGER}value1 T ::= {int 5,explicit TRUE,case lower,signal 27 }With default keywords substitution file the following SDL is generated:
newtype CASE_TTCN_KEYWORDliterals upper,loweroperatorsordering;endnewtype;newtype T structint_CPP_KEYWORD Integer;explicit_CPP_KEYWORD Boolean;case_CPP_KEYWORD CASE_TTCN_KEYWORD;signal_SDL_KEYWORD Integer;endnewtype;synonym value1 T = (. 5, true, lower, 27 .);A configuration file allows the user to control the set of keywords to be replaced. Removing lines with TTCN keywords, for example, will switch off TTCN keywords sensitivity. Providing an empty configuration file will result in switching off keywords substitution completely.
Module
- An ASN.1 module is translated to an SDL package as specified in Z.105. The DefinitiveIdentifier (object identifier after module name) is ignored. The tag default is also ignored.
- EXPORTS is mapped to a corresponding interface-clause.
- IMPORTS is mapped to a corresponding package reference clause. The AssignedIdentifier (object identifier after module name) is ignored.
On UNIX, the -b option disables generation of package/endpackage, interface and use clauses. Files that have been generated this way can be included in SDL with the #INCLUDE directive, see Including PR Files.
MyModule DEFINITIONS ::= BEGINEXPORTS A, b, C;IMPORTS X, Y, z FROM SomeModule { iso 3 0 8 }...ENDpackage MyModule;interface newtype A, synonym b, newtype C;use SomeModule / newtype X, newtype Y, synonym z;...endpackage;Joining modules
Mapping for ASN.1 original module structure can be changed by applying joining module functionality. Several ASN.1 modules can be generated into one SDL package, if ASN.1 modules are arranged into groups in the Organizer. Joining modules can also be controlled from the command line (see Command-Line Interface).
Joining means throwing away all import/export clauses and module headers and generating all module bodies into one big package with the name specified in the Organizer or command line interface.
When joining definitions from several ASN.1 modules into one SDL package, names in the resulting SDL package change according to the following rules:
- Clashed names are prefixed by the original ASN.1 module name
- Package names in the external references are replaced by the join package name
M1DEFINITIONS ::=BEGINIMPORTS S2 FROM M2;T ::= SET OF SEQUENCE { a S2 }S1 ::= IA5StringENDM2DEFINITIONS ::=BEGINT ::= SEQUENCE OF SEQUENCE OF M1.S1S2 ::= BOOLEANENDwithout joining applied ASN.1 modules M1 and M2 are mapped to
use M2/newtype S2;package M1; /*#ASN.1 'M1'*/newtype TBag(T_INLINE_0)endnewtype;newtype T_INLINE_0 /*#SYNT*/ structa S2;endnewtype;syntype S1 = IA5String endsyntype;endpackage M1;package M2; /*#ASN.1 'M2'*/newtype TString (T_INLINE_0, emptystring)endnewtype;newtype T_INLINE_0 /*#SYNT*/String (<<package M1>>S1, emptystring)endnewtype;syntype S2 = Boolean endsyntype;endpackage M2;with joining to package Join-Package applied ASN.1 modules are mapped to
package Join_Package; /*#ASN.1 'Join_Package'*/newtype M1_TBag(M1_T_INLINE_0)endnewtype;newtype M1_T_INLINE_0 /*#SYNT*/ structa S2;endnewtype;syntype S1 = IA5String endsyntype;newtype M2_TString (M2_T_INLINE_0, emptystring)endnewtype;newtype M2_T_INLINE_0 /*#SYNT*/String (<<package Join_Package>>S1, emptystring)endnewtype;syntype S2 = Boolean endsyntype;endpackage Join_Package;General Type and Value Assignment
A type assignment is mapped to a newtype or a syntype, depending on the type on the right-hand side of the `::='. Tags are ignored. An ASN.1 value assignment is mapped to a synonym.
T1 ::= INTEGERT2 ::= [APPLICATION 28] T1a BOOLEAN ::= TRUEsyntype T1 = Integer endsyntype;syntype T2 = T1 endsyntype;synonym a Boolean = True;Inline types naming
The ASN.1 language can use type definitions inside composite types, which are called inline types. Inline types are not allowed in SDL. In SDL, only named types can be used in a composite type. Implicit names are assigned to ASN.1 inline types and they are referenced by this name in SDL.
Implicit names for generated SDL have the following syntax: <parent_definition_name>_INLINE_<counter>, where parent_definition_name is either the name of the parent type or the name of the parent value, depending on if inline type exists in type or value assignment construct in ASN.1.
T1 ::= SEQUENCE {a SET OF INTEGER,b CHOICE { x BIT STRING,y OCTET STRING },c ENUMERATED { sat, sun } }For type T the following inline types will be generated to SDLnewtype T1 structa T1_INLINE_0;b T1_INLINE_1;c T1_INLINE_2;endnewtype;newtype T1_INLINE_0 /*#SYNT*/Bag(Integer)endnewtype;newtype T1_INLINE_1 /*#SYNT*/ choicex Bit_string;y Octet_string;endnewtype;newtype T1_INLINE_2 /*#SYNT*/literals sat,sunoperatorsfirst: T1_INLINE_2 -> T1_INLINE_2;last: T1_INLINE_2 -> T1_INLINE_2;succ: T1_INLINE_2 -> T1_INLINE_2;pred: T1_INLINE_2 -> T1_INLINE_2;num: T1_INLINE_2 -> Integer;ordering;<operator definitions>endnewtype;T2 SEQUENCE OF INTEGER ::= { {1,1} | {2,2} }For T2 the following inline types will be generated to SDLnewtype T2 /*#SYNT*/String (Integer, emptystring)constants ((. 1, 1 .)), ((. 2, 2 .))endnewtype;val BIT STRING ( SIZE(3) ) ::= `101'Bsynonym val val_INLINE_0 = bitstr('101');syntype val_INLINE_0 = Bit_string constants size (3) endsyntype;
Boolean, NULL, and Real
BOOLEAN, NULL and REAL are mapped to the corresponding SDL types. Value notations for these types are mapped as follows
ANY BOOLEAN TRUE FALSE NULL NULL REAL 0 PLUS-INFINITY MINUS-INFINITY { mantissa 31416, base 10, exponent -4 }If a REAL value has an exponent bigger than 1000 and if the mantissa is not zero, then it is mapped to PLUS_INFINITY or MINUS_INFINITY. If a REAL value has an exponent less than -1000, then it is mapped to 0.
Bit String
BIT STRING is mapped to the Z.105-specific type Bit_string. Named bits are mapped to integer synonyms. Values for bit strings are mapped to hexstr/bitstr expressions.
B ::= BIT STRING { bit0(0), bit23(23) }b1 BIT STRING ::= `011 1110'Bb2 BIT STRING ::= `3AFC'Hsyntype B = Bit_string endsyntype;synonym bit0 Integer = 0;synonym bit23 Integer = 23;synonym b1 Bit_string = bitstr(`0110 1110');synonym b2 Bit_string = hexstr(`3AFC');
Bit_string, as opposed to most other string types in SDL, has indices starting with 0!
Type Bit is a Z.105 specific type with literals 0 and 1, and with boolean operators.
bitstr : Charstring -> Bit_string;/* converts a Charstring consisting of `0' and`1'-s to a Bit_string */hexstr : Charstring -> bit_string;/* converts a Charstring consisting ofhexadecimal characters to a bit_string */"not" : Bit_string -> Bit_string;"and" : Bit_string, Bit_string -> Bit_string;"or" : Bit_string, Bit_string -> Bit_string;"xor" : Bit_string, Bit_string -> Bit_string;"=>" : Bit_string, Bit_string -> Bit_string;/* bitwise logical operators */mkstring : Bit -> Bit_string;length : Bit_string -> Integer;first : Bit_string -> Bit;last : Bit_string -> Bit;"//" : Bit_string, Bit_string -> Bit_string;extract : Bit_string, Integer -> Bit;modify! : Bit_string, Integer, Bit-> Bit_string;substring : Bit_string, Integer, Integer ->Bit_string;/* normal String operators, except that indexstarts with 0;see also Sequence of Types */Character Strings
PrintableString, NumericString, VisibleString, and IA5String (i.e. all ASN.1 character string types with character sets that are a subset of ASCII) are mapped to syntypes of SDL Charstring. Values for these strings are mapped to corresponding Charstring synonyms in SDL.
The same operators as for Charstring are available for these types, and values of these types can be assigned freely to each other without need for conversion operators.
For example, in SDL an IA5String value can be assigned to a NumericString variable (given that the IA5String only contains numeric characters).
Choice Types
A CHOICE type is mapped to the choice-construct that is described in more detail in Choice.
C ::= CHOICE {a INTEGER,b BOOLEAN}c C ::= a:7newtype C choicea Integer;b Boolean;endnewtype;synonym c C = a:7The operators that are available for a CHOICE type are (assuming that C is defined as in Example 42 above):
aextract! : C -> Integer;/* e.g. c!a returns 7 */bextract! : C -> Boolean;/* but c!b gives dynamic error! */amake! : Integer -> C;
bmake! : Boolean -> C;/* build choice value, e.g. in SDLit is possible to write b:True */amodify! : C, Integer -> C;/* e.g. var!a := -5 */bmodify! : C, Boolean -> C;presentextract! : C -> xxx;/* returns the selected field.xxx is an anonymous type with values a and b.E.g. c!present gives a */Enumerated Types
An ENUMERATED type is mapped to a newtype with a set of literals plus some operators. By default only ordering operators are generated, use command line option -e to get the rest. The list of literals that is generated is reordered in accordance with the associated integer values.
N ::= ENUMERATED { yellow(5), red(0), blue(6) }is mapped to (only signature of operators shown)
newtype Nliterals red, yellow, blue/* note that the literals have been reordered! */operatorsordering;first: N -> N;last: N -> N;succ: N -> N;pred: N -> N;num: N -> Integer;endnewtype,The operators that are available for an ENUMERATED type are (assuming that N is defined as in Example 43 above):
num : N -> Integer;/* num(yellow)=5, num(red)=0, num(blue)=6 */"<" : N, N -> Boolean;"<=": N, N -> Boolean;">" : N, N -> Boolean;">=": N, N -> Boolean;/* comparison based on num, i.e. red < yellow */pred: N -> N;succ: N -> N;/* predecessor/successor based on num, i.e.succ(red)=yellow, succ(yellow)=blue,pred(red) gives a dynamic error */first: N -> N;last : N -> N;/* first/last element based on num, i.e.first(red)=red, last(red)=blue */Integer
INTEGER is mapped to the SDL Integer type, and ASN.1 integer values are mapped to corresponding SDL values.
Named numbers are mapped to synonyms.
A ::= INTEGER { a(5), b(7) }syntype A = Integer endsyntype;synonym a Integer = 5;synonym b Integer = 7;Object Identifier
OBJECT IDENTIFIER is mapped to the Z.105-specific type Object_Identifier. The normal String operators are available for Object_Identifier, listed also in Sequence of Types. Indices start as usual with 1.
Octet String
OCTET STRING is mapped to the Z.105-specific type Octet_string. Octet_string is based on type Octet. This type is further described in SDL Predefined Types. The mapping for the octet string value notation to SDL is identical to bit strings, see Bit String.
bitstr : Charstring -> Octet_string;hexstr : Charstring -> Octet_string;/* conversion from Charstring to Octet_string,see also Bit String*/bit_string : Octet_string -> Bit_string;octet_string: Bit_string -> Octet_string;/* conversion operatorsOctet_string <-> Bit_string */mkstring : Octet -> Octet_string;length : Octet_string -> Integer;first : Octet_string -> Octet;last : Octet_string -> Octet;"//" : Octet_string, Octet_string ->Octet_string;extract! : Octet_string, Integer -> Octet;modify! : Octet_string, Integer, Octet ->Octet_string;substring : Octet_string, Integer, Integer ->Octet_string;/* normal String operators, see alsoSequence of Types */Sequence/Set Types
SEQUENCE and SET are both mapped to SDL struct. From an SDL point of view there is no difference between SEQUENCE and SET. In order to support optional and default components, SDL has been extended with corresponding concepts.
Optional and default fields in struct are both non-standardized extensions to SDL.
Values are mapped to the "(. ... .)" construct (= Make! operator). Values for optional and default components are not supported. Instead, SDL tasks should be used to assign optional and default components.
S ::= SEQUENCE {a INTEGER OPTIONAL,b BOOLEAN,c IA5String DEFAULT "xyz" }s S ::= { b TRUE }newtype S structa Integer optional;b Boolean;c IA5String := `xyz';endnewtype;synonym s S = (. True .);The operators that are available for a SEQUENCE or SET type are (assuming that S is defined as in Example 45 above):
make! : Boolean -> S;/* builds a value for S */aextract!: S -> Integer;bextract!: S -> Boolean;cextract!: S -> IA5String;/* Extract operators. Note that aextract! givesdynamic error if the field has not been set */amodify! : S, Integer -> S;bmodify! : S, Boolean -> S;cmodify! : S, IA5String -> S;/* Modify operators change one componentin a Sequence/Set */apresent : S -> Boolean;/* gives True if component a has been assigneda value, e.g. aPresent(s) = False */Sequence of Types
SEQUENCE OF is mapped to the String generator. Values are mapped to corresponding synonyms.
S ::= SEQUENCE OF INTEGERs1 S ::= { 3, 2, 5 }s2 S ::= {}newtype SString (Integer, Emptystring)endnewtype;synonym s1 S = (. 3, 2, 5 .);synonym s2 S = (. .);The normal String operators are available for Sequence types. Indices start at 1.
The operators that are available for a SEQUENCE OF type are (assuming that S is defined as in Example 46 above):
mkstring : Integer -> S;/* make a sequence of one item */length : S -> Integer;/* returns number of elements in sequence */first : S -> Integer;/* returns first element in sequence */last : S -> Integer;/* returns last element in sequence"//" : S, S -> S;/* returns concatenation of two sequences */extract! : S, Integer -> Integer;/* returns the indexed element */modify! : S, Integer, Integer -> S;/* modify the indexed element */substring : S, Integer, Integer -> S;/* Substring(S, i, l) returns substring of Sof length l, starting at index i */make! : * Integer -> S;/* adds the included elements to the string,* corresponds to (. .) */append : in/out S, Integer;/* appends one element to the string */Set of Types
SET OF is mapped to the Z.105 specific Bag generator. For a more complete description of the Bag generator, see Bag.
S ::= SET OF INTEGERs1 S ::= { 2, 2, 5 }s2 S ::= {}newtype SBag (Integer)endnewtype;synonym s1 S = (. 2, 2, 5 .);synonym s2 S = (. .);The operators that are available for a SET OF type are (assuming that S is defined as in Example 47 above):
incl : Integer, S -> S;/* add an element to the bag */del : Integer, S -> S;/* delete one element */incl : Integer, in/out S;del : Integer, in/out S;length : S -> Integer;/* returns number of elements */take : S -> Integer;/* return some element from the bag */take : S, Integer -> Integer;/* return the indexed element in the bag */makebag : Integer -> S;/* build a bag of one element */"in" : Integer, S -> Boolean;/* gives true if the element is in the bag */"<" : S, S -> Boolean;">" : S, S -> Boolean;"<=" : S, S -> Boolean;">=" : S, S -> Boolean;/* subset/superset comparison operators */"and" : S, S -> S;"or" : S, S -> S;/* intersection/union operators */make! : * Integer -> S;/* adds the included elements to the bag,* corresponds to (. .) */Useful Types
The types GeneralizedTime and UTCTime have been defined in terms of ASN.1 as specified in X.680. It follows from their definition in X.680, together with the information about the translation rules given in this chapter, which operators are available in SDL for these types.
Constrained Types
Constrained types are mapped to sdl syntypes of the associated parent sort. Value constraints are mapped to sdl range condition.
When specifying ASN.1 value constraints, several constructs can be used that are not supported in the SDL Suite, such as ALL EXCEPT,INCLUDES <subtype> and value range with MIN or MAX endpoint. Possible values for such a type are computed and mapped to syntype with range condition represented by a sequence of open and closed ranges.
T ::= INTEGER ( (1..10) EXCEPT 8 )T1 ::= INTEGER ( INCLUDES T EXCEPT (3..<6) )syntype T = Integerconstants 9 : 10, 1 : 7endsyntype;syntype T1 = Integerconstants 9 : 10, 6 : 7, 1 : 2endsyntype;"COMPONENTS OF" and "WITH COMPONENT" constraints are mapped by using extra inline types. If the present constraint is applied to the parent type, then the new type is generated excluding fields marked as ABSENT and including fields marked as PRESENT.
T ::= SEQUENCE {a INTEGER,b IA5String}T1 ::= T ( WITH COMPONENTS {a (-5..5),b (SIZE (7))} )newtype T structa Integer;b IA5String;endnewtype;newtype T1 structa T1_INLINE_0;b T1_INLINE_1;endnewtype;syntype T1_INLINE_0 = Integer constants -5 : 5endsyntype;syntype T1_INLINE_1 = IA5String constants size(7)endsyntype;T ::= SET OF BIT STRINGT1 ::= T ( WITH COMPONENT (SIZE (5)) )newtype TBag(Bit_string)endnewtype;syntype T1 = T1_INLINE_0 endsyntype;newtype T1_INLINE_0 /*#SYNT*/Bag(T1_INLINE_1)endnewtype;syntype T1_INLINE_1 = Bit_stringconstants size (5)endsyntype;T ::= SET {a INTEGER OPTIONAL,b REAL OPTIONAL}T1 ::= T ( WITH COMPONENTS {a (0..<MAX) PRESENT,b ABSENT} )newtype T structa Integer optional;b Real optional;endnewtype;newtype T1 structa T1_INLINE_0;endnewtype;syntype T1_INLINE_0 = Integer constants >=0endsyntype;
According to ASN.1, the types T and T1 are compatible, because they are derived from each other. In SDL these are different types and values of type T can not be assigned to type T1.
ASN.1 SET OF and SEQUENCE OF types with SIZE or single value constraints are mapped to one SDL type with constraint without introducing any extra inline types.
T1 ::= SEQUENCE SIZE (5..15) OF INTEGERT2 ::= SEQUENCE ( { 1 } | {} ) OF INTEGERT3 ::= SET (SIZE (MIN .. <100) ) OF BOOLEANT4 ::= SET (SIZE (15) | { ''B } ) OF BIT STRINGnewtype T1String(Integer, emptystring)constants size (5 : 15)endnewtype;newtype T2String(Integer, emptystring)constants ((. .)), ((. 1 .))endnewtype;newtype T3Bag(Boolean)constants size (<=99)endnewtype;newtype T4Bag(Bit_string)constants ((. bitstr('') .)), size (15)endnewtype;Extensibility
Extensibility was introduced in X.680 (1997). In ASN.1 extensibility is represented with extension markers and extension addition groups, that can be specified inside SET, SEQUENCE, CHOICE, ENUMERATED types and constraints.
Extension markers are not visible in SDL translations. All square brackets are ignored and all components from extension addition groups are translated into SDL as individual fields. All required components from extension additions, individual or from extension addition groups are mapped to optional ones.
S1 ::= SET{x [100] INTEGER,... ,[[gr11 REAL]],t BIT STRING,[[gr21 BOOLEAN OPTIONAL,gr22 SET OF INTEGER]],... ,y INTEGER}newtype S1 structx Integer;gr11 Real optional;t Bit_string optional;gr21 Boolean optional;gr22 S1_INLINE_1 optional;y Integer;endnewtype;newtype S1_INLINE_1 /*#SYNT*/Bag(Integer)endnewtype;
Extension markers are ignored in constraints. If both root and additional constraints are present, they are translated to the union constraint.
T1 ::= INTEGER ( 1..10 ^ 2..20, ... , 12 )is mapped to SDLsyntype T1 = Integer constants 12, 2 : 10 endsyntype;T2 ::= INTEGER (1 | 3, ... )is mapped to SDLsyntype T2 = Integer constants 3, 1 endsyntype;Information from Object Classes, Objects and Object Sets
Object classes, object and objects sets are not translated to SDL. Only types and values are translated to SDL, but it is possible in ASN.1 to use information from object classes, objects and object sets when specifying types and values. This information is translated into SDL.
ObjectClassFieldType
ObjectClassFieldType is a reference to object class and a field in that class. The translation to SDL depends on the kind of field name used.
An open type is defined if the field name references a type field, a variable type value field or variable type value set field. An open type can be any ASN.1 type. Open types are translated to Octet_string types in SDL.
OPERATION ::= CLASS {&ArgumentType,&arg &ArgumentType}T1 ::= SEQUENCE { a OPERATION.&ArgumentType }newtype T1 structa T1_INLINE_0;endnewtype;syntype T1_INLINE_0 = Octet_string endsyntype;T2 ::= OPERATION.&argsyntype T2 = Octet_string endsyntype;If the field name in the class references a fixed type value or fixed type value set fields, then the fixed type is used when translated to SDL.
OPERATION ::= CLASS {&ValueSet INTEGER}T ::= OPERATION.&ValueSetsyntype T = Integer endsyntype;ObjectClassFieldType with table constraint (object set constraint)
Table constraint applied to ObjectClassFieldType restricts the set of possible types or values to those specified in a column of the table. A table corresponds to an object set. The columns of the table correspond to the object class fields and the rows correspond to the objects in the set.
If the field name in ObjectClassFieldType is a type field and constrained with a table, then it is translated to a CHOICE type with fields of the types specified in the table column. The names of the fields in the choice are the same as the names of the types in the column but the first letter is changed from upper case to lower case.
If the type in the field is inline then the name in the field will be an implicitly generated inline name, like t_INLINE_4.
If the field name in ObjectClassFieldType is a fixed type value or a fixed type value set, then this is translated to a constrained type where only values that are specified in the table column are permitted.
If the field name in ObjectClassFieldType is a variable type value or variable type value set field, then this is translated to a CHOICE type with types, that are constrained to have values specified in the corresponding cell in the same row of the table.
OPERATION ::= CLASS {&ArgumentType,&operationCode INTEGER UNIQUE,&ValueSet INTEGER,&ArgSet &ArgumentType}C1 ::= OPERATION.&ArgumentType ( {My-Operations} )newtype C1 choiceinteger Integer;c1_INLINE_2 C1_INLINE_1;endnewtype;newtype C1_INLINE_1 /*#SYNT*/Bag(Integer)endnewtype;C2 ::= OPERATION.&operationCode ( {My-Operations} )syntype C2 = Integer constants 2, 1 endsyntype;C3 ::= OPERATION.&ValueSet ( {My-Operations} )syntype C3 = Integer constants 2 : 8, 1, 5 : 8, 2 endsyntype;C4 ::= OPERATION.&ArgSet ( {My-Operations} )newtype C4 choicec4_INLINE_1 C4_INLINE_1;c4_INLINE_1 C4_INLINE_2;endnewtype;syntype C4_INLINE_1 = Integer constants 111 : 444 endsyntype;syntype C4_INLINE_2 /*#SYNT*/Bag(Integer)constants ((. 888 .)), ((. 1, 2, 3 .))endsyntype;If an open type is constrained by the table for which all type settings are omitted, then it is translated to SDL Octet_string instead of an empty CHOICE type.
MY-CLASS ::= CLASS {&id INTEGER,&OpenType OPTIONAL}S ::= SEQUENCE {id MY-CLASS.&id({My-Set}),val MY-CLASS.&OpenType({My-Set}{@id})}newtype S structid S_INLINE_0;val S_INLINE_2;endnewtype;syntype S_INLINE_0 = Integer constants 2, 1 endsyntype;syntype S_INLINE_2 = Octet_string endsyntype;TypeFromObject
TypeFromObject is a reference to an object and a type field in that object. This is simply translated to that type in SDL. If the field is optional in the class and not set in the object, then TypeFromObject cannot be translated.
OPERATION ::= CLASS {&ArgumentType,&ResultType}operationA OPERATION ::= {&ArgumentType INTEGER,&ResultType BOOLEAN}O1 ::= operationA.&ArgumentTypesyntype O1 = Integer endsyntype;O2 ::= operationA.&ResultTypesyntype O2 = Boolean endsyntype;ValueSetFromObject
ValueSetFromObject is a reference to an object and a field with a set of values in that object. This is translated to a constrained type in SDL, allowing only values from the value set.
OPERATION ::= CLASS {&ValueSet INTEGER}operationA OPERATION ::= {&ValueSet { 1 | 2 | 5..8 }}V1 ::= operationA.&ValueSetsyntype V1 = Integer constants 2, 5 : 8, 1 endsyntype;ValueFromObject
ValueFromObject is a reference to an object and a field with a value in that object. This is translated to the same value in SDL.
OPERATION ::= CLASS {&operationCode INTEGER UNIQUE}operationA OPERATION ::= { &operationCode 1 }val2 INTEGER ::= operationA.&operationCodesynonym val2 Integer = 1;CONSTRAINED BY notation
CONSTRAINED BY is treated like a comment and is not translated to SDL.
Parameterization
Wherever a parameterized type or value is used, it is translated to SDL after all dummy references are replaced by the actual parameters. A parameterized value is also translated after all dummy references are replaced by the actual parameters.
Parameterized assignments are ignored when translating to SDL.
Container { ElemType, INTEGER : maxelements } ::=
SET SIZE (0..maxelements ) OF ElemTypeIntcontainer ::= Container {INTEGER, 25}Intcontainer ::= SET SIZE( 0..25 ) OF INTEGERand then translated to SDL. Container is not translated to SDL.
http://www.ibm.com/rational |
![]() |
![]() |
![]() |
![]() |