Author: allison
Date: Wed May  3 23:42:25 2006
New Revision: 12498

Modified:
   trunk/   (props changed)
   trunk/languages/punie/lib/POST/Label.pir
   trunk/languages/punie/lib/POST/Op.pir
   trunk/languages/punie/lib/POST/Ops.pir
   trunk/languages/punie/lib/POST/Val.pir
   trunk/languages/punie/lib/POST/Var.pir
   trunk/languages/punie/lib/past2post.tg
   trunk/languages/punie/lib/pge2past.tg

Log:
 [EMAIL PROTECTED]:  allison | 2006-05-03 23:22:42 -0700
 Punie: update to take advantage of the past week of refactors.


Modified: trunk/languages/punie/lib/POST/Label.pir
==============================================================================
--- trunk/languages/punie/lib/POST/Label.pir    (original)
+++ trunk/languages/punie/lib/POST/Label.pir    Wed May  3 23:42:25 2006
@@ -22,36 +22,16 @@
     .return ()
 .end
 
-.sub name :method
-    .param string name :optional
-    .param int got_name :opt_flag
-    unless got_name goto get
-  set:
-    $P1 = new .String
-    $P1 = name
-    setattribute self, "name", $P1
-    .return ($P1)
-  get:
-    $P2 = getattribute self, "name"
-    .return ($P2)
+.sub 'name' :method
+    .param string name       :optional
+    .param int passed_name   :opt_flag
+    .return self.'accessor'('name', name, passed_name)
 .end
 
-.sub dest :method
-    .param int dest :optional
-    .param int got_dest :opt_flag
-    unless got_dest goto get
-  set:
-    $P1 = new Integer
-    $P1 = dest
-    setattribute self, "dest", $P1 
-    .return ($P1)
-  get:
-    $P2 = getattribute self, "dest"
-    unless null $P2 goto got_it
-    $P2 = new Integer
-    $P2 = 0
-  got_it:
-    .return ($P2)
+.sub 'dest' :method
+    .param int dest       :optional
+    .param int passed_dest   :opt_flag
+    .return self.'accessor'('dest', dest, passed_dest)
 .end
 
 .sub __clone :method
@@ -64,27 +44,13 @@
     .return (result)
 .end
 
-.sub "dump" :method
-    .param int level :optional
-    .local string indent
-    indent = repeat "    ", level # tab is 4 spaces here
-    level += 1 # set level for attributes
-    $S0 = typeof self
-    print indent
-    print "<"
-    print $S0
-    print "> => { \n"
-
-    # print source for this node
-    self.dump_attribute("source", level)
-    self.dump_attribute("pos", level)
-    self.dump_attribute("name", level)
-    self.dump_attribute("dest", level)
-
-    # close off current node display
-    print indent
-    print "}\n"
-    .return ()
+.sub 'DUMPABLE' :method
+    $P1 = new .ResizablePMCArray
+    push $P1, 'source'
+    push $P1, 'pos'
+    push $P1, 'name'
+    push $P1, 'dest'
+    .return ($P1)
 .end
 
 .sub generate_label :method

Modified: trunk/languages/punie/lib/POST/Op.pir
==============================================================================
--- trunk/languages/punie/lib/POST/Op.pir       (original)
+++ trunk/languages/punie/lib/POST/Op.pir       Wed May  3 23:42:25 2006
@@ -19,39 +19,17 @@
     .return ()
 .end
 
-.sub "dump" :method
-    .param int level :optional
-    .local string indent
-    indent = repeat "    ", level # tab is 4 spaces here
-    level += 1 # set level for attributes
-    $S0 = typeof self
-    print indent
-    print "<"
-    print $S0
-    print "> => { \n"
-
-    # print source for this node
-    self.dump_attribute("source", level)
-    self.dump_attribute("pos", level)
-    self.dump_attribute("op", level)
-    self.dump_children(level)
-
-    # close off current node display
-    print indent
-    print "}\n"
-    .return ()
+.sub 'op' :method
+    .param string op       :optional
+    .param int passed_op   :opt_flag
+    .return self.'accessor'('op', op, passed_op)
 .end
 
-.sub 'op' :method
-    .param string op :optional
-    .param int got_op :opt_flag
-    unless got_op goto get
-  set:
-    $P1 = new .String
-    $P1 = op
-    setattribute self, "op", $P1
+.sub 'DUMPABLE' :method
+    $P1 = new .ResizablePMCArray
+    push $P1, 'source'
+    push $P1, 'pos'
+    push $P1, 'op'
+    push $P1, 'children'
     .return ($P1)
