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
12 * Szabo, Janos Zoltan – initial implementation
14 ******************************************************************************/
15 #ifndef _Common_Code_HH
16 #define _Common_Code_HH
18 #include "ttcn3/compiler.h"
29 * Abstract class for storing Code.
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);
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);
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,
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);
58 /** @} end of AST group */
62 #endif // _Common_Code_HH