• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
      • Sv
      • Fgl
      • Vwsim
      • Vl
        • Syntax
        • Loader
          • Preprocessor
          • Vl-loadconfig
          • Vl-loadstate
          • Lexer
          • Parser
          • Vl-load-merge-descriptions
          • Vl-find-basename/extension
          • Vl-load-file
          • Vl-loadresult
          • Scope-of-defines
          • Vl-find-file
          • Vl-flush-out-descriptions
          • Vl-description
          • Vl-read-file
            • Vl-read-file-loop
            • Vl-read-file-loop-aux
              • Vl-read-file-hook
            • Vl-includeskips-report-gather
            • Vl-load-main
            • Extended-characters
            • Vl-load
            • Vl-load-description
            • Vl-descriptions-left-to-load
            • Inject-warnings
            • Vl-preprocess-debug
            • Vl-write-preprocessor-debug-file
            • Vl-read-file-report-gather
            • Vl-load-descriptions
            • Vl-load-files
            • Translate-off
            • Vl-load-read-file-hook
            • Vl-read-file-report
            • Vl-loadstate-pad
            • Vl-load-summary
            • Vl-collect-modules-from-descriptions
            • Vl-loadstate->warnings
            • Vl-iskips-report
            • Vl-descriptionlist
          • Warnings
          • Getting-started
          • Utilities
          • Printer
          • Kit
          • Mlib
          • Transforms
        • 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 len nrev &key (state 'state)) 
     
      → 
    (mv nrev len 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).
    len — Current byte number.
        Guard (natp len).
    Returns
    nrev — Characters from the file in reverse order.
    len — Type (natp len).

    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 len acc)
             (b* (((mv data & state)
                   (vl-read-file-loop channel filename line col)))
               (mv (append acc data)
                   (+ (lnfix len) (len data))
                   state))))

    Definitions and Theorems

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

    (defun vl-read-file-loop-aux-fn
           (channel filename line col len nrev state)
     (declare (xargs :stobjs (nrev state)))
     (declare (type string filename)
              (type (integer 1 *) line)
              (type (integer 0 *) col)
              (type (integer 0 *) len))
     (declare
          (xargs :guard (and (stringp filename)
                             (posp line)
                             (natp col)
                             (natp len)
                             (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))
            (len (lnfix len))
            ((unless (mbt (state-p state)))
             (mv nrev len state))
            ((mv byte state)
             (read-byte$ channel state))
            ((unless byte) (mv nrev len 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))))
            (next-len (the (integer 0 *) (+ 1 len)))
            (nrev (nrev-push echar nrev)))
         (vl-read-file-loop-aux channel filename
                                next-line next-col next-len nrev))))

    Theorem: natp-of-vl-read-file-loop-aux.len

    (defthm natp-of-vl-read-file-loop-aux.len
     (b* (((mv acl2::?nrev acl2::?len acl2::?state)
           (vl-read-file-loop-aux-fn channel
                                     filename line col len nrev state)))
       (natp len))
     :rule-classes :type-prescription)