Example #1
0
    /// <summary>
    /// Verification of the generated code
    /// </summary>
    /// <param name="ns"></param>
    /// <remarks></remarks>

    private static void VerifyGeneratedStorage(BasicSymbolStorage ns)
    {
        NativeProcedure proc = null;

        VerifyTrue(ns.TryGetGlobalSymbol("SendMessageA", out proc));
        VerifyTrue(ns.TryGetGlobalSymbol("SendMessageW", out proc));
        VerifyTrue(ns.TryGetGlobalSymbol("GetForegroundWindow", out proc));
        VerifyTrue(ns.TryGetGlobalSymbol("CreateWellKnownSid", out proc));

        NativeTypeDef typedef = null;

        VerifyTrue(ns.TryGetGlobalSymbol("LPCSTR", out typedef));
        VerifyTrue(ns.TryGetGlobalSymbol("LPWSTR", out typedef));

        NativeType defined = null;

        VerifyTrue(ns.TryGetType("WNDPROC", out defined));
        VerifyTrue(ns.TryGetType("HOOKPROC", out defined));
        VerifyTrue(ns.TryGetType("tagPOINT", out defined));
        VerifyTrue(ns.TryGetType("_SYSTEM_INFO", out defined));

        NativeConstant c = null;

        VerifyTrue(ns.TryGetGlobalSymbol("WM_PAINT", out c));
        VerifyTrue(ns.TryGetGlobalSymbol("WM_LBUTTONDOWN", out c));
    }
Example #2
0
        public void SaveAndLoad4()
        {
            NativeTypeDef t1 = new NativeTypeDef("t1");

            t1.RealType = new NativeBuiltinType(BuiltinType.NativeByte);

            var ns = new BasicSymbolStorage();

            ns.AddTypeDef(t1);

            NativeType rett1 = null;

            Assert.True(ns.TryGetType(t1.Name, out rett1));
            Assert.True(NativeTypeEqualityComparer.AreEqualRecursive(rett1, t1));
        }
Example #3
0
        public void SaveAndLoad3()
        {
            NativeStruct s1 = new NativeStruct("s1");

            s1.Members.Add(new NativeMember("m1", new NativeNamedType("foo")));

            var ns = new BasicSymbolStorage();

            ns.AddDefinedType(s1);

            NativeType rets1 = null;

            Assert.True(ns.TryGetType(s1.Name, out rets1));
            Assert.True(NativeTypeEqualityComparer.AreEqualTopLevel(s1, rets1));
        }
Example #4
0
        public void LoadByName2()
        {
            NativeStruct s1 = new NativeStruct("s");

            s1.Members.Add(new NativeMember("m1", new NativeBuiltinType(BuiltinType.NativeInt32)));
            s1.Members.Add(new NativeMember("m2", new NativeBuiltinType(BuiltinType.NativeByte)));
            s1.Members.Add(new NativeMember("m3", new NativeBitVector(6)));
            s1.Members.Add(new NativeMember("m4", new NativePointer(new NativeBuiltinType(BuiltinType.NativeChar))));
            s1.Members.Add(new NativeMember("m5", new NativeArray(new NativeBuiltinType(BuiltinType.NativeFloat), 4)));
            s1.Members.Add(new NativeMember("m7", new NativeNamedType("bar", new NativeBuiltinType(BuiltinType.NativeDouble))));


            NativeType s2 = null;

            var ns = new BasicSymbolStorage();

            ns.AddDefinedType(s1);

            Assert.True(ns.TryGetType(s1.Name, out s2));
        }