develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r34470 - trunk/lib/Parrot/Pmc2c

From:
petdance
Date:
December 27, 2008 23:21
Subject:
[svn:parrot] r34470 - trunk/lib/Parrot/Pmc2c
Message ID:
20081228072109.BD187CB9B0@x12.develooper.com
Author: petdance
Date: Sat Dec 27 23:21:09 2008
New Revision: 34470

Modified:
   trunk/lib/Parrot/Pmc2c/MethodEmitter.pm
   trunk/lib/Parrot/Pmc2c/PMC.pm

Log:
hoisted the export macros into a PMC method

Modified: trunk/lib/Parrot/Pmc2c/MethodEmitter.pm
==============================================================================
--- trunk/lib/Parrot/Pmc2c/MethodEmitter.pm	(original)
+++ trunk/lib/Parrot/Pmc2c/MethodEmitter.pm	Sat Dec 27 23:21:09 2008
@@ -49,7 +49,7 @@
         $self->rewrite_nci_method($pmc);
     }
 
-    $emit->( ( $pmc->is_dynamic ? 'PARROT_DYNEXT_EXPORT ' : 'PARROT_EXPORT ') . $self->decl( $pmc, 'CFILE' ) );
+    $emit->( $pmc->export . ' ' . $self->decl( $pmc, 'CFILE' ) );
     $emit->("{\n");
     $emit->($body);
     $emit->("}\n");
@@ -103,11 +103,12 @@
     my ( $decorators, $export, $extern, $newl, $semi, $interp, $pmcvar );
     $decorators = join($/, @$decs, '');
     if ( $for_header eq 'HEADER' ) {
-        $export = $pmc->is_dynamic ? 'PARROT_DYNEXT_EXPORT ' : 'PARROT_EXPORT ';
+        $export = $pmc->export;
         $extern = '';
         $newl   = ' ';
         $semi   = ';';
-        $interp = $pmcvar = '';
+        $interp = '';
+        $pmcvar = '';
     }
     else {
         $export = '';
@@ -119,7 +120,7 @@
     }
 
     return <<"EOC";
-$decorators$export$extern$ret${newl}Parrot_${pmcname}_$meth(PARROT_INTERP, PMC *$pmcvar$args)$semi
+$decorators$export $extern$ret${newl}Parrot_${pmcname}_$meth(PARROT_INTERP, PMC *$pmcvar$args)$semi
 EOC
 }
 

Modified: trunk/lib/Parrot/Pmc2c/PMC.pm
==============================================================================
--- trunk/lib/Parrot/Pmc2c/PMC.pm	(original)
+++ trunk/lib/Parrot/Pmc2c/PMC.pm	Sat Dec 27 23:21:09 2008
@@ -172,6 +172,12 @@
     return 1;
 }
 
+sub export {
+    my ( $self ) = @_;
+
+    return $self->is_dynamic ? 'PARROT_DYNEXT_EXPORT' : 'PARROT_EXPORT';
+}
+
 sub implements_vtable {
     my ( $self, $vt_meth ) = @_;
     return 0 unless $self->has_method($vt_meth);



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About