1 /******************************************************************************
2 * Copyright (c) 2000-2016 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
17 * Szabo, Janos Zoltan – initial implementation
20 ******************************************************************************/
24 #include "asn1/asn1p_old.h"
25 #include "ttcn3/rawASTspec.h"
32 /* C structures for representing TTCN-3 and ASN.1 types */
34 typedef enum { RECORD
, SET
, UNION
, ANYTYPE
} struct_def_kind_enum
;
36 typedef enum { RECORD_OF
, SET_OF
} struct_of_def_kind_enum
;
44 /* bit fields, use one of {ANY_ATTRIB_BIT,ANY_ELEM_BIT} and
45 * one of {ANY_FROM_BIT, ANY_EXCEPT_BIT} */
47 /** Flags that determine the type(s) of value an object or field will be encoded
50 JSON_NONE
= 0x00, // no value type set (default)
51 JSON_NUMBER
= 0x01, // integer and float
52 JSON_STRING
= 0x02, // all string types, the objid type, the verdict type and enumerated values
53 JSON_BOOLEAN
= 0x04, // boolean (true or false)
54 JSON_OBJECT
= 0x08, // records, sets, unions and the anytype
55 JSON_ARRAY
= 0x10, // record of, set of and array
56 JSON_NULL
= 0x20, // ASN.1 null type
57 JSON_ANY_VALUE
= 0x3F // unions with the "as value" coding instruction
60 /* Compound type definitions */
62 /* record, set, union */
64 /** Structure field descriptor for code generation */
66 const char *type
; /**< The C++ type name of the field */
67 const char *typegen
; /**< XER descriptor name */
68 const char *typedescrname
; /**< The name of the TTCN_descriptor variable */
69 const char *name
; /**< The C++ name of the field (without the prefix) */
70 const char *dispname
; /**< Display name (user-visible name) */
72 boolean isDefault
; /**< does it have a default value */
73 boolean of_type
; /**< true if the field is a sequence-of or set-of */
75 raw_attrib_struct raw
;
76 const char *defvalname
; /**< the constant containing the default value */
79 /** Conflated field for anyAttributes and anyElement. Use one of
80 * {ANY_ATTRIB_BIT,ANY_ELEM_BIT} + one of {ANY_FROM_BIT, ANY_EXCEPT_BIT} */
81 unsigned short xerAnyKind
;
82 unsigned short jsonValueType
;
84 boolean jsonOmitAsNull
;
85 boolean jsonMetainfoUnbound
;
86 const char* jsonAlias
;
87 const char* jsonDefaultValue
;
88 /** true if the field is a record-of or set-of with optimized memory allocation */
89 boolean optimizedMemAlloc
;
92 /** Structure (record, set, union, anytype) descriptor for code generation */
94 const char *name
; /**< C++ name for code generation */
95 const char *dispname
; /**< Display name (user-visible) */
96 struct_def_kind_enum kind
; /**< is it a record or a set */
97 boolean isASN1
; /**< Originating from an ASN.1 module */
103 boolean xerUntaggedOne
; /**< from Type::u.secho.has_single_charenc */
104 boolean xerUseNilPossible
; /* for sequence */
105 boolean xerUseOrderPossible
; /* for sequence */
106 boolean xerUseQName
; /* for sequence */
107 boolean xerUseTypeAttr
; /* for choice */
108 boolean xerUseUnion
; /* for choice */
109 boolean xerHasNamespaces
; /* from the module */
110 boolean xerEmbedValuesPossible
; /* for sequence */
111 boolean jsonAsValue
; /* for choice */
112 /** The index of the last field which can generate empty XML, or -1 */
113 int exerMaybeEmptyIndex
; /* for union */
114 const char * control_ns_prefix
;
115 raw_attrib_struct raw
;
116 size_t nElements
; /**< Number of fields for this class */
117 size_t totalElements
; /**< Real number of elements; may include
118 fields from the last component when USE-NIL and USE-ORDER are both set */
119 struct_field
*elements
;
120 boolean has_opentypes
;
121 boolean opentype_outermost
;
123 boolean isOptional
; /**< this structure is an optional field in a record/set */
126 /** record of, set of descriptor for code generation */
128 const char *name
; /**< C++ name for code generation */
129 const char *dispname
; /**< Display name (user-visible) */
130 struct_of_def_kind_enum kind
; /**< is it a record-of or a set-of */
136 /** true if this is a record-of BOOLEAN, ENUMERATED or NULL */
137 boolean xmlValueList
;
138 /* * true if this record-of has the LIST encoding instruction */
140 /** true if this record-of has the ATTRIBUTE encoding instruction */
141 boolean xerAttribute
;
142 /** true if this record-of has the ANY-ATTRIBUTE or ANY-ELEMENT encoding instruction */
143 boolean xerAnyAttrElem
;
144 raw_attrib_struct raw
;
145 boolean has_opentypes
;
146 const char *type
; /**< Type of the elements */
147 const char *oftypedescrname
; /**< Type descr. variable of the elements */
148 size_t nFollowers
; /**< number of optional fields following the record-of */
149 struct_field
*followers
; /**< information about following optional siblings */
152 /* for processing enumerated type definitions */
155 const char *name
; /* identifier name */
156 const char *dispname
; /* identifier TTCN-3 name */
157 const char *text
; /* modified by TEXT */
163 const char *dispname
; /* fullname */
169 boolean xerUseNumber
;
170 boolean xerText
; /* A component has the TEXT encoding instruction */
172 enum_field
*elements
;
173 int firstUnused
, secondUnused
;
176 /* for function, altstep, testcase reference types */
178 typedef enum { FUNCTION
, ALTSTEP
, TESTCASE
} fat_type
;
182 const char *dispname
;
185 boolean runs_on_self
;
186 boolean is_startable
;
187 char *formal_par_list
;
188 char *actual_par_list
;
190 const char** parameters
;
193 /** for template restrictions */
195 TR_NONE
, /* no restriction was given */
199 } template_restriction_t
;
201 #endif /* DATATYPES_H */