Index: .cvsignore
===================================================================
RCS file: /cvs/public/parrot/languages/tcl/.cvsignore,v
retrieving revision 1.2
diff -u -u -r1.2 .cvsignore
--- .cvsignore	17 Feb 2004 09:38:01 -0000	1.2
+++ .cvsignore	14 Mar 2004 14:14:52 -0000
@@ -1,2 +1,3 @@
+tcl.pbc
 tcl.imc
 Makefile
Index: tcl.pl
===================================================================
RCS file: /cvs/public/parrot/languages/tcl/tcl.pl,v
retrieving revision 1.2
diff -u -u -r1.2 tcl.pl
--- tcl.pl	27 Feb 2004 13:13:55 -0000	1.2
+++ tcl.pl	14 Mar 2004 14:14:53 -0000
@@ -29,15 +29,16 @@
 #
 # Read in the contents of a file and parse it.
 
-.pcc_sub _main prototyped
-  .param var argv
+.sub _main 
+  .param PerlArray argv
 
+  .local string program_name
   .local string filename
   .local string mode
   .local string chunk
   .local string contents
-  .local PerlHash commands
-  .local sub command_sub
+  .local pmc    commands
+  .local pmc    command_sub
   .local int argc
 
   # If no file was specified, read from stdin.
@@ -47,7 +48,8 @@
   goto loop 
 
 open_file: 
-  filename = argv[1]
+  shift program_name, argv
+  shift filename, argv
 
   $S1="<"  
   open $P1, filename, $S1
@@ -87,12 +89,7 @@
 
   global "commands" = commands
 
-  .arg contents
-  saveall
-  call __parse
-  restoreall
-  .result $S0
-  #print $S0
+  $S0 = __parse( contents )
 
   # don't fall off the end of main, it's rude.
   end 
Index: lib/backslash_newline_subst.imc
===================================================================
RCS file: /cvs/public/parrot/languages/tcl/lib/backslash_newline_subst.imc,v
retrieving revision 1.1
diff -u -u -r1.1 backslash_newline_subst.imc
--- lib/backslash_newline_subst.imc	4 Oct 2003 16:01:03 -0000	1.1
+++ lib/backslash_newline_subst.imc	14 Mar 2004 14:14:53 -0000
@@ -46,6 +46,7 @@
 
   ord a_byte, buffer, pos
 
+
   .is_space(a_byte,retval)
  
   if retval == 1 goto loop_inner
@@ -57,8 +58,7 @@
   goto loop_outer
 
 my_end:
-
-  .return buffer
-  ret
-
+  .pcc_begin_return
+    .return buffer
+  .pcc_end_return
 .end
Index: lib/backslash_subst.imc
===================================================================
RCS file: /cvs/public/parrot/languages/tcl/lib/backslash_subst.imc,v
retrieving revision 1.1
diff -u -u -r1.1 backslash_subst.imc
--- lib/backslash_subst.imc	4 Oct 2003 16:01:03 -0000	1.1
+++ lib/backslash_subst.imc	14 Mar 2004 14:14:53 -0000
@@ -97,7 +97,8 @@
   goto loop_outer
 
 my_end:
-  .return buffer
-  ret
+  .pcc_begin_return
+    .return buffer
+  .pcc_end_return
 
 .end
Index: lib/match_close.imc
===================================================================
RCS file: /cvs/public/parrot/languages/tcl/lib/match_close.imc,v
retrieving revision 1.1
diff -u -u -r1.1 match_close.imc
--- lib/match_close.imc	4 Oct 2003 16:01:03 -0000	1.1
+++ lib/match_close.imc	14 Mar 2004 14:14:53 -0000
@@ -11,7 +11,7 @@
   .param string buffer
 
   .local int debug
-  debug=0
+  debug = 0
   .include "lib/macros/debug.imc"
 
   .local int opener
@@ -120,16 +120,21 @@
   $I1 = position - start_pos
   # off by two?
   inc $I1
-  .return $I1
-  ret
+  goto match_close_end
 
 die1:
   .debug("match_close:die1\n")
