diff --git a/impls/vbs/step3_env.vbs b/impls/vbs/step3_env.vbs index 8ff0aeb374..5134e72f3f 100644 --- a/impls/vbs/step3_env.vbs +++ b/impls/vbs/step3_env.vbs @@ -129,11 +129,34 @@ Function Read(strCode) Set Read = ReadString(strCode) End Function +Sub DebugEval(objCode, objEnv) + Dim value, bool + Set value = objEnv.Get("DEBUG-EVAL") + If TypeName(value) = "Nothing" Then + bool = False + Else + Select Case value.Type + Case TYPES.NIL + bool = False + Case TYPES.BOOLEAN + bool = value.Value + Case Else + bool = True + End Select + End If + If bool Then + IO.WriteLine "EVAL: " + Print(objCode) + End If +End Sub + Function Evaluate(objCode, objEnv) If TypeName(objCode) = "Nothing" Then Set Evaluate = Nothing Exit Function End If + + DebugEval objCode, objEnv + Dim varRet, objFirst If objCode.Type = TYPES.LIST Then If objCode.Count = 0 Then ' () diff --git a/impls/vbs/step4_if_fn_do.vbs b/impls/vbs/step4_if_fn_do.vbs index 37d364063a..6b3cccd3f9 100644 --- a/impls/vbs/step4_if_fn_do.vbs +++ b/impls/vbs/step4_if_fn_do.vbs @@ -143,11 +143,34 @@ Function Read(strCode) Set Read = ReadString(strCode) End Function +Sub DebugEval(objCode, objEnv) + Dim value, bool + Set value = objEnv.Get("DEBUG-EVAL") + If TypeName(value) = "Nothing" Then + bool = False + Else + Select Case value.Type + Case TYPES.NIL + bool = False + Case TYPES.BOOLEAN + bool = value.Value + Case Else + bool = True + End Select + End If + If bool Then + IO.WriteLine "EVAL: " + Print(objCode) + End If +End Sub + Function Evaluate(objCode, objEnv) If TypeName(objCode) = "Nothing" Then Set Evaluate = Nothing Exit Function End If + + DebugEval objCode, objEnv + Dim varRet, objFirst If objCode.Type = TYPES.LIST Then If objCode.Count = 0 Then ' () diff --git a/impls/vbs/step5_tco.vbs b/impls/vbs/step5_tco.vbs index 1b23cadb8e..17d3449c29 100644 --- a/impls/vbs/step5_tco.vbs +++ b/impls/vbs/step5_tco.vbs @@ -152,6 +152,26 @@ Function Read(strCode) Set Read = ReadString(strCode) End Function +Sub DebugEval(objCode, objEnv) + Dim value, bool + Set value = objEnv.Get("DEBUG-EVAL") + If TypeName(value) = "Nothing" Then + bool = False + Else + Select Case value.Type + Case TYPES.NIL + bool = False + Case TYPES.BOOLEAN + bool = value.Value + Case Else + bool = True + End Select + End If + If bool Then + IO.WriteLine "EVAL: " + Print(objCode) + End If +End Sub + Function Evaluate(ByVal objCode, ByVal objEnv) While True If TypeName(objCode) = "Nothing" Then @@ -159,6 +179,8 @@ Function Evaluate(ByVal objCode, ByVal objEnv) Exit Function End If + DebugEval objCode, objEnv + Dim varRet, objFirst If objCode.Type = TYPES.LIST Then If objCode.Count = 0 Then ' () diff --git a/impls/vbs/step6_file.vbs b/impls/vbs/step6_file.vbs index 3bb1bdeeb5..02d58b5869 100644 --- a/impls/vbs/step6_file.vbs +++ b/impls/vbs/step6_file.vbs @@ -180,6 +180,26 @@ Function Read(strCode) Set Read = ReadString(strCode) End Function +Sub DebugEval(objCode, objEnv) + Dim value, bool + Set value = objEnv.Get("DEBUG-EVAL") + If TypeName(value) = "Nothing" Then + bool = False + Else + Select Case value.Type + Case TYPES.NIL + bool = False + Case TYPES.BOOLEAN + bool = value.Value + Case Else + bool = True + End Select + End If + If bool Then + IO.WriteLine "EVAL: " + Print(objCode) + End If +End Sub + Function Evaluate(ByVal objCode, ByVal objEnv) While True If TypeName(objCode) = "Nothing" Then @@ -187,6 +207,8 @@ Function Evaluate(ByVal objCode, ByVal objEnv) Exit Function End If + DebugEval objCode, objEnv + Dim varRet, objFirst If objCode.Type = TYPES.LIST Then If objCode.Count = 0 Then ' () diff --git a/impls/vbs/step7_quote.vbs b/impls/vbs/step7_quote.vbs index 5673f4a9ef..fd8aa9ebc9 100644 --- a/impls/vbs/step7_quote.vbs +++ b/impls/vbs/step7_quote.vbs @@ -303,6 +303,26 @@ Function Read(strCode) Set Read = ReadString(strCode) End Function +Sub DebugEval(objCode, objEnv) + Dim value, bool + Set value = objEnv.Get("DEBUG-EVAL") + If TypeName(value) = "Nothing" Then + bool = False + Else + Select Case value.Type + Case TYPES.NIL + bool = False + Case TYPES.BOOLEAN + bool = value.Value + Case Else + bool = True + End Select + End If + If bool Then + IO.WriteLine "EVAL: " + Print(objCode) + End If +End Sub + Function Evaluate(ByVal objCode, ByVal objEnv) While True If TypeName(objCode) = "Nothing" Then @@ -310,6 +330,8 @@ Function Evaluate(ByVal objCode, ByVal objEnv) Exit Function End If + DebugEval objCode, objEnv + Dim varRet, objFirst If objCode.Type = TYPES.LIST Then If objCode.Count = 0 Then ' () diff --git a/impls/vbs/step8_macros.vbs b/impls/vbs/step8_macros.vbs index 723f9a5b40..70f3bf755f 100644 --- a/impls/vbs/step8_macros.vbs +++ b/impls/vbs/step8_macros.vbs @@ -316,6 +316,26 @@ Function Read(strCode) Set Read = ReadString(strCode) End Function +Sub DebugEval(objCode, objEnv) + Dim value, bool + Set value = objEnv.Get("DEBUG-EVAL") + If TypeName(value) = "Nothing" Then + bool = False + Else + Select Case value.Type + Case TYPES.NIL + bool = False + Case TYPES.BOOLEAN + bool = value.Value + Case Else + bool = True + End Select + End If + If bool Then + IO.WriteLine "EVAL: " + Print(objCode) + End If +End Sub + Function Evaluate(ByVal objCode, ByVal objEnv) While True If TypeName(objCode) = "Nothing" Then @@ -323,6 +343,8 @@ Function Evaluate(ByVal objCode, ByVal objEnv) Exit Function End If + DebugEval objCode, objEnv + Dim varRet, objFirst If objCode.Type = TYPES.LIST Then If objCode.Count = 0 Then ' () diff --git a/impls/vbs/step9_try.vbs b/impls/vbs/step9_try.vbs index 407cfee0e3..e346c3eea3 100644 --- a/impls/vbs/step9_try.vbs +++ b/impls/vbs/step9_try.vbs @@ -382,6 +382,26 @@ Function Read(strCode) Set Read = ReadString(strCode) End Function +Sub DebugEval(objCode, objEnv) + Dim value, bool + Set value = objEnv.Get("DEBUG-EVAL") + If TypeName(value) = "Nothing" Then + bool = False + Else + Select Case value.Type + Case TYPES.NIL + bool = False + Case TYPES.BOOLEAN + bool = value.Value + Case Else + bool = True + End Select + End If + If bool Then + IO.WriteLine "EVAL: " + Print(objCode) + End If +End Sub + Function Evaluate(ByVal objCode, ByVal objEnv) While True If TypeName(objCode) = "Nothing" Then @@ -389,6 +409,8 @@ Function Evaluate(ByVal objCode, ByVal objEnv) Exit Function End If + DebugEval objCode, objEnv + Dim varRet, objFirst If objCode.Type = TYPES.LIST Then If objCode.Count = 0 Then ' () diff --git a/impls/vbs/stepA_mal.vbs b/impls/vbs/stepA_mal.vbs index 04b9626b49..0b93de67ad 100644 --- a/impls/vbs/stepA_mal.vbs +++ b/impls/vbs/stepA_mal.vbs @@ -383,6 +383,26 @@ Function Read(strCode) Set Read = ReadString(strCode) End Function +Sub DebugEval(objCode, objEnv) + Dim value, bool + Set value = objEnv.Get("DEBUG-EVAL") + If TypeName(value) = "Nothing" Then + bool = False + Else + Select Case value.Type + Case TYPES.NIL + bool = False + Case TYPES.BOOLEAN + bool = value.Value + Case Else + bool = True + End Select + End If + If bool Then + IO.WriteLine "EVAL: " + Print(objCode) + End If +End Sub + Function Evaluate(ByVal objCode, ByVal objEnv) While True If TypeName(objCode) = "Nothing" Then @@ -390,6 +410,8 @@ Function Evaluate(ByVal objCode, ByVal objEnv) Exit Function End If + DebugEval objCode, objEnv + Dim varRet, objFirst If objCode.Type = TYPES.LIST Then If objCode.Count = 0 Then ' ()