Generate a term representing the final computation state after the execution of a C function.
(atc-gen-cfun-final-compustate affect typed-formals subst compst-var prec-objs) → term
The correctness theorem of a C function says that
executing the function on a generic computation state
(satisfying conditions in the hypotheses of the theorem)
and on generic arguments
yields an optional result (absent if the function is
The parameter
Note that, in the correctness theorem,
the new array and structure variables are bound to
the possibly modified arrays and structures returned by the ACL2 function:
these new array and structure variables are obtained by adding
Function:
(defun atc-gen-cfun-final-compustate (affect typed-formals subst compst-var prec-objs) (declare (xargs :guard (and (symbol-listp affect) (atc-symbol-varinfo-alistp typed-formals) (symbol-symbol-alistp subst) (symbolp compst-var) (atc-string-objinfo-alistp prec-objs)))) (let ((__function__ 'atc-gen-cfun-final-compustate)) (declare (ignorable __function__)) (b* (((when (endp affect)) compst-var) (formal (car affect)) (info (cdr (assoc-eq formal typed-formals))) ((when (not info)) (raise "Internal error: formal ~x0 not found." formal)) (type (atc-var-info->type info)) ((unless (or (type-case type :pointer) (type-case type :array) (atc-var-info->externalp info))) (raise "Internal error: affected formal ~x0 has type ~x1 and is not an external object." formal type))) (if (consp (assoc-equal (symbol-name formal) prec-objs)) (cons 'write-static-var (cons (cons 'ident (cons (symbol-name formal) 'nil)) (cons (add-suffix-to-fn formal "-NEW") (cons (atc-gen-cfun-final-compustate (cdr affect) typed-formals subst compst-var prec-objs) 'nil)))) (cons 'write-object (cons (cons 'value-pointer->designator (cons (cdr (assoc-eq formal subst)) 'nil)) (cons (add-suffix-to-fn formal "-NEW") (cons (atc-gen-cfun-final-compustate (cdr affect) typed-formals subst compst-var prec-objs) 'nil))))))))