• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
        • Error-checking
        • Fty-extensions
        • Isar
        • Kestrel-utilities
        • Set
        • C
          • Syntax-for-tools
            • Formalized-subset
            • Mapping-to-language-definition
            • Input-files
              • Input-files-implementation
                • Input-files-process-inputs
                • Input-files-gen-events
                • Input-files-process-preprocess-args
                • Input-files-process-inputs-and-gen-events
                • Input-files-complete-preprocess-extra-args
                • Input-files-process-ienv
                • Input-files-fn
                • Input-files-read-files
                  • Input-files-process-const
                  • String-stringlist-map-map-cons-values
                  • Input-files-process-path
                  • Input-files-process-files
                  • Input-files-process-process
                  • Input-files-preprocess-arg-std
                  • Input-files-process-preprocess
                  • Input-files-process-keep-going
                  • Input-files-process-inputp
                  • Input-files-preprocess-inputp
                  • *input-files-allowed-options*
                  • Input-files-definition
                • Input-files-prog
              • Compilation-database
              • Printer
              • Output-files
              • Abstract-syntax-operations
              • Implementation-environments
              • Abstract-syntax
              • Concrete-syntax
              • Disambiguation
              • Validation
              • Gcc-builtins
              • Preprocessing
              • Parsing
            • Atc
            • Transformation-tools
            • Language
            • Representation
            • Insertion-sort
            • Pack
          • Soft
          • Bv
          • Imp-language
          • Ethereum
          • Event-macros
          • Java
          • Riscv
          • Bitcoin
          • Zcash
          • Yul
          • ACL2-programming-language
          • Prime-fields
          • Json
          • Syntheto
          • File-io-light
          • Cryptography
          • Number-theory
          • Axe
          • Lists-light
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Input-files-implementation

    Input-files-read-files

    Read a file set from a given set of paths.

    Signature
    (input-files-read-files files path state) 
      → 
    (mv erp fileset state)
    Arguments
    files — Guard (string-listp files).
    path — Guard (stringp path).
    Returns
    fileset — Type (filesetp fileset).

    We go through each file, we prepend the path, and we attempt to read the file at each resulting path, constructing the file set along the way. Recall that path never ends with / (unless it is just /), because input processing removes the ending slash.

    Definitions and Theorems

    Function: input-files-read-files

    (defun input-files-read-files (files path state)
      (declare (xargs :stobjs (state)))
      (declare (xargs :guard (and (string-listp files)
                                  (stringp path))))
      (let ((__function__ 'input-files-read-files))
        (declare (ignorable __function__))
        (b* (((reterr) (irr-fileset) state)
             ((when (endp files))
              (retok (fileset nil) state))
             (file (car files))
             (path-to-read (str::cat path "/" file))
             ((mv erp bytes state)
              (acl2::read-file-into-byte-list path-to-read state))
             ((when erp)
              (reterr (msg "Reading ~x0 failed." path-to-read)))
             (data (filedata bytes))
             ((erp fileset state)
              (input-files-read-files (cdr files)
                                      path state)))
          (retok (fileset (omap::update (filepath file)
                                        data (fileset->unwrap fileset)))
                 state))))

    Theorem: filesetp-of-input-files-read-files.fileset

    (defthm filesetp-of-input-files-read-files.fileset
      (b* (((mv acl2::?erp ?fileset acl2::?state)
            (input-files-read-files files path state)))
        (filesetp fileset))
      :rule-classes :rewrite)