• 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
              • Output-files-implementation
                • Output-files-process-inputs
                • Output-files-process-const/arg
                • Output-files-process-printer-options
                • Output-files-gen-files
                  • Output-files-fn
                  • Output-files-process-path
                  • Output-files-process-inputs-and-gen-files
                  • *output-files-printer-options*
                  • *output-files-allowed-options*
                  • Output-files-definition
                • Output-files-prog
              • 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
    • Output-files-implementation

    Output-files-gen-files

    Generate the files.

    Signature
    (output-files-gen-files code path 
                            indent-size paren-nested-conds state) 
     
      → 
    (mv erp state)
    Arguments
    code — Guard (code-ensemblep code).
    path — Guard (stringp path).
    indent-size — Guard (posp indent-size).
    paren-nested-conds — Guard (booleanp paren-nested-conds).

    Definitions and Theorems

    Function: output-files-gen-files-loop

    (defun output-files-gen-files-loop (map path state)
     (declare (xargs :stobjs (state)))
     (declare (xargs :guard (and (filepath-filedata-mapp map)
                                 (stringp path))))
     (let ((__function__ 'output-files-gen-files-loop))
      (declare (ignorable __function__))
      (b*
       (((reterr) state)
        ((when (omap::emptyp map))
         (retok state))
        ((mv filepath data) (omap::head map))
        (file-string (filepath->unwrap filepath))
        ((unless (stringp file-string))
         (reterr
          (msg
           "File path must contain a string, ~
                             but it contains ~x0 instead."
           file-string)))
        (path-to-write (str::cat path "/" file-string))
        ((mv erp state)
         (acl2::write-bytes-to-file! (filedata->unwrap data)
                                     path-to-write 'output-files
                                     state))
        ((when erp)
         (reterr (msg "Writing ~x0 failed." path-to-write))))
       (output-files-gen-files-loop (omap::tail map)
                                    path state))))

    Function: output-files-gen-files

    (defun output-files-gen-files
           (code path
                 indent-size paren-nested-conds state)
     (declare (xargs :stobjs (state)))
     (declare (xargs :guard (and (code-ensemblep code)
                                 (stringp path)
                                 (posp indent-size)
                                 (booleanp paren-nested-conds))))
     (declare (xargs :guard (and (code-ensemble-unambp code)
                                 (code-ensemble-aidentp code))))
     (let ((__function__ 'output-files-gen-files))
       (declare (ignorable __function__))
       (b*
         (((reterr) state)
          (options (make-priopt :indent-size indent-size
                                :paren-nested-conds paren-nested-conds))
          (tunits (code-ensemble->transunits code))
          (files (print-fileset tunits options
                                (ienv->gcc (code-ensemble->ienv code))))
          ((erp state)
           (output-files-gen-files-loop (fileset->unwrap files)
                                        path state)))
         (retok state))))