Limbo 3.5.4
Loading...
Searching...
No Matches
test_bison.cpp
Go to the documentation of this file.
1
7
8#include <iostream>
9#include <fstream>
10
12
13using std::cout;
14using std::cin;
15using std::endl;
16using std::string;
17
21{
22 public:
25 {
26 cout << "GdfDataBase::" << __func__ << endl;
27 }
28
31 virtual void add_gdf_cell(GdfParser::Cell& cell)
32 {
33 cout << cell << endl;
34 }
35};
36
38void test1(string const& filename)
39{
40 cout << "////////////// test1 ////////////////" << endl;
41 GdfDataBase db;
42 GdfParser::read(db, filename);
43}
44
46void test2(string const& filename)
47{
48 cout << "////////////// test2 ////////////////" << endl;
49 GdfDataBase db;
50 GdfParser::Driver driver (db);
51 //driver.trace_scanning = true;
52 //driver.trace_parsing = true;
53
54 driver.parse_file(filename);
55}
56
61int main(int argc, char** argv)
62{
63
64 if (argc > 1)
65 {
66 test1(argv[1]);
67 //test2(argv[1]);
68 }
69 else
70 cout << "at least 1 argument is required" << endl;
71
72 return 0;
73}
Driver for Gdf parser.
void test2(string const &filename)
test 2: use class wrapper BookshelfParser::Driver
Custom class that inheritates GdfParser::GdfDataBase with all the required callbacks gdfined.
virtual void add_gdf_cell(GdfParser::Cell &cell)
add routing cell
GdfDataBase()
constructor
bool parse_file(const string &filename)
Base class for def database. Only pure virtual functions are defined. User needs to inheritate this...
bool read(GdfDataBase &db, const string &filename)
API for GdfParser. Read GDF file and initialize database by calling user-defined callback functions.
the whole routing layout is describe by a cell
int main()
void test1()
test function API