public IEnumerable<BuildObject> getIncludes(BuildObject beatsrc) { IHasher hasher = BuildEngine.theEngine.getHasher(); OrderPreservingSet<BuildObject> includes = new OrderPreservingSet<BuildObject>(); BuildObject ifcFile = hasher.search(this.includePathSearcher, beatsrc.getFileNameWithoutExtension(), ModPart.Ifc); BuildObject impFile = hasher.search(this.includePathSearcher, beatsrc.getFileNameWithoutExtension(), ModPart.Imp); Util.Assert(ifcFile.Equals(beatsrc) || impFile.Equals(beatsrc)); includes.AddRange(this.directIncludes.getBasmIncludes(ifcFile)); includes.AddRange(this.directIncludes.getBasmIncludes(impFile)); return includes; }
public IEnumerable <BuildObject> getIncludes(BuildObject beatsrc) { IHasher hasher = BuildEngine.theEngine.getHasher(); OrderPreservingSet <BuildObject> includes = new OrderPreservingSet <BuildObject>(); BuildObject ifcFile = hasher.search(this.includePathSearcher, beatsrc.getFileNameWithoutExtension(), ModPart.Ifc); BuildObject impFile = hasher.search(this.includePathSearcher, beatsrc.getFileNameWithoutExtension(), ModPart.Imp); Util.Assert(ifcFile.Equals(beatsrc) || impFile.Equals(beatsrc)); includes.AddRange(this.directIncludes.getBasmIncludes(ifcFile)); includes.AddRange(this.directIncludes.getBasmIncludes(impFile)); return(includes); }
// This is merely an assert double-check that we didn't let a spec generated // by DafnyCC slip through to be used in the BoogieAsmVerify step. internal static void AssertSmellsImplementy(BuildObject obj) { string fn = obj.getFileNameWithoutExtension(); Util.Assert(fn.EndsWith("_" + DafnyTransformBaseVerb.DAFNY_I_SUFFIX) || fn.EndsWith("_" + DafnyTransformBaseVerb.DAFNY_C_SUFFIX) || fn.Equals("Checked") || fn.Equals("Heap") || fn.Equals("Seq")); }
protected override bool transformFilterAccepts(BuildObject dfysource) { string fn = dfysource.getFileNameWithoutExtension(); if (fn.EndsWith("." + DafnyTransformBaseVerb.DAFNY_S_SUFFIX)) { return true; } else { Util.Assert(fn.EndsWith("." + DafnyTransformBaseVerb.DAFNY_I_SUFFIX) || fn.EndsWith("." + DafnyTransformBaseVerb.DAFNY_C_SUFFIX) || dfysource.Equals(this.getDafnyPrelude())); return false; } }
protected override bool transformFilterAccepts(BuildObject dfysource) { string fn = dfysource.getFileNameWithoutExtension(); if (fn.EndsWith("." + DafnyTransformBaseVerb.DAFNY_S_SUFFIX)) { return(true); } else { Util.Assert(fn.EndsWith("." + DafnyTransformBaseVerb.DAFNY_I_SUFFIX) || fn.EndsWith("." + DafnyTransformBaseVerb.DAFNY_C_SUFFIX) || dfysource.Equals(this.getDafnyPrelude())); return(false); } }
private static IEnumerable <BeatIncludes.LabeledInclude> getBeatFlavoredShallowIncludesLabeled( IContextGeneratingVerb contextVerb, BuildObject rootObj) { ContextContents context = (ContextContents) BuildEngine.theEngine.getNuObjContents().openVirtual(contextVerb.getContextOutput()); BeatIncludes includes = new BeatIncludes(context.context); OrderPreservingSet <BeatIncludes.LabeledInclude> result = new OrderPreservingSet <BeatIncludes.LabeledInclude>( includes.getLabeledIncludes(rootObj)); if (BeatExtensions.whichPart(rootObj) == ModPart.Imp) { BuildObject rootIfc = context.context.search(rootObj.getFileNameWithoutExtension(), ModPart.Ifc); result.Add(new BeatIncludes.LabeledInclude(BeatIncludes.ImportFilter.ForBeatOrBasm, rootIfc)); } return(result); }
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); }
private string getModuleNameForObj(BuildObject obj) { return(obj.getFileNameWithoutExtension()); }
public BasmModuleAccumulator(IContextGeneratingVerb contextGenVerb, BuildObject upstreamObj, bool linkMode) { this._contextGenVerb = contextGenVerb; this._mutableVerbSet = new HashSet <IVerb>(); //- NB preserve module definition-dependency order this._basmModules = new OrderPreservingSet <BuildObject>(); this._auxiliaryDeps = new HashSet <BuildObject>(); _ddisp = DependencyDisposition.Complete; //-try //-{ _mutableVerbSet.Add(contextGenVerb); _auxiliaryDeps.UnionWith(contextGenVerb.getOutputs()); context = contextGenVerb.fetchIfAvailable(ref _ddisp); if (context != null) { OrderPreservingSet <BuildObject> deps; if (!linkMode) { deps = BeatExtensions.getBeatFlavoredShallowDependencies( contextGenVerb, upstreamObj, out _ddisp, BeatIncludes.ImportFilter.ForBasmOnly); } else { deps = BeatExtensions.getBasmFlavoredTransitiveDependencies(contextGenVerb, upstreamObj, out _ddisp); _mutableVerbSet.Add(BeatExtensions.getBasmFlavoredTransitiveDepVerb(_contextGenVerb, upstreamObj)); } string targetModName = upstreamObj.getFileNameWithoutExtension(); ModPart targetModPart = BeatExtensions.whichPart(upstreamObj); //- NB security policy note: When verifying X.imp, we must be sure to supply X.ifc //- to BoogieAsm, so that we know that we're actually verifying the promises //- that other modules are relying on when they say "X" (which is how X got on //- the verification obligation list). That property happens automatically here, //- because we make a list of modules (ignoring ifc/imp part), such as {A,B,X}, //- and include *every* .ifc. If we're verifying X.imp, a conditional test //- includes it at the time we consider module X. foreach (BuildObject dep in deps) { string depExtn = dep.getExtension(); if (depExtn == null || depExtn.EndsWith(TransitiveDepsVerb.TDEP_EXTN) || depExtn.EndsWith(ContextGeneratingVerb.CONTEXT_EXTN)) { _auxiliaryDeps.Add(dep); } else { Util.Assert(depExtn.Equals(BeatExtensions.BEATIFC_EXTN) || depExtn.Equals(BeatExtensions.BEATIMP_EXTN) || depExtn.Equals(BASMIFC_EXTN) || depExtn.Equals(BASMIMP_EXTN)); //- Burned too many times by this silly filter-out strategy. string modName = dep.getFileNameWithoutExtension(); ModPart modPart = BeatExtensions.whichPart(dep); getBasmModule(modName, ModPart.Ifc); if ((dep.Equals(upstreamObj) && modPart == ModPart.Imp) || linkMode) { getBasmModule(modName, ModPart.Imp); } } } } //-} //-catch (ObjNotReadyException) //-{ //- //- _ddisp = DependencyDisposition.Incomplete; //-} //-catch (ObjFailedException) //-{ //- _ddisp = DependencyDisposition.Failed; //-} }
private string getModuleNameForObj(BuildObject obj) { return obj.getFileNameWithoutExtension(); }
public BasmModuleAccumulator(IContextGeneratingVerb contextGenVerb, BuildObject upstreamObj, bool linkMode) { this._contextGenVerb = contextGenVerb; this._mutableVerbSet = new HashSet<IVerb>(); // NB preserve module definition-dependency order. this._basmModules = new OrderPreservingSet<BuildObject>(); this._auxiliaryDeps = new HashSet<BuildObject>(); _ddisp = DependencyDisposition.Complete; ////try ////{ _mutableVerbSet.Add(contextGenVerb); _auxiliaryDeps.UnionWith(contextGenVerb.getOutputs()); context = contextGenVerb.fetchIfAvailable(ref _ddisp); if (context != null) { OrderPreservingSet<BuildObject> deps; if (!linkMode) { deps = BeatExtensions.getBeatFlavoredShallowDependencies( contextGenVerb, upstreamObj, out _ddisp, BeatIncludes.ImportFilter.ForBasmOnly); } else { deps = BeatExtensions.getBasmFlavoredTransitiveDependencies(contextGenVerb, upstreamObj, out _ddisp); _mutableVerbSet.Add(BeatExtensions.getBasmFlavoredTransitiveDepVerb(_contextGenVerb, upstreamObj)); } // REVIEW: The following two variables are unused. Remove? string targetModName = upstreamObj.getFileNameWithoutExtension(); ModPart targetModPart = BeatExtensions.whichPart(upstreamObj); // NB security policy note: When verifying X.imp, we must be sure to supply X.ifc // to BoogieAsm, so that we know that we're actually verifying the promises // that other modules are relying on when they say "X" (which is how X got on // the verification obligation list). That property happens automatically here, // because we make a list of modules (ignoring ifc/imp part), such as {A,B,X}, // and include *every* .ifc. If we're verifying X.imp, a conditional test // includes it at the time we consider module X. foreach (BuildObject dep in deps) { string depExtn = dep.getExtension(); if (depExtn == null || depExtn.EndsWith(TransitiveDepsVerb.TDEP_EXTN) || depExtn.EndsWith(ContextGeneratingVerb.CONTEXT_EXTN)) { _auxiliaryDeps.Add(dep); } else { Util.Assert(depExtn.Equals(BeatExtensions.BEATIFC_EXTN) || depExtn.Equals(BeatExtensions.BEATIMP_EXTN) || depExtn.Equals(BASMIFC_EXTN) || depExtn.Equals(BASMIMP_EXTN)); // Burned too many times by this silly filter-out strategy. string modName = dep.getFileNameWithoutExtension(); ModPart modPart = BeatExtensions.whichPart(dep); getBasmModule(modName, ModPart.Ifc); if ((dep.Equals(upstreamObj) && modPart == ModPart.Imp) || linkMode) { getBasmModule(modName, ModPart.Imp); } } } } ////} ////catch (ObjNotReadyException) ////{ //// // oh, we don't even have the context object yet. //// _ddisp = DependencyDisposition.Incomplete; ////} ////catch (ObjFailedException) ////{ //// _ddisp = DependencyDisposition.Failed; ////} }
private static IEnumerable<BeatIncludes.LabeledInclude> getBeatFlavoredShallowIncludesLabeled( IContextGeneratingVerb contextVerb, BuildObject rootObj) { ContextContents context = (ContextContents) BuildEngine.theEngine.Repository.FetchVirtual(contextVerb.getContextOutput()); BeatIncludes includes = new BeatIncludes(context.Context); OrderPreservingSet<BeatIncludes.LabeledInclude> result = new OrderPreservingSet<BeatIncludes.LabeledInclude>( includes.getLabeledIncludes(rootObj)); if (BeatExtensions.whichPart(rootObj) == ModPart.Imp) { BuildObject rootIfc = context.Context.search(rootObj.getFileNameWithoutExtension(), ModPart.Ifc); result.Add(new BeatIncludes.LabeledInclude(BeatIncludes.ImportFilter.ForBeatOrBasm, rootIfc)); } return result; }