• 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
        • Soft
        • Bv
        • Imp-language
        • Ethereum
        • Event-macros
        • Java
        • Riscv
        • Bitcoin
        • Zcash
        • Yul
        • ACL2-programming-language
        • Prime-fields
        • Json
        • Syntheto
        • File-io-light
          • Read-file-into-byte-array-stobj
          • Read-file-into-character-array-stobj
          • Read-objects-from-book
          • Write-strings-to-file!
          • Write-strings-to-file
          • Write-objects-to-file!
            • Write-bytes-to-file!
            • Write-objects-to-file
            • Read-objects-from-file
            • Read-object-from-file
            • Read-file-into-byte-list
            • Write-strings-to-channel
            • Write-bytes-to-file
            • Write-bytes-to-channel
            • Read-file-into-character-list
          • Cryptography
          • Number-theory
          • Axe
          • Lists-light
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Io
    • File-io-light

    Write-objects-to-file!

    Write a list of ACL2 objects to a file, when ttags are needed to write.

    ;; Writes the OBJECTS to FILENAME, each on a separate line, overwriting the
    ;; previous contents of FILENAME.  Returns (mv erp state).  The ttag is needed
    ;; because this calls open-output-channel!, but that makes this version usable
    ;; during make-event expansion, clause-processors, etc.
    (defund write-objects-to-file! (objects filename ctx state)
      (declare (xargs :stobjs state
                      :guard (and (true-listp objects)
                                  (stringp filename))))
      (mv-let (channel state)
        (open-output-channel! filename :object state)
        (if (not channel)
            (prog2$ (er hard? ctx "Unable to open file ~s0 for :object output." filename)
                    (mv t state))
          (pprogn (write-objects-to-channel objects channel state)
                  (close-output-channel channel state)
                  (mv nil state)))))