Пример #1
0
 public extern var this[var propertyName]
 {
     [XaeiOSMethodImpl(MethodImplOptions.Inline, Implementation = "{this}[{0}]")]
     get;
     [XaeiOSMethodImpl(MethodImplOptions.Inline, Implementation = "{this}[{0}] = {1}")]
     set;
 }
Пример #2
0
    static void Main()
    {
        var a;
        a = new var();
        a.Field = 1234;

        Console.WriteLine(a.Field);
    }
Пример #3
0
	public static int Main ()
	{
		var i = null;
		var v = new var ();
		
		if (v.GetType () != typeof (var))
			return 1;
		
		return 0;	
	}
Пример #4
0
 public var this[var propertyName]
 {
     get
     {
         return _internalDictionary[propertyName];
     }
     set
     {
         _internalDictionary[propertyName] = value;
     }
 }
Пример #5
0
 public Boolean IsUsuario(var nombre, var clave)
 {
     Boolean isEncontrado = false;
     for(int i = 0; i < nombres.Length; i++)
     {
         if(nombres[i] == nombre && claves[i] == clave)
         {
             isEncontrado = true;
         }
         else
         {
             isEncontrado = false;
         }
     }
     return isEncontrado;
 }
Пример #6
0
        private static void BootCallback(TaskHandle taskId, string taskName, var returnValue, TaskExitStatus exitStatus)
        {
            if (!_booted)
            {
                string reason = "reason unknown";
                if (exitStatus == TaskExitStatus.UnhandledException)
                {
                    if (returnValue != null)
                    {
                        Exception exception = returnValue.Cast<Exception>();
                        reason = exception.ToString() + "\n " + exception.StackTrace;

                    }
                }
                throw new NativeError("XaeiOS.Boot process failed to boot: " + reason);
            }
        }
Пример #7
0
 public NativeFunction Bind(var self)
 {
     NativeFunction fn = GenerateCodeForThis();
     if (GetArguments().Length == 1) // optimization for delegate create
     {
         return GenerateCodeForBoundNativeFunctionSimple(fn, self);
     }
     else
     {
         throw new NativeError("Not yet implemented");
         /* // TODO: This code causes a bug in CopyPropagation for BasicMiddleEnd: Array out of bounds for a Set
         NativeArray args = new NativeArray();
         for (int i = 0; i < GetArguments().Length; i++)
         {
             args[i] = GetArguments()[i];
         }
         var self = args.Shift();
         return GenerateCodeForBoundNativeFunction(fn, self, args);
          */
     }
 }
Пример #8
0
 public static extern void ClearTimeout(var timeoutId);
Пример #9
0
 public static extern void ClearInterval(var intervalId);
Пример #10
0
 public static extern NativeFunction GenerateCodeForBoundNativeFunction(NativeFunction fn, var self, var[] args);
Пример #11
0
 public static extern NativeFunction GenerateCodeForBoundNativeFunctionSimple(NativeFunction fn, var self);
Пример #12
0
 public extern var Apply(var target, var[] args);
Пример #13
0
 public extern var Call(var target, params var[] args);
Пример #14
0
 static (bool success, int value) Parse(string s) => int.TryParse(s, out var x) ? (true, x) : (false, 0);
Пример #15
0
 public void Cancel()
 {
     Logging.Trace("Unblocker::Cancel()");
     Global.ClearTimeout(TimeoutId);
     TimeoutId = null;
     Task = null;
 }
Пример #16
0
 public extern void RemoveKey(var key);
Пример #17
0
 public void ScheduleUnblock(int timeoutMs)
 {
     TimeoutId = Global.SetTimeout((NativeFunction)new NativeVoidDelegate(Unblock), timeoutMs);
 }
Пример #18
0
 private void InternalSleep(int milliseconds)
 {
     CancelUnblock();
     SystemCalls.BlockTask(Task);
     _unblockTimeoutId = Global.SetTimeout((NativeFunction)new NativeVoidDelegate(WakeUp), milliseconds);
     SystemCalls.Yield();
 }
Пример #19
0
        private void InternalCallback(TaskHandle task, string taskName, var returnValue, TaskExitStatus exitStatus)
        {
            //Logging.Trace("Thread internal callback: " + this + ":" + this.Name);
            _running = false;
            //Logging.Trace("Unregistering thread: " + this + ":" + this.Name);
            ThreadManager.UnregisterThread(this);

            if (exitStatus == TaskExitStatus.UnhandledException)
            {
                _unhandledException = returnValue.Cast<Object>() as Exception;
            }
            else if (exitStatus == TaskExitStatus.CriticalError)
            {
                _unhandledException = new ExecutionEngineException(returnValue.NativeToString());
            }

            if (Callback != null)
            {
                // TODO: Use the SIP thread pool to run this callback
                Callback();
            }
            else
            {
                if (_unhandledException != null)
                {
                    Console.WriteLine("An unhandled exception occurred in thread: " + this + ": " + _unhandledException + "\n" + _unhandledException.StackTrace);
                }
            }
        }
		private static string getHandProximity(var handPos, double threshold)	// Returns the hand distance in relation to the three instruments and returns the closest instrument
																					// If the instrument are outside the threshold, returns "far"																				
		{
			float[] handDistance = new float[3];				// Array of hand distance to each instrument
				
			for (int j = 0; j < 3; j++)
			{
				float handDistance[j] = (float)Math.Sqrt(Math.Pow(handPos.X - instrumentXYZ[j].X, 2) + Math.Pow(handPos.Y - instrumentXYZ[j].Y, 2) + Math.Pow(handPos.Z - instrumentXYZ[j].Z, 2));