#include <astl_binary.h>
#include <dot.h>

// Send a dot (graphviz) representation to the standard output

template <class DFA>
void dot_output(DFA &A, const string &filename)
{
  load_dfa(A, filename);
  DFA_dot out(cout);
  dot(out, dfirstmarkc(forwardc(A)));
  exit(0);
}
  
int main(int argc, char **argv)
{
  usage use(argv[0]);
  use.push_back("[dfa_file]");
  use.push_back("send the dot representation of the dfa to standard output");
  use.check(argc, argv, 0, 1);

  if (use[0] == "matrix") {
    DFA_matrix<plain> A;
    dot_output(A, use[1]);
  }
  if (use[0] == "map") {
    DFA_map<plain> A;
    dot_output(A, use[1]);
  }
  if (use[0] == "bin") {
    DFA_bin<plain> A;
    dot_output(A, use[1]);
  }
  if (use[0] == "mtf") {
    DFA_mtf<plain> A;
    dot_output(A, use[1]);
  }
  if (use[0] == "tr") {
    DFA_tr<plain> A;
    dot_output(A, use[1]);
  }
  if (use[0] == "hash") {
    DFA_hash<plain> A;
    dot_output(A, use[1]);
  }
  exit(1);
}

