Process the
(atc-process-file-name options output-dir state) → (mv erp file-name path-wo-ext state)
If successful, return, besides the file name itself as a string,
the full path of the file(s),
without the
We make sure that, after adding each of the
Due to the use of the file utilities, we also need to return state.
Function:
(defun atc-process-file-name (options output-dir state) (declare (xargs :stobjs (state))) (declare (xargs :guard (and (symbol-alistp options) (stringp output-dir)))) (let ((__function__ 'atc-process-file-name)) (declare (ignorable __function__)) (b* (((reterr) "" "" state) (file-name-option (assoc-eq :file-name options)) ((unless (consp file-name-option)) (reterr (msg "The :FILE-NAME input must be present, ~ but it is absent instead."))) (file-name (cdr file-name-option)) ((unless (stringp file-name)) (reterr (msg "The :FILE-NAME input must be a string, ~ but ~x0 is not a string." file-name))) ((when (equal file-name "")) (reterr (msg "The :FILE-NAME input must not be the empty string."))) ((unless (str::letter/digit/uscore/dash-charlist-p (acl2::explode file-name))) (reterr (msg "The :FILE-NAME input must consists of only ~ ASCII letters, digits, underscores, and dashes, ~ but ~s0 violates this condition." file-name))) (path-wo-ext (oslib::catpath output-dir file-name)) (path.c (str::cat path-wo-ext ".c")) ((mv msg? existsp state) (oslib::path-exists-p path.c)) ((when msg?) (reterr (msg "The existence of the file path ~x0 ~ cannot be tested. ~ ~@1" path.c msg?))) ((when (not existsp)) (retok file-name path-wo-ext state)) ((mv msg? kind state) (oslib::file-kind path.c)) ((when msg?) (reterr (msg "The kind of the file path ~x0 ~ cannot be tested. ~ ~@1" path.c msg?))) ((unless (eq kind :regular-file)) (reterr (msg "The file path ~x0 ~ is not a regular file; it has kind ~x1 instead." path.c kind)))) (retok file-name path-wo-ext state))))
Theorem:
(defthm stringp-of-atc-process-file-name.file-name (b* (((mv acl2::?erp ?file-name ?path-wo-ext acl2::?state) (atc-process-file-name options output-dir state))) (stringp file-name)) :rule-classes :rewrite)
Theorem:
(defthm stringp-of-atc-process-file-name.path-wo-ext (b* (((mv acl2::?erp ?file-name ?path-wo-ext acl2::?state) (atc-process-file-name options output-dir state))) (stringp path-wo-ext)) :rule-classes :rewrite)