LCOV - code coverage report
Current view: top level - src/common - tables.hpp (source / functions) Hit Total Coverage
Test: flower-f.info Lines: 1 1 100.0 %
Date: 2022-06-10 00:44:15 Functions: 1 1 100.0 %

          Line data    Source code
       1             : #ifndef TABLES_H
       2             : #define TABLES_H
       3             : 
       4             : #include <cstddef>
       5             : #include <ostream>
       6             : #include <vector>
       7             : #include "common/exprtype.hpp"
       8             : 
       9             : class IdentTable {
      10             :     type_t valType;    // Тип идентификатора
      11             :     char * structName; // Имя структуры (если valType == _STRUCT_)
      12             :     char * name;       // Имя идентификатора
      13             :     char * fadedName;  // Для отладки
      14             :     bool def;          // Определён ли
      15             :     bool func;         // Является ли функцией
      16             :     bool reg;          // Лежит ли на регистрах
      17             :     void * val;        // Данные
      18             :     int ord;           // Номер элемента
      19             :     int params;        // Количество переменных (если функция)
      20             :     int offset;        // Позиция в байткоде
      21             :     bool shared;
      22             :     IdentTable * mainTable;
      23             : 
      24             : public:
      25             :     IdentTable *next;
      26             : 
      27             :     IdentTable(void);
      28             :     IdentTable(const IdentTable & templateIT);
      29             :     IdentTable & operator=(const IdentTable & templateIT);
      30             :     friend bool operator==(IdentTable & a, IdentTable & b);
      31             : 
      32             :     void pushId(char * ident);
      33             :     void pushType(type_t t);
      34             :     void pushStruct(char * name);
      35             :     void pushVal(void* v);
      36             : 
      37             :     void setType(type_t newType);
      38             :     void setFunc(void);
      39             :     void setVal(void * val);
      40             :     void setId(char * name);
      41             :     void setOrd(int x);
      42             :     void setReg(bool x);
      43             :     void setParams(int x);
      44             :     void setOffset(int x);
      45             :     void setShared(void);
      46             :     void setMainTable(IdentTable* table);
      47             :     void setStruct(char * name);
      48             : 
      49             :     char * getStruct(void) const;
      50             :     type_t getType(void) const;
      51             :     void * getVal(void) const;
      52             :     char * getId(void) const;
      53             :     int getOrd(void) const;
      54             :     int getParams(void) const;
      55             :     int getOffset(void) const;
      56             :     IdentTable* getMainTable(void);
      57             : 
      58             :     bool isFunc(void) const;
      59             :     bool isDef(void) const;
      60             :     bool isReg(void) const;
      61             :     bool isShared(void) const;
      62             : 
      63             :     void whoami();
      64             :     void repr(void);
      65             :     void fade(void);
      66             :     void dupType(void);
      67             :     IdentTable * last(void);
      68             :     IdentTable * confirm(void);
      69             :     IdentTable * deleteLabels(void);
      70             :     void writeValToStream(std::ostream & s);
      71             :     IdentTable * getIT(char * name, bool autodel = true);
      72             : 
      73             :     ~IdentTable();
      74             : };
      75             : 
      76             : class StructTable {
      77             :     char * name;
      78             :     IdentTable fields;
      79             :     StructTable * next;
      80             : public:
      81          67 :     StructTable(void): name(nullptr), next(nullptr) {};
      82             : 
      83             :     void pushName(char * name);
      84             :     void pushField(type_t type, char * name, char * structName, bool shared = false);
      85             :     StructTable * confirm(void);
      86             :     StructTable * last(void);
      87             : 
      88             :     StructTable * getStruct(char * name);
      89             :     IdentTable & getFields(void);
      90             :     std::vector<type_t> getTypes(char * name);
      91             : 
      92             :     ~StructTable();
      93             : };
      94             : 
      95             : #endif

Generated by: LCOV version 1.14