Author: mdiep
Date: Sat Aug 13 16:37:44 2005
New Revision: 8945

Modified:
   trunk/languages/tcl/lib/expression.pir
   trunk/languages/tcl/lib/list.pir
   trunk/languages/tcl/lib/string.pir
   trunk/languages/tcl/tcl.pir_template
Log:
tcl: Convert the INTEGER constant to OPERAND and quit returning it from 
__expr_get_number

Modified: trunk/languages/tcl/lib/expression.pir
==============================================================================
--- trunk/languages/tcl/lib/expression.pir      (original)
+++ trunk/languages/tcl/lib/expression.pir      Sat Aug 13 16:37:44 2005
@@ -101,7 +101,7 @@ get_paren_done:
   if return_type == TCL_ERROR goto die_horribly
 
   chunk = new TclList
-  chunk[0] = INTEGER
+  chunk[0] = OPERAND
   chunk[1] = retval
 
   push chunks, chunk
@@ -116,7 +116,7 @@ get_variable:
   retval = $I0
   
   chunk = new TclList
-  chunk[0] = INTEGER
+  chunk[0] = OPERAND
   chunk[1] = retval
   push chunks, chunk
   dec chunk_start
@@ -144,15 +144,14 @@ get_function:
 get_number:
   #print "GET_NUMBER\n"
   # If we got here, then char and chunk_start are already set properly
-  .local int num_type
   .local pmc value
-  (op_length,num_type,value) = __expr_get_number(expr,chunk_start)
+  (op_length,value) = __expr_get_number(expr,chunk_start)
   #print "GOT_NUMBER\n"
   if op_length == 0 goto get_operator
   # XXX otherwise, pull that number off
   # stuff the chunk onto the chunk_list
   chunk = new TclList
-  chunk[0] = INTEGER
+  chunk[0] = OPERAND
   chunk[1] = value
   push chunks, chunk
   chunk_start += op_length
@@ -262,7 +261,7 @@ converter_loop:
   $I0 = typeof our_op
   if $I0 == .Undef goto converter_next
   $I2 = our_op[0]
-  if $I2 == INTEGER goto converter_next
+  if $I2 == OPERAND goto converter_next
   if $I2 == CHUNK   goto converter_next
   if $I2 == OP   goto is_opfunc
   if $I2 == FUNC goto is_opfunc # XXX should eventually go away as we make 
functions part of "CHUNK", above.
@@ -587,7 +586,7 @@ done_op:
   #print "\n"
   $P5 = new FixedPMCArray
   $P5 = 2
-  $P5[0] = INTEGER
+  $P5[0] = OPERAND
   $P5[1] = op_result
   push result_stack, $P5
 
@@ -703,7 +702,7 @@ finish_up:
    value = $I0 
 
 real_done:
-  .return(pos,INTEGER,value)
+  .return(pos,value)
 .end
 
 .sub __expr_get_function
@@ -777,7 +776,7 @@ loop_done:
   ($I9,operand) = __expression_interpret(operand)  
   $P10 = new FixedPMCArray
   $P10 = 2
-  $P10[0] = INTEGER
+  $P10[0] = OPERAND
   $P10[1] = operand
   operand = $P10
   if $I9 == TCL_ERROR goto fail
@@ -812,7 +811,7 @@ was this a valid tcl-style level, or did
   current_call_level = find_global "_Tcl", "call_level"
   orig_level = current_call_level
  
-  .local int num_length, num_type
+  .local int num_length
 
 get_absolute:
   # Is this an absolute? 
@@ -820,8 +819,9 @@ get_absolute:
   $S1 = substr $S0, 0, 1
   if $S1 != "#" goto get_integer
   $S0 = tcl_level
-  (num_length,num_type,parrot_level) = __expr_get_number($S0,1)
-  if num_type != INTEGER goto default 
+  (num_length,parrot_level) = __expr_get_number($S0,1)
+  $I0 = isa parrot_level, "Integer"
+  if $I0 == 0 goto default
   $S0 = tcl_level
   $I0 = length $S0
 
