public ResolveProcedure ( string moduleName, int ordinal, IPlatform platform ) : Reko.Core.ExternalProcedure | ||
moduleName | string | |
ordinal | int | |
platform | IPlatform | |
리턴 | Reko.Core.ExternalProcedure |
public void Impres_ProcedureByName() { var proj = new Project { MetadataFiles = { new MetadataFile { ModuleName = "foo", TypeLibrary = new TypeLibrary { ServicesByName = { { "bar@4", new SystemService { Name = "bar", Signature= new ProcedureSignature() } } } } } } }; var impres = new ImportResolver(proj); var ep = impres.ResolveProcedure("foo", "bar@4", new DefaultPlatform(services, arch)); Assert.AreEqual("bar", ep.Name); }
public void Impres_ProcedureByOrdinal() { var proj = new Project { MetadataFiles = { new MetadataFile { ModuleName = "foo" } }, Programs = { program } }; var module = new ModuleDescriptor("foo") { ServicesByVector = { { 9, new SystemService { Name = "bar", Signature = new ProcedureSignature() } } } }; mockFactory.Given_UserDefinedMetafile("foo", null, null, module); var impres = new ImportResolver(proj); var ep = impres.ResolveProcedure("foo", 9, platform); Assert.AreEqual("bar", ep.Name); }
public void Impres_ProcedureByName_NoModule() { var proj = new Project { MetadataFiles = { new MetadataFile { ModuleName = "foo" } }, Programs = { program } }; var sigs = new Dictionary<string, ProcedureSignature>(); sigs.Add( "bar", new ProcedureSignature( new Identifier( "res", PrimitiveType.Word16, new RegisterStorage("ax", 0, 0, PrimitiveType.Word16) ), new Identifier( "a", PrimitiveType.Word16, new RegisterStorage("cx", 0, 0, PrimitiveType.Word16) ), new Identifier( "b", PrimitiveType.Word16, new RegisterStorage("dx", 0, 0, PrimitiveType.Word16) ) ) ); mockFactory.Given_UserDefinedMetafile("foo", null, sigs, null); var impres = new ImportResolver(proj); var ep = impres.ResolveProcedure("foo", "bar", platform); Assert.AreEqual("bar", ep.Name); var sigExp = @"Register word16 ()(Register word16 a, Register word16 b) // stackDelta: 0; fpuStackDelta: 0; fpuMaxParam: -1 "; Assert.AreEqual(sigExp, ep.Signature.ToString()); }
public void Impres_ProcedureByOrdinal() { var proj = new Project { MetadataFiles = { new MetadataFile { ModuleName = "foo" } }, Programs = { program } }; var module = new ModuleDescriptor("foo") { ServicesByVector = { { 9, new SystemService { Name = "bar", Signature = new FunctionType() } } } }; program.EnvironmentMetadata.Modules.Add(module.ModuleName, module); var impres = new ImportResolver(proj, program, new FakeDecompilerEventListener()); var ep = impres.ResolveProcedure("foo", 9, platform); Assert.AreEqual("bar", ep.Name); }
public void Impres_ProcedureByName_NoModule() { var proj = new Project { MetadataFiles = { new MetadataFile { ModuleName = "foo" } }, Programs = { program } }; var barSig = new FunctionType( new Identifier( "res", PrimitiveType.Word16, new RegisterStorage("ax", 0, 0, PrimitiveType.Word16) ), new[] { new Identifier( "a", PrimitiveType.Word16, new RegisterStorage("cx", 0, 0, PrimitiveType.Word16) ), new Identifier( "b", PrimitiveType.Word16, new RegisterStorage("dx", 0, 0, PrimitiveType.Word16) ) } ); program.EnvironmentMetadata.Modules.Add("foo", new ModuleDescriptor("foo") { ServicesByName = { { "bar", new SystemService { Name = "bar", Signature = barSig } } } }); var impres = new ImportResolver(proj, program, new FakeDecompilerEventListener()); var ep = impres.ResolveProcedure("foo", "bar", platform); Assert.AreEqual("bar", ep.Name); var sigExp = @"Register word16 bar(Register word16 a, Register word16 b) // stackDelta: 0; fpuStackDelta: 0; fpuMaxParam: -1 "; Assert.AreEqual(sigExp, ep.Signature.ToString("bar", FunctionType.EmitFlags.AllDetails)); }