• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
      • B*
      • Defunc
      • Fty
        • Deftagsum
        • Defprod
        • Defflexsum
        • Defbitstruct
        • Deflist
        • Defalist
        • Defbyte
        • Deffixequiv
        • Defresult
          • Reserr
          • Reserr-option
          • Patbind-ok
          • Reserrf-push
            • Defresult-macro-definition
            • Reserrf
            • Patbind-okf
          • Deffixtype
          • Defoption
          • Fty-discipline
          • Fold
          • Fty-extensions
          • Defsubtype
          • Defset
          • Deftypes
          • Specific-types
          • Defflatsum
          • Deflist-of-len
          • Defbytelist
          • Defomap
          • Fty::basetypes
          • Defvisitors
          • Deffixtype-alias
          • Deffixequiv-sk
          • Defunit
          • Multicase
          • Deffixequiv-mutual
          • Fty::baselists
          • Def-enumcase
          • Defmap
        • Apt
        • Std/util
        • Defdata
        • Defrstobj
        • Seq
        • Match-tree
        • Defrstobj
        • With-supporters
        • Def-partial-measure
        • Template-subst
        • Soft
        • Defthm-domain
        • Event-macros
        • Def-universal-equiv
        • Def-saved-obligs
        • With-supporters-after
        • Definec
        • Sig
        • Outer-local
        • Data-structures
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Defresult

    Reserrf-push

    Push the current function onto the stack of an error result, optionally with additional information.

    This is useful when receiving an error result from a called function, to add the caller to the stack, and possibly more information, before propagating the error. This addition is handled automatically when using patbind-okf, actually using nil as extra information; when that binder cannot be used for some reason, or when additional information must be pushed, then this reserrf-push macro may come handy.

    This assumes that __function__ is bound to the current function name, which is automatically the case when using define.

    Macro: reserrf-push

    (defmacro reserrf-push (error &optional info)
     (cons
      'b*
      (cons
       (cons (cons 'stack
                   (cons (cons 'reserr->info (cons error 'nil))
                         'nil))
             'nil)
       (cons
        (cons
          'reserr
          (cons (cons 'cons
                      (cons (cons 'list
                                  (cons '__function__ (cons info 'nil)))
                            '(stack)))
                'nil))
        'nil))))