Turn an ACL2 package name into a Java class name.
In the shallow embedding approach, a Java class is generated for each ACL2 package that includes ACL2 functions that we generate Java code for; each ACL2 function is turned into a Java method in that Java class.
The name of the Java class for the ACL2 package
is obtained by turning the ACL2 package name
into a valid Java identifier,
using atj-chars-to-jchars-id,
but without flipping uppercase and lowercase.
The resulting Java class name
must not be in *atj-disallowed-class-names*.
Since the Java class is contained in the main class generated by ATJ,
we also ensure that the name is distinct from the containing class,
whose name is passed to this function.
We also ensure that the Java class name is distinct from
all the mv class names:
we do so by checking that the class name does not start with
Function:
(defun atj-pkg-to-class (pkg java-class$) (declare (xargs :guard (and (stringp pkg) (stringp java-class$)))) (let ((__function__ 'atj-pkg-to-class)) (declare (ignorable __function__)) (b* ((jchars (atj-chars-to-jchars-id (explode pkg) t :dash nil)) (jstring (implode jchars)) (jstring (if (or (member-equal jstring *atj-disallowed-class-names*) (equal jstring java-class$) (and (>= (length jstring) 3) (eql (char jstring 0) #\M) (eql (char jstring 1) #\V) (eql (char jstring 2) #\_))) (str::cat jstring "$") jstring))) jstring)))
Theorem:
(defthm stringp-of-atj-pkg-to-class (b* ((class (atj-pkg-to-class pkg java-class$))) (stringp class)) :rule-classes :rewrite)