• 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
            • Compilation-database
            • Printer
            • Output-files
            • Abstract-syntax-operations
            • Implementation-environments
            • Abstract-syntax
            • Concrete-syntax
            • Disambiguation
            • Validation
            • Gcc-builtins
            • Preprocessing
              • Preprocessor
                • Pproc
                • Preprocessor-states
                • Preprocessor-printer
                • Pread-token/newline
                • Pread-token
                • Pproc-files
                • Preprocessor-lexer
                • Pproc-file
                • Pproc-group-part
                • Pproc-*-group-part
                • Pproc-directive
                • *pproc-files-max*
                • String-plexeme-list-alist-to-filepath-filedata-map
                • String-plexeme-list-alist
                • Read-input-file-to-preproc
                  • Preprocessor-reader
                  • Preprocessor-messages
                • External-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
    • Preprocessor

    Read-input-file-to-preproc

    Read a file to preprocess, explicitly specified as user input.

    Signature
    (read-input-file-to-preproc path file state) 
      → 
    (mv erp bytes state)
    Arguments
    path — Guard (stringp path).
    file — Guard (stringp file).
    Returns
    bytes — Type (byte-listp bytes).

    This is used for the files whose paths are explicitly passed to pproc-files. We concatenate the path prefix to the file path suffix, with a slash in between (this is for Unix-like systems). We read the bytes from the file system, and return them.

    Definitions and Theorems

    Function: read-input-file-to-preproc

    (defun read-input-file-to-preproc (path file state)
      (declare (xargs :stobjs (state)))
      (declare (xargs :guard (and (stringp path) (stringp file))))
      (b* (((reterr) nil state)
           (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))))
        (retok bytes state)))

    Theorem: byte-listp-of-read-input-file-to-preproc.bytes

    (defthm byte-listp-of-read-input-file-to-preproc.bytes
      (b* (((mv acl2::?erp ?bytes acl2::?state)
            (read-input-file-to-preproc path file state)))
        (byte-listp bytes))
      :rule-classes :rewrite)