absyntax_utils/search_var_instance_decl.cc
changeset 507 30b31d8f6d0f
parent 504 f8d422b98315
child 511 b22ae67d8003
equal deleted inserted replaced
506:2b4e69c7ff8b 507:30b31d8f6d0f
   230 search_var_instance_decl_c::search_var_instance_decl_c(symbol_c *search_scope) {
   230 search_var_instance_decl_c::search_var_instance_decl_c(symbol_c *search_scope) {
   231   this->current_vartype = none_vt;
   231   this->current_vartype = none_vt;
   232   this->search_scope = search_scope;
   232   this->search_scope = search_scope;
   233   this->search_name = NULL;
   233   this->search_name = NULL;
   234   this->current_type_decl = NULL;
   234   this->current_type_decl = NULL;
       
   235   this->current_option = none_opt;
   235 }
   236 }
   236 
   237 
   237 symbol_c *search_var_instance_decl_c::get_decl(symbol_c *variable) {
   238 symbol_c *search_var_instance_decl_c::get_decl(symbol_c *variable) {
   238   this->current_vartype = none_vt;
   239   this->current_vartype = none_vt;
       
   240   this->current_option  = none_opt;
   239   this->search_name = get_var_name_c::get_name(variable);
   241   this->search_name = get_var_name_c::get_name(variable);
   240   return (symbol_c *)search_scope->accept(*this);
   242   return (symbol_c *)search_scope->accept(*this);
   241 }
   243 }
   242 
   244 
   243 unsigned int search_var_instance_decl_c::get_vartype(symbol_c *variable) {
   245 unsigned int search_var_instance_decl_c::get_vartype(symbol_c *variable) {
   244   this->current_vartype = none_vt;
   246   this->current_vartype = none_vt;
       
   247   this->current_option  = none_opt;
   245   this->search_name = get_var_name_c::get_name(variable);
   248   this->search_name = get_var_name_c::get_name(variable);
   246   search_scope->accept(*this);
   249   search_scope->accept(*this);
   247   return current_vartype;
   250   return this->current_vartype;
   248 }
   251 }
   249 
   252 
       
   253 unsigned int search_var_instance_decl_c::get_option(symbol_c *variable) {
       
   254   this->current_vartype = none_vt;
       
   255   this->current_option  = none_opt;
       
   256   this->search_name = get_var_name_c::get_name(variable);
       
   257   search_scope->accept(*this);
       
   258   return this->current_option;
       
   259 }
   250 
   260 
   251 /***************************/
   261 /***************************/
   252 /* B 0 - Programming Model */
   262 /* B 0 - Programming Model */
   253 /***************************/
   263 /***************************/
   254 void *search_var_instance_decl_c::visit(library_c *symbol) {
   264 void *search_var_instance_decl_c::visit(library_c *symbol) {
   265 /******************************************/
   275 /******************************************/
   266 
   276 
   267 /* edge -> The F_EDGE or R_EDGE directive */
   277 /* edge -> The F_EDGE or R_EDGE directive */
   268 // SYM_REF2(edge_declaration_c, edge, var1_list)
   278 // SYM_REF2(edge_declaration_c, edge, var1_list)
   269 // TODO
   279 // TODO
       
   280 void *search_var_instance_decl_c::visit(constant_option_c *symbol) {
       
   281   current_option = constant_opt;
       
   282   return NULL;
       
   283 }
       
   284 
       
   285 void *search_var_instance_decl_c::visit(retain_option_c *symbol) {
       
   286   current_option = retain_opt;
       
   287   return NULL;
       
   288 }
       
   289 
       
   290 void *search_var_instance_decl_c::visit(non_retain_option_c *symbol) {
       
   291   current_option = non_retain_opt;
       
   292   return NULL;
       
   293 }
   270 
   294 
   271 void *search_var_instance_decl_c::visit(input_declarations_c *symbol) {
   295 void *search_var_instance_decl_c::visit(input_declarations_c *symbol) {
   272   current_vartype = input_vt;
   296   current_vartype = input_vt;
       
   297   current_option  = none_opt; /* not really required. Just to make the code more readable */
       
   298   if (NULL != symbol->option)  
       
   299     symbol->option->accept(*this);
   273   void *res = symbol->input_declaration_list->accept(*this);
   300   void *res = symbol->input_declaration_list->accept(*this);
   274   if (res == NULL) {
   301   if (res == NULL) {
   275     current_vartype = none_vt;
   302     current_vartype = none_vt;
       
   303     current_option  = none_opt;
   276   }
   304   }
   277   return res;
   305   return res;
   278 }
   306 }
   279 
   307 
   280 /* VAR_OUTPUT [RETAIN | NON_RETAIN] var_init_decl_list END_VAR */
   308 /* VAR_OUTPUT [RETAIN | NON_RETAIN] var_init_decl_list END_VAR */
   281 /* option -> may be NULL ! */
   309 /* option -> may be NULL ! */
   282 void *search_var_instance_decl_c::visit(output_declarations_c *symbol) {
   310 void *search_var_instance_decl_c::visit(output_declarations_c *symbol) {
   283   current_vartype = output_vt;
   311   current_vartype = output_vt;
       
   312   current_option  = none_opt; /* not really required. Just to make the code more readable */
       
   313   if (NULL != symbol->option)
       
   314     symbol->option->accept(*this);
   284   void *res = symbol->var_init_decl_list->accept(*this);
   315   void *res = symbol->var_init_decl_list->accept(*this);
   285   if (res == NULL) {
   316   if (res == NULL) {
   286     current_vartype = none_vt;
   317     current_vartype = none_vt;
       
   318     current_option  = none_opt;
   287   }
   319   }
   288   return res;
   320   return res;
   289 }
   321 }
   290 
   322 
   291 /*  VAR_IN_OUT var_declaration_list END_VAR */
   323 /*  VAR_IN_OUT var_declaration_list END_VAR */
   292 void *search_var_instance_decl_c::visit(input_output_declarations_c *symbol) {
   324 void *search_var_instance_decl_c::visit(input_output_declarations_c *symbol) {
   293   current_vartype = inoutput_vt;
   325   current_vartype = inoutput_vt;
       
   326   current_option  = none_opt; /* not really required. Just to make the code more readable */
   294   void *res = symbol->var_declaration_list->accept(*this);
   327   void *res = symbol->var_declaration_list->accept(*this);
   295   if (res == NULL) {
   328   if (res == NULL) {
   296     current_vartype = none_vt;
   329     current_vartype = none_vt;
   297   }
   330   }
   298   return res;
   331   return res;
   309 /* VAR [CONSTANT] var_init_decl_list END_VAR */
   342 /* VAR [CONSTANT] var_init_decl_list END_VAR */
   310 /* option -> may be NULL ! */
   343 /* option -> may be NULL ! */
   311 /* helper symbol for input_declarations */
   344 /* helper symbol for input_declarations */
   312 void *search_var_instance_decl_c::visit(var_declarations_c *symbol) {
   345 void *search_var_instance_decl_c::visit(var_declarations_c *symbol) {
   313   current_vartype = private_vt;
   346   current_vartype = private_vt;
       
   347   current_option  = none_opt; /* not really required. Just to make the code more readable */
       
   348   if (NULL != symbol->option)
       
   349     symbol->option->accept(*this);
   314   void *res = symbol->var_init_decl_list->accept(*this);
   350   void *res = symbol->var_init_decl_list->accept(*this);
   315   if (res == NULL) {
   351   if (res == NULL) {
   316     current_vartype = none_vt;
   352     current_vartype = none_vt;
       
   353     current_option = none_opt;
   317   }
   354   }
   318   return res;
   355   return res;
   319 }
   356 }
   320 
   357 
   321 /*  VAR RETAIN var_init_decl_list END_VAR */
   358 /*  VAR RETAIN var_init_decl_list END_VAR */
   322 void *search_var_instance_decl_c::visit(retentive_var_declarations_c *symbol) {
   359 void *search_var_instance_decl_c::visit(retentive_var_declarations_c *symbol) {
   323   current_vartype = private_vt;
   360   current_vartype = private_vt;
       
   361   current_option  = retain_opt;
   324   void *res = symbol->var_init_decl_list->accept(*this);
   362   void *res = symbol->var_init_decl_list->accept(*this);
   325   if (res == NULL) {
   363   if (res == NULL) {
   326     current_vartype = none_vt;
   364     current_vartype = none_vt;
       
   365     current_option = none_opt;
   327   }
   366   }
   328   return res;
   367   return res;
   329 }
   368 }
   330 
   369 
   331 /*  VAR [CONSTANT|RETAIN|NON_RETAIN] located_var_decl_list END_VAR */
   370 /*  VAR [CONSTANT|RETAIN|NON_RETAIN] located_var_decl_list END_VAR */
   332 /* option -> may be NULL ! */
   371 /* option -> may be NULL ! */
   333 //SYM_REF2(located_var_declarations_c, option, located_var_decl_list)
   372 //SYM_REF2(located_var_declarations_c, option, located_var_decl_list)
   334 void *search_var_instance_decl_c::visit(located_var_declarations_c *symbol) {
   373 void *search_var_instance_decl_c::visit(located_var_declarations_c *symbol) {
   335   current_vartype = located_vt;
   374   current_vartype = located_vt;
       
   375   current_option  = none_opt; /* not really required. Just to make the code more readable */
       
   376   if (NULL != symbol->option)
       
   377     symbol->option->accept(*this);
   336   void *res = symbol->located_var_decl_list->accept(*this);
   378   void *res = symbol->located_var_decl_list->accept(*this);
   337   if (res == NULL) {
   379   if (res == NULL) {
   338     current_vartype = none_vt;
   380     current_vartype = none_vt;
       
   381     current_option  = none_opt;
   339   }
   382   }
   340   return res;
   383   return res;
   341 }
   384 }
   342 
   385 
   343 /*| VAR_EXTERNAL [CONSTANT] external_declaration_list END_VAR */
   386 /*| VAR_EXTERNAL [CONSTANT] external_declaration_list END_VAR */
   344 /* option -> may be NULL ! */
   387 /* option -> may be NULL ! */
   345 //SYM_REF2(external_var_declarations_c, option, external_declaration_list)
   388 //SYM_REF2(external_var_declarations_c, option, external_declaration_list)
   346 void *search_var_instance_decl_c::visit(external_var_declarations_c *symbol) {
   389 void *search_var_instance_decl_c::visit(external_var_declarations_c *symbol) {
   347   current_vartype = external_vt;
   390   current_vartype = external_vt;
       
   391   current_option  = none_opt; /* not really required. Just to make the code more readable */
       
   392   if (NULL != symbol->option)
       
   393     symbol->option->accept(*this);
   348   void *res = symbol->external_declaration_list->accept(*this);
   394   void *res = symbol->external_declaration_list->accept(*this);
   349   if (res == NULL) {
   395   if (res == NULL) {
   350     current_vartype = none_vt;
   396     current_vartype = none_vt;
       
   397     current_option = none_opt;
   351   }
   398   }
   352   return res;
   399   return res;
   353 }
   400 }
   354 
   401 
   355 /*| VAR_GLOBAL [CONSTANT|RETAIN] global_var_decl_list END_VAR */
   402 /*| VAR_GLOBAL [CONSTANT|RETAIN] global_var_decl_list END_VAR */
   356 /* option -> may be NULL ! */
   403 /* option -> may be NULL ! */
   357 //SYM_REF2(global_var_declarations_c, option, global_var_decl_list)
   404 //SYM_REF2(global_var_declarations_c, option, global_var_decl_list)
   358 void *search_var_instance_decl_c::visit(global_var_declarations_c *symbol) {
   405 void *search_var_instance_decl_c::visit(global_var_declarations_c *symbol) {
   359   current_vartype = global_vt;
   406   current_vartype = global_vt;
       
   407   current_option  = none_opt; /* not really required. Just to make the code more readable */
       
   408   if (NULL != symbol->option)
       
   409     symbol->option->accept(*this);
   360   void *res = symbol->global_var_decl_list->accept(*this);
   410   void *res = symbol->global_var_decl_list->accept(*this);
   361   if (res == NULL) {
   411   if (res == NULL) {
   362     current_vartype = none_vt;
   412     current_vartype = none_vt;
       
   413     current_option = none_opt;
   363   }
   414   }
   364   return res;
   415   return res;
   365 }
   416 }
   366 
   417 
   367 /* var1_list is one of the following...
   418 /* var1_list is one of the following...