-  .return -1
-  ret
+  $I1 = -1
+  goto match_close_end
 
 die2:
   .debug("match_close:die2\n")
-  .return -2
-  ret
+  $I1 = -2
+  goto match_close_end
+
+match_close_end:
+  .pcc_begin_return
+    .return $I1
+  .pcc_end_return
+
 .end
Index: lib/parse.imc
===================================================================
RCS file: /cvs/public/parrot/languages/tcl/lib/parse.imc,v
retrieving revision 1.1
diff -u -u -r1.1 parse.imc
--- lib/parse.imc	4 Oct 2003 16:01:03 -0000	1.1
+++ lib/parse.imc	14 Mar 2004 14:14:54 -0000
@@ -35,34 +35,26 @@
   .local int end_of_word
 
   # An array of commands, the current command
-  .local PerlArray commands
+  .local pmc commands
   commands = new PerlArray
-  .local PerlArray command
+  .local pmc command
 
   # our running return value
   # XXX really need to support more than a string
   .local string retval
   retval = ""
 
-  # Various places we need to jump to/return from
-  .local Sub func_variable_subst
-  newsub func_variable_subst, .Sub, __var_subst
-
-  # Define any macros we use.
-  .include "lib/macros/is_space.imc"
-  .include "lib/macros/debug.imc"
-  .include "lib/macros/substitution.imc"
-
   # XXX: This would probably be a good point to create a lexical scope
   # to store variables in.
 
   .debug("Backslash newline substitution\n")
 
-  .arg buffer
-  saveall
-  call __backslash_newline_subst
-  restoreall
-  .result buffer
+  buffer = __backslash_newline_subst( buffer )
+
+  # Define any macros we use.
+  .include "lib/macros/is_space.imc"
+  .include "lib/macros/debug.imc"
+  .include "lib/macros/substitution.imc"
 
 BEGIN_COMMAND:
   .debug("BEGIN COMMAND:\n")
@@ -229,12 +221,7 @@
   # This handles both { and " style blocks.
 
   .debug("block_begin:\n")
-  .arg buffer
-  .arg start_word
-  saveall
-  call __match_close
-  restoreall
-  .result word_length
+  word_length =  __match_close( start_word, buffer )
   .debug("word_length = ")
   .debug(word_length)
   .debug("\n")
@@ -252,7 +239,7 @@
 
   shift command, commands
 
-  .local PerlArray cooked_command
+  .local pmc cooked_command
   cooked_command = new PerlArray
 
 cooking:
@@ -311,12 +298,7 @@
   index $I2, $S0, "["
   if $I2 == -1 goto command_subst_loop
 
-  .arg $S0
-  .arg $I2
-  saveall
-  call __match_close
-  restoreall
-  .result $I3
+  $I3 =  __match_close( $I2, $S0 )
 
   # Ok. we know the [] goes from $I2 to $I3. now, get the output of
   # That parse, and use it to replace...
@@ -333,11 +315,7 @@
 
   $S2 = ""
 
-  .arg $S1
-  saveall
-  call __parse
-  restoreall
-  .result $S2
+  $S2 = __parse( $S1 )
 
   .debug("gives output of \"")
   .debug($S2)
@@ -369,14 +347,7 @@
   if $I0 == 1 goto backslash_subst 
   $S1 = string_array[current_pointer]
 
-  .pcc_begin prototyped
-  .arg $S1
-  .pcc_call func_variable_subst
-  sillyrequiredret1:
-  .result $S1
-  .result $I1
-  .result $I2
-  .pcc_end
+  ( $S1, $I1, $I2 ) =  __var_subst( $S1 )
 
   #print "String is "
   #print $S1
@@ -409,11 +380,7 @@
   .substitution_iter_next($I0)
   if $I0 == 1 goto reintegrate
   $S1 = string_array[current_pointer]
-  .arg $S1
-  saveall
-  call __backslash_subst
-  restoreall
-  .result $S1
+  ( $S1 ) = __backslash_subst( $S1 )
   string_array[current_pointer] = $S1 
   goto backslash_subst_loop
 
