cvsuser     04/11/10 14:45:17

  Modified:    build_tools c2str.pl
  Log:
  Make c2str.pl work in the face of #line directives.
  
  Revision  Changes    Path
  1.7       +13 -1     parrot/build_tools/c2str.pl
  
  Index: c2str.pl
  ===================================================================
  RCS file: /cvs/public/parrot/build_tools/c2str.pl,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- c2str.pl  20 Aug 2004 13:54:44 -0000      1.6
  +++ c2str.pl  10 Nov 2004 22:45:17 -0000      1.7
  @@ -86,11 +86,23 @@
   HEADER
       print ALL "# $infile\n";
       my %this_file_seen;
  +    # There is a chance that the same __LINE__ will reoccur if #line 
directives
  +    # are used.
  +    my %lines_seen;
       while (<IN>) {
  +     if (m/^\s*#\s*line\s+(\d+)/) {
  +         # #line directive
  +         $line = $1 - 1;
  +         next;
  +     }
        $line++;
  -     next if m/^\s*#/; # ignore preprocessor
  +     next if m/^\s*#/; # otherwise ignore preprocessor
        next unless s/.*\bCONST_STRING\s*\(\w+\s*,//;
   
  +     if ($lines_seen{$line}++) {
  +         die "Seen line $line before in $infile - can't continue";
  +     }
  +
        my $str = extract_delimited; # $_, '"';
        $str = substr $str, 1, -1;
        # print STDERR "** '$str' $line\n";
  
  
  

Reply via email to