[alt.sources] Bibc, a bibliography creator, maintaner for LaTeX bib files...

kannan@giza.cis.ohio-state.edu (Kannan Varadhan) (07/17/89)

What is bibc?

bibc is a tool for creating and updating BibTeX bib files.  It has all
the templates as specified in "The LaTeX manual", and "BibTeXing" guide.

It works by prompting you for the field required.  It has a few
interesting features to help out.  Look at the README file for examples
on how it works...

It can be made to handle scribe easily, and maybe even other formats.
The file you would look at for doing so is "templates.c"

Why bibc?

well, see, as of now, the only two solutions I have been given are use
emacs, or use vi.

emacs as a solution to anything is an abhorrent concept with me(1).

vi as a solution to this problem is a overly complicated task, requiring
too many macros, and too many complications, so, bibc is it....

Installing bibc:

You should basically have to edit the Makefile to figure where the
binary is going to go finally, and you should be through.  You will need
flex before you can make bibc though.  Flex 2.0 is just out on
comp.sources.xxxxx .

Oh yeah, if you are using sysV, you should need to change the string
library stuff.  These are all localised in "strings.h", which is part of
this package...

Verifying the bib file:

Having got yourself a new bib file, or an update of the old one, you
would like to ensure that there are no clashes, and to see some form of
the printout, right?  So, use bibv.  See the sample run in the README
file....

Note that bibv uses a specially hacked bst file, called specl.bst.  This
style causes the bibitem keys to be the same as the \cite-keys that you
have used.  This is a convenient style for keeping hardcopies for ready
reference, considering that these are sorted nicely and all that :)
If you would like to have a copy of the btxbst.doc file, send me a note,
and I'll send it to you....

If you wish to remove this, edit bibv, and change the STYLE=specl line.
Follow the directions in the file at that point.

Best of luck, 

Do send me some feedbacks on this...

KANNAN				22/JUN/89

Updated:	Mon Jul 17 10:03:21 EDT 1989


(1) I know I am probably going to be flamed for that statement, but
then, well.....what the heck, life isn't worth living if you don't take
a few risks..:-).  Actually, as an aside observation, when I got replies
to my query regarding creating and updating such bibliographies, the
only answers I got were from emacsers, and they were too too closeminded
to even try thinking of options outside of emacs.  Speaks volumes to me,
of the cancerish nature of emacs, doesn't it to you? :-)



#--------------------------------------------------------------------------
# to unpack the routine(s) in this package, remove everything
# above the dotted line and say, `sh filename'
# If any of the routines already exists, say, `sh -o filename'
#	Makefile README bibc.c bibc.h bibc.l bibv inits.c lex.yy.c specl.bst
#	strings.h templates.c
echo -n "Makefile..." 1>&2
if test -f Makefile
then
	case $# in 
	0)
		echo 'exists, `sh filename -o'\'' to overwrite'
		exit 0;;
	esac
	case $1 in 
	-o)	;;
	*)
		echo 'exists, `sh filename -o'\'' to overwrite'
		exit 0;;
	esac
fi
sed 's/^X//' << 'EOFile Makefile' > Makefile
X.l.c: ; 	flex -I $*.l
X
X# machine type.....I use it to determine MCBINDEST
XHOST=sun
XCFLAGS=-O
X# bin directory for machine specific executables
XMCBINDEST=/n/shell/0/kannan/bin/${HOST}/
X# bin directory for shell executables, 
XSHBINDEST=/n/shell/0/kannan/bin/
X
XINCLUDES=bibc.h strings.h
X
Xbibc:	bibc.o lex.yy.o inits.o templates.o
X	cc ${CFLAGS} bibc.o lex.yy.o inits.o templates.o -o bibc 
X
Xlex.yy.o:	lex.yy.c $(INCLUDES)
X	cc -c ${CFLAGS} lex.yy.c
X
Xbibc.o:		bibc.c $(INCLUDES)
X	cc -c ${CFLAGS} bibc.c
X
Xinits.o:	inits.c $(INCLUDES)
X	cc -c ${CFLAGS} inits.c
X
Xtemplates.o:	templates.c $(INCLUDES)
X	cc -c ${CFLAGS} templates.c
X
Xlex.yy.c:	bibc.l $(INCLUDES)
X	flex -I bibc.l
X
Xinstall: bibc
X	install -s bibc ${MCBINDEST}
X	install -c bibv ${SHBINDEST}
Xclean:
X	rm -f core linterrs *.o
EOFile Makefile
chmod u=rw+,g=rw+,o=r++ Makefile
echo '...done' 1>&2
echo -n "README..." 1>&2
if test -f README
then
	case $# in 
	0)
		echo 'exists, `sh filename -o'\'' to overwrite'
		exit 0;;
	esac
	case $1 in 
	-o)	;;
	*)
		echo 'exists, `sh filename -o'\'' to overwrite'
		exit 0;;
	esac
fi
sed 's/^X//' << 'EOFile README' > README
XWhat is bibc?
X
Xbibc is a tool for creating and updating BibTeX bib files.  It has all
Xthe templates as specified in "The LaTeX manual", and "BibTeXing" guide.
XFirstly, it prompts you for the type of record you wish to enter.  Then,
Xfor the type of object, it prompts you for the data concerning each
Xfield.  It indicates optional fields for the type of object, and
Xprotests vehemently (and probably rudely as well :-) if you do not give
Xit a required field.  You can ask for the meaning of a given field given
Xa particular context, and it will help you out.  You do this by typing
Xin a '?'.  If you make a mistake, and wish to restart the record, you
Xcan type an 'xx' to the entry.  After typing the whole record, you can
XEDIT the file, start entering a new record or quit.
X
XA sample working is shown below...
X
XScript started on Thu Jun 22 23:30:26 1989
Xgiza Bibcreate. bibc -help
XUsage: bibc [-i|-verify] [+|-verbose] [-file <filename>]
Xgiza Bibcreate. bibc -file foo.bib
XWhat kind of record would you like to enter (one of the following)?
X	article		book		booklet		conference
X	inbook		incollection	inproceedings	manual
X	mastersthesis	misc		phdthesis	proceedings
X	techreport	unpublished
Xor	EDIT		EOF		^D
Xarticle
XCITEKEY? ?
XThe key used to cross reference with the cite command in the
X  main text.
XCITEKEY? xx
XAbort? y
XWhat kind of record would you like to enter (one of the following)?
X	article		book		booklet		conference
X	inbook		incollection	inproceedings	manual
X	mastersthesis	misc		phdthesis	proceedings
X	techreport	unpublished
Xor	EDIT		EOF		^D
Xbook
XCITEKEY? kn:gnus
XAUTHOR? Donald E. Knudsen
XTITLE? 1966 World Gnus Almanac
XPUBLISHER? Permafrost Press
XYEAR? 1966
XVOLUME (optional)? 
XSERIES (optional)? 
XADDRESS (optional)? Novosibirsk
XEDITION (optional)? 
XMONTH (optional)? 
XNOTE (optional)? 
XKEY (optional)? 
XCOMMENT (optional)? Notice that the program insists on a year, while the LaTeX manual leaves it out.  This is because the YEAR is a required field for book
XCROSS-REFERENCE (optional)? 
X@BOOK { kn:gnus ,
X	ADDRESS = "Novosibirsk" ,
X	AUTHOR = "Donald E. Knudsen" ,
X	PUBLISHER = "Permafrost Press" ,
X	TITLE = "1966 World Gnus Almanac" ,
X	YEAR = "1966" ,
X	COMMENT = "Notice that the program insists on a year, while the LaTeX manual leaves it out.  This is because the YEAR is a required field for book"
X	}
X
XWhat kind of record would you like to enter (one of the following)?
X	article		book		booklet		conference
X	inbook		incollection	inproceedings	manual
X	mastersthesis	misc		phdthesis	proceedings
X	techreport	unpublished
Xor	EDIT		EOF		^D
XEDIT
X	[A whole lot of EDITOR codes for this terminal...edited out :) -kva]
XWhat kind of record would you like to enter (one of the following)?
X	article		book		booklet		conference
X	inbook		incollection	inproceedings	manual
X	mastersthesis	misc		phdthesis	proceedings
X	techreport	unpublished
Xor	EDIT		EOF		^D
X^D
Xgiza Bibcreate. ^D
X
Xscript done on Thu Jun 22 23:33:48 1989
X
XInstalling bibc:
X
XYou should basically have to edit the Makefile to figure where the
Xbinary is going to go finally, and you should be through.  You will need
Xflex before you can make bibc though.  Flex 2.0 is just out on
Xcomp.sources.xxxxx .
X
XOh yeah, if you are using sysV, you should need to change the string
Xlibrary stuff.  These are all localised in "strings.h", which is part of
Xthis package...
X
XVerifying the bib file:
X
XHaving got yourself a new bib file, or an update of the old one, you
Xwould like to ensure that there are no clashes, and to see some form of
Xthe printout, right?  So, use bibv.  Here is a sample....
X
XScript started on Thu Jun 22 23:41:23 1989
Xgiza Bibcreate. bibv
XUsage: bibverify <filename>
Xgiza Bibcreate. bibv foo
XFILE foo.bib has 1 records
XThis is BibTeX, Version 0.99c in C converted with ptc
XThe top-level auxiliary file: bibtex.aux
XThe style file: specl.bst
XDatabase file #1: foo.bib
XThis is TeX, C Version 2.9 (no format preloaded)
X(bibtex.tex
XLaTeX Version 2.09 <26 Apr 1988>
X(/usr/local/lib/tex/macros/article.sty
XDocument Style `article' <16 Mar 88>.
X(/usr/local/lib/tex/macros/art10.sty)) (bibtex.aux) (bibtex.bbl) [1]
X(bibtex.aux)
XLaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.
XOutput written on bibtex.dvi (1 page, 676 bytes).
XTranscript written on bibtex.log.
Xgiza Bibcreate. ls
XMakefile	bibc.h		bibtex.tex	foo.bib		templates.c
XREADME		bibc.l		bibv*		inits.c		typescript
Xbibc.c		bibtex.dvi	btxbst.doc	specl.bst
Xgiza Bibcreate. 
X
Xscript done on Thu Jun 22 23:42:07 1989
X
X
XThe file bibtex.tex contains a skeleton tex file with all the bib
Xentries.  The file bibtex.dvi is how your bibliographic entries actually
Xlook like.
X
XNote that bibv uses a specially hacked bst file, called specl.bst.  This
Xstyle causes the bibitem keys to be the same as the \cite-keys that you
Xhave used.  This is a convenient style for keeping hardcopies for ready
Xreference, considering that these are sorted nicely and all that :)
XIf you would like to have a copy of the btxbst.doc file, send me a note,
Xand I'll send it to you....
X
XThe file, specl.bst, should either be in the current directory, or with
Xthe other .bst files, usually in /usr/local/lib/tex/bibtex/.
XActually, it should be in some directory which is a component of $TEXINPUTS
X
XIf you wish to remove this, edit bibv, and change the STYLE=specl line.
XFollow the directions in the file at that point.
X
X
XBest of luck, 
X
XDo send me some feedbacks on this...
X
XKANNAN				22/JUN/89
X
XUpdated:	Mon Jul 17 10:03:21 EDT 1989
EOFile README
chmod u=rw+,g=rw+,o=r++ README
echo '...done' 1>&2
echo -n "bibc.c..." 1>&2
if test -f bibc.c
then
	case $# in 
	0)
		echo 'exists, `sh filename -o'\'' to overwrite'
		exit 0;;
	esac
	case $1 in 
	-o)	;;
	*)
		echo 'exists, `sh filename -o'\'' to overwrite'
		exit 0;;
	esac