@@ -451,10 +418,10 @@
   if $S1 == "PerlUndef" goto no_command
 
   .pcc_begin prototyped
-  .arg cooked_command
+    .arg cooked_command
   .pcc_call $P1
-  shouldntneedtodothis:
-  .result retval
+    shouldntneedtodothis:
+    .result retval
   .pcc_end
   .debug("retval of '")
   .debug(retval)
@@ -479,12 +446,7 @@
   # MIDDLE Word to keep accumulating word fragments...
   # XXX this can probably be combined with block_begin...
   .debug("handle_command_block:\n")
-  .arg buffer
-  .arg start_word
-  saveall
-  call __match_close
-  restoreall
-  .result word_length
+  word_length =  __match_close( start_word, buffer )
   .debug("word_length = ")
   .debug(word_length)
   .debug("\n")
@@ -496,10 +458,12 @@
   .debug("final retval is '")
   .debug(retval)
   .debug("'\n")
-  .return retval
-  ret
+  .pcc_begin_return
+    .return retval
+  .pcc_end_return
 
 END:
   end
 
 .end
+
Index: lib/var_subst.imc
===================================================================
RCS file: /cvs/public/parrot/languages/tcl/lib/var_subst.imc,v
retrieving revision 1.1
diff -u -u -r1.1 var_subst.imc
--- lib/var_subst.imc	4 Oct 2003 16:01:03 -0000	1.1
+++ lib/var_subst.imc	14 Mar 2004 14:14:54 -0000
@@ -19,7 +19,7 @@
 # Copyright (c) 2002-2003 by William J. Coleda
 
 
-.pcc_sub __var_subst prototyped 
+.sub __var_subst prototyped 
   .param string word
 
   .local int start_pos
@@ -129,9 +129,9 @@
   #print "\n"
 
   .pcc_begin_return
-  .return start_pos
-  .return replace_len
-  .return replace_str
+    .return start_pos
+    .return replace_len
+    .return replace_str
   .pcc_end_return
 
 .end
Index: lib/commands/append.imc
===================================================================
RCS file: /cvs/public/parrot/languages/tcl/lib/commands/append.imc,v
retrieving revision 1.1
diff -u -u -r1.1 append.imc
--- lib/commands/append.imc	4 Oct 2003 16:01:10 -0000	1.1
+++ lib/commands/append.imc	14 Mar 2004 14:14:55 -0000
@@ -5,12 +5,12 @@
 #
 # append var [...]
 
-.pcc_sub __cmd_append prototyped
+.sub __cmd_append 
   .param PerlArray argv
   
   .include "lib/macros/debug.imc"
   .local int debug
-  debug = 0
+  debug = 1
 
   .local int argc 
   argc = argv
@@ -48,6 +48,6 @@
 
 done:
   .pcc_begin_return
-  .return value
+    .return value
   .pcc_end_return
 .end
Index: lib/commands/exit.imc
===================================================================
RCS file: /cvs/public/parrot/languages/tcl/lib/commands/exit.imc,v
retrieving revision 1.1
diff -u -u -r1.1 exit.imc
--- lib/commands/exit.imc	4 Oct 2003 16:01:10 -0000	1.1
+++ lib/commands/exit.imc	14 Mar 2004 14:14:55 -0000
@@ -2,7 +2,7 @@
 # [exit]
 # Copyright (c) 2002-2003 by William J. Coleda
 
-.pcc_sub __cmd_exit
+.sub __cmd_exit
   # we don't care about our arguments. just yet.
   end 
   
Index: lib/commands/incr.imc
===================================================================
RCS file: /cvs/public/parrot/languages/tcl/lib/commands/incr.imc,v
retrieving revision 1.1
diff -u -u -r1.1 incr.imc
--- lib/commands/incr.imc	4 Oct 2003 16:01:10 -0000	1.1
+++ lib/commands/incr.imc	14 Mar 2004 14:14:55 -0000
@@ -6,11 +6,11 @@
 # incr foo
 # incr foo offset
 
