;;; compiled by mycroft@hal on Tue Sep 22 05:16:59 1992
;;; from file /src/emacs-19.0/lisp/refbib.el
;;; emacs version 19.0.426.
;;; bytecomp version FSF 2.08
;;; optimization is on.

(defvar r2b-trace-on nil "\
*trace conversion")
(defvar r2b-journal-abbrevs nil "\
  Abbreviation list for journal names.  
If the car of an element matches a journal name exactly, it is replaced by
the cadr when output.  Braces must be included if replacement is a
{string}, but not if replacement is a bibtex abbreviation.  The cadr
may be eliminated if is exactly the same as the car.  
  Because titles are capitalized before matching, the abbreviation
for the journal name should be listed as beginning with a capital 
letter, even if it really doesn't.
  For example, a value of '((\"Aij\" \"{Artificial Intelligence}\")
(\"Ijcai81\" \"ijcai7\")) would expand Aij to the text string
\"Artificial Intelligence\", but would replace Ijcai81 with the 
BibTeX macro \"ijcai7\".")
(defvar r2b-booktitle-abbrevs nil "\
  Abbreviation list for book and proceedings names.  If the car of
an element matches a title or booktitle exactly, it is replaced by 
the cadr when output.  Braces must be included if replacement is 
a {string}, but not if replacement is a bibtex abbreviation.  The cadr 
may be eliminated if is exactly the same as the car.  
  Because titles are capitalized before matching, the abbreviated title
should be listed as beginning with a capital letter, even if it doesn't.
  For example, a value of '((\"Aij\" \"{Artificial Intelligence}\")
(\"Ijcai81\" \"ijcai7\")) would expand Aij to the text string
\"Artificial Intelligence\", but would replace Ijcai81 with the 
BibTeX macro \"ijcai7\".")
(defvar r2b-proceedings-list nil "\
  Assoc list of books or journals which are really conference proceedings,
but whose name and whose abbrev expansion (as defined in `r2b-journal-abbrevs'
and `r2b-booktitle-abbrevs') does not contain the words \"conference\" or
\"proceedings\".  (Those cases are handled automatically.)
The entry must match the given data exactly.
  Because titles are capitalized before matching, the items in this list 
should begin with a capital letter.
  For example, suppose the title \"Ijcai81\" is used for the proceedings of
a conference, and it's expansion is the BibTeX macro \"ijcai7\".  Then
`r2b-proceedings-list' should be '((\"Ijcai81\") ...).  If instead its
expansion were \"Proceedings of the Seventh International Conference
on Artificial Intelligence\", then you would NOT need to include Ijcai81
in `r2b-proceedings-list' (although it wouldn't cause an error).")
(defvar r2b-additional-stop-words "Some\\|What" "\
Words other than the `capitialize-title-stop-words'
which are not to be used to build the citation key")
(defvar r2b-delimit-with-quote t "\
*If true, then use \" to delimit fields, otherwise use braces")
(defvar capitalize-title-stop-words (concat "the\\|and\\|of\\|is\\|a\\|an\\|of\\|for\\|in\\|to\\|in\\|on\\|at\\|" "by\\|with\\|that\\|its") "\
Words not to be capitialized in a title (unless they are the first
word in the title)")
(byte-code "! Q" [boundp capitalize-title-stop-regexp "\\(" capitalize-title-stop-words "\\)\\(\\b\\|'\\)"] 3)
(fset 'capitalize-title-region (make-byte-code (quote (begin end)) " Ď!	\"eb!$ !( !#U != !( !)N !( !( ," [nil syntax-table orig-syntax-table case-fold-search ((set-syntax-table orig-syntax-table)) set-syntax-table text-mode-syntax-table narrow-to-region begin end looking-at "[A-Z][a-z]*[A-Z]" forward-word 1 capitalize-word re-search-forward "\\<" t capitalize-title-stop-regexp downcase-word] 4 "\
Like `capitalize-region', but don't capitalize stop words, except the first." "r"))
(fset 'capitalize-title (make-byte-code (quote (s)) "!q ced\" )" [get-buffer-create "$$$Scratch$$$" erase-buffer s capitalize-title-region buffer-string] 3 "\
Like capitalize, but don't capitalize stop words, except the first."))
(fset 'r2b-reset (make-byte-code (quote nil) "!!!!!!!" [makunbound r2b-journal-abbrevs r2b-booktitle-abbrevs r2b-proceedings-list capitalize-title-stop-words capitalize-title-stop-regexp r2b-additional-stop-words r2b-stop-regexp] 2 "\
Unbind defvars, for debugging." nil))
(byte-code "! %$M" [boundp r2b-stop-regexp concat "\\`\\(\\(" r2b-additional-stop-words "\\|" capitalize-title-stop-words "\\)\\('\\w*\\)?\\W+\\)*\\([A-Z0-9]+\\)" r2b-trace make-byte-code (&rest args) " \"!" [r2b-trace-on apply message args sit-for 0] 3] 6)
(fset 'r2b-match (make-byte-code (quote (exp)) "\n!\n!\"" [buffer-substring match-beginning exp match-end] 4 "\
Returns string matched in current buffer."))
(defvar r2b-out-buf-name "*Out*" "\
*output from refer-to-bibtex")
(defvar r2b-log-name "*Log*" "\
*logs errors from refer-to-bibtex")
(byte-code "! ! ! !  " [boundp r2b-in-buf nil r2b-out-buf r2b-log r2b-error-found (r2b-error-found r2bv-author r2bv-primary-author r2bv-date r2bv-year r2bv-decade r2bv-month r2bv-title r2bv-title-first-word r2bv-editor r2bv-annote r2bv-tr r2bv-address r2bv-institution r2bv-keywords r2bv-booktitle r2bv-journal r2bv-volume r2bv-number r2bv-pages r2bv-booktitle r2bv-kn r2bv-publisher r2bv-organization r2bv-school r2bv-type r2bv-where r2bv-note r2bv-ordering) r2b-variables] 2)
(fset 'r2b-clear-variables (make-byte-code (quote nil) " 	@L	A )" [r2b-variables vars nil] 3 "\
Set all global vars used by r2b to nil."))
(byte-code "$M" [r2b-warning make-byte-code (&rest args) "\"\"\"\"\"\"\"" [t r2b-error-found princ apply format args r2b-log "\n" r2b-out-buf "% "] 4] 6)
(fset 'r2b-get-field (make-byte-code (quote (var field &optional unique required capitalize)) "\"eb\nf Q#f !!UA !A !!Q# J  ^ #Q Q s s !L?  !+" [nil t not-past-end val item r2b-trace "snarfing %s" field re-search-forward "^" "\\b[ 	]*\\(.*[^ 	\n]\\)[ 	]*" r2b-match 1 forward-line 0 looking-at "[ 	]*$\\|%" "\\(.*[^ 	\n]\\)[ 	]*$" "\n" unique r2b-warning "*Illegal multiple field %s %s" "\n		and " capitalize capitalize-title var required r2b-require] 4 "\
Set VAR to string value of FIELD, if any.  If none, VAR is set to
nil.  If multiple fields appear, then separate values with the
'\\nand\\t\\t', unless UNIQUE is non-nil, in which case log a warning
and just concatenate the values.  Trim off leading blanks and tabs on
first line, and trailing blanks and tabs of every line.  Log a warning
and set VAR to the empty string if REQUIRED is true.  Capitalize as a
title if CAPITALIZE is true.  Returns value of VAR."))
(fset 'r2b-set-match (make-byte-code (quote (var n regexp string)) "	; 	\" 	!!OL" [var string string-match regexp match-beginning n match-end] 5 "\
Set VAR to the Nth subpattern in REGEXP matched by STRING, or nil if none."))
(byte-code "! " [boundp r2b-month-abbrevs (("jan") ("feb") ("mar") ("apr") ("may") ("jun") ("jul") ("aug") ("sep") ("oct") ("nov") ("dec"))] 2)
(fset 'r2b-convert-month (make-byte-code (quote nil) "U 	\"- \n! \n@@\"! \nA \nT \n@@T !@\n!M \nVM \nWM \n	8@T !ˉ)" [r2bv-month r2b-month-abbrevs months string-match "[^0-9]" read-from-string numberp 0 13 r2b-warning "* Ridiculous month" nil] 4 "\
Try to convert `r2bv-month' to a standard 3 letter name."))
(fset 'r2b-snarf-input (make-byte-code (quote nil) "!!qeb	\"` `\"	\"	!\"\"B $U R $U $$y $y P$$; \" !O %)%$####\"%%###@ #́A B #)" [t case-fold-search r2b-trace "snarfing..." sit-for 0 r2b-in-buf princ "    " r2b-log buffer-substring end-of-line terpri r2b-get-field r2bv-author "%A" r2bv-editor "%E" r2b-set-match r2bv-primary-author 1 "\\b\\(\\w+\\)[ 	]*\\($\\|,\\)" "" r2bv-date "%D" r2bv-year "[12][0-9][0-9][0-9]" "[^0-9]\\([0-9][0-9]\\)$" "19" r2bv-decade "..\\(..\\)" r2bv-month "[0-9]+/\\|[a-zA-Z]+" string-match "\\(.*\\)/$" match-end r2b-convert-month r2bv-title "%T" r2bv-title-first-word 4 r2b-stop-regexp r2bv-annote "%X" r2bv-tr "%R" r2bv-address "%C" r2bv-institution "%I" r2bv-keywords "%K" r2bv-booktitle "%B" nil r2bv-journal "%J" r2bv-volume "%V" r2bv-number "%N" r2bv-pages "%P" r2bv-where "%W" r2bv-ordering "%O"] 6 "\
Parse buffer into global variables."))
(fset 'r2b-put-field (make-byte-code (quote (field data &optional abbrevs)) "/ \"/ A& @* A@ \"B \"B  \n#n !O!!O!O%!\\D \n# !O!OQ!\\p  \n# !O!OQ!\\ !!!  ! !\"!V !!?  ! !," [data nil index multi-line nodelim match abbrevs assoc t equal "" string-match "[^0-9]" 0 "[\\~^]" concat match-beginning "\\verb+" match-end "+" 7 "[$&%#_{}]" "\\" 1 r2b-delimit-with-quote "\"" "{\"}" 2 princ ", \n  " field " =	" "{" ".*" 59 "\n" "}"] 8 "\
Print bibtex FIELD = {DATA} if DATA not null; precede
with a comma and newline; if ABBREVS list is given, then
try to replace the {DATA} with an abbreviation."))
(fset 'r2b-require (make-byte-code (quote (vars)) "?\" < @!A!J?\" \"L" [vars r2b-require r2b-warning "*Missing value for field %s" ""] 3 "\
If any of VARS is null, set to empty string and log error."))
(fset 'r2b-moveq (cons 'macro (make-byte-code (quote (new old)) "\nEEE" [progn setq new old nil] 5 "\
Set NEW to OLD and set OLD to nil.")))
(fset 'r2b-isa-proceedings (make-byte-code (quote (name)) "$ \"$ \"$ \"# A@\")" [name string-match "proceedings\\|conference" assoc r2b-proceedings-list r2b-booktitle-abbrevs match] 4 "\
Return t if NAME is the name of proceedings."))
(fset 'r2b-isa-university (make-byte-code (quote (name)) " \" \"?" [name string-match "university" "press"] 3 "\
Return t if NAME is a university or similar organization,
but not a publisher."))
(fset 'r2b-barf-output (make-byte-code (quote nil) "!!q\nQ!O !9 @ !ق!} !g n !ق \" !!݂ \" !!߂ \" ! !!!$&\"&!E!3:$\\{\\\"{!$w!!\"!O.!O11!4!6!!4!!!\"&>#@\"A BC#D E#F G\"H .\"I 1\"J >#K $\"L \"M \"N \"O \"P Q\"R S\"T \"U V\"W X\"Y Z\"[ \\\"] !+" [r2b-out-buf t nil match case-fold-search standard-output r2b-trace "...barfing" sit-for 0 r2bv-primary-author r2bv-decade r2bv-title-first-word r2bv-kn r2b-isa-proceedings r2bv-journal r2bv-booktitle r2b-isa-university r2bv-institution r2bv-organization r2bv-publisher r2bv-tr r2bv-note r2b-require r2bv-author inproceedings string-match "phd" r2bv-school phdthesis "master" mastersthesis "draft\\|unpublish" unpublished article incollection r2bv-editor "\\`personal communication\\'" r2bv-title misc proceedings "\\bisbn\\b" book "\\`\\(\\(.\\|\n\\)+\\)[ 	\n]+\\([^ 	\n]\\)+\\'" match-end 1 r2bv-type match-beginning 3 r2bv-number techreport manual r2bv-entry-kind (r2bv-year) r2b-error-found princ "\n% Warning -- Errors During Conversion Next Entry\n" "\n@" "( " r2b-put-field "author" "title" r2b-booktitle-abbrevs "year" r2bv-year "month" r2bv-month r2b-month-abbrevs "journal" r2b-journal-abbrevs "volume" r2bv-volume "type" "number" "booktitle" "editor" "publisher" "institution" "organization" "school" "pages" r2bv-pages "address" r2bv-address "note" "keywords" r2bv-keywords "where" r2bv-where "ordering" r2bv-ordering "annote" r2bv-annote " )\n"] 4 "\
Generate bibtex based on global variables."))
(fset 'r2b-convert-record (make-byte-code (quote (output-name)) "!pqdb	!\nqdbq#b #!!`#`\n\"   q b+" [nil not-done rec-begin rec-end output-name r2b-out-buf-name get-buffer-create r2b-out-buf r2b-in-buf r2b-log-name r2b-log re-search-forward "[^ 	\n]" t re-search-backward "^[ 	]*$" 2 "^%" forward-line 0 narrow-to-region r2b-clear-variables r2b-snarf-input r2b-barf-output widen] 5 "\
Transform current bib entry and append to buffer OUTPUT;
do \"M-x r2b-help\" for more info." (quote (byte-code "\n\"C" [read-string "Output to buffer: " r2b-out-buf-name] 3))))
(fset 'r2b-convert-buffer (make-byte-code (quote (output-name)) "	!q ) eb!!\n! 	#" [get-buffer-create r2b-log-name r2b-log erase-buffer widen message "Working, please be patient..." sit-for 0 r2b-convert-record output-name "Done, results in %s, errors in %s" r2b-out-buf-name] 5 "\
Transform current buffer and append to buffer OUTPUT;
do \"M-x r2b-help\" for more info." (quote (byte-code "\n\"C" [read-string "Output to buffer: " r2b-out-buf-name] 3))))
(defvar r2b-load-quietly nil "\
*Don't print help message when loaded")
(byte-code "! " [boundp r2b-help-message "                   Refer to Bibtex Bibliography Conversion\n\nA refer-style database is of the form:\n\n%A Joe Blow\n%T Great Thoughts I've Thought\n%D 1977\netc.\n\nThis utility converts these kind of databases to bibtex form, for\nusers of TeX and LaTex.  Instructions:\n1.  Visit the file containing the refer-style database.\n2.  The command\n	M-x r2b-convert-buffer\n    converts the entire buffer, appending it's output by default in a\n    buffer named *Out*, and logging progress and errors in a buffer\n    named *Log*.  The original file is never modified.\n	Note that results are appended to *Out*, so if that buffer\n	buffer already exists and contains material you don't want to\n 	save, you should kill it first.\n3.  Switch to the buffer *Out* and save it as a named file.\n4.  To convert a single refer-style entry, simply position the cursor\n    at the entry and enter\n	M-x r2b-convert-record\n    Again output is appended to *Out* and errors are logged in *Log*.\n\nThis utility is very robust and pretty smart about determining the\ntype of the entry.  It includes facilities for expanding refer macros\nto text, or substituting bibtex macros.  Do M-x describe-variable on\n     r2b-journal-abbrevs\n     r2b-booktitle-abbrevs\n     r2b-proceedings-list\nfor information on these features.\n\nIf you don't want to see this help message when you load this utility,\nthen include the following line in your .emacs file:\n	(setq r2b-load-quietly t)\nTo see this message again, perform \n         M-x r2b-help\nPlease send bug reports and suggestions to\n	Henry Kautz\n        kautz@research.att.com\n	allegra!kautz"] 2)
(fset 'r2b-help (make-byte-code (quote nil) "\n!" ["*Help*" princ r2b-help-message] 3 "\
Print help message." nil))
(byte-code "  !!" [r2b-load-quietly r2b-help message "r2b loaded" provide refer-to-bibtex] 2)
