public Function Find(string functionName, string[] parameterTypes, bool[] constantInts)
 {
     return(functions.Find(a =>
     {
         if (a.name != functionName)
         {
             return false;
         }
         if (parameterTypes.Length == 0 &&
             a.parameters.Count == 1 && a.parameters[0].type.GetName() == "void")
         {
             return true;
         }
         if (a.parameters.Count != parameterTypes.Length)
         {
             return false;
         }
         for (int loop = 0; loop < a.parameters.Count; ++loop)
         {
             IParameterType fVar = ParameterType.GetParameterType(
                 parameterTypes[loop]);
             if (!a.parameters[loop].type.Equals(fVar) &&
                 !(
                     a.parameters[loop].type.GetName().StartsWith("int") &&
                     !a.parameters[loop].type.GetName().EndsWith("_ptr") &&
                     fVar.GetName().StartsWith("int") &&
                     !fVar.GetName().EndsWith("_ptr") &&
                     constantInts[loop]))
             {
                 return false;
             }
         }
         return true;
     }));
 }
 public Function Find(string functionName, params string[] parameterTypes)
 {
     return(functions.Find(a =>
     {
         if (a.name != functionName)
         {
             return false;
         }
         if (parameterTypes.Length == 0 &&
             a.parameters.Count == 1 && a.parameters[0].type.GetName() == "void")
         {
             return true;
         }
         if (a.parameters.Count != parameterTypes.Length)
         {
             return false;
         }
         for (int loop = 0; loop < a.parameters.Count; ++loop)
         {
             IParameterType fVar = ParameterType.GetParameterType(
                 parameterTypes[loop]);
             if (!a.parameters[loop].type.Equals(fVar) &&
                 !(
                     a.parameters[loop].type.GetName().StartsWith("int") &&
                     !a.parameters[loop].type.GetName().EndsWith("_ptr") &&
                     fVar.GetName().StartsWith("int") &&
                     !fVar.GetName().EndsWith("_ptr") /* &&
                                                       * fVariables.ElementAt(loop).address.length == -2*/))
             {
                 return false;
             }
         }
         return true;
     }));
 }
예제 #3
0
 public bool Equals(IParameterType other)
 {
     return(other is PT_Int16 &&
            GetLengthInBytes() == other.GetLengthInBytes() &&
            GetName() == other.GetName());
 }
        public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
        {
            IParameterType parameter = (IParameterType)value;

            writer.WriteValue(parameter.GetName());
        }