• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Community
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
        • Warnings
        • Primitives
        • Use-set
        • Syntax
        • Getting-started
        • Utilities
        • Loader
          • Preprocessor
          • Vl-loadconfig
          • Lexer
          • Vl-loadstate
          • Parser
          • Vl-load-merge-descriptions
          • Scope-of-defines
          • Vl-load-file
          • Vl-flush-out-descriptions
          • Vl-description
          • Vl-loadresult
          • Vl-read-file
            • Vl-read-file-loop
            • Vl-read-file-loop-aux
              • Vl-read-file-rchars
            • Vl-find-basename/extension
            • Vl-find-file
            • Vl-read-files
            • Extended-characters
            • Vl-load
            • Vl-load-main
            • Vl-load-description
            • Vl-descriptions-left-to-load
            • Inject-warnings
            • Vl-load-descriptions
            • Vl-load-files
            • Vl-load-summary
            • Vl-collect-modules-from-descriptions
            • Vl-descriptionlist
          • Transforms
          • Lint
          • Mlib
          • Server
          • Kit
          • Printer
          • Esim-vl
          • Well-formedness
        • Sv
        • Fgl
        • Vwsim
        • Vl
        • X86isa
        • Svl
        • Rtl
      • Software-verification
      • Math
      • Testing-utilities
    • Vl-read-file

    Vl-read-file-loop-aux

    Tail-recursive, executable loop for vl-read-file.

    Signature
    (vl-read-file-loop-aux channel filename 
                           line col nrev &key (state 'state)) 
     
      → 
    (mv nrev state)
    Arguments
    channel — Guard (and (symbolp channel) (open-input-channel-p channel :byte state)).
    filename — Current file name.
        Guard (stringp filename).
    line — Current line number.
        Guard (posp line).
    col — Current column number.
        Guard (natp col).
    Returns
    nrev — Characters from the file in reverse order.

    You should never need to reason about this function directly, because it is typically rewritten into vl-read-file-loop using the following rule:

    Theorem: vl-read-file-loop-aux-redef

    (defthm vl-read-file-loop-aux-redef
      (equal (vl-read-file-loop-aux channel filename line col acc)
             (b* (((mv data state)
                   (vl-read-file-loop channel filename line col)))
               (mv (append acc data) state))))

    Definitions and Theorems

    Function: vl-read-file-loop-aux-fn

    (defun vl-read-file-loop-aux-fn
           (channel filename line col nrev state)
     (declare (xargs :stobjs (nrev state)))
     (declare (type string filename)
              (type (integer 1 *) line)
              (type (integer 0 *) col))
     (declare
          (xargs :guard (and (stringp filename)
                             (posp line)
                             (natp col)
                             (and (symbolp channel)
                                  (open-input-channel-p channel
                                                        :byte state)))))
     (declare (xargs :split-types t))
     (let ((__function__ 'vl-read-file-loop-aux))
       (declare (ignorable __function__))
       (b* ((nrev (nrev-fix nrev))
            ((unless (mbt (state-p state)))
             (mv nrev state))
            ((mv byte state)
             (read-byte$ channel state))
            ((unless byte) (mv nrev state))
            ((the character char)
             (code-char (the (unsigned-byte 8) byte)))
            (echar (make-vl-echar-fast :char char
                                       :filename filename
                                       :line line
                                       :col col))
            (newlinep (eql char #\Newline))
            (next-line (if newlinep (the (integer 0 *) (+ 1 line))
                         line))
            (next-col (if newlinep 0
                        (the (integer 0 *) (+ 1 col))))
            (nrev (nrev-push echar nrev)))
         (vl-read-file-loop-aux channel
                                filename next-line next-col nrev))))