コード例 #1
0
        private bool CheckBoogie(string file, Syntax.ProgramDecl prog)
        {
            var pPath     = Path.Combine("..", "P", "Tst", "RegressionTests");
            var localFile = file.Replace(@"..\P\Tst", "");

            localFile = Path.ChangeExtension(".p", ".bpl");
            using (var sw = new StreamWriter(localFile))
            {
                using (var itw = new IndentedTextWriter(sw, "    "))
                {
                    Translator.translateProg(prog, itw);
                }
            }
            using (Process corralProcess = new Process())
            {
                var              argFilePath        = Path.Combine(Path.GetDirectoryName(localFile), testConfFile);
                var              goodOutputFilePath = Path.Combine(Path.GetDirectoryName(localFile), goodOutputFile);
                string           args = File.ReadAllText(argFilePath);
                ProcessStartInfo info = new ProcessStartInfo(corralPath, args);
                info.RedirectStandardInput  = true;
                info.RedirectStandardOutput = true;
                info.UseShellExecute        = false;
                corralProcess.StartInfo     = info;
                corralProcess.Start();

                var    output     = corralProcess.StandardOutput.ReadToEnd().Split();
                string goodOutput = File.ReadAllText(goodOutputFilePath);
            }

            return(false);
        }
コード例 #2
0
 private static void printPFile(string fileName, Syntax.ProgramDecl prog)
 {
     Console.WriteLine(fileName);
     if (fileName == "-")
     {
         Helper.printProg(prog, new IndentedTextWriter(Console.Out, "   "));
     }
     else if (fileName != null)
     {
         using (var sw = new StreamWriter(fileName))
             using (var tr = new IndentedTextWriter(sw, "    "))
             {
                 Helper.printProg(prog, tr);
             }
     }
     else
     {
         Console.WriteLine("Error: fileName is null");
         Environment.Exit(-1);
     }
 }
コード例 #3
0
        //Serialize the F# data structure.
        static void Save(Syntax.ProgramDecl prog, string fileName)
        {
            Stream stream = null;

            try
            {
                IFormatter formatter = new BinaryFormatter();
                stream = new FileStream(fileName, FileMode.Create, FileAccess.Write, FileShare.None);
                formatter.Serialize(stream, prog);
            }
            catch
            {
                // do nothing, just ignore any possible errors
            }
            finally
            {
                if (null != stream)
                {
                    stream.Close();
                }
            }
        }
コード例 #4
0
 private bool CheckP(Syntax.ProgramDecl prog)
 {
     return(false);
 }