#! /usr/bin/perl -i.bak
while(<>){
- if($_ eq "/*JP\n"){
- my($s1, $s2, $s3);
- $s1 = <>;
- $s2 = <>;
- $s3 = <>;
- if($s2 eq "*/\n"){
- print $s1;
- open FF, ">>../../1line/$ARGV.txt";
- print FF $s1;
- print FF $s3;
- close FF;
- } else {
- print "/*JP\n";
- print $s1;
- print $s2;
- print $s3;
- }
- } else {
- print $_;
- }
+ if($_ eq "/*JP\n"){
+ my($s1, $s2, $s3);
+ $s1 = <>;
+ $s2 = <>;
+ $s3 = <>;
+ if($s2 eq "*/\n"){
+ print $s1;
+ open FF, ">>../../1line/$ARGV.txt";
+ print FF $s1;
+ print FF $s3;
+ close FF;
+ } else {
+ print "/*JP\n";
+ print $s1;
+ print $s2;
+ print $s3;
+ }
+ } else {
+ print $_;
+ }
}
-
-
my (@file2) = @file;
close F;
for($i = 0; $i < $#file; $i++){
-$file2[$i] =~ s/^[\t ]+//;
+ $file2[$i] =~ s/^[\t ]+//;
}
open FI, "<../../1line/$ARGV.txt";
while(!eof(FI)){
- my ($i);
- my ($in, $in2, $out);
- my ($f) = 0;
- $in = <FI>;
- $out = <FI>;
- $in2 = $in;
- $in2 =~ s/^[\t ]+//;
- for($i = 0; $i < $#file; $i++){
- if($file[$i] eq "#if 0 /*JP*/\n"){
- $f = 1;
- next;
- }
- if($file[$i] =~ /endif/){
- $f = 0;
- next;
- }
+ my ($i);
+ my ($in, $in2, $out);
+ my ($f) = 0;
+ $in = <FI>;
+ $out = <FI>;
+ $in2 = $in;
+ $in2 =~ s/^[\t ]+//;
+ for($i = 0; $i < $#file; $i++){
+ if($file[$i] eq "#if 0 /*JP*/\n"){
+ $f = 1;
+ next;
+ }
+ if($file[$i] =~ /endif/){
+ $f = 0;
+ next;
+ }
- if($f == 1){
- next;
- }
+ if($f == 1){
+ next;
+ }
- if($in2 eq $file2[$i]){
- $file[$i] = "/*JP\n$in*/\n$out";
- $file2[$i] = '';
- last;
- }
- }
- if($i == $#file){
- print "$ARGV:\n" . $in . $out;
- }
+ if($in2 eq $file2[$i]){
+ $file[$i] = "/*JP\n$in*/\n$out";
+ $file2[$i] = '';
+ last;
+ }
+ }
+ if($i == $#file){
+ print "$ARGV:\n" . $in . $out;
+ }
}
close FI;
open FO, ">$ARGV.new";