# New Ticket Created by  "Paul Cochrane" 
# Please include the string:  [perl #40475]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=40475 >


Hi,

PMC files are just C-language files in a sense, right?  If so, then
here's a patch that gets Parrot::Distribution to find all the .pmc
files, and adds a check to the c_code_coda.t test so that after a
"make realclean; perl Configure.pl; make" more of the c_code_coda
tests pass.

HTH,

Paul

files affected:

lib/Parrot/Distribution.pm
t/codingstd/c_code_coda.t
Index: lib/Parrot/Distribution.pm
===================================================================
--- lib/Parrot/Distribution.pm	(revision 14845)
+++ lib/Parrot/Distribution.pm	(working copy)
@@ -186,7 +186,59 @@
     return;
 }
 
+=item C<pmc_source_file_directories()>
 
+Returns the directories which contain PMC source files.
+
+=cut
+
+sub pmc_source_file_directories
+{
+    my $self = shift;
+
+    return
+        map $self->directory_with_name($_) =>
+	    'compilers/bcg/src/pmc',
+	    'languages/APL/src/pmc',
+	    'languages/WMLScript/pmc',
+	    'languages/amper/lib/kernel/pmc',
+	    'languages/cardinal/src/pmc',
+	    'languages/dotnet/pmc',
+	    'languages/lua/pmc',
+	    'languages/perl6/src/pmc',
+	    'languages/pugs/pmc',
+	    'languages/python/pmc',
+	    'languages/tcl/src/pmc',
+            map("src/$_" => qw<dynpmc pmc>),
+            't/tools',
+    ;
+}
+
+
+=item C<pmc_source_file_with_name($name)>
+
+Returns the PMC source file with the specified name.
+
+=cut
+
+sub pmc_source_file_with_name
+{
+    my $self = shift;
+    my $name = shift || return;
+
+    $name .= '.pmc';
+
+    foreach my $dir ($self->pmc_source_file_directories)
+    {
+        return $dir->file_with_name($name)
+            if $dir->file_exists_with_name($name);
+    }
+
+    print 'WARNING: ' . __FILE__ . ':' . __LINE__ . ' File not found:' . $name ."\n";
+
+    return;
+}
+
 =item C<file_for_perl_module($module)>
 
 Returns the Perl module file for the specified module.
Index: t/codingstd/c_code_coda.t
===================================================================
--- t/codingstd/c_code_coda.t	(revision 14845)
+++ t/codingstd/c_code_coda.t	(working copy)
@@ -92,6 +92,7 @@
     return (
         map( $_->files_of_type('C code'),   $DIST->c_source_file_directories ),
         map( $_->files_of_type('C header'), $DIST->c_header_file_directories ),
+        map( $_->files_of_type('PMC code'),   $DIST->pmc_source_file_directories ),
     );
 }
 

Reply via email to