/// <summary> /// A better ToString() for Values. /// </summary> /// <param name="v"></param> /// <returns></returns> public static string Print(this Value v) { return(FScheme.print(v)); }
protected virtual void Run(List <dynNodeModel> topElements, FScheme.Expression runningExpression) { //Print some stuff if we're in debug mode if (DynamoViewModel.RunInDebug) { if (dynSettings.Controller.UIDispatcher != null) { foreach (string exp in topElements.Select(node => node.PrintExpression())) { DynamoLogger.Instance.Log("> " + exp); } } } try { DynamoLogger.Instance.Log("Evaluating the expression..."); //Evaluate the expression FScheme.Value expr = FSchemeEnvironment.Evaluate(runningExpression); if (dynSettings.Controller.UIDispatcher != null) { //Print some more stuff if we're in debug mode if (DynamoViewModel.RunInDebug && expr != null) { DynamoLogger.Instance.Log(FScheme.print(expr)); } } } catch (CancelEvaluationException ex) { /* Evaluation was cancelled */ OnRunCancelled(false); RunCancelled = false; if (ex.Force) { runAgain = false; } } catch (Exception ex) { /* Evaluation failed due to error */ if (dynSettings.Controller.UIDispatcher != null) { //Print unhandled exception if (ex.Message.Length > 0) { dynSettings.Controller.DispatchOnUIThread(() => DynamoLogger.Instance.Log(ex)); } } OnRunCancelled(true); RunCancelled = true; runAgain = false; //If we are testing, we need to throw an exception here //which will, in turn, throw an Assert.Fail in the //Evaluation thread. if (Testing) { throw new Exception(ex.Message); } } OnEvaluationCompleted(); }
/// <summary> /// A better ToString() for Values. /// </summary> /// <param name="v"></param> /// <returns></returns> public static string Print(this Value v) { return(v.IsString ? (v as Value.String).Item : FScheme.print(v)); }