torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
XdlImporterTest.cpp
Go to the documentation of this file.
1 // Gizmo - Copyright 2009 University of Southern California. All Rights Reserved.
2 // $HeadURL$
3 // $Id$
4 #if 0
5 #include <iostream>
6 #include <fstream>
9 
10 int xdlmain(int argc, char *argv[]);
11 int xdlmain(int argc, char *argv[])
12 {
14  bool readfile = false;
15 
16  for(int ai = 1; ai < argc; ++ai)
17  {
18  if (argv[ai] == std::string ("-p")) {
19  importer.mTraceParsing = true;
20  }
21  else if (argv[ai] == std::string ("-s")) {
22  importer.mTraceScanning = true;
23  }
24  else
25  {
26  // read a file with expressions
27 
28  std::fstream infile(argv[ai]);
29  if (!infile.good())
30  {
31  std::cerr << "Could not open file: " << argv[ai] << std::endl;
32  return 0;
33  }
34 
35  bool result = importer(infile, argv[ai]);
36  if (result)
37  {
38  std::cout << "Successfully parsed \"" << argv[ai] << "\"." << std::endl;
39  torc::physical::XdlExporter exporter(std::cout);
40  exporter(importer.getDesignPtr());
41  }
42  else
43  {
44  std::cout << "Failed to parse \"" << argv[ai] << "\"." << std::endl;
45  }
46 
47  readfile = true;
48  }
49  }
50 
51  if (readfile) return 0;
52 
53  std::cout << "Reading expressions from stdin" << std::endl;
54 
55  std::string line;
56  while( std::cout << "input: " &&
57  std::getline(std::cin, line) &&
58  !line.empty() )
59  {
60  bool result = importer(line, "input");
61 
62  if (result)
63  {
64  std::cout << "Successfully parsed stdin" << std::endl;
65  return 0;
66  }
67  }
68 
69  return -1;
70 }
71 #endif
int xdlmain(int argc, char *argv[])
DesignSharedPtr getDesignPtr(void)
Returns a shared pointer for the design.
bool mTraceScanning
Enable debug output in the flex scanner.
std::string string
Header for the XdlImporter class.
Header for the XdlExport class.
bool mTraceParsing
Enable debug output in the bison parser.
Importer from XDL format into a physical design.
Physical design exporter for XDL.
Definition: XdlExporter.hpp:31