Whamcloud - gitweb
Changebar support for lustre.pdf. Check out the old doc directory into doc/doc.old...
authorgord-fig <gord-fig>
Thu, 8 Aug 2002 21:49:26 +0000 (21:49 +0000)
committergord-fig <gord-fig>
Thu, 8 Aug 2002 21:49:26 +0000 (21:49 +0000)
lustre/doc/Makefile.am
lustre/doc/chbar.sh [new file with mode: 0755]

index 7081923..eadb6b6 100644 (file)
@@ -3,9 +3,11 @@
 # This code is issued under the GNU General Public License.
 # See the file COPYING in this distribution
 LYX2PDF = lyx --export pdf
+LYX2PS = lyx --export ps
+LYX2TEX = lyx --export latex
 LYX2TXT = lyx --export text
 LYX2HTML = lyx --export html
-SUFFIXES = .lin .lyx .pdf .sgml .html .txt .fig .eps
+SUFFIXES = .lin .lyx .pdf .ps .sgml .html .txt .tex .fig .eps
 
 DOCS = lustre.pdf lustre-HOWTO.txt
 IMAGES =  cache1.eps cache2.eps intermezzocache.eps intermezzofilesys.eps meta.eps metadata1.eps networklayer.eps bigpicture.eps intermezzo.eps mds.eps portals.eps client.eps layering.eps metadata.eps sb.eps cow.eps lockacq.eps obdfs.eps snapsetup.eps dirbodyapi.eps loraid.eps ost.eps updates.eps hotmigrate.eps lustreclusters.eps osthw.eps portals-lib.eps lockqueues.eps lockexample1.eps lockexample2.eps lockexample3.eps lockexample4.eps lockseverity.eps
@@ -17,7 +19,7 @@ LYXFILES= lustre.lin evolution.lyx  llocks.lyx mgmt.lyx uncertain.lyx\
 MAINTAINERCLEANFILES =  $(IMAGES) $(DOCS) $(GENERATED)
 GENERATED = lustre-HOWTO.lyx lustre.lyx
 
-EXTRA_DIST = $(DOCS) $(IMAGES) $(LYXFILES) lustre.bib
+EXTRA_DIST = lyxchbar.sh chbar.sh $(DOCS) $(IMAGES) $(LYXFILES) lustre.bib
 
 all: $(DOCS)
 
@@ -34,6 +36,12 @@ $(GENERATED) : %.lyx: %.lin Makefile
 .lyx.pdf:
        @$(LYX2PDF) $< || printf "\n*** Warning: not creating PDF docs; install lyx to rectify this\n"
 
+.lyx.ps:
+       @$(LYX2PS) $< || printf "\n*** Warning: not creating PostScript docs; install lyx to rectify this\n"
+
+.lyx.tex:
+       @$(LYX2TEX) $< || printf "\n*** Warning: not creating LaTeX docs; install lyx to rectify this\n"
+
 .lyx.txt:
        @$(LYX2TXT) $< || printf "\n*** Warning: not creating text docs; install lyx to rectify this\n"
 
@@ -47,6 +55,21 @@ lustre.pdf lustre.txt lustre.html: $(IMAGES) lustre-HOWTO.lyx
 syncweb: lustre.pdf
        cp lustre.pdf /usr/src/www/content/lustre/docs/lustre.pdf
        ( cd /usr/src/www ; make lustre ; make synclustre )
+.PHONY: syncweb chbar
+
+# Build a changebar document from the files in doc.old and this directory.
+chbar: lustre-chbar.pdf
+lustre-chbar.pdf: lyxchbar.sh chbar.sh lustre.bib
+lustre-chbar.pdf: $(addprefix doc.old/,$(LYXFILES)) $(LYXFILES)
+       rm -rf doc.chbar
+       mkdir doc.chbar
+       for f in $(LYXFILES); do \
+         $(SHELL) $(srcdir)/lyxchbar.sh doc.old/$$f $$f > doc.chbar/$$f; \
+       done
+       (cd doc.chbar && ln -s ../lustre.bib lustre.bib)
+       (cd doc.chbar && make -f ../Makefile top_srcdir=../.. top_builddir=../.. srcdir=.. VPATH=.. lustre.pdf)
+       cp -p doc.chbar/lustre.pdf lustre-chbar.pdf
+       #rm -rf doc.chbar
 
 dist-hook:
        rm -rf $(distdir)/figs/CVS
