コード例 #1
0
ファイル: DafnyIncludes.cs プロジェクト: jango2015/Ironclad
        /// <summary>
        /// Gets a list of the include files included in the given Dafny source file.
        /// </summary>
        /// <param name="dfysource">Source file to extract include file names from.</param>
        /// <returns>List of include file BuildObjects.</returns>
        public IEnumerable<BuildObject> getIncludes(BuildObject dfysource)
        {
            List<BuildObject> outlist = new List<BuildObject>();
            using (TextReader tr = BuildEngine.theEngine.Repository.OpenRead(dfysource))
            {
                while (true)
                {
                    string line = tr.ReadLine();
                    if (line == null)
                    {
                        break;
                    }

                    Match match = this.includeRegex.Match(line);
                    int count = 0;
                    while (match.Success)
                    {
                        string includedPath = match.Groups[1].ToString();
                        string gluedPath = Path.Combine(dfysource.getDirPath(), includedPath);
                        SourcePath sp = new SourcePath(gluedPath);
                        outlist.Add(sp);
                        count += 1;
                        match = match.NextMatch();  // That would be unexpected!
                    }

                    Util.Assert(count <= 1);
                }
            }

            ////Logger.WriteLine(String.Format("{0} includes {1} things", dfysource.getFilesystemPath(), outlist.Count));
            return outlist;
        }
コード例 #2
0
        public IEnumerable <BuildObject> getIncludes(BuildObject dfysource)
        {
            List <BuildObject> outlist = new List <BuildObject>();
            Regex re = new Regex("^\\s*include\\s*\"(.*)\"");

            using (TextReader tr = BuildEngine.theEngine.getNuObjContents().openRead(dfysource))
            {
                while (true)
                {
                    String line = tr.ReadLine();
                    if (line == null)
                    {
                        break;
                    }
                    Match match = re.Match(line);
                    int   count = 0;
                    while (match.Success)
                    {
                        string     includedPath = match.Groups[1].ToString();
                        string     gluedPath    = Path.Combine(dfysource.getDirPath(), includedPath);
                        SourcePath sp           = new SourcePath(gluedPath);
                        outlist.Add(sp);
                        count += 1;
                        match  = match.NextMatch(); //- That would be unexpected!
                    }
                    Util.Assert(count <= 1);
                }
            }
            //-Logger.WriteLine(String.Format("{0} includes {1} things", dfysource.getFilesystemPath(), outlist.Count));
            return(outlist);
        }
コード例 #3
0
        public BuildObject getMutualSummary()
        {
            // SymDiff files need to go into their own directory.
            BuildObject normalName      = BeatExtensions.makeOutputObject(basmInput, MUTUAL_SUMMARY_EXTN);
            BuildObject dirExtendedName = new BuildObject(Path.Combine(normalName.getDirPath(), dirName, normalName.getFileName()));

            return(dirExtendedName);
        }
コード例 #4
0
        public BuildObject getMutualSummary()
        {
            //- SymDiff files need to go into their own directory
            BuildObject normalName      = BeatExtensions.makeOutputObject(basmInput, MUTUAL_SUMMARY_EXTN);
            BuildObject dirExtendedName = new BuildObject(Path.Combine(normalName.getDirPath(), Util.mungeClean(getAbstractIdentifier().ToString()), normalName.getFileName()));

            return(dirExtendedName);
        }
コード例 #5
0
        public override BuildObject outputFile()
        {
            if (buildSymDiffMutualSummary)
            {
                // SymDiff files need to go into their own directory
                BuildObject normalName = BeatExtensions.makeOutputObject(basmInput, SYMDIFF_EXTN);
                dirName = normalName.getFileName() + SYMDIFF_DIR_EXTN;
                BuildObject dirExtendedName = new BuildObject(Path.Combine(normalName.getDirPath(), dirName, normalName.getFileName()));

                return(dirExtendedName);
            }
            else
            {
                return(BeatExtensions.makeOutputObject(basmInput, BoogieVerb.BPL_EXTN));
            }
        }
コード例 #6
0
        public override BuildObject getOutputFile()
        {
            string extension = null;

            switch (mode)
            {
            case Mode.LEFT:
                extension = LEFT_EXTN; break;

            case Mode.RIGHT:
                extension = RIGHT_EXTN; break;

            default:
                throw new Exception("Unexpected mode for SymDiffExtractVerb");
            }
            return(new BuildObject(Path.Combine(basmIn.getDirPath(), basmIn.getFileNameWithoutExtension() + extension + BoogieVerb.BPL_EXTN)));
            //-return basmIn.makeOutputObject(extension + BoogieVerb.BPL_EXTN);
        }
コード例 #7
0
        public override BuildObject outputFile()
        {
            if (buildSymDiffMutualSummary)
            {
                //- SymDiff files need to go into their own directory
                BuildObject normalName = BeatExtensions.makeOutputObject(basmInput, SYMDIFF_EXTN);

                //- The following produces file names that are too long in the failures directory.
                //- The OS then truncates them, causing filename collisions.
                //-BuildObject dirExtendedName = new BuildObject(Path.Combine(normalName.getDirPath(), Util.mungeClean(getAbstractIdentifier()), normalName.getFileName()));
                //- Try naming the directory after the file instead
                BuildObject dirExtendedName = new BuildObject(Path.Combine(normalName.getDirPath(), normalName.getFileName() + SYMDIFF_DIR_EXTN, normalName.getFileName()));

                return(dirExtendedName);
            }
            else
            {
                return(BeatExtensions.makeOutputObject(basmInput, BoogieVerb.BPL_EXTN));
            }
        }
コード例 #8
0
 /// <summary>
 /// Creates the directory in the local filesystem that corresponds
 /// to this instance.
 /// </summary>
 /// <param name="obj">A build object.</param>
 public void CreateDirectoryFor(BuildObject obj)
 {
     Directory.CreateDirectory(Path.Combine(this.path, obj.getDirPath()));
 }
コード例 #9
0
 private BuildObject RelocateBuildObjectToExeDirectory(BuildObject sourceOb)
 {
     return(new BuildObject(exeOutput.getDirPath() + "\\" + sourceOb.getFileName()));
 }
コード例 #10
0
 /// <summary>
 /// Creates the directory in the local filesystem that corresponds
 /// to this instance.
 /// </summary>
 /// <param name="obj">A build object.</param>
 public void CreateDirectoryFor(BuildObject obj)
 {
     Directory.CreateDirectory(Path.Combine(this.path, obj.getDirPath()));
 }
コード例 #11
0
 private BuildObject getTmpInputFile()
 {
     return(new BuildObject(Path.Combine(basmIn.getDirPath(), getFileName() + BoogieVerb.BPL_EXTN)));
 }