Search for a filename with any of a list of extensions.
(vl-find-basename/extension-aux filename extensions dir dirxcache warnings) → (mv realfile warnings)
Function:
(defun vl-find-basename/extension-aux (filename extensions dir dirxcache warnings) (declare (xargs :guard (and (stringp filename) (string-listp extensions) (stringp dir) (vl-dirxcache-p dirxcache) (vl-warninglist-p warnings)))) (let ((__function__ 'vl-find-basename/extension-aux)) (declare (ignorable __function__)) (b* ((filename (string-fix filename)) (dir (string-fix dir)) (dirxcache (vl-dirxcache-fix dirxcache)) (found-exts (cdr (hons-get filename dirxcache))) ((when (atom found-exts)) (mv nil (ok))) (winner (if (atom (cdr found-exts)) (first found-exts) (vl-find-highest-priority-extension extensions found-exts))) (realfile (vl-extend-pathname dir (cat filename "." winner))) (warnings (if (atom (cdr found-exts)) (ok) (warn :type :vl-ambiguous-load :msg "Loading ~x0 based on extension order, but ~ there are also other matching files in this ~ directory. Directory ~x0. Matching ~ extensions: ~&1." :args (list realfile found-exts))))) (mv realfile warnings))))
Theorem:
(defthm maybe-stringp-of-vl-find-basename/extension-aux.realfile (b* (((mv ?realfile ?warnings) (vl-find-basename/extension-aux filename extensions dir dirxcache warnings))) (maybe-stringp realfile)) :rule-classes :rewrite)
Theorem:
(defthm vl-warninglist-p-of-vl-find-basename/extension-aux.warnings (b* (((mv ?realfile ?warnings) (vl-find-basename/extension-aux filename extensions dir dirxcache warnings))) (vl-warninglist-p warnings)) :rule-classes :rewrite)
Theorem:
(defthm vl-find-basename/extension-aux-of-str-fix-filename (equal (vl-find-basename/extension-aux (str-fix filename) extensions dir dirxcache warnings) (vl-find-basename/extension-aux filename extensions dir dirxcache warnings)))
Theorem:
(defthm vl-find-basename/extension-aux-streqv-congruence-on-filename (implies (streqv filename filename-equiv) (equal (vl-find-basename/extension-aux filename extensions dir dirxcache warnings) (vl-find-basename/extension-aux filename-equiv extensions dir dirxcache warnings))) :rule-classes :congruence)
Theorem:
(defthm vl-find-basename/extension-aux-of-string-list-fix-extensions (equal (vl-find-basename/extension-aux filename (string-list-fix extensions) dir dirxcache warnings) (vl-find-basename/extension-aux filename extensions dir dirxcache warnings)))
Theorem:
(defthm vl-find-basename/extension-aux-string-list-equiv-congruence-on-extensions (implies (str::string-list-equiv extensions extensions-equiv) (equal (vl-find-basename/extension-aux filename extensions dir dirxcache warnings) (vl-find-basename/extension-aux filename extensions-equiv dir dirxcache warnings))) :rule-classes :congruence)
Theorem:
(defthm vl-find-basename/extension-aux-of-str-fix-dir (equal (vl-find-basename/extension-aux filename extensions (str-fix dir) dirxcache warnings) (vl-find-basename/extension-aux filename extensions dir dirxcache warnings)))
Theorem:
(defthm vl-find-basename/extension-aux-streqv-congruence-on-dir (implies (streqv dir dir-equiv) (equal (vl-find-basename/extension-aux filename extensions dir dirxcache warnings) (vl-find-basename/extension-aux filename extensions dir-equiv dirxcache warnings))) :rule-classes :congruence)
Theorem:
(defthm vl-find-basename/extension-aux-of-vl-dirxcache-fix-dirxcache (equal (vl-find-basename/extension-aux filename extensions dir (vl-dirxcache-fix dirxcache) warnings) (vl-find-basename/extension-aux filename extensions dir dirxcache warnings)))
Theorem:
(defthm vl-find-basename/extension-aux-vl-dirxcache-equiv-congruence-on-dirxcache (implies (vl-dirxcache-equiv dirxcache dirxcache-equiv) (equal (vl-find-basename/extension-aux filename extensions dir dirxcache warnings) (vl-find-basename/extension-aux filename extensions dir dirxcache-equiv warnings))) :rule-classes :congruence)
Theorem:
(defthm vl-find-basename/extension-aux-of-vl-warninglist-fix-warnings (equal (vl-find-basename/extension-aux filename extensions dir dirxcache (vl-warninglist-fix warnings)) (vl-find-basename/extension-aux filename extensions dir dirxcache warnings)))
Theorem:
(defthm vl-find-basename/extension-aux-vl-warninglist-equiv-congruence-on-warnings (implies (vl-warninglist-equiv warnings warnings-equiv) (equal (vl-find-basename/extension-aux filename extensions dir dirxcache warnings) (vl-find-basename/extension-aux filename extensions dir dirxcache warnings-equiv))) :rule-classes :congruence)