class Buffer;
///
-struct Command {
+class Format {
+public:
///
- Command(string const & f, string const & t, string const & c,
- bool o)
- : from(f), to(t), command(c), original_dir(o) {}
+ Format() {}
///
- string from;
+ Format(string const & n, string const & e, string const & p,
+ string const & s) :
+ name(n), extension(e), prettyname(p), shortcut(s) {};
///
- string to;
+ string name;
///
- string command;
+ string extension;
///
- bool original_dir;
+ string prettyname;
///
- bool visited;
+ string shortcut;
///
- std::vector<Command>::iterator previous;
+ string viewer;
};
///
-class Format {
-public:
+struct Command {
///
- Format() : in_degree(0) {}
+ Command(Format const * f, Format const * t, string const & c)
+ : from(f), to(t), command(c),
+ latex(false), original_dir(false), need_aux(false) {}
///
- Format(string const & n);
+ Format const * from;
///
- string name;
+ Format const * to;
///
- string prettyname;
+ string command;
+ /// The converter is latex or its derivatives
+ bool latex;
+ /// Do we need to run the converter in the original directory?
+ bool original_dir;
+ /// This converter needs the .aux files
+ bool need_aux;
+ /// If the converter put the result in a directory, then result_dir
+ /// is the name of the directory
+ string result_dir;
+ /// If the converter put the result in a directory, then result_file
+ /// is the name of the main file in that directory
+ string result_file;
+ /// Command to convert the program output to a LaTeX log file format
+ string parselog;
+ /// Backends in which the converter is not used
+ std::vector<string> disable;
+
+ /// Used by the BFS algorithm
+ bool visited;
+ /// Used by the BFS algorithm
+ std::vector<Command>::iterator previous;
+};
+
+class FormatPair {
+public:
///
- string viewer;
+ Format const * format;
+ ///
+ Format const * from;
+ ///
+ string command;
///
- int in_degree;
+ FormatPair(Format const * f1, Format const * f2, string c)
+ : format(f1), from(f2), command(c) {}
};
///
void Add(string const & name);
///
static
+ void Add(string const & name, string const & extension,
+ string const & prettyname, string const & shortcut);
+ ///
+ static
void SetViewer(string const & name, string const & command);
///
static
- bool View(string const & filename);
+ bool View(Buffer const * buffer, string const & filename,
+ string const & format_name);
///
static
Format * GetFormat(string const & name);
///
static
string const PrettyName(string const & name);
+ ///
+ static
+ string const Extension(string const & name);
private:
///
static
void Add(string const & from, string const & to,
string const & command, string const & flags);
///
+
+ ///
static
- std::vector<std::pair<string, string> > const
- GetReachable(string const & from,
- bool only_viewable = false);
+ std::vector<FormatPair> const
+ GetReachable(string const & from, string const & stop_format,
+ bool only_viewable);
///
static
- bool convert(Buffer * buffer, string const & from_file,
- string const & to_format);
+ bool IsReachable(string const & from, string const & to);
///
static
- string const SplitFormat(string const & str, string & format);
+ bool 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);
+ ///
+ static
+ bool 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());
+ ///
+ static
+ string const SplitFormat(string const & str, string & format);
+ ///
+ static
+ string const dvi_papersize(Buffer const * buffer);
+ ///
+ static
+ string const dvips_options(Buffer const * buffer);
+ ///
+ static
+ void init();
private:
///
static
- bool runLaTeX(Buffer * buffer, string const & command);
+ bool scanLog(Buffer const * buffer, string const & command,
+ string const & filename);
+ ///
+ static
+ bool runLaTeX(Buffer const * buffer, string const & command);
///
static
std::vector<Command> commands;
+ ///
+ static
+ string latex_command;
};
#endif