@@ -832,8 +832,9 @@ get_absolute:
 get_integer:
   # Is this an integer? 
   $S0 = tcl_level
-  (num_length,num_type,parrot_level) = __expr_get_number($S0,0)
-  if num_type != INTEGER goto default 
+  (num_length,parrot_level) = __expr_get_number($S0,0)
+  $I0 = isa parrot_level, "Integer"
+  if $I0 == 0 goto default
   $S0 = tcl_level
   $I0 = length $S0
   if $I0 != num_length goto default

Modified: trunk/languages/tcl/lib/list.pir
==============================================================================
--- trunk/languages/tcl/lib/list.pir    (original)
+++ trunk/languages/tcl/lib/list.pir    Sat Aug 13 16:37:44 2005
@@ -20,7 +20,7 @@
   .local int return_type
   return_type = TCL_OK
 
-  .local int index_length,number_length,number_type
+  .local int index_length,number_length
   .local pmc number_result
 
   if position == "end" goto my_end
@@ -28,9 +28,10 @@
   $S0 = substr position, 0, 4
   if $S0 == "end-" goto has_end
   index_length = length position
-  (number_length,number_type,retval) = __expr_get_number(position,0)
-  if number_type != INTEGER goto bad_arg 
+  (number_length,retval) = __expr_get_number(position,0)
   if number_length != index_length goto bad_arg
+  $I0 = isa retval, "Integer"
+  if $I0 == 0 goto bad_arg
   
   # if the number is greater than the number of elements
   # in the list, we want the end
@@ -55,9 +56,10 @@ has_end:
   index_length = length position
   index_length -= 4  # ignore "end-"
   # is this an int?
-  (number_length,number_type,number_result) = __expr_get_number(position,4)
-  if number_type != INTEGER goto bad_arg
+  (number_length,number_result) = __expr_get_number(position,4)
   if number_length != index_length goto bad_arg
+  $I0 = isa number_result, "Integer"
+  if $I0 == 0 goto bad_arg
   # say, 1 if -1
   $I0 = number_result
   # say, 2 if -2

Modified: trunk/languages/tcl/lib/string.pir
==============================================================================
--- trunk/languages/tcl/lib/string.pir  (original)
+++ trunk/languages/tcl/lib/string.pir  Sat Aug 13 16:37:44 2005
@@ -20,7 +20,6 @@
   .local pmc retval
   .local int index_length
   .local int number_length
-  .local int number_type
   .local pmc number_result
 
   .local int index_1
@@ -31,9 +30,10 @@
   if $S0 == "end-" goto has_end
   index_length = length $S0
   # is this an int?
-  (number_length,number_type,retval) = __expr_get_number(position,0)
-  if number_type != INTEGER goto bad_arg
+  (number_length,retval) = __expr_get_number(position,0)
   if number_length != index_length goto bad_arg
+  $I0 = isa retval, "Integer"
+  if $I0 == 0 goto bad_arg
   goto done
 
   #if not, fail.
@@ -50,9 +50,10 @@ has_end:
   index_length = length position
   index_length -= 4  # ignore "end-"
   # is this an int?
-  (number_length,number_type,number_result) = __expr_get_number(position,4)
-  if number_type != INTEGER goto bad_arg
+  (number_length,number_result) = __expr_get_number(position,4)
   if number_length != index_length goto bad_arg
+  $I0 = isa number_result, "Integer"
+  if $I0 == 0 goto bad_arg
   # say, 1 if -1
   $I0 = number_result
   # say, 2 if -2

Modified: trunk/languages/tcl/tcl.pir_template
==============================================================================
--- trunk/languages/tcl/tcl.pir_template        (original)
+++ trunk/languages/tcl/tcl.pir_template        Sat Aug 13 16:37:44 2005
@@ -25,8 +25,7 @@ providing a compreg-compatible method.
 
   .const int OP      = 20
   .const int FUNC    = 21
-  # XXX Should be changed to OPERAND
-  .const int INTEGER = 11
+  .const int OPERAND = 11
  
   # Still not sure if these are going to be useful
   .const int BLOCK   = 14

Reply via email to