コード例 #1
0
ファイル: ModuleDescriptor.cs プロジェクト: uxmal/reko
 public ModuleDescriptor(ModuleDescriptor other)
 {
     this.ModuleName = other.ModuleName;
     this.ServicesByName = new Dictionary<string, SystemService>(other.ServicesByName);
     this.ServicesByVector = new Dictionary<int, SystemService>(other.ServicesByVector);
     this.GlobalsByName = new Dictionary<string, DataType>();
     this.GlobalsByOrdinal = new Dictionary<int, DataType>();
 }
コード例 #2
0
        public void Impres_ProcedureByName()
        {
            var proj = new Project
            {
                MetadataFiles = 
                {
                    new MetadataFile
                    {
                         ModuleName = "foo"
                    }
                },
                Programs =
                {
                    program
                }
            };

            var module = new ModuleDescriptor("foo")
            {
                ServicesByName =
                {
                    {
                        "bar@4",
                         new SystemService
                         {
                            Name = "bar",
                            Signature = new ProcedureSignature()
                         }
                    }
                }
            };

            mockFactory.Given_UserDefinedMetafile("foo", null, null, module);

            var impres = new ImportResolver(proj);
            var ep = impres.ResolveProcedure("foo", "bar@4", platform);
            Assert.AreEqual("bar", ep.Name);
        }
コード例 #3
0
ファイル: ImportResolverTests.cs プロジェクト: uxmal/reko
        public void Impres_ProcedureByName()
        {
            var proj = new Project
            {
                MetadataFiles = 
                {
                    new MetadataFile
                    {
                         ModuleName = "foo"
                    }
                },
                Programs =
                {
                    program
                }
            };

            var module = new ModuleDescriptor("foo")
            {
                ServicesByName =
                {
                    {
                        "bar@4",
                         new SystemService
                         {
                            Name = "bar",
                            Signature = new FunctionType()
                         }
                    }
                }
            };
            program.EnvironmentMetadata.Modules.Add("foo", module);

            var impres = new ImportResolver(proj, program, new FakeDecompilerEventListener());
            var ep = impres.ResolveProcedure("foo", "bar@4", platform);
            Assert.AreEqual("bar", ep.Name);
        }
コード例 #4
0
 public ModuleDescriptor(ModuleDescriptor other)
 {
     this.ModuleName       = other.ModuleName;
     this.ServicesByName   = new Dictionary <string, SystemService>(other.ServicesByName);
     this.ServicesByVector = new Dictionary <int, SystemService>(other.ServicesByVector);
 }
コード例 #5
0
ファイル: MockFactory.cs プロジェクト: gitter-badger/reko
        public void Given_UserDefinedMetafile(
            string moduleName, Dictionary<string, DataType> types,
            Dictionary<string, ProcedureSignature> signatures,
            ModuleDescriptor module)
        {
            if (types == null)
                types = new Dictionary<string, DataType>();
            if (signatures == null)
                signatures = new Dictionary<string, ProcedureSignature>();
            var loaderMetadata = new TypeLibrary(types, signatures);
            if (module != null)
                loaderMetadata.Modules.Add(moduleName, module);

            var loader = CreateLoader();

            var metafileName = moduleName+".xml";

            CreateLoadMetadataStub(metafileName, platform, loaderMetadata);

            foreach(var program in programs)
            {
                program.LoadMetadataFile(loader, metafileName);
            }
        }
コード例 #6
0
 public ModuleDescriptor(ModuleDescriptor other)
 {
     this.ModuleName = other.ModuleName;
     this.ServicesByName = new Dictionary<string, SystemService>(other.ServicesByName);
     this.ServicesByVector = new Dictionary<int, SystemService>(other.ServicesByVector);
 }
コード例 #7
0
ファイル: ImportResolverTests.cs プロジェクト: uxmal/reko
        public void Impres_GlobalByName()
        {
            var proj = new Project
            {
                MetadataFiles =
                {
                    new MetadataFile
                    {
                         ModuleName = "foo"
                    }
                },
                Programs =
                {
                    program
                }
            };

            var module = new ModuleDescriptor("foo")
            {
                GlobalsByName =
                {
                    {
                         "bar",
                         new StructureType
                         {
                             Fields =
                             {
                                 { 0, new Pointer(PrimitiveType.Char, 4), "name" },
                                 { 4, PrimitiveType.Int32, "age" }
                             }
                         }
                    }
                }
            };
            program.EnvironmentMetadata.Modules.Add(module.ModuleName, module);

            var impres = new ImportResolver(proj, program, new FakeDecompilerEventListener());
            var dt = impres.ResolveGlobal("foo", "bar", platform);
            Assert.AreEqual("bar", dt.ToString());
        }