• 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-rchars

    Optimized alternative to vl-read-file that reads the entire file into nrev.

    Signature
    (vl-read-file-rchars filename nrev &key (state 'state)) 
      → 
    (mv okp nrev state)
    Arguments
    filename — The file to read.
        Guard (stringp filename).

    We implement this mainly for vl-read-files.

    Definitions and Theorems

    Function: vl-read-file-rchars-fn

    (defun vl-read-file-rchars-fn (filename nrev state)
      (declare (xargs :stobjs (nrev state)))
      (declare (xargs :guard (stringp filename)))
      (let ((__function__ 'vl-read-file-rchars))
        (declare (ignorable __function__))
        (mbe :logic
             (non-exec (b* (((mv okp data state)
                             (vl-read-file filename)))
                         (mv okp (append nrev data) state)))
             :exec
             (b* (((mv channel state)
                   (open-input-channel filename
                                       :byte state))
                  ((unless channel) (mv nil nrev state))
                  ((mv nrev state)
                   (vl-read-file-loop-aux channel filename 1 0 nrev))
                  (state (close-input-channel channel state)))
               (mv t nrev state)))))