-.pcc_sub __cmd_incr prototyped
+.sub __cmd_incr prototyped
   .param PerlArray argv
   .include "lib/macros/debug.imc"
   .local int debug
-  debug = 0
+  debug = 1
 
   .local int value
   .local int increment 
Index: lib/commands/puts.imc
===================================================================
RCS file: /cvs/public/parrot/languages/tcl/lib/commands/puts.imc,v
retrieving revision 1.1
diff -u -u -r1.1 puts.imc
--- lib/commands/puts.imc	4 Oct 2003 16:01:10 -0000	1.1
+++ lib/commands/puts.imc	14 Mar 2004 14:14:55 -0000
@@ -2,7 +2,7 @@
 # [puts]
 # Copyright (c) 2002-2003 by William J. Coleda
 
-.pcc_sub __cmd_puts prototyped
+.sub __cmd_puts 
   .param PerlArray argv
 
   .local int argc 
Index: lib/commands/rename.imc
===================================================================
RCS file: /cvs/public/parrot/languages/tcl/lib/commands/rename.imc,v
retrieving revision 1.1
diff -u -u -r1.1 rename.imc
--- lib/commands/rename.imc	4 Oct 2003 16:01:10 -0000	1.1
+++ lib/commands/rename.imc	14 Mar 2004 14:14:55 -0000
@@ -2,7 +2,7 @@
 # [rename]
 # Copyright (c) 2002-2003 by William J. Coleda
 
-.pcc_sub __cmd_rename prototyped
+.sub __cmd_rename 
   .param PerlArray argv
   
   .include "lib/macros/debug.imc"
@@ -14,7 +14,7 @@
 
   .local string oldName
   .local string newName
-  .local PerlHash commands
+  .local pmc commands
  
   if argc != 2 goto error
   oldName = argv[0]
Index: lib/commands/set.imc
===================================================================
RCS file: /cvs/public/parrot/languages/tcl/lib/commands/set.imc,v
retrieving revision 1.1
diff -u -u -r1.1 set.imc
--- lib/commands/set.imc	4 Oct 2003 16:01:10 -0000	1.1
+++ lib/commands/set.imc	14 Mar 2004 14:14:55 -0000
@@ -2,22 +2,23 @@
 # [set]
 # Copyright (c) 2002-2003 by William J. Coleda
 
-.pcc_sub __cmd_set prototyped
+.sub __cmd_set 
   .param PerlArray argv
-  
+
   .include "lib/macros/debug.imc"
   .local int debug
   debug = 0
 
   .local int argc 
   argc = argv
-
-  .local PerlString value
+  
+  .local pmc value
   .local string retval
  
   if argc == 0 goto error
 
   $S1 = argv[0] 
+
   if argc == 2 goto setting
   if argc == 1 goto getting
   if argc > 2 goto error
@@ -26,12 +27,12 @@
   find_lex $P1, $S1
   retval = $P1
   .debug("Trying to get value of: ")
-  .debug(S1)
+  .debug($S1)
   .debug("\n")
   goto done
 
 setting:
-  new value, .PerlString
+  value = new PerlString
   value = argv[1]
   .debug("Trying to save value of: ")
   .debug(value)
@@ -50,6 +51,6 @@
 
 done:
   .pcc_begin_return
-  .return retval
+    .return retval
   .pcc_end_return
 .end
Index: lib/macros/substitution.imc
===================================================================
RCS file: /cvs/public/parrot/languages/tcl/lib/macros/substitution.imc,v
retrieving revision 1.1
diff -u -u -r1.1 substitution.imc
--- lib/macros/substitution.imc	4 Oct 2003 16:01:16 -0000	1.1
+++ lib/macros/substitution.imc	14 Mar 2004 14:14:55 -0000
@@ -16,9 +16,9 @@
   .local int start_pointer
   .local int iterator
 
-  .local PerlArray next_array
-  .local PerlArray string_array
-  .local PerlArray cooked_array
+  .local pmc next_array
+  .local pmc string_array
+  .local pmc cooked_array
 
 #
 # Given a replacement string and where to put it in the current chunk,
