Commit | Line | Data |
---|---|---|
970ed795 | 1 | /////////////////////////////////////////////////////////////////////////////// |
3abe9331 | 2 | // Copyright (c) 2000-2015 Ericsson Telecom AB |
970ed795 EL |
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() */ | |
3abe9331 | 48 | char *get_param; /**< Code for get_module_param() */ |
970ed795 EL |
49 | char *log_param; /**< Code for log_module_param() */ |
50 | char *init_comp; /**< Code for init_comp_type() */ | |
51 | char *start; /**< Code for start_ptc_function() */ | |
52 | char *control; /**< Code for module_control_part() */ | |
53 | } functions; | |
54 | } output_struct; | |
55 | ||
56 | typedef struct expression_struct_t { | |
57 | char *preamble; | |
58 | char *expr; | |
59 | char *postamble; | |
60 | } expression_struct; | |
61 | ||
62 | /* for global and local constant definitions */ | |
63 | ||
64 | typedef struct const_def_t { | |
65 | char *decl; | |
66 | char *def; | |
67 | /* char *cdef; */ | |
68 | char *init; | |
69 | } const_def; | |
70 | ||
71 | /* Commonly used functions and variables */ | |
72 | ||
73 | extern const char *infile; | |
74 | ||
75 | extern void write_output(output_struct *output, const char *module_name, | |
76 | const char *module_dispname, const char *filename_suffix, boolean is_ttcn, | |
77 | boolean has_circular_import, boolean is_module); | |
78 | extern void report_nof_updated_files(void); | |
79 | ||
80 | extern FILE *open_output_file(const char *file_name, boolean *is_temporary); | |
81 | extern void close_output_file(const char *file_name, FILE *fp, | |
82 | boolean is_temporary, size_t skip_lines); | |
83 | ||
84 | #ifdef __cplusplus | |
85 | } | |
86 | #endif | |
87 | ||
88 | extern int ttcn3_parse_file(const char* filename, boolean generate_code); | |
89 | ||
90 | #endif |