예제 #1
0
        static void doHwswLevelMatch(string infile, string outfile)
        {
            var program = BoogieUtil.ParseProgram(infile);

            foreach (var decl in program.TopLevelDeclarations)
            {
                var impl = decl as Implementation;
                if (impl == null)
                {
                    continue;
                }
                doHwswLevelMatch(impl);
            }

            BoogieUtil.PrintProgram(program, outfile);
        }
예제 #2
0
        public static Program GetInputProgram(string filename)
        {
            Program init = BoogieUtil.ParseProgram(filename);

            //Instrumentations.RemoveAssertNonNull ra = new Instrumentations.RemoveAssertNonNull();
            //BoogieUtil.PrintProgram(ra.VisitProgram(init), "noassert.bpl");
            //Sanity check (currently most of it happens inside HarnessInstrumentation)
            CheckInputProgramRequirements(init);

            // Adding impl for stubs
            if (Options.stubsfile != null)
            {
                try
                {
                    Program stubProg = BoogieUtil.ParseProgram(Options.stubsfile);

                    var procs = new Dictionary <string, Procedure>();
                    init.TopLevelDeclarations.OfType <Procedure>().Iter(proc => procs.Add(proc.Name, proc));

                    var impls = new HashSet <string>();
                    init.TopLevelDeclarations.OfType <Implementation>().Iter(impl => impls.Add(impl.Name));

                    foreach (var impl in stubProg.TopLevelDeclarations.OfType <Implementation>())
                    {
                        // Add the model if there is a procedure declaration but no implementation
                        if (procs.ContainsKey(impl.Name) && !impls.Contains(impl.Name))
                        {
                            init.AddTopLevelDeclaration(impl);
                            //impl.Proc = procs[impl.Name];
                        }
                    }
                }
                catch (System.IO.FileNotFoundException)
                {
                    Utils.Print(string.Format("Stub file not found : {0}", Options.stubsfile));
                }
            }

            init.Resolve();

            return(init);
        }