-  get:
-    $P2 = getattribute self, "op"
-    .return ($P2)
 .end

Modified: trunk/languages/punie/lib/POST/Ops.pir
==============================================================================
--- trunk/languages/punie/lib/POST/Ops.pir      (original)
+++ trunk/languages/punie/lib/POST/Ops.pir      Wed May  3 23:42:25 2006
@@ -21,14 +21,8 @@
     .return ()
 .end
 
-.sub tmpvar :method
-    .param pmc tmpvar :optional
-    .param int got_tmpvar :opt_flag
-    unless got_tmpvar goto get
-  set:
-    setattribute self, "tmpvar", tmpvar
-    .return ($P1)
-  get:
-    $P2 = getattribute self, "tmpvar"
-    .return ($P2)
+.sub 'tmpvar' :method
+    .param pmc tmpvar       :optional
+    .param int passed_tmpvar   :opt_flag
+    .return self.'accessor'('tmpvar', tmpvar, passed_tmpvar)
 .end

Modified: trunk/languages/punie/lib/POST/Val.pir
==============================================================================
--- trunk/languages/punie/lib/POST/Val.pir      (original)
+++ trunk/languages/punie/lib/POST/Val.pir      Wed May  3 23:42:25 2006
@@ -19,53 +19,23 @@
     .return ()
 .end
 
-.sub "dump" :method
-    .param int level :optional
-    .local string indent
-    indent = repeat "    ", level # tab is 4 spaces here
-    level += 1 # set level for attributes
-    $S0 = typeof self
-    print indent
-    print "<"
-    print $S0
-    print "> => { \n"
-
-    # print source for this node
-    self.dump_attribute("source", level)
-    self.dump_attribute("pos", level)
-    self.dump_attribute("value", level)
-    self.dump_attribute("valtype", level)
-
-    # close off current node display
-    print indent
-    print "}\n"
-    .return ()
+.sub 'value' :method
+    .param string value       :optional
+    .param int passed_value   :opt_flag
+    .return self.'accessor'('value', value, passed_value)
 .end
 
-.sub value :method
-    .param string value  :optional
-    .param int got_value :opt_flag
-    unless got_value goto get
-  set:
-    $P1 = new .String
-    $P1 = value
-    setattribute self, "value", $P1
-    .return ($P1)
-  get:
-    $P2 = getattribute self, "value"
-    .return ($P2)
+.sub 'valtype' :method
+    .param string valtype       :optional
+    .param int passed_valtype   :opt_flag
+    .return self.'accessor'('valtype', valtype, passed_valtype)
 .end
 
-.sub valtype :method
-    .param string valtype  :optional
-    .param int got_valtype :opt_flag
-    unless got_valtype goto get
-  set:
-    $P1 = new .String
-    $P1 = valtype
-    setattribute self, "valtype", $P1
+.sub 'DUMPABLE' :method
+    $P1 = new .ResizablePMCArray
+    push $P1, 'source'
+    push $P1, 'pos'
+    push $P1, 'value'
+    push $P1, 'valtype'
     .return ($P1)
-  get:
-    $P2 = getattribute self, "valtype"
-    .return ($P2)
 .end

Modified: trunk/languages/punie/lib/POST/Var.pir
==============================================================================
--- trunk/languages/punie/lib/POST/Var.pir      (original)
+++ trunk/languages/punie/lib/POST/Var.pir      Wed May  3 23:42:25 2006
@@ -19,6 +19,12 @@
     .return ()
 .end
 
+.sub 'varname' :method
+    .param string varname       :optional
+    .param int passed_varname   :opt_flag
+    .return self.'accessor'('varname', varname, passed_varname)
+.end
+
 .sub generate_temp :method
     .local string temp
        temp = "$P"
@@ -50,7 +56,7 @@
     # 'Undef'. It has 2 arguments: the temp variable and the type.
     .local pmc newop
     newop = new 'POST::Op'
-    newop.'clone_node'(self)
+    newop.'clone'(self)
     newop.'op'('new')
 
     newop.'add_child'(self)
@@ -63,38 +69,10 @@
     .return (newop)
 .end
 
