Join together a temp directory, the user name, the PID, and the base name to create a temporary filename.
(default-tempfile-aux tempdir basename state) → (mv tempfile new-state)
Function:
(defun default-tempfile-aux (tempdir basename state) (declare (xargs :stobjs (state))) (declare (xargs :guard (and (stringp tempdir) (stringp basename)))) (let ((__function__ 'default-tempfile-aux)) (declare (ignorable __function__)) (b* (((mv pid state) (getpid state)) ((unless (natp pid)) (er hard? __function__ "getpid failed") (mv nil state)) ((mv ?err user state) (getenv$ "USER" state)) ((unless (stringp user)) (er hard? __function__ "reading $USER failed") (mv nil state)) (filename (cat user "-" (str::nat-to-dec-string pid) "-" basename)) (path (catpath tempdir filename))) (mv path state))))
Theorem:
(defthm return-type-of-default-tempfile-aux.tempfile (b* (((mv ?tempfile ?new-state) (default-tempfile-aux tempdir basename state))) (or (stringp tempfile) (not tempfile))) :rule-classes :type-prescription)
Theorem:
(defthm state-p1-of-default-tempfile-aux.new-state (implies (force (state-p1 state)) (b* (((mv ?tempfile ?new-state) (default-tempfile-aux tempdir basename state))) (state-p1 new-state))) :rule-classes :rewrite)
Theorem:
(defthm w-state-of-default-tempfile-aux (b* (((mv ?tempfile ?new-state) (default-tempfile-aux tempdir basename state))) (equal (w new-state) (w state))))