DatatypeDescriptionEditor

Aus ExpeccoWiki

(Weitergeleitet von Datatype Editor)
Wechseln zu: Navigation, Suche

Inhaltsverzeichnis

Introduction

This editor is used to define new datatypes. User defined datatypes are shown in the datatype-defining pull-down lists at the bottom of the menu.

There are multiple conceptional ways to define a datatype:

  • as a subtype of an existing type (enum, range types)
  • by combining elements of existing types (tuple, array, structure or union types)
  • be explicit definition as a class or datastructure (C-type, ST/X-class type)

Also, there are various syntactical representations, in which a type may be entered:

  • XML / DTD
  • C language struct syntax
  • Copybook, IDL, ASN1
  • Internal expecco Syntax

The set of options avalable in the editor depends on the expecco version (basic, pro, enterprise) and the set of available plugins (SWIFT, ASNI1, etc.).

To define a type, choose an appropriate representation in the "type-Kind" list to get a template. Change the template and press "Accept" to install the type.

TypeEditor1.png

Type Kinds (Semantic)

Primary Types

These are builtin types of the underlying execution framework. For example, "String", "Array", "Set", "Btree", "Dictionary" to name a few. There are thousands of classes available, but you will usually get along happily with only a few. For details, please refer to the "Basic Classes Introduction".

Array Types

Are defined as a homogenous collection of a elements, which are all of the same baseType. The number of elements is variable among instances. The elements are accessable by index (1..).

Tuple Types

Are defined as a non-homogenous, fixed size vector of a elements. Each element has a predefined type. The types may be different among elements, but all isntances of the tuple type have the same type of element at corresponding positions. The elements are accessable by index (1..).

Class Types

A user defined class. Includes the instance's private slots (also called "instance variables"), and a set of operations (usually called "methods" or "virtual functions"). All of this information is stored with the testSuite. Instance slots are accessable by getter/setter method invocations.

Compound Types

A collection of named slots. Is similar to a Class Type without operations (actually, that is how the system represents them internally). The elements are accessable by name.

Enumeration Types

A single symbolic value from a list of enumerated values.

Range Types

A subrange of of either Character or Integer.

Union Types

The instance can be an instance from a number of other types.

Type Representation (Syntax)

Various textual representations are possible; some are already built into the base expecco system, others are addons and present if certain plugins are installed.

Expecco Type Syntax

Expecco provides its own native type-description language, with an easy to understand and use syntax:

type ::= <nonArrayType> | <arrayType>
arrayType ::= <nonArrayType> '[' ']'
nonArrayType ::= <tupleType> | <unionType> | <compoundType> 
                             | <enumType> | <rangeType> | <monitorType> 
                             | <primaryType> | <simpleType>
tupleType ::= '(' <elementType1> <elementType2> .. <elementTypeN> ')'
elementType ::= <type>
unionType ::= '(' <alternativeType1> '|' <alternativeType2 > '|' .. <alternativeTypeN> ')'
alternativeType ::= <type>
enumType := 'enum' '(' <enumValue1> <enumValue2> .. <enumValueN> ')'
enumValue ::= <identifier> | <quoted-string> | <dquoted-string>
rangeType := 'range' '(' <baseType> ':' minValue .. <maxValue> ')'
minValue ::= <constant>
maxValue ::= <constant>
monitorType := 'monitor' '(' <baseType>')'
portType := 'port' '(' <baseType>')'
compoundType ::= '{' <fieldSpec1> <fieldSpec2> .. <fieldSpecN> '}'
fieldSpec ::= <fieldIdentifier> ':' <fieldType> [ '=' <defaultValue> ]
fieldType ::= <type>
primaryType ::= '<' <BuiltIn-Classname> '>'
BuiltIn-Classname ::= <identifier>
simpleType ::= <anyType> | <templateType> | <namedType>
anyType ::= '*'
templateType ::= '#' <templateIdentifier>

constraintTemplateType ::= '#' <templateIdentifier> <setOfConstraintTypes>
setOfConstraintTypes ::= <unionType>
<namedType> ::= 'any' | <typeName_in_project> | <Smalltalk-Classname>
typeName_in_project ::= <identifier>

This format is used if you select "Defined" type in the editor. It is also expected if you select "Define..." in one of the type menus (Pin-Type, Veriable-Type, Skill-Type). Support for this representation is part of the base expecco system.

DTD Type Definition

A DTD-Defintion can also be used to specify a compound type. For this, choose "Compound (DTD-Defined)", and paste the DTD into the text area. Support for this representation is part of the base expecco system.

C-Language Type Definition

A C-Language code fragment can also be used to specify a compound or union type. For this, choose "CType-C-Defined)", and paste the C-type definition into the text area. Support for this representation is part of the base expecco system.

A typical C-Language definition looks like:

struct {
   int i1;
   float f1;
   double d1;
   char c[20];
}

Instances of this type are especially useful when calling external DLL functions.

COBOL CopyBook Definition

Parses a Cobol-CopyBook type-definition. This is only avaliable as plugin. Please read the corresponding plugin documentation for details.

ASN1 Type Definiton

Parses an ASN1 type-definition. This is only avaliable as plugin. Please read the corresponding plugin documentation for details.

SunRPC Type Definiton

Parses a SunRPC type-definition, which is used for example in the NFS file-system or in VISA lab equipment interfaces. This is only avaliable as plugin. Please read the corresponding plugin documentation for details.

COM/DCOM-IDL Type Definiton

Parses a COM/DCOM IDL type-definition. This is only avaliable as plugin. Please read the corresponding plugin documentation for details.

Meine Werkzeuge