Author: coke
Date: Tue May  3 08:40:50 2005
New Revision: 7960

Modified:
   trunk/languages/tcl/lib/commands/eval.imc
   trunk/languages/tcl/lib/commands/if.imc
   trunk/languages/tcl/lib/commands/uplevel.imc
Log:
Add in support for PIR tailcall syntax



Modified: trunk/languages/tcl/lib/commands/eval.imc
==============================================================================
--- trunk/languages/tcl/lib/commands/eval.imc   (original)
+++ trunk/languages/tcl/lib/commands/eval.imc   Tue May  3 08:40:50 2005
@@ -42,8 +42,6 @@
   zero = new Integer
   zero = 0
   $P1 = parser."parse"(pmcString,zero,zero)
-  ($I0,$P0) = interpret($P1) 
 
-done:
-  .return($I0,$P0)
+  .return interpret($P1) #tailcall
 .end

Modified: trunk/languages/tcl/lib/commands/if.imc
==============================================================================
--- trunk/languages/tcl/lib/commands/if.imc     (original)
+++ trunk/languages/tcl/lib/commands/if.imc     Tue May  3 08:40:50 2005
@@ -68,9 +68,9 @@
   else = temp_str
 
   (return_type,retval) = expression_p(condition)
-  if return_type == TCL_ERROR goto done_final
+  if return_type == TCL_ERROR goto done_error
   (return_type,retval) = expression_i(retval)
-  if return_type == TCL_ERROR goto done_final
+  if return_type == TCL_ERROR goto done_error
 
   unless retval goto do_elseifs
   code = body 
@@ -85,9 +85,9 @@
   $P1 = elseifs[$I2]
   condition = $P1[0]
   (return_type,retval) = expression_p(condition)
-  if return_type == TCL_ERROR goto done_final
+  if return_type == TCL_ERROR goto done_error
   (return_type,retval) = expression_i(retval)
-  if return_type == TCL_ERROR goto done_final
+  if return_type == TCL_ERROR goto done_error
   if retval goto done_elseifs
   inc $I2
   goto elseif_loop  
@@ -107,8 +107,9 @@
   pmcString = code
  
   $P1 = parser."parse"(pmcString,zero,zero)
-  (return_type,retval) = interpret($P1)
 
-done_final:
+  .return interpret($P1) #tailcall
+
+done_error:
   .return(return_type,retval)
 .end

Modified: trunk/languages/tcl/lib/commands/uplevel.imc
==============================================================================
--- trunk/languages/tcl/lib/commands/uplevel.imc        (original)
+++ trunk/languages/tcl/lib/commands/uplevel.imc        Tue May  3 08:40:50 2005
@@ -60,5 +60,6 @@
   store_global "_Tcl", "call_level", old_call_level
 
 done:
-  .return($I0,$P0)
+  # XXX can't quite tailcall this at the moment due to the hackish call_level
+  .return($I0,$P0) 
 .end

Reply via email to