1 ///////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2000-2014 Ericsson Telecom AB
3 // All rights reserved. This program and the accompanying materials
4 // are made available under the terms of the Eclipse Public License v1.0
5 // which accompanies this distribution, and is available at
6 // http://www.eclipse.org/legal/epl-v10.html
7 ///////////////////////////////////////////////////////////////////////////////
11 #include "asn1/asn1p_old.h"
12 #include "ttcn3/rawASTspec.h"
19 /* C structures for representing TTCN-3 and ASN.1 types */
21 typedef enum { RECORD
, SET
, UNION
, ANYTYPE
} struct_def_kind_enum
;
23 typedef enum { RECORD_OF
, SET_OF
} struct_of_def_kind_enum
;
31 /* bit fields, use one of {ANY_ATTRIB_BIT,ANY_ELEM_BIT} and
32 * one of {ANY_FROM_BIT, ANY_EXCEPT_BIT} */
34 /** Flags that determine the type(s) of value an object or field will be encoded
37 JSON_NONE
= 0x00, // no value type set (default)
38 JSON_NUMBER
= 0x01, // integer and float
39 JSON_STRING
= 0x02, // all string types, the verdict type and enumerated values
40 JSON_LITERAL
= 0x04, // boolean (true or false)
41 JSON_OBJECT
= 0x08, // records, sets and unions
42 JSON_ARRAY
= 0x10, // record of and set of
43 JSON_ANY_VALUE
= 0x1F // unions with the "as value" coding instruction
46 /* Compound type definitions */
48 /* record, set, union */
50 /** Structure field descriptor for code generation */
52 const char *type
; /**< The C++ type name of the field */
53 const char *typegen
; /**< XER descriptor name */
54 const char *typedescrname
; /**< The name of the TTCN_descriptor variable */
55 const char *name
; /**< The C++ name of the field (without the prefix) */
56 const char *dispname
; /**< Display name (user-visible name) */
58 boolean isDefault
; /**< does it have a default value */
59 boolean of_type
; /**< true if the field is a sequence-of or set-of */
61 raw_attrib_struct raw
;
62 const char *defvalname
; /**< the constant containing the default value */
65 /** Conflated field for anyAttributes and anyElement. Use one of
66 * {ANY_ATTRIB_BIT,ANY_ELEM_BIT} + one of {ANY_FROM_BIT, ANY_EXCEPT_BIT} */
67 unsigned short xerAnyKind
;
68 unsigned short jsonValueType
;
70 boolean jsonOmitAsNull
;
71 const char* jsonAlias
;
72 const char* jsonDefaultValue
;
75 /** Structure (record, set, union, anytype) descriptor for code generation */
77 const char *name
; /**< C++ name for code generation */
78 const char *dispname
; /**< Display name (user-visible) */
79 struct_def_kind_enum kind
; /**< is it a record or a set */
80 boolean isASN1
; /**< Originating from an ASN.1 module */
86 boolean xerUntaggedOne
; /**< from Type::u.secho.has_single_charenc */
87 boolean xerUseNilPossible
; /* for sequence */
88 boolean xerUseOrderPossible
; /* for sequence */
89 boolean xerUseQName
; /* for sequence */
90 boolean xerUseTypeAttr
; /* for choice */
91 boolean xerUseUnion
; /* for choice */
92 boolean xerHasNamespaces
; /* from the module */
93 boolean xerEmbedValuesPossible
; /* for sequence */
94 boolean jsonAsValue
; /* for choice */
95 /** The index of the last field which can generate empty XML, or -1 */
96 int exerMaybeEmptyIndex
; /* for union */
97 const char * control_ns_prefix
;
98 raw_attrib_struct raw
;
99 size_t nElements
; /**< Number of fields for this class */
100 size_t totalElements
; /**< Real number of elements; may include
101 fields from the last component when USE-NIL and USE-ORDER are both set */
102 struct_field
*elements
;
103 boolean has_opentypes
;
104 boolean opentype_outermost
;
108 /** record of, set of descriptor for code generation */
110 const char *name
; /**< C++ name for code generation */
111 const char *dispname
; /**< Display name (user-visible) */
112 struct_of_def_kind_enum kind
; /**< is it a record-of or a set-of */
118 /** true if this is a record-of BOOLEAN, ENUMERATED or NULL */
119 boolean xmlValueList
;
120 /* * true if this record-of has the LIST encoding instruction */
122 /** true if this record-of has the ATTRIBUTE encoding instruction */
123 boolean xerAttribute
;
124 /** true if this record-of has the ANY-ATTRIBUTE or ANY-ELEMENT encoding instruction */
125 boolean xerAnyAttrElem
;
126 raw_attrib_struct raw
;
127 boolean has_opentypes
;
128 const char *type
; /**< Type of the elements */
129 const char *oftypedescrname
; /**< Type descr. variable of the elements */
130 size_t nFollowers
; /**< number of optional fields following the record-of */
131 struct_field
*followers
; /**< information about following optional siblings */
134 /* for processing enumerated type definitions */
137 const char *name
; /* identifier name */
138 const char *dispname
; /* identifier TTCN-3 name */
139 const char *text
; /* modified by TEXT */
145 const char *dispname
; /* fullname */
151 boolean xerUseNumber
;
152 boolean xerText
; /* A component has the TEXT encoding instruction */
154 enum_field
*elements
;
155 int firstUnused
, secondUnused
;
158 /* for function, altstep, testcase reference types */
160 typedef enum { FUNCTION
, ALTSTEP
, TESTCASE
} fat_type
;
164 const char *dispname
;
167 boolean runs_on_self
;
168 boolean is_startable
;
169 char *formal_par_list
;
170 char *actual_par_list
;
172 const char** parameters
;
175 /** for template restrictions */
177 TR_NONE
, /* no restriction was given */
181 } template_restriction_t
;
183 #endif /* DATATYPES_H */