Common Lisp Package: BIBTEX-RUNTIME

README:

FUNCTION

Public

ADD-PERIOD-UNLESS-SENTENCE-END (STRING)

Add a period to STRING unless it is empty, or its last non-right-brace character is a period, question mark or exclamation mark.

BBL-PRINT (STRING)

Add STRING to the BBL output buffer. If there are enough characters present in the output buffer, it writes one or more lines out to the *BBL-OUTPUT* stream. It may break a line at any whitespace character it likes, but if it does, it will add two spaces to the next output line. If there's no whitespace character to break the line at, we break it just before *BBL-MAX-PRINT-LINE*, append a comment character (%), and don't indent the next line.

BIB-ENTRY-CITE-KEY (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

BIB-ENTRY-TYPE (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

BIB-ERROR (FORMAT-CONTROL &REST ARGS)

When there's a serious error parsing a BIB file, we flush everything up to the beginning of the next entry.

BIB-WARN (FORMAT-CONTROL &REST ARGS)

Emit a warning.

BIB-WARN* (&REST STRINGS)

Emit a warning consisting of the concatenation of STRINGS.

BIBTEX-NAME-FIRST (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

BIBTEX-NAME-JR (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

BIBTEX-NAME-LAST (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

BIBTEX-NAME-VON (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

BIBTEX-STRING-DOWNCASE (STRING)

Convert to lower case all letters in STRING at brace-level 0. Also handle special characters in a very complicated way.

BIBTEX-STRING-PREFIX (STRING NUM-TOKENS)

The BibTeX TEXT.PREFIX$ function.

BIBTEX-STRING-PURIFY (STRING)

Remove nonalphanumeric characters except for whitespace and sep-char characters (these get converted to a space) and removes certain alphabetic characters contained in the control sequences associated with a special character.

BIBTEX-STRING-TITLEDOWNCASE (STRING)

Convert to lower case all letters except the very first character in the STRING, which it leaves alone, and except the first character following any `:' and then non-null whitespace, which it also leaves alone. Only those letters at brace-level 0 are affected. Also handle special characters in a very complicated way.

BIBTEX-STRING-UPCASE (STRING)

Convert to upper case all letters in STRING at brace-level 0. Also handle special characters in a very complicated way.

BIBTEX-STRING-WIDTH (STRING &KEY (WIDTHS +CMR10-CHARACTER-WIDTHS+))

The BibTeX WIDTH$ function. Compute the approximate width of STRING by summing the WIDTHS of the individual characters. BibTeX special characters are handled specially.

BIBTEX-SUBSTRING (S START &OPTIONAL (COUNT MOST-POSITIVE-FIXNUM))

A substring function compatible with BibTeX's substring$.

CITED-BIB-ENTRIES (CITE-KEYS &KEY (MIN-CROSSREFS 2))

Return a vector of the entries in *BIB-DATABASE* whose keys are given in the list CITE-KEYS (if CITE-KEYS is the symbol T, return a vector of all database entries. When a crossref'd entry is referenced at least :MIN-CROSSREFS times, it is included as a separate entry as well.

FORMAT-NTH-BIBTEX-NAME (STREAM FORMAT-STRING NAMES-STRING INDEX)

Parse NAMES-STRING as an `and'-separated list of BibTeX names, pick the name of given 1-based INDEX and format it to STREAM according to the BibTeX-style FORMAT-STRING.

PARSE-BIBTEX-NAME (NAME-STRING &KEY (START 0) (END NIL))

Break a BibTeX name into its components, returning a BIBTEX-NAME structure.

PARSE-BIBTEX-NAME-LIST (NAMES-STRING)

Parse a string containing BibTeX names, separated by the word `and' surrounded by non-null whitespace, and return a list of BIBTEX-NAME structures.

READ-AUX-FILE (NAME)

Read an AUX file, modifying *CITE-KEYS*, *CITE-ALL-ENTRIES*, *BIB-FILES*, and *BIB-STYLE*.

READ-BIB-DATABASE (STREAM)

Read a BibTeX database from STREAM, storing the entries in the hash-table *BIB-DATABASE* and using/updating the macro hash-table *BIB-MACROS*.

Undocumented

BBL-TERPRI

SETFBIB-ENTRY-CITE-KEY (NEW-VALUE INSTANCE)

BIB-ENTRY-REF (KEY ENTRY &OPTIONAL DEFAULT)

SETFBIB-ENTRY-REF (VALUE KEY ENTRY &OPTIONAL DEFAULT)

BIB-ENTRY-SORT-KEY (ENTRY)

SETFBIB-ENTRY-TYPE (NEW-VALUE INSTANCE)

BIB-FATAL (FORMAT-CONTROL &REST ARGS)

SETFBIBTEX-NAME-FIRST (NEW-VALUE INSTANCE)

SETFBIBTEX-NAME-JR (NEW-VALUE INSTANCE)

SETFBIBTEX-NAME-LAST (NEW-VALUE INSTANCE)

SETFBIBTEX-NAME-VON (NEW-VALUE INSTANCE)

EMPTY-FIELD-P (STRING)

FORMAT-BIBTEX-NAME (STREAM FORMAT-STRING BIBTEX-NAME)

MAKE-BIB-ENTRY (&KEY ((TYPE DUM224) NIL) ((CITE-KEY DUM225) ) ((SORT-KEY% DUM226) NIL) ((DICT DUM227) (MAKE-HASH-TABLE SIZE 16 TEST 'EQUALP)))

MAKE-BIBTEX-NAME (&KEY ((FIRST DUM908) NIL) ((VON DUM909) NIL) ((LAST DUM910) NIL) ((JR DUM911) NIL))

NUM-BIBTEX-NAMES (NAMES-STRING)

READ-ALL-BIB-FILES-AND-COMPUTE-BIB-ENTRIES

WHITESPACE-P (CHAR)

WRITE-BIB-ENTRY (ENTRY &OPTIONAL (STREAM *STANDARD-OUTPUT*))

Private

AUX-BIBSTYLE-COMMAND

Process an AUX-file \bibstyle command.

AUX-INPUT-COMMAND

Process an AUX-file \@input command.

BIB-ENTRY-DICT (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

BIB-ENTRY-SORT-KEY% (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

COMPRESS-WHITESPACE (S)

Compress non-null whitespace to a single space.

COMPUTE-BIB-EQUIVALENCE-CLASSES

Return a list of lists of equivalent keys.

DOWNCASE-FOREIGN-CHARACTER (TOKEN)

TOKEN is a string, designating a TeX control sequence. Return a list of tokens that are the lowercase replacement.

FIND-AND-AT-BRACE-LEVEL-0 (STRING &KEY (START 0) (END NIL))

Return the index of the first `and' surrounded by non-null whitespace at brace level 0 in STRING, bounded by :START and :END. If none found, return nil.

FOR-ALL-TEX-TOKENS (FUNCTION STRING-OR-GROUP)

Call FUNCTION for every token in the given TeX string (a string or a TeX-group). The second argument passed to FUNCTION is the bracelevel.

FOREIGN-CHARACTER-LOWERCASE (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

FOREIGN-CHARACTER-NAME (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

FOREIGN-CHARACTER-PURIFICATION (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

FOREIGN-CHARACTER-UPPERCASE (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

GET-AUX-COMMAND-AND-PROCESS

Read a TeX control sequence from *AUX-STREAM*. If the sequence is found in *AUX-FILE-COMMANDS*, call the associated function.

GET-MERGED-BIB-ENTRY (KEY)

Compute a bib entry where all crossrefs have been merged in.

MERGE-BIB-ENTRIES (A B)

Return a fresh bib entry that merges A and B.

PARSE-TEX-STRING (STRING)

Parse the STRING containing TeX {groups} and \controlsequences. Return a list whose elements are characters, strings representing control sequences or sub-lists representing groups.

READ-BIB-FIELD (FIELD-P)

Return two values, the name and the value.

READ-BIB-FIELD-VALUE (FIELD-P)

Read a list of field tokens from *BIB-STREAM* that define the field value string and return the concatenation of all field tokens, compressing non-null whitespace to a single space. If FIELD-P is non-nil, remove any leading or trailing whitespace.

READ-BIB-IDENTIFIER

Read an identifier from *BIB-STREAM*, returning it as a string, or nil if no identifier could be read.

READ-TEX-CONTROL-SEQUENCE (STREAM &KEY (SKIP-WHITESPACE T) (AT-IS-LETTER NIL))

Read a TeX control sequence from STREAM, assuming that the escape character (\) has already been read. In the case of a control word, trailing whitespace is flushed if :SKIP-WHITESPACE is non-nil.

READ-TEX-GROUP (STREAM)

Read TeX tokens from STREAM until a `}' character or end-of-file is found. Return a list of the tokens, where characters represent ordinary characters, strings represent control sequences (without the escape character) and nested lists represent TeX groups.

SCAN-BALANCED-BRACES (STREAM RIGHT-DELIMITER)

Scan STREAM for the RIGHT-DELIMITER character, skipping balanced pairs of braces. Return a string of everything read, except for the right delimiter.

SCAN-TO-DELIMITER (STREAM DELIMITERS)

Read characters from STREAM until a character in the list DELIMITERS is found. Return a string of these characters, excluding the delimiter, which is left in the stream.

TOKENIZE-BIBTEX-NAME (NAME-STRING &KEY (START 0) (END NIL))

Break a BibTeX name into name tokens.

UPCASE-FOREIGN-CHARACTER (TOKEN)

TOKEN is a string, designating a TeX control sequence. Return a list of tokens that are the uppercase replacement.

WRITE-TEX-GROUP (GROUP &OPTIONAL (STREAM *STANDARD-OUTPUT*) NO-TERMINATE-P)

Write the TeX GROUP to STREAM. If a control word occurs at the end of the group, terminate it with whitespace unless NO-TERMINATE-P is true.

Undocumented

AUX-BIBDATA-COMMAND

AUX-CITATION-COMMAND

AUX-ERROR (FORMAT-CONTROL &REST ARGS)

BBL-FLUSH

BIB-ENTRY-P (OBJECT)

SETFBIB-ENTRY-SORT-KEY% (NEW-VALUE INSTANCE)

BIBTEX-NAME-P (OBJECT)

CHECK-MULTIPLE-CITED-EQUIVALENT-ENTRIES (BIB-ENTRIES)

COPY-BIB-ENTRY (INSTANCE)

COPY-BIBTEX-NAME (INSTANCE)

COPY-FOREIGN-CHARACTER (INSTANCE)

DEFINE-FOREIGN-CHARACTER (&REST ARGS)

ENOUGH-TEXT-CHARS (STRING MIN-LENGTH)

FIND-FOREIGN-CHARACTER (NAME)

SETFFOREIGN-CHARACTER-LOWERCASE (NEW-VALUE INSTANCE)

SETFFOREIGN-CHARACTER-NAME (NEW-VALUE INSTANCE)

FOREIGN-CHARACTER-P (OBJECT)

SETFFOREIGN-CHARACTER-PURIFICATION (NEW-VALUE INSTANCE)

SETFFOREIGN-CHARACTER-UPPERCASE (NEW-VALUE INSTANCE)

FORMAT-BIBTEX-NAME-COMPONENT (STREAM STREAM-STRING TOKENS FULL INTER-TOKEN-STRING)

MAKE-FOREIGN-CHARACTER (&KEY ((NAME DUM2256) NIL) ((UPPERCASE DUM2257) NIL) ((LOWERCASE DUM2258) NIL) ((PURIFICATION DUM2259) NIL))

MARK-ERROR

MARK-FATAL

MARK-HISTORY (LEVEL)

MARK-WARNING

PARSE-EQUIVALENT-ENTRIES-STRING (STRING)

PROCESS-BIB-ENTRY-COMMAND (ENTRY-TYPE)

PROCESS-BIB-PREAMBLE-COMMAND

PROCESS-BIB-STRING-COMMAND

READ-ALL-BIB-FILES

READ-AUX-FILE-RECURSIVELY (NAME)

READ-BIB-FIELD-TOKEN

SEPCHAR-P (CHAR)

TEX-ALPHA-CHAR-P (CHAR &KEY (AT-IS-LETTER NIL))

TEX-GROUP-CHANGE-CASE (GROUP CHAR-FUN FOREIGN-CHARACTER-FUN FOREIGN-CHARACTER-CHAR-FUN AFTER-GROUP-THUNK)

TEX-GROUP-DOWNCASE (GROUP)

TEX-GROUP-TITLEDOWNCASE (GROUP)

TEX-GROUP-UPCASE (GROUP)

VON-TOKEN-P (TOKEN)

MACRO

Public

Undocumented

WITH-BBL-OUTPUT ((STREAM) &BODY BODY)

Private

DO-TEX-TOKENS ((TOKEN STRING-OR-GROUP &OPTIONAL (BRACE-LEVEL (GENSYM) BRACE-LEVEL-P)) &BODY BODY)

Perform BODY on every token in the given TeX string (a string or a TeX-group).

VARIABLE

Public

*BBL-MAX-PRINT-LINE*

Maximum .bbl line length. BBL-PRINT breaks lines so that no more than this many characters apear on each output line. If nil, BBL-PRINT will not break lines.

*BBL-MIN-PRINT-LINE*

Minimum line length in the formatted bibliography (BBL) file.

*BBL-OUTPUT*

The stream corresponding to the formatted bibliography (BBL) file.

*BIB-DATABASE*

A hashtable associating BibTeX keys with entries

*BIB-ENTRIES*

A list containing all requested BibTeX entries

*BIB-ENTRY-TYPE-FUNCTIONS*

An alist mapping BibTeX entry types to formatter functions

*BIB-FILES*

List of BibTeX database files to be read.

*BIB-MACROS*

A hashtable associating macro names with their definitions

*BIB-PREAMBLE*

A string accumulating all BibTeX @PREAMBLEs

*BIB-STYLE*

The requested BibTeX style.

*BIBTEX-LONG-NAME-LENGTH*

A BibTeX name component is considered `long' when it has at least this many text characters.

*BIBTEX-LONG-TOKEN-LENGTH*

A BibTeX name token is considered `long' when it has at least this many text characters.

*BIBTEX-SPLIT-INITIALS*

If non-nil, BibTeX understands that there are two abbreviated first names in names like `Padberg, M.W.'. The original BibTeX 0.99c, written by Oren Patashnik in the WEB language, thinks that `M.W.' is a single first name; hence, in abbreviated format, the name becomes `M. Padberg' instead of `M. W. Padberg'.

*CITE-ALL-ENTRIES*

Non-nil if all BibTeX entries are cited.

*CITE-KEYS*

List of cited BibTeX keys.

*MIN-CROSSREFS*

When a crossref'd entry is referenced at least *MIN-CROSSREFS* times, it is included as a separate entry as well.

Undocumented

*BIB-ENTRY*

*BIBTEX-SPLIT-INITIALS-ALREADY-WARNED-HASHTABLE*

*ERR-COUNT*

*HISTORY*

Private

*AUX-STREAM*

The stream corresponding to the current AUX file.

*BIBDATA-SEEN-P*

Non-nil if a bibdata command has been seen in an AUX file.

*CHECK-MULTIPLE-CITED-EQUIVALENT-ENTRIES*

If true, perform the following extension of BibTeX behavior: The attribute EQUIVALENT-ENTRIES of a bibliographic entry specifies the keys of other bibliographic entries that are to be considered equivalent. We compute the equivalence classes spanned by these equivalences, and warn if multiple equivalent keys are used in one document (we warn because both we and the original BibTeX will produce a bibliography that contains several copies of that entry).

*CITATION-SEEN-P*

Non-nil if a citation command has been seen in an AUX file.

*FOREIGN-CHARACTERS*

A list of FOREIGN-CHARACTER structures.

+CMR10-CHARACTER-WIDTHS+

An alist associating characters with their widths. The widths here are taken from Stanford's June '87 cmr10 font and represent hundredths of a point (rounded), but since they're used only for relative comparisons, the units have no meaning.

Undocumented

*AUX-FILE-COMMANDS*

*AUX-FILE-LEVEL*

*BBL-LINE-BUFFER*

*BIB-STREAM*

*GENERATE-SORT-KEY*

*IDENTIFIER-GROWTH*

+BIB-SEP-CHARACTER-LIST+

+BIB-WHITESPACE-CHARACTER-LIST+

CLASS

Public

BIBTEX-NAME

BibTeX name, broken down into its components. Each component is a list of name tokens (SEP-CHAR TOKEN-STRING).

Private

Undocumented

BIB-ENTRY

FOREIGN-CHARACTER

CONSTANT

Public

Undocumented

+ERROR-MESSAGE+

+FATAL-MESSAGE+

+SPOTLESS-HISTORY+

+WARNING-MESSAGE+