Write the printed characters to a file and clear out the
This is similar to vl-print-to-file except that it also
clears out the characters in
Function:
(defun vl-print-to-file-and-clear-fn (filename ps state) (declare (xargs :stobjs (ps state))) (declare (xargs :guard (stringp filename))) (let ((__function__ 'vl-print-to-file-and-clear)) (declare (ignorable __function__)) (b* ((filename (string-fix filename)) ((mv channel state) (open-output-channel! filename :character state)) ((unless channel) (raise "Error opening file ~s0 for writing." filename) (mv ps state)) (rchars (vl-ps->rchars)) (ps (vl-ps-update-rchars nil)) (ps (vl-ps-update-col 0)) (state (princ$ (str::printtree->str rchars) channel state)) (state (close-output-channel channel state))) (mv ps state))))
Theorem:
(defthm state-p1-of-vl-print-to-file-and-clear.state (implies (force (state-p1 state)) (b* (((mv ?ps acl2::?state) (vl-print-to-file-and-clear-fn filename ps state))) (state-p1 state))) :rule-classes :rewrite)
Theorem:
(defthm vl-print-to-file-and-clear-fn-of-str-fix-filename (equal (vl-print-to-file-and-clear-fn (str-fix filename) ps state) (vl-print-to-file-and-clear-fn filename ps state)))
Theorem:
(defthm vl-print-to-file-and-clear-fn-streqv-congruence-on-filename (implies (streqv filename filename-equiv) (equal (vl-print-to-file-and-clear-fn filename ps state) (vl-print-to-file-and-clear-fn filename-equiv ps state))) :rule-classes :congruence)