[svn:parrot] r44801 - in branches/ops_pct/compilers/opsc/src/Ops: Compiler Trans

bacek at svn.parrot.org bacek at svn.parrot.org
Tue Mar 9 11:27:10 UTC 2010


Author: bacek
Date: Tue Mar  9 11:27:07 2010
New Revision: 44801
URL: https://trac.parrot.org/parrot/changeset/44801

Log:
Generate code closer to ops2c.pl

Modified:
   branches/ops_pct/compilers/opsc/src/Ops/Compiler/Actions.pm
   branches/ops_pct/compilers/opsc/src/Ops/Trans/C.pm

Modified: branches/ops_pct/compilers/opsc/src/Ops/Compiler/Actions.pm
==============================================================================
--- branches/ops_pct/compilers/opsc/src/Ops/Compiler/Actions.pm	Tue Mar  9 09:59:11 2010	(r44800)
+++ branches/ops_pct/compilers/opsc/src/Ops/Compiler/Actions.pm	Tue Mar  9 11:27:07 2010	(r44801)
@@ -87,7 +87,7 @@
     if !%flags<flow> {
         $op.push(PAST::Op.new(
             :pasttype('inline'),
-            :inline("\n" ~ '{{+=OP_SIZE}};' ~ "\n")
+            :inline("\n" ~ '{{+=OP_SIZE}};')
             ));
     }
 

Modified: branches/ops_pct/compilers/opsc/src/Ops/Trans/C.pm
==============================================================================
--- branches/ops_pct/compilers/opsc/src/Ops/Trans/C.pm	Tue Mar  9 09:59:11 2010	(r44800)
+++ branches/ops_pct/compilers/opsc/src/Ops/Trans/C.pm	Tue Mar  9 11:27:07 2010	(r44801)
@@ -58,7 +58,7 @@
 
         @op_func_table.push(sprintf( "  %-50s /* %6ld */\n", "$func_name,", $index ));
 
-        my $body := join(' ', $definition, '{', "\n", $src, '}', "\n\n");
+        my $body := join('', $definition, '  {', "\n", $src, '}', "\n\n");
         @op_funcs.push($body);
         @op_protos.push($prototype);
         $index++;
@@ -90,9 +90,9 @@
     "interp->resume_offset = REL_PC + $offset; interp->resume_flag = 1";
 }
 
-method goto_address($addr) { "return (opcode_t *) $addr"; }
+method goto_address($addr) { "return (opcode_t *)$addr"; }
 
-method goto_offset($offset) { "return (opcode_t *) cur_opcode + $offset"; }
+method goto_offset($offset) { "return (opcode_t *)cur_opcode + $offset"; }
 
 method expr_address($addr) { $addr; }
 
@@ -131,7 +131,7 @@
 method op_func($emitter) { $emitter.bs ~ 'op_func_table' }
 method getop($emitter)   { 'get_op' };
 
-method body_prelude() { 'Parrot_Context const * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);' }
+method body_prelude() { '    Parrot_Context const * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);' }
 
 method emit_source_part($emitter, $fh) {
     self._emit_op_func_table($emitter, $fh);


More information about the parrot-commits mailing list