public override BuildObject search(string basename, ModPart modPart) { // Kinda linear. ////Logger.WriteLine("Looking for " + basename); foreach (BuildObject obj in this.DafnyOutputs) { if (BeatExtensions.whichPart(obj) != modPart) { continue; } ////Logger.WriteLine(" trying " + obj.getFileNameWithoutExtension() + " from " + obj); if (string.Equals(obj.getFileNameWithoutExtension(), basename, StringComparison.OrdinalIgnoreCase)) { if (this.assertSuspiciousDafnyImpls) { DafnyCCVerb.AssertSmellsImplementy(obj); } return obj; } } return null; }
public void AttachPart(string Name) { ModPart part = ModSystemTools.GetPartN(Name); if (part == null) { return; } foreach (var item in transform.GetComponentsInChildren <ModSlot>()) { if (item.Type == part.Type) { if (item.installedPart != null) { Destroy(item.installedPart.gameObject); } GameObject gm = Instantiate(part.gameObject, item.transform); item.installedPart = gm.GetComponent <ModPart>(); if (item.gameObject.GetComponent <IModSystemSlot>() != null) { item.gameObject.GetComponent <IModSystemSlot>().PartAdded(part.Type, Name); } } } }
public override BuildObject search(string basename, ModPart modPart) { // Kinda linear. ////Logger.WriteLine("Looking for " + basename); foreach (BuildObject obj in this.DafnyOutputs) { if (BeatExtensions.whichPart(obj) != modPart) { continue; } ////Logger.WriteLine(" trying " + obj.getFileNameWithoutExtension() + " from " + obj); if (string.Equals(obj.getFileNameWithoutExtension(), basename, StringComparison.OrdinalIgnoreCase)) { if (this.assertSuspiciousDafnyImpls) { DafnyCCVerb.AssertSmellsImplementy(obj); } return(obj); } } return(null); }
public override BuildObject search(string basename, ModPart modPart = ModPart.Ifc) { foreach (IIncludePathContext context in _contexts) { BuildObject obj = context.search(basename, modPart); if (obj != null) { return(obj); } } return(null); }
public static string ExtnStr(this ModPart modPart) { switch (modPart) { case ModPart.Ifc: return(ModPartIfc); case ModPart.Imp: return(ModPartImp); case ModPart.Unknown: return(ModPartUnknown); default: return(null); } }
public override BuildObject search(string basename, ModPart modPart = ModPart.Ifc) { foreach (IIncludePathContext context in this.contexts) { BuildObject obj = context.search(basename, modPart); if (obj != null) { return obj; } } return null; }
internal static BuildObject makeLabeledOutputObject(BuildObject input, string appLabel, string typeExtn) { ModPart part = whichPart(input); if (part == ModPart.Unknown) { //- input must be a raw boogie file. Util.Assert(input.getExtension().EndsWith(BoogieVerb.BPL_EXTN)); return(input.makeLabeledOutputObject(appLabel, typeExtn)); } else { return(input.makeLabeledOutputObject(appLabel, part.ExtnStr() + typeExtn)); } }
void getBasmModule(string modName, ModPart modPart) { //-Logger.WriteLine(String.Format("context {0} modName {1} modPart {2}", context, modName, modPart)); //-BuildObject ifcObj = context.search(modName, modPart); BuildObject ifcObj = BuildEngine.theEngine.getHasher().search(context, modName, modPart); if (ifcObj == null) { Util.Assert(false); //- I'm not sure this case even occur anymore, since we guard the foreach on incomplete deps _ddisp = _ddisp.combine(DependencyDisposition.Incomplete); } else { ifcObj = maybeBeat(ifcObj, _mutableVerbSet); _basmModules.Add(ifcObj); } }
public override BuildObject search(string basename, ModPart modPart) { List<SourcePath> results = new List<SourcePath>(); foreach (string extension in this.dstExtensions.Where(extn => BeatExtensions.whichPart(extn) == modPart)) { string filename = basename + extension; foreach (DirectoryRecord directoryRecord in this.directories) { if (directoryRecord.Contains(filename)) { string proposed = Path.Combine( BuildEngine.theEngine.getIronRoot(), BuildEngine.theEngine.getSrcRoot(), directoryRecord.directory, basename + extension); ////Logger.WriteLine("SourcePathIncludeContext Trying " + proposed); ////Util.Assert(File.Exists(proposed)); results.Add(new SourcePath(proposed)); } } } if (results.Count() == 0) { return null; } else if (results.Count() > 1) { throw new SourceConfigurationError(string.Format( "Reference {0} matches {1} paths: {2}", basename, results.Count(), string.Join(",", results))); } else { return results.First(); } }
public override BuildObject search(string basename, ModPart modPart) { List <SourcePath> results = new List <SourcePath>(); foreach (string extension in this.dstExtensions.Where(extn => BeatExtensions.whichPart(extn) == modPart)) { string filename = basename + extension; foreach (DirectoryRecord directoryRecord in this.directories) { if (directoryRecord.Contains(filename)) { string proposed = Path.Combine( BuildEngine.theEngine.getIronRoot(), BuildEngine.theEngine.getSrcRoot(), directoryRecord.directory, basename + extension); ////Logger.WriteLine("SourcePathIncludeContext Trying " + proposed); ////Util.Assert(File.Exists(proposed)); results.Add(new SourcePath(proposed)); } } } if (results.Count() == 0) { return(null); } else if (results.Count() > 1) { throw new SourceConfigurationError(string.Format( "Reference {0} matches {1} paths: {2}", basename, results.Count(), string.Join(",", results))); } else { return(results.First()); } }
public void Visit(ModPart modPart) => HandleOperation(modPart.Left, modPart.Right, "% ");
public abstract BuildObject search(string basename, ModPart modPart = ModPart.Ifc);
public BuildObject search(IIncludePathContext context, string modName, ModPart modPart) { return(_contextResolutionCache.get(new Tuple <IIncludePathContext, string, ModPart>(context, modName, modPart))); }
public BuildObject search(IIncludePathContext context, string modName, ModPart modPart) { return this.contextResolutionCache.get(new Tuple<IIncludePathContext, string, ModPart>(context, modName, modPart)); }
private void getBasmModule(string modName, ModPart modPart) { ////Logger.WriteLine(string.Format("context {0} modName {1} modPart {2}", context, modName, modPart)); ////BuildObject ifcObj = context.search(modName, modPart); BuildObject ifcObj = BuildEngine.theEngine.getHasher().search(context, modName, modPart); if (ifcObj == null) { Util.Assert(false); // I'm not sure this case even occur anymore, since we guard the foreach on incomplete deps. _ddisp = _ddisp.combine(DependencyDisposition.Incomplete); } else { ifcObj = maybeBeat(ifcObj, _mutableVerbSet); _basmModules.Add(ifcObj); } }
public ModPartCache(string name, ModPart part) { Name = name; Part = part; }
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; //-} }