Esempio n. 1
0
 /// <summary>
 /// Arc-cosine; the result is in the range 0 to + π.
 /// </summary>
 /// <param name="em">Emitter object</param>
 public static void ACOS(Emitter em)
 {
     if (em == null) {
         throw new ArgumentNullException("em");
     }
     em.Emit0(OpCodes.Call, typeof(Math).GetMethod("Acos", new [] { typeof(double) }));
 }
Esempio n. 2
0
 /// <summary>
 /// Converts to integer by truncation.
 /// </summary>
 /// <param name="em">Emitter object</param>
 /// <param name="typeWanted">The type of the argument</param>
 public static void AINT(Emitter em, Type typeWanted)
 {
     if (em == null) {
         throw new ArgumentNullException("em");
     }
     em.Emit0(OpCodes.Conv_I4);
     em.ConvertSystemType(typeWanted);
 }
Esempio n. 3
0
 /// <summary>
 /// Returns the absolute of the given value.
 /// </summary>
 /// <param name="em">Emitter object</param>
 /// <param name="typeWanted">The type of the argument</param>
 public static void ABS(Emitter em, Type typeWanted)
 {
     if (em == null) {
         throw new ArgumentNullException("em");
     }
     if (typeWanted == typeof(Complex)) {
         em.Emit0(OpCodes.Call, typeof(Complex).GetMethod("Abs", new [] { typeWanted }));
     } else {
         em.Emit0(OpCodes.Call, typeof(Math).GetMethod("Abs", new [] { typeWanted }));
     }
 }
Esempio n. 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CCompiler.Temporaries"/> class
 /// using the given emitter.
 /// </summary>
 /// <param name="em">A code generator Emitter</param>
 public Temporaries(Emitter em)
 {
     _em = em;
     _locals = new Collection<LocalDescriptor>();
 }
Esempio n. 5
0
 /// <summary>
 /// Emit inline code for SNGL function.
 /// </summary>
 /// <param name="em">Emitter object</param>
 public static void SNGL(Emitter em)
 {
     if (em == null) {
         throw new ArgumentNullException("em");
     }
     em.Emit0(OpCodes.Conv_R4);
 }
Esempio n. 6
0
 /// <summary>
 /// Emit inline code for REAL function.
 /// </summary>
 /// <param name="em">Emitter object</param>
 /// <param name="typeWanted">The type of the argument</param>
 public static void REAL(Emitter em, Type typeWanted)
 {
     if (em == null) {
         throw new ArgumentNullException("em");
     }
     if (typeWanted == typeof(Complex)) {
         em.Emit0(OpCodes.Call, typeof(JComLib.Intrinsics).GetMethod("REAL", new [] { typeof(Complex) }));
     } else {
         em.Emit0(OpCodes.Conv_R4);
     }
 }
Esempio n. 7
0
 /// <summary>
 /// Inline generator for MOD function.
 /// </summary>
 /// <param name="em">Emitter object</param>
 public static void MOD(Emitter em)
 {
     if (em == null) {
         throw new ArgumentNullException("em");
     }
     em.Emit0(OpCodes.Rem);
 }
Esempio n. 8
0
 /// <summary>
 /// Returns length of the character argument.
 /// </summary>
 /// <param name="em">Emitter object</param>
 /// <param name="typeWanted">The type of the argument</param>
 public static void LEN(Emitter em, Type typeWanted)
 {
     if (em == null) {
         throw new ArgumentNullException("em");
     }
     if (typeWanted == null) {
         throw new ArgumentNullException("typeWanted");
     }
     em.Emit0(OpCodes.Call, typeWanted.GetMethod("get_Length"));
 }
Esempio n. 9
0
 /// <summary>
 /// Returns position of first character of the string in the local character code table.
 /// </summary>
 /// <param name="em">Emitter object</param>
 /// <param name="typeWanted">The type of the argument</param>
 public static void ICHAR(Emitter em, Type typeWanted)
 {
     if (em == null) {
         throw new ArgumentNullException("em");
     }
     if (typeWanted == null) {
         throw new ArgumentNullException("typeWanted");
     }
     em.LoadInteger(0);
     em.Emit0(OpCodes.Call, typeWanted.GetMethod("get_Chars", new [] { typeof(int) }));
 }
Esempio n. 10
0
 /// <summary>
 /// SQRT intrinsic function
 /// Returns the square root of the given value.
 /// </summary>
 /// <param name="em">Emitter object</param>
 public static void CSQRT(Emitter em)
 {
     if (em == null) {
         throw new ArgumentNullException("em");
     }
     em.Emit0(OpCodes.Call, typeof(Complex).GetMethod("Sqrt", new [] { typeof(Complex) }));
 }
Esempio n. 11
0
 /// <summary>
 /// Convert the specified value to a complex value.
 /// </summary>
 /// <param name="em">Emitter object</param>
 public static void CMPLX(Emitter em)
 {
     if (em == null) {
         throw new ArgumentNullException("em");
     }
     em.Emit0(OpCodes.Newobj, typeof(Complex).GetConstructor(new [] { typeof(double), typeof(double) } ));
 }
Esempio n. 12
0
 /// <summary>
 /// Returns Nth character in local character code table.
 /// </summary>
 /// <param name="em">Emitter object</param>
 public static void CHAR(Emitter em)
 {
     if (em == null) {
         throw new ArgumentNullException("em");
     }
     em.Emit0(OpCodes.Conv_U2);
     em.CreateObject(typeof(JComLib.FixedString), new [] { typeof(char) });
 }