• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
      • Io
      • Defttag
      • Sys-call
      • Save-exec
      • Quicklisp
      • Oslib
      • Std/io
      • Bridge
      • Clex
      • Tshell
      • Unsound-eval
      • Hacker
      • ACL2s-interface
        • Itest?-query
        • ACL2s-event
        • ACL2s-query
        • Quiet-mode-hooks
          • ACL2s-interface-symbol-package-tips
          • ACL2s-compute
          • ACL2s-interface::ACL2s-interface-utils
          • Quiet-mode
          • Capture-output
        • Startup-banner
        • Command-line
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • ACL2s-interface

    Quiet-mode-hooks

    Hooks that fire when the ACL2s interface quiet mode is turned on or off.

    General form
    (add-quiet-mode-on-hook
      name  ; A (symbol) name to associate with this hook
      hook) ; A function to call when quiet mode transitions from disabled to enabled.
            ; The return value of the hook function should be a list of ACL2 forms to
            ; be executed.
    
    (add-quiet-mode-off-hook
      name  ; A (symbol) name to associate with this hook
      hook) ; A function to call when quiet mode transitions from enabled to disabled.
            ; The return value of the hook function should be a list of ACL2 forms to
            ; be executed.

    Some applications may have verbosity settings beyond the standard ACL2 ones. Quiet mode hooks provide a way to change these settings whenever the ACL2s interface transitions from quiet mode being enabled to disabled, and vice versa.

    Upon the appropriate transition, each hook function for that transition is called. The return values of all of the hook functions for that transition type are appended, and the resulting list of ACL2 forms is evaluated using ACL2::ld in an environment that disables all output. Typically, hooks will perform some stateful operation (for example, a quiet-mode-on hook might save the current value of a setting into a variable) and then produce a list of ACL2 forms that will change the setting to its original value (for a quiet-mode-off hook) or to a particular quiet value (for a quiet-mode-on hook). One should not call any of acl2s-compute, acl2s-query, or acl2s-event from inside of a hook.

    For each transition type, adding a hook with the same name as another hook for that same transition type will result in the previously added hook being removed from the list of hooks.

    Examples
    ;; Define a variable to store the last seen gag mode.
    ;; See books/acl2s/interface/acl2s-interface.lsp for the definition
    ;; of define-var, which is needed to work around SBCL and CCL quirks.
    (define-var *saved-gag-mode* (acl2::gag-mode))
    
    (add-quiet-mode-on-hook
      :gag-mode
      (lambda ()
        ;; Calling acl2::@ here is probably not super safe, but it seems to work...
        (setf *saved-gag-mode* (acl2::@ acl2::gag-mode))
        '((acl2::set-gag-mode t))))
    
    (add-quiet-mode-off-hook
      :gag-mode
      (lambda () `((acl2::set-gag-mode ,*saved-gag-mode*))))

    See books/acl2s/interface/acl2s-utils/additions.lsp for some example hooks.