commit 369cb6557e7b92268ebfdb6508eacee8803605d4
parent 613f39d285e7d5c617c34d646f443d428520a4cb
Author: Brian Swetland <swetland@frotz.net>
Date: Sat, 28 Dec 2013 04:46:07 -0800
remove packaging and printing support
This is really neat but is not going to get along well with the code
shuffling I'm doing, so just removing it for now.
Diffstat:
M | Makefile | | | 53 | ----------------------------------------------------- |
D | cuth | | | 48 | ------------------------------------------------ |
D | pr.pl | | | 36 | ------------------------------------ |
D | runoff | | | 243 | ------------------------------------------------------------------------------- |
D | runoff.list | | | 77 | ----------------------------------------------------------------------------- |
D | runoff.spec | | | 102 | ------------------------------------------------------------------------------- |
D | runoff1 | | | 108 | ------------------------------------------------------------------------------- |
D | show1 | | | 3 | --- |
D | toc.ftr | | | 13 | ------------- |
D | toc.hdr | | | 6 | ------ |
10 files changed, 0 insertions(+), 689 deletions(-)
diff --git a/Makefile b/Makefile
@@ -188,16 +188,6 @@ clean:
.gdbinit \
$(UPROGS)
-# make a printout
-FILES = $(shell grep -v '^\#' runoff.list)
-PRINT = runoff.list runoff.spec README toc.hdr toc.ftr $(FILES)
-
-xv6.pdf: $(PRINT)
- ./runoff
- ls -l xv6.pdf
-
-print: xv6.pdf
-
# run in emulators
bochs : fs.img xv6.img
@@ -235,46 +225,3 @@ qemu-nox-gdb: fs.img xv6.img .gdbinit
@echo "*** Now run 'gdb'." 1>&2
$(QEMU) -nographic $(QEMUOPTS) -S $(QEMUGDB)
-# CUT HERE
-# prepare dist for students
-# after running make dist, probably want to
-# rename it to rev0 or rev1 or so on and then
-# check in that version.
-
-EXTRA=\
- mkfs.c ulib.c user.h cat.c echo.c forktest.c grep.c kill.c\
- ln.c ls.c mkdir.c rm.c stressfs.c usertests.c wc.c zombie.c\
- printf.c umalloc.c\
- README dot-bochsrc *.pl toc.* runoff runoff1 runoff.list\
- .gdbinit.tmpl gdbutil\
-
-dist:
- rm -rf dist
- mkdir dist
- for i in $(FILES); \
- do \
- grep -v PAGEBREAK $$i >dist/$$i; \
- done
- sed '/CUT HERE/,$$d' Makefile >dist/Makefile
- echo >dist/runoff.spec
- cp $(EXTRA) dist
-
-dist-test:
- rm -rf dist
- make dist
- rm -rf dist-test
- mkdir dist-test
- cp dist/* dist-test
- cd dist-test; $(MAKE) print
- cd dist-test; $(MAKE) bochs || true
- cd dist-test; $(MAKE) qemu
-
-# update this rule (change rev#) when it is time to
-# make a new revision.
-tar:
- rm -rf /tmp/xv6
- mkdir -p /tmp/xv6
- cp dist/* dist/.gdbinit.tmpl /tmp/xv6
- (cd /tmp; tar cf - xv6) | gzip >xv6-rev5.tar.gz
-
-.PHONY: dist-test dist
diff --git a/cuth b/cuth
@@ -1,48 +0,0 @@
-#!/usr/bin/perl
-
-$| = 1;
-
-sub writefile($@){
- my ($file, @lines) = @_;
-
- sleep(1);
- open(F, ">$file") || die "open >$file: $!";
- print F @lines;
- close(F);
-}
-
-# Cut out #include lines that don't contribute anything.
-for($i=0; $i<@ARGV; $i++){
- $file = $ARGV[$i];
- if(!open(F, $file)){
- print STDERR "open $file: $!\n";
- next;
- }
- @lines = <F>;
- close(F);
-
- $obj = "$file.o";
- $obj =~ s/\.c\.o$/.o/;
- system("touch $file");
-
- if(system("make CC='gcc -Werror' $obj >/dev/null 2>\&1") != 0){
- print STDERR "make $obj failed: $rv\n";
- next;
- }
-
- system("cp $file =$file");
- for($j=@lines-1; $j>=0; $j--){
- if($lines[$j] =~ /^#include/){
- $old = $lines[$j];
- $lines[$j] = "/* CUT-H */\n";
- writefile($file, @lines);
- if(system("make CC='gcc -Werror' $obj >/dev/null 2>\&1") != 0){
- $lines[$j] = $old;
- }else{
- print STDERR "$file $old";
- }
- }
- }
- writefile($file, grep {!/CUT-H/} @lines);
- system("rm =$file");
-}
diff --git a/pr.pl b/pr.pl
@@ -1,36 +0,0 @@
-#!/usr/bin/perl
-
-use POSIX qw(strftime);
-
-if($ARGV[0] eq "-h"){
- shift @ARGV;
- $h = $ARGV[0];
- shift @ARGV;
-}else{
- $h = $ARGV[0];
-}
-
-$page = 0;
-$now = strftime "%b %e %H:%M %Y", localtime;
-
-@lines = <>;
-for($i=0; $i<@lines; $i+=50){
- print "\n\n";
- ++$page;
- print "$now $h Page $page\n";
- print "\n\n";
- for($j=$i; $j<@lines && $j<$i +50; $j++){
- $lines[$j] =~ s!//DOC.*!!;
- print $lines[$j];
- }
- for(; $j<$i+50; $j++){
- print "\n";
- }
- $sheet = "";
- if($lines[$i] =~ /^([0-9][0-9])[0-9][0-9] /){
- $sheet = "Sheet $1";
- }
- print "\n\n";
- print "$sheet\n";
- print "\n\n";
-}
diff --git a/runoff b/runoff
@@ -1,243 +0,0 @@
-#!/bin/sh
-
-echo This script takes a minute to run. Be patient. 1>&2
-
-LC_CTYPE=C export LC_CTYPE
-
-# pad stdin to multiple of 120 lines
-pad()
-{
- awk '{print} END{for(; NR%120!=0; NR++) print ""}'
-}
-
-# create formatted (numbered) files
-mkdir -p fmt
-rm -f fmt/*
-cp README fmt
-files=`grep -v '^#' runoff.list | awk '{print $1}'`
-n=99
-for i in $files
-do
- ./runoff1 -n $n $i >fmt/$i
- nn=`tail -1 fmt/$i | sed 's/ .*//; s/^0*//'`
- if [ "x$nn" != x ]; then
- n=$nn
- fi
-done
-
-# create table of contents
-cat toc.hdr >fmt/toc
-pr -e8 -t runoff.list | awk '
-/^[a-z0-9]/ {
- s=$0
- f="fmt/"$1
- getline<f
- close(f)
- n=$1
- printf("%02d %s\n", n/100, s);
- printf("TOC: %04d %s\n", n, s) >"fmt/tocdata"
- next
-}
-{
- print
-}' | pr -3 -t >>fmt/toc
-cat toc.ftr >>fmt/toc
-
-# check for bad alignments
-perl -e '
- $leftwarn = 0;
- while(<>){
- chomp;
- s!#.*!!;
- s!\s+! !g;
- s! +$!!;
- next if /^$/;
-
- if(/TOC: (\d+) (.*)/){
- $toc{$2} = $1;
- next;
- }
-
- if(/sheet1: (left|right)$/){
- print STDERR "assuming that sheet 1 is a $1 page. double-check!\n";
- $left = $1 eq "left" ? "13579" : "02468";
- $right = $1 eq "left" ? "02468" : "13579";
- next;
- }
-
- if(/even: (.*)/){
- $file = $1;
- if(!defined($toc{$file})){
- print STDERR "Have no toc for $file\n";
- next;
- }
- if($toc{$file} =~ /^\d\d[^0]/){
- print STDERR "$file does not start on a fresh page.\n";
- }
- next;
- }
-
- if(/odd: (.*)/){
- $file = $1;
- if(!defined($toc{$file})){
- print STDERR "Have no toc for $file\n";
- next;
- }
- if($toc{$file} !~ /^\d\d5/){
- print STDERR "$file does not start on a second half page.\n";
- }
- next;
- }
-
- if(/(left|right): (.*)/){
- $what = $1;
- $file = $2;
- if(!defined($toc{$file})){
- print STDERR "Have no toc for $file\n";
- next;
- }
- if($what eq "left" && !($toc{$file} =~ /^\d[$left][05]/)){
- print STDERR "$file does not start on a left page [$toc{$file}]\n";
- }
- # why does this not work if I inline $x in the if?
- $x = ($toc{$file} =~ /^\d[$right][05]/);
- if($what eq "right" && !$x){
- print STDERR "$file does not start on a right page [$toc{$file}] [$x]\n";
- }
- next;
- }
-
- print STDERR "Unknown spec: $_\n";
- }
-' fmt/tocdata runoff.spec
-
-# make definition list
-cd fmt
-perl -e '
- while(<>) {
- chomp;
-
- s!//.*!!;
- s!/\*([^*]|[*][^/])*\*/!!g;
- s!\s! !g;
- s! +$!!;
-
- # look for declarations like char* x;
- if (/^[0-9]+ typedef .* u(int|short|long|char);/) {
- next;
- }
- if (/^[0-9]+ extern/) {
- next;
- }
- if (/^[0-9]+ struct [a-zA-Z0-9_]+;/) {
- next;
- }
- if (/^([0-9]+) #define +([A-za-z0-9_]+) +?\(.*/) {
- print "$1 $2\n"
- }
- 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";
- }
-
- if(/^^([0-9]+) \.globl ([a-zA-Z0-9_]+)/){
- $isglobl{$2} = 1;
- }
- if(/^^([0-9]+) ([a-zA-Z0-9_]+):$/ && $isglobl{$2}){
- print "$1 $2\n";
- }
-
- if (/\(/) {
- next;
- }
-
- if (/^([0-9]+) (((static|struct|extern|union|enum) +)*([A-Za-z0-9_]+))( .*)? +([A-Za-z_][A-Za-z0-9_]*)(,|;|=| =)/) {
- print "$1 $7\n";
- }
-
- elsif(/^([0-9]+) (enum|struct|union) +([A-Za-z0-9_]+) +{/){
- print "$1 $3\n";
- }
- # TODO: enum members
- }
-' $files >defs
-
-(for i in $files
-do
- case "$i" in
- *.S)
- cat $i | sed 's;#.*;;; s;//.*;;;'
- ;;
- *)
- cat $i | sed 's;//.*;;; s;"([^"\\]|\\.)*";;;'
- esac
-done
-) >alltext
-
-perl -n -e 'print if s/^([0-9]+ [a-zA-Z0-9_]+)\(.*$/\1/;' alltext |
- egrep -v ' (STUB|usage|main|if|for)$' >>defs
-#perl -n -e 'print if s/^([0-9]+) STUB\(([a-zA-Z0-9_]+)\)$/\1 \2/;' alltext \
-# >>defs
-(
->s.defs
-
-# make reference list
-for i in `awk '{print $2}' defs | sort -f | uniq`
-do
- defs=`egrep '^[0-9]+ '$i'( |$)' defs | awk '{print $1}'`
- echo $i $defs >>s.defs
- uses=`egrep -h '([^a-zA-Z_0-9])'$i'($|[^a-zA-Z_0-9])' alltext | awk '{print $1}'`
- if [ "x$defs" != "x$uses" ]; then
- echo $i $defs
- echo $uses |fmt -29 | sed 's/^/ /'
-# else
-# echo $i defined but not used >&2
- fi
-done
-) >refs
-
-# build defs list
-awk '
-{
- printf("%04d %s\n", $2, $1);
- for(i=3; i<=NF; i++)
- printf("%04d \" \n", $i);
-}
-' s.defs > t.defs
-
-# format the whole thing
-(
- ../pr.pl README
- ../pr.pl -h "table of contents" toc
- # pr -t -2 t.defs | ../pr.pl -h "definitions" | pad
- pr -t -l50 -2 refs | ../pr.pl -h "cross-references" | pad
- # pr.pl -h "definitions" -2 t.defs | pad
- # pr.pl -h "cross-references" -2 refs | pad
- for i in $files
- do
- ../pr.pl -h "xv6/$i" $i
- done
-) | mpage -m50t50b -o -bLetter -T -t -2 -FCourier -L60 >all.ps
-grep Pages: all.ps
-
-# if we have the nice font, use it
-nicefont=LucidaSans-Typewriter83
-if [ ! -f ../$nicefont ]
-then
- if git cat-file blob font:$nicefont > ../$nicefont~; then
- mv ../$nicefont~ ../$nicefont
- fi
-fi
-if [ -f ../$nicefont ]
-then
- echo nicefont
- (sed 1q all.ps; cat ../$nicefont; sed "1d; s/Courier/$nicefont/" all.ps) >allf.ps
-else
- echo ugly font!
- cp all.ps allf.ps
-fi
-ps2pdf allf.ps ../xv6.pdf
-cd ..
-pdftops xv6.pdf xv6.ps
diff --git a/runoff.list b/runoff.list
@@ -1,77 +0,0 @@
-# basic headers
-types.h
-param.h
-memlayout.h
-defs.h
-x86.h
-asm.h
-mmu.h
-elf.h
-
-# entering xv6
-entry.S
-entryother.S
-main.c
-
-# locks
-spinlock.h
-spinlock.c
-
-# processes
-vm.c
-proc.h
-proc.c
-swtch.S
-kalloc.c
-
-# system calls
-traps.h
-vectors.pl
-trapasm.S
-trap.c
-syscall.h
-syscall.c
-sysproc.c
-
-# file system
-buf.h
-fcntl.h
-stat.h
-fs.h
-file.h
-ide.c
-bio.c
-log.c
-fs.c
-file.c
-sysfile.c
-exec.c
-
-# pipes
-pipe.c
-
-# string operations
-string.c
-
-# low-level hardware
-mp.h
-mp.c
-lapic.c
-ioapic.c
-picirq.c
-kbd.h
-kbd.c
-console.c
-timer.c
-uart.c
-
-# user-level
-initcode.S
-usys.S
-init.c
-sh.c
-
-# bootloader
-bootasm.S
-bootmain.c
-
diff --git a/runoff.spec b/runoff.spec
@@ -1,102 +0,0 @@
-# Is sheet 01 (after the TOC) a left sheet or a right sheet?
-sheet1: right
-
-# "left" and "right" specify which page of a two-page spread a file
-# must start on. "left" means that a file must start on the first of
-# the two pages. "right" means it must start on the second of the two
-# pages. The file may start in either column.
-#
-# "even" and "odd" specify which column a file must start on. "even"
-# means it must start in the left of the two columns (00). "odd" means it
-# must start in the right of the two columns (50).
-#
-# You'd think these would be the other way around.
-
-# types.h either
-# param.h either
-# defs.h either
-# x86.h either
-# asm.h either
-# mmu.h either
-# elf.h either
-# mp.h either
-
-even: entry.S # mild preference
-even: entryother.S # mild preference
-even: main.c
-# mp.c don't care at all
-# even: initcode.S
-# odd: init.c
-
-left: spinlock.h
-even: spinlock.h
-
-# This gets struct proc and allocproc on the same spread
-left: proc.h
-even: proc.h
-
-# goal is to have two action-packed 2-page spreads,
-# one with
-# userinit growproc fork exit wait
-# and another with
-# scheduler sched yield forkret sleep wakeup1 wakeup
-right: proc.c # VERY important
-even: proc.c # VERY important
-
-# A few more action packed spreads
-# page table creation and process loading
-# walkpgdir mappages setupkvm switch[ku]vm inituvm (loaduvm)
-# process memory management
-# allocuvm deallocuvm freevm
-left: vm.c
-
-even: kalloc.c # mild preference
-
-# syscall.h either
-# trapasm.S either
-# traps.h either
-# even: trap.c
-# vectors.pl either
-# syscall.c either
-# sysproc.c either
-
-# buf.h either
-# dev.h either
-# fcntl.h either
-# stat.h either
-# file.h either
-# fs.h either
-# fsvar.h either
-# left: ide.c # mild preference
-even: ide.c
-# odd: bio.c
-
-# log.c fits nicely in a spread
-even: log.c
-left: log.c
-
-# with fs.c starting on 2nd column of a left page, we get these 2-page spreads:
-# ialloc iupdate iget idup ilock iunlock iput iunlockput
-# bmap itrunc stati readi writei
-# namecmp dirlookup dirlink skipelem namex namei
-# fileinit filealloc filedup fileclose filestat fileread filewrite
-# starting on 2nd column of a right page is not terrible either
-odd: fs.c # VERY important
-left: fs.c # mild preference
-# file.c either
-# exec.c either
-# sysfile.c either
-
-# Mild preference, but makes spreads of mp.c, lapic.c, and ioapic.c+picirq.c
-even: mp.c
-left: mp.c
-
-# even: pipe.c # mild preference
-# string.c either
-# left: kbd.h # mild preference
-even: kbd.h
-even: console.c
-odd: sh.c
-
-even: bootasm.S # mild preference
-even: bootmain.c # mild preference
diff --git a/runoff1 b/runoff1
@@ -1,108 +0,0 @@
-#!/usr/bin/perl
-
-$n = 0;
-$v = 0;
-if($ARGV[0] eq "-v") {
- $v = 1;
- shift @ARGV;
-}
-if($ARGV[0] eq "-n") {
- $n = $ARGV[1];
- shift @ARGV;
- shift @ARGV;
-}
-$n = int(($n+49)/50)*50 - 1;
-
-$file = $ARGV[0];
-@lines = <>;
-$linenum = 0;
-foreach (@lines) {
- $linenum++;
- chomp;
- s/\s+$//;
- if(length() >= 75){
- print STDERR "$file:$linenum: line too long\n";
- }
-}
-@outlines = ();
-$nextout = 0;
-
-for($i=0; $i<@lines; ){
- # Skip leading blank lines.
- $i++ while $i<@lines && $lines[$i] =~ /^$/;
- last if $i>=@lines;
-
- # If the rest of the file fits, use the whole thing.
- if(@lines <= $i+50 && !grep { /PAGEBREAK/ } @lines){
- $breakbefore = @lines;
- }else{
- # Find a good next page break;
- # Hope for end of function.
- # but settle for a blank line (but not first blank line
- # in function, which comes after variable declarations).
- $breakbefore = $i;
- $lastblank = $i;
- $sawbrace = 0;
- $breaksize = 15; # 15 lines to get to function
- for($j=$i; $j<$i+50 && $j < @lines; $j++){
- if($lines[$j] =~ /PAGEBREAK!/){
- $lines[$j] = "";
- $breakbefore = $j;
- $breaksize = 100;
- last;
- }
- if($lines[$j] =~ /PAGEBREAK:\s*([0-9]+)/){
- $breaksize = $1;
- $breakbefore = $j;
- $lines[$j] = "";
- }
- if($lines[$j] =~ /^};?$/){
- $breakbefore = $j+1;
- $breaksize = 15;
- }
- if($lines[$j] =~ /^{$/){
- $sawbrace = 1;
- }
- if($lines[$j] =~ /^$/){
- if($sawbrace){
- $sawbrace = 0;
- }else{
- $lastblank = $j;
- }
- }
- }
- if($j<@lines && $lines[$j] =~ /^$/){
- $lastblank = $j;
- }
-
- # 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($v){
- print STDERR "breakbefore $breakbefore i $i breaksize $breaksize\n";
- }
- $breakbefore = $lastblank;
- $breaksize = 5; # only 5 lines to get to blank line
- }
-
- # If we are not putting enough on a page, force a full page.
- if($breakbefore - $i < 50 - $breaksize && $breakbefore != @lines){
- $breakbefore = $i + 50;
- $breakbefore = @lines if @lines < $breakbefore;
- }
-
- if($breakbefore < $i+2){
- $breakbefore = $i+2;
- }
- }
-
- # Emit the page.
- $i50 = $i + 50;
- for(; $i<$breakbefore; $i++){
- printf "%04d %s\n", ++$n, $lines[$i];
- }
-
- # Finish page
- for($j=$i; $j<$i50; $j++){
- printf "%04d \n", ++$n;
- }
-}
diff --git a/show1 b/show1
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-runoff1 "$@" | pr.pl -h "xv6/$@" | mpage -m50t50b -o -bLetter -T -t -2 -FLucidaSans-Typewriter83 -L60 >x.ps; gv --swap x.ps
diff --git a/toc.ftr b/toc.ftr
@@ -1,13 +0,0 @@
-
-
-The source listing is preceded by a cross-reference that lists every defined
-constant, struct, global variable, and function in xv6. Each entry gives,
-on the same line as the name, the line number (or, in a few cases, numbers)
-where the name is defined. Successive lines in an entry list the line
-numbers where the name is used. For example, this entry:
-
- swtch 2658
- 0374 2428 2466 2657 2658
-
-indicates that swtch is defined on line 2658 and is mentioned on five lines
-on sheets 03, 24, and 26.
diff --git a/toc.hdr b/toc.hdr
@@ -1,6 +0,0 @@
-The numbers to the left of the file names in the table are sheet numbers.
-The source code has been printed in a double column format with fifty
-lines per column, giving one hundred lines per sheet (or page).
-Thus there is a convenient relationship between line numbers and sheet numbers.
-
-