-.sub varname :method
-    .param string varname :optional
-    .param int got_varname :opt_flag
-    unless got_varname goto get
-  set:
-    $P1 = new .String
-    $P1 = varname
-    setattribute self, "varname", $P1
+.sub 'DUMPABLE' :method
+    $P1 = new .ResizablePMCArray
+    push $P1, 'source'
+    push $P1, 'pos'
+    push $P1, 'varname'
     .return ($P1)
-  get:
-    $P2 = getattribute self, "varname"
-    .return ($P2)
-.end
-
-.sub "dump" :method
-    .param int level :optional
-    .local string indent
-    indent = repeat "    ", level # tab is 4 spaces here
-    level += 1 # set level for attributes
-    $S0 = typeof self
-    print indent
-    print "<"
-    print $S0
-    print "> => { \n"
-
-    # print source for this node
-    self.dump_attribute("source", level)
-    self.dump_attribute("pos", level)
-    self.dump_attribute("varname", level)
-
-    # close off current node display
-    print indent
-    print "}\n"
-    .return ()
 .end

Modified: trunk/languages/punie/lib/past2post.tg
==============================================================================
--- trunk/languages/punie/lib/past2post.tg      (original)
+++ trunk/languages/punie/lib/past2post.tg      Wed May  3 23:42:25 2006
@@ -1,7 +1,7 @@
 ROOT: result(.) = {
     .local pmc result
     result = new 'POST::Sub'
-    result.'clone_node'(node)
+    result.'clone'(node)
 
     .local pmc iter
     iter = node.'child_iter'()
@@ -19,7 +19,7 @@
 PAST::Stmts: result(.) = {
     .local pmc result
     result = new 'POST::Ops'
-    result.'clone_node'(node)
+    result.'clone'(node)
 
     .local pmc iter
     iter = node.'child_iter'()
@@ -81,7 +81,7 @@
     # for each child.
     .local pmc childop
     childop = new 'POST::Op'
-    childop.'clone_node'(node)
+    childop.'clone'(node)
     $S2 = node.op()
     childop.op($S2)
 
@@ -135,7 +135,7 @@
     # Create the node to contain all the generated ops.
     .local pmc newops
     newops = new 'POST::Ops'
-    newops.'clone_node'(node)
+    newops.'clone'(node)
 
     # Create the op for the current node
     .local pmc childop
@@ -151,7 +151,7 @@
     # Create a temporary variable
     .local pmc temp_var
     temp_var = new 'POST::Var'
-    temp_var.'clone_node'(node)
+    temp_var.'clone'(node)
     $P8 = temp_var.new_dummy()
     newops.'add_child'($P8)
 
@@ -172,13 +172,13 @@
       create_tmp:
         # Create a temp variable
         $P4 = new 'POST::Var'
-        $P4.'clone_node'(node)
+        $P4.'clone'(node)
         $P5 = $P4.new_dummy()
         newops.'add_child'($P5)
         childop.'add_child'($P4)
         # Assign the value node to the variable
         $P7 = new 'POST::Op'
-        $P7.'clone_node'(node)
+        $P7.'clone'(node)
         $P7.'op'('set')
         $P7.'add_child'($P4) # the first argument is the variable
         $P7.'add_child'($P3) # the second argument is the value
@@ -211,7 +211,7 @@
     opname = oplookup($S1)
     .local pmc childop
     childop = new 'POST::Op'
-    childop.'clone_node'(node)
+    childop.'clone'(node)
     childop.'op'(opname)
 
     # Set up to handle children of Op node.
@@ -251,7 +251,7 @@
     endlabel = new 'POST::Label'
     endlabel.'new_dummy'('endcond')
     $P4 = new 'POST::Op'
-    $P4.'clone_node'(node)
+    $P4.'clone'(node)
     $P4.'op'('goto')
     $P4.'add_child'(endlabel)
     newops.'add_child'($P4)
@@ -306,7 +306,7 @@
     # Create a node to contain the generated ops.
     .local pmc newops
     newops = new 'POST::Ops'
-    newops.'clone_node'(node)
+    newops.'clone'(node)
 
     # Store the opname for later reuse
     .local string opname
@@ -323,7 +323,7 @@
       $P3 = tree.get('result', $P2)
       $S1 = typeof $P3
       $P5 = new 'POST::Op'
-      $P5.'clone_node'(node)
+      $P5.'clone'(node)
       $P5.'op'(opname)
       $S1 = typeof $P3
       if $S1 == 'POST::Ops' goto complex_result # the argument has setup
@@ -350,7 +350,7 @@
 PAST::Val: result(.) = {
     .local pmc result
     result = new 'POST::Val'
-    result.'clone_node'(node)
+    result.'clone'(node)
     $P1 = node.'value'()
     result.'value'($P1)
     $P2 = node.'valtype'()

Modified: trunk/languages/punie/lib/pge2past.tg
==============================================================================
--- trunk/languages/punie/lib/pge2past.tg       (original)
+++ trunk/languages/punie/lib/pge2past.tg       Wed May  3 23:42:25 2006
@@ -31,7 +31,7 @@
 PunieGrammar::lineseq: result(.) = {
     .local pmc result
     result = new 'PAST::Stmts'
-    result.'clone_pge'(node)
+    result.'clone'(node)
 
     # Ask the child node for its result
     .local pmc child
@@ -59,7 +59,7 @@
 PunieGrammar::line: result(.) = {
     .local pmc result
     result = new 'PAST::Stmt'
-    result.'clone_pge'(node)
+    result.'clone'(node)
 
     .local pmc iter
     iter = new Iterator, node    # setup iterator for node
@@ -80,7 +80,7 @@
 PunieGrammar::expr: result(.) = {
     .local pmc result
     result = new 'PAST::Exp'
-    result.'clone_pge'(node)
+    result.'clone'(node)
 
     $P1 = node.get_hash()
     $P0 = new Iterator, $P1    # setup iterator for node
@@ -101,7 +101,7 @@
 PunieGrammar::gprint: result(.) = {
     .local pmc result
     result = new 'PAST::Op'
-    result.'clone_pge'(node)
+    result.'clone'(node)
     $S1 = node[0]
     result.'op'($S1)
 
@@ -124,7 +124,7 @@
 PunieGrammar::cond: result(.) = {
     .local pmc result
     result = new 'PAST::Op'
-    result.'clone_pge'(node)
+    result.'clone'(node)
     $S1 = node[0]
     result.'op'($S1)
 
@@ -151,7 +151,7 @@
     unless onechild goto no_child
     .local pmc result
     result = new 'PAST::Op'
-    result.'clone_pge'(onechild)
+    result.'clone'(onechild)
     $S1 = onechild[0]
     result.'op'($S1)
 
@@ -184,7 +184,7 @@
     unless $I0 goto err_no_oexpr
     $P1 = node["PunieGrammar::oexpr"]
     result = new 'PAST::Op'
-    result.'clone_pge'(node)
+    result.'clone'(node)
     result.'op'('O_COMMA')
 
     $P0 = new Iterator, $P1    # setup iterator for node
@@ -217,7 +217,7 @@
 PunieGrammar::oexpr: result(.) = {
     .local pmc result
     result = new 'PAST::Exp'
-    result.'clone_pge'(node)
+    result.'clone'(node)
 
     .local pmc iter
     $P1 = node.get_hash()
@@ -240,7 +240,7 @@
 PunieGrammar::number: result(.) = {
     .local pmc result
     result = new 'PAST::Val'
-    result.'clone_pge'(node)
+    result.'clone'(node)
     $S2 = node 
     result.'value'($S2)
     result.'valtype'('num')
@@ -251,7 +251,7 @@
 PunieGrammar::integer: result(.) = {
     .local pmc result
     result = new 'PAST::Val'
-    result.'clone_pge'(node)
+    result.'clone'(node)
     $S2 = node 
     result.'value'($S2)
     result.'valtype'('int')
@@ -261,7 +261,7 @@
 PunieGrammar::stringdouble: result(.) = {
     .local pmc result
     result = new 'PAST::Val'
-    result.'clone_pge'(node)
+    result.'clone'(node)
 
     .local string value
     # Check if this is a string match
@@ -283,7 +283,7 @@
 PunieGrammar::stringsingle: result(.) = {
     .local pmc result
     result = new 'PAST::Val'
-    result.'clone_pge'(node)
+    result.'clone'(node)
 
     .local string value
     # Check if this is a string match
@@ -327,7 +327,7 @@
 expr: op(.) = {
     .local pmc result
     result = new 'PAST::Op'
-    result.'clone_pge'(node)
+    result.'clone'(node)
     $S1 = node["type"]
     result.'op'($S1)
 

Reply via email to