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 | * Baranyi, Botond | |
11 | * Cserveni, Akos | |
12 | * Delic, Adam | |
13 | * Forstner, Matyas | |
14 | * Kovacs, Ferenc | |
15 | * Kremer, Peter | |
16 | * Raduly, Csaba | |
14e21cff | 17 | * Szabo, Bence Janos |
d44e3c4f | 18 | * Szabo, Janos Zoltan – initial implementation |
19 | * Tatarka, Gabor | |
20 | * Zalanyi, Balazs Andor | |
21 | * | |
22 | ******************************************************************************/ | |
970ed795 EL |
23 | #ifndef COMPILER_H |
24 | #define COMPILER_H | |
25 | ||
26 | #include <stdio.h> | |
27 | ||
28 | #include "../../common/memory.h" | |
29 | #include "../datatypes.h" | |
30 | ||
31 | #ifdef __cplusplus | |
32 | extern "C" { | |
33 | #endif | |
34 | ||
35 | /* for generating output files */ | |
36 | ||
37 | typedef struct output_struct_t { | |
38 | struct { | |
39 | char *includes; | |
40 | char *class_decls; | |
41 | char *typedefs; | |
42 | char *class_defs; | |
43 | char *function_prototypes; | |
44 | char *global_vars; | |
45 | char *testport_includes; | |
46 | } header; | |
47 | struct { | |
48 | char *includes; | |
49 | char *static_function_prototypes; | |
50 | char *static_conversion_function_prototypes; | |
51 | char *string_literals; | |
52 | char *class_defs; | |
53 | char *global_vars; | |
54 | char *methods; | |
55 | char *function_bodies; | |
56 | char *static_function_bodies; | |
57 | char *static_conversion_function_bodies; | |
58 | } source; | |
59 | struct { | |
60 | char *pre_init; /**< Code for pre_init_module() */ | |
61 | char *post_init; /**< Code for post_init_module() */ | |
62 | char *set_param; /**< Code for set_module_param() */ | |
3abe9331 | 63 | char *get_param; /**< Code for get_module_param() */ |
970ed795 EL |
64 | char *log_param; /**< Code for log_module_param() */ |
65 | char *init_comp; /**< Code for init_comp_type() */ | |
66 | char *start; /**< Code for start_ptc_function() */ | |
67 | char *control; /**< Code for module_control_part() */ | |
68 | } functions; | |
14e21cff | 69 | struct { |
70 | size_t pre_things_size; // Size of string_literals + global_vars | |
71 | size_t *methods; | |
72 | size_t methods_max_size; | |
73 | size_t methods_size; | |
74 | size_t *function_bodies; | |
75 | size_t function_bodies_max_size; | |
76 | size_t function_bodies_size; | |
77 | size_t *static_function_bodies; | |
78 | size_t static_function_bodies_max_size; | |
79 | size_t static_function_bodies_size; | |
80 | size_t *static_conversion_function_bodies; | |
81 | size_t static_conversion_function_bodies_size; | |
82 | size_t static_conversion_function_bodies_max_size; | |
83 | } intervals; | |
970ed795 EL |
84 | } output_struct; |
85 | ||
86 | typedef struct expression_struct_t { | |
87 | char *preamble; | |
88 | char *expr; | |
89 | char *postamble; | |
90 | } expression_struct; | |
91 | ||
92 | /* for global and local constant definitions */ | |
93 | ||
94 | typedef struct const_def_t { | |
95 | char *decl; | |
96 | char *def; | |
97 | /* char *cdef; */ | |
98 | char *init; | |
99 | } const_def; | |
100 | ||
101 | /* Commonly used functions and variables */ | |
102 | ||
103 | extern const char *infile; | |
104 | ||
105 | extern void write_output(output_struct *output, const char *module_name, | |
106 | const char *module_dispname, const char *filename_suffix, boolean is_ttcn, | |
107 | boolean has_circular_import, boolean is_module); | |
108 | extern void report_nof_updated_files(void); | |
109 | ||
110 | extern FILE *open_output_file(const char *file_name, boolean *is_temporary); | |
111 | extern void close_output_file(const char *file_name, FILE *fp, | |
112 | boolean is_temporary, size_t skip_lines); | |
113 | ||
114 | #ifdef __cplusplus | |
115 | } | |
116 | #endif | |
117 | ||
118 | extern int ttcn3_parse_file(const char* filename, boolean generate_code); | |
119 | ||
120 | #endif |