private void RecursiveDiscoverCompilationTree( LinkerTarget root, Dictionary <FileReference, LinkerTarget> targets) { if (root.FileCompilation.FileReferences.Count != 0) { foreach (FileReference reference in root.FileCompilation.FileReferences) { if (targets.ContainsKey(reference)) { continue; } if (File.Exists(reference.File)) { FileCompilation fc = new FileCompilation(reference); LinkerTarget t = new LinkerTarget(fc, fc.Reference.LinkerArguments); targets[reference] = t; RecursiveDiscoverCompilationTree(t, targets); } else { LinkerInfo info = LinkerInfo.Load(reference.File); FileCompilation fc = new FileCompilation(info); LinkerTarget t = new LinkerTarget(fc, new object[0]); targets[reference] = t; } } } }
private LinkerResult ProcessOrdered( LinkerTarget root, Dictionary <FileReference, LinkerTarget> mapping, bool enableHide) { Stack <FileReference> todo = new Stack <FileReference>(mapping.Keys.Where(x => x.File != root.FileCompilation.Reference.File)); LinkerResult result = new LinkerResult( mapping.Values.ToArray(), new Dictionary <string, AddressItem>(), new Dictionary <string, AddressItem>(), new Dictionary <string, AddressItem>(), new List <AToken[]>(), new uint[0] ); PerformLinking(result, new List <LinkerTarget> { root }, enableHide); while (todo.Count != 0) { FileReference nextFile = todo.Pop(); LinkerTarget fileTarget = mapping[nextFile]; PerformLinking(result, new List <LinkerTarget> { fileTarget }, enableHide); } return(result); }
private Dictionary <FileReference, LinkerTarget> DiscoverCompilationTree(LinkerTarget root) { Dictionary <FileReference, LinkerTarget> allLinkerTargets = new Dictionary <FileReference, LinkerTarget>(); RecursiveDiscoverCompilationTree(root, allLinkerTargets); return(allLinkerTargets); }
public void Compile(string file) { FileCompilation fc = new FileCompilation(new FileReference(file)); LinkerTarget linkTarget = new LinkerTarget(fc, fc.Reference.LinkerArguments); LinkerResult linkResult = m_Linker.Link(linkTarget, this); LinkerResult = linkResult; ByteCode = m_AssemblyGenerator.Assemble(linkResult); LinkerInfo = CreateFromResult(linkResult); }
public override LinkerResult Link(LinkerTarget target, Compilation compilation) { if (target.FileCompilation.FileReferences.Count != 0) { EventManager <ErrorEvent> .SendEvent(new FileReferencesUnsupportedEvent()); } LinkerResult ret = new LinkerResult( new[] { target }, target.FileCompilation.Constants, target.FileCompilation.Labels, target.FileCompilation.DataSectionHeader, target.FileCompilation.Tokens.ToList(), target.FileCompilation.DataSection.ToArray() ); return(ret); }
public override LinkerResult Link(LinkerTarget target, Compilation compilation) { Dictionary <FileReference, LinkerTarget> tree = DiscoverCompilationTree(target); return(ProcessOrdered(target, tree, !SettingsManager.GetSettings <LinkerSettings>().NoHiddenItems)); }