Preprocess a file set [C:5.1.1.2/4].
(preprocess fileset) → tunit
This is a very simplified model of C preprocessing [C:6.10].
If there is no header, this is essentially a no-op:
the external declarations are unwrapped from the source file
and re-wrapped into a translation unit.
If there is a header, as explained in fileset,
it is implicitly included in the source file
(without an explicit representation of the
Function:
(defun preprocess (fileset) (declare (xargs :guard (filesetp fileset))) (let ((__function__ 'preprocess)) (declare (ignorable __function__)) (b* ((h-extdecls (and (fileset->dot-h fileset) (file->declons (fileset->dot-h fileset)))) (c-extdecls (file->declons (fileset->dot-c fileset)))) (make-transunit :declons (append h-extdecls c-extdecls)))))
Theorem:
(defthm transunit-resultp-of-preprocess (b* ((tunit (preprocess fileset))) (transunit-resultp tunit)) :rule-classes :rewrite)
Theorem:
(defthm preprocess-of-fileset-fix-fileset (equal (preprocess (fileset-fix fileset)) (preprocess fileset)))
Theorem:
(defthm preprocess-fileset-equiv-congruence-on-fileset (implies (fileset-equiv fileset fileset-equiv) (equal (preprocess fileset) (preprocess fileset-equiv))) :rule-classes :congruence)