Determine where to load a file from, given its (absolute or relative) name and a list of directories to search.
(vl-find-file filename searchcache state) → (mv realpath state)
Function:
(defun vl-find-file (filename searchcache state) (declare (xargs :stobjs (state))) (declare (xargs :guard (and (stringp filename) (vl-dirlist-cache-p searchcache)))) (let ((__function__ 'vl-find-file)) (declare (ignorable __function__)) (b* ((filename (string-fix filename)) ((when (acl2::absolute-pathname-string-p filename nil (acl2::os (w state)))) (mv filename state)) ((when (or (str::substrp "/" filename) (str::substrp "\\" filename))) (vl-slow-find-file-aux filename searchcache state))) (mv (vl-cache-find-file-aux filename searchcache) state))))
Theorem:
(defthm maybe-stringp-of-vl-find-file.realpath (b* (((mv ?realpath acl2::?state) (vl-find-file filename searchcache state))) (maybe-stringp realpath)) :rule-classes :type-prescription)
Theorem:
(defthm state-p1-of-vl-find-file.state (implies (force (state-p1 state)) (b* (((mv ?realpath acl2::?state) (vl-find-file filename searchcache state))) (state-p1 state))) :rule-classes :rewrite)
Theorem:
(defthm vl-find-file-of-str-fix-filename (equal (vl-find-file (str-fix filename) searchcache state) (vl-find-file filename searchcache state)))
Theorem:
(defthm vl-find-file-streqv-congruence-on-filename (implies (streqv filename filename-equiv) (equal (vl-find-file filename searchcache state) (vl-find-file filename-equiv searchcache state))) :rule-classes :congruence)
Theorem:
(defthm vl-find-file-of-vl-dirlist-cache-fix-searchcache (equal (vl-find-file filename (vl-dirlist-cache-fix searchcache) state) (vl-find-file filename searchcache state)))
Theorem:
(defthm vl-find-file-vl-dirlist-cache-equiv-congruence-on-searchcache (implies (vl-dirlist-cache-equiv searchcache searchcache-equiv) (equal (vl-find-file filename searchcache state) (vl-find-file filename searchcache-equiv state))) :rule-classes :congruence)