Limbo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
test_bison.cpp
Go to the documentation of this file.
1 
8 #include <iostream>
9 #include <fstream>
10 
12 
13 using std::cout;
14 using std::cin;
15 using std::endl;
16 using std::string;
17 
21 {
22  public:
25  {
26  cout << "BookshelfDataBase::" << __func__ << endl;
27  }
31  virtual void resize_bookshelf_node_terminals(int nn, int nt)
32  {
33  cout << __func__ << " => " << nn << ", " << nt << endl;
34  }
36  virtual void resize_bookshelf_net(int n)
37  {
38  cout << __func__ << " => " << n << endl;
39  }
41  virtual void resize_bookshelf_pin(int n)
42  {
43  cout << __func__ << " => " << n << endl;
44  }
46  virtual void resize_bookshelf_row(int n)
47  {
48  cout << __func__ << " => " << n << endl;
49  }
53  virtual void add_bookshelf_terminal(string& name, int w, int h)
54  {
55  cout << __func__ << " => " << name << ", " << w << ", " << h << endl;
56  }
60  virtual void add_bookshelf_node(string& name, int w, int h)
61  {
62  cout << __func__ << " => " << name << ", " << w << ", " << h << endl;
63  }
65  virtual void add_bookshelf_net(BookshelfParser::Net const& net)
66  {
67  net.print(cout);
68  }
70  virtual void add_bookshelf_row(BookshelfParser::Row const& row)
71  {
72  row.print(cout);
73  }
79  virtual void set_bookshelf_node_position(string const& name, double x, double y, string const& orient, string const& status, bool plFlag)
80  {
81  cout << __func__ << " => " << name << ", " << x << ", " << y << ", " << orient << ", " << status << ", plFlag = " << plFlag << endl;
82  }
84  virtual void set_bookshelf_design(string& name)
85  {
86  cout << __func__ << " => " << name << endl;
87  }
89  virtual void bookshelf_end()
90  {
91  cout << __func__ << endl;
92  }
93 };
94 
96 void test1(string const& filename)
97 {
98  cout << "////////////// test1 ////////////////" << endl;
100  BookshelfParser::read(db, filename);
101 }
102 
104 void test2(string const& filename)
105 {
106  cout << "////////////// test2 ////////////////" << endl;
108  BookshelfParser::Driver driver (db);
109  //driver.trace_scanning = true;
110  //driver.trace_parsing = true;
111 
112  driver.parse_file(filename);
113 }
114 
119 int main(int argc, char** argv)
120 {
121 
122  if (argc > 1)
123  {
124  test1(argv[1]);
125  test2(argv[1]);
126  }
127  else
128  cout << "at least 1 argument is required" << endl;
129 
130  return 0;
131 }
Driver for Bookshelf parser.
bool parse_file(const string &filename)
virtual void print(ostream &ss) const
virtual void add_bookshelf_node(string &name, int w, int h)
Definition: test_bison.cpp:60
Custom class that inheritates BookshelfParser::BookshelfDataBase with all the required callbacks defi...
Definition: test_bison.cpp:20
virtual void set_bookshelf_node_position(string const &name, double x, double y, string const &orient, string const &status, bool plFlag)
Definition: test_bison.cpp:79
Base class for bookshelf database. Only pure virtual functions are defined. User needs to inheritate ...
virtual void resize_bookshelf_pin(int n)
Definition: test_bison.cpp:41
BookshelfDataBase()
constructor
Definition: test_bison.cpp:24
virtual void resize_bookshelf_node_terminals(int nn, int nt)
Definition: test_bison.cpp:31
net to describe interconnection of netlist
virtual void add_bookshelf_row(BookshelfParser::Row const &row)
Definition: test_bison.cpp:70
virtual void add_bookshelf_net(BookshelfParser::Net const &net)
Definition: test_bison.cpp:65
virtual void resize_bookshelf_net(int n)
Definition: test_bison.cpp:36
virtual void resize_bookshelf_row(int n)
Definition: test_bison.cpp:46
void test2(string const &filename)
test 2: use class wrapper BookshelfParser::Driver
Definition: test_bison.cpp:104
void test1(string const &filename)
test 1: use function wrapper BookshelfParser::read
Definition: test_bison.cpp:96
bool read(BookshelfDataBase &db, const string &auxFile)
API for BookshelfParser. Read .aux file and parse all other files.
virtual void set_bookshelf_design(string &name)
Definition: test_bison.cpp:84
virtual void print(ostream &ss) const
virtual void add_bookshelf_terminal(string &name, int w, int h)
Definition: test_bison.cpp:53
int main(int argc, char **argv)
main function
Definition: test_bison.cpp:119
virtual void bookshelf_end()
end of bookshelf
Definition: test_bison.cpp:89