;;; -*- Mode:Lisp; IBase:10.; -*- Package created by KMP, 11/2/80 ;;; ;;; OCTAL: A package for doing shorthand octal input (PDP10 only) ;;; ;;; Sets up "&" as a readmacro to read shorthand octal numbers. (Note that a ;;; side-effect of this is that &-keywords must be written as /&optional, ;;; etc.) ;;; ;;; Style Suggestion: ;;; This package is not intended for production use (use in programs), since ;;; it ties down a valuable character, but it can be useful as an interactive ;;; debugging tool. It is strongly recommended that programs for release use ;;; the #o octal syntax already which is primitive to Maclisp. ;;; ;;; If a comma (or two) is read in the middle of the number, it divides the ;;; right and left half of the word being assembled. ;;; ;;; Examples: ;;; ;;; &77 = 000000,,000077 ;;; &-1,, = 777777,,000000 ;;; &-1,,1 = 777777,,000001 ;;; &0,,-1 = 000000,,777777 ;;; &,-1 = 000000,,777777 ;;; &37, = 000037,,000000 ;;; ;;; See also the BINPRT package for display of octal numbers. #-PDP10 (ERROR "This package not written to work except on a PDP10.") (DECLARE (FIXNUM (READ-OCTAL-AUX) (READ-OCTAL))) (HERALD OCTAL /3) (DEFUN READ-OCTAL-AUX () (DO ((I 0. (+ (LSH I 3) (- (TYI) #/0))) (S (IF (OR (= (TYIPEEK) #/+) (= (TYIPEEK) #/-)) (= (TYI) #/-)))) ((OR (< (TYIPEEK) #/0) (> (TYIPEEK) #/7)) (IF (NOT S) I (- I))) (DECLARE (FIXNUM I)))) (DEFUN READ-OCTAL () (LET ((TEMP (READ-OCTAL-AUX))) (DECLARE (FIXNUM TEMP)) (COND ((= (TYIPEEK) #/,) (TYI) (IF (= (TYIPEEK) #/,) (TYI)) (LOGIOR (LSH TEMP 18.) (LOGAND (READ-OCTAL-AUX) #o777777))) (T TEMP)))) (SSTATUS MACRO /& 'READ-OCTAL)