Commit | Line | Data |
---|---|---|
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 | * Balasko, Jeno | |
10 | * Cserveni, Akos | |
11 | * Forstner, Matyas | |
12 | * Szabo, Janos Zoltan – initial implementation | |
13 | * | |
14 | ******************************************************************************/ | |
970ed795 EL |
15 | #ifndef _Common_Code_HH |
16 | #define _Common_Code_HH | |
17 | ||
18 | #include "ttcn3/compiler.h" | |
19 | ||
20 | namespace Common { | |
21 | ||
22 | /** | |
23 | * \addtogroup AST | |
24 | * | |
25 | * @{ | |
26 | */ | |
27 | ||
28 | /** | |
29 | * Abstract class for storing Code. | |
30 | */ | |
31 | class Code { | |
32 | public: | |
33 | ||
34 | static void init_output(output_struct *output); | |
35 | static void merge_output(output_struct *dest, output_struct *src); | |
36 | static void free_output(output_struct *output); | |
37 | ||
38 | static void init_cdef(const_def *cdef); | |
39 | static void merge_cdef(output_struct *dest, const_def *cdef); | |
40 | static void free_cdef(const_def *cdef); | |
41 | ||
42 | static void init_expr(expression_struct *expr); | |
43 | static void clean_expr(expression_struct *expr); | |
44 | static void free_expr(expression_struct *expr); | |
45 | static char* merge_free_expr(char* str, expression_struct *expr, | |
46 | bool is_block=false); | |
47 | ||
48 | /** Appends the C/C++ equivalent of character \a c to \a str. If flag | |
49 | * \a in_string is true (i.e. the \a c is a part of a string literal) then | |
50 | * the " character is escaped, otherwise (i.e. the \a c is a character | |
51 | * constant) ' is escaped. The function uses the standard C escape sequences | |
52 | * if possible or the octal notation for non-printable characters. */ | |
53 | static char *translate_character(char *str, char c, bool in_string); | |
54 | /** Appends the C/C++ equivalent of literal string \a src to \a str. */ | |
55 | static char *translate_string(char *str, const char *src); | |
56 | }; | |
57 | ||
58 | /** @} end of AST group */ | |
59 | ||
60 | } // namespace Common | |
61 | ||
62 | #endif // _Common_Code_HH |