• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Community
    • Proof-automation
    • ACL2
    • Macro-libraries
    • 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-find-basename/extension
          • Vl-find-file
            • Vl-find-file-aux
              • Vl-extend-pathname
            • 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-find-file

    Vl-find-file-aux

    Look for a file in a list of search directories.

    Definitions and Theorems

    Function: vl-find-file-aux

    (defun vl-find-file-aux (filename searchpath state)
      (declare (xargs :guard (and (stringp filename)
                                  (string-listp searchpath)
                                  (state-p state))))
      (b* (((when (atom searchpath))
            (mv nil state))
           (attempt (vl-extend-pathname (car searchpath)
                                        filename))
           ((mv channel state)
            (open-input-channel attempt
                                :character state))
           ((unless channel)
            (vl-find-file-aux filename (cdr searchpath)
                              state))
           (state (close-input-channel channel state)))
        (mv attempt state)))

    Theorem: state-p1-of-vl-find-file-aux

    (defthm state-p1-of-vl-find-file-aux
     (implies
      (force (state-p1 state))
      (state-p1 (mv-nth 1
                        (vl-find-file-aux filename searchpath state)))))

    Theorem: stringp-of-vl-find-file-aux

    (defthm stringp-of-vl-find-file-aux
     (equal
         (stringp (mv-nth 0
                          (vl-find-file-aux filename searchpath state)))
         (if (mv-nth 0
                     (vl-find-file-aux filename searchpath state))
             t
           nil)))