
(defvar db-use-completing-read t "\
*Non-nil if EDB should use `completing-read' when reading enumerated types.
Otherwise, on erroneous enumeration input, EDB shows the possible completions
but doesn't correct the input.")

(defvar db-enum-ignore-case t "\
If non-nil, assume that any association lists created from
enumeration types input names are to include both upper and lower case
versions of the name, if distinct.")

(defun define-displaytype-from-optstring (typename optstring) "\
Define a displaytype named TYPENAME according to OPTSTRING.
TYPENAME is a symbol or string and OPTSTRING is the optional parameters
part of a display specification string." (byte-code ";…
 Å!‰ˆÆÂÄ#Ç	\")‡" [typename displayspec nil optstring t intern make-displayspec-from-type-and-options define-displaytype-from-displayspec] 5))

(defun define-displaytype-from-displayspec (typename displayspec) "\
Define a displaytype named TYPENAME (a symbol) with the default DISPLAYSPEC.
DISPLAYSPEC may also be a typename symbol itself." (byte-code "	
BB‰‡" [db-displaytypes typename displayspec] 2))

(put (quote define-displaytype-from-displayspec) (quote lisp-indent-hook) 1)

(defun define-recordfieldtype-from-recordfieldspec (typename recordfieldspec) "\
Define a recordfieldtype named TYPENAME (a symbol) with the default RECORDFIELDSPEC.
DISPLAYSPEC may also be a typename symbol itself.
After this call, `recordfieldtype->recordfieldspec' called with argument
TYPENAME returns the proper record field specification." (byte-code "	
BB‰‡" [db-recordfieldtypes typename recordfieldspec] 2))

(put (quote define-recordfieldtype-from-recordfieldspec) (quote lisp-indent-hook) 1)

(fset (quote define-displaytype-alias) (quote define-displaytype-from-displayspec))

(make-obsolete (quote define-displaytype-alias) (quote define-displaytype-from-displayspec))

(fset (quote define-recordfieldtype-alias) (quote define-recordfieldtype-from-recordfieldspec))

(make-obsolete (quote define-recordfieldtype-alias) (quote define-recordfieldtype-from-recordfieldspec))

(defun define-type-alias (alias typename) "\
Make symbol ALIAS refer to the same displaytype and recordfieldtype as TYPENAME." (byte-code "Â	\"ˆÃ	\"‡" [alias typename define-displaytype-from-displayspec define-recordfieldtype-from-recordfieldspec] 4))

(defun define-one-char-enum-displaytype (typename alternatives optstring) (byte-code "ÀÁ!‡" [error "define-one-char-enum-displaytype isn't defined yet"] 2))

(defun define-enum-type (typename alternatives &optional optstring) "\
Make TYPENAME (a symbol or string) an enumerated type.
Both a displaytype and a recordfieldtype are created.

ALTERNATIVES is a list.  Each alternative is a list of up to four components:
 the internal representation, any constant Lisp object, often a string;
 the input representation typed by the user to specify this alternative,
   a string or list of strings (for multiple input representations);
 the display representation, a string; and
 the file storage representation, a string.

If the input representation is omitted and the internal representation is a
string, that string is used.  If the display representation is omitted, it
defaults to the first input representation.  The display representation is
automatically also a valid input representation.  If the file storage
representation is omitted, it defaults to the display representation.
If all the other components are omitted, the internal representation string
may be used in place of a one-element list containing just it.

Optional argument OPTSTRING is a displayspec option string." (byte-code ";…
 Ë!‰ˆÇÇÇÌ!@A@AA@‰ˆÍÇÉ#ÎÇIˆÏÐ	\"IˆÑÒ
\"IˆÓ\")ˆÔ 

ÕIˆ
ÎÖIˆ
×Ø
\"Iˆ
ÙÚ
\"Iˆ
ÛÜKIˆ
ÝÞ	\"Iˆ
ßà\"Iˆ
áâ\"Iˆã
\"),‡" [typename d->a a->d a->s processed-alternatives alternatives ds nil optstring t rs intern db-enum-process-alternatives make-displayspec-from-type-and-options 2 12 db-enum-make-display->actual 11 db-enum-make-actual->display define-displaytype-from-displayspec make-recordfieldspec 1 "" 5 make-enum-member-orderer 6 make-enum-member-sorter 7 string-match-function 8 db-enum-make-help-info 9 db-enum-make-actual->stored 10 db-enum-make-stored->actual define-recordfieldtype-from-recordfieldspec] 17))

(fset (quote define-alternative-multi-char-displaytype) (quote define-enum-type))

(defun db-enum-process-alternatives (alternatives) (byte-code "ËËËËËËËËËË	
…¥ 
@<ƒ* ‚, C@A@†9 <ƒF ‚I CAA@†U @Ì8†_ 	ÍÎÏ\"\"Ð\"ƒw 	‚~ B	BB
B	BB†š Ñ	\"?
A‰
ˆ‚ ˆÍÒ	!\"Ò
!…¸ Ò!‰ˆ
E.
‡" [d->a dinput->a a->d a->s a-s-differ alternative internal input display storage alternatives nil 3 nconc mapcar (lambda (irep) (byte-code "	B‡" [irep internal] 2)) member equal nreverse] 11))

(defun db-enum-make-help-info (type d->a) (byte-code "ÄÅ!ŠqˆÆ ˆÇÈÉÊ
!\"!ˆËÌÍ\"!ˆÎ Ï!ˆ)*‡" [buf standard-output type d->a get-buffer-create " *temp*" erase-buffer princ format "%s:  an enumerated type.  " symbol-name display-completion-list all-completions "" buffer-string kill-buffer] 11))

(defun db-enum-make-display->actual (type d->a) (byte-code "ÂÃÄÅÆDÆ	DFE‡" [type d->a lambda (input-rep) db-enum-do-completions input-rep quote] 7))

(defun db-enum-do-completions (input-rep type d->a) (byte-code "Ë	
\"ƒ A‚y Ì	
\"… Ë
\"‰ƒ' A‚x Í†- Î!ˆƒP ÏÐÑ\"
ÈÉ†B Î%Ë	
\"‰ˆA‚x 
ƒ_ ÒÓ!ˆÔÕ!‚l Ö�×Ø†h Î
\"!‘ˆÙƒv Ú‚w Û!*)‡" [assoc-hit input-rep d->a completion-ignore-case db-enum-ignore-case try-comp db-use-completing-read type nil t use-electric-help-p assoc try-completion dbf-set-this-field-text "" completing-read format "Enter \"%s\" enum value (? for list): " require ehelp with-electric-help (lambda nil (byte-code "ÂÃ† Ä	\"!‡" [try-comp d->a display-completion-list all-completions ""] 4)) "*Help*" display-completion-list all-completions error "Not unique." "No match."] 14))

(defun db-enum-make-actual->display (typename a->d) (byte-code "ÁÂÃÄÅÆDEDE‡" [a->d lambda (enum-val) cdr assoc enum-val quote] 7))

(defun db-enum-make-actual->stored (typename a->s) (byte-code "… ÁÂÃÄÅÆDEDE‡" [a->s lambda (enum-val) cdr assoc enum-val quote] 7))

(defun db-enum-make-stored->actual (typename a->s) (byte-code "… ÁÂÃÄÅÆDEDE‡" [a->s lambda (stored-val) car db-rassoc stored-val quote] 7))

(defun make-enum-member-orderer (type a->d) (byte-code "Â	ÃÄÅ%‡" [type a->d make-enum-member-orderer-internal -1 0 1] 6))

(proclaim-inline make-enum-member-orderer)

(defun make-enum-member-sorter (type a->d) (byte-code "Ä	ÂÃÃ%‡" [type a->d t nil make-enum-member-orderer-internal] 6))

(proclaim-inline make-enum-member-sorter)

(defun make-enum-member-orderer-internal (type a->d less-value equal-value greater-value) (byte-code "ÄÅÆÇÈÉÊ	DDËDÌEÍÉÎÏÐÑÒË
ÉÓ%DÔÑÒËÉÓ%DÕFFËFFE‡" [equal-value a->d less-value greater-value lambda (item1 item2) if (equal item1 item2) let alt-alist quote result alt-item while (setq alt-item (car alt-alist)) cond (equal (car alt-item) item1) list setq nil (equal (car alt-item) item2) (t (setq alt-alist (cdr alt-alist)))] 20))

(let ((ds (make-displayspec))) (displayspec-set-indent ds nil) (displayspec-set-actual->display ds (function int-to-string)) (displayspec-set-display->actual ds (function string-to-int)) (define-displaytype-from-displayspec (quote integer) ds))

(let ((rs (make-recordfieldspec))) (recordfieldspec-set-type rs (quote integer)) (recordfieldspec-set-default-value rs 0) (recordfieldspec-set-actual->stored rs (function int-to-string)) (recordfieldspec-set-stored->actual rs (function string-to-int)) (recordfieldspec-set-order-fn rs (function number-order)) (recordfieldspec-set-sort-fn rs (function <)) (recordfieldspec-set-match-function rs (function =)) (recordfieldspec-set-help-info rs "An integer.") (define-recordfieldtype-from-recordfieldspec (quote integer) rs))

(let ((ds (make-displayspec))) (displayspec-set-indent ds nil) (displayspec-set-actual->display ds (function number-or-nil->string)) (displayspec-set-display->actual ds (function string->integer-or-nil)) (define-displaytype-from-displayspec (quote integer-or-nil) ds))

(let ((rs (make-recordfieldspec))) (recordfieldspec-set-type rs (quote integer-or-nil)) (recordfieldspec-set-default-value rs 0) (recordfieldspec-set-actual->stored rs (function number-or-nil->string)) (recordfieldspec-set-stored->actual rs (function string->integer-or-nil)) (recordfieldspec-set-order-fn rs (function number-or-nil-order-nil-greatest)) (recordfieldspec-set-match-function rs (function equal)) (recordfieldspec-set-help-info rs "An integer, or nil.") (define-recordfieldtype-from-recordfieldspec (quote integer-or-nil) rs))

(defun string-or-nil->number-or-nil (string-or-nil) (byte-code "… Á!‡" [string-or-nil string->number-or-nil] 2))

(make-obsolete (quote string-or-nil->integer-or-nil) (quote string-or-nil->number-or-nil))

(let ((ds (make-displayspec))) (displayspec-set-indent ds nil) (displayspec-set-actual->display ds (function number-to-string)) (displayspec-set-display->actual ds (function string-to-number)) (define-displaytype-from-displayspec (quote number) ds))

(let ((rs (make-recordfieldspec))) (recordfieldspec-set-type rs (quote number)) (recordfieldspec-set-default-value rs 0) (recordfieldspec-set-actual->stored rs (function number-to-string)) (recordfieldspec-set-stored->actual rs (function string-to-number)) (recordfieldspec-set-order-fn rs (function number-order)) (recordfieldspec-set-sort-fn rs (function <)) (recordfieldspec-set-match-function rs (function =)) (recordfieldspec-set-help-info rs "A number.") (define-recordfieldtype-from-recordfieldspec (quote number) rs))

(let ((ds (make-displayspec))) (displayspec-set-indent ds nil) (displayspec-set-actual->display ds (function number-or-nil->string)) (displayspec-set-display->actual ds (function string->number-or-nil)) (define-displaytype-from-displayspec (quote number-or-nil) ds))

(let ((rs (make-recordfieldspec))) (recordfieldspec-set-type rs (quote number-or-nil)) (recordfieldspec-set-default-value rs 0) (recordfieldspec-set-actual->stored rs (function number-or-nil->string)) (recordfieldspec-set-stored->actual rs (function string->number-or-nil)) (recordfieldspec-set-order-fn rs (function number-or-nil-order-nil-greatest)) (recordfieldspec-set-match-function rs (function equal)) (recordfieldspec-set-help-info rs "A number, or nil.") (define-recordfieldtype-from-recordfieldspec (quote number-or-nil) rs))

(defun number-order (a b) "\
Return -1, 0, or 1 depending on whether A < B, A = B, or A > B." (byte-code "	Uƒ
 Ã‚ 	Wƒ Ä‚ Å‡" [a b t 0 -1 1] 2))

(proclaim-inline number-order)

(defun number-or-nil-order-nil-greatest (a b) "\
Like number-order, but nil is treated as greater than any integer.
This puts nil after integers in an increasing list." (byte-code "… 	ƒ Ã	\"‚  ƒ Ä‚  	ƒ Å‚  Æ‡" [a b t number-order -1 1 0] 3))

(defun number-or-nil-order-nil-least (a b) "\
Like number-order, but nil is treated as smaller than any integer.
This puts nil after integers in a decreasing list." (byte-code "… 	ƒ Ã	\"‚  ƒ Ä‚  	ƒ Å‚  Æ‡" [a b t number-order 1 -1 0] 3))

(let ((ds (make-displayspec))) (displayspec-set-indent ds nil) (displayspec-set-min-width ds 3) (displayspec-set-max-width ds 3) (displayspec-set-actual->display ds (function boolean->yes-no-string)) (displayspec-set-display->actual ds (function yes-no-string->boolean)) (define-displaytype-from-displayspec (quote yes-no) ds))

(let ((rs (make-recordfieldspec))) (recordfieldspec-set-type rs (quote boolean)) (recordfieldspec-set-default-value rs nil) (recordfieldspec-set-actual->stored rs (function boolean->yn-string)) (recordfieldspec-set-stored->actual rs (function yn-string->boolean)) (recordfieldspec-set-order-fn rs (function boolean-order-function)) (recordfieldspec-set-sort-fn rs (function boolean-lessp)) (recordfieldspec-set-match-function rs (function eq)) (recordfieldspec-set-help-info rs "A boolean value.") (define-recordfieldtype-from-recordfieldspec (quote boolean) rs))

(defun boolean->yes-no-string (boolean) (byte-code "ƒ Á‚	 Â‡" [boolean "Yes" "No"] 1))

(proclaim-inline boolean->yes-no-string)

(defun yes-no-string->boolean (yes-or-no) (byte-code "Ä	!ÅÆ\"ƒ Â‚ ÅÇ\"ƒ Ã‚ ÈÉ	\")‡" [downcased-yes-or-no yes-or-no t nil downcase string= "yes" "no" error "`%s' is not `Yes' or `No'."] 6))

(defun boolean->yn-string (boolean) (byte-code "ƒ Á‚	 Â‡" [boolean "Y" "N"] 1))

(proclaim-inline boolean->yn-string)

(defun yn-string->boolean (y-or-n) (byte-code "ÁÂÃ!\"‡" [y-or-n string= "y" downcase] 4))

(proclaim-inline yn-string->boolean)

(defun string-is-yn-p (string) (byte-code "ÁGU…  ÂÃ\"†  ÂÄ\"†  ÂÅ\"†  ÂÆ\"‡" [string 1 string= "Y" "y" "N" "n"] 6))

(defun boolean-order-function (bool1 bool2) (byte-code "… 	† † 	?ƒ Ã‚ ƒ Ä‚ Å‡" [bool1 bool2 t 0 -1 1] 1))

(defun boolean-lessp (bool1 bool2) (byte-code "?… 	‡" [bool1 bool2] 1))

(proclaim-inline boolean-lessp)

(let ((ds (make-displayspec))) (displayspec-set-max-height ds nil) (displayspec-set-indent ds t) (displayspec-set-match-actual->display ds (quote string-match-actual->display)) (displayspec-set-match-display->actual ds (quote string-match-display->actual)) (define-displaytype-from-displayspec (quote string) ds))

(let ((rs (make-recordfieldspec))) (recordfieldspec-set-type rs (quote string)) (recordfieldspec-set-default-value rs "") (recordfieldspec-set-order-fn rs (function string-order-ci)) (recordfieldspec-set-sort-fn rs (function string-lessp-ci)) (recordfieldspec-set-match-function rs (function string-match-function)) (define-recordfieldtype-from-recordfieldspec (quote string) rs))

(let ((ds (copy-displayspec (displaytype->displayspec (quote string))))) (displayspec-set-max-height ds 1) (displayspec-set-indent ds nil) (define-displaytype-from-displayspec (quote one-line-string) ds))

(let ((rs (copy-recordfieldspec (recordfieldtype->recordfieldspec (quote string))))) (recordfieldspec-set-type rs (quote one-line-string)) (define-recordfieldtype-from-recordfieldspec (quote one-line-string) rs))

(let ((ds (copy-displayspec (displaytype->displayspec (quote string))))) (displayspec-set-actual->display ds (function string-or-nil->string)) (define-displaytype-from-displayspec (quote string-or-nil) ds))

(let ((rs (copy-recordfieldspec (recordfieldtype->recordfieldspec (quote string))))) (recordfieldspec-set-type rs (quote string-or-nil)) (recordfieldspec-set-order-fn rs (function string-or-nil-order-ci)) (recordfieldspec-set-sort-fn rs (function string-or-nil-lessp-ci)) (recordfieldspec-set-match-function rs (function string-or-nil-match-function)) (define-recordfieldtype-from-recordfieldspec (quote string-or-nil) rs))

(let ((ds (copy-displayspec (displaytype->displayspec (quote string-or-nil))))) (displayspec-set-display->actual ds (function string->nil-or-string)) (define-displaytype-from-displayspec (quote nil-or-string) ds))

(let ((rs (copy-recordfieldspec (recordfieldtype->recordfieldspec (quote string-or-nil))))) (recordfieldspec-set-type rs (quote nil-or-string)) (define-recordfieldtype-from-recordfieldspec (quote nil-or-string) rs))

(let ((ds (copy-displayspec (displaytype->displayspec (quote one-line-string))))) (displayspec-set-actual->display ds (function string-or-nil->string)) (define-displaytype-from-displayspec (quote one-line-string-or-nil) ds))

(let ((rs (copy-recordfieldspec (recordfieldtype->recordfieldspec (quote one-line-string))))) (recordfieldspec-set-type rs (quote one-line-string-or-nil)) (recordfieldspec-set-order-fn rs (function string-or-nil-order-ci)) (recordfieldspec-set-sort-fn rs (function string-or-nil-lessp-ci)) (recordfieldspec-set-match-function rs (function string-or-nil-match-function)) (define-recordfieldtype-from-recordfieldspec (quote one-line-string-or-nil) rs))

(defun string-lessp-ci (string1 string2) "\
Case-insensitive version of string-lessp." (byte-code "ÂÃ!Ã	!\"‡" [string1 string2 string-lessp downcase] 5))

(proclaim-inline string-lessp-ci)

(defun string-order-ci (string1 string2) "\
Return -1, 0, or 1 depending on whether STRING1 is lexicographically less
than, equal to, or greater than STRING2.  Case-insensitive." (byte-code "Å	!Å!Æ
\"ƒ Ç‚ È
\"ƒ É‚ Ê*‡" [s1 string1 s2 string2 t downcase string= 0 string-lessp -1 1] 6))

(defvar dbm-string-regexp-prefix "^[ 	]*\\(/\\|regexp[ 	]+\\)")

(defvar dbm-string-regexp-prefix-string "/")

(defun make-regexp-pattern (regexp) (byte-code "ÀD‡" [regexp] 2))

(defun regexp-pattern-regexp (regexp-pattern) (byte-code "A@‡" [regexp-pattern] 1))

(defun make-string-pattern (string &optional regexp) (byte-code "Á† Â	!	E‡" [regexp string regexp-quote] 4))

(defun string-pattern-regexp (string-pattern) (byte-code "A@‡" [string-pattern] 1))

(defun string-pattern-string (string-pattern) (byte-code "AA@‡" [string-pattern] 1))

(defun string-match-function (pattern string) (byte-code "Â;ƒ
 ‚ A@	\"‡" [pattern string string-match] 3))

(proclaim-inline string-match-function)

(defun string-match-display->actual (string) (byte-code "Â	\"ƒ Ã	ÄÅ!ÆO!‚ Ç	!‡" [dbm-string-regexp-prefix string string-match make-regexp-pattern match-end 0 nil make-string-pattern] 6))

(defun string-match-actual->display (pattern) (byte-code "@Ã=ƒ Ä!‚  @Å=ƒ 	Æ!P‚  ÇÈ\"‡" [pattern dbm-string-regexp-prefix-string t string string-pattern-string regexp regexp-pattern-regexp error "string-match-actual->display:  bad pattern %s"] 5))

(defun string-or-nil->string (s-o-n) (byte-code "† Á‡" [s-o-n ""] 1))

(proclaim-inline string-or-nil->string)

(defun string-or-nil-lessp-ci (s-o-n-1 s-o-n-2) (byte-code "ÂÃ!Ã	!\"‡" [s-o-n-1 s-o-n-2 string-lessp-ci string-or-nil->string] 5))

(proclaim-inline string-or-nil-lessp-ci)

(defun string-or-nil-order-ci (s-o-n-1 s-o-n-2) (byte-code "Â† Ã	† Ã\"‡" [s-o-n-1 s-o-n-2 string-order-ci ""] 3))

(proclaim-inline string-or-nil-order-ci)

(defun string-or-nil-match-function (pattern s-o-n) (byte-code "Â;ƒ
 ‚ ƒ A@‚ Ã	† Ã\"‡" [pattern s-o-n string-match ""] 3))

(proclaim-inline string-or-nil-match-function)

(defun string->nil-or-string (string) (byte-code "ÂÃ\"ƒ Á‚ ‡" [string nil equal ""] 3))

(proclaim-inline string->nil-or-string)

(defun order-last-names (last-name-1 last-name-2) "\
Return -1, 0, or 1 depending on whether LAST-NAME-1 is lexographically
less than, equal to, or greater than LAST-NAME-2." (byte-code "Ã	\"ƒ Ä‚ ÅÆ!Æ	!\"ƒ Ç‚ È‡" [last-name-1 last-name-2 t equal 0 string-lessp canonicalize-name -1 1] 6))

(defun canonicalize-name (last-name) (byte-code "ÂÃÄ	\"… 	ÅÆÅ!OP	ÇÅ!ÈO‰ˆ‚ ˆÉ	P!)‡" [result last-name "" string-match "[ ']+" 0 match-beginning match-end nil downcase] 7))

(make-obsolete (quote make-name-comparable) (quote canonicalize-name))

(defconst nicknames (quote (("Abraham" "Abe") ("Charles" "Charlie") ("David" "Dave") ("Elizabeth" "Beth" "Liz") ("Gerald" "Gerry") ("James" "Jamey" "Jamie") ("Leonard" "Lenny") ("Michael" "Mike") ("Richard" "Dick" "Dicky" "Rick" "Ricky" "Rico") ("Robert" "Bob") ("Theodore" "Ted"))) "\
List of nicknames which are not prefixes of the full name.
It is by no means comprehensive.")

(defun same-first-name-p (fname1 fname2) (byte-code "Â	\"† Â	\"‡" [fname1 fname2 nicknamep] 4))

(defun nicknamep (nickname fullname) (byte-code "ÃÄÅ!P	\"† ÆÇÈ	!@
\"A\"‡" [nickname fullname nicknames string-match "^" regexp-quote member assoc db-string-split-first-word] 8))

(defun order-first-names (first-name-1 first-name-2) (byte-code "Å	!Å!Æ@
@\"† Æ	\"ƒ Ç‚* È@
@\"ƒ) É‚* Ê*‡" [first-middle-1 first-name-1 first-middle-2 first-name-2 t db-string-split-first-word same-first-name-p 0 string-lessp -1 1] 7))

(defun standardize-name (name) (byte-code "ÁÂÃP\"… ÄÅ!ÆO‰ˆÅÁÇ\"O‰ˆÁÈ\"…7 ÅÉÊ!OËÉÊ!ÆOQ‰ˆ‚ ˆ‡" [name string-match "^\\(\\(Dr\\|Mrs?\\|Prof\\|1?Lt\\)\\.?" "\\|Miss\\|Ensign\\|Doctor\\) " match-end 0 nil ",? \\(PhD\\|MD\\|Esq\\.?\\|Esquire\\)$" "\\(^\\| \\)[A-Z]\\([ ,]\\|$\\)" match-beginning 2 "."] 12))

(defvar jr-assoc-list (quote (("3d" . "3rd"))))

(defun name->name-jr (name) (byte-code "ÃÄ\"ƒ$ ÅÆÅ!OÆÇ!ÈOÉÊ	!
\"A† 	)D‚' ËD‡" [name jr jr-assoc-list string-match ",? +\\(jr\\.?\\|sr\\.?\\|3r?d\\|[45]th\\|I+\\)$" 0 match-beginning 1 nil assoc downcase ""] 8))

(defun name->first-last-jr (fullname) (byte-code "ÃÄ	!!Å@Æ\"Ç
A\"*‡" [name-jr fullname split-names name->name-jr standardize-name db-string-split-last-word "\\(La\\|de\\) [A-Z-]+" append] 6))

(defvar UK-postal-code-regexp "[A-Z][0-9][A-Z] ?[0-9][A-Z][0-9]")

(defvar zip-code-regexp "[0-9][0-9][0-9][0-9][0-9]\\(-?[0-9][0-9][0-9][0-9]\\)?")

(defvar postal-code-regexp (mapconcat (function identity) (list zip-code-regexp UK-postal-code-regexp "[0-9][0-9A-Z]*") "\\|"))

(defun postal-code-p (string) (byte-code "Â	\"‡" [postal-code-regexp string string-match] 3))

(proclaim-inline postal-code-p)

(defvar state-alist (quote (("AK" . "Alaska") ("AL" . "Alabama") ("AR" . "Arkansas") ("AZ" . "Arizona") ("CA" . "California") ("CO" . "Colorado") ("CT" . "Conneticut") ("DC" . "District of Columbia") ("DE" . "Deleware") ("FL" . "Florida") ("GA" . "Georgia") ("GU" . "Guam") ("HI" . "Hawaii") ("ID" . "Idaho") ("IL" . "Illinois") ("IN" . "Indiana") ("IA" . "Iowa") ("KS" . "Kansas") ("KY" . "Kentucky") ("LA" . "Louisiana") ("MA" . "Massachusetts") ("MD" . "Maryland") ("ME" . "Maine") ("MI" . "Michigan") ("MN" . "Minnessota") ("MS" . "Mississippi") ("MO" . "Missouri") ("MT" . "Montana") ("NE" . "Nebraska") ("NH" . "New Hampshire") ("NC" . "North Carolina") ("ND" . "North Dakota") ("NJ" . "New Jersey") ("NM" . "New Mexico") ("NV" . "Nevada") ("NY" . "New York") ("OH" . "Ohio") ("OK" . "Oklahoma") ("OR" . "Oregon") ("PA" . "Pennsylvania") ("PR" . "Puerto Rico") ("RI" . "Rhode Island") ("SC" . "South Carolina") ("SD" . "South Dakota") ("TX" . "Texas") ("TN" . "Tennessee") ("UT" . "Utah") ("VA" . "Virginia") ("VT" . "Vermont") ("WA" . "Washington") ("WI" . "Wisconson") ("WV" . "West Virginia") ("WY" . "Wyoming"))) "\
An alist of ABBREV and FULLNAME of each of the United States, and its
territories.  Used by \"full-state-name\" and \"abbreviate-state\".")

(defun statep (string) "\
Return non-nil if STRING is a valid state abbreviation." (byte-code "Á!‡" [string full-state-name] 2))

(defun full-state-name (abbrev) "\
Return the full state name for ABBREV, or nil if not found." (byte-code "ÂGU… ÃÄ!	\"A‡" [abbrev state-alist 2 assoc upcase] 4))

(defun abbreviate-state (state) "\
Return the postal abbreviation for STATE, or nil if not found." (byte-code "ÂÃ!	\"@‡" [state state-alist db-rassoc capitalize] 4))

(defvar country-list (quote ("Canada" "Israel" "Switzerland" "Japan" "West Germany" "United States" "Zambia")) "\
List of country names.  Far from complete.")

(defun countryp (string) (byte-code "ÂÃ!	\"‡" [string country-list member capitalize] 4))

(proclaim-inline countryp)
