2003-03-31  Matthias Koeppe  <mkoeppe@mail.math.uni-magdeburg.de>

 	Version 0.4
	
	* bst-builtins.lisp (CHR.TO.INT$): Fix warning in interpreted mode.

	* bibtex.lisp (*registered-bibtex-style*): New.
	(register-bibtex-style): Set it here.

	(interpreted-bibtex-style, lisp-bibtex-style): New.
	(find-bibtex-style): Use it here.

	* bibtex-runtime.lisp (*foreign-character-purifications*): Removed.
	(defstruct foreign-character, *foreign-characters*,
	define-foreign-character, find-foreign-character): New.
	(bibtex-string-purify): Use it here.

	(bibtex-string-upcase, bibtex-string-downcase,
	bibtex-string-titledowncase): Handle special characters.

2003-02-06  Matthias Koeppe  <mkoeppe@mail.math.uni-magdeburg.de>

	* bibtex-runtime.lisp (+bib-whitespace-character-list+): Add #\Tab.

2003-01-28  Matthias Koeppe  <mkoeppe@mail.math.uni-magdeburg.de>

	* bibtex-runtime.lisp (format-bibtex-name-component,
	format-bibtex-name): Go for bug-for-bug compatibility with BibTeX
	in the domain of tieing short name components.

	(write-tex-group): New optional argument NO-TERMINATE-P; use it to
	suppress unneeded whitespace after control words.  (This gets rid of
	the extraneous whitespace after control words, which was introduced by
	bibtex-string-upcase and bibtex-string-downcase.)

	(bibtex-string-purify): Don't remove whitespace, turn it into a space
	instead.  (This fixes problems with the sort order for some styles.)

2003-01-16  Matthias Koeppe  <mkoeppe@mail.math.uni-magdeburg.de>

	* bibtex-compiler.lisp (bst-compiler-warning): Add report function.
	(compile-bst-function): Resignal errors.

	* bst-builtins.lisp (newline$, write$): Use BBL-TERPRI and BBL-PRINT.

	* bibtex.lisp (bibtex): Use WITH-BBL-OUTPUT.

	* bibtex-runtime.lisp (bib-warn): Print "Warning".
	(read-bib-field-token): Call BIB-WARN, rather than BIB-ERROR, for
	undefined macros.
	(get-merged-bib-entry): New.
	(cited-bib-entries): Resolve crossrefs also if all entries are cited.
	Always merge crossrefed data into entry.

	(*bbl-min-print-line*, *bbl-max-print-line*, *bbl-line-buffer*): New.
	(bbl-print, bbl-terpri, bbl-flush, with-bbl-output): New.

	(read-all-bib-files-and-compute-bib-entries): Fix the case of
	unreadable database files.

2003-01-03  Matthias Koeppe  <mkoeppe@mail.math.uni-magdeburg.de>

	* bibtex-compiler.lisp (coerce-form): New.
	(pop-form): Use it here.

	(type-union*): New.
	("IF$"): Fix handling of *relaxed-compilation*.  Handle the case
	of THEN function returning BOOLEAN and ELSE function returning
	INTEGER.

	(package-as-body): New keyword arg, expected-result-types.
	(package-as-form, package-as-procedure): Pass args to package-as-body.

	(":="): Catch assignments to non-variables.  Request the type of the
	assigned-to variable when popping the new value.

	(compile-literal): New.
	(bst-compile-literal): Use it here. Pass remaining args to
	package-as-form.

	(*silent-compilation*): New variable.
	(bst-compile-warning): Don't signal a condition if *silent-compilation*.
	("IF$"): Bind *silent-compilation* to true during the first pass.

	(assign-loop-variables): New.
	(bst-compile-literal-as-while-body): Use it here.
	(bst-compile-literal-as-while-predicate): New.
	(current-stack-as-values-list): New.
	("WHILE$"): Handle the case of loops with complicated data flow.

	(compile-funcall): Pass the pop-form-args of a function to pop-form
	when popping the arguments.

	* bst-builtins.lisp ("+"): Use build-associative-form.
	("change.case$", "chr.to.int$"): Use the pop-form args
	:NEED-VARIABLE T.  Get rid of LET.

	* bst-functions.lisp (bst-function): New field, pop-form-args.

	* bst-reader.lisp (*bst-readtable*):
	Intern :-symbols into the current package.

	* lisp-form-builder.lisp (build-values-body, build-progn-form): New.

	* packages.lisp (bibtex-runtime, bibtex-compiler):
	Shadow VARIABLE also in CLISP.

2002-12-25  Matthias Koeppe  <mkoeppe@mail.math.uni-magdeburg.de>

	* bibtex.lisp (make-macro-set-form): Don't emit a SETF form if
	nothing is to be set.
	(compile-bst-file): Make some variables constant.  Sort shadowed
	symbols.

	* bibtex-compiler.lisp (*bst-function-call-sequence*): New.
	(*relaxed-compilation*): New.
	(bst-compiler-warning, bst-compile-warning): New.

	(pop-form):  Even if NEED-VARIABLE is :IF-SIDE-EFFECTS, we need to
	make sure we pop single-value forms only!  (This caused a bug when
	compiling a custombib-generated style file.)

	(pop-form): Return a fourth value that disambiguates between a Lisp
	form NIL and the exhausted-stack situation when :WHEN-EMPTY is NIL.
	(pop-single-value-form): Handle this.

	(":="): Do nothing for constant variables.  Otherwise, count
	assignments.

	(get-bst-function): Signal an error if a function is referenced that
	could not be compiled.

	("IF$"): Handle *RELAXED-COMPILATION*.

	(compile-bst-function): HANDLER-BIND for condition
	BST-COMPILER-WARNING.

	(make-some-variables-lexical): Don't try to make constants lexical.
	(make-some-variables-constant): New.

	* bst-reader.lisp: Record BST function calls in
	*BST-FUNCTION-CALL-SEQUENCE*.

	* bst-functions.lisp (bst-function): New fields.
	(register-bst-global-var): New keyword arg.
	(bst-name-to-lisp-name): Handle :constant variables.

	* bst-builtins.lisp (FALSE, TRUE): New pseudo-primitive BST functions.
	(ENTRY.MAX$, GLOBAL.MAX$): Declare constant.

