+ parselog = flag_value;
+ }
+ if (!result_dir.empty() && result_file.empty())
+ result_file = "index." + formats.Extension(to);
+ //if (!contains(command, token_from))
+ // latex = true;
+}
+
+
+bool operator<(Converter const & a, Converter const & b)
+{
+ int const i = compare_no_case(a.From->prettyname(),
+ b.From->prettyname());
+ if (i == 0)
+ return compare_no_case(a.To->prettyname(), b.To->prettyname())
+ < 0;
+ else
+ return i < 0;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+class compare_Converter {
+public:
+ compare_Converter(string const & f, string const & t)
+ : from(f), to(t) {}
+ bool operator()(Converter const & c) {
+ return c.from == from && c.to == to;
+ }
+private:
+ string const & from;
+ string const & to;
+};
+
+
+Converter const * Converters::GetConverter(string const & from,
+ string const & to)
+{
+ ConverterList::const_iterator cit =
+ find_if(converterlist.begin(), converterlist.end(),
+ compare_Converter(from, to));
+ if (cit != converterlist.end())
+ return &(*cit);
+ else
+ return 0;
+}
+
+
+int Converters::GetNumber(string const & from, string const & to)
+{
+ ConverterList::const_iterator cit =
+ find_if(converterlist.begin(), converterlist.end(),
+ compare_Converter(from, to));
+ if (cit != converterlist.end())
+ return cit - converterlist.begin();
+ else
+ return -1;
+}
+
+
+void Converters::Add(string const & from, string const & to,
+ string const & command, string const & flags)
+{
+ formats.Add(from);
+ formats.Add(to);
+ ConverterList::iterator it = find_if(converterlist.begin(),
+ converterlist.end(),
+ compare_Converter(from, to));
+
+ Converter converter(from, to, command, flags);
+ if (it != converterlist.end() && !flags.empty() && flags[0] == '*') {
+ converter = *it;
+ converter.command = command;
+ converter.flags = flags;
+ }
+ converter.ReadFlags();
+
+ if (converter.latex && (latex_command.empty() || to == "dvi"))
+ latex_command = subst(command, token_from, "");
+ // If we have both latex & pdflatex, we set latex_command to latex.
+ // The latex_command is used to update the .aux file when running
+ // a converter that uses it.
+
+ if (it == converterlist.end())
+ converterlist.push_back(converter);
+ else {
+ converter.From = it->From;
+ converter.To = it->To;
+ *it = converter;