Read an entire file into a list of lines (strings).
Signature: (read-file-lines filename state) returns
On success,
On failure, e.g., perhaps
BOZO This currently just looks for individual newline characters,
i.e.,
Function:
(defun read-file-lines (filename state) "Returns (MV ERRMSG/LINES STATE)" (declare (xargs :guard (stringp filename) :stobjs state)) (b* ((filename (mbe :logic (if (stringp filename) filename "") :exec filename)) ((mv channel state) (open-input-channel filename :byte state)) ((unless channel) (mv (concatenate 'string "Error opening file " filename) state)) ((mv data state) (read-file-lines-aux nil nil channel state)) (state (close-input-channel channel state))) (mv (reverse data) state)))
Theorem:
(defthm state-p1-of-read-file-lines (implies (force (state-p1 state)) (state-p1 (mv-nth 1 (read-file-lines filename state)))))
Theorem:
(defthm string-listp-of-read-file-lines (equal (string-listp (mv-nth 0 (read-file-lines filename state))) (not (stringp (mv-nth 0 (read-file-lines filename state))))))