Upgrade to Pod-Simple-3.04
[p5sagit/p5-mst-13.2.git] / embed.pl
index 2ef42aa..a1068ab 100755 (executable)
--- a/embed.pl
+++ b/embed.pl
@@ -19,7 +19,7 @@ sub do_not_edit ($)
 {
     my $file = shift;
 
-    my $years = '1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005';
+    my $years = '1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006';
 
     $years =~ s/1999,/1999,\n  / if length $years > 40;
 
@@ -124,26 +124,6 @@ sub munge_c_files () {
     } '/dev/null', '', '';
     local $^I = '.bak';
     while (<>) {
-#      if (/^#\s*include\s+"perl.h"/) {
-#          my $file = uc $ARGV;
-#          $file =~ s/\./_/g;
-#          print "#define PERL_IN_$file\n";
-#      }
-#      s{^(\w+)\s*\(}
-#       {
-#          my $f = $1;
-#          my $repl = "$f(";
-#          if (exists $functions->{$f}) {
-#              my $flags = $functions->{$f}[0];
-#              $repl = "Perl_$repl" if $flags =~ /p/;
-#              unless ($flags =~ /n/) {
-#                  $repl .= "pTHX";
-#                  $repl .= "_ " if @{$functions->{$f}} > 3;
-#              }
-#              warn("$ARGV:$.:$repl\n");
-#          }
-#          $repl;
-#       }e;
        s{(\b(\w+)[ \t]*\([ \t]*(?!aTHX))}
         {
            my $repl = $1;
@@ -201,6 +181,15 @@ sub write_protos {
                }
                push( @nonnull, $n ) if ( $arg =~ s/\s*\bNN\b\s+// );
                $arg =~ s/\s*\bNULLOK\b\s+//; # strip NULLOK with no effect
+
+               # Make sure each arg has at least a type and a var name.
+               # An arg of "int" is valid C, but want it to be "int foo".
+               my $temp_arg = $arg;
+               $temp_arg =~ s/\*//g;
+               $temp_arg =~ s/\s*\bstruct\b\s*/ /g;
+               if ( ($temp_arg ne "...") && ($temp_arg !~ /\w+\s+\w+/) ) {
+                   warn "$func: $arg doesn't have a name\n";
+               }
            }
            $ret .= join ", ", @args;
        }