other
(in-package "ACL2S-HOOKS")
other
(include-book "canonical-print")
other
(include-book "categorize-input")
other
(include-book "hacking/hacker" :dir :system)
other
(include-book "hacking/defcode" :dir :system :ttags ((defcode)))
other
(include-book "hacking/redefun" :dir :system)
other
(include-book "hacking/rewrite-code" :dir :system)
other
(include-book "super-history" :ttags ((:acl2s-super-history) (defcode)))
other
(include-book "hacking/raw" :dir :system)
other
(program)
other
(set-state-ok t)
acl2s-password-hashfunction
(defun acl2s-password-hash (password) (let ((n (+ 4984190985322139823307306678324857897 (acl2-count password)))) (mod (* n n) 1976322537236016347623339359149920390129)))
acl2s-passwordpfunction
(defun acl2s-passwordp (password state) (equal (acl2s-password-hash password) (@ acl2s-password)))
acl2s-protection-beginfunction
(defun acl2s-protection-begin (password state) (if (boundp-global 'acl2s-password state) (er soft 'set-acl2s-password "Password already assigned.") (er-progn (assign acl2s-password (acl2s-password-hash password)) (value :invisible))))
clear-acl2s-passwordfunction
(defun clear-acl2s-password (password state) (if (boundp-global 'acl2s-password state) (if (acl2s-passwordp password state) (pprogn (makunbound-global 'acl2s-password state) (value :invisible)) (er soft 'clear-acl2s-password "Bad password given.")) (value :invisible)))
other
(push-untouchable acl2s-password nil)
acl2s-protected-modepfunction
(defun acl2s-protected-modep (state) (boundp-global 'acl2s-password state))
user-revert-super-historyfunction
(defun user-revert-super-history (n password state) (cond ((not (acl2s-passwordp password state)) (er soft 'revert-super-history "Not authorized.")) (t (revert-super-history n state))))
other
(push-untouchable (update-super-history restore-current-super-history revert-super-history) t)
other
(defttag :acl2s-protection)
other
(progn+touchable :all (redefun+rewrite chk-acceptable-ld-fn1-pair (:carpat (and (symbolp %val%) (open-input-channel-p %val% :object state) . %cdr%) :vars (%val% %cdr%) :mult 2 :repl (and (symbolp %val%) (open-input-channel-p %val% :object state) (or (not (acl2s-protected-modep state)) (<= (@ ld-level) 2) (not (eq %val% *standard-oi*))) . %cdr%))) (redefun+rewrite ld-read-eval-print (:carpat (prog2$ (and (equal (standard-oi state) *standard-oi*) (good-bye)) state) :mult 1 :repl (if (equal (standard-oi state) *standard-oi*) (pprogn (makunbound-global 'acl2s-password state) (prog2$ (good-bye) state)) state))))
other
(defttag nil)