absyntax_utils/search_varfb_instance_type.hh
changeset 417 d48f53715f77
parent 372 25332e048742
child 420 866eb35e4e14
--- a/absyntax_utils/search_varfb_instance_type.hh	Wed Feb 01 13:01:08 2012 +0000
+++ b/absyntax_utils/search_varfb_instance_type.hh	Wed Feb 01 19:49:11 2012 +0000
@@ -1,7 +1,7 @@
 /*
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
- *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2003-2012  Mario de Sousa (msousa@fe.up.pt)
  *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  This program is free software: you can redistribute it and/or modify
@@ -77,28 +77,37 @@
  *
  * Member functions:
  * ================
+ *   get_basetype_id()    ---> returns 2A   (implemented, although currently it is not needed! )
  *   get_basetype_decl()  ---> returns 2B 
  *   get_type_id()        ---> returns 1A
  * 
- *   Since we haven't yet needed them, we don't yet implement
- *   get_basetype_id()    ----> would return 2A
- *   get_type_decl()      ----> would return 1B
+ *   Since we haven't yet needed it, we don't yet implement
+ *   get_type_decl()      ---> returns 1B 
  */ 
 
-class search_varfb_instance_type_c: public search_base_type_c {
+class search_varfb_instance_type_c : null_visitor_c {
 
   private:
     search_var_instance_decl_c search_var_instance_decl;
-    decompose_var_instance_name_c *decompose_var_instance_name;
-    symbol_c *current_structelement_name;
-    symbol_c *current_typeid;
-    symbol_c *current_basetypeid;
+    search_base_type_c         search_base_type;
+
+//  symbol_c *current_type_decl;
+    symbol_c *current_type_id;
+    symbol_c *current_basetype_decl;
+    symbol_c *current_basetype_id;
+    
+    symbol_c *current_field_selector;
+
     bool is_complex;
+    
+    /* sets all the above variables to NULL, or false */
+    void init(void);
 
   public:
     search_varfb_instance_type_c(symbol_c *search_scope);
     symbol_c *get_basetype_decl(symbol_c *variable_name);
-    symbol_c *get_type_decl(symbol_c *variable_name);
+    symbol_c *get_basetype_id  (symbol_c *variable_name);
+//     symbol_c *get_type_decl(symbol_c *variable_name);
     symbol_c *get_type_id(symbol_c *variable_name);
 
     /* NOTE: this function should be remvoed/deleted.
@@ -130,12 +139,11 @@
      * to be a type, unlike this class that allows a variable instance
      * of a function block type...
      */
-    void *visit(identifier_c *type_name);
+//     void *visit(identifier_c *type_name);
 
     /********************************/
     /* B 1.3.3 - Derived data types */
     /********************************/
-    
     /*  identifier ':' array_spec_init */
     void *visit(array_type_declaration_c *symbol);
     
@@ -170,7 +178,20 @@
     void *visit(structure_element_initialization_c *symbol); /* should never get called... */
 
 
-
+    /*********************/
+    /* B 1.4 - Variables */
+    /*********************/
+    void *visit(symbolic_variable_c *symbol);
+
+    /********************************************/
+    /* B.1.4.1   Directly Represented Variables */
+    /********************************************/
+    /*************************************/
+    /* B 1.4.2 - Multi-element variables */
+    /*************************************/
+    void *visit(array_variable_c *symbol);
+    void *visit(structured_variable_c *symbol);
+    
     /**************************************/
     /* B.1.5 - Program organization units */
     /**************************************/