2002-12-15  Matthias Koeppe  <mkoeppe@mail.math.uni-magdeburg.de>

	Version 0.3.1
	
	* bst-reader.lisp:  Fix the interpreter to not compute Lisp
	symbols for the BST identifiers, which would fail.

2002-12-15  Matthias Koeppe  <mkoeppe@mail.math.uni-magdeburg.de>

	Version 0.3
	
	* bst-builtins.lisp (CALL.TYPE$): Use bst-intern rather than intern.

	* bibtex.system (*bibtex-source-pathname*, *bibtex-binary-pathname*):
	New variables.
	(mk:defsystem "BIBTEX"): Use them here.

	* bibtex.lisp (*bibtex-pprint-dispatch*): Moved here.
	(compile-bst-file): Make two compiler passes.
	(bibtex): Make *bib-macros* an equalp hash.

	* bibtex-compiler.lisp (*lisp-stream*, lisp-write): Removed.
	(*bibtex-pprint-dispatch*): Moved to bibtex.lisp.
	(max-side-effectss, remove-variables-from-side-effects,
	package-as-body, IF$, compile-funcall): Handle the new side
	effects "variables-used-before-assigned" and
	"unconditionally-assigned-variables".
	(bst-gentemp): Use bst-intern rather than intern.
	(print-bst-function-info): New.
	(compile-bst-function): Changed interface; modify the passed
	bst-function structure.
	(make-some-variables-lexical): New.

	* bst-functions.lisp (side-effects, bst-function): New fields.
	(*bst-package*): New variable.
	(bst-intern): New function.
	(bst-name-to-lisp-name): Use bst-intern rather than intern.

	* bst-reader.lisp (get-bst-commands-and-process, INTEGERS,
	STRINGS): Store into *bst-definition-sequence*, rather than
	writing to *lisp-stream*.
	(FUNCTION): Changed call to compile-bst-function.

2002-12-11  Matthias Koeppe  <mkoeppe@mail.math.uni-magdeburg.de>

	* bibtex-runtime.lisp (bibtex-string-upcase): Really upcase (not
	downcase) the string.  Reported by Solofo Ramangalahy.
	
	* packages.lisp: Allegro portability fix.  Thanks to Drew McDermott.

	* interpreter.lisp (bst-execute-body, bst-execute-stack-literal,
	bst-pop/coerce, bst-coerce/push):  Handle the case of the empty
	BST function body {}.

	* bibtex-compiler.lisp (mvform): Use an extra field to
	disambiguate between the Lisp form () and the empty BST function
	body {}.  Change uses throughout.  
	Reported by Drew McDermott.
	
2002-11-25  Matthias Koeppe  <mkoeppe@mail.math.uni-magdeburg.de>

	Version 0.2
	
	* bibtex: New shell script.

	* bibtex-compiler.lisp (lisp-write): Use pprint dispatch function
	for DEFINE-BIBTEX-STYLE.
	(IF$, compile-bst-function): Change call to bst-name-to-lisp-name.

	* run-lisp: Added from CLOCC.

	* kpathsea.lisp (find-file): Implement for SBCL; implement for all
	other platforms using CLOCC PORT.

	* bst-reader.lisp (*bst-readtable*): Portability fix for CLISP in
	macro-character function of #\:.
	(INTEGERS, STRINGS): Changed use of BST-NAME.
	(ITERATE, READ, REVERSE, SORT): Fix for target package.

	* bst-functions.lisp (bst-name-to-lisp-name): Use *SPECIAL* naming
	convention for special variables.

	* bst-builtins.lisp (CALL.TYPE$): Fixes for the target package.

	* bibtex.lisp (compile-bst-file): Write out defpackage, in-package, and
	define-bibtex-style forms.
	(*bibtex-styles*, register-bibtex-style, define-bibtex-style,
	find-bibtex-style): New.
	(bibtex, cl-bibtex): Unified functionality into the BIBTEX function;
	removed CL-BIBTEX.  Use FIND-BIBTEX-STYLE.

	* bibtex-runtime.lisp (mark-history): Set *err-count* to 1 if new
	level of error reached.
	(process-bib-preamble-command): Fix to handle extra level of
	quoting around preamble strings.
	(make-bib-entry, merge-bib-entries): New.
	(*min-crossref*): New variable.
	(cited-bib-entries): Implement the crossref feature.
	(for-all-tex-tokens, do-tex-tokens): New.
	(bibtex-string-width): Handle special chars.
	(tex-alpha-char-p): New.
	(read-tex-control-sequence): New keyword argument :AT-IS-LETTER.
	(get-aux-command-and-process): Handle the \@input command to deal
	with nested .aux files.
	(*foreign-character-purifications*): New.
	(bibtex-string-purify): Do the purification.

2002-03-18  Matthias Koeppe  <mkoeppe@mail.math.uni-magdeburg.de>

	* kpathsea.lisp (find-file): Take pathname designators, not strings.
	* bibtex.lisp (bibtex, cl-bibtex): Likewise.
	  Suggested by Paul Foley.

	* packages.lisp, bibtex-runtime.lisp (write-bib-entry): New function.

2002-03-14  Matthias Koeppe  <mkoeppe@mail.math.uni-magdeburg.de>

	Version 0.1
	
