| 1 | (in-package "SPELL")
|
|---|
| 2 |
|
|---|
| 3 | (defconstant +spell-deleted-entry+ #xFFFF)
|
|---|
| 4 |
|
|---|
| 5 | ;;; The next number (using 6 bits) is 63, and that's pretty silly because
|
|---|
| 6 | ;;; "supercalafragalistic" is less than 31 characters long.
|
|---|
| 7 | ;;;
|
|---|
| 8 | (defconstant +max-entry-length+ 31
|
|---|
| 9 | "This the maximum number of characters an entry may have.")
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 | ;;; These are the eleven bits of a computed hash that are stored as part of
|
|---|
| 14 | ;;; an entries descriptor unit. The shifting constant is how much the
|
|---|
| 15 | ;;; eleven bits need to be shifted to the right, so they take up the upper
|
|---|
| 16 | ;;; eleven bits of one 16-bit element in a descriptor unit.
|
|---|
| 17 | ;;;
|
|---|
| 18 | (defconstant +new-hash-byte+ (byte 11 13))
|
|---|
| 19 | (defconstant +stored-hash-byte+ (byte 11 5))
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 | ;;; The next two constants are used to extract information from an entry's
|
|---|
| 23 | ;;; descriptor unit. The first is the two most significant bits of 18
|
|---|
| 24 | ;;; bits that hold an index into the string table where the entry is
|
|---|
| 25 | ;;; located. If this is confusing, regard the diagram of the descriptor
|
|---|
| 26 | ;;; units above.
|
|---|
| 27 | ;;;
|
|---|
| 28 | ;;; This is used to break up an 18 bit string table index into two parts
|
|---|
| 29 | ;;; for storage in a word descriptor unit. See the documentation at the
|
|---|
| 30 | ;;; top of Spell-Correct.Lisp.
|
|---|
| 31 | ;;;
|
|---|
| 32 | (defconstant +whole-index-low-byte+ (byte 16 0))
|
|---|
| 33 | (defconstant +whole-index-high-byte+ (byte 2 16))
|
|---|
| 34 |
|
|---|
| 35 | (defconstant +stored-index-high-byte+ (byte 2 14))
|
|---|
| 36 | (defconstant +stored-length-byte+ (byte 5 0))
|
|---|
| 37 |
|
|---|
| 38 | (defconstant +spell-alphabet+
|
|---|
| 39 | (list #\A #\B #\C #\D #\E #\F #\G #\H
|
|---|
| 40 | #\I #\J #\K #\L #\M #\N #\O #\P
|
|---|
| 41 | #\Q #\R #\S #\T #\U #\V #\W #\X #\Y #\Z))
|
|---|
| 42 |
|
|---|
| 43 | ;;; This is the first thing in a spell binary dictionary file to serve as a
|
|---|
| 44 | ;;; quick check of its proposed contents. This particular number is
|
|---|
| 45 | ;;; "BILLS" on a calculator held upside-down.
|
|---|
| 46 | ;;;
|
|---|
| 47 | (defconstant +magic-file-id+ 57718)
|
|---|
| 48 |
|
|---|
| 49 | ;;; These constants are derived from the order things are written to the
|
|---|
| 50 | ;;; binary dictionary in Spell-Build.Lisp.
|
|---|
| 51 | ;;;
|
|---|
| 52 | (defconstant +magic-file-id-loc+ 0)
|
|---|
| 53 | (defconstant +dictionary-size-loc+ 1)
|
|---|
| 54 | (defconstant +descriptors-size-loc+ 2)
|
|---|
| 55 | (defconstant +string-table-size-low-byte-loc+ 3)
|
|---|
| 56 | (defconstant +string-table-size-high-byte-loc+ 4)
|
|---|
| 57 | (defconstant +file-header-bytes+ 10)
|
|---|
| 58 |
|
|---|
| 59 | ;;; bump this up a bit, but do not lower it. TRY-WORD-ENDINGS depends on
|
|---|
| 60 | ;;; this value being at least 4.
|
|---|
| 61 | (defconstant +minimum-try-word-endings-length+ 4)
|
|---|