fi
sed 's/^X//' << 'EOFile bibc.c' > bibc.c
X/*
X * This program has been written by Kannan Varadhan.  You are welcome to
X * use, copy, modify, or circulate as you please, provided you do not
X * charge any fee for any of it, and you do not remove these header
X * comments from any of these files.
X *
X *		22/JUN/89
X */
X
X#define	GLOBALS
X#include "bibc.h"
X
Xmain (argc, argv, envp)
Xint	argc;
Xchar	**argv, **envp;
X
X{
Xint	retval;
X
X	retval = FLD_NULL;
X
X	process_args (argc, argv);
X	initialise (&bibitem);
X
X	while (retval = my_yylex()) {
X	  switch (retval) {
X	    case FLD_ERROR:	fprintf (stderr, "Uh oh! no no no\n");
X				continue;
X	    case ARTICLE:	retval = get_article ();	break;
X	    case BOOK:		retval = get_book ();		break;
X	    case BOOKLET:	retval = get_booklet ();	break;
X	    case CONFERENCE:	retval = get_inproceedings ();	break;
X	    case INBOOK:	retval = get_inbook ();		break;
X	    case INCOLLECTION:	retval = get_incollection ();	break;
X	    case INPROCEEDINGS:	retval = get_inproceedings ();	break;
X	    case MANUAL:	retval = get_manual ();		break;
X	    case MASTERSTHESIS:	retval = get_mastersthesis ();	break;
X	    case MISC:		retval = get_misc ();		break;
X	    case PHDTHESIS:	retval = get_phdthesis ();	break;
X	    case PROCEEDINGS:	retval = get_proceedings ();	break;
X	    case TECHREPORT:	retval = get_techreport ();	break;
X	    case UNPUBLISHED:	retval = get_unpublished ();	break;
X	    case FLD_EDITOR:	retval = edit (outfile, _O_outfilename, envp); break;
X	    }
X	  if (retval != -1)
X	    writeout (&bibitem, outfile);
X	  resetall (&bibitem);
X	  }
X	fclose (outfile);
X	return 0;
X}
X
Xwriteout (bi, outfile)
Xbibrec	*bi;
XFILE	*outfile;
X
X{
X#define	PUT(VAR,REC)							\
X	if (ISSET (VAR,REC))						\
X	  {								\
X	  if (Index (ISVAL(VAR,REC), QUOTE_CHAR))			\
X	    { tmp1 = OPEN_BRACE; tmp2 = CLOSE_BRACE ; }			\
X	  else								\
X	    tmp1 = tmp2 = QUOTE_CHAR;					\
X	  sprintf (recordbuf, "%s ,\n\t%s = %c%s%c", recordbuf,		\
X			(VAR)->REC.prompt, tmp1, ISVAL (VAR,REC), tmp2);\
X	  }
Xchar	recordbuf[1024];
Xchar	answer[10];
Xchar	tmp1, tmp2;
X
X	sprintf (recordbuf, "@%s { %s", ISVAL(bi, rectype), ISVAL (bi, citekey));
X	PUT (bi, address);
X	PUT (bi, annote);
X	PUT (bi, author);
X	PUT (bi, booktitle);
X	PUT (bi, chapter);
X	PUT (bi, edition);
X	PUT (bi, editor);
X	PUT (bi, howpublished);
X	PUT (bi, institution);
X	PUT (bi, journal);
X	PUT (bi, key);
X	PUT (bi, month);
X	PUT (bi, note);
X	PUT (bi, number);
X	PUT (bi, organisation);
X	PUT (bi, pages);
X	PUT (bi, publisher);
X	PUT (bi, school);
X	PUT (bi, series);
X	PUT (bi, title);
X	PUT (bi, type);
X	PUT (bi, volume);
X	PUT (bi, year);
X	PUT (bi, comment);
X	Strcat (recordbuf, "\n\t}\n\n");
X
X	write (2, "", 1);
X	if (_O_verbose)
X	  fprintf (stderr, recordbuf);
X	if (_O_verify)
X	  {
X	  fprintf (stderr, "Is this correct? [y/n] ");
X	  gets (answer);
X	  if (answer[0] == 'n')
X	    return 0;
X	  }
X	fprintf (outfile, recordbuf);
X	fflush (outfile);
X	return 0;
X}
X
X
Xget_field (next_field, rectype, status)
Xfield	*next_field;
Xchar	*rectype;
Xchar	status;
X
X{
X#define	ERRORMSG1	\
X	"ERROR: %s is a REQUIRED FIELD for %s. Let's try that again...sigh...\n"
X#define ERRORMSG2	\
X	"ERROR: Frankly my dear, I don't give a damn...\n"
Xchar	inputline[512];
Xchar	answer[32];
Xchar	error;
Xchar	secondtime = FALSE;
X
XRETRY:	fprintf (stderr, "%s%s? ", next_field->prompt, 
X		((status == OPTIONAL)? " (optional)" : "" ));
X	fflush (stderr);
X	error = FALSE;
X	if (! gets (inputline))
X	  if (status == REQUIRED) error = TRUE;
X	switch (inputline[0]) {
X	  case '\0':
X		if (status == REQUIRED)
X		  error = TRUE;
X		else
X		  return 0;
X		break;
X	  case '?':
X		fprintf (stderr, "%s\n", next_field->helpstring);
X		goto RETRY;
X	  case 'x':
X		if (! Strcmp(inputline, "xx"))
X		  {
X		  fprintf (stderr, "Abort? "); fflush (stderr);
X		  gets (answer);
X		  if (answer[0] == 'y')  return -1;
X		  }
X	  }
X	if (error)
X	  {
X	  if (secondtime)
X	    {
X	    fprintf (stderr, ERRORMSG2, next_field->prompt, rectype);
X	    return 0;
X	    }
X	  else
X	    {
X	    fprintf (stderr, ERRORMSG1, next_field->prompt, rectype);
X	    secondtime = TRUE;
X	    goto RETRY;
X	    }
X	  }
X	Strcpy (next_field->string, inputline);
X	next_field->full = TRUE;
X	return 0;
X}
X
X
Xedit (filep, editfile, envp)
XFILE	*filep;
Xchar	*editfile;
Xchar	**envp;
X
X{
XFILE	*freopen();
Xchar	*EDITOR, *TEXEDIT, *getenv();
Xchar	*temp, string[100];
Xint	editorpid;
X
X	if (editfile[0] == '\0')
X	  {
X	  fprintf (stderr, "No output file has been specified\n");
X	  return -1;
X	  }
X	TEXEDIT = getenv ("TEXEDIT");
X	if (! TEXEDIT)
X	  {
X	  EDITOR = getenv ("VISUAL");
X	  if (! EDITOR) EDITOR = getenv ("EDITOR");
X	  if (! EDITOR) EDITOR = DEFAULT_EDITOR;
X	  }
X	else
X	  {
X	  temp = Index (TEXEDIT, '%');
X	  temp++;
X	  if (temp && (*temp == 'd'))
X	    *temp = 'c'	/* We would like to replace with the '$' character*/;
X	  else
X	    {
X	    temp = Index (temp, '%');
X	    temp++;
X	    if (temp && (*temp++ == 'd'))
X	      *temp = 'c';
X	    }
X	  sprintf (string, TEXEDIT, '$', editfile);
X	  }
X
X
X	fclose (filep);
X	editorpid = fork();
X	if (editorpid < 0)
X	  {
X	  perror ("Cannot fork Editor");
X	  exit (-2);
X	  }
X	else if (editorpid == 0)	/* CHILD */
X	  {
X	  if (TEXEDIT)
X	    execle ("/bin/sh", "sh", "-c", string, (char *) NULL, envp);
X	  else
X	    execle (EDITOR, EDITOR, editfile, (char *) NULL, envp);
X	  perror ("Cannot exec Editor");
X	  exit (-3);
X	  }
X	else
X	  wait ((union wait *) 0);
X	filep = freopen (_O_outfilename, "a", filep);
X	return -1 /* A wierd return code, indicating, print nothing..*/;
X}
EOFile bibc.c
chmod u=rw+,g=rw+,o=r++ bibc.c
echo '...done' 1>&2
echo -n "bibc.h..." 1>&2
if test -f bibc.h
then
	case $# in 
	0)
		echo 'exists, `sh filename -o'\'' to overwrite'
		exit 0;;
	esac
	case $1 in 
	-o)	;;
	*)
		echo 'exists, `sh filename -o'\'' to overwrite'
		exit 0;;
	esac
fi
sed 's/^X//' << 'EOFile bibc.h' > bibc.h
X/*
X * This program has been written by Kannan Varadhan.  You are welcome to
X * use, copy, modify, or circulate as you please, provided you do not
X * charge any fee for any of it, and you do not remove these header
X * comments from any of these files.
X *
X *		22/JUN/89
X */
X
X#include <stdio.h>
X#include <sys/file.h>
X#include "strings.h"
X
X#ifdef	GLOBALS
X#define	DCL(TYPE,VAR,VAL)	TYPE	VAR = VAL
X#define	DCLX(TYPE,VAR)		TYPE	VAR
X#else
X#define	DCL(TYPE,VAR,VAL)	extern	TYPE	VAR
X#define	DCLX(TYPE,VAR)		extern	TYPE	VAR
X#endif
X
X#define	FALSE	0
X#define	TRUE	! FALSE
X
X#define	OPTIONAL	FALSE
X#define	REQUIRED	TRUE
X
X#define	FLD_ERROR		-1
X#define	FLD_NULL	0x0000
X#define	ARTICLE		0x0001
X#define	BOOK		0x0002
X#define	BOOKLET		0x0004
X#define	CONFERENCE	0x0008
X#define	INBOOK		0x0010
X#define	INCOLLECTION	0x0020
X#define	INPROCEEDINGS	0x0040
X#define	MANUAL		0x0080
X#define	MASTERSTHESIS	0x0100
X#define	MISC		0x0200
X#define	PHDTHESIS	0x0400
X#define	PROCEEDINGS	0x0800
X#define	TECHREPORT	0x1000
X#define	UNPUBLISHED	0x2000
X#define	FLD_EDITOR	0x4000
X
X#define	GET(VAR,FIELD,STATUS)			\
X	if (get_field (&(VAR)->FIELD, ISVAL(VAR, rectype), STATUS) == -1)\
X		return -1 
X#define	SET(VAR,FIELD,VALUE)	{			\
X		Strcpy ((VAR)->FIELD.string, VALUE);	\
X		(VAR)->FIELD.full = TRUE;		\
X		}
X#define	RESET(VAR,FIELD)	{			\
X		Strcpy ((VAR)->FIELD.string, "");	\
X		(VAR)->FIELD.full = FALSE;		\
X		}
X#define	ISSET(VAR,FIELD)	(VAR)->FIELD.full
X#define	ISVAL(VAR,FIELD)	(VAR)->FIELD.string
X#define	ISHELP(VAR,FIELD)	(VAR)->FIELD.helpstring
Xtypedef	struct	record	{
X	char	full	/* Actually holds a boolean place value	*/;
X	char	string[391]	/* An even 32 words / field	*/;
X	char	prompt[32];
X	char	helpstring[344]	/* Display if user is confused	*/;
X	}	field;
X
Xtypedef	struct	biblio_record	{
X	field	rectype;
X	field	citekey;
X	field	address;
X	field	annote;
X	field	author;
X	field	booktitle;
X	field	chapter;
X	field	edition;
X	field	editor;
X	field	howpublished;
X	field	institution;
X	field	journal;
X	field	key;
X	field	month;
X	field	note;
X	field	number;
X	field	organisation;
X	field	pages;
X	field	publisher;
X	field	school;
X	field	series;
X	field	title;
X	field	type;
X	field	volume;
X	field	year;
X	field	comment;
X	field	cross_ref;
X	}	bibrec;
X
X#ifdef DEBUG
X#define	WRITE(STRING)	write(2,STRING,strlen(STRING));write(2,"\n",1)
X#endif
X
XDCL (char, _O_help, FALSE);
XDCL (char, _O_verify, FALSE);
XDCL (char, _O_verbose, TRUE);
XDCL (FILE, *outfile, stdout);
XDCL (char, _O_outfilename[50], "");
XDCLX (bibrec, bibitem);
X
X#define	DEFAULT_EDITOR	"/usr/ucb/vi"
X
X
X#define	QUOTE_CHAR	'"'
X#define	OPEN_BRACE	'{'
X#define	CLOSE_BRACE	'}'
X
EOFile bibc.h
chmod u=rw+,g=rw+,o=r++ bibc.h
echo '...done' 1>&2
echo -n "bibc.l..." 1>&2
if test -f bibc.l
then
	case $# in 
	0)
		echo 'exists, `sh filename -o'\'' to overwrite'
		exit 0;;
	esac
	case $1 in 
	-o)	;;
	*)
		echo 'exists, `sh filename -o'\'' to overwrite'
		exit 0;;
	esac
fi
sed 's/^X//' << 'EOFile bibc.l' > bibc.l
X%{
X
X/*
X * This program has been written by Kannan Varadhan.  You are welcome to
X * use, copy, modify, or circulate as you please, provided you do not
X * charge any fee for any of it, and you do not remove these header
X * comments from any of these files.
X *
X *		22/JUN/89
X */
X
X#include	"bibc.h"
X#undef	YY_INPUT
X#define	YY_INPUT(buf,reslt,msize)	my_input (buf, &reslt, msize)
X
Xmy_input (buf,reslt, size)
Xchar	*buf;
Xint	*reslt;
Xint	size;
X
X{
Xchar	inputln[80];
X
X	if (! gets (inputln))
X	  strcpy (buf, "EOF");
X	else
X	  strncpy (buf, inputln, size);
X	strcat (buf, "!");
X	return *reslt = strlen (buf);
X}
X
X
Xmy_yylex ()
X
X{
X#define	PROMPTSTR			"\
XWhat kind of record would you like to enter (one of the following)?\n\
X	article		book		booklet		conference\n\
X	inbook		incollection	inproceedings	manual\n\
X	mastersthesis	misc		phdthesis	proceedings\n\
X	techreport	unpublished\n\
Xor	EDIT		EOF		^D\n"
X	
X	fprintf (stderr, PROMPTSTR);
X	return yylex ();
X}
X%}
X
X%%
X"article!"		return ARTICLE;
X"book!"			return BOOK;
X"booklet!"		return BOOKLET;
X"conference!"		return CONFERENCE;
X"inbook!"		return INBOOK;
X"incollection!"		return INCOLLECTION;
X"inproceedings!"	return INPROCEEDINGS;
X"manual!"		return MANUAL;
X"mastersthesis!"	return MASTERSTHESIS;
X"misc!"			return MISC;
X"phdthesis!"		return PHDTHESIS;
X"proceedings!"		return PROCEEDINGS;
X"techreport!"		return TECHREPORT;
X"unpublished!"		return UNPUBLISHED;
X"quit!"			return FLD_NULL;
X"EOF!"			return FLD_NULL;
X"EDIT!"			return FLD_EDITOR;
X[a-zA-Z0-9]*!		return FLD_ERROR;
X%%
X
EOFile bibc.l
chmod u=rw+,g=rw+,o=r++ bibc.l
echo '...done' 1>&2
echo -n "bibv..." 1>&2
if test -f bibv
then
	case $# in 
	0)
		echo 'exists, `sh filename -o'\'' to overwrite'
		exit 0;;
	esac
	case $1 in 
	-o)	;;
	*)
		echo 'exists, `sh filename -o'\'' to overwrite'
		exit 0;;
	esac
fi
sed 's/^X//' << 'EOFile bibv' > bibv
X#! /bin/sh
X
XFN=`basename $0`
X
Xcase $# in
X0)	echo "$FN: Usage: bibverify <filename> [<filename>*]" ; exit ;;
Xesac
X
X#
X# This bibv is made to, and is most useful, IMHO, when it is using
X# the style file, specl.bst.  If for some strange reason, you are 
X# not, or do not wish to use this style file, comment the line
X# below, and uncomment the one below that
XSTYLE=specl
X#STYLE=alpha	# Actually, stick your preferred STYLE file here then
X
XFILE=bibtex
XBIBFILE=${FILE}.bib
XTEXFILE=${FILE}.tex
XTMPFIL1=sysut1.$$
X
Xtrap 'rm ${FILE}.bbl ${FILE}.aux ${FILE}.log ${FILE}.blg $TMPFIL1 ; exit' \
X						1 2 3 15
X
X> $TEXFILE
X> ${FILE}.bbl
X> ${FILE}.aux
X> ${FILE}.log
X> ${FILE}.blg
X> $TMPFIL1
X
Xecho "\documentstyle{article}"				>> $TEXFILE
Xecho "\begin{document}"					>> $TEXFILE
Xecho "\bibliographystyle{$STYLE}"			>> $TEXFILE
Xecho "\title{Verifying Biblio files}"			>> $TEXFILE
Xecho "\author{$USER}"					>> $TEXFILE
Xecho "\date{\today}"					>> $TEXFILE
Xecho "\maketitle"					>> $TEXFILE
Xecho ""							>> $TEXFILE
Xecho ""							>> $TEXFILE
X
XBIBRECD=""
Xfor i
Xdo
X	file="`echo $i | sed 's/.bib//'`"
X	bibfile=${file}.bib
X	TITLE=`echo $bibfile | sed 's/_/-/; s/#/-/'`
X	echo "\section{FILE $TITLE}"			>> $TEXFILE
X	BIBRECD="${BIBRECD},${file}"
X	echo FILE $bibfile has `egrep '^@' $bibfile | wc -l` records
X	sed -n 's/^@.*{[ 	]*\(.*\)/\\nocite {\1}/p' $bibfile  |
X		sed 's/[, 	]//g' >> $TMPFIL1
X
Xdone
XBIBRECD="`echo $BIBRECD | sed 's/,//'`"
X
Xecho "\bibliography{$BIBRECD}"				>> $TEXFILE
Xcat $TMPFIL1						>> $TEXFILE
Xecho "\end{document}"					>> $TEXFILE
X
X# Do this run silently....
Xlatex  $FILE	2>&- 1>&- </dev/null || {
X	echo "$FN: cannot run latex, see yah"
X	rm ${FILE}.bbl ${FILE}.aux ${FILE}.log ${FILE}.blg $TMPFIL1
X	exit
X	}
X
Xbibtex $FILE
Xlatex  $FILE
X
X# Cleanup...
Xrm ${FILE}.bbl ${FILE}.aux ${FILE}.log ${FILE}.blg $TMPFIL1
X
Xexit
EOFile bibv
chmod u=rwx,g=r+x,o=r+x bibv
echo '...done' 1>&2
echo -n "inits.c..." 1>&2
if test -f inits.c
then
	case $# in 
	0)
		echo 'exists, `sh filename -o'\'' to overwrite'
		exit 0;;
	esac
	case $1 in 
	-o)	;;
	*)
		echo 'exists, `sh filename -o'\'' to overwrite'
		exit 0;;
	esac
fi
sed 's/^X//' << 'EOFile inits.c' > inits.c
X/*
X * This program has been written by Kannan Varadhan.  You are welcome to
X * use, copy, modify, or circulate as you please, provided you do not
X * charge any fee for any of it, and you do not remove these header
X * comments from any of these files.
X *
X *		22/JUN/89
X */
X
X#include "bibc.h"
X
Xresetall (bibitem)
Xbibrec	*bibitem;
X
X{
X	RESET (bibitem, rectype);
X	RESET (bibitem, citekey);
X	RESET (bibitem, address);
X	RESET (bibitem, annote);
X	RESET (bibitem, author);
X	RESET (bibitem,	booktitle);
X	RESET (bibitem,	chapter);
X	RESET (bibitem,	edition);
X	RESET (bibitem,	edition);
X	RESET (bibitem,	editor);
X	RESET (bibitem,	howpublished);
X	RESET (bibitem,	institution);
X	RESET (bibitem,	journal);
X	RESET (bibitem,	key);
X	RESET (bibitem,	month);
X	RESET (bibitem,	note);
X	RESET (bibitem,	number);
X	RESET (bibitem,	organisation);
X	RESET (bibitem,	pages);
X	RESET (bibitem,	publisher);
X	RESET (bibitem,	school);
X	RESET (bibitem,	series);
X	RESET (bibitem,	title);
X	RESET (bibitem,	type);
X	RESET (bibitem,	volume);
X	RESET (bibitem,	year);
X	RESET (bibitem, comment);
X	RESET (bibitem, cross_ref);
X
X	return 0;
X}
X
X
Xinitialise (bibitem)
Xbibrec	*bibitem;
X
X{
X	resetall (bibitem);
X
X#define	STORHELP(VAR,FIELD,VALUE,HELP) 		\
X	{					\
X	Strcpy ((VAR)->FIELD.prompt, VALUE);	\
X	Strcpy ((VAR)->FIELD.helpstring, HELP);	\
X	}
X
X	STORHELP (bibitem,	rectype,	"",	""	);
X	STORHELP (bibitem,	citekey,	"CITEKEY",
X"The key used to cross reference with the \cite command in the\n\
X main text."							);
X	STORHELP (bibitem,	address,	"ADDRESS",
X"Publisher's address.For major publishing houses, just the city\n\
X is given, for smaller publishers, you might choose to give the\n\
X full address."							);
X	STORHELP (bibitem,	author,		"AUTHOR",
X"The name(s) of the author(s).  Separate multiple authors by the\n\
X keyword 'and'.  See the LaTeX manual for more help."		);
X	STORHELP (bibitem,	annote,		"ANNOTE",
X"An annotation. Not used in the standard bibliography styles, but\n\
X may be used by others."					);
X	STORHELP (bibitem,	booktitle,	"BOOKTITLE",
X"Title of the book, part of which is being cited."		);
X	STORHELP (bibitem,	chapter,	"CHAPTER",
X"A chapter number."						);
X	STORHELP (bibitem,	edition,	"EDITION",
X"The edition of the book--for example, 'second'."		);
X	STORHELP (bibitem,	editor,		"EDITOR",
X"Name(s) of editor(s), typed as in the author field.  If the author\n\
X is also indicated, then this field gives the editor of the book or\n\
X collection in which the refernce appears."			);
X	STORHELP (bibitem,	howpublished,	"HOWPUBLISHED",
X"How something strange has been published."			);
X	STORHELP (bibitem,	institution,	"INSTITUTION",
X"The institution that published the work."			);
X	STORHELP (bibitem,	journal,	"JOURNAL",
X"The name of a journal."					);
X	STORHELP (bibitem,	key,		"KEY",
X"Used for alphabetising and creating a label when the author and\n\
X editor fields are missing."					);
X	STORHELP (bibitem,	month,		"MONTH",
X"The month in which the work was published.  For an unpublished\n\
X work, the month in which it was written."			);
X	STORHELP (bibitem,	note,		"NOTE",
X"Any additional information that can help the reader."		);
X	STORHELP (bibitem,	number,		"NUMBER",
X"The number of a journal, magazine or technical report."	);
X	STORHELP (bibitem,	organisation,	"ORGANISATION",
X"The organisation sponsoring the conference."			);
X	STORHELP (bibitem,	pages,		"PAGES",
X"One or more page numbers, or range of page numbers, as 42--111,\n\
X or 7,41,73--97."						);
X	STORHELP (bibitem,	publisher,	"PUBLISHER",
X"The publisher's name."						);
X	STORHELP (bibitem,	school,		"SCHOOL",
X"The name of the school in which the thesis was written."	);
X	STORHELP (bibitem,	series,		"SERIES",
X"The name of a series or set of books."				);
X	STORHELP (bibitem,	title,		"TITLE",
X"The work's title"						);
X	STORHELP (bibitem,	type,		"TYPE",
X"The type of a technical report, for example, 'Research Note'."	);
X	STORHELP (bibitem,	volume,		"VOLUME",
X"The volume of a journal or multivolume work."			);
X	STORHELP (bibitem,	year,		"YEAR",
X"The year of publication, or for an unpublished work, the year in\n\
X which it was written."						);
X	STORHELP (bibitem,	comment,	"COMMENT",
X"Any relevant info associated with this record that you would like\n\
X to store herein."						);
X	STORHELP (bibitem,	cross_ref,	"CROSS-REFERENCE",
X"used to fill in missing field info in this record from the\n\
X cross-referenced bib-record..see BiBTeXing manual for more help.");
X#undef	STORHELP
X	return 0;
X}
X
X
Xprocess_args (argc, argv)
Xint	argc;
Xchar	*argv[];
X
X{
X#define	SHIFT	i++
X#define	args(str) (! Strcmp (argv[i], str))
X#define	USAGE	"Usage: bibc [-i|-verify] [+|-verbose] [-file <filename>]\n"
X
Xint	i;
X
X	for (i = 1; i < argc; SHIFT)
X	  {
X	  if (args ("-i") || args ("-verify"))
X	    { _O_verify = _O_verbose = TRUE; continue; }
X	  if args ("-verbose")
X	    { _O_verbose = TRUE; continue; }
X	  if args ("+verbose")
X	    { _O_verbose = FALSE; continue; }
X	  if args ("-help")
X	    { _O_help = TRUE; continue; }
X	  if args ("-file")
X	    { SHIFT;
X	      Strcpy (_O_outfilename, argv[i]);
X	      outfile = (FILE *) fopen (_O_outfilename, "a");
X	      continue;
X	    }
X	  /* default: */
X	    { _O_help = TRUE; continue; }
X	  }
X	if (_O_help)
X	  {
X	  fprintf (stderr, USAGE);
X	  exit (0);
X	  }
X	return 0;
X#undef SHIFT
X#undef args
X}
EOFile inits.c
chmod u=rw+,g=rw+,o=r++ inits.c
echo '...done' 1>&2
echo -n "lex.yy.c..." 1>&2
if test -f lex.yy.c
then
	case $# in 
	0)
		echo 'exists, `sh filename -o'\'' to overwrite'
		exit 0;;
	esac
	case $1 in 
	-o)	;;
	*)
		echo 'exists, `sh filename -o'\'' to overwrite'
		exit 0;;
	esac
fi
sed 's/^X//' << 'EOFile lex.yy.c' > lex.yy.c
X#define FLEX_COMPRESSED
X/* A lexical scanner generated by flex */
X
X/* scanner skeleton version:
X * $Header: flex.skel,v 1.1 89/05/24 00:32:10 vern Locked $
X */
X
X#include <stdio.h>
X
X#define FLEX_SCANNER
X
X/* returned upon end-of-file */
X#define YY_END_TOK 0
X
X/* amount of stuff to slurp up with each read */
X#define YY_READ_BUF_SIZE 8192
X
X#define YY_BUF_SIZE (YY_READ_BUF_SIZE * 2) /* size of input buffer */
X
X/* number of characters one rule can match.  One less than YY_BUF_SIZE to make
X * sure we never access beyond the end of an array
X */
X#define YY_BUF_MAX (YY_BUF_SIZE - 1)
X
X/* copy whatever the last rule matched to the standard output */
X
X#define ECHO fputs( yytext, yyout )
X
X/* gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
X * is returned in "result".
X */
X#define YY_INPUT(buf,result,max_size) \
X	if ( (result = read( fileno(yyin), buf, max_size )) < 0 ) \
X	    YY_FATAL_ERROR( "read() in flex scanner failed" );
X#define YY_NULL 0
X
X/* report a fatal error */
X#define YY_FATAL_ERROR(msg) \
X	{ \
X	fputs( msg, stderr ); \
X	putc( '\n', stderr ); \
X	exit( 1 ); \
X	}
X
X/* default yywrap function - always treat EOF as an EOF */
X#define yywrap() 1
X
X/* enter a start condition.  This macro really ought to take a parameter,
X * but we do it the disgusting crufty way that old Unix-lex does it
X */
X#define BEGIN yy_start = 1 +
X
X/* default declaration of generated scanner - a define so the user can
X * easily add parameters
X */
X#define YY_DECL int yylex()
X
X/* code executed at the end of each rule */
X#define YY_BREAK break;
X
X#define YY_END_OF_BUFFER_CHAR 0
X
X/* done after the current pattern has been matched and before the
X * corresponding action - sets up yytext
X */
X#define YY_DO_BEFORE_ACTION \
X	yytext = yy_bp; \
X	yy_hold_char = *yy_cp; \
X	*yy_cp = '\0'; \
X	yy_c_buf_p = yy_cp;
X
X/* returns the length of the matched text */
X#define yyleng (yy_cp - yy_bp)
X
X#define EOB_ACT_RESTART_SCAN 0
X#define EOB_ACT_END_OF_FILE 1
X#define EOB_ACT_LAST_MATCH 2
X
X/* return all but the first 'n' matched characters back to the input stream */
X#define yyless(n) \
X	{ \
X	*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ \
X	yy_c_buf_p = yy_cp = yy_bp + n; \
X	YY_DO_BEFORE_ACTION; /* set up yytext again */ \
X	}
X
X#define unput(c) yyunput( c, yy_bp )
X
X#define YY_USER_ACTION
X
X# line 1 "bibc.l"
X#define INITIAL 0
X# line 2 "bibc.l"
X
X/*
X * This program has been written by Kannan Varadhan.  You are welcome to
X * use, copy, modify, or circulate as you please, provided you do not
X * charge any fee for any of it, and you do not remove these header
X * comments from any of these files.
X *
X *		22/JUN/89
X */
X
X#include	"bibc.h"
X#undef	YY_INPUT
X#define	YY_INPUT(buf,reslt,msize)	my_input (buf, &reslt, msize)
X
Xmy_input (buf,reslt, size)
Xchar	*buf;
Xint	*reslt;
Xint	size;
X
X{
Xchar	inputln[80];
X
X	if (! gets (inputln))
X	  strcpy (buf, "EOF");
X	else
X	  strncpy (buf, inputln, size);
X	strcat (buf, "!");
X	return *reslt = strlen (buf);
X}
X
X
Xmy_yylex ()
X
X{
X#define	PROMPTSTR			"\
XWhat kind of record would you like to enter (one of the following)?\n\
X	article		book		booklet		conference\n\
X	inbook		incollection	inproceedings	manual\n\
X	mastersthesis	misc		phdthesis	proceedings\n\
X	techreport	unpublished\n\
Xor	EDIT		EOF		^D\n"
X	
X	fprintf (stderr, PROMPTSTR);
X	return yylex ();
X}
X# line 49 "bibc.l"
X#define YY_END_OF_BUFFER 20
Xtypedef int yy_state_type;
Xstatic short int yy_accept[148] =
X    {   0,
X        0,    0,   20,   19,   18,   19,   19,   19,   19,   19,
X       19,   19,   19,   19,   19,   19,   18,    0,    0,    0,
X        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
X        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
X        0,    0,    0,    0,    0,    0,    0,    0,   16,    0,
X        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
X        0,    0,    0,   17,    0,    2,    0,    0,    0,    0,
X        0,    0,    0,   10,    0,    0,   15,    0,    0,    0,
X        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
X        0,    0,    0,    0,    5,    0,    0,    8,    0,    0,
X
X        0,    0,    0,    1,    3,    0,    0,    0,    0,    0,
X        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
X        0,    0,    0,    0,    0,   11,    0,    0,    0,    4,
X        0,    0,    0,    0,   13,    0,    0,    0,    0,   12,
X       14,    6,    0,    0,    7,    9,    0
X    } ;
X
Xstatic char yy_ec[128] =
X    {   0,
X        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
X        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
X        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
X        1,    1,    2,    1,    1,    1,    1,    1,    1,    1,
X        1,    1,    1,    1,    1,    1,    1,    3,    3,    3,
X        3,    3,    3,    3,    3,    3,    3,    1,    1,    1,
X        1,    1,    1,    1,    3,    3,    3,    4,    5,    6,
X        3,    3,    7,    3,    3,    3,    3,    3,    8,    3,
X        3,    3,    3,    9,    3,    3,    3,    3,    3,    3,
X        1,    1,    1,    1,    1,    1,   10,   11,   12,   13,
X
X       14,   15,   16,   17,   18,    3,   19,   20,   21,   22,
X       23,   24,   25,   26,   27,   28,   29,    3,    3,    3,
X        3,    3,    1,    1,    1,    1,    1
X    } ;
X
Xstatic char yy_meta[30] =
X    {   0,
X        1,    2,    2,    2,    2,    2,    2,    2,    2,    2,
X        2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
X        2,    2,    2,    2,    2,    2,    2,    2,    2
X    } ;
X
Xstatic short int yy_base[149] =
X    {   0,
X        0,    0,  265,  266,  266,  262,   28,   29,   31,   33,
X       35,   32,   36,   37,   38,   39,  266,  261,   41,   43,
X       42,   44,   49,   57,   56,   45,   61,   62,   58,   63,
X       71,   75,  260,   78,   80,   77,   84,   85,   86,   87,
X       89,   88,   91,   92,   95,   96,   99,  259,  266,  103,
X      100,  104,  101,  107,  108,  112,  119,  258,  109,  123,
X      255,  127,  128,  266,  130,  266,  132,  133,  136,  134,
X      139,  138,  140,  266,  142,  143,  266,  146,  141,  150,
X      145,  160,  254,  161,  163,  253,  165,  166,  167,  147,
X      168,  252,  251,  174,  266,  170,  176,  266,  177,  179,
X
X      181,  183,  182,  266,  266,  186,  185,  187,  193,  189,
X      192,  199,  200,  201,  202,  205,  210,  248,  206,  209,
X      216,  245,  217,  219,  224,  266,  225,  244,  226,  266,
X      227,  229,  230,  242,  266,  241,  240,  231,  232,  266,
X      266,  266,  236,  234,  266,  266,  266,  233
X    } ;
X
Xstatic short int yy_def[149] =
X    {   0,
X      147,    1,  147,  147,  147,  148,  148,  148,  148,  148,
X      148,  148,  148,  148,  148,  148,  147,  148,  148,  148,
X      148,  148,  148,  148,  148,  148,  148,  148,  148,  148,
X      148,  148,  148,  148,  148,  148,  148,  148,  148,  148,
X      148,  148,  148,  148,  148,  148,  148,  148,  147,  148,
X      148,  148,  148,  148,  148,  148,  148,  148,  148,  148,
X      148,  148,  148,  147,  148,  147,  148,  148,  148,  148,
X      148,  148,  148,  147,  148,  148,  147,  148,  148,  148,
X      148,  148,  148,  148,  148,  148,  148,  148,  148,  148,
X      148,  148,  148,  148,  147,  148,  148,  147,  148,  148,
X
X      148,  148,  148,  147,  147,  148,  148,  148,  148,  148,
X      148,  148,  148,  148,  148,  148,  148,  148,  148,  148,
X      148,  148,  148,  148,  148,  147,  148,  148,  148,  147,
X      148,  148,  148,  148,  147,  148,  148,  148,  148,  147,
X      147,  147,  148,  148,  147,  147,    0,  147
X    } ;
X
Xstatic short int yy_nxt[296] =
X    {   0,
X        4,    5,    6,    6,    7,    6,    6,    6,    6,    8,
X        9,   10,    6,    6,    6,    6,    6,   11,    6,    6,
X       12,    6,    6,   13,   14,    6,    6,   15,   16,   17,
X       17,   19,   17,   17,   17,   20,   17,   17,   17,   17,
X       17,   25,   17,   17,   17,   17,   17,   32,   33,   26,
X       17,   30,   27,   22,   21,   23,   24,   17,   17,   17,
X       31,   28,   17,   17,   17,   29,   35,   37,   38,   34,
X       36,   42,   17,   43,   46,   45,   17,   40,   17,   17,
X       39,   17,   41,   48,   44,   17,   17,   17,   17,   17,
X       17,   52,   17,   17,   47,   50,   17,   17,   51,   58,
X
X       17,   66,   17,   60,   17,   17,   53,   54,   17,   17,
X       17,   55,   62,   17,   65,   56,   57,   68,   59,   67,
X       17,   72,   61,   69,   17,   75,   70,   63,   17,   17,
X       71,   17,   73,   17,   17,   17,   76,   17,   79,   17,
X       17,   17,   17,   17,   17,   81,   17,   17,   17,   80,
X       85,   17,   78,   84,   83,   88,   89,   86,   82,   90,
X       91,   17,   17,   92,   17,   87,   17,   17,   17,   17,
X      102,   17,   93,   94,   96,   17,   97,   17,   17,  101,
X       17,  107,   17,   17,   17,  103,   17,   17,   17,  108,
X       17,   99,  100,   17,   17,  106,  110,  114,  111,  116,
X
X       17,   17,   17,   17,  109,  112,   17,   17,  113,  117,
X       17,   17,  115,  119,  122,  118,  121,   17,   17,  123,
X       17,  127,  124,  125,  120,   17,   17,   17,   17,  129,
X       17,   17,   17,   17,   18,  146,  128,  145,  136,  131,
X      132,  142,  141,  140,  138,  135,  130,  139,  137,  126,
X      133,  134,  105,  104,   98,   95,   77,  143,  144,   74,
X       64,   49,   17,   17,  147,    3,  147,  147,  147,  147,
X      147,  147,  147,  147,  147,  147,  147,  147,  147,  147,
X      147,  147,  147,  147,  147,  147,  147,  147,  147,  147,
X      147,  147,  147,  147,  147
X
X    } ;
X
Xstatic short int yy_chk[296] =
X    {   0,
X        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
X        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
X        1,    1,    1,    1,    1,    1,    1,    1,    1,    7,
X        8,    7,    9,   12,   10,    7,   11,   13,   14,   15,
X       16,   12,   19,   21,   20,   22,   26,   19,   20,   12,
X       23,   15,   13,    9,    8,   10,   11,   25,   24,   29,
X       16,   13,   27,   28,   30,   14,   22,   24,   24,   21,
X       23,   26,   31,   27,   30,   29,   32,   25,   36,   34,
X       24,   35,   25,   32,   28,   37,   38,   39,   40,   42,
X       41,   36,   43,   44,   31,   34,   45,   46,   35,   42,
X
X       47,   51,   53,   44,   50,   52,   37,   38,   54,   55,
X       59,   39,   46,   56,   50,   40,   41,   52,   43,   51,
X       57,   56,   45,   53,   60,   59,   54,   47,   62,   63,
X       55,   65,   57,   67,   68,   70,   60,   69,   63,   72,
X       71,   73,   79,   75,   76,   67,   81,   78,   90,   65,
X       71,   80,   62,   70,   69,   75,   76,   72,   68,   78,
X       79,   82,   84,   80,   85,   73,   87,   88,   89,   91,
X       90,   96,   81,   82,   84,   94,   85,   97,   99,   89,
X      100,   96,  101,  103,  102,   91,  107,  106,  108,   97,
X      110,   87,   88,  111,  109,   94,  100,  106,  101,  108,
X
X      112,  113,  114,  115,   99,  102,  116,  119,  103,  109,
X      120,  117,  107,  111,  114,  110,  113,  121,  123,  115,
X      124,  119,  116,  117,  112,  125,  127,  129,  131,  121,
X      132,  133,  138,  139,  148,  144,  120,  143,  129,  123,
X      124,  137,  136,  134,  132,  128,  122,  133,  131,  118,
X      125,  127,   93,   92,   86,   83,   61,  138,  139,   58,
X       48,   33,   18,    6,    3,  147,  147,  147,  147,  147,
X      147,  147,  147,  147,  147,  147,  147,  147,  147,  147,
X      147,  147,  147,  147,  147,  147,  147,  147,  147,  147,
X      147,  147,  147,  147,  147
X
X    } ;
X
X/* the intent behind this definition is that it'll catch
X * any uses of REJECT which flex missed
X */
X#define REJECT reject_used_but_not_detected
X
XFILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
X
X/* these variables are all declared out here so that section 3 code can
X * manipulate them
X */
Xstatic char *yy_c_buf_p;	/* points to current character in buffer */
Xstatic int yy_init = 1;		/* whether we need to initialize */
Xstatic int yy_start = 0;	/* start state number */
X
X/* true when we've seen an EOF for the current input file */
Xstatic int yy_eof_has_been_seen;
X
Xstatic int yy_n_chars;		/* number of characters read into yy_ch_buf */
X
X/* yy_ch_buf has to be 2 characters longer than YY_BUF_SIZE because we need
X * to put in 2 end-of-buffer characters (this is explained where it is
X * done) at the end of yy_ch_buf
X */
Xstatic char yy_ch_buf[YY_BUF_SIZE + 2];
X
X/* yy_hold_char holds the character lost when yytext is formed */
Xstatic char yy_hold_char;
Xchar *yytext;
X
Xstatic yy_state_type yy_last_accepting_state;
Xstatic char *yy_last_accepting_cpos;
X
Xstatic yy_state_type yy_get_previous_state();
Xstatic int yy_get_next_buffer();
X
Xstatic yyunput();
Xstatic input();
X
XYY_DECL
X    {
X    register yy_state_type yy_current_state;
X    register char *yy_cp, *yy_bp;
X    register int yy_act;
X
X
X
X    if ( yy_init )
X	{
X	if ( ! yy_start )
X	    yy_start = 1;	/* first start state */
X
X	if ( ! yyin )
X	    yyin = stdin;
X
X	if ( ! yyout )
X	    yyout = stdout;
X
Xnew_file:
X	/* this is where we enter upon encountering an end-of-file and
X	 * yywrap() indicating that we should continue processing
X	 */
X
X	/* we put in the '\n' and start reading from [1] so that an
X	 * initial match-at-newline will be true.
X	 */
X
X	yy_ch_buf[0] = '\n';
X	yy_n_chars = 1;
X
X	/* we always need two end-of-buffer characters.  The first causes
X	 * a transition to the end-of-buffer state.  The second causes
X	 * a jam in that state.
X	 */
X	yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
X	yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
X
X	yy_eof_has_been_seen = 0;
X
X	yytext = yy_c_buf_p = &yy_ch_buf[1];
X	yy_hold_char = *yy_c_buf_p;
X	yy_init = 0;
X	}
X
X    while ( 1 )		/* loops until end-of-file is reached */
X	{
X	yy_cp = yy_c_buf_p;
X
X	/* support of yytext */
X	*yy_cp = yy_hold_char;
X
X	/* yy_bp points to the position in yy_ch_buf of the start of the
X	 * current run.
X	 */
X	yy_bp = yy_cp;
X
X	yy_current_state = yy_start;
X	do
X	    {
X	    register char yy_c = yy_ec[*yy_cp];
X	    if ( yy_accept[yy_current_state] )
X		{
X		yy_last_accepting_state = yy_current_state;
X		yy_last_accepting_cpos = yy_cp;
X		}
X	    while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
X		{
X		yy_current_state = yy_def[yy_current_state];
X		if ( yy_current_state >= 148 )
X		    yy_c = yy_meta[yy_c];
X		}
X	    yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
X	    ++yy_cp;
X	    }
X	while ( yy_base[yy_current_state] != 266 );
X
X	/* bogus while loop to let YY_BACK_TRACK and EOB_ACT_LAST_MATCH
X	 * actions branch here without introducing an optimizer-daunting
X	 * goto
X	 */
X	while ( 1 )
X	    {
X	    yy_act = yy_accept[yy_current_state];
X
X	    YY_DO_BEFORE_ACTION;
X	    YY_USER_ACTION;
X
X#ifdef FLEX_DEBUG
X	    fprintf( stderr, "--accepting rule #%d (\"%s\")\n",
X		     yy_act, yytext );
X#endif
X	    switch ( yy_act )
X		{
X		case 0: /* must backtrack */
X		/* undo the effects of YY_DO_BEFORE_ACTION */
X		*yy_cp = yy_hold_char;
X		yy_cp = yy_last_accepting_cpos;
X		yy_current_state = yy_last_accepting_state;
X		continue; /* go to "YY_DO_BEFORE_ACTION" */
X
Xcase 1:
X# line 50 "bibc.l"
Xreturn ARTICLE;
X	YY_BREAK
Xcase 2:
X# line 51 "bibc.l"
Xreturn BOOK;
X	YY_BREAK
Xcase 3:
X# line 52 "bibc.l"
Xreturn BOOKLET;
X	YY_BREAK
Xcase 4:
X# line 53 "bibc.l"
Xreturn CONFERENCE;
X	YY_BREAK
Xcase 5:
X# line 54 "bibc.l"
Xreturn INBOOK;
X	YY_BREAK
Xcase 6:
X# line 55 "bibc.l"
Xreturn INCOLLECTION;
X	YY_BREAK
Xcase 7:
X# line 56 "bibc.l"
Xreturn INPROCEEDINGS;
X	YY_BREAK
Xcase 8:
X# line 57 "bibc.l"
Xreturn MANUAL;
X	YY_BREAK
Xcase 9:
X# line 58 "bibc.l"
Xreturn MASTERSTHESIS;
X	YY_BREAK
Xcase 10:
X# line 59 "bibc.l"
Xreturn MISC;
X	YY_BREAK
Xcase 11:
X# line 60 "bibc.l"
Xreturn PHDTHESIS;
X	YY_BREAK
Xcase 12:
X# line 61 "bibc.l"
Xreturn PROCEEDINGS;
X	YY_BREAK
Xcase 13:
X# line 62 "bibc.l"
Xreturn TECHREPORT;
X	YY_BREAK
Xcase 14:
X# line 63 "bibc.l"
Xreturn UNPUBLISHED;
X	YY_BREAK
Xcase 15:
X# line 64 "bibc.l"
Xreturn FLD_NULL;
X	YY_BREAK
Xcase 16:
X# line 65 "bibc.l"
Xreturn FLD_NULL;
X	YY_BREAK
Xcase 17:
X# line 66 "bibc.l"
Xreturn FLD_EDITOR;
X	YY_BREAK
Xcase 18:
X# line 67 "bibc.l"
Xreturn FLD_ERROR;
X	YY_BREAK
Xcase 19:
X# line 68 "bibc.l"
XECHO;
X	YY_BREAK
X
X		case YY_END_OF_BUFFER:
X		    /* undo the effects of YY_DO_BEFORE_ACTION */
X		    *yy_cp = yy_hold_char;
X
X		    yytext = yy_bp;
X
X		    switch ( yy_get_next_buffer() )
X			{
X			case EOB_ACT_END_OF_FILE:
X			    {
X			    if ( yywrap() )
X				{
X				/* note: because we've taken care in
X				 * yy_get_next_buffer() to have set up yytext,
X				 * we can now set up yy_c_buf_p so that if some
X				 * total hoser (like flex itself) wants
X				 * to call the scanner after we return the
X				 * YY_NULL, it'll still work - another YY_NULL
X				 * will get returned.
X				 */
X				yy_c_buf_p = yytext;
X				return ( YY_NULL );
X				}
X
X			    else
X				goto new_file;
X			    }
X			    break;
X
X			case EOB_ACT_RESTART_SCAN:
X			    yy_c_buf_p = yytext;
X			    yy_hold_char = *yy_c_buf_p;
X			    break;
X
X			case EOB_ACT_LAST_MATCH:
X			    yy_c_buf_p = &yy_ch_buf[yy_n_chars];
X
X			    yy_current_state = yy_get_previous_state();
X
X			    yy_cp = yy_c_buf_p;
X			    yy_bp = yytext;
X			    continue; /* go to "YY_DO_BEFORE_ACTION" */
X			}
X		    break;
X
X		default:
X		    printf( "action # %d\n", yy_act );
X		    YY_FATAL_ERROR( "fatal flex scanner internal error" );
X		}
X
X	    break; /* exit bogus while loop */
X	    }
X	}
X    }
X
X
X/* yy_get_next_buffer - try to read in new buffer
X *
X * synopsis
X *     int yy_get_next_buffer();
X *     
X * returns a code representing an action
X *     EOB_ACT_LAST_MATCH - 
X *     EOB_ACT_RESTART_SCAN - restart the scanner
X *     EOB_ACT_END_OF_FILE - end of file
X */
X
Xstatic int yy_get_next_buffer()
X
X    {
X    if ( yy_c_buf_p != &yy_ch_buf[yy_n_chars + 1] )
X	{
X	YY_FATAL_ERROR( "NULL in input" );
X	/*NOTREACHED*/
X	}
X
X    else
X	{ /* try to read more data */
X	register char *dest = yy_ch_buf;
X	register char *source = yytext - 1; /* copy prev. char, too */
X	register int number_to_move, i;
X	int ret_val;
X	
X	/* first move last chars to start of buffer */
X	number_to_move = yy_c_buf_p - yytext;
X
X	for ( i = 0; i < number_to_move; ++i )
X	    *(dest++) = *(source++);
X
X	if ( yy_eof_has_been_seen )
X	    /* don't do the read, it's not guaranteed to return an EOF,
X	     * just force an EOF
X	     */
X	    yy_n_chars = 0;
X
X	else
X	    /* read in more data */
X	    YY_INPUT( (&yy_ch_buf[number_to_move]), yy_n_chars,
X		      YY_BUF_SIZE - number_to_move - 1 );
X
X	if ( yy_n_chars == 0 )
X	    {
X	    if ( number_to_move == 1 )
X		ret_val = EOB_ACT_END_OF_FILE;
X	    else
X		ret_val = EOB_ACT_LAST_MATCH;
X
X	    yy_eof_has_been_seen = 1;
X	    }
X
X	else
X	    ret_val = EOB_ACT_RESTART_SCAN;
X
X	yy_n_chars += number_to_move;
X	yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
X	yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
X
X	/* yytext begins at the second character in
X	 * yy_ch_buf; the first character is the one which
X	 * preceded it before reading in the latest buffer;
X	 * it needs to be kept around in case it's a
X	 * newline, so yy_get_previous_state() will have
X	 * with '^' rules active
X	 */
X
X	yytext = &yy_ch_buf[1];
X
X	return ( ret_val );
X	}
X    }
X
X
X/* yy_get_previous_state - get the state just before the EOB char was reached
X *
X * synopsis
X *     yy_state_type yy_get_previous_state();
X */
X
Xstatic yy_state_type yy_get_previous_state()
X
X    {
X    register yy_state_type yy_current_state;
X    register char *yy_cp;
X
X    yy_current_state = yy_start;
X
X    for ( yy_cp = yytext; yy_cp < yy_c_buf_p; ++yy_cp )
X	{
X	register char yy_c = yy_ec[*yy_cp];
X	if ( yy_accept[yy_current_state] )
X	    {
X	    yy_last_accepting_state = yy_current_state;
X	    yy_last_accepting_cpos = yy_cp;
X	    }
X	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
X	    {
X	    yy_current_state = yy_def[yy_current_state];
X	    if ( yy_current_state >= 148 )
X		yy_c = yy_meta[yy_c];
X	    }
X	yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
X	}
X
X    return ( yy_current_state );
X    }
X
X
Xstatic yyunput( c, yy_bp )
Xint c;
Xregister char *yy_bp;
X
X    {
X    register char *yy_cp = yy_c_buf_p;
X
X    *yy_cp = yy_hold_char; /* undo effects of setting up yytext */
X
X    if ( yy_cp < yy_ch_buf + 2 )
X	{ /* need to shift things up to make room */
X	register int number_to_move = yy_n_chars + 2; /* +2 for EOB chars */
X	register char *dest = &yy_ch_buf[YY_BUF_SIZE + 2];
X	register char *source = &yy_ch_buf[number_to_move];
X
X	while ( source > yy_ch_buf )
X	    *--dest = *--source;
X
X	yy_cp += dest - source;
X	yy_bp += dest - source;
X
X	if ( yy_cp < yy_ch_buf + 2 )
X	    YY_FATAL_ERROR( "flex scanner push-back overflow" );
X	}
X
X    if ( yy_cp > yy_bp && yy_cp[-1] == '\n' )
X	yy_cp[-2] = '\n';
X
X    *--yy_cp = c;
X
X    YY_DO_BEFORE_ACTION; /* set up yytext again */
X    }
X
X
Xstatic int input()
X
X    {
X    int c;
X    char *yy_cp = yy_c_buf_p;
X
X    *yy_cp = yy_hold_char;
X
X    if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
X	{ /* need more input */
X	yytext = yy_c_buf_p;
X	++yy_c_buf_p;
X
X	switch ( yy_get_next_buffer() )
X	    {
X	    /* this code, unfortunately, is somewhat redundant with
X	     * that above
X	     */
X	    case EOB_ACT_END_OF_FILE:
X		{
X		if ( yywrap() )
X		    {
X		    yy_c_buf_p = yytext;
X		    return ( EOF );
X		    }
X
X		yy_ch_buf[0] = '\n';
X		yy_n_chars = 1;
X		yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
X		yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
X		yy_eof_has_been_seen = 0;
X		yytext = yy_c_buf_p = &yy_ch_buf[1];
X		yy_hold_char = *yy_c_buf_p;
X
X		return ( input() );
X		}
X		break;
X
X	    case EOB_ACT_RESTART_SCAN:
X		yy_c_buf_p = yytext;
X		break;
X
X	    case EOB_ACT_LAST_MATCH:
X		YY_FATAL_ERROR( "unexpected last match in input()" );
X	    }
X	}
X
X    c = *yy_c_buf_p;
X    yy_hold_char = *++yy_c_buf_p;
X
X    return ( c );
X    }
X# line 68 "bibc.l"
X
X
EOFile lex.yy.c
chmod u=rw+,g=rw+,o=r++ lex.yy.c
echo '...done' 1>&2
echo -n "specl.bst..." 1>&2
if test -f specl.bst
then
	case $# in 
	0)
		echo 'exists, `sh filename -o'\'' to overwrite'
		exit 0;;
	esac
	case $1 in 
	-o)	;;
	*)
		echo 'exists, `sh filename -o'\'' to overwrite'
		exit 0;;
	esac
fi
sed 's/^X//' << 'EOFile specl.bst' > specl.bst
X% BibTeX `plain' family
X% BibTeX style: spec(ia)l   generates the \cite-key specified by the
X% user as is....useful for keeping a cross-referenced hardcopy
X% Designed by Kannan Varadhan		22/JUN/89
X	% version 0.99a for BibTeX versions 0.99a or later, LaTeX version 2.09.
X	% Copyright (C) 1985, all rights reserved.
X	% Copying of this file is authorized only if either
X	% (1) you make absolutely no changes to your copy, including name, or
X	% (2) if you do make changes, you name it something other than
X	% btxbst.doc, plain.bst, unsrt.bst, alpha.bst, and abbrv.bst.
X	% This restriction helps ensure that all standard styles are identical.
X	% The file btxbst.doc has the documentation for this style.
X
X
X
XENTRY
X  { address
X    author
X    booktitle
X    chapter
X    edition
X    editor
X    howpublished
X    institution
X    journal
X    key
X    month
X    note
X    number
X    organization
X    pages
X    publisher
X    school
X    series
X    title
X    type
X    volume
X    year
X  }
X  {}
X
X
X  { label extra.label sort.label }
X
X
X
X
XINTEGERS { output.state before.all mid.sentence after.sentence after.block }
X
XFUNCTION {init.state.consts}
X{ #0 'before.all :=
X  #1 'mid.sentence :=
X  #2 'after.sentence :=
X  #3 'after.block :=
X}
X
X
XSTRINGS { s t }
X
XFUNCTION {output.nonnull}
X{ 's :=
X  output.state mid.sentence =
X    { ", " * write$ }
X    { output.state after.block =
X	{ add.period$ write$
X	  newline$
X	  "\newblock " write$
X	}
X	{ output.state before.all =
X	    'write$
X	    { add.period$ " " * write$ }
X	  if$
X	}
X      if$
X      mid.sentence 'output.state :=
X    }
X  if$
X  s
X}
X
XFUNCTION {output}
X{ duplicate$ empty$
X    'pop$
X    'output.nonnull
X  if$
X}
X
XFUNCTION {output.check}
X{ 't :=
X  duplicate$ empty$
X    { pop$ "empty " t * " in " * cite$ * warning$ }
X    'output.nonnull
X  if$
X}
X
XFUNCTION {output.bibitem}
X{ newline$
X
X      "\bibitem[" write$
X      label write$
X      "]{" write$
X
X  cite$ write$
X  "}" write$
X  newline$
X  ""
X  before.all 'output.state :=
X}
X
X
XFUNCTION {fin.entry}
X{ add.period$
X  write$
X  newline$
X}
X
XFUNCTION {new.block}
X{ output.state before.all =
X    'skip$
X    { after.block 'output.state := }
X  if$
X}
X
XFUNCTION {new.sentence}
X{ output.state after.block =
X    'skip$
X    { output.state before.all =
X	'skip$
X	{ after.sentence 'output.state := }
X      if$
X    }
X  if$
X}
X
X
XFUNCTION {not}
X{   { #0 }
X    { #1 }
X  if$
X}
X
XFUNCTION {and}
X{   'skip$
X    { pop$ #0 }
X  if$
X}
X
XFUNCTION {or}
X{   { pop$ #1 }
X    'skip$
X  if$
X}
X
X
XFUNCTION {new.block.checka}
X{ empty$
X    'skip$
X    'new.block
X  if$
X}
X
XFUNCTION {new.block.checkb}
X{ empty$
X  swap$ empty$
X  and
X    'skip$
X    'new.block
X  if$
X}
X
X
XFUNCTION {new.sentence.checka}
X{ empty$
X    'skip$
X    'new.sentence
X  if$
X}
X
XFUNCTION {new.sentence.checkb}
X{ empty$
X  swap$ empty$
X  and
X    'skip$
X    'new.sentence
X  if$
X}
X
X
XFUNCTION {field.or.null}
X{ duplicate$ empty$
X    { pop$ "" }
X    'skip$
X  if$
X}
X
XFUNCTION {emphasize}
X{ duplicate$ empty$
X    { pop$ "" }
X    { "{\em " swap$ * "}" * }
X  if$
X}
X
XINTEGERS { nameptr namesleft numnames }
X
XFUNCTION {format.names}
X{ 's :=
X  #1 'nameptr :=
X  s num.names$ 'numnames :=
X  numnames 'namesleft :=
X    { namesleft #0 > }
X
X    { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't :=
X
X      nameptr #1 >
X	{ namesleft #1 >
X	    { ", " * t * }
X	    { numnames #2 >
X		{ "," * }
X		'skip$
X	      if$
X	      t "others" =
X		{ " et~al." * }
X		{ " and " * t * }
X	      if$
X	    }
X	  if$
X	}
X	't
X      if$
X      nameptr #1 + 'nameptr :=
X      namesleft #1 - 'namesleft :=
X    }
X  while$
X}
X
XFUNCTION {format.authors}
X{ author empty$
X    { "" }
X    { author format.names }
X  if$
X}
X
XFUNCTION {format.editors}
X{ editor empty$
X    { "" }
X    { editor format.names
X      editor num.names$ #1 >
X	{ ", editors" * }
X	{ ", editor" * }
X      if$
X    }
X  if$
X}
X
X
XFUNCTION {format.title}
X{ title empty$
X    { "" }
X
X    { title "t" change.case$ }
X
X  if$
X}
X
X
X
XFUNCTION {n.dashify}
X{ 't :=
X  ""
X    { t empty$ not }
X    { t #1 #1 substring$ "-" =
X	{ t #1 #2 substring$ "--" = not
X	    { "--" *
X	      t #2 global.max$ substring$ 't :=
X	    }
X	    {   { t #1 #1 substring$ "-" = }
X		{ "-" *
X		  t #2 global.max$ substring$ 't :=
X		}
X	      while$
X	    }
X	  if$
X	}
X	{ t #1 #1 substring$ *
X	  t #2 global.max$ substring$ 't :=
X	}
X      if$
X    }
X  while$
X}
X
X
XFUNCTION {format.date}
X{ year empty$
X    { month empty$
X	{ "" }
X	{ "there's a month but no year in " cite$ * warning$
X	  month
X	}
X      if$
X    }
X    { month empty$
X	'year
X	{ month " " * year * }
X      if$
X    }
X  if$
X}
X
X
XFUNCTION {format.btitle}
X{ title emphasize
X}
X
X
XFUNCTION {tie.or.space.connect}
X{ duplicate$ text.length$ #3 <
X    { "~" }
X    { " " }
X  if$
X  swap$ * *
X}
X
X
XFUNCTION {either.or.check}
X{ empty$
X    'pop$
X    { "can't use both " swap$ * " fields in " * cite$ * warning$ }
X  if$
X}
X
X
XFUNCTION {format.bvolume}
X{ volume empty$
X    { "" }
X    { "volume" volume tie.or.space.connect
X      series empty$
X	'skip$
X	{ " of " * series emphasize * }
X      if$
X      "volume and number" number either.or.check
X    }
X  if$
X}
X
X
XFUNCTION {format.number.series}
X{ volume empty$
X    { number empty$
X	{ series field.or.null }
X	{ output.state mid.sentence =
X	    { "number" }
X	    { "Number" }
X	  if$
X	  number tie.or.space.connect
X	  series empty$
X	    { "there's a number but no series in " cite$ * warning$ }
X	    { " in " * series * }
X	  if$
X	}
X      if$
X    }
X    { "" }
X  if$
X}
X
X
XFUNCTION {format.edition}
X{ edition empty$
X    { "" }
X    { output.state mid.sentence =
X	{ edition "l" change.case$ " edition" * }
X	{ edition "t" change.case$ " edition" * }
X      if$
X    }
X  if$
X}
X
X
XINTEGERS { multiresult }
X
XFUNCTION {multi.page.check}
X{ 't :=
X  #0 'multiresult :=
X    { multiresult not
X      t empty$ not
X      and
X    }
X    { t #1 #1 substring$
X      duplicate$ "-" =
X      swap$ duplicate$ "," =
X      swap$ "+" =
X      or or
X	{ #1 'multiresult := }
X	{ t #2 global.max$ substring$ 't := }
X      if$
X    }
X  while$
X  multiresult
X}
X
X
XFUNCTION {format.pages}
X{ pages empty$
X    { "" }
X    { pages multi.page.check
X	{ "pages" pages n.dashify tie.or.space.connect }
X	{ "page" pages tie.or.space.connect }
X      if$
X    }
X  if$
X}
X
X
XFUNCTION {format.vol.num.pages}
X{ volume field.or.null
X  number empty$
X    'skip$
X    { "(" number * ")" * *
X      volume empty$
X	{ "there's a number but no volume in " cite$ * warning$ }
X	'skip$
X      if$
X    }
X  if$
X  pages empty$
X    'skip$
X    { duplicate$ empty$
X	{ pop$ format.pages }
X	{ ":" * pages n.dashify * }
X      if$
X    }
X  if$
X}
X
X
X
XFUNCTION {format.chapter.pages}
X{ chapter empty$
X    'format.pages
X    { type empty$
X	{ "chapter" }
X	{ type "l" change.case$ }
X      if$
X      chapter tie.or.space.connect
X      pages empty$
X	'skip$
X	{ ", " * format.pages * }
X      if$
X    }
X  if$
X}
X
X
XFUNCTION {format.in.ed.booktitle}
X{ booktitle empty$
X    { "" }
X    { editor empty$
X	{ "In " booktitle emphasize * }
X	{ "In " format.editors * ", " * booktitle emphasize * }
X      if$
X    }
X  if$
X}
X
X
XFUNCTION {empty.misc.check}
X{ author empty$ title empty$ howpublished empty$
X  month empty$ year empty$ note empty$
X  and and and and and
X
X  key empty$ not and
X
X    { "all relevant fields are empty in " cite$ * warning$ }
X    'skip$
X  if$
X}
X
X
XFUNCTION {format.thesis.type}
X{ type empty$
X    'skip$
X    { pop$
X      type "t" change.case$
X    }
X  if$
X}
X
X
XFUNCTION {format.tr.number}
X{ type empty$
X    { "Technical Report" }
X    'type
X  if$
X  number empty$
X    { "t" change.case$ }
X    { number tie.or.space.connect }
X  if$
X}
X
X
XFUNCTION {format.article.crossref}
X{ key empty$
X    { journal empty$
X	{ "need key or journal for " cite$ * " to crossref " * crossref *
X	  warning$
X	  ""
X	}
X	{ "In {\em " journal * "\/}" * }
X      if$
X    }
X    { "In " key * }
X  if$
X  " \cite{" * crossref * "}" *
X}
X
X
XFUNCTION {format.crossref.editor}
X{ editor #1 "{vv~}{ll}" format.name$
X  editor num.names$ duplicate$
X  #2 >
X    { pop$ " et~al." * }
X    { #2 <
X	'skip$
X	{ editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
X	    { " et~al." * }
X	    { " and " * editor #2 "{vv~}{ll}" format.name$ * }
X	  if$
X	}
X      if$
X    }
X  if$
X}
X
X
XFUNCTION {format.book.crossref}
X{ volume empty$
X    { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
X      "In "
X    }
X    { "Volume" volume tie.or.space.connect
X      " of " *
X    }
X  if$
X  editor empty$
X  editor field.or.null author field.or.null =
X  or
X    { key empty$
X	{ series empty$
X	    { "need editor, key, or series for " cite$ * " to crossref " *
X	      crossref * warning$
X	      "" *
X	    }
X	    { "{\em " * series * "\/}" * }
X	  if$
X	}
X	{ key * }
X      if$
X    }
X    { format.crossref.editor * }
X  if$
X  " \cite{" * crossref * "}" *
X}
X
X
XFUNCTION {format.incoll.inproc.crossref}
X{ editor empty$
X  editor field.or.null author field.or.null =
X  or
X    { key empty$
X	{ booktitle empty$
X	    { "need editor, key, or booktitle for " cite$ * " to crossref " *
X	      crossref * warning$
X	      ""
X	    }
X	    { "In {\em " booktitle * "\/}" * }
X	  if$
X	}
X	{ "In " key * }
X      if$
X    }
X    { "In " format.crossref.editor * }
X  if$
X  " \cite{" * crossref * "}" *
X}
X
X
XFUNCTION {article}
X{ output.bibitem
X  format.authors "author" output.check
X  new.block
X  format.title "title" output.check
X  new.block
X  crossref missing$
X    { journal emphasize "journal" output.check
X      format.vol.num.pages output
X      format.date "year" output.check
X    }
X    { format.article.crossref output.nonnull
X      format.pages output
X    }
X  if$
X  new.block
X  note output
X  fin.entry
X}
X
XFUNCTION {book}
X{ output.bibitem
X  author empty$
X    { format.editors "author and editor" output.check }
X    { format.authors output.nonnull
X      crossref missing$
X	{ "author and editor" editor either.or.check }
X	'skip$
X      if$
X    }
X  if$
X  new.block
X  format.btitle "title" output.check
X  crossref missing$
X    { format.bvolume output
X      new.block
X      format.number.series output
X      new.sentence
X      publisher "publisher" output.check
X      address output
X    }
X    { new.block
X      format.book.crossref output.nonnull
X    }
X  if$
X  format.edition output
X  format.date "year" output.check
X  new.block
X  note output
X  fin.entry
X}
X
X
XFUNCTION {booklet}
X{ output.bibitem
X  format.authors output
X  new.block
X  format.title "title" output.check
X  howpublished address new.block.checkb
X  howpublished output
X  address output
X  format.date output
X  new.block
X  note output
X  fin.entry
X}
X
X
X
XFUNCTION {inbook}
X{ output.bibitem
X  author empty$
X    { format.editors "author and editor" output.check }
X    { format.authors output.nonnull
X      crossref missing$
X	{ "author and editor" editor either.or.check }
X	'skip$
X      if$
X    }
X  if$
X  new.block
X  format.btitle "title" output.check
X  crossref missing$
X    { format.bvolume output
X      format.chapter.pages "chapter and pages" output.check
X      new.block
X      format.number.series output
X      new.sentence
X      publisher "publisher" output.check
X      address output
X    }
X    { format.chapter.pages "chapter and pages" output.check
X      new.block
X      format.book.crossref output.nonnull
X    }
X  if$
X  format.edition output
X  format.date "year" output.check
X  new.block
X  note output
X  fin.entry
X}
X
X
XFUNCTION {incollection}
X{ output.bibitem
X  format.authors "author" output.check
X  new.block
X  format.title "title" output.check
X  new.block
X  crossref missing$
X    { format.in.ed.booktitle "booktitle" output.check
X      format.bvolume output
X      format.number.series output
X      format.chapter.pages output
X      new.sentence
X      publisher "publisher" output.check
X      address output
X      format.edition output
X      format.date "year" output.check
X    }
X    { format.incoll.inproc.crossref output.nonnull
X      format.chapter.pages output
X    }
X  if$
X  new.block
X  note output
X  fin.entry
X}
X
X
XFUNCTION {inproceedings}
X{ output.bibitem
X  format.authors "author" output.check
X  new.block
X  format.title "title" output.check
X  new.block
X  crossref missing$
X    { format.in.ed.booktitle "booktitle" output.check
X      format.bvolume output
X      format.number.series output
X      format.pages output
X      address empty$
X	{ organization publisher new.sentence.checkb
X	  organization output
X	  publisher output
X	  format.date "year" output.check
X	}
X	{ address output.nonnull
X	  format.date "year" output.check
X	  new.sentence
X	  organization output
X	  publisher output
X	}
X      if$
X    }
X    { format.incoll.inproc.crossref output.nonnull
X      format.pages output
X    }
X  if$
X  new.block
X  note output
X  fin.entry
X}
X
X
XFUNCTION {conference} { inproceedings }
X
X
XFUNCTION {manual}
X{ output.bibitem
X  author empty$
X    { organization empty$
X	'skip$
X	{ organization output.nonnull
X	  address output
X	}
X      if$
X    }
X    { format.authors output.nonnull }
X  if$
X  new.block
X  format.btitle "title" output.check
X  author empty$
X    { organization empty$
X	{ address new.block.checka
X	  address output
X	}
X	'skip$
X      if$
X    }
X    { organization address new.block.checkb
X      organization output
X      address output
X    }
X  if$
X  format.edition output
X  format.date output
X  new.block
X  note output
X  fin.entry
X}
X
X
XFUNCTION {mastersthesis}
X{ output.bibitem
X  format.authors "author" output.check
X  new.block
X  format.title "title" output.check
X  new.block
X  "Master's thesis" format.thesis.type output.nonnull
X  school "school" output.check
X  address output
X  format.date "year" output.check
X  new.block
X  note output
X  fin.entry
X}
X
X
XFUNCTION {misc}
X{ output.bibitem
X  format.authors output
X  title howpublished new.block.checkb
X  format.title output
X  howpublished new.block.checka
X  howpublished output
X  format.date output
X  new.block
X  note output
X  fin.entry
X  empty.misc.check
X}
X
X
XFUNCTION {phdthesis}
X{ output.bibitem
X  format.authors "author" output.check
X  new.block
X  format.btitle "title" output.check
X  new.block
X  "PhD thesis" format.thesis.type output.nonnull
X  school "school" output.check
X  address output
X  format.date "year" output.check
X  new.block
X  note output
X  fin.entry
X}
X
X
XFUNCTION {proceedings}
X{ output.bibitem
X  editor empty$
X    { organization output }
X    { format.editors output.nonnull }
X  if$
X  new.block
X  format.btitle "title" output.check
X  format.bvolume output
X  format.number.series output
X  address empty$
X    { editor empty$
X	{ publisher new.sentence.checka }
X	{ organization publisher new.sentence.checkb
X	  organization output
X	}
X      if$
X      publisher output
X      format.date "year" output.check
X    }
X    { address output.nonnull
X      format.date "year" output.check
X      new.sentence
X      editor empty$
X	'skip$
X	{ organization output }
X      if$
X      publisher output
X    }
X  if$
X  new.block
X  note output
X  fin.entry
X}
X
X
XFUNCTION {techreport}
X{ output.bibitem
X  format.authors "author" output.check
X  new.block
X  format.title "title" output.check
X  new.block
X  format.tr.number output.nonnull
X  institution "institution" output.check
X  address output
X  format.date "year" output.check
X  new.block
X  note output
X  fin.entry
X}
X
X
XFUNCTION {unpublished}
X{ output.bibitem
X  format.authors "author" output.check
X  new.block
X  format.title "title" output.check
X  new.block
X  note "note" output.check
X  format.date output
X  fin.entry
X}
X
X
XFUNCTION {default.type} { misc }
X
X
X
X
XMACRO {jan} {"January"}
X
XMACRO {feb} {"February"}
X
XMACRO {mar} {"March"}
X
XMACRO {apr} {"April"}
X
XMACRO {may} {"May"}
X
XMACRO {jun} {"June"}
X
XMACRO {jul} {"July"}
X
XMACRO {aug} {"August"}
X
XMACRO {sep} {"September"}
X
XMACRO {oct} {"October"}
X
XMACRO {nov} {"November"}
X
XMACRO {dec} {"December"}
X
X
X
X
X
X
XMACRO {acmcs} {"ACM Computing Surveys"}
X
XMACRO {acta} {"Acta Informatica"}
X
XMACRO {cacm} {"Communications of the ACM"}
X
XMACRO {ibmjrd} {"IBM Journal of Research and Development"}
X
XMACRO {ibmsj} {"IBM Systems Journal"}
X
XMACRO {ieeese} {"IEEE Transactions on Software Engineering"}
X
XMACRO {ieeetc} {"IEEE Transactions on Computers"}
X
XMACRO {ieeetcad}
X {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
X
XMACRO {ipl} {"Information Processing Letters"}
X
XMACRO {jacm} {"Journal of the ACM"}
X
XMACRO {jcss} {"Journal of Computer and System Sciences"}
X
XMACRO {scp} {"Science of Computer Programming"}
X
XMACRO {sicomp} {"SIAM Journal on Computing"}
X
XMACRO {tocs} {"ACM Transactions on Computer Systems"}
X
XMACRO {tods} {"ACM Transactions on Database Systems"}
X
XMACRO {tog} {"ACM Transactions on Graphics"}
X
XMACRO {toms} {"ACM Transactions on Mathematical Software"}
X
XMACRO {toois} {"ACM Transactions on Office Information Systems"}
X
XMACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
X
XMACRO {tcs} {"Theoretical Computer Science"}
X
X
X
X
XREAD
X
X
X
X
XFUNCTION {sortify}
X{ purify$
X  "l" change.case$
X}
X
XINTEGERS { len }
X
XFUNCTION {chop.word}
X{ 's :=
X  'len :=
X  s #1 len substring$ =
X    { s len #1 + global.max$ substring$ }
X    's
X  if$
X}
X
X
X
X
X
X
XINTEGERS { et.al.char.used }
X
XFUNCTION {initialize.et.al.char.used}
X{ #0 'et.al.char.used :=
X}
X
XEXECUTE {initialize.et.al.char.used}
X
XFUNCTION {format.lab.names}
X{ 's :=
X  s num.names$ 'numnames :=
X  numnames #1 >
X    { numnames #4 >
X	{ #3 'namesleft := }
X	{ numnames 'namesleft := }
X      if$
X      #1 'nameptr :=
X      ""
X	{ namesleft #0 > }
X	{ nameptr numnames =
X	    { s nameptr "{ff }{vv }{ll}{ jj}" format.name$ "others" =
X		{ "{\etalchar{+}}" *
X		  #1 'et.al.char.used :=
X		}
X		{ s nameptr "{v{}}{l{}}" format.name$ * }
X	      if$
X	    }
X	    { s nameptr "{v{}}{l{}}" format.name$ * }
X	  if$
X	  nameptr #1 + 'nameptr :=
X	  namesleft #1 - 'namesleft :=
X	}
X      while$
X      numnames #4 >
X	{ "{\etalchar{+}}" *
X	  #1 'et.al.char.used :=
X	}
X	'skip$
X      if$
X    }
X    { s #1 "{v{}}{l{}}" format.name$
X      duplicate$ text.length$ #2 <
X	{ pop$ s #1 "{ll}" format.name$ #3 text.prefix$ }
X	'skip$
X      if$
X    }
X  if$
X}
X
XFUNCTION {author.key.label}
X{ author empty$
X    { key empty$
X
X	{ cite$ #1 #3 substring$ }
X
X	{ key #3 text.prefix$ }
X      if$
X    }
X    { author format.lab.names }
X  if$
X}
X
XFUNCTION {author.editor.key.label}
X{ author empty$
X    { editor empty$
X	{ key empty$
X
X	    { cite$ #1 #3 substring$ }
X
X	    { key #3 text.prefix$ }
X	  if$
X	}
X	{ editor format.lab.names }
X      if$
X    }
X    { author format.lab.names }
X  if$
X}
X
XFUNCTION {author.key.organization.label}
X{ author empty$
X    { key empty$
X	{ organization empty$
X
X	    { cite$ #1 #3 substring$ }
X
X	    { "The " #4 organization chop.word #3 text.prefix$ }
X	  if$
X	}
X	{ key #3 text.prefix$ }
X      if$
X    }
X    { author format.lab.names }
X  if$
X}
X
XFUNCTION {editor.key.organization.label}
X{ editor empty$
X    { key empty$
X	{ organization empty$
X
X	    { cite$ #1 #3 substring$ }
X
X	    { "The " #4 organization chop.word #3 text.prefix$ }
X	  if$
X	}
X	{ key #3 text.prefix$ }
X      if$
X    }
X    { editor format.lab.names }
X  if$
X}
X
XFUNCTION {calc.label}
X{
X
X  cite$ cite$
X
X  'label :=
X  year field.or.null purify$ #-1 #4 substring$
X  *
X  sortify 'sort.label :=
X}
X
X
X
X
X
X
X
X
X
XFUNCTION {sort.format.names}
X{ 's :=
X  #1 'nameptr :=
X  ""
X  s num.names$ 'numnames :=
X  numnames 'namesleft :=
X    { namesleft #0 > }
X    { nameptr #1 >
X	{ "   " * }
X	'skip$
X      if$
X
X      s nameptr "{vv{ } }{ll{ }}{  ff{ }}{  jj{ }}" format.name$ 't :=
X
X      nameptr numnames = t "others" = and
X	{ "et al" * }
X	{ t sortify * }
X      if$
X      nameptr #1 + 'nameptr :=
X      namesleft #1 - 'namesleft :=
X    }
X  while$
X}
X
X
XFUNCTION {sort.format.title}
X{ 't :=
X  "A " #2
X    "An " #3
X      "The " #4 t chop.word
X    chop.word
X  chop.word
X  sortify
X  #1 global.max$ substring$
X}
X
X
XFUNCTION {author.sort}
X{ author empty$
X    { key empty$
X	{ "to sort, need author or key in " cite$ * warning$
X	  ""
X	}
X	{ key sortify }
X      if$
X    }
X    { author sort.format.names }
X  if$
X}
X
XFUNCTION {author.editor.sort}
X{ author empty$
X    { editor empty$
X	{ key empty$
X	    { "to sort, need author, editor, or key in " cite$ * warning$
X	      ""
X	    }
X	    { key sortify }
X	  if$
X	}
X	{ editor sort.format.names }
X      if$
X    }
X    { author sort.format.names }
X  if$
X}
X
XFUNCTION {author.organization.sort}
X{ author empty$
X    { organization empty$
X	{ key empty$
X	    { "to sort, need author, organization, or key in " cite$ * warning$
X	      ""
X	    }
X	    { key sortify }
X	  if$
X	}
X	{ "The " #4 organization chop.word sortify }
X      if$
X    }
X    { author sort.format.names }
X  if$
X}
X
XFUNCTION {editor.organization.sort}
X{ editor empty$
X    { organization empty$
X	{ key empty$
X	    { "to sort, need editor, organization, or key in " cite$ * warning$
X	      ""
X	    }
X	    { key sortify }
X	  if$
X	}
X	{ "The " #4 organization chop.word sortify }
X      if$
X    }
X    { editor sort.format.names }
X  if$
X}
X
X
XFUNCTION {presort}
X
X{ calc.label
X  sort.label
X  "    "
X  *
X  type$ "book" =
X
X  type$ "inbook" =
X  or
X    'author.editor.sort
X    { type$ "proceedings" =
X	'editor.organization.sort
X	{ type$ "manual" =
X	    'author.organization.sort
X	    'author.sort
X	  if$
X	}
X      if$
X    }
X  if$
X
X  *
X
X  "    "
X  *
X  year field.or.null sortify
X  *
X  "    "
X  *
X  title field.or.null
X  sort.format.title
X  *
X  #1 entry.max$ substring$
X  'sort.key$ :=
X}
X
XITERATE {presort}
X
X
XSORT
X
X
X
X
X
X
X
X
XSTRINGS { longest.label last.sort.label next.extra }
X
XINTEGERS { longest.label.width last.extra.num }
X
XFUNCTION {initialize.longest.label}
X{ "" 'longest.label :=
X  #0 int.to.chr$ 'last.sort.label :=
X  "" 'next.extra :=
X  #0 'longest.label.width :=
X  #0 'last.extra.num :=
X}
X
XFUNCTION {forward.pass}
X{ last.sort.label sort.label =
X    { last.extra.num #1 + 'last.extra.num :=
X      last.extra.num int.to.chr$ 'extra.label :=
X    }
X    { "a" chr.to.int$ 'last.extra.num :=
X      "" 'extra.label :=
X      sort.label 'last.sort.label :=
X    }
X  if$
X}
X
XFUNCTION {reverse.pass}
X{ next.extra "b" =
X    { "a" 'extra.label := }
X    'skip$
X  if$
X  label extra.label * 'label :=
X  label width$ longest.label.width >
X    { label 'longest.label :=
X      label width$ 'longest.label.width :=
X    }
X    'skip$
X  if$
X  extra.label 'next.extra :=
X}
X
XEXECUTE {initialize.longest.label}
X
XITERATE {forward.pass}
X
XREVERSE {reverse.pass}
X
X
X
X
X
X
XFUNCTION {begin.bib}
X
X{ et.al.char.used
X    { "\newcommand{\etalchar}[1]{$^{#1}$}" write$ newline$ }
X    'skip$
X  if$
X  preamble$ empty$
X
X    'skip$
X    { preamble$ write$ newline$ }
X  if$
X  "\begin{thebibliography}{"  longest.label  * "}" * write$ newline$
X}
X
XEXECUTE {begin.bib}
X
XEXECUTE {init.state.consts}
X
X
XITERATE {call.type$}
X
X
XFUNCTION {end.bib}
X{ newline$
X  "\end{thebibliography}" write$ newline$
X}
X
XEXECUTE {end.bib}
EOFile specl.bst
chmod u=rw+,g=r++,o=r++ specl.bst
echo '...done' 1>&2
echo -n "strings.h..." 1>&2
if test -f strings.h
then
	case $# in 
	0)
		echo 'exists, `sh filename -o'\'' to overwrite'
		exit 0;;
	esac
	case $1 in 
	-o)	;;
	*)
		echo 'exists, `sh filename -o'\'' to overwrite'
		exit 0;;
	esac
fi
sed 's/^X//' << 'EOFile strings.h' > strings.h
X#include <strings.h>
X
X#define Index		(char *) index
X#define Strcpy		(void *) strcpy
X#define Strcat		(void *) strcat
X#define Strcmp		(int) strcmp
EOFile strings.h
chmod u=rw+,g=r++,o=r++ strings.h
echo '...done' 1>&2
echo -n "templates.c..." 1>&2
if test -f templates.c
then
	case $# in 
	0)
		echo 'exists, `sh filename -o'\'' to overwrite'
		exit 0;;
	esac
	case $1 in 
	-o)	;;
	*)
		echo 'exists, `sh filename -o'\'' to overwrite'
		exit 0;;
	esac
fi
sed 's/^X//' << 'EOFile templates.c' > templates.c
X/*
X * This program has been written by Kannan Varadhan.  You are welcome to
X * use, copy, modify, or circulate as you please, provided you do not
X * charge any fee for any of it, and you do not remove these header
X * comments from any of these files.
X *
X *		22/JUN/89
X */
X
X#include "bibc.h"
X
Xget_article ()
X
X{
X	SET (&bibitem, rectype, "ARTICLE");
X	GET (&bibitem, citekey, REQUIRED);
X	GET (&bibitem, author, REQUIRED);
X	GET (&bibitem, title, REQUIRED);
X	GET (&bibitem, journal, REQUIRED);
X	GET (&bibitem, year, REQUIRED);
X	GET (&bibitem, volume, OPTIONAL);
X	GET (&bibitem, number, OPTIONAL);
X	GET (&bibitem, pages, OPTIONAL);
X	GET (&bibitem, month, OPTIONAL);
X	GET (&bibitem, note, OPTIONAL);
X	GET (&bibitem, key, OPTIONAL);
X	GET (&bibitem, comment, OPTIONAL);
X	GET (&bibitem, cross_ref, OPTIONAL);
X	return 0;
X}
X
Xget_book () 
X
X{
X	SET (&bibitem, rectype, "BOOK");
X	GET (&bibitem, citekey, REQUIRED);
X	GET (&bibitem, author, REQUIRED);
X	GET (&bibitem, title, REQUIRED);
X	GET (&bibitem, publisher, REQUIRED);
X	GET (&bibitem, year, REQUIRED);
X	GET (&bibitem, volume, OPTIONAL);
X	GET (&bibitem, series, OPTIONAL);
X	GET (&bibitem, address, OPTIONAL);
X	GET (&bibitem, edition, OPTIONAL);
X	GET (&bibitem, month, OPTIONAL);
X	GET (&bibitem, note, OPTIONAL);
X	GET (&bibitem, key, OPTIONAL);
X	GET (&bibitem, comment, OPTIONAL);
X	GET (&bibitem, cross_ref, OPTIONAL);
X	return 0;
X}
X
Xget_booklet () 
X
X{
X	SET (&bibitem, rectype, "BOOKLET");
X	GET (&bibitem, citekey, REQUIRED);
X	GET (&bibitem, title, REQUIRED);
X	GET (&bibitem, author, OPTIONAL);
X	GET (&bibitem, howpublished, OPTIONAL);
X	GET (&bibitem, address, OPTIONAL);
X	GET (&bibitem, month, OPTIONAL);
X	GET (&bibitem, year, OPTIONAL);
X	GET (&bibitem, note, OPTIONAL);
X	GET (&bibitem, key, OPTIONAL);
X	GET (&bibitem, comment, OPTIONAL);
X	GET (&bibitem, cross_ref, OPTIONAL);
X	return 0;
X}
X
X
Xget_inproceedings ()
X
X{
X	SET (&bibitem, rectype, "INPROCEEDINGS");
X	GET (&bibitem, citekey, REQUIRED);
X	GET (&bibitem, author, REQUIRED);
X	GET (&bibitem, title, REQUIRED);
X	GET (&bibitem, booktitle, REQUIRED);
X	GET (&bibitem, year, REQUIRED);
X	GET (&bibitem, editor, OPTIONAL);
X	GET (&bibitem, pages, OPTIONAL);
X	GET (&bibitem, organisation, OPTIONAL);
X	GET (&bibitem, publisher, OPTIONAL);
X	GET (&bibitem, address, OPTIONAL);
X	GET (&bibitem, month, OPTIONAL);
X	GET (&bibitem, note, OPTIONAL);
X	GET (&bibitem, key, OPTIONAL);
X	GET (&bibitem, comment, OPTIONAL);
X	GET (&bibitem, cross_ref, OPTIONAL);
X	return 0;
X}
X
X
Xget_inbook ()
X
X{
X	SET (&bibitem, rectype, "INBOOK");
X	GET (&bibitem, citekey, REQUIRED);
X	GET (&bibitem, author, REQUIRED);
X	GET (&bibitem, title, REQUIRED);
X	GET (&bibitem, chapter, REQUIRED);
X	GET (&bibitem, pages, OPTIONAL);
X	GET (&bibitem, publisher, REQUIRED);
X	GET (&bibitem, year, REQUIRED);
X	GET (&bibitem, volume, OPTIONAL);
X	GET (&bibitem, series, OPTIONAL);
X	GET (&bibitem, address, OPTIONAL);
X	GET (&bibitem, edition, OPTIONAL);
X	GET (&bibitem, month, OPTIONAL);
X	GET (&bibitem, note, OPTIONAL);
X	GET (&bibitem, key, OPTIONAL);
X	GET (&bibitem, comment, OPTIONAL);
X	GET (&bibitem, cross_ref, OPTIONAL);
X	return 0;
X}
X
X
Xget_incollection ()
X
X{
X	SET (&bibitem, rectype, "INCOLLECTION");
X	GET (&bibitem, citekey, REQUIRED);
X	GET (&bibitem, author, REQUIRED);
X	GET (&bibitem, title, REQUIRED);
X	GET (&bibitem, booktitle, REQUIRED);
X	GET (&bibitem, publisher, REQUIRED);
X	GET (&bibitem, year, REQUIRED);
X	GET (&bibitem, editor, OPTIONAL);
X	GET (&bibitem, chapter, OPTIONAL);
X	GET (&bibitem, pages, OPTIONAL);
X	GET (&bibitem, address, OPTIONAL);
X	GET (&bibitem, month, OPTIONAL);
X	GET (&bibitem, note, OPTIONAL);
X	GET (&bibitem, key, OPTIONAL);
X	GET (&bibitem, comment, OPTIONAL);
X	GET (&bibitem, cross_ref, OPTIONAL);
X	return 0;
X}
X
X
Xget_manual ()
X
X{
X	SET (&bibitem, rectype, "MANUAL");
X	GET (&bibitem, citekey, REQUIRED);
X	GET (&bibitem, title, REQUIRED);
X	GET (&bibitem, author, OPTIONAL);
X	GET (&bibitem, organisation, OPTIONAL);
X	GET (&bibitem, address, OPTIONAL);
X	GET (&bibitem, edition, OPTIONAL);
X	GET (&bibitem, month, OPTIONAL);
X	GET (&bibitem, note, OPTIONAL);
X	GET (&bibitem, key, OPTIONAL);
X	GET (&bibitem, comment, OPTIONAL);
X	GET (&bibitem, cross_ref, OPTIONAL);
X	return 0;
X}
X
X
Xget_mastersthesis ()
X
X{
X	SET (&bibitem, rectype, "MASTERSTHESIS");
X	GET (&bibitem, citekey, REQUIRED);
X	GET (&bibitem, author, REQUIRED);
X	GET (&bibitem, title, REQUIRED);
X	GET (&bibitem, school, REQUIRED);
X	GET (&bibitem, year, REQUIRED);
X	GET (&bibitem, address, OPTIONAL);
X	GET (&bibitem, month, OPTIONAL);
X	GET (&bibitem, note, OPTIONAL);
X	GET (&bibitem, key, OPTIONAL);
X	GET (&bibitem, comment, OPTIONAL);
X	GET (&bibitem, cross_ref, OPTIONAL);
X	return 0;
X}
X
X
Xget_misc ()
X
X{
X	SET (&bibitem, rectype, "MISC");
X	GET (&bibitem, citekey, REQUIRED);
X	GET (&bibitem, author, OPTIONAL);
X	GET (&bibitem, title, OPTIONAL);
X	GET (&bibitem, howpublished, OPTIONAL);
X	GET (&bibitem, month, OPTIONAL);
X	GET (&bibitem, year, OPTIONAL);
X	GET (&bibitem, note, OPTIONAL);
X	GET (&bibitem, key, OPTIONAL);
X	GET (&bibitem, comment, OPTIONAL);
X	GET (&bibitem, cross_ref, OPTIONAL);
X	return 0;
X}
X
X
Xget_phdthesis ()
X
X{
X	SET (&bibitem, rectype, "PHDTHESIS");
X	GET (&bibitem, citekey, REQUIRED);
X	GET (&bibitem, author, REQUIRED);
X	GET (&bibitem, title, REQUIRED);
X	GET (&bibitem, school, REQUIRED);
X	GET (&bibitem, year, REQUIRED);
X	GET (&bibitem, address, OPTIONAL);
X	GET (&bibitem, month, OPTIONAL);
X	GET (&bibitem, note, OPTIONAL);
X	GET (&bibitem, key, OPTIONAL);
X	GET (&bibitem, comment, OPTIONAL);
X	GET (&bibitem, cross_ref, OPTIONAL);
X	return 0;
X}
X
X
Xget_proceedings ()
X
X{
X	SET (&bibitem, rectype, "PROCEEDINGS");
X	GET (&bibitem, citekey, REQUIRED);
X	GET (&bibitem, title, REQUIRED);
X	GET (&bibitem, year, REQUIRED);
X	GET (&bibitem, editor, OPTIONAL);
X	GET (&bibitem, publisher, OPTIONAL);
X	GET (&bibitem, organisation, OPTIONAL);
X	GET (&bibitem, address, OPTIONAL);
X	GET (&bibitem, month, OPTIONAL);
X	GET (&bibitem, note, OPTIONAL);
X	GET (&bibitem, key, OPTIONAL);
X	GET (&bibitem, comment, OPTIONAL);
X	GET (&bibitem, cross_ref, OPTIONAL);
X	return 0;
X}
X
X
Xget_techreport ()
X
X{
X	SET (&bibitem, rectype, "TECHREPORT");
X	GET (&bibitem, citekey, REQUIRED);
X	GET (&bibitem, author, REQUIRED);
X	GET (&bibitem, title, REQUIRED);
X	GET (&bibitem, institution, REQUIRED);
X	GET (&bibitem, year, REQUIRED);
X	GET (&bibitem, type, OPTIONAL);
X	GET (&bibitem, number, OPTIONAL);
X	GET (&bibitem, address, OPTIONAL);
X	GET (&bibitem, month, OPTIONAL);
X	GET (&bibitem, note, OPTIONAL);
X	GET (&bibitem, key, OPTIONAL);
X	GET (&bibitem, comment, OPTIONAL);
X	GET (&bibitem, cross_ref, OPTIONAL);
X	return 0;
X}
X
X
Xget_unpublished ()
X
X{
X	SET (&bibitem, rectype, "UNPUBLISHED");
X	GET (&bibitem, citekey, REQUIRED);
X	GET (&bibitem, author, REQUIRED);
X	GET (&bibitem, title, REQUIRED);
X	GET (&bibitem, note, REQUIRED);
X	GET (&bibitem, month, OPTIONAL);
X	GET (&bibitem, year, OPTIONAL);
X	GET (&bibitem, key, OPTIONAL);
X	GET (&bibitem, comment, OPTIONAL);
X	GET (&bibitem, cross_ref, OPTIONAL);
X	return 0;
X}
EOFile templates.c
chmod u=rw+,g=rw+,o=r++ templates.c
echo '...done' 1>&2
echo Now gitouttaere
-=-
email:  kannan@cis.ohio-state.edu 	or	...{backbone}!osu-cis!kannan
voice:  {Res.} (614) 297-8720 | {Off.} (614) 292-8234 or 4-9099 on campus
snail:  Kannan Varadhan 306, W. Lane Ave., # 15, Columbus, OH 43201