diff --git a/lustre/doc/chbar.sh b/lustre/doc/chbar.sh
new file mode 100755 (executable)
index 0000000..8a16d0d
--- /dev/null
@@ -0,0 +1,105 @@
+#! /bin/sh
+#      Gadget to take two LaTeX files and produce a third which
+#      has changebars highlighting the difference between them.
+#
+# Version 1.1
+# Author:
+#      Don Ward, Careful Computing (don@careful.co.uk)
+# v1.0 April 1989
+# v1.1  Feb 93 Amended to use changebar.sty (v3.0) and dvips
+#
+# Useage:
+#      chbar file1 file2 [output]
+#              (default output is stdout)
+#      chbar old
+#              (new file on stdin, output on stdout)
+#
+# Method:
+# 1    Use diff to get an ed script to go from file1 to file2.
+# 2    Breathe on it a bit (with sed) to insert changebar commands.
+# 3    Apply modified ed script to produce (nearly) the output.
+# 4    Use awk to insert the changebars option into the \documentstyle
+#      and to handle changebar commands inside verbatim environments.
+# 5     Remove changebars before \begin{document} with sed
+if test $# -eq 0
+then cat <<\xEOF
+Useage:
+       chbars old new [output]
+       chbars old
+xEOF
+exit 0
+fi
+#      Strictly speaking, should check that $TMP doesn't exist already.
+TMP=/tmp/chb-$$
+export TMP
+OLD=$1
+if test $# -eq 1
+then   NEW="-";        # arg is old file, take new from stdin
+else   NEW=$2 ; 
+fi  
+#
+#      sed commands to edit ed commands to edit old file
+cat <<\xEOF > $TMP
+/^\.$/i\
+\\cbend{}%
+/^[0-9][0-9]*[ac]$/a\
+\\cbstart{}%
+/^[0-9][0-9]*,[0-9][0-9]*[ac]$/a\
+\\cbstart{}%
+/^[0-9][0-9]*d$/a\
+i\
+\\cbdelete{}%\
+.
+/^[0-9][0-9]*,[0-9][0-9]*d$/a\
+i\
+\\cbdelete{}%\
+.
+xEOF
+diff -b -e $OLD $NEW | ( sed -f $TMP ; echo w ${TMP}1 ; echo q ) | ed - $OLD
+#      awk commands to insert Changebars style and to protect
+#      changebar commands in verbatim environments
+#       and to tell what driver is in use
+cat <<\xEOF >$TMP
+/^\\documentstyle/{
+  if (index($0, "changebar") == 0 ) {
+    opts = index($0, "[")
+    if (opts > 0)
+       printf "%schangebar,%s",substr($0,1,opts),substr($0,opts+1)
+    else
+       printf "\\documentstyle[changebar]%s\n", substr($0,15)
+    next
+  }
+}
+/\\begin{document}/ {print "%\\driver{dvips}"}
+/\\begin{verbatim}/{++nesting}
+/\\end{verbatim}/{--nesting}
+/\\cbstart{}%|\\cbend{}%|\cbdelete{}%/ {
+  if ( nesting > 0) {
+#      changebar command in a verbatim environment: Temporarily exit,
+#      do the changebar command and reenter.
+#
+#      The obvious ( printf "\\end{verbatim}%s\\begin{verbatim} , $0 )
+#      leaves too much vertical space around the changed line(s).
+#      The following magic seeems to work
+#
+       print  "\\end{verbatim}\\nointerlineskip"
+       print  "\\vskip -\\ht\\strutbox\\vskip -\\ht\\strutbox"
+       printf "\\vbox to 0pt{\\vskip \\ht\\strutbox%s\\vss}\n", $0
+       print  "\\begin{verbatim}"
+       next
+       }
+}
+{ print $0 }
+xEOF
+awk -f $TMP ${TMP}1 >${TMP}2
+#    sed commands to clean up unwanted changebars
+#    (those before \begin{document})
+# cat <<xEOF >$TMP
+# 1,/\\begin{document}/s/\\\\cb[sed][tne][adl][^{}]*{}%$/%/
+# xEOF
+# if test $# -le 2 || test $3 = '-'
+# then  sed -f $TMP ${TMP}2
+# else  sed -f $TMP ${TMP}2 >$3
+# fi
+#rm $TMP ${TMP}[0-9]
+cat ${TMP}2