fixed compilation errors when DEBUG is switched on
[deliverable/titan.core.git] / compiler2 / AST.hh
CommitLineData
d44e3c4f 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
7 *
8 * Contributors:
9 *
10 * Baji, Laszlo
11 * Balasko, Jeno
12 * Baranyi, Botond
13 * Cserveni, Akos
14 * Czerman, Oliver
15 * Delic, Adam
16 * Forstner, Matyas
17 * Gecse, Roland
18 * Kovacs, Ferenc
19 * Raduly, Csaba
20 * Szabados, Kristof
21 * Szabo, Janos Zoltan – initial implementation
22 * Szalai, Gabor
23 * Zalanyi, Balazs Andor
24 * Pandi, Krisztian
25 *
26 ******************************************************************************/
970ed795
EL
27#ifndef _Common_AST_HH
28#define _Common_AST_HH
29
30
31#undef new
32#include <new>
33#include <set>
34#include <string>
35#include "../common/dbgnew.hh"
36
37#include "../common/ModuleVersion.hh"
38#include "CompilerError.hh"
39#include "Setting.hh"
40#include "Type.hh"
41#include "Value.hh"
42#include "vector.hh"
43
44namespace Ttcn {
45 // not defined here
46 class Template;
47 class FormalParList;
48 class ArrayDimensions;
49 class Group;
50 class Module;
51} // namespace Ttcn
52
53// not defined here
54class JSON_Tokenizer;
55
56/**
57 * This namespace contains things used both in TTCN-3
58 * and ASN.1 compiler.
59 */
60namespace Common {
61
62 /**
63 * \defgroup AST AST
64 *
65 * These classes provide a unified interface for language entities
66 * present both in TTCN and ASN. (Most of) the classes defined here
67 * are abstract, and have a descendant (with the same name) in the
68 * namespaces Asn and Ttcn.
69 *
70 * @{
71 */
72
73 class Identifier;
74 class Modules;
75 class Module;
76 class Assignments;
77 class Assignment;
78 class TypeConv;
79 class CodeGenHelper;
80
81 enum visibility_t {
82 NOCHANGE, /* for parser usage only; default visibility */
83 PUBLIC, /* public visibility */
84 PRIVATE, /* private visibility */
85 FRIEND /* friend visibility */
86 };
87
88 /**
89 * Class for storing modules.
90 *
91 * This is, in effect, the "root" of the AST: there is only one instance
92 * of this class (declared in main.cc).
93 */
94 class Modules : public Node {
95 private:
96 /** Containers to store the modules. */
97 vector<Module> mods_v;
98 map<string, Module> mods_m;
3f84031e 99
100 /** Contains info needed for delayed type encoding checks */
101 struct type_enc_t {
102 Type* t;
103 bool enc;
104 };
105 static vector<type_enc_t> delayed_type_enc_v;
970ed795
EL
106
107 /** Not implemented */
108 Modules(const Modules& p);
109 Modules& operator=(const Modules& p);
110 public:
111 /** The default constructor. */
112 Modules();
113 /** The destructor. */
114 ~Modules();
115 /** Not implemented: generates FATAL_ERROR */
116 virtual Modules *clone() const;
117 /** Adds a new module. The uniqueness of identifier is not checked. */
118 void add_mod(Module *p_mod);
119 /** Returns whether a module with the given \a modid exists. */
120 bool has_mod_withId(const Identifier& p_modid);
121 /** Gets the module with the given \a modid. Returns 0 if the
122 * module does not exist (w/o error message). See also:
123 * has_mod_withId */
124 Module* get_mod_byId(const Identifier& p_modid);
125 /** Returns the referenced assignment or 0 if it does not exist.
126 * Append an error message when necessary. */
127 Assignment* get_ass_bySRef(Ref_simple *p_ref);
128 /** Checks the uniqueness of module identifiers. Prints an error
129 * message if <tt>get_modid()</tt> returns the same for two
130 * modules. */
131 void chk_uniq();
132 /** Performs the semantic analysis on modules of the ATS.
133 * Generates error/warning messages when necessary */
134 void chk();
135 void write_checksums();
136 std::set<ModuleVersion> getVersionsWithProductNumber() const;
137 private:
138 /* Checks the ASN.1 top-level PDU types that were passed as command line
139 * arguments */
140 void chk_top_level_pdus();
141 public:
142 void generate_code(CodeGenHelper& cgh);
143 void dump(unsigned level=1) const;
144
af710487 145 /** Generates JSON schema segments for the types defined in the modules,
146 * and references to these types. Information related to the types'
147 * JSON encoding and decoding functions is also inserted after the references.
148 *
149 * @param json JSON document containing the main schema, schema segments for
150 * the types will be inserted here
151 * @param json_refs map of JSON documents containing the references and function
152 * info related to each type */
153 void generate_json_schema(JSON_Tokenizer& json, map<Type*, JSON_Tokenizer>& json_refs);
3f84031e 154
155 /** Called if a Type::chk_coding() call could not be resolved (because the
156 * needed custom coding function was not found yet, but it might be among
157 * the functions that have not been checked yet).
158 * This stores the info needed to call the function again after everything
159 * else has been checked. */
160 static void delay_type_encode_check(Type* p_type, bool p_encode);
970ed795
EL
161 };
162
163 /**
164 * Interface-class to represent a module.
165 *
166 * Abstract class because of clone() and a bunch of other methods.
167 */
168 class Module : public Scope, public Location {
169 public:
170 enum moduletype_t { MOD_UNKNOWN, MOD_ASN, MOD_TTCN };
171 /** The map is used as a set. */
172 typedef map <Module*, void> module_set_t;
173 protected: // *::Module need access
174 moduletype_t moduletype;
175 /** Module identifier ("module name") */
176 Identifier *modid;
177 /** The \c Modules collection which contains this module. Not owned. */
178 /** Indicates whether the import list has been checked. */
179 bool imp_checked;
180 /** Indicates whether to generate C++ code for the module. */
181 bool gen_code;
182 /** Indicates whether the module has a checksum. */
183 bool has_checksum;
184 /** Contains the set of modules that are visible through imports (i.e. the
185 * module is imported either directly or indirectly by an imported module).
186 * The set is complete if \a this is added to the set. */
187 module_set_t visible_mods;
188 /** Contains the checksum (more correctly, a hash) of the module.
189 * It is an MD5 hash of the TTCN source, computed by the lexer. */
190 unsigned char module_checksum[16];
191
192 /** @name Containers to store string literals.
193 * @{ */
194 map<string, string> bs_literals; ///< bitstring values
195 map<string, string> bp_literals; ///< bitstring patterns
196 map<string, string> hs_literals; ///< hexstring values
197 map<string, string> hp_literals; ///< hexstring patterns
198 map<string, string> os_literals; ///< octetstring values
199 map<string, string> op_literals; ///< octetstring patterns
200 map<string, string> cs_literals; ///< charstring values
201 map<ustring, string> us_literals; ///< universal charstring values
202 map<string, string> pp_literals; ///< padding patterns (RAW codec)
203 map<string, string> mp_literals; ///< matching patterns (TEXT codec)
204 /** @} */
205
206 struct OID_literal {
207 size_t nof_elems;
208 string oid_id;
209 };
210 map<string, OID_literal> oid_literals;
211
212 /** Counter for the temporary identifiers */
213 size_t tmp_id_count;
214
215 /** Control namespace and prefix.
216 * The module owns these strings. */
217 char * control_ns;
218 char * control_ns_prefix;
219
220 /** Namespace declarations encountered (global for the entire program).
221 * Keys are the prefixes. Values are the URIs. */
222 static map<string, const char> namespaces;
223
224 /** The index of the replacement for the empty prefix, or -1. Returned by
225 * \p get_ns_index if the empty prefix has indeed been replaced. */
226 static size_t replacement_for_empty_prefix;
227
228 /** Namespace prefixes made up to avoid clashes.
229 * Keys are the URIs (!), values are the prefixes.
230 * (This is a reverse of a subset of the \p namespaces member).
231 * This allows reuse of made-up prefixes if the same namespace URI
232 * appears again. */
233 static map<string, const char> invented_prefixes;
234
235 /** Indexes of the namespaces used by this module.
236 * Written while Common::Type::generate_code_xerdescriptor() makes calls
237 * to Common::Module::get_ns_index(). */
238 map<size_t, void> used_namespaces;
239
240 /** How many different namespace URIs with empty prefix have been added */
241 static size_t default_namespace_attempt;
242
243 /** Type conversions found in this module */
244 vector<TypeConv> type_conv_v;
245
246 /** @name Module version fields
247 * @{ */
248 char* product_number;
249 unsigned int suffix;
250 unsigned int release;
251 unsigned int patch;
252 unsigned int build;
253 char* extra;
254 /** @} */
255
256 friend class Ttcn::Module;
257
258 /* * Value of GLOBAL-DEFAULTS MODIFIED-ENCODINGS */
259 //TODO: introduce bool modified_encodings;
260
261 /** Generates code for all string literals that belong to the
262 * module into \a target */
263 void generate_literals(output_struct *target);
264 /** Generates the module level entry functions based on
265 * \a output->functions. The resulting functions are placed into
266 * \a output->source.function_bodies.
267 * Also writes the control part, module checksum, XML namespaces,
268 * module object to output->source.global_vars */
269 void generate_functions(output_struct *output);
270 void generate_conversion_functions(output_struct *output);
7329404e
BB
271
272 /** Generates the debugger initialization function for this module.
273 * The function creates the global debug scope associated with this module,
274 * and initializes it with all the global variables visible in the module
275 * (including imported variables).
276 * The debug scopes of all component types defined in the module are also
277 * created and initialized with their variables. */
278 virtual void generate_debugger_init(output_struct *output) = 0;
279
280 /** Generates the variable adding code for all global variables defined
281 * in this module. This function is called by generate_debugger_init()
282 * for both the current module and all imported modules. */
283 virtual char* generate_debugger_global_vars(char* str, Common::Module* current_mod) = 0;
284
285 /** Generates the debugger variable printing function, which can print values
286 * and templates of all types defined in this module (excluding subtypes). */
287 virtual void generate_debugger_functions(output_struct *output) = 0;
288
970ed795
EL
289 private:
290 /** Copy constructor not implemented */
291 Module(const Module& p);
292 /** Assignment disabled */
293 Module& operator=(const Module& p);
294
295 /** Adds \a str to container \a literals with prefix \a prefix */
296 static string add_literal(map<string, string>& literals, const string& str,
297 const char *prefix);
298
299 void generate_bs_literals(char *&src, char *&hdr);
300 void generate_bp_literals(char *&src, char *&hdr);
301 void generate_hs_literals(char *&src, char *&hdr);
302 void generate_hp_literals(char *&src, char *&hdr);
303 void generate_os_literals(char *&src, char *&hdr);
304 void generate_op_literals(char *&src, char *&hdr);
305 void generate_cs_literals(char *&src, char *&hdr);
306 void generate_us_literals(char *&src, char *&hdr);
307 void generate_oid_literals(char *&src, char *&hdr);
308 void generate_pp_literals(char *&src, char *&hdr);
309 void generate_mp_literals(char *&src, char *&hdr);
310
311 /** Clears the container \a literals */
312 static void clear_literals(map<string, string>& literals);
313
314 public:
315 Module(moduletype_t p_mt, Identifier *modid);
316 virtual ~Module();
317 /** Adds type conversion \p p_conv to this module. */
318 void add_type_conv(TypeConv *p_conv);
319 /** Checks if \p p_from_type and \p p_to_type types need conversion in
320 * this module. */
321 bool needs_type_conv(Type *p_from_type, Type *p_to_type) const;
322 /** Returns the module type (either TTCN-3 or ASN.1). */
323 moduletype_t get_moduletype() const {return moduletype;}
324 /** Sets the flag to generate C++ code for this module. */
325 void set_gen_code() {gen_code = true;}
326 /** Returns whether to generate C++ code for this module. */
327 bool get_gen_code() const {return gen_code;}
328 /** Returns the module-identifier. */
329 const Identifier& get_modid() const {return *modid;}
330 /** Gets the module scope. This function returns this scope or a
331 * scope above this or 0 if neither is a Module. */
332 virtual Module* get_scope_mod() {return this;}
333 virtual Module* get_scope_mod_gen() {return this;}
334 virtual Assignments *get_asss() =0;
335 virtual Common::Assignment* importAssignment(
336 const Identifier& p_source_modid, const Identifier& p_id) const =0;
337 /** Returns true if a symbol with identifier \a p_id is
338 * exported. */
339 virtual bool exports_sym(const Identifier& p_id) =0;
340 /** Returns whether the module has an imported definition/assignment with
341 * identifier \a p_id */
342 virtual bool has_imported_ass_withId(const Identifier& p_id) = 0;
343 /** Returns a pointer to the TTCN-3 special address type that is defined in
344 * the TTCN-3 module. A NULL pointer is returned if the address type is not
345 * defined in this module. This function is applicable to TTCN-3 modules
346 * only (otherwise a FATAL_ERROR will occur). */
347 virtual Type *get_address_type();
348 /** Checks imports (and propagates the code generation
349 * flags). */
350 virtual void chk_imp(ReferenceChain& refch, vector<Module>& moduleStack) = 0;
351 /** Checks everything (imports, exports, assignments) */
352 virtual void chk() = 0;
353 /** Checks this module and all imported modules in bottom-up order.
354 * Argument \a checked_modules contains the list of modules that are
355 * already checked */
356 void chk_recursive(module_set_t& checked_modules);
357 /** Returns whether \a m is visible from \a this through imports. */
358 bool is_visible(Module *m);
359 /** Extends \a p_visible_mods with the set of visible modules. It uses the
360 * cache \a visible_mods if possible or calls \a get_imported_mods()
361 * otherwise. */
362 void get_visible_mods(module_set_t& p_visible_mods);
363 /** Walks through the import list and collects the imported modules into
364 * \a p_imported_mods recursively. */
365 virtual void get_imported_mods(module_set_t& p_imported_mods) = 0;
366 void write_checksum();
367 static char* get_product_identifier(const char* product_number,
368 const unsigned int suffix, unsigned int release, unsigned int patch,
369 unsigned int build, const char* extra=NULL);
370 ModuleVersion getVersion() const;
371 protected: // *::Module need access
372 /** Collects the set of visible modules into \a visible_mods. */
373 void collect_visible_mods();
374 virtual void generate_code_internal(CodeGenHelper& cgh) = 0;
375 public:
376 /** Adds a string to the module's bitstring container. Returns a
377 * string like "bs_xx", where xx is the index of the literal in
378 * the container. */
379 inline string add_bitstring_literal(const string& bstr)
380 { return add_literal(bs_literals, bstr, "bs_"); }
381 inline string add_bitstring_pattern(const string& bpat)
382 { return add_literal(bp_literals, bpat, "bp_"); }
383 inline string add_hexstring_literal(const string& hstr)
384 { return add_literal(hs_literals, hstr, "hs_"); }
385 inline string add_hexstring_pattern(const string& hpat)
386 { return add_literal(hp_literals, hpat, "hp_"); }
387 inline string add_octetstring_literal(const string& ostr)
388 { return add_literal(os_literals, ostr, "os_"); }
389 inline string add_octetstring_pattern(const string& opat)
390 { return add_literal(op_literals, opat, "op_"); }
391 inline string add_charstring_literal(const string& cstr)
392 { return add_literal(cs_literals, cstr, "cs_"); }
393 inline string add_padding_pattern(const string& ppat)
394 { return add_literal(pp_literals, ppat, "pp_"); }
395 inline string add_matching_literal(const string& mpat)
396 { return add_literal(mp_literals, mpat, "mp_"); }
397 string add_ustring_literal(const ustring& ustr);
398 string add_objid_literal(const string& oi_str, const size_t nof_elems);
399
400 /** Sets the module checksum. Parameter \a checksum_ptr points to the
401 * checksum to be set, which consists of \a checksum_len bytes. */
402 void set_checksum(size_t checksum_len, const unsigned char* checksum_ptr);
403
404 /** Returns an identifier used for temporary C++ objects,
405 * which is unique in the module */
406 string get_temporary_id();
407
408 /** Sets the control namespace and its prefix.
409 * Any previous value is overwritten.
410 * Takes ownership of the strings (must be allocated on the heap). */
411 void set_controlns(char *ns, char *prefix);
412
413 /** Gets the control namespace components.
414 * The caller must not free the strings. */
415 void get_controlns(const char * &ns, const char * &prefix);
416
417 /** Adds a namespace to the list of known namespaces.
418 * No effect if the namespace is already in the map.
419 * @param new_uri namespace URI
420 * @param new_prefix namespace prefix; NULL means "make up a prefix"
421 * @note If \p new_prefix is empty and there is already a namespace with
422 * an empty prefix, a new, non-empty prefix is invented for this URI;
423 * in this case \p new_prefix is modified to contain the "made-up" value.
424 * @note \p new_prefix \b MUST be expstring_t or allocated by Malloc
425 * (add_namespace may call Free() on it) */
426 static void add_namespace(const char *new_uri, char * &new_prefix);
427
428 /** Returns the number of XML namespaces */
429 static inline size_t get_nof_ns()
430 { return namespaces.size(); }
431
432 /** Return the index of the given namespace prefix in the list of namespaces.
433 * If the namespace is not found, FATAL_ERROR occurs.
434 * @note also records the index in the per-instance member used_namespaces
435 * (which is why it cannot be static) */
436 size_t get_ns_index(const char *prefix);
437
438 /** Rename the default namespace, but only if there were two or more
439 * namespaces with empty prefixes */
440 static void rename_default_namespace();
441
442 /** Generates C++ code for the module */
443 void generate_code(CodeGenHelper& cgh);
444 virtual void dump(unsigned level) const;
445
af710487 446 /** Generates JSON schema segments for the types defined in the modules,
447 * and references to these types. Information related to the types'
448 * JSON encoding and decoding functions is also inserted after the references.
449 *
450 * @param json JSON document containing the main schema, schema segments for
451 * the types will be inserted here
452 * @param json_refs map of JSON documents containing the references and function
453 * info related to each type */
454 virtual void generate_json_schema(JSON_Tokenizer& json, map<Type*, JSON_Tokenizer>& json_refs) = 0;
970ed795
EL
455 };
456
457 /**
458 * Class to store assignments.
459 */
460 class Assignments : public Scope {
461 protected: // Ttcn::Definitions and Asn::Assignments need access
462
463 Assignments(const Assignments& p): Scope(p) {}
464 public:
465 /** Constructor. */
466 Assignments() : Scope() {}
467
468 virtual Assignments* get_scope_asss();
469 /** Returns the referenced assignment or 0 if it does not exist.
470 * An error message is generated when necessary. */
471 virtual Assignment* get_ass_bySRef(Ref_simple *p_ref);
472 /** Returns whether an assignment with id \a p_id exists;
473 * either in the current scope or its parent (recursively). */
474 virtual bool has_ass_withId(const Identifier& p_id);
475 /** Returns whether an assignment with id \a p_id exists.
476 * Unlike \a has_ass_withId() this function does not look into the
477 * parent scope. */
478 virtual bool has_local_ass_withId(const Identifier& p_id) = 0;
479 /** Returns the locally defined assignment with the given id,
480 * or NULL if it does not exist. */
481 virtual Assignment* get_local_ass_byId(const Identifier& p_id) = 0;
482 /** Returns the number of assignments. Only the uniquely named
483 * assignments are visible. */
484 virtual size_t get_nof_asss() = 0;
485 /** Returns the assignment with the given index. Only the uniquely
486 * named assignments are visible. */
487 virtual Assignment* get_ass_byIndex(size_t p_i) = 0;
488 };
489
490 /**
491 * Abstract class to represent different kinds of assignments.
492 */
493 class Assignment : public Node, public Location {
494 public:
495 enum asstype_t {
496 A_TYPE, /**< type */
497 A_CONST, /**< value (const) */
498 A_UNDEF, /**< undefined/undecided (ASN.1) */
499 A_ERROR, /**< erroneous; the kind cannot be deduced (ASN.1) */
500 A_OC, /**< information object class (ASN.1) */
501 A_OBJECT, /**< information object (ASN.1) */
502 A_OS, /**< information object set (ASN.1) */
503 A_VS, /**< value set (ASN.1) */
504 A_EXT_CONST, /**< external constant (TTCN-3) */
505 A_MODULEPAR, /**< module parameter (TTCN-3) */
506 A_MODULEPAR_TEMP, /**< template module parameter */
507 A_TEMPLATE, /**< template (TTCN-3) */
508 A_VAR, /**< variable (TTCN-3) */
509 A_VAR_TEMPLATE, /**< template variable, dynamic template (TTCN-3) */
510 A_TIMER, /**< timer (TTCN-3) */
511 A_PORT, /**< port (TTCN-3) */
512 A_FUNCTION, /**< function without return type (TTCN-3) */
513 A_FUNCTION_RVAL, /**< function that returns a value (TTCN-3) */
514 A_FUNCTION_RTEMP, /**< function that returns a template (TTCN-3) */
515 A_EXT_FUNCTION, /**< external function without return type (TTCN-3) */
516 A_EXT_FUNCTION_RVAL, /**< ext. func that returns a value (TTCN-3) */
517 A_EXT_FUNCTION_RTEMP, /**< ext. func that returns a template (TTCN-3) */
518 A_ALTSTEP, /**< altstep (TTCN-3) */
519 A_TESTCASE, /**< testcase (TTCN-3) */
520 A_PAR_VAL, /**< formal parameter (value) (TTCN-3) */
521 A_PAR_VAL_IN, /**< formal parameter (in value) (TTCN-3) */
522 A_PAR_VAL_OUT, /**< formal parameter (out value) (TTCN-3) */
523 A_PAR_VAL_INOUT, /**< formal parameter (inout value) (TTCN-3) */
524 A_PAR_TEMPL_IN, /**< formal parameter ([in] template) (TTCN-3) */
525 A_PAR_TEMPL_OUT, /**< formal parameter (out template) (TTCN-3) */
526 A_PAR_TEMPL_INOUT,/**< formal parameter (inout template) (TTCN-3) */
527 A_PAR_TIMER, /**< formal parameter (timer) (TTCN-3) */
528 A_PAR_PORT /**< formal parameter (port) (TTCN-3) */
529 };
530 protected: // Ttcn::Definition and Asn::Assignment need access
531 asstype_t asstype;
532 Identifier *id; /**< the name of the assignment */
533 Scope *my_scope; /**< the scope this assignment belongs to */
534 bool checked;
535 visibility_t visibilitytype;
536
537 /// Copy constructor disabled
538 Assignment(const Assignment& p);
539 /// Assignment disabled
540 Assignment& operator=(const Assignment& p);
541 virtual string get_genname() const = 0;
542 public:
543 Assignment(asstype_t p_asstype, Identifier *p_id);
544 virtual ~Assignment();
545 virtual Assignment* clone() const =0;
546 virtual asstype_t get_asstype() const;
547 /** Returns the string representation of the assignment type */
548 const char *get_assname() const;
549 /** Returns the description of the definition, which consists of the
550 * assignment type and name. The name is either the fullname or only
551 * the id. It depends on \a asstype and \a my_scope. */
552 string get_description();
553 /** Gets the id of the assignment. */
554 const Identifier& get_id() const {return *id;}
555 /** Sets the internal pointer my_scope to \a p_scope. */
556 virtual void set_my_scope(Scope *p_scope);
557 Scope* get_my_scope() const { return my_scope; }
558 bool get_checked() const { return checked; }
559 /** Return the visibility type of the assignment */
560 visibility_t get_visibility() const { return visibilitytype; }
561 /** Returns whether the definition belongs to a TTCN-3 statement block
562 * (i.e. it is defined in the body of a function, testcase, altstep or
563 * control part). */
564 virtual bool is_local() const;
565 /** @name Need to be overridden and implemented in derived classes.
566 * Calling these methods causes a FATAL_ERROR.
567 *
568 * @{
569 */
570 virtual Setting* get_Setting();
571 virtual Type *get_Type();
572 virtual Value *get_Value();
573 virtual Ttcn::Template *get_Template();
574 virtual bool get_lazy_eval() const;
575 /** @} */
576 /** Returns the formal parameter list of a TTCN-3 definition */
577 virtual Ttcn::FormalParList *get_FormalParList();
578 /** Returns the dimensions of TTCN-3 port and timer arrays or NULL
579 * otherwise. */
580 virtual Ttcn::ArrayDimensions *get_Dimensions();
581 /** Returns the component type referred by the 'runs on' clause of a
582 * TTCN-3 definition */
583 virtual Type *get_RunsOnType();
584 /** Semantic check */
585 virtual void chk() = 0;
586 /** Checks whether the assignment has a valid TTCN-3 identifier,
587 * i.e. is reachable from TTCN. */
588 void chk_ttcn_id();
589 /** Returns a string containing the C++ reference pointing to this
590 * definition from the C++ equivalent of scope \a p_scope. The reference
591 * is a simple identifier qualified with a namespace when necessary.
592 * If \a p_prefix is not NULL it is inserted before the string returned by
593 * function \a get_genname(). */
594 string get_genname_from_scope(Scope *p_scope, const char *p_prefix = 0);
595 /** Returns the name of the C++ object in the RTE that contains the common
596 * entry points for the module that the definition belongs to */
597 const char *get_module_object_name();
598 /** A stub function to avoid dynamic_cast's. It causes FATAL_ERROR unless
599 * \a this is an `in' value or template parameter. The real implementation
600 * is in class Ttcn::FormalPar. */
601 virtual void use_as_lvalue(const Location& p_loc);
602 virtual void generate_code(output_struct *target, bool clean_up = false);
603 virtual void generate_code(CodeGenHelper& cgh); // FIXME: this should be pure virtual
604 virtual void dump(unsigned level) const;
605 virtual Ttcn::Group* get_parent_group();
606 };
607
608 /** @} end of AST group */
609
610} // namespace Common
611
612#endif // _Common_AST_HH
This page took 0.045074 seconds and 5 git commands to generate.