1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Minor code optimization.

This commit is contained in:
Russ Rowan 2006-01-08 16:20:46 -05:00
parent f451e89286
commit e15c9d4611

View File

@ -20,13 +20,12 @@ while (<FILEIN>)
if ($_ =~ /^\s+\*\s$/) { next if $first; $_ =~ s/\s\*// if not $first; } if ($_ =~ /^\s+\*\s$/) { next if $first; $_ =~ s/\s\*// if not $first; }
if ($_ =~ /^\s\*+\/$/ or $_ !~ /^\s/) { $found = undef; next; } if ($_ =~ /^\s\*+\/$/ or $_ !~ /^\s/) { $found = undef; next; }
$_ =~ s/^(\s*)\s\*\s/$1/; $_ =~ s/^(\s*)\s\*\s/$1/;
$found = 'sorta' if $_ =~ s/\s*\*\/$//; $found = 'sorta' if $_ =~ s/\s*\*\/$//; $first = undef;
$first = undef;
} }
elsif ($_ =~ /^\s*\/\*\*\s(.*)/) elsif ($_ =~ /^\s*\/\*\*\s(.*)/)
{ {
$_ = $1; $first = 1;
print FILEOUT "\n\n\n" if $start; print FILEOUT "\n\n\n" if $start;
$_ = $1;
if ($_ =~ s/\s*\*\/$//) { $found = 'sorta'; } else { $found = $.; } if ($_ =~ s/\s*\*\/$//) { $found = 'sorta'; } else { $found = $.; }
if ($_ =~ /::/) { $_ = "$_\n\n"; } if ($_ =~ /::/) { $_ = "$_\n\n"; }
else else
@ -34,15 +33,14 @@ while (<FILEIN>)
my $dash; for (my $x = 0; $x < length($_); $x++) { $dash .= '-'; } my $dash; for (my $x = 0; $x < length($_); $x++) { $dash .= '-'; }
$_ = "$_\n$dash\n\n"; $_ = "$_\n$dash\n\n";
} }
$first = 1;
} }
elsif ($_ =~ /\s*([A-Z0-9_]+),\s*\/\*::\s*(.*)\s+\*\/$/) elsif ($_ =~ /\s*([A-Z0-9_]+),\s*\/\*::\s*(.*)\s+\*\/$/)
{ {
print FILEOUT "\n" if $gotone; print FILEOUT "\n" if $gotone;
$_ =~ s/\s*([A-Z0-9_]+),\s*\/\*::\s*(.*)\s+\*\/$/id[$1]::\n $2/; $_ =~ s/\s*([A-Z0-9_]+),\s*\/\*::\s*(.*)\s+\*\/$/id[$1]::\n $2/;
$found = 'sorta'; $gotone = 1; $found = 'sorta'; $gotone = $.;
} }
else { $gotone = undef; } $gotone = undef if $gotone and $gotone < $.;
next if not $found; $found = undef if $found eq 'sorta'; next if not $found; $found = undef if $found eq 'sorta';
print FILEOUT $_ and $start = 1; print FILEOUT $_ and $start = 1;
} }