-bool Converter::Convert(Buffer * buffer, string const & from_file,
- string const & to_file, string const & using_format,
- string * view_file)
+bool Converter::IsReachable(string const & from, string const & to)
+{
+ if (from == to)
+ return true;
+
+ queue< vector<Command>::iterator > Q;
+ for (vector<Command>::iterator it = commands.begin();
+ it != commands.end(); ++it)
+ if ((*it).from->name == from && enable(it, from)) {
+ Q.push(it);
+ (*it).visited = true;
+ } else
+ (*it).visited = false;
+
+ while (!Q.empty()) {
+ vector<Command>::iterator it = Q.front();
+ Q.pop();
+ if ((*it).to->name == to)
+ return true;
+ for (vector<Command>::iterator it2 = commands.begin();
+ it2 != commands.end(); ++it2)
+ if (!(*it2).visited && (*it).to == (*it2).from &&
+ enable(it2, from)) {
+ Q.push(it2);
+ (*it2).visited = true;
+ }
+ }
+ return false;
+}
+
+
+bool Converter::Convert(Buffer const * buffer,
+ string const & from_file, string const & to_file_base,
+ string const & from_format, string const & to_format,
+ string const & using_format, string & to_file)