(read-object-all channel state) reads all remaining objects from a file.
This is the main loop inside read-file-objects. It reads everything in the file, but doesn't handle opening or closing the file.
Function:
(defun tr-read-object-all (channel state acc) (declare (xargs :guard (and (state-p state) (symbolp channel) (open-input-channel-p channel :object state)))) (b* (((unless (mbt (state-p state))) (mv acc state)) ((mv eofp obj state) (read-object channel state)) ((when eofp) (mv acc state))) (tr-read-object-all channel state (cons obj acc))))
Function:
(defun read-object-all (channel state) (declare (xargs :guard (and (state-p state) (symbolp channel) (open-input-channel-p channel :object state)))) (mbe :logic (b* (((unless (state-p state)) (mv nil state)) ((mv eofp obj state) (read-object channel state)) ((when eofp) (mv nil state)) ((mv rest state) (read-object-all channel state))) (mv (cons obj rest) state)) :exec (b* (((mv acc state) (tr-read-object-all channel state nil))) (mv (reverse acc) state))))
Theorem:
(defthm tr-read-object-all-removal (equal (tr-read-object-all channel state nil) (mv (rev (mv-nth 0 (read-object-all channel state))) (mv-nth 1 (read-object-all channel state)))))
Theorem:
(defthm true-listp-of-read-object-all (true-listp (mv-nth 0 (read-object-all channel state))) :rule-classes :type-prescription)
Theorem:
(defthm state-p1-of-read-object-all (implies (and (force (state-p1 state)) (force (symbolp channel)) (force (open-input-channel-p1 channel :object state))) (state-p1 (mv-nth 1 (read-object-all channel state)))))
Theorem:
(defthm open-input-channel-p1-of-read-object-all (implies (and (force (state-p1 state)) (force (symbolp channel)) (force (open-input-channel-p1 channel :object state))) (open-input-channel-p1 channel :object (mv-nth 1 (read-object-all channel state)))))