equal
deleted
inserted
replaced
87 * remaining st code is being handled. |
87 * remaining st code is being handled. |
88 */ |
88 */ |
89 search_expression_type_c *search_expression_type; |
89 search_expression_type_c *search_expression_type; |
90 |
90 |
91 search_varfb_instance_type_c *search_varfb_instance_type; |
91 search_varfb_instance_type_c *search_varfb_instance_type; |
|
92 search_var_instance_decl_c *search_var_instance_decl; |
92 |
93 |
93 search_base_type_c search_base_type; |
94 search_base_type_c search_base_type; |
94 |
95 |
95 symbol_c* current_array_type; |
96 symbol_c* current_array_type; |
96 symbol_c* current_param_type; |
97 symbol_c* current_param_type; |
107 generate_c_st_c(stage4out_c *s4o_ptr, symbol_c *name, symbol_c *scope, const char *variable_prefix = NULL) |
108 generate_c_st_c(stage4out_c *s4o_ptr, symbol_c *name, symbol_c *scope, const char *variable_prefix = NULL) |
108 : generate_c_typedecl_c(s4o_ptr) { |
109 : generate_c_typedecl_c(s4o_ptr) { |
109 search_fb_instance_decl = new search_fb_instance_decl_c(scope); |
110 search_fb_instance_decl = new search_fb_instance_decl_c(scope); |
110 search_expression_type = new search_expression_type_c(scope); |
111 search_expression_type = new search_expression_type_c(scope); |
111 search_varfb_instance_type = new search_varfb_instance_type_c(scope); |
112 search_varfb_instance_type = new search_varfb_instance_type_c(scope); |
|
113 search_var_instance_decl = new search_var_instance_decl_c(scope); |
|
114 |
112 this->set_variable_prefix(variable_prefix); |
115 this->set_variable_prefix(variable_prefix); |
113 current_array_type = NULL; |
116 current_array_type = NULL; |
114 current_param_type = NULL; |
117 current_param_type = NULL; |
115 fcall_number = 0; |
118 fcall_number = 0; |
116 fbname = name; |
119 fbname = name; |
120 |
123 |
121 virtual ~generate_c_st_c(void) { |
124 virtual ~generate_c_st_c(void) { |
122 delete search_fb_instance_decl; |
125 delete search_fb_instance_decl; |
123 delete search_expression_type; |
126 delete search_expression_type; |
124 delete search_varfb_instance_type; |
127 delete search_varfb_instance_type; |
|
128 delete search_var_instance_decl; |
125 } |
129 } |
126 |
130 |
127 |
131 |
128 public: |
132 public: |
129 void generate(statement_list_c *stl) { |
133 void generate(statement_list_c *stl) { |
131 } |
135 } |
132 |
136 |
133 private: |
137 private: |
134 |
138 |
135 void *print_getter(symbol_c *symbol) { |
139 void *print_getter(symbol_c *symbol) { |
136 unsigned int vartype = search_varfb_instance_type->get_vartype(symbol); |
140 unsigned int vartype = search_var_instance_decl->get_vartype(symbol); |
137 if (wanted_variablegeneration == fparam_output_vg) { |
141 if (wanted_variablegeneration == fparam_output_vg) { |
138 if (vartype == search_var_instance_decl_c::external_vt) |
142 if (vartype == search_var_instance_decl_c::external_vt) |
139 s4o.print(GET_EXTERNAL_BY_REF); |
143 s4o.print(GET_EXTERNAL_BY_REF); |
140 else if (vartype == search_var_instance_decl_c::located_vt) |
144 else if (vartype == search_var_instance_decl_c::located_vt) |
141 s4o.print(GET_LOCATED_BY_REF); |
145 s4o.print(GET_LOCATED_BY_REF); |
153 s4o.print("("); |
157 s4o.print("("); |
154 |
158 |
155 variablegeneration_t old_wanted_variablegeneration = wanted_variablegeneration; |
159 variablegeneration_t old_wanted_variablegeneration = wanted_variablegeneration; |
156 wanted_variablegeneration = complextype_base_vg; |
160 wanted_variablegeneration = complextype_base_vg; |
157 symbol->accept(*this); |
161 symbol->accept(*this); |
158 if (search_varfb_instance_type->type_is_complex()) |
162 if (search_varfb_instance_type->type_is_complex(symbol)) |
159 s4o.print(","); |
163 s4o.print(","); |
160 wanted_variablegeneration = complextype_suffix_vg; |
164 wanted_variablegeneration = complextype_suffix_vg; |
161 symbol->accept(*this); |
165 symbol->accept(*this); |
162 s4o.print(")"); |
166 s4o.print(")"); |
163 wanted_variablegeneration = old_wanted_variablegeneration; |
167 wanted_variablegeneration = old_wanted_variablegeneration; |
170 symbol_c* fb_symbol = NULL, |
174 symbol_c* fb_symbol = NULL, |
171 symbol_c* fb_value = NULL) { |
175 symbol_c* fb_value = NULL) { |
172 |
176 |
173 bool type_is_complex = false; |
177 bool type_is_complex = false; |
174 if (fb_symbol == NULL) { |
178 if (fb_symbol == NULL) { |
175 unsigned int vartype = search_varfb_instance_type->get_vartype(symbol); |
179 unsigned int vartype = search_var_instance_decl->get_vartype(symbol); |
176 type_is_complex = search_varfb_instance_type->type_is_complex(); |
180 type_is_complex = search_varfb_instance_type->type_is_complex(symbol); |
177 if (vartype == search_var_instance_decl_c::external_vt) |
181 if (vartype == search_var_instance_decl_c::external_vt) |
178 s4o.print(SET_EXTERNAL); |
182 s4o.print(SET_EXTERNAL); |
179 else if (vartype == search_var_instance_decl_c::located_vt) |
183 else if (vartype == search_var_instance_decl_c::located_vt) |
180 s4o.print(SET_LOCATED); |
184 s4o.print(SET_LOCATED); |
181 else |
185 else |