Core loop for printing format strings.
Function:
(defun vl-basic-fmt-aux-fn (x n xl alist ps) (declare (xargs :stobjs (ps))) (declare (xargs :guard (and (stringp x) (natp n) (alistp alist) (eql xl (length x))))) (declare (xargs :guard (<= n xl))) (let ((__function__ 'vl-basic-fmt-aux)) (declare (ignorable __function__)) (b* (((when (mbe :logic (zp (- (nfix xl) (nfix n))) :exec (eql xl n))) ps) ((mv type val n) (vl-basic-fmt-parse-tilde x n xl)) (ps (case type (:skip ps) (:normal (vl-fmt-print-normal val)) (:hard-space (vl-print #\Space)) (:cbreak (if (zp (vl-ps->col)) ps (vl-println ""))) (otherwise (b* ((lookup (assoc val alist)) ((unless lookup) (prog2$ (raise "alist does not bind ~x0; fmt-string is ~x1." val x) ps))) (case type (#\s (vl-fmt-tilde-s (cdr lookup))) (#\& (vl-fmt-tilde-& (cdr lookup))) (#\x (vl-fmt-tilde-x (cdr lookup))) (otherwise (prog2$ (raise "Unsupported directive: ~~~x0.~%" type) ps)))))))) (vl-basic-fmt-aux x n xl alist))))
Theorem:
(defthm vl-basic-fmt-aux-fn-of-str-fix-x (equal (vl-basic-fmt-aux-fn (str-fix x) n xl alist ps) (vl-basic-fmt-aux-fn x n xl alist ps)))
Theorem:
(defthm vl-basic-fmt-aux-fn-streqv-congruence-on-x (implies (streqv x x-equiv) (equal (vl-basic-fmt-aux-fn x n xl alist ps) (vl-basic-fmt-aux-fn x-equiv n xl alist ps))) :rule-classes :congruence)
Theorem:
(defthm vl-basic-fmt-aux-fn-of-nfix-n (equal (vl-basic-fmt-aux-fn x (nfix n) xl alist ps) (vl-basic-fmt-aux-fn x n xl alist ps)))
Theorem:
(defthm vl-basic-fmt-aux-fn-nat-equiv-congruence-on-n (implies (acl2::nat-equiv n n-equiv) (equal (vl-basic-fmt-aux-fn x n xl alist ps) (vl-basic-fmt-aux-fn x n-equiv xl alist ps))) :rule-classes :congruence)