(vl-println? x &key (ps 'ps)) prints text with automatic encoding, and may also
inserts a newline if we have gone past the
(vl-println? x &key (ps 'ps)) → ps
This function is like vl-print, except that after
When writing pretty-printers, it is useful to call this function in places that would be acceptable line-break points, so that very long lines will be split up at reasonably good places.
Function:
(defun vl-println?-fn (x ps) (declare (xargs :stobjs (ps))) (declare (xargs :guard (vl-printable-p x))) (let ((__function__ 'vl-println?)) (declare (ignorable __function__)) (let* ((rchars (vl-ps->rchars)) (col (vl-ps->col)) (htmlp (vl-ps->htmlp)) (autowrap-col (vl-ps->autowrap-col)) (x (vl-printable-fix x)) (x (cond ((stringp x) x) ((atom x) (explode-atom x 10)) (t x)))) (if htmlp (b* ((tabsize (vl-ps->tabsize)) ((mv col rchars) (if (stringp x) (vl-html-encode-string-aux x 0 (length x) col tabsize rchars) (vl-html-encode-chars-aux x col tabsize rchars))) ((when (< col autowrap-col)) (vl-ps-seq (vl-ps-update-rchars rchars) (vl-ps-update-col col))) (indent (vl-ps->autowrap-ind)) (rchars (revappend *vl-html-newline* rchars)) (rchars (repeated-revappend indent *vl-html- * rchars))) (vl-ps-seq (vl-ps-update-rchars rchars) (vl-ps-update-col indent))) (b* ((col (if (stringp x) (vl-col-after-printing-string col x) (vl-col-after-printing-chars col x))) (rchars (if (stringp x) (cons x rchars) (revappend x rchars))) ((when (< col autowrap-col)) (vl-ps-seq (vl-ps-update-rchars rchars) (vl-ps-update-col col))) (indent (vl-ps->autowrap-ind)) (rchars (cons #\Newline rchars)) (rchars (make-list-ac indent #\Space rchars))) (vl-ps-seq (vl-ps-update-rchars rchars) (vl-ps-update-col indent)))))))
Theorem:
(defthm vl-println?-fn-of-vl-printable-fix-x (equal (vl-println?-fn (vl-printable-fix x) ps) (vl-println?-fn x ps)))
Theorem:
(defthm vl-println?-fn-vl-printable-equiv-congruence-on-x (implies (vl-printable-equiv x x-equiv) (equal (vl-println?-fn x ps) (vl-println?-fn x-equiv ps))) :rule-classes :congruence)