public extern var this[var propertyName] { [XaeiOSMethodImpl(MethodImplOptions.Inline, Implementation = "{this}[{0}]")] get; [XaeiOSMethodImpl(MethodImplOptions.Inline, Implementation = "{this}[{0}] = {1}")] set; }
static void Main() { var a; a = new var(); a.Field = 1234; Console.WriteLine(a.Field); }
public static int Main () { var i = null; var v = new var (); if (v.GetType () != typeof (var)) return 1; return 0; }
public var this[var propertyName] { get { return _internalDictionary[propertyName]; } set { _internalDictionary[propertyName] = value; } }
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; }
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); } }
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); */ } }
public static extern void ClearTimeout(var timeoutId);
public static extern void ClearInterval(var intervalId);
public static extern NativeFunction GenerateCodeForBoundNativeFunction(NativeFunction fn, var self, var[] args);
public static extern NativeFunction GenerateCodeForBoundNativeFunctionSimple(NativeFunction fn, var self);
public extern var Apply(var target, var[] args);
public extern var Call(var target, params var[] args);
static (bool success, int value) Parse(string s) => int.TryParse(s, out var x) ? (true, x) : (false, 0);
public void Cancel() { Logging.Trace("Unblocker::Cancel()"); Global.ClearTimeout(TimeoutId); TimeoutId = null; Task = null; }
public extern void RemoveKey(var key);
public void ScheduleUnblock(int timeoutMs) { TimeoutId = Global.SetTimeout((NativeFunction)new NativeVoidDelegate(Unblock), timeoutMs); }
private void InternalSleep(int milliseconds) { CancelUnblock(); SystemCalls.BlockTask(Task); _unblockTimeoutId = Global.SetTimeout((NativeFunction)new NativeVoidDelegate(WakeUp), milliseconds); SystemCalls.Yield(); }
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));