(chars (cdr word-count-and-chars))
(cur 0)
(lock 0)
- (abbrev-char nil)
(s ""))
- (dolist (char chars)
- (cond
- (abbrev-char
- (let ((abbrev-addr
- (* 2 (ez-mem-ref-word (+ ez-abbrevtab-addr
- (* 2 (+ (* (- abbrev-char 1) 32) char)))))))
- (setq s (concat s (cdr (ez-get-zstring-and-length abbrev-addr)))))
- (setq abbrev-char nil))
- ((memq char '(1 2 3)) ;Abbreviation
- (setq abbrev-char char))
- ((= char 4)
- (setq cur (mod (+ cur 1) 3)))
- ((= char 5)
- (setq cur (mod (+ 3 (- cur 1)) 3)))
- (t
- (setq s (concat s (substring (elt ez-zstring-alphabets cur)
- char (+ char 1))))
- (setq cur lock))))
+ (while (> (length chars) 0)
+ (let ((char (pop chars)))
+ (cond
+ ((memq char '(1 2 3)) ;Abbreviation
+ (let* ((abbrev-char char)
+ (abbrev-addr
+ (* 2 (ez-mem-ref-word (+ ez-abbrevtab-addr
+ (* 2 (+ (* (- abbrev-char 1) 32) (pop chars))))))))
+ (setq s (concat s (cdr (ez-get-zstring-and-length abbrev-addr))))))
+ ((= char 4)
+ (setq cur (mod (+ cur 1) 3)))
+ ((= char 5)
+ (setq cur (mod (+ 3 (- cur 1)) 3)))
+ ((and (= cur 2) (= char 6))
+ (setq s (concat s (char-to-string (+ (lsh (pop chars) 5) (pop chars)))))
+ (setq cur lock))
+ (t
+ (setq s (concat s (substring (elt ez-zstring-alphabets cur)
+ char (+ char 1))))
+ (setq cur lock)))))
(cons word-count s)))
(defun ez-get-zstring (base-addr)
(cdr (ez-get-zstring-and-length base-addr)))
+;; Dictionary
+
+(defun ez-get-dictionary ()
+ (let* ((nseps (ez-mem-ref-byte ez-dict-base))
+ (separators
+ (mapcar (lambda (i) (ez-mem-ref-byte (+ ez-dict-base i)))
+ (number-sequence 1 nseps)))
+ (bytes-per-entry (ez-mem-ref-byte (+ ez-dict-base 1 nseps)))
+ (nentries (ez-mem-ref-word (+ ez-dict-base 1 nseps 1)))
+ (entries-base (+ ez-dict-base nseps 4))
+ (entries nil))
+ (dotimes (i nentries)
+ (let ((this-base (+ entries-base (* 7 i))))
+ (setq entries (cons (cons this-base
+ (ez-get-zstring this-base))
+ entries))))
+ (list entries separators entries)))
+
;; Call stack
(defvar ez-call-stack nil)