Commit | Line | Data |
---|---|---|
970ed795 EL |
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 | /////////////////////////////////////////////////////////////////////////////// | |
8 | #ifndef COMPILER_H | |
9 | #define COMPILER_H | |
10 | ||
11 | #include <stdio.h> | |
12 | ||
13 | #include "../../common/memory.h" | |
14 | #include "../datatypes.h" | |
15 | ||
16 | #ifdef __cplusplus | |
17 | extern "C" { | |
18 | #endif | |
19 | ||
20 | /* for generating output files */ | |
21 | ||
22 | typedef struct output_struct_t { | |
23 | struct { | |
24 | char *includes; | |
25 | char *class_decls; | |
26 | char *typedefs; | |
27 | char *class_defs; | |
28 | char *function_prototypes; | |
29 | char *global_vars; | |
30 | char *testport_includes; | |
31 | } header; | |
32 | struct { | |
33 | char *includes; | |
34 | char *static_function_prototypes; | |
35 | char *static_conversion_function_prototypes; | |
36 | char *string_literals; | |
37 | char *class_defs; | |
38 | char *global_vars; | |
39 | char *methods; | |
40 | char *function_bodies; | |
41 | char *static_function_bodies; | |
42 | char *static_conversion_function_bodies; | |
43 | } source; | |
44 | struct { | |
45 | char *pre_init; /**< Code for pre_init_module() */ | |
46 | char *post_init; /**< Code for post_init_module() */ | |
47 | char *set_param; /**< Code for set_module_param() */ | |
48 | char *log_param; /**< Code for log_module_param() */ | |
49 | char *init_comp; /**< Code for init_comp_type() */ | |
50 | char *start; /**< Code for start_ptc_function() */ | |
51 | char *control; /**< Code for module_control_part() */ | |
52 | } functions; | |
53 | } output_struct; | |
54 | ||
55 | typedef struct expression_struct_t { | |
56 | char *preamble; | |
57 | char *expr; | |
58 | char *postamble; | |
59 | } expression_struct; | |
60 | ||
61 | /* for global and local constant definitions */ | |
62 | ||
63 | typedef struct const_def_t { | |
64 | char *decl; | |
65 | char *def; | |
66 | /* char *cdef; */ | |
67 | char *init; | |
68 | } const_def; | |
69 | ||
70 | /* Commonly used functions and variables */ | |
71 | ||
72 | extern const char *infile; | |
73 | ||
74 | extern void write_output(output_struct *output, const char *module_name, | |
75 | const char *module_dispname, const char *filename_suffix, boolean is_ttcn, | |
76 | boolean has_circular_import, boolean is_module); | |
77 | extern void report_nof_updated_files(void); | |
78 | ||
79 | extern FILE *open_output_file(const char *file_name, boolean *is_temporary); | |
80 | extern void close_output_file(const char *file_name, FILE *fp, | |
81 | boolean is_temporary, size_t skip_lines); | |
82 | ||
83 | #ifdef __cplusplus | |
84 | } | |
85 | #endif | |
86 | ||
87 | extern int ttcn3_parse_file(const char* filename, boolean generate_code); | |
88 | ||
89 | #endif |