tweaks
This commit is contained in:
parent
66d46d691d
commit
fb6ddf3ea2
2 changed files with 12 additions and 3 deletions
2
runoff
2
runoff
|
@ -10,7 +10,7 @@ pad()
|
||||||
|
|
||||||
# create formatted (numbered) files
|
# create formatted (numbered) files
|
||||||
mkdir -p fmt
|
mkdir -p fmt
|
||||||
rm fmt/*
|
rm -f fmt/*
|
||||||
cp README fmt
|
cp README fmt
|
||||||
files=`grep -v '^#' runoff.list | awk '{print $1}'`
|
files=`grep -v '^#' runoff.list | awk '{print $1}'`
|
||||||
n=99
|
n=99
|
||||||
|
|
13
runoff1
13
runoff1
|
@ -1,6 +1,11 @@
|
||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
|
|
||||||
$n = 0;
|
$n = 0;
|
||||||
|
$v = 0;
|
||||||
|
if($ARGV[0] eq "-v") {
|
||||||
|
$v = 1;
|
||||||
|
shift @ARGV;
|
||||||
|
}
|
||||||
if($ARGV[0] eq "-n") {
|
if($ARGV[0] eq "-n") {
|
||||||
$n = $ARGV[1];
|
$n = $ARGV[1];
|
||||||
shift @ARGV;
|
shift @ARGV;
|
||||||
|
@ -38,12 +43,13 @@ for($i=0; $i<@lines; ){
|
||||||
$breaksize = 15; # 15 lines to get to function
|
$breaksize = 15; # 15 lines to get to function
|
||||||
for($j=$i; $j<$i+50 && $j < @lines; $j++){
|
for($j=$i; $j<$i+50 && $j < @lines; $j++){
|
||||||
if($lines[$j] =~ /PAGEBREAK:\s*([0-9]+)/){
|
if($lines[$j] =~ /PAGEBREAK:\s*([0-9]+)/){
|
||||||
$breaksize = int($2);
|
$breaksize = $1;
|
||||||
$breakbefore = $j;
|
$breakbefore = $j;
|
||||||
$lines[$j] = "";
|
$lines[$j] = "";
|
||||||
}
|
}
|
||||||
if($lines[$j] =~ /^};?$/){
|
if($lines[$j] =~ /^};?$/){
|
||||||
$breakbefore = $j+1;
|
$breakbefore = $j+1;
|
||||||
|
$breaksize = 15;
|
||||||
}
|
}
|
||||||
if($lines[$j] =~ /^{$/){
|
if($lines[$j] =~ /^{$/){
|
||||||
$sawbrace = 1;
|
$sawbrace = 1;
|
||||||
|
@ -59,9 +65,12 @@ for($i=0; $i<@lines; ){
|
||||||
if($j<@lines && $lines[$j] =~ /^$/){
|
if($j<@lines && $lines[$j] =~ /^$/){
|
||||||
$lastblank = $j;
|
$lastblank = $j;
|
||||||
}
|
}
|
||||||
|
|
||||||
# If we are not putting enough on a page, try a blank line.
|
# If we are not putting enough on a page, try a blank line.
|
||||||
if($breakbefore - $i < 50 - $breaksize && $lastblank > $breakbefore && $lastblank >= $i+50 - 5){
|
if($breakbefore - $i < 50 - $breaksize && $lastblank > $breakbefore && $lastblank >= $i+50 - 5){
|
||||||
|
if($v){
|
||||||
|
print STDERR "breakbefore $breakbefore i $i breaksize $breaksize\n";
|
||||||
|
}
|
||||||
$breakbefore = $lastblank;
|
$breakbefore = $lastblank;
|
||||||
$breaksize = 5; # only 5 lines to get to blank line
|
$breaksize = 5; # only 5 lines to get to blank line
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue