IniList setup_ext_list (setup_exts,
setup_exts + (sizeof(setup_exts) / sizeof(*setup_exts)));
-static BoolOption NoVerifyOption (false, 'X', "no-verify", "Don't verify setup.ini signatures");
-
-extern int yyparse ();
-
-/*extern int yydebug;*/
+static BoolOption NoVerifyOption (false, 'X', "no-verify", IDS_HELPTEXT_NO_VERIFY);
+static BoolOption NoVersionCheckOption (false, '\0', "no-version-check", IDS_HELPTEXT_NO_VERSION_CHECK);
class GuiParseFeedback : public IniParseFeedback
{
public:
GuiParseFeedback () : lastpct (0)
{
+ Progress.SetText1 (IDS_PROGRESS_PARSING);
Progress.SetText2 ("");
Progress.SetText3 ("");
- Progress.SetText4 ("Progress:");
+ Progress.SetText4 (IDS_PROGRESS_PROGRESS);
+
+ yyerror_count = 0;
+ yyerror_messages.clear ();
}
virtual void progress (unsigned long const pos, unsigned long const max)
{
}
virtual void iniName (const std::string& name)
{
- Progress.SetText1 ("Parsing...");
Progress.SetText2 (name.c_str ());
Progress.SetText3 ("");
+ filename = name;
}
virtual void babble (const std::string& message)const
{
{
mbox (Progress.GetHWND(), message.c_str (), "Warning", 0);
}
- virtual void error (const std::string& message)const
+ virtual void note_error(int lineno, const std::string &error)
{
- mbox (Progress.GetHWND(), message.c_str (), "Parse Errors", 0);
+ char tmp[16];
+ sprintf (tmp, "%d", lineno);
+
+ std::string e = filename + " line " + tmp + ": " + error;
+
+ if (!yyerror_messages.empty ())
+ yyerror_messages += "\n";
+
+ yyerror_messages += e;
+ yyerror_count++;
+ }
+ virtual bool has_errors () const
+ {
+ return (yyerror_count > 0);
+ }
+ virtual void show_errors () const
+ {
+ mbox (Progress.GetHWND(), yyerror_messages.c_str (), "Parse Errors", 0);
}
virtual ~ GuiParseFeedback ()
{
- Progress.SetText4 ("Package:");
+ Progress.SetText2 ("");
+ Progress.SetText3 ("");
+ Progress.SetText4 (IDS_PROGRESS_PACKAGE);
+ Progress.SetBar1 (0);
}
private:
unsigned int lastpct;
+ std::string filename;
+ std::string yyerror_messages;
+ int yyerror_count;
};
static io_stream*
-decompress_ini (io_stream *ini_file)
+decompress_ini (io_stream *ini_file, std::string ¤t_ini_name)
{
// Replace the current compressed setup stream with its decompressed
// version. Which decompressor to use is determined by file magic.
ini_file = check_ini_sig (ini_file, ini_sig_file, sig_fail,
"localdir", current_ini_sig_name.c_str (), owner);
if (ini_file)
- ini_file = decompress_ini (ini_file);
+ ini_file = decompress_ini (ini_file, current_ini_name);
if (!ini_file || sig_fail)
{
// no setup found or signature invalid
rfc1738_unescape (current_ini_name.substr (ldl, cap - ldl));
ini_init (ini_file, &aBuilder, myFeedback);
- if (yyparse () || yyerror_count > 0)
+ if (yyparse () || myFeedback.has_errors())
{
- myFeedback.error (yyerror_messages);
+ myFeedback.show_errors ();
ini_error = true;
}
break;
}
if (ini_file)
- ini_file = decompress_ini (ini_file);
+ ini_file = decompress_ini (ini_file, current_ini_name);
if (!ini_file || sig_fail)
{
// no setup found or signature invalid
aBuilder.parse_mirror = n->url;
ini_init (ini_file, &aBuilder, myFeedback);
- if (yyparse () || yyerror_count > 0)
+ if (yyparse () || myFeedback.has_errors())
{
- myFeedback.error (yyerror_messages);
+ myFeedback.show_errors ();
ini_error = true;
}
else
setup_version);
if (ini_setup_version.size ())
{
- if (version_compare (setup_version, ini_setup_version) < 0)
+ if ((version_compare (setup_version, ini_setup_version) < 0)
+ && !NoVersionCheckOption)
note (owner, IDS_OLD_SETUP_VERSION, setup_version,
ini_setup_version.c_str ());
}
HANDLE *context;
context = (HANDLE*)p;
+ SetThreadUILanguage(langid);
+
try
{
bool succeeded = do_ini_thread ((HINSTANCE)context[0], (HWND)context[1]);