示例#1
0
        /// <summary>
        /// Registers the specified type to RTTI map.
        /// </summary>
        /// <param name="intType">The interface type.</param>
        /// <param name="implType">The implementation type.</param>
        /// <param name="address">The addresses.</param>
        /// <param name="moduleBase">Current module base address.</param>
        internal static void Register(Type intType, Type implType, uint[] address, IntPtr moduleBase)
        {
            if (intType == null)
            {
                throw new ArgumentNullException("intType");
            }
            if (implType == null)
            {
                throw new ArgumentNullException("implType");
            }
            if (address == null)
            {
                throw new ArgumentNullException("address");
            }
            if (moduleBase == null)
            {
                throw new ArgumentNullException("moduleBase");
            }

            if (MapInterface.ContainsKey(intType))
            {
                throw new InvalidOperationException("RTTI for \"" + intType.Name + "\" already exists!");
            }
            if (MapImplementation.ContainsKey(implType))
            {
                throw new InvalidOperationException("RTTI for \"" + implType.Name + "\" already exists!");
            }

            address = address.ToArray();

            MapInterface[intType]       = new Tuple <Type, uint[], IntPtr>(implType, address, moduleBase);
            MapImplementation[implType] = new Tuple <Type, uint[], IntPtr>(intType, address, moduleBase);
        }
示例#2
0
 public int eval(MapInterface <String, int> tbl, HeapInterface <int> heap)
 {
     if (tbl.ContainsKey(id))
     {
         return(tbl [id]);
     }
     throw new UninitializedVariableException();
 }
示例#3
0
 public int eval(MapInterface<String, int> tbl, HeapInterface<int> heap)
 {
     if (tbl.ContainsKey (id))
         return tbl [id];
     throw new UninitializedVariableException ();
 }