Skip to content
Snippets Groups Projects
Commit 26dfb4c8 authored by rsc's avatar rsc
Browse files

runoff fixes

parent 2a55cc55
No related branches found
No related tags found
No related merge requests found
...@@ -42,44 +42,50 @@ pr -e8 -t runoff.list | awk ' ...@@ -42,44 +42,50 @@ pr -e8 -t runoff.list | awk '
# make definition list # make definition list
cd fmt cd fmt
awk ' perl -e '
/^[0-9]+ [A-Za-z0-9_]+ .*[A-Za-z0-9_].*;/ { while(<>) {
s=$0; chomp;
sub(/\[.*/, "", s);
sub(/\(.*/, "", s); s!//.*!!;
sub(/ *=.*/, "", s); s!/\*([^*]|[*][^/])*\*/!!g;
sub(/.* \**/, "", s); s!\s! !g;
sub(/;.*/, "", s); s! +$!!;
print $1, s
} # look for declarations like char* x;
$2=="#define" { if (/^[0-9]+ typedef .* u(int|short|long|char);/) {
if($3 ~ /\(/){ next;
sub(/\(.*/, "", $3); print $1, $3
} else {
s = ""
for(i=4; i<=NF; i++){
s = s $i
}
print $1, $3, s
} }
} if (/^[0-9]+ extern/) {
$2=="enum" { inenum = 1; v=-1; } next;
$2 == "};" { inenum = 0; } }
inenum && $2 ~ /^[A-Z][a-zA-Z0-9_]+$/ { if (/^[0-9]+ struct [a-zA-Z0-9_]+;/) {
if($3 == "="){ next;
s = "" }
for(i=4; i<=NF; i++){ if (/\(/) {
s = s " " $i next;
} }
sub(/,$/, "", s);
sub(/^ /, "", s); if (/^([0-9]+) (((static|struct|extern|union|enum) +)*([A-Za-z0-9_]+))( .*)? +([A-Za-z_][A-Za-z0-9_]*)[,;]/) {
v = s;
}else print "$1 $7\n"
v++; }
print $1, $2, v;
} elsif (/^([0-9]+) #define +([A-za-z0-9_]+) +?\(.*/) {
$2=="struct" && $3 ~ /^[A-Z][a-zA-Z0-9_]+$/ { print "$1 $2\n"
print $1, $3; }
elsif (/^([0-9]+) #define +([A-Za-z0-9_]+) +([^ ]+)$/) {
print "$1 $2 $3\n";
}
elsif (/^([0-9]+) #define +([A-Za-z0-9_]+)/) {
print "$1 $2\n";
}
elsif(/^([0-9]+) (enum|struct|union) +([A-Za-z0-9_]+) +{/){
print "$1 $3\n";
}
# TODO: enum members
} }
' $files >defs ' $files >defs
...@@ -110,12 +116,15 @@ awk ' ...@@ -110,12 +116,15 @@ awk '
# format the whole thing # format the whole thing
( (
pr -l60 -e4 README pr -l60 -e8 README
pr -l60 -e4 toc pr -l60 -e8 -2 toc
pr -l60 -h "definitions" -2 t.defs | pad pr -l60 -h "definitions" -2 t.defs | pad
pr -l60 -h "cross-references" -2 refs | pad pr -l60 -h "cross-references" -2 refs | pad
pr -l60 -e4 $files for i in $files
) | mpage -m50t50b -o -bLetter -t -2 -FCourier -L60 >all.ps do
cat $i | pr -l60 -e8 -h "xv6/$i"
done
) | mpage -m50t50b -o -bLetter -T -t -2 -FCourier -L60 >all.ps
grep Pages: all.ps grep Pages: all.ps
# if we have the nice font, use it # if we have the nice font, use it
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment