static void Main(string[] args) { FortranOptions opts = new FortranOptions(); MessageCollection messages = new MessageCollection(opts); opts.Messages = messages; if (opts.Parse(args)) { Compiler comp = new Compiler(opts); comp.Messages = messages; foreach (string srcfile in opts.SourceFiles) { if (!File.Exists(srcfile)) { messages.Error(MessageCode.SOURCEFILENOTFOUND, String.Format("File '{0}' not found", srcfile)); break; } comp.Compile(srcfile); } if (messages.ErrorCount == 0) { comp.Save(); if (opts.Run && messages.ErrorCount == 0) { comp.Execute(); } } } foreach (Message msg in messages) { if (msg.Level == MessageLevel.Error) { Console.ForegroundColor = ConsoleColor.Red; } Console.WriteLine(msg); Console.ResetColor(); } if (messages.ErrorCount > 0) { Console.WriteLine(String.Format("*** {0} errors found. Compilation stopped.", messages.ErrorCount)); } }