Generate the class for an ACL2 package.
(atj-gen-shallow-pkg-class pkg fields-by-pkg methods-by-pkg pkg-class-names verbose$) → class
In the shallow embedding approach, we generate a Java class for each ACL2 package. This is a public static Java class, nested into the main Java class that ATJ generates.
The fields are in the
The methods are in the
We apply to the class body elements of the class the part of the post-translation that operates at that level. The part of the post-translation that operates at the level of methods is applied in atj-gen-shallow-fndef-method.
Function:
(defun atj-gen-shallow-pkg-class (pkg fields-by-pkg methods-by-pkg pkg-class-names verbose$) (declare (xargs :guard (and (stringp pkg) (string-jfieldlist-alistp fields-by-pkg) (string-jmethodlist-alistp methods-by-pkg) (string-string-alistp pkg-class-names) (booleanp verbose$)))) (let ((__function__ 'atj-gen-shallow-pkg-class)) (declare (ignorable __function__)) (b* ((class-name (atj-get-pkg-class-name pkg pkg-class-names)) ((run-when verbose$) (cw " ~s0 for ~s1~%" class-name pkg)) (fields (cdr (assoc-equal pkg fields-by-pkg))) (methods (cdr (assoc-equal pkg methods-by-pkg))) (body-elems (append (jmethods-to-jcbody-elements methods) (jfields-to-jcbody-elements fields))) (body-elems (atj-post-translate-jcbody-elements body-elems))) (make-jclass :access (jaccess-public) :abstract? nil :static? t :final? nil :strictfp? nil :name class-name :superclass? nil :superinterfaces nil :body body-elems))))
Theorem:
(defthm jclassp-of-atj-gen-shallow-pkg-class (b* ((class (atj-gen-shallow-pkg-class pkg fields-by-pkg methods-by-pkg pkg-class-names verbose$))) (jclassp class)) :rule-classes :rewrite)