using System;
using dnlib.DotNet;
using dnlib.DotNet.Emit;
namespace Confuser.Core.API {
///
/// The descriptor of a type of opaque predicate.
///
public interface IOpaquePredicateDescriptor {
///
/// Gets the type of the opaque predicate.
///
/// The type of the opaque predicate.
OpaquePredicateType Type { get; }
///
/// Gets the number of arguments this predicate has.
///
///
/// When is ,
/// there can be 0 or more arguments.
/// When is ,
/// there must be more than 0 arguments.
///
/// The number of arguments this predicate has.
int ArgumentCount { get; }
///
/// Determines whether this predicate can be used with the specified method.
///
/// The method.
/// true if this predicate can be used with the specified method; otherwise, false.
bool IsUsable(MethodDef method);
///
/// Creates a new opaque predicate for the specified method.
///
/// The method.
/// A newly create opaque predicate.
IOpaquePredicate CreatePredicate(MethodDef method);
}
///
/// An instance of opaque predicate.
///
public interface IOpaquePredicate {
///
/// Emits the runtime instruction sequence for this predicate.
///
///
/// A function that returns an instruction sequence that returns the input value,
/// or null if is 0.
///
/// An instruction sequence that returns the value of this predicate.
Instruction[] Emit(Func loadArg);
///
/// Computes the value of this predicate with the specified argument.
///
/// The argument to this predicate.
/// The return value of this predicate.
uint GetValue(uint[] arg);
}
///
/// The type of opaque predicate.
///
public enum OpaquePredicateType {
///
/// A function, in a mathematics sense, with one input and one output.
///
Function,
///
/// A constant function, always returning the same value.
///
Invariant
}
}