#! /bin/sh
# This is a shell archive.  The files and directories it contains
# may be unpacked by running it through /bin/sh.
# Packaged by oscar at cuisun48 on Thu Dec 6 11:19:04 MET 1990
# Contents:
# drwxr-xr-x  2 oscar         512 Dec  6 11:18 Bib
# -rw-r--r--  1 oscar        2369 Dec  6 11:13 Bib/README.fm
# -rwxr-xr-x  1 oscar        4409 Dec  6 10:29 Bib/accent
# -rw-r--r--  1 oscar        3644 Dec  6 10:29 Bib/accent.mml
# -rwxr-xr-x  1 oscar        1693 Dec  6 10:28 Bib/bib
# -rwxr-xr-x  1 oscar        3109 Dec  6 10:28 Bib/bib2mml
# -rwxr-xr-x  1 oscar        3119 Dec  6 10:28 Bib/bib2ms
# -rwxr-xr-x  1 oscar        3387 Dec  6 10:28 Bib/bib2tex
# -rwxr-xr-x  1 oscar         930 Dec  6 10:28 Bib/bibsearch
# -rwxr-xr-x  1 oscar         590 Dec  6 11:14 Bib/code
# -rwxr-xr-x  1 oscar         887 Dec  6 10:43 Bib/lbl
# -rwxr-xr-x  1 oscar         540 Dec  6 10:43 Bib/lchar
# -rwxr-xr-x  1 oscar        3582 Dec  6 10:28 Bib/ms2mml
# -rwxr-xr-x  1 oscar        1575 Dec  6 10:28 Bib/rec
# -rw-r--r--  1 oscar        2371 Dec  6 10:53 Bib/ref.mif
# -rwxr-xr-x  1 oscar         858 Dec  6 10:28 Bib/rgrep
# -rwxr-xr-x  1 oscar         463 Dec  6 10:28 Bib/rsort
# -rwxr-xr-x  1 oscar         857 Dec  6 10:28 Bib/rsplit
# -rwxr-xr-x  1 oscar        1152 Dec  6 10:43 Bib/vlbl
echo mkdir Bib
mkdir Bib
if test -f Bib/README.fm
then echo 'shar: Bib/README.fm -- file exists'
else echo x - Bib/README.fm
sed 's/^|//' > Bib/README.fm << 'eof'
|
|The shell and awk scripts provided here will translate refer files to
|various formats including TeX and Framemaker MML format.  The translation
|scripts attempt to properly introduce italics, quotation marks and accents.
|The main script is called "bib" and takes various options.  To generate
|an MML file from a file "refs" of references, simply run:
|
|	bib -f refs > refs.mml
|
|Installation:
|1. Put the file "accent.mml" in a public directory.
|2. Set the variable FMDIR in "accent" to point here.
|3. Define a paragraph tag <Reference> to be used in your documents.
|	[For an example see ref.mif.  You may also define a tag
|	<UnNumRef> for unnumbered references.  Use "bib -fl"
|	to get the alternative tag.]
|
|Some other useful scripts are provided for manipulating refer files and
|for generating MML files from text or from (pseudo) troff -ms source.
|
|Description:
|	bib	-- format file of refer records (various options)
|
|	rgrep	-- grep a file of records
|	rsort	-- sort a file of records
|	rsplit	-- split a file of records by a keyword
|
|	code	-- generate mml from ascii text (e.g., programs)
|	ms2mml	-- generate mml from troff (subset of -ms macros)
|
|Files:
|	accent.mml -- accent macros for Framemaker
|	ref.mif	-- example <Reference> and <UnNumRef> paragraph tags
|
|Utilities:
|	accent	-- filter accents for tex, ms etc.
|	bib2mml	-- generate mml from refer files
|	bib2ms	-- generate ms from refer
|	bib2tex	-- generate tex thebibliography from refer
|	bibsearch -- search for labels (within [] or \cite{})
|	lbl	-- generate labels
|	lchar	-- disambiguate labels
|	rec	-- compress & expand record files (used by rgrep etc.)
|	vlbl	-- generate verbose labels
|
|Note: The "code" and "ms2mml" scripts assume the existence of various
|standard paragraph tags like <Title>, <Section> etc.  You can either
|edit the scripts to use the tags you have defined, or rename the tags
|you use to conform to those used by the script ...
|
|-------------------------------------------------------------------
|Dr. O.M. Nierstrasz                 | Tel:    41 (22) 787.65.80
|University of Geneva                | Fax:            735.39.05
|Centre Universitaire d'Informatique | Home:           733.95.68
|12 rue du Lac, CH-1207 Geneva       | E-mail: oscar@cui.unige.ch
|SWITZERLAND                         |         oscar@cgeuge51.bitnet
|-------------------------------------------------------------------
|
eof
if test `wc -c < Bib/README.fm` -ne 2369
then echo 'shar: Bib/README.fm damaged (should be 2369 bytes)'
fi
fi
if test -f Bib/accent
then echo 'shar: Bib/accent -- file exists'
else echo x - Bib/accent
sed 's/^|//' > Bib/accent << 'eof'
|#! /bin/sh
|# accent
|
|# Filter "dead-key" conventions to produce the right
|# sequences for TeX, Framemaker mml files or troff.
|
|# Examples:
|# acute accent:	\'a
|# grave accent:	\`e
|# circumflex:	\^o (or \<o)
|# dieresis:	\"u (or \:u)
|# tilde:	\~n
|# cedilla:	\,c
|# slash:	\/o
|
|# Uses: accent.mml
|
|# Author: Oscar Nierstrasz (Revised: Jan 1990)
|
|# Location of accent.mml:
|FMDIR=/u1/oscar/Framemaker
|
|u='Usage: accent [<mode>] [<files> ...]
|	-strip	-- translate umlauts and delete rest
|	-ms	-- generate troff -ms (.AM) accents
|	-tex	-- generate TeX accents
|	-mml	-- generate FrameMaker accents
|	-o	-- use overstrike macros
|	-nix	-- undo Nixdorf macros
|'
|
|# FrameMaker accents
|accent="<Include ${FMDIR}/accent.mml>"
|mode=-ms # default
|sed="exec /bin/sed"
|
|for arg
|do
|	case $arg in
|	-strip ) mode=$arg ;;
|	-ms )	mode=$arg ;;
|	-tex )	mode=$arg ;;
|	-mml )	mode=$arg ;;
|	-nix )	mode=$arg ;;
|	-[ol] )	mode=$arg ;;
|	-* )	echo "$u" 1>&2 ; exit ;;
|	* )	files="$files $arg" ;;
|	esac
|done
|
|case $mode in
|
|# Translate umlauts on a, e and u, and chuck the rest:
|-strip )
|$sed	-e	's/\\:\([AOUaou]\)/\1e/g'			\
|	-e	's/\\"\([AOUaou]\)/\1e/g'			\
|	-e	's/\\.//g'					\
|	$files
|	;;
|
|# This generates framemaker mml instructions.
|# Assumes existence of accent macros.
|-mml )	echo "$accent"
|$sed	-e	's/\\'\''\([aeiou]\)/<\1acute>/g'		\
|	-e	's/\\`\([aeiou]\)/<\1grave>/g'			\
|	-e	's/\\[\^<]\([aeiou]\)/<\1circumflex>/g'		\
|	-e	's/\\:\([aeiou]\)/<\1dieresis>/g'		\
|	-e	's/\\"\([aeiou]\)/<\1dieresis>/g'		\
|	-e	's/\\~\([aon]\)/<\1tilde>/g'			\
|	-e	's/\\,\([c]\)/<\1cedilla>/g'			\
|	-e	's/\\\/\([o]\)/<\1slash>/g'			\
|	-e	's/``/<quotedblleft>/g'				\
|	-e	's/'\'\''/<quoteblright>/g'			\
|	-e	's/--/<endash>/g'				\
|	$files
|	;;
|
|# For TeX -- no special macros needed.
|# NB: first three sed lines duplicate some of the functionality
|# of texchars.  Can't use accent and texchars together, because
|# accent generates TeX code which would be escaped by texchars.
|# We assume that certain special characters (backslash, tilde, etc.)
|# only occur in the input as accent macros.
|
|-tex )
|$sed	-e	's/\$/\\$/g'					\
|	-e	's/[&#_]/\\&/g'					\
|	-e	's/[<>=|][<>=|]*/$&$/g'				\
|	-e	's/\\\(['\''`^"]\)\([aeou]\)/\\\1{\2}/g'	\
|	-e	's/\\<\([aeou]\)/\\^{\1}/g'			\
|	-e	's/\\\(['\''`^"]\)i/\\\1{\\i}/g'		\
|	-e	's/\\<i/\\^{\\i}/g'				\
|	-e	's/\\:\([aeou]\)/\\"{\1}/g'			\
|	-e	's/\\:i/\\"{\\i}/g'				\
|	-e	's/\\~\([aon]\)/\\~{\1}/g'			\
|	-e	's/\\,\([c]\)/\\c{\1}/g'			\
|	-e	's/\\\/\([o]\)/{\\o}/g'				\
|	$files
|	;;
|
|# Assumes new -ms accent macros loaded with .AM
|-ms )
|$sed	-e	's/\\'\''\([aeiou]\)/\1\\*'\''/g'		\
|	-e	's/\\`\([aeiou]\)/\1\\*`/g'			\
|	-e	's/\\[\^<]\([aeiou]\)/\1\\*^/g'			\
|	-e	's/\\:\([aeiou]\)/\1\\*:/g'			\
|	-e	's/\\"\([aeiou]\)/\1\\*:/g'			\
|	-e	's/\\:\([AOU]\)/\1e/g'				\
|	-e	's/\\"\([AOU]\)/\1e/g'				\
|	-e	's/\\~\([aon]\)/\1\\*~/g'			\
|	-e	's/\\,\([c]\)/\1\\*,/g'				\
|	-e	's/\\\/\([o]\)/\1\\*\//g'			\
|	$files
|	;;
|
|# Actually, it seems Nixdorf's accents are the same as Dimitri's ...
|-nix )
|$sed	-e	's/\\\*\([aeiouAEIOU]\)/\\"\1/g'		\
|	$files
|	;;
|
|# Use (dimitri's) accent macros: (see below)
|-d )	
|$sed	-e	's/\\'\''\([aeiou]\)/\\\*(\1'\''/g'		\
|	-e	's/\\`\([aeiou]\)/\\\*(\1`/g'			\
|	-e	's/\\[\^<]\([aeiou]\)/\\\*(\1^/g'		\
|	-e	's/\\:\([aeiou]\)/\\\*(\1"/g'			\
|	-e	's/\\"\([aeiou]\)/\\\*(\1"/g'			\
|	-e	's/\\~\([an]\)/\\\*(\1~/g'			\
|	-e	's/\\,\([c]\)/\\\*(\1,/g'			\
|	-e	's/\\\/\([o]\)/\\\*(\1\//g'			\
|	$files
|	;;
|
|# Use overstrikes directly (same as dimitri's macros):
|-o )	
|$sed	-e	's/\\'\''\([aeiou]\)/\\o\\\1/g'		\
|	-e	's/\\`\([aeiou]\)/\\o\\(ga\1/g'		\
|	-e	's/\\[\^<]\([aeiou]\)/\\o^\1/g'		\
|	-e	's/\\[:"]\([aeiou]\)/\\o\\(um\1/g'		\
|	-e	's/\\~\([an]\)/\\o~\1/g'			\
|	-e	's/\\,\([c]\)/\\o\\(cdc/g'			\
|	-e	's/\\\/\([o]\)/\\o\/\1/g'			\
|	$files | tr '\01' \'
|	;;
|
|esac
|
|exit
|
|.\" Authors: Dimitri Konstantas and Oscar Nierstrasz (Nov. 10, 1988)
|.\" 
|.\"  ACCENTS   an old funny way which works!!
|.\"  say \*(e' to get e grave
|.\"
|.\" Modified Aug 23 1989 by Oscar to add missing accents
|.\" Bugs:
|.\" - Missing "i" w/o dot for \'i etc.
|.ds a' \o'\'a'
|.ds e' \o'\'e'
|.ds i' \o'\'i'
|.ds o' \o'\'o'
|.ds u' \o'\'u'
|.ds a` \o'\(gaa'
|.ds e` \o'\(gae'
|.ds i` \o'\(gai'
|.ds o` \o'\(gao'
|.ds u` \o'\(gau'
|.ds a^ \o'^a'
|.ds e^ \o'^e'
|.ds i^ \o'^i'
|.ds o^ \o'^o'
|.ds u^ \o'^u'
|.ds a" \o'\(uma'
|.ds e" \o'\(ume'
|.ds i" \o'\(umi'
|.ds o" \o'\(umo'
|.ds u" \o'\(umu'
|.ds a~ \o'~a'
|.ds n~ \o'~n'
|.ds c, \o'\(cdc'
|.ds o/ \o'/o'
|
eof
if test `wc -c < Bib/accent` -ne 4409
then echo 'shar: Bib/accent damaged (should be 4409 bytes)'
fi
fi
if test -f Bib/accent.mml
then echo 'shar: Bib/accent.mml -- file exists'
else echo x - Bib/accent.mml
sed 's/^|//' > Bib/accent.mml << 'eof'
|<MML 1.0 Accent macros>
|<Comment "copied from Oscar Nierstrasz, corrected and completed by E. Casais">
|
|<!DefineMacro UAgrave       "<Character \\xcb >" >
|<!DefineMacro UAacute       "<Character \\xe7 >" >
|<!DefineMacro UAcircumflex  "<Character \\xe5 >" >
|<!DefineMacro UAtilde       "<Character \\xcc >" >
|<!DefineMacro UAdieresis    "<Character \\x80 >" >
|<!DefineMacro UAring        "<Character \\x81 >" >
|<!DefineMacro UAE           "<Character \\xae >" >
|
|<!DefineMacro agrave        "<Character \\x88 >" >
|<!DefineMacro aacute        "<Character \\x87 >" >
|<!DefineMacro acircumflex   "<Character \\x89 >" >
|<!DefineMacro atilde        "<Character \\x8b >" >
|<!DefineMacro adieresis     "<Character \\x8a >" >
|<!DefineMacro aring         "<Character \\x8c >" >
|<!DefineMacro ae	    "<Character \\xbe >" >
|
|
|<!DefineMacro UEgrave       "<Character \\xe9 >" >
|<!DefineMacro UEacute       "<Character \\x83 >" >
|<!DefineMacro UEcircumflex  "<Character \\xe6 >" >
|<!DefineMacro UEdieresis    "<Character \\xe8 >" >
|
|<!DefineMacro egrave        "<Character \\x8f >" >
|<!DefineMacro eacute        "<Character \\x8e >" >
|<!DefineMacro ecircumflex   "<Character \\x90 >" >
|<!DefineMacro edieresis     "<Character \\x91 >" >
|
|
|<!DefineMacro UIgrave       "<Character \\xed >" >
|<!DefineMacro UIacute       "<Character \\xea >" >
|<!DefineMacro UIcircumflex  "<Character \\xeb >" >
|<!DefineMacro UIdieresis    "<Character \\xec >" >
|
|<!DefineMacro igrave        "<Character \\x93 >" >
|<!DefineMacro iacute        "<Character \\x92 >" >
|<!DefineMacro icircumflex   "<Character \\x94 >" >
|<!DefineMacro idieresis     "<Character \\x95 >" >
|<!DefineMacro dotlessi      "<Character \\xf5 >" >
|
|
|<!DefineMacro UOgrave       "<Character \\xf1 >" >
|<!DefineMacro UOacute       "<Character \\xee >" >
|<!DefineMacro UOcircumflex  "<Character \\xef >" >
|<!DefineMacro UOtilde       "<Character \\xcd >" >
|<!DefineMacro UOdieresis    "<Character \\x85 >" >
|<!DefineMacro UOslash	    "<Character \\xaf >" >
|<!DefineMacro UOE           "<Character \\xce >" >
|
|<!DefineMacro ograve        "<Character \\x98 >" >
|<!DefineMacro oacute        "<Character \\x97 >" >
|<!DefineMacro ocircumflex   "<Character \\x99 >" >
|<!DefineMacro otilde        "<Character \\x9b >" >
|<!DefineMacro odieresis     "<Character \\x9a >" >
|<!DefineMacro oslash        "<Character \\xbf >" >
|<!DefineMacro oe            "<Character \\xcf >" >
|
|
|<!DefineMacro UUgrave       "<Character \\xf4 >" >
|<!DefineMacro UUacute       "<Character \\xf2 >" >
|<!DefineMacro UUcircumflex  "<Character \\xf3 >" >
|<!DefineMacro UUdieresis    "<Character \\x86 >" >
|
|<!DefineMacro ugrave        "<Character \\x9d >" >
|<!DefineMacro uacute        "<Character \\x9c >" >
|<!DefineMacro ucircumflex   "<Character \\x9e >" >
|<!DefineMacro udieresis     "<Character \\x9f >" >
|
|
|<!DefineMacro UYdieresis    "<Character \\xd9 >" >
|<!DefineMacro ydieresis     "<Character \\xd8 >" >
|
|
|<!DefineMacro UCcedilla     "<Character \\x82 >" >
|<!DefineMacro ccedilla      "<Character \\x8d >" >
|
|<!DefineMacro UNtilde       "<Character \\x84 >" >
|<!DefineMacro ntilde        "<Character \\x96 >" >
|
|<!DefineMacro endash        "<Character \\xd0 >" >
|<!DefineMacro emdash        "<Character \\xd1 >" >
|
|<!DefineMacro quotedblleft  "<Character \\xd2 >" >
|<!DefineMacro quoteblright  "<Character \\xd3 >" >
|<!DefineMacro quoteleft     "<Character \\xd4 >" >
|<!DefineMacro quoteright    "<Character \\xd5 >" >
|
|<!DefineMacro guillemotleft "<Character \\xc7 >" >
|<!DefineMacro guillemotright    "<Character \\xc8 >" >
|<!DefineMacro guilsinglleft "<Character \\xdc >" >
|<!DefineMacro guilsinglright    "<Character \\xdd >" >
|
eof
if test `wc -c < Bib/accent.mml` -ne 3644
then echo 'shar: Bib/accent.mml damaged (should be 3644 bytes)'
fi
fi
if test -f Bib/bib
then echo 'shar: Bib/bib -- file exists'
else echo x - Bib/bib
sed 's/^|//' > Bib/bib << 'eof'
|#! /bin/sh
|
|# bib
|
|# Format bibliographic records.
|
|# Author: Oscar Nierstrasz (Revised: 11/10/88)
|
|# Uses: accent bib2desc bib2ms bib2tex bibsearch lbl lchar refer2tex rsort vlbl
|
|usage='Usage :
|	bib -f [<refer file> ...]	-- generate framemaker mml file
|	bib -fl [<refer file> ...]	-- generate framemaker with labels
|	bib -t [<refer file> ...]	-- generate tex thebibliography
|	bib -tn [<refer file> ...]	-- generate tex enumeration list
|	bib -td [<refer file> ...]	-- generate tex description list
|	bib -b [<refer file> ...]	-- generate bibtex (via refer2tex)
|	bib -v [<refer file> ...]	-- generate tex with verbose labels
|	bib -vd [<refer file> ...]	-- generate tex verbose descriptions
|	bib -ms [<refer file> ...]	-- generate troff -ms
|	bib -vm [<refer file> ...]	-- generate verbose troff -ms
|	bib -l [<refer file> ...]	-- generate new labels (%L field)
|	bib -s [<text file> ...]	-- search bib entries'
|
|case $# in
|0 )	flag=-h ;;
|* )	flag=$1 ; shift ;;
|esac
|
|fixcommas="s/'',/,''/"
|
|case $flag in
|-f )	bib2mml $* | sed $fixcommas | accent -mml ;;
|-fl )	bib2mml mode=1 $* | sed $fixcommas | accent -mml ;;
|-mml )	bib2mml $* | sed $fixcommas | accent -mml ;;
|-ms )	bib2ms $* | sed $fixcommas | accent -ms | fmt ;;
|-vm )	vlbl $* | bib2ms | sed $fixcommas | accent -ms | fmt ;;
|-t )	bib2tex $* | sed $fixcommas | accent -tex ;;
|-t[ln] ) bib2tex mode=1 $* | sed $fixcommas | accent -tex ;;
|-tn )	bib2tex mode=2 $* | sed $fixcommas | accent -tex ;;
|-b )	refer2tex $* | accent -tex ;;
|-v )	vlbl $* | bib2tex | sed $fixcommas | accent -tex ;;
|-v[dl] ) vlbl $* | bib2tex mode=1 | sed $fixcommas | accent -tex ;;
|-l )	lbl $* | rsort | lchar ;;
|-s )	bibsearch $* ;;
|* )	echo "$usage" ; exit ;;
|esac
|
eof
if test `wc -c < Bib/bib` -ne 1693
then echo 'shar: Bib/bib damaged (should be 1693 bytes)'
fi
fi
if test -f Bib/bib2mml
then echo 'shar: Bib/bib2mml -- file exists'
else echo x - Bib/bib2mml
sed 's/^|//' > Bib/bib2mml << 'eof'
|#! /bin/awk -f
|# bib2mml
|
|# Converts refer format files to framemaker mml format.
|# Assumes you have defined <Reference> paragraph style.
|
|# Should check for and report unprinted fields ...
|
|# Author: Oscar Nierstrasz (Revised: Jan 30, 1990)
|
|# [0 : %L %Q %A %T	%S %V		%P    %C %D %O
|# [1 : %L %Q %A %T	%J %V %N	%P %I %C %D %O
|# [2 : %L %Q %A %T	%S %V		%P %I %C %D %O
|# [3 : %L %Q %A %T	%B %E %S %V	%P %I %C %D %O
|# [4 : %L %Q %A %T	%R %G		%P %I %C %D %O
|
|BEGIN {	FS = ""
|	n = 0
|	output = 0
|	type = 2	# default = book
|	rec = 1		# for numbering
|	print "<MML file -- generated by `bib2mml'>"
|	print "<Units pica>"
|	print "<!DefineTag Reference>"
|	print "<!DefineTag UnNumRef>"
|	}
|
|/./ {	output = 1 }
|
|#	set article type
|/%[JBR]/ { if(type != 2) print "\n<Comment TYPE CONFLICT>" }
|/%J/ {	type = 1 ; print "\n<Comment JOURNAL>" }
|/%B/ {	type = 3 ; print "\n<Comment ARTICLE IN BOOK>" }
|/%R/ {	type = 4 ; print "\n<Comment REPORT>" }
|
|#	compile author names
|/^%[AQ]/ { auth[++an] = substr($0,4) ; next }
|
|#	other fields
|/^%/ {	fld = substr($0,1,2)
|	entry[fld] = substr($0,4)
|	flist[++n] = fld
|	next
|	}
|
|#	a continued field
|/./ {	entry[fld] = sprintf "%s\n%s", entry[fld], $0
|	next
|	}
|
|#	print common fields
|/^$/ {
|	comma = ""
|	if(type == 2) print "\n<Comment BOOK>"
|
|	if (mode == 0) # Automatic numbering:
|		printf "\n<Reference>\n"
|	else if (mode == 1) # Labelled references:
|		printf "\n<UnNumRef>\n[%s]\t", entry["%L"]
|
|	if(an == 0)
|		err = err "\n<Comment NO AUTHORS!?>\n"
|	else {
|		printf "%s", auth[1]
|		for(i=2; i<=an; i++) {
|			if(i != an)
|				printf ",\n%s", auth[i]
|			else	printf " and %s", auth[i]
|			}
|		comma = ",\n"
|		}
|	if(entry["%T"] !~ /^$/) {
|		if(type == 2)
|			printf "%s<Italic>%s<Plain>", comma, entry["%T"]
|		else	printf "%s``%s''", comma, entry["%T"]
|		}
|	else	err = err "\n<Comment NO TITLE!?>\n"
|	}
|
|#	here the types differ
|/^$/ && (type == 1) {	# journal
|	printf ",\n%s", entry["%J"]
|	if(entry["%V"] !~ /^$/)
|		printf ",\nvol. %s", entry["%V"]
|	if(entry["%N"] !~ /^$/)
|		printf ",\nno. %s", entry["%N"]
|	}
|
|/^$/ && (type == 2) {	# book
|	if(entry["%S"] !~ /^$/)
|		printf ",\n%s", entry["%S"]
|	if(entry["%V"] !~ /^$/)
|		printf ",\n%s", entry["%V"]
|	}
|
|/^$/ && (type == 3) {	# article in book
|	printf ",\nin <Italic>%s<Plain>", entry["%B"]
|	if(entry["%E"] !~ /^$/)
|		printf ",\ned. %s", entry["%E"]
|	if(entry["%S"] !~ /^$/)
|		printf ",\n%s", entry["%S"]
|	if(entry["%V"] !~ /^$/)
|		printf ",\nvol. %s", entry["%V"]
|	}
|
|/^$/ && (type == 4) {	# report
|	printf ",\n%s", entry["%R"]
|	}
|
|#	finish off with common fields
|/^$/ {
|	if(entry["%P"] ~ /-/)
|		printf ",\npp. %s", entry["%P"]
|	else if(entry["%P"] !~ /^$/)
|		printf ",\np. %s", entry["%P"]
|	if(entry["%I"] !~ /^$/)
|		printf ",\n%s", entry["%I"]
|	if(entry["%C"] !~ /^$/)
|		printf ",\n%s", entry["%C"]
|	if(entry["%D"] !~ /^$/)
|		printf ",\n%s", entry["%D"]
|	if(entry["%O"] !~ /^$/)
|		printf ",\n%s", entry["%O"]
|
|#	cleanup activity
|	print "."
|	if(err !~ /^$/) {
|		printf err
|		err = ""
|		}
|	type = 2
|	for(i=1;i<=n;i++) entry[flist[i]] = ""
|	output = an = n = 0
|	next
|	}
|
|END {	if(output == 1) print "\n<Comment MISSING linefeed at end>" }
|
eof
if test `wc -c < Bib/bib2mml` -ne 3109
then echo 'shar: Bib/bib2mml damaged (should be 3109 bytes)'
fi
fi
if test -f Bib/bib2ms
then echo 'shar: Bib/bib2ms -- file exists'
else echo x - Bib/bib2ms
sed 's/^|//' > Bib/bib2ms << 'eof'
|#! /bin/awk -f
|# bib2ms
|
|# Converts refer format files to -ms format
|# without the need for macros.
|# Uses the %L field as a label.
|# (Verbose labels can be generated by filtering
|# through "vlbl" first.)
|
|# Should check for and report unprinted fields ...
|
|# Author: Oscar Nierstrasz (Revised: 11/10/88)
|
|# [0 : %L %Q %A %T	%S %V		%P    %C %D %O
|# [1 : %L %Q %A %T	%J %V %N	%P %I %C %D %O
|# [2 : %L %Q %A %T	%S %V		%P %I %C %D %O
|# [3 : %L %Q %A %T	%B %E %S %V	%P %I %C %D %O
|# [4 : %L %Q %A %T	%R %G		%P %I %C %D %O
|
|BEGIN {	FS = ""
|	n = 0
|	output = 0
|	type = 2	# default = book
|	rec = 1		# for numbering
|	printf ".\\\" .AM \\\" Accent macros\n"
|	}
|
|/./ {	output = 1 }
|
|#	set article type
|/%[JBR]/ { if(type != 2) print ".\\\" TYPE CONFLICT" }
|/%J/ {	type = 1 ; print ".\\\" JOURNAL" }
|/%B/ {	type = 3 ; print ".\\\" ARTICLE IN BOOK" }
|/%R/ {	type = 4 ; print ".\\\" REPORT" }
|
|#	compile author names
|/^%[AQ]/ { auth[++an] = substr($0,4) ; next }
|
|#	other fields
|/^%/ {	fld = substr($0,1,2)
|	entry[fld] = substr($0,4)
|	flist[++n] = fld
|	next
|	}
|
|#	a continued field
|/./ {	entry[fld] = sprintf "%s\n%s", entry[fld], $0
|	next
|	}
|
|#	print common fields
|/^$/ {
|	comma = ""
|	if(type == 2) print ".\\\" BOOK"
|
|	if(entry["%L"] !~ /^$/)
|		printf ".IP \"[%s] \"\n", entry["%L"]
|	else	print ".IP \"[???] \""
|
|	# NUMBERED REFERENCES:
|	# printf ".IP \"[%d]\"\n", rec++
|
|	# if(entry["%L"] !~ /^$/)
|	# 	printf ".LP\n[%s]\n.IP\n", entry["%L"]
|	# else	printf ".LP\n[???]\n.IP\n"
|	if(an == 0)
|		err = err ".\\\" NO AUTHORS!?\n"
|	else {
|		printf "%s", auth[1]
|		for(i=2; i<=an; i++) {
|			if(i != an)
|				printf ",\n%s", auth[i]
|			else	printf " and %s", auth[i]
|			}
|		comma = ",\n"
|		}
|	if(entry["%T"] !~ /^$/) {
|		if(type == 2)
|			printf "%s\\f2%s\\f1", comma, entry["%T"]
|		else	printf "%s``%s''", comma, entry["%T"]
|		}
|	else	err = err ".\\\" NO TITLE!?\n"
|	}
|
|#	here the types differ
|/^$/ && (type == 1) {	# journal
|	printf ",\n%s", entry["%J"]
|	if(entry["%V"] !~ /^$/)
|		printf ",\nvol. %s", entry["%V"]
|	if(entry["%N"] !~ /^$/)
|		printf ",\nno. %s", entry["%N"]
|	}
|
|/^$/ && (type == 2) {	# book
|	if(entry["%S"] !~ /^$/)
|		printf ",\n%s", entry["%S"]
|	if(entry["%V"] !~ /^$/)
|		printf ",\n%s", entry["%V"]
|	}
|
|/^$/ && (type == 3) {	# article in book
|	printf ",\nin \\f2%s\\f1", entry["%B"]
|	if(entry["%E"] !~ /^$/)
|		printf ",\ned. %s", entry["%E"]
|	if(entry["%S"] !~ /^$/)
|		printf ",\n%s", entry["%S"]
|	if(entry["%V"] !~ /^$/)
|		printf ",\nvol. %s", entry["%V"]
|	}
|
|/^$/ && (type == 4) {	# report
|	printf ",\n%s", entry["%R"]
|	}
|
|#	finish off with common fields
|/^$/ {
|	if(entry["%P"] ~ /-/)
|		printf ",\npp. %s", entry["%P"]
|	else if(entry["%P"] !~ /^$/)
|		printf ",\np. %s", entry["%P"]
|	if(entry["%I"] !~ /^$/)
|		printf ",\n%s", entry["%I"]
|	if(entry["%C"] !~ /^$/)
|		printf ",\n%s", entry["%C"]
|	if(entry["%D"] !~ /^$/)
|		printf ",\n%s", entry["%D"]
|	if(entry["%O"] !~ /^$/)
|		printf ",\n%s", entry["%O"]
|
|#	cleanup activity
|	print "."
|	if(err !~ /^$/) {
|		printf err
|		err = ""
|		}
|	type = 2
|	for(i=1;i<=n;i++) entry[flist[i]] = ""
|	output = an = n = 0
|	next
|	}
|
|END {	if(output == 1) print "MISSING <linefeed> at end" }
|
eof
if test `wc -c < Bib/bib2ms` -ne 3119
then echo 'shar: Bib/bib2ms damaged (should be 3119 bytes)'
fi
fi
if test -f Bib/bib2tex
then echo 'shar: Bib/bib2tex -- file exists'
else echo x - Bib/bib2tex
sed 's/^|//' > Bib/bib2tex << 'eof'
|#! /bin/awk -f
|# bib2tex
|
|# Converts refer format files to tex thebibliography format.
|# Can generate description list or enumerated list if
|# mode variable is set to 1 or 2, respectively.
|# I.e., bib2tex mode=1 refs > ref.tex
|
|# Compare with bib2ms.
|
|# Should check for and report unprinted fields ...
|
|# NB: commas should appear within quotes (i.e., ``title,'').
|
|# Author: Oscar Nierstrasz (Revised: 11/10/88)
|
|# [0 : %L %Q %A %T	%S %V		%P    %C %D %O
|# [1 : %L %Q %A %T	%J %V %N	%P %I %C %D %O
|# [2 : %L %Q %A %T	%S %V		%P %I %C %D %O
|# [3 : %L %Q %A %T	%B %E %S %V	%P %I %C %D %O
|# [4 : %L %Q %A %T	%R %G		%P %I %C %D %O
|
|BEGIN {	FS = ""
|	n = 0
|	output = 0
|	type = 2	# default = book
|	}
|
|(NR == 1) {
|	if (mode == 0)
|		printf "\\begin{thebibliography}{99}\n"
|	else if (mode == 1)
|		printf "\\begin{description}\n"
|	else if (mode == 2)
|		printf "\\begin{enumerate}\n"
|	}
|
|/./ {	output = 1 }
|
|#	set article type
|/%[JBR]/ { if(type != 2) print "\n% TYPE CONFLICT" }
|/%J/ {	type = 1 ; print "\n% JOURNAL" }
|/%B/ {	type = 3 ; print "\n% ARTICLE IN BOOK" }
|/%R/ {	type = 4 ; print "\n% REPORT" }
|
|#	compile author names
|/^%[AQ]/ { auth[++an] = substr($0,4) ; next }
|
|#	other fields
|/^%/ {	fld = substr($0,1,2)
|	entry[fld] = substr($0,4)
|	flist[++n] = fld
|	next
|	}
|
|#	a continued field
|/./ {	entry[fld] = sprintf "%s\n%s", entry[fld], $0
|	next
|	}
|
|#	print common fields
|/^$/ {
|	comma = ""
|	if(type == 2) print "\n% BOOK"
|
|	if (mode == 0)
|		printf "\\bibitem{%s}\n", entry["%L"]
|	else if (mode == 1)
|		printf "\\item{[%s]}\n", entry["%L"]
|	else if (mode == 2)
|		printf "\\item\n"
|
|	if(an == 0)
|		err = err "\n% NO AUTHORS!?\n"
|	else {
|		printf "%s", auth[1]
|		for(i=2; i<=an; i++) {
|			if(i != an)
|				printf ",\n%s", auth[i]
|			else	printf " and %s", auth[i]
|			}
|		comma = ",\n"
|		}
|	if(entry["%T"] !~ /^$/) {
|		if(type == 2)
|			printf "%s{\\it %s}", comma, entry["%T"]
|		else	printf "%s``%s''", comma, entry["%T"]
|		}
|	else	err = err "\n% NO TITLE!?\n"
|	}
|
|#	here the types differ
|/^$/ && (type == 1) {	# journal
|	printf ",\n%s", entry["%J"]
|	if(entry["%V"] !~ /^$/)
|		printf ",\nvol. %s", entry["%V"]
|	if(entry["%N"] !~ /^$/)
|		printf ",\nno. %s", entry["%N"]
|	}
|
|/^$/ && (type == 2) {	# book
|	if(entry["%S"] !~ /^$/)
|		printf ",\n%s", entry["%S"]
|	if(entry["%V"] !~ /^$/)
|		printf ",\n%s", entry["%V"]
|	}
|
|/^$/ && (type == 3) {	# article in book
|	printf ",\nin {\it %s}", entry["%B"]
|	if(entry["%E"] !~ /^$/)
|		printf ",\ned. %s", entry["%E"]
|	if(entry["%S"] !~ /^$/)
|		printf ",\n%s", entry["%S"]
|	if(entry["%V"] !~ /^$/)
|		printf ",\nvol. %s", entry["%V"]
|	}
|
|/^$/ && (type == 4) {	# report
|	printf ",\n%s", entry["%R"]
|	}
|
|#	finish off with common fields
|/^$/ {
|	if(entry["%P"] ~ /-/)
|		printf ",\npp. %s", entry["%P"]
|	else if(entry["%P"] !~ /^$/)
|		printf ",\np. %s", entry["%P"]
|	if(entry["%I"] !~ /^$/)
|		printf ",\n%s", entry["%I"]
|	if(entry["%C"] !~ /^$/)
|		printf ",\n%s", entry["%C"]
|	if(entry["%D"] !~ /^$/)
|		printf ",\n%s", entry["%D"]
|	if(entry["%O"] !~ /^$/)
|		printf ",\n%s", entry["%O"]
|
|#	cleanup activity
|	print "."
|	if(err !~ /^$/) {
|		printf err
|		err = ""
|		}
|	type = 2
|	for(i=1;i<=n;i++) entry[flist[i]] = ""
|	output = an = n = 0
|	next
|	}
|
|END {	if(output == 1) print "MISSING <linefeed> at end"
|	if (mode == 0)
|		printf "\n\\end{thebibliography}\n"
|	else if (mode == 1)
|		printf "\n\\end{description}\n"
|	else if (mode == 2)
|		printf "\n\\end{enumerate}\n"
|	}
|
eof
if test `wc -c < Bib/bib2tex` -ne 3387
then echo 'shar: Bib/bib2tex damaged (should be 3387 bytes)'
fi
fi
if test -f Bib/bibsearch
then echo 'shar: Bib/bibsearch -- file exists'
else echo x - Bib/bibsearch
sed 's/^|//' > Bib/bibsearch << 'eof'
|#! /bin/sh
|
|# bibsearch
|
|# Search for bibliographic labels in a document.
|
|# Author: Oscar Nierstrasz (Revised: 11/10/88)
|# 05/11/88: simplified to search for labels in any context.
|
|# regular expression to match labels
|# (sequence of chars, 2 digits plus optional disambiguators)
|label='/^[a-zA-Z][a-zA-Z]*[0-9][0-9][a-z]*/p'
|
|cat $* | tr '[]{}\\;,. ' '\012' | \
|sed -n "${label}" | \
|sort -u
|
|exit
|
|######################################################################
|
|# OLD VERSION:
|
|search='BEGIN { FS = "[" }
|/^\.ds \[L / { print substr ($0, 8) ; next }
|# /^\./ { if ($0 !~ /^\.IP /) next }
|/^%L / { split ($0, stuff, " ") ; print stuff[2] ; next }
|/\[/ {	for (i=2; i<=NF; i++)
|		{ split ($i, stuff, "]") ; print stuff[1] }
|	next
|	}
|/\]/ {	split ($0, stuff, "]") ; print stuff[1] }'
|
|cat $* | tr '^' '\012' | \
|sed 's/\\cite{\([^}]*\)}/[\1]/g' | \
|awk "$search" | tr '\\;, ' '\012' | \
|sed -n "${label}" | \
|sort -u
|
|exit
|
eof
if test `wc -c < Bib/bibsearch` -ne 930
then echo 'shar: Bib/bibsearch damaged (should be 930 bytes)'
fi
fi
if test -f Bib/code
then echo 'shar: Bib/code -- file exists'
else echo x - Bib/code
sed 's/^|//' > Bib/code << 'eof'
|#! /bin/sh
|# code -- generate a framemaker mml file from text
|
|# Author: Oscar Nierstrasz
|
|cat << 'eof'
|
|<MML file -- generated by `code'>
|
|<Units pica>
|
|<!DefineTag Code>
|
|<Code>
|
|<Comment -- linefeed = hard return>
|<!DefineMacro lf "\\x0d " >
|<!DefineMacro cr "\\x0a " >
|
|eof
|
|sed	-e 's/\\/&&/g'				\
|	-e 's/	/\\t/g'				\
|	-e 's/[<>]/\\&/g'			\
|	-e 's/--/<endash>/g'			\
|	-e 's/``/<quotedblleft>/g'		\
|	-e 's/'\'\''/<quoteblright>/g'		\
|	$* |					\
|awk 'BEGIN { lf = "\n" }
|/^$/ { lf = "\n" ; printf "%s\n<cr>", lf ; next }
|{ printf "%s\n%s", lf, $0 ; lf = "<lf>\\"  }
|END { print "" }'
|
eof
if test `wc -c < Bib/code` -ne 590
then echo 'shar: Bib/code damaged (should be 590 bytes)'
fi
fi
if test -f Bib/lbl
then echo 'shar: Bib/lbl -- file exists'
else echo x - Bib/lbl
sed 's/^|//' > Bib/lbl << 'eof'
|#! /bin/awk -f
|
|# Generate bibliography labels from first author name and year.
|# Pipe output through rsort and lchar to generate
|# disambiguating character (a-z).
|
|# Author: Oscar Nierstrasz (Revised: 11/10/88)
|
|BEGIN {
|	lbl = ""
|	new = ""
|	auth = ""
|	fields = 0
|	}
|
|/%L/ {
|	lbl = $2
|	l = length(lbl)
|	year = substr(lbl, l-1, 2)
|	next
|	}
|
|/%[AQ]/ && (auth ~ /^$/) {
|	if ($0 ~ /,/) {
|		n = split($0, front, ",")
|		n = split(front[1], name, " ")
|		auth = name[n]
|		}
|	else if ($NF ~ /\(.*\)/)
|		auth = $(NF-1)
|	else	auth = $NF
|	}
|
|/%D/ {
|	for(i=1;i<=NF;i++)
|		if($i ~ /^19[0-9][0-9]$/)
|			year = substr($i, 3)
|	}
|
|/./ {
|	bib[++fields] = $0
|	next
|	}
|
|/^$/ {
|	if (auth ~ /^$/)
|		new = lbl
|	else	new = substr(auth, 1, 4) year
|
|	# if (new != lbl)
|		# new = new "\n%# WAS: " lbl
|	print "%L", new
|	for (n=1;n<=fields;n++)
|		print bib[n]
|	print ""
|	lbl = ""
|	new = ""
|	auth = ""
|	fields = 0
|	}
|
eof
if test `wc -c < Bib/lbl` -ne 887
then echo 'shar: Bib/lbl damaged (should be 887 bytes)'
fi
fi
if test -f Bib/lchar
then echo 'shar: Bib/lchar -- file exists'
else echo x - Bib/lchar
sed 's/^|//' > Bib/lchar << 'eof'
|#! /bin/awk -f
|
|# Generate disambiguating characters for bibliography labels.
|# Use lbl or vlbl to generate new labels, then pipe
|# through rsort and lchar.
|
|# Author: Oscar Nierstrasz (Revised: 11/10/88)
|
|BEGIN {
|	alph = "abcdefghijklmnopqrstuvwxyz"
|	prev = ""
|	lbl = ""
|	fields = 0
|	count = 1
|	}
|
|/%L/ {
|	lbl = substr($0, 4)
|	next
|	}
|
|/./ {
|	bib[++fields] = $0
|	next
|	}
|
|/^$/ {
|	if (lbl == prev)
|		count++
|	else	count = 1
|	prev = lbl
|	print "%L", lbl substr(alph,count,1)
|	for (n=1;n<=fields;n++)
|		print bib[n]
|	print ""
|	fields = 0
|	}
|
eof
if test `wc -c < Bib/lchar` -ne 540
then echo 'shar: Bib/lchar damaged (should be 540 bytes)'
fi
fi
if test -f Bib/ms2mml
then echo 'shar: Bib/ms2mml -- file exists'
else echo x - Bib/ms2mml
sed 's/^|//' > Bib/ms2mml << 'eof'
|#! /bin/sh
|# ms2mml -- generate a framemaker mml file from a troff-like document
|
|# Uses: accent
|
|# Author: Oscar Nierstrasz @ cuisun.unige.ch (Jan 30, 1990)
|
|u='Usage: ms2mml [<pseudo-ms-file> ...]
|	Macros:
|		.TL	Title
|		.AU	Author
|		.AI	SubTitle
|		.AB	Abstract
|		.NH 1	Section
|		.NH 2	SubSection
|		.NH 3	SubSubSection
|		.SH	UnNumSec
|		.SS	UnNumSub
|		.LP	Block-NoIndent
|		.PP	Block-FirstIndent
|		.IP	Block-AllIndent
|		.BU	Bullet-Indent
|		.QP	Quote
|		.EF	List-FirstItem
|		.EN	List-NextItem
|		.RF	Reference
|		.CD	Code
|		.\"	comment
|		.br	line break
|		.sp	space (blank line)
|	In-line: \f[IBRPC], \['\''`^:][aeiou], \~[an], \,c, \/o
|'
|
|for arg
|do
|	case $arg in
|	-h )	echo "$u" 1>&2 ; exit ;;
|	* )	files="$files $arg" ;;
|	esac
|done
|
|cat << 'eof'
|
|<MML file -- generated by `ms2mml'>
|
|<Units pica>
|
|<!DefineTag Abstract>
|<!DefineTag Abstract-Title>
|<!DefineTag Author>
|<!DefineTag Block-AllIndent>
|<!DefineTag Block-FirstIndent>
|<!DefineTag Block-HangIndent>
|<!DefineTag Block-NoIndent>
|<!DefineTag Bullet-Indent>
|<!DefineTag Bullet-NoIndent >
|<!DefineTag Caption-Figure>
|<!DefineTag Caption-Table>
|<!DefineTag Code>
|<!DefineTag Footer>
|<!DefineTag Footnote>
|<!DefineTag Header>
|<!DefineTag List-FirstItem>
|<!DefineTag List-NextItem>
|<!DefineTag Quote>
|<!DefineTag Reference>
|<!DefineTag Section>
|<!DefineTag SubSection>
|<!DefineTag SubSubSection>
|<!DefineTag SubTitle>
|<!DefineTag Title>
|<!DefineTag UnNumRef>
|<!DefineTag UnNumSec>
|<!DefineTag UnNumSub>
|
|<Comment -- linefeed = hard return>
|<!DefineMacro lf "\\x0d " >
|<!DefineMacro cr "\\x0a " >
|
|eof
|
|# <!DefineFont fi <Family Times><Italic> >
|# <!DefineFont fb <Family Times><Bold> >
|# <!DefineFont fp <Family Times><Plain> >
|# <!DefineFont fc <Family Courier><Plain> >
|
|soelim $files | \
|sed	-e 's/[<>]/\\&/g'	\
|	-e 's/\\\\</\\</g'	\
|	-e 's/	/\\t/g'		\
|	-e 's/\\fI/<Italic>/g'	\
|	-e 's/\\fB/<Bold>/g'	\
|	-e 's/\\fR/<Family Times><Plain>/g'	\
|	-e 's/\\fP/<Family Times><Plain>/g'	\
|	-e 's/\\fC/<Family Helvetica><Plain>/g'	\
|	| \
|accent -mml | \
|sed 's/\\[^"t<>]/\\&/g' | \
|awk 'BEGIN { newline = 0 }
|# Authors & code appear on separate lines:
|/^\.AU/	{ printf "\n<Author>\n" ; newline = 1 ; next }
|/^\.AI/	{ printf "\n<SubTitle>\n" ; newline = 1 ; next }
|/^\.CD/	{ printf "\n<Code>\n" ; newline = 1 ; next }
|# Do not change mode:
|/^\.\\"/ { next } # printf "<Comment -- %s>\n", substr($0,4) ; next }
|/^\.br/	{ printf "<lf>" ; next }
|/^\.sp/	{ printf "<cr>\n\n" ; next }
|/^\.nf/	{ nf = 1 ; next }
|/^\.fi/	{ nf = 0 ; next }
|/^$/	{ printf "<cr>\n\n" ; next }
|# Drop newline mode:
|/^\./	{ newline = 0 }
|/^\.TL/	{ printf "\n<Title>\n" ; next }
|/^\.AB/	{
|	printf "\n<Abstract-Title>\n"
|	printf "\n<Abstract>\n"
|	next
|	}
|/^\.NH 1/ { printf "\n<Section>\n" ; next }
|/^\.NH 2/ { printf "\n<SubSection>\n" ; next }
|/^\.NH 3/ { printf "\n<SubSubSection>\n" ; next }
|/^\.SH/	{ printf "\n<UnNumSec>\n" ; next }
|/^\.SS/	{ printf "\n<UnNumSub>\n" ; next }
|/^\.LP/	{ printf "\n<Block-NoIndent>\n" ; next }
|/^\.PP/	{ printf "\n<Block-FirstIndent>\n" ; next }
|/^\.BU/	{ printf "\n<Bullet-Indent>\n" ; next }
|/^\.IP$/ { printf "\n<Block-AllIndent>\n" ; next }
|/^\.IP .*/ { printf "\n<Block-HangIndent>\n%s\n", substr($0,5) ; next }
|/^\.QP/	{ printf "\n<Quote>\n" ; next }
|/^\.EF/	{ printf "\n<List-FirstItem>\n" ; next }
|/^\.EN/	{ printf "\n<List-NextItem>\n" ; next }
|/^\.RF/	{ printf "\n<Reference>\n" ; next }
|/^\./ { printf "<Comment -- command ignored: %s >\n", $0 ; next }
|{ print }
|(nf == 1) { printf "<lf>" }
|(newline == 1) { print "" }
|'
|
|exit
|
|Others:
|
|<!DefineTag `figure'>
|<!DefineTag `table'>
|<!DefineTag `Footer'>
|<!DefineTag `Header'>
|
eof
if test `wc -c < Bib/ms2mml` -ne 3582
then echo 'shar: Bib/ms2mml damaged (should be 3582 bytes)'
fi
fi
if test -f Bib/rec
then echo 'shar: Bib/rec -- file exists'
else echo x - Bib/rec
sed 's/^|//' > Bib/rec << 'eof'
|#! /bin/sh
|
|# rec -- compress, expand and edit record files.
|
|# Used by rgrep, rsort etc.
|
|# Assumes records are separated by a blank line.  Compressed
|# records are printed on single lines, with a caret ("^")
|# separating the lines of the record.  The expander simply
|# translates the carets back to newlines.
|
|# `rec | rec -x ' adds a blank line at the end of the file, if
|# there isn't already one there.  Blank records are deleted.
|
|# Author: Oscar Nierstrasz (Revised: 11/10/88)
|
|u='Usage :	rec -c(ompress) [<file> ...]
|	rec -x(expand) [<file> ...]
|	rec -d(elete empty records) [<file> ...]
|	rec -e(dit) <compressed file> ...'
|
|case $EDITOR in
|"" )	EDITOR=/usr/ucb/vi ;;
|esac
|
|comp='/^$/ { printf "\n" ; next }
|{ printf "%s^", $0 }'
|
|del='BEGIN { rec = 0 } # delete empty records
|/^$/ { if (rec == 1) { print ; rec = 0 } ; next }
|{ print ; rec = 1 }
|END { if (rec == 1) print }'
|
|case $# in
|0 )	flag=-h ;;
|* )	flag=$1 ; shift ;;
|esac
|
|case $flag in
|-c )	exec /bin/awk "$comp" $* ;;
|-x )	cat $* | tr '^' '\012' ;;
|-d )	exec /bin/awk "$del" $* ;;
|
|-e )	for i
|	do
|		umask 0777
|		if (echo > $i.l) 2> /dev/null
|		then
|			umask 022
|			echo $USER > $i.w
|			echo -n "Editing $i ... "
|			touch $i
|			tr '^' '\012' < $i > $i.ed
|			touch $i.w
|			$EDITOR $i.ed
|			echo -n "Just a second ... "
|			case `find $i.ed -newer $i.w -exec echo y \;` in
|			y )	awk "$comp" $i.ed > $i
|				echo -n "done " ;;
|			* )	echo -n "no changes " ;;
|			esac
|			rm -f $i.ed $i.w $i.l
|			echo
|		else
|		echo "Sorry, `cat $i.w` is editing the file!" 1>&2
|		fi
|	done ;;
|
|-* )	echo "$u" 1>&2 ; exit ;;
|esac
|
eof
if test `wc -c < Bib/rec` -ne 1575
then echo 'shar: Bib/rec damaged (should be 1575 bytes)'
fi
fi
if test -f Bib/ref.mif
then echo 'shar: Bib/ref.mif -- file exists'
else echo x - Bib/ref.mif
sed 's/^|//' > Bib/ref.mif << 'eof'
| <Pgf 
|  <PgfTag `Reference'>
|  <PgfUseNextTag No >
|  <PgfNextTag `'>
|  <PgfAlignment Left >
|  <PgfFIndent  0.0 pt>
|  <PgfLIndent  24.0 pt>
|  <PgfRIndent  0.0 pt>
|  <PgfTopSeparator `'>
|  <PgfBotSeparator `'>
|  <PgfPlacement Anywhere >
|  <PgfSpBefore  4.0 pt>
|  <PgfSpAfter  4.0 pt>
|  <PgfWithPrev No >
|  <PgfWithNext No >
|  <PgfBlockSize 5>
|  <PgfFont 
|   <FTag `'>
|   <FFamily `Times'>
|   <FVar `Regular'>
|   <FWeight `Regular'>
|   <FAngle `Regular'>
|   <FSize  10.0 pt>
|   <FUnderline No >
|   <FStrike No >
|   <FSupScript No >
|   <FSubScript No >
|   <FOverline No >
|   <FChangeBar No >
|   <FOutline No >
|   <FShadow No >
|   <FPairKern No >
|   <FDX  0.0 pt>
|   <FDY  0.0 pt>
|   <FDW 0>
|   <FSeparation 0>
|  > # end of PgfFont
|  <PgfLineSpacing Fixed >
|  <PgfLeading  2.0 pt>
|  <PgfAutoNum Yes >
|  <PgfNumFormat `r:[<+\>]\\t'>
|  <PgfNumberFont `'>
|  <PgfNumAtEnd No >
|  <PgfNumTabs 1>
|  <TabStop 
|   <TSX  24.0 pt>
|   <TSType Left >
|   <TSLeaderStr ` '>
|  > # end of TabStop
|  <PgfHyphenate Yes >
|  <HyphenMaxLines 4>
|  <HyphenMinPrefix 2>
|  <HyphenMinSuffix 2>
|  <HyphenMinWord 5>
|  <PgfLetterSpace No >
|  <PgfMinWordSpace 75>
|  <PgfOptWordSpace 100>
|  <PgfMaxWordSpace 125>
|  <PgfLanguage USEnglish >
| > # end of Pgf
| <Pgf 
|  <PgfTag `UnNumRef'>
|  <PgfUseNextTag No >
|  <PgfNextTag `'>
|  <PgfAlignment LeftRight >
|  <PgfFIndent  0.0 pt>
|  <PgfLIndent  60.0 pt>
|  <PgfRIndent  0.0 pt>
|  <PgfTopSeparator `'>
|  <PgfBotSeparator `'>
|  <PgfPlacement Anywhere >
|  <PgfSpBefore  4.0 pt>
|  <PgfSpAfter  4.0 pt>
|  <PgfWithPrev No >
|  <PgfWithNext No >
|  <PgfBlockSize 5>
|  <PgfFont 
|   <FTag `'>
|   <FFamily `Times'>
|   <FVar `Regular'>
|   <FWeight `Regular'>
|   <FAngle `Regular'>
|   <FSize  10.0 pt>
|   <FUnderline No >
|   <FStrike No >
|   <FSupScript No >
|   <FSubScript No >
|   <FOverline No >
|   <FChangeBar No >
|   <FOutline No >
|   <FShadow No >
|   <FPairKern No >
|   <FDX  0.0 pt>
|   <FDY  0.0 pt>
|   <FDW 0>
|   <FSeparation 0>
|  > # end of PgfFont
|  <PgfLineSpacing Fixed >
|  <PgfLeading  2.0 pt>
|  <PgfAutoNum No >
|  <PgfNumTabs 1>
|  <TabStop 
|   <TSX  60.0 pt>
|   <TSType Left >
|   <TSLeaderStr ` '>
|  > # end of TabStop
|  <PgfHyphenate Yes >
|  <HyphenMaxLines 4>
|  <HyphenMinPrefix 2>
|  <HyphenMinSuffix 2>
|  <HyphenMinWord 5>
|  <PgfLetterSpace No >
|  <PgfMinWordSpace 75>
|  <PgfOptWordSpace 100>
|  <PgfMaxWordSpace 125>
|  <PgfLanguage USEnglish >
| > # end of Pgf
eof
if test `wc -c < Bib/ref.mif` -ne 2371
then echo 'shar: Bib/ref.mif damaged (should be 2371 bytes)'
fi
fi
if test -f Bib/rgrep
then echo 'shar: Bib/rgrep -- file exists'
else echo x - Bib/rgrep
sed 's/^|//' > Bib/rgrep << 'eof'
|#! /bin/sh
|
|# rgrep
|
|# Select records that contain a string.
|# Each record is separated by a blank line.
|
|# This should be a C-program (i.e., an option to fgrep).
|
|# (Actually, awk has this functionality, provided you use
|# a character other than newline to separate records,
|# but that still doesn't solve the problem of sorting
|# a file of records.)
|
|# Author: Oscar Nierstrasz (Revised: 11/10/88)
|
|# Uses: rec
|
|sort=cat
|grep=fgrep
|u='Usage :	rgrep [-s(ort)] [fgrep flags] <pattern> [<file> ...]
|	rgrep [-s] [fgrep flags] -f <pattern file> [<file> ...]'
|
|case $# in
|0 )	echo "$u" 1>&2 ; exit ;;
|esac
|
|while :
|do
|	case $# in
|	0 )	break ;;
|	esac
|	case $1 in
|	-s )	sort=sort ;;
|	-* )	flags="$flags $1" ;;
|	* )	case "$pat" in
|		"" )	pat="$1" ;;
|		* )	files="$files $1" ;;
|		esac
|	esac
|	shift
|done
|
|rec -c $files | $grep $flags "${pat}" | $sort | rec -x
|
|exit
|
eof
if test `wc -c < Bib/rgrep` -ne 858
then echo 'shar: Bib/rgrep damaged (should be 858 bytes)'
fi
fi
if test -f Bib/rsort
then echo 'shar: Bib/rsort -- file exists'
else echo x - Bib/rsort
sed 's/^|//' > Bib/rsort << 'eof'
|#! /bin/sh
|
|# rsort
|
|# Sort a file of records.
|# Each record is separated by a blank line.
|
|# This should be an option to sort.
|
|# Author: Oscar Nierstrasz (9/10/88)
|# Uses: rec
|
|sort=sort
|u='Usage : rsort [sort flags] [<file> ...]'
|rec=rec
|
|while :
|do
|	case $# in
|	0 )	break ;;
|	esac
|	case $1 in
|	-[oyzT]* ) flags="$flags $1 $2" ; shift ;;
|	-* )	flags="$flags $1" ;;
|	* )	files="$files $1" ;;
|	esac
|	shift
|done
|
|rec -c $files | $sort $flags $pat | rec -x
|
|exit
|
eof
if test `wc -c < Bib/rsort` -ne 463
then echo 'shar: Bib/rsort damaged (should be 463 bytes)'
fi
fi
if test -f Bib/rsplit
then echo 'shar: Bib/rsplit -- file exists'
else echo x - Bib/rsplit
sed 's/^|//' > Bib/rsplit << 'eof'
|#! /bin/sh
|
|# rsplit <key> <file>
|
|# Split a file of records into <file>.1 and <file>.2 respectively
|# containing and not containing the <key> word.
|# The output files may be given as arguments.
|# If the mismatch file is missing, the source is assumed.
|
|# Uses: rec
|
|# Author: Oscar Nierstrasz (oscar@cuisun.unige.ch) 890516
|
|u='Usage: rsplit <key> <file> [<match-file> [<mismatch-file>]]'
|
|case $# in
|2 )	key=$1 ; file=$2 ; o1=$file.1 ; o2=$file.2 ;;
|3 )	key=$1 ; file=$2 ; o1=$3 ; o2=$file ;;
|4 )	key=$1 ; file=$2 ; o1=$3 ; o2=$4 ;;
|* )	echo "$u" 1>&2 ; exit ;;
|esac
|
|case $o1 in
|$o2 )	echo 'rsplit: match-file = mismatch-file' 1>&2 ; exit ;;
|esac
|
|grep=fgrep
|t=$file.$$
|
|trap "rm -f $t ; exit" 1 2
|
|rec -c $file > $t
|# echo sed -n "/${key}/p" $t
|sed -n "/${key}/p" $t | rec -x > $o1
|# echo sed "/${key}/d" $t 
|sed "/${key}/d" $t | rec -x > $o2
|rm -f $t
|
eof
if test `wc -c < Bib/rsplit` -ne 857
then echo 'shar: Bib/rsplit damaged (should be 857 bytes)'
fi
fi
if test -f Bib/vlbl
then echo 'shar: Bib/vlbl -- file exists'
else echo x - Bib/vlbl
sed 's/^|//' > Bib/vlbl << 'eof'
|#! /bin/awk -f
|
|# Generate verbose reference labels from author names.
|# Pipe output through rsort and lchar to generate
|# disambiguating characters (a-z).
|
|# Format depends on number of authors:
|#	Author, 'YR
|#	Author1 and Author2, 'YR
|#	Author1, et al., 'YR
|
|# Warning: may generate unexpected results for some references.
|
|# Author: Oscar Nierstrasz (Revised: 11/10/88)
|
|BEGIN {
|	fields = 0
|	authors = 0
|	year = 0
|	}
|
|/^%A/ || /^%Q/ {
|	authors++
|	if ($0 ~ /,/) {
|		n = split($0, front, ",")
|		n = split(front[1], name, " ")
|		auth[authors] = name[n]
|		}
|	else {
|		# ignore parenthetical comments
|		if ($NF ~ /\(.*\)/)
|			auth[authors] = $(NF-1)
|		else	auth[authors] = $NF
|		}
|	}
|
|/^%D/ {
|	for(i=2;i<=NF;i++)
|		if($i ~ /^1[5-9][0-9][0-9]$/)
|			year = $i
|	}
|
|/^%L/	{ next }
|
|/./ {
|	bib[++fields] = $0
|	next
|	}
|
|/^$/ {
|	printf "%%L "
|	if (authors == 0)
|		printf "ANON, %s\n", year
|	else if (authors == 1)
|		printf "%s, %s\n", auth[1], year
|	else if (authors == 2)
|		printf "%s and %s, %s\n", auth[1], auth[2], year
|	else
|		printf "%s, et al. %s\n", auth[1], year
|	for (n=1;n<=fields;n++)
|		print bib[n]
|	print ""
|	fields = 0
|	authors = 0
|	year = 0
|	}
|
eof
if test `wc -c < Bib/vlbl` -ne 1152
then echo 'shar: Bib/vlbl damaged (should be 1152 bytes)'
fi
fi
exit

