You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by ge...@apache.org on 2005/10/08 06:29:29 UTC

svn commit: r307257 [6/24] - in /incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm: ./ bootJVM/ bootJVM/jni/ bootJVM/jni/src/ bootJVM/jni/src/gnu/ bootJVM/jni/src/gnu/classpath/ bootJVM/jni/src/gnu/classpath/0.16/ bootJVM/jni/src/gnu/classpath/...

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/include/jlObject.h
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/include/jlObject.h?rev=307257&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/include/jlObject.h (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/include/jlObject.h Fri Oct  7 21:27:56 2005
@@ -0,0 +1,376 @@
+#ifndef _jlObject_h_included_
+#define _jlObject_h_included_
+
+/*!
+ * @file jlObject.h
+ *
+ * @brief Public interface to native implementation of
+ * @c @b java.lang.Object
+ *
+ * Two parallel sets of definitions are used here, one for internal
+ * implementation purposes, the other for the JNI interface.  The first
+ * uses internal data types (via @link #JLOBJECT_LOCAL_DEFINED
+   \#ifdef JLOBJECT_LOCAL_DEFINED@endlink) where the second does not.
+ * Instead, it uses @c @b \<jni.h\> data types.  Those types @e must
+ * match up for JNI to work, yet by keeping them
+ * absolutely separate, application JNI code does @e not have
+ * @b any dependencies on the core code of this JVM implementation.
+ *
+ * Even though there is only apparently @e one set of definitions,
+ * the @c @b \#ifdef statement controls which set is used.
+ *
+ * This file must be included by JNI code along with the
+ * @c @b java.lang.Class JNI header file.  The following example
+ * shows how to call one of the @e local native methods of this class
+ * from the JNI environment.  Notice that although this is not necessary
+ * due to the local implementation shortcut defined in
+ * @link jvm/src/native.c native.c@endlink, it is not only possible,
+ * but sometimes quite desirable to do so.
+ *
+ * @verbatim
+   #include <jni.h>
+   #include <solaris/jni_md.h>   ... or appropriate platform-specifics
+   #include "java_lang_Object.h" ... JNI definitions
+   #include "jlObject.h"         ... this file
+  
+   JNIEXPORT jint JNICALL
+       Java_java_lang_Object_hashCode(JNIEnv  *env, jobject thisobj)
+   {
+       jint i;
+
+       i = jlClass_hashCode(thisobj); ... call native implementation
+
+       return(i);
+   }
+   @endverbatim
+ *
+ * @attention This local native method implementation is defined
+ *            in @link jvm/src/native.c native.c@endlink and
+ *            does @e not make use of the @b JNIENV pointer in
+ *            @e any manner.
+ *
+ * @attention Although @link #jvalue jvalue@endlink is indeed a part
+ *            of both this implementation and the standard JNI interface
+ *            through @c @b \<jni.h\> , it is @e not recommended to use
+ *            it if at all possible.  Due to the fact that both
+ *            definitions involve unions, along with the slightly
+ *            differing contents between the two versions, it is almost
+ *            certain that there will be compilation compatibility
+ *            problems in the memory layouts from one platform to
+ *            another, and possibly between the layouts between them on
+ *            any given platform.  Since @link #jvalue jvalue@endlink
+ *            is not specificaly a @e Java type, but instead a JNI
+ *            construction, this may not be a problem, but this
+ *            advisory is raised anyway in order to encourage reliable
+ *            implementation of JNI.
+ *
+ * @section Control
+ *
+ * \$URL: https://svn.apache.org/path/name/jlObject.h $ \$Id: jlObject.h 0 09/28/2005 dlydick $
+ *
+ * Copyright 2005 The Apache Software Foundation
+ * or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 ("the License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied.
+ *
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * @version \$LastChangedRevision: 0 $
+ *
+ * @date \$LastChangedDate: 09/28/2005 $
+ *
+ * @author \$LastChangedBy: dlydick $
+ *         Original code contributed by Daniel Lydick on 09/28/2005.
+ *
+ * @section Reference
+ *
+ */
+
+
+/**********************************************************************/
+#ifdef JLOBJECT_LOCAL_DEFINED
+
+ARCH_COPYRIGHT_APACHE(jlObject, h, "$URL: https://svn.apache.org/path/name/jlObject.h $ $Id: jlObject.h 0 09/28/2005 dlydick $");
+
+/**********************************************************************/
+#else /* JLOBJECT_LOCAL_DEFINED */
+
+/*!
+ * @name Reserved native local method ordinal numbers
+ *
+ * @brief These ordinal values are reserved for use by the
+ * local native method interface as implemented in
+ * @link jvm/src/native.c native.c@endlink
+ *
+ */
+/*@{*/
+/*!
+ * @brief Empty table index for code internals.
+ *
+ * See also parallel definition in
+ * @link #JVMCFG_JLOBJECT_NMO_NULL jvmcfg.h@endlink
+ */
+#define JLOBJECT_NMO_NULL 0
+ 
+
+/*!
+ * @brief Reserved table index for JNI method registration.
+ *
+ * See also parallel definition in
+ * @link #JVMCFG_JLOBJECT_NMO_REGISTER jvmcfg.h@endlink
+ */
+#define JLOBJECT_NMO_REGISTER 1
+
+
+/*!
+ * @brief Reserved table index for JNI method <em>de</em>-registration.
+ *
+ * See also parallel definition in
+ * @link #JVMCFG_JLOBJECT_NMO_UNREGISTER jvmcfg.h@endlink
+ */
+#define JLOBJECT_NMO_UNREGISTER 2
+
+/*}@*/
+
+/*!
+ * @name JNI parallel type definitions.
+ *
+ * @brief Implementation type definitions, but redefined from
+ * @c @b \<jni.h\> so no implementation header files are needed by
+ * JNI source code.
+ *
+ * See also respective parallel definition for each one as found 
+ * particularly in @link jvm/src/jvmcfg.h jvmcfg.h@endlink
+ *
+ */
+
+/*@{*/
+
+/*!
+ * @brief Implementation type definition for @c @b jobject
+ *
+ * This symbol is defined for use in the core JVM code in
+ * @link jvm/src/jvmcfg.h jvmcfg.h@endlink. 
+ *
+ * @attention  See comments about @c @b jobject and @c @b jclass in
+ *             the local definition of @b jvm_class_index.
+ *
+ * @todo In the JVM spec, an object reference seems to look like an
+ *       arbitrary integer token.  However, looking at the JNI header
+ *       file for the Solaris JDK 1.4.2_06 implementation, it appears
+ *       to be a pointer to an empty structure.  The apparent purpose
+ *       of this definition is to have a @e completely generic
+ *       definition of use by any implementation.  @b HOWEVER, there
+ *       is a problem with this:  What happens when the implementation
+ *       is ported to a 64-bit hardware runtime environment?  All
+ *       pointers change from 32 bits (namely, from
+ *       @c @b sizeof(jint)) to 64 bits (namely,
+ *       @c @b sizeof(jlong)), taking a second 32-bit word.
+ *       This can have @e significant implications for code, and not
+ *       only for the JNI interface.  This needs some detailed scrutiny
+ *       so that the JNI interface and the implementation as a whole
+ *       properly compensates for this situtation or declares it a
+ *       non-issue.
+ *
+ * @note As an aside, and in addition to the above @todo item, the
+ *       consider that many GC implementations use a variation
+ *       of "copying garbage collection" (sometimes with adjectives
+ *       in front, such as "generational copying garbage collection,"
+ *       etc.).  These tend to be more efficient than the old
+ *       mark-and-sweep, even though they usually add an extra
+ *       layer of indirection.  For example, every pointer might
+ *       actually be an index into a table of pointers or perhaps
+ *       a pointer to a pointer.  The idea is that the GC algorithm
+ *       can relocate/copy the object, knowing it needs to update
+ *       only one pointer and all current accesses to the object
+ *       at its old location will now be able to access it at its new
+ *       location without missing a beat.  In this case, the 32-bit
+ *       unsigned int might be an index into a table of pointers and
+ *       the pointers might be 64-bits or 32-bits or anything else.
+ *
+ */
+typedef jobject jvm_object_hash;
+
+/*!
+ * @brief Implementation type definition for @c @b jclass
+ *
+ * This symbol is defined for use in the core JVM code in
+ * @link jvm/src/jvmcfg.h jvmcfg.h@endlink. 
+ *
+ * @attention As long as this type definition is the same width or
+ * narrower than the local definition of @b jvm_object_hash,  all
+ * code will connect the JNI and JVM environments properly.  Some
+ * Java implementations may consider @c @b jobject to be an ordinal,
+ * some may consider it to be an array index, some may consider it
+ * to be a pointer.  If @c @b jclass is compatible with such definition,
+ * then everything should work fine.  The compiler will provide the
+ * necessary width adjustments without loss of any significant digits.
+ * @e Therefore, notice that this data type @e cannot be defined as
+ * being any @e wider than @c @b jobject and @b jvm_object_hash.
+ */
+typedef jclass  jvm_class_index;
+
+/*!
+ * @brief Definition of Java @c @b void as used in
+ * this implementation.
+ *
+ * This type definition is @e not typically part
+ * of @c @b \<jni.h\> but used extensively here.
+ *
+ * This symbol is defined for use in the core JVM code in
+ * @link jvm/src/jrtypes.h jrtypes.h@endlink. 
+ */
+typedef void jvoid;
+
+/*@}*/
+
+#endif /* JLOBJECT_LOCAL_DEFINED */
+/**********************************************************************/
+
+/*!
+ * @name Unified set of prototypes for functions
+ * in @link jvm/src/jlObject.c jlObject.c@endlink
+ *
+ * @brief JNI table index and external reference to
+ * each function that locally implements a JNI native method.
+ *
+ * The JVM native interface ordinal definition base for this class
+ * is 10.  An enumeration is used so the compiler can help the use
+ * to not choose duplicate values.
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+typedef enum
+{
+
+    JLOBJECT_NMO_GETCLASS = 10, /**< Ordinal for
+                        @link #jlObject_getClass() getClass()@endlink */
+
+    JLOBJECT_NMO_HASHCODE = 11, /**< Ordinal for
+                        @link #jlObject_hashCode() hashCode()@endlink */
+
+    JLOBJECT_NMO_WAIT4EVER = 12, /**< Ordinal for
+                      @link #jlObject_wait4ever() wait4ever()@endlink */
+
+    JLOBJECT_NMO_WAITTIMED = 13  /**< Ordinal for
+                      @link #jlObject_waittimed() waittimed()@endlink */
+
+} jlObject_nmo_enum;
+
+/*
+ * Add one function prototype below
+ * for each local native method enumeration above:
+ */
+
+/*!
+ * @brief JNI hook to @link #jlObject_getClass() getClass()@endlink
+ */
+jvm_object_hash jlObject_getClass(jvm_object_hash objhash);
+
+/*!
+ * @brief JNI hook to @link #jlObject_hashCode() hashCode()@endlink
+ */
+jint jlObject_hashCode(jvm_object_hash objhash);
+
+/*!
+ * @brief JNI hook to @link #jlObject_wait4ever() wait4ever()@endlink
+ */
+extern jvoid jlObject_wait4ever(jvm_object_hash objhashcurr);
+
+/*!
+ * @brief JNI hook to @link #jlObject_waittimed() waittimed()@endlink
+ */
+extern jvoid jlObject_waittimed(jvm_object_hash objhashcurr,
+                                jlong           sleeptime);
+
+/*@} */ /* End grouped definitions */
+
+
+/*!
+ * @name Connection to local native method tables.
+ *
+ * @brief These manifest constant code fragments are designed to be
+ * inserted directly into locations in
+ * @link jvm/src/native.c native.c@endlink without any other
+ * modification to that file except a @e single entry to actually
+ * invoke the method.
+ *
+ */
+/*@{ */ /* Begin grouped definitions */
+
+
+/*!
+ * @brief Complete list of local native method ordinals
+ * for @c @b java.lang.Object
+ */
+#define NATIVE_TABLE_JLOBJECT     \
+    case JLOBJECT_NMO_GETCLASS:   \
+    case JLOBJECT_NMO_HASHCODE:   \
+    case JLOBJECT_NMO_WAIT4EVER:  \
+    case JLOBJECT_NMO_WAITTIMED:
+
+/*!
+ * @brief Table of local native methods and their descriptors
+ * for @c @b java.lang.Object
+ */
+#define NATIVE_TABLE_JLOBJECT_ORDINALS                                \
+    {                                                                 \
+        { JLOBJECT_NMO_GETCLASS, "getClass", "()Ljava/lang/Class"  }, \
+        { JLOBJECT_NMO_HASHCODE, "hashCode", "()I"  },                \
+        { JLOBJECT_NMO_WAIT4EVER, "wait",    "()V"  },                \
+        { JLOBJECT_NMO_WAIT4EVER, "wait",    "(J)V" },                \
+                                                                      \
+        /* Add other method entries here */                           \
+                                                                      \
+                                                                      \
+        /* End of table marker */                                     \
+        { JVMCFG_JLOBJECT_NMO_NULL,                                   \
+          CHEAT_AND_USE_NULL_TO_INITIALIZE,                           \
+          CHEAT_AND_USE_NULL_TO_INITIALIZE }                          \
+    }
+
+/*!
+ * @brief @c @b (jvoid) local native method ordinal table
+ * for @c @b java.lang.Object
+ */
+#define NATIVE_TABLE_JLOBJECT_JVOID     \
+    case JLOBJECT_NMO_WAIT4EVER:        \
+    case JLOBJECT_NMO_WAITTIMED:
+
+/*!
+ * @brief @c @b (jobject) local native method ordinal table
+ * for @c @b java.lang.Object
+ */
+#define NATIVE_TABLE_JLOBJECT_JOBJECT \
+    case JLOBJECT_NMO_GETCLASS:
+
+/*!
+ * @brief @c @b (jint) local native method ordinal table
+ * for @c @b java.lang.Object
+ */
+#define NATIVE_TABLE_JLOBJECT_JINT \
+    case JLOBJECT_NMO_HASHCODE:
+
+#define NATIVE_TABLE_JLOBJECT_JFLOAT  /**< No @c @b (jfloat) methods */
+#define NATIVE_TABLE_JLOBJECT_JLONG   /**< No @c @b (jlong) methods */
+#define NATIVE_TABLE_JLOBJECT_JDOUBLE /**< No @c @b (jdouble) methods*/
+
+/*@} */ /* End grouped definitions */
+
+
+#endif /* _jlObject_h_included_ */
+
+
+/* EOF */

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/include/jlString.h
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/include/jlString.h?rev=307257&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/include/jlString.h (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/include/jlString.h Fri Oct  7 21:27:56 2005
@@ -0,0 +1,209 @@
+#ifndef _jlString_h_included_
+#define _jlString_h_included_
+
+/*!
+ * @file jlString.h
+ *
+ * @brief Public interface to native implementation of
+ * @c @b java.lang.String
+ *
+ * Two parallel sets of definitions are used here, one for internal
+ * implementation purposes, the other for the JNI interface.  The first
+ * uses internal data types (via @link #JLSTRING_LOCAL_DEFINED
+   \#ifdef JLSTRING_LOCAL_DEFINED@endlink) where the second does not.
+ * Instead, it uses @c @b \<jni.h\> data types.  Those types @e must
+ * match up for JNI to work, yet by keeping them
+ * absolutely separate, application JNI code does @e not have
+ * @b any dependencies on the core code of this JVM implementation.
+ *
+ * Even though there is only apparently @e one set of definitions,
+ * the @c @b \#ifdef statement controls which set is used.
+ *
+ * This file must be included by JNI code along with the
+ * @c @b java.lang.Class JNI header file.  The following example
+ * shows how to call one of the @e local native methods of this class
+ * from the JNI environment.  Notice that although this is not necessary
+ * due to the local implementation shortcut defined in
+ * @link jvm/src/native.c native.c@endlink, it is not only possible,
+ * but sometimes quite desirable to do so.
+ *
+ * @verbatim
+   #include <jni.h>
+   #include <solaris/jni_md.h>    ... or appropriate platform-specifics
+  
+   #include "java_lang_String.h"  ... JNI definitions
+   #include "jlString.h"          ... this file
+  
+   JNIEXPORT jstring JNICALL
+       Java_java_lang_String_intern(JNIEnv  *env, jobject  thisobj)
+   {
+       jstring s;
+
+        s = jlString_intern(thisobj); ... call native implementation
+
+        return(s);
+   }
+   @endverbatim
+ *
+ * @attention This local native method implementation is defined
+ *            in @link jvm/src/native.c native.c@endlink and
+ *            does @e not make use of the @b JNIENV pointer in
+ *            @e any manner.
+ *
+ * @attention Although @link #jvalue jvalue@endlink is indeed a part
+ *            of both this implementation and the standard JNI interface
+ *            through @c @b \<jni.h\> , it is @e not recommended to use
+ *            it if at all possible.  Due to the fact that both
+ *            definitions involve unions, along with the slightly
+ *            differing contents between the two versions, it is almost
+ *            certain that there will be compilation compatibility
+ *            problems in the memory layouts from one platform to
+ *            another, and possibly between the layouts between them on
+ *            any given platform.  Since @link #jvalue jvalue@endlink
+ *            is not specificaly a @e Java type, but instead a JNI
+ *            construction, this may not be a problem, but this
+ *            advisory is raised anyway in order to encourage reliable
+ *            implementation of JNI.
+ *
+ *
+ * @section Control
+ *
+ * \$URL: https://svn.apache.org/path/name/jlString.h $ \$Id: jlString.h 0 09/28/2005 dlydick $
+ *
+ * Copyright 2005 The Apache Software Foundation
+ * or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 ("the License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied.
+ *
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * @version \$LastChangedRevision: 0 $
+ *
+ * @date \$LastChangedDate: 09/28/2005 $
+ *
+ * @author \$LastChangedBy: dlydick $
+ *         Original code contributed by Daniel Lydick on 09/28/2005.
+ *
+ * @section Reference
+ *
+ */
+
+/**********************************************************************/
+#ifdef JLSTRING_LOCAL_DEFINED
+
+ARCH_COPYRIGHT_APACHE(jlString, h, "$URL: https://svn.apache.org/path/name/jlString.h $ $Id: jlString.h 0 09/28/2005 dlydick $");
+
+/**********************************************************************/
+#else /* JLSTRING_LOCAL_DEFINED */
+
+#include "jlObject.h"
+
+/* There is currently nothing else needed here */
+
+#endif /* JLSTRING_LOCAL_DEFINED */
+/**********************************************************************/
+
+/*!
+ * @name Unified set of prototypes for functions
+ * in @link jvm/src/jlString.c jlString.c@endlink
+ *
+ * @brief JNI table index and external reference to
+ * each function that locally implements a JNI native method.
+ *
+ * The JVM native interface ordinal definition base for this class
+ * is 30.  An enumeration is used so the compiler can help the use
+ * to not choose duplicate values.
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+typedef enum
+{
+
+    JLSTRING_NMO_INTERN = 30  /**< Ordinal for
+                            @link #jlString_intern() intern()@endlink */
+
+} jlString_nmo_enum;
+
+/*
+ * Add one function prototype below
+ * for each local native method enumeration above:
+ */
+
+/*!
+ * @brief JNI hook to @link #jlString_intern() intern()@endlink
+ */
+extern jvm_object_hash jlString_intern(jvm_object_hash objhash);
+
+/*@} */ /* End grouped definitions */
+
+
+/**********************************************************************/
+
+/*!
+ * @name Connection to local native method tables.
+ *
+ * @brief These manifest constant code fragments are designed to be
+ * inserted directly into locations in
+ * @link jvm/src/native.c native.c@endlink without any other
+ * modification to that file except a @e single entry to actually
+ * invoke the method.
+ *
+ */
+/*@{*/
+
+/*!
+ * @brief Complete list of local native method ordinals
+ * for @c @b java.lang.String
+ */
+#define NATIVE_TABLE_JLSTRING \
+    case JLSTRING_NMO_INTERN:
+
+/*!
+ * @brief Table of local native methods and their descriptors
+ * for @c @b java.lang.String
+ */
+#define NATIVE_TABLE_JLSTRING_ORDINALS                                 \
+    {                                                                  \
+        { JLSTRING_NMO_INTERN,     "intern",  "()Ljava/lang/String" }, \
+                                                                       \
+        /* Add other method entries here */                            \
+                                                                       \
+                                                                       \
+        /* End of table marker */                                      \
+        { JVMCFG_JLOBJECT_NMO_NULL,                                    \
+         CHEAT_AND_USE_NULL_TO_INITIALIZE,                             \
+         CHEAT_AND_USE_NULL_TO_INITIALIZE }                            \
+    }
+
+#define NATIVE_TABLE_JLSTRING_JVOID   /**< No @c @b (jvoid) methods */
+
+/*!
+ * @brief @c @b (jobject) local native method ordinal table
+ * for @c @b java.lang.String
+ */
+#define NATIVE_TABLE_JLSTRING_JOBJECT \
+    case JLSTRING_NMO_INTERN:
+
+#define NATIVE_TABLE_JLSTRING_JINT    /**< No @c @b (jint) methods */
+#define NATIVE_TABLE_JLSTRING_JFLOAT  /**< No @c @b (jfloat) methods */
+#define NATIVE_TABLE_JLSTRING_JLONG   /**< No @c @b (jlong) methods */
+#define NATIVE_TABLE_JLSTRING_JDOUBLE /**< No @c @b (jdouble) methods*/
+
+/*@}*/
+
+#endif /* _jlString_h_included_ */
+
+
+/* EOF */

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/include/jlThread.h
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/include/jlThread.h?rev=307257&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/include/jlThread.h (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/include/jlThread.h Fri Oct  7 21:27:56 2005
@@ -0,0 +1,483 @@
+#ifndef _jlThread_h_included_
+#define _jlThread_h_included_
+
+/*!
+ * @file jlThread.h
+ *
+ * @brief Public interface to native implementation of
+ * @c @b java.lang.Thread
+ *
+ * Two parallel sets of definitions are used here, one for internal
+ * implementation purposes, the other for the JNI interface.  The first
+ * uses internal data types (via @link #JLTHREAD_LOCAL_DEFINED
+   \#ifdef JLTHREAD_LOCAL_DEFINED@endlink) where the second does not.
+ * Instead, it uses @c @b \<jni.h\> data types.  Those types @e must
+ * match up for JNI to work, yet by keeping them
+ * absolutely separate, application JNI code does @e not have
+ * @b any dependencies on the core code of this JVM implementation.
+ *
+ * Even though there is only apparently @e one set of definitions,
+ * the @c @b \#ifdef statement controls which set is used.
+ *
+ * This file must be included by JNI code along with the
+ * @c @b java.lang.Class JNI header file.  The following example
+ * shows how to call one of the @e local native methods of this class
+ * from the JNI environment.  Notice that although this is not necessary
+ * due to the local implementation shortcut defined in
+ * @link jvm/src/native.c native.c@endlink, it is not only possible,
+ * but sometimes quite desirable to do so.
+ *
+ * @verbatim
+   #include <jni.h>
+   #include <solaris/jni_md.h>    ... or appropriate platform-specifics
+  
+   #include "java_lang_Thread.h"  ... JNI definitions
+   #include "jlThread.h"          ... this file
+  
+   JNIEXPORT jboolean JNICALL
+       Java_java_lang_Thread_holdsLock(JNIEnv *env,
+                                       jclass  thisclass,
+                                       jobject thisobj)
+   {
+       jboolean b;
+
+       b = jlThread_holdsLock(thisclass,
+                              thisobj); ... call native implementation
+
+       return(b);
+   }
+   @endverbatim
+ *
+ * @attention This local native method implementation is defined
+ *            in @link jvm/src/native.c native.c@endlink and
+ *            does @e not make use of the @b JNIENV pointer in
+ *            @e any manner.
+ *
+ * @attention Although @link #jvalue jvalue@endlink is indeed a part
+ *            of both this implementation and the standard JNI interface
+ *            through @c @b \<jni.h\> , it is @e not recommended to use
+ *            it if at all possible.  Due to the fact that both
+ *            definitions involve unions, along with the slightly
+ *            differing contents between the two versions, it is almost
+ *            certain that there will be compilation compatibility
+ *            problems in the memory layouts from one platform to
+ *            another, and possibly between the layouts between them on
+ *            any given platform.  Since @link #jvalue jvalue@endlink
+ *            is not specificaly a @e Java type, but instead a JNI
+ *            construction, this may not be a problem, but this
+ *            advisory is raised anyway in order to encourage reliable
+ *            implementation of JNI.
+ *
+ *
+ * @section Control
+ *
+ * \$URL: https://svn.apache.org/path/name/jlThread.h $ \$Id: jlThread.h 0 09/28/2005 dlydick $
+ *
+ * Copyright 2005 The Apache Software Foundation
+ * or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 ("the License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied.
+ *
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * @version \$LastChangedRevision: 0 $
+ *
+ * @date \$LastChangedDate: 09/28/2005 $
+ *
+ * @author \$LastChangedBy: dlydick $
+ *         Original code contributed by Daniel Lydick on 09/28/2005.
+ *
+ * @section Reference
+ *
+ */
+
+/**********************************************************************/
+#ifdef JLTHREAD_LOCAL_DEFINED
+
+ARCH_COPYRIGHT_APACHE(jlThread, h, "$URL: https://svn.apache.org/path/name/jlThread.h $ $Id: jlThread.h 0 09/28/2005 dlydick $");
+
+/**********************************************************************/
+#else /* JLTHREAD_LOCAL_DEFINED */
+
+#include "jlObject.h"
+
+/* There is currently nothing else needed here */
+
+#endif /* JLTHREAD_LOCAL_DEFINED */
+/**********************************************************************/
+
+/*!
+ * @name Unified set of prototypes for functions
+ * in @link jvm/src/jlThread.c jlThread.c@endlink
+ *
+ * @brief JNI table index and external reference to
+ * each function that locally implements a JNI native method.
+ *
+ * The JVM native interface ordinal definition base for this class
+ * is 40.  An enumeration is used so the compiler can help the use
+ * to not choose duplicate values.
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+typedef enum
+{
+
+    JLTHREAD_NMO_CURRENTTHREAD = 40, /**< Ordinal for
+                      @link #jlThread_currentThread() yield()@endlink */
+
+    JLTHREAD_NMO_YIELD = 41,        /**< Ordinal for
+                              @link #jlThread_yield() yield()@endlink */
+
+    JLTHREAD_NMO_INTERRUPT = 42,    /**< Ordinal for
+                       @link #jlThread_interrupt() interrupt()@endlink*/
+
+    JLTHREAD_NMO_INTERRUPTED = 43,  /**< Ordinal for
+                  @link #jlThread_interrupted() interrupted()@endlink */
+
+    JLTHREAD_NMO_ISINTERRUPTED = 44, /**< Ordinal for
+              @link #jlThread_isInterrupted() isInterrupted()@endlink */
+
+    JLTHREAD_NMO_SLEEP = 45,        /**< Ordinal for
+                              @link #jlThread_sleep() sleep()@endlink */
+
+    JLTHREAD_NMO_SLEEP_NANOS = 46,  /**< Ordinal for
+                  @link #jlThread_sleep_nanos() sleep_nanos()@endlink */
+
+    JLTHREAD_NMO_JOIN4EVER = 47,    /**< Ordinal for
+                       @link #jlThread_join4ever() join4ever()@endlink*/
+
+    JLTHREAD_NMO_JOINTIMED = 48,    /**< Ordinal for
+                       @link #jlThread_jointimed() jointimed()@endlink*/
+
+    JLTHREAD_NMO_JOINTIMED_NANOS = 49, /**< Ordinal for
+          @link #jlThread_jointimed_nanos() jointimed_nanos()@endlink */
+
+    JLTHREAD_NMO_ISALIVE = 50,        /**< Ordinal for
+                       @link #jlThread_isAlive() isAlive()@endlink */
+
+    JLTHREAD_NMO_START = 51,          /**< Ordinal for
+                           @link #jlThread_start() holdsLock()@endlink*/
+
+    JLTHREAD_NMO_COUNTSTACKFRAMES = 52, /**< Ordinal for
+        @link #jlThread_countStackFrames() countStackFrames()@endlink */
+
+    JLTHREAD_NMO_HOLDSLOCK = 53,      /**< Ordinal for
+                       @link #jlThread_holdsLock() holdsLock()@endlink*/
+
+    JLTHREAD_NMO_SETPRIORITY = 54,    /**< Ordinal for
+                  @link #jlThread_setPriority() setPriority()@endlink */
+
+    JLTHREAD_NMO_GETPRIORITY = 55,    /**< Ordinal for
+                  @link #jlThread_getPriority() getPriority()@endlink */
+
+    JLTHREAD_NMO_DESTROY = 56,        /**< Ordinal for
+                          @link #jlThread_destroy() destroy()@endlink */
+
+    JLTHREAD_NMO_CHECKACCESS = 57,    /**< Ordinal for
+                  @link #jlThread_checkAccess() checkAccess()@endlink */
+
+    JLTHREAD_NMO_SETDAEMON = 58,      /**< Ordinal for
+                      @link #jlThread_setDaemon() setDaemon()@endlink */
+
+    JLTHREAD_NMO_ISDAEMON = 59,       /**< Ordinal for
+                        @link #jlThread_isDaemon() isDaemon()@endlink */
+
+    JLTHREAD_NMO_STOP = 60,           /**< Ordinal for
+                                @link #jlThread_stop() stop()@endlink */
+
+    JLTHREAD_NMO_SUSPEND = 61,        /**< Ordinal for
+                             @link #jlThread_suspend() stop()@endlink */
+
+    JLTHREAD_NMO_RESUME = 62,         /**< Ordinal for
+                             @link #jlThread_resume() stop()@endlink */
+
+} jlThread_nmo_enum;
+
+/*
+ * Add one function prototype below
+ * for each local native method enumeration above:
+ */
+
+/*!
+ * @brief JNI hook to @link #jlThread_currentThread()
+   currentThread()@endlink
+ */
+extern
+    jvm_object_hash jlThread_currentThread(jvm_class_index clsidxTHR);
+
+/*!
+ * @brief JNI hook to @link #jlThread_yield() yield()@endlink
+ */
+extern jvoid jlThread_yield(jvm_class_index clsidxTHR);
+
+/*!
+ * @brief JNI hook to @link #jlThread_interrupt() interrupt()@endlink
+ */
+extern jvoid jlThread_interrupt(jvm_object_hash objhashthis);
+
+/*!
+ *@brief JNI hook to @link #jlThread_interrupted() interrupted()@endlink
+ */
+extern jboolean jlThread_interrupted(jvm_object_hash objhashTHR);
+
+/*!
+ * @brief JNI hook to
+ * @link #jlThread_isInterrupted() isInterrupted()@endlink
+ */
+extern jboolean jlThread_isInterrupted(jvm_object_hash objhashthis);
+
+/*!
+ * @brief JNI hook to @link #jlThread_sleep() sleep()@endlink
+ */
+extern jboolean jlThread_sleep(jvm_class_index clsidxTHR,
+                               jlong           sleeptime_milliseconds);
+
+/*!
+ * @brief JNI hook to
+ * @link #jlThread_sleep_nanos() sleep_nanos()@endlink
+ */
+extern jboolean jlThread_sleep_nanos(jvm_class_index clsidxTHR,
+                                     jlong       sleeptime_milliseconds,
+                                     jint        sleeptime_nanoseconds);
+
+/*!
+ * @brief JNI hook to @link #jlThread_join4ever() join4ever()@endlink
+ */
+extern jvoid jlThread_join4ever(jvm_object_hash objhashthis);
+
+/*!
+ * @brief JNI hook to @link #jlThread_jointimed() jointimed()@endlink
+ */
+extern jvoid jlThread_jointimed(jvm_object_hash objhashthis,
+                                jlong           sleeptime);
+
+/*!
+ * @brief JNI hook to
+ * @link #jlThread_jointimed_nanos() jointimed_nanos()@endlink
+ */
+extern jvoid jlThread_jointimed_nanos(jvm_object_hash objhashthis,
+                                      jlong           sleeptime,
+                                      jint          sleeptime_nanos);
+
+/*!
+ * @brief JNI hook to @link #jlThread_jointimed() jointimed()@endlink
+ */
+extern jboolean jlThread_isAlive(jvm_object_hash objhashthis);
+
+/*!
+ * @brief JNI hook to @link #jlThread_start() start()@endlink
+ */
+extern jboolean jlThread_start(jvm_object_hash objhashthis);
+
+/*!
+ * @brief JNI hook to
+ * @link #jlThread_countStackFrames() countStackFrames()@endlink
+ */
+extern jint jlThread_countStackFrames(jvm_object_hash objhashthis);
+
+/*!
+ * @brief JNI hook to @link #jlThread_holdsLock() holdsLock()@endlink
+ */
+extern jboolean jlThread_holdsLock(jvm_class_index clsidxTHR,
+                                   jvm_object_hash objhashLOCK);
+
+/*!
+ * @brief JNI hook to
+ * @link #jlThread_setPriority() setPriority()@endlink
+ */
+extern jboolean jlThread_setPriority(jvm_object_hash objhashthis,
+                                     jint             priority);
+
+/*!
+ * @brief JNI hook to
+ * @link #jlThread_getPriority() getPriority()@endlink
+ */
+extern jint jlThread_getPriority(jvm_object_hash objhashthis);
+
+/*!
+ * @brief JNI hook to @link #jlThread_destroy() destroy()@endlink
+ */
+extern jboolean jlThread_destroy(jvm_object_hash objhashthis);
+
+/*!
+ * @brief JNI hook to
+ * @link #jlThread_checkAccess() checkAccess()@endlink
+ */
+extern jboolean jlThread_checkAccess(jvm_object_hash objhashthis);
+
+/*!
+ * @brief JNI hook to @link #jlThread_setDaemon() setDaemon()@endlink
+ */
+extern jvoid jlThread_setDaemon(jvm_object_hash objhashthis,
+                                jboolean isdaemon);
+
+/*!
+ * @brief JNI hook to @link #jlThread_isDaemon() isDaemon()@endlink
+ */
+extern jboolean jlThread_isDaemon(jvm_object_hash objhashthis);
+
+/*!
+ * @brief JNI hook to @link #jlThread_stop() stop()@endlink
+ */
+extern jvoid jlThread_stop(jvm_object_hash objhashthis);
+
+/*!
+ * @brief JNI hook to @link #jlThread_suspend() suspend()@endlink
+ */
+extern jvoid jlThread_suspend(jvm_object_hash objhashthis);
+
+/*!
+ * @brief JNI hook to @link #jlThread_resume() resume()@endlink
+ */
+extern jvoid jlThread_resume(jvm_object_hash objhashthis);
+
+/*@} */ /* End grouped definitions */
+
+
+/**********************************************************************/
+
+/*!
+ * @name Connection to local native method tables.
+ *
+ * @brief These manifest constant code fragments are designed to be
+ * inserted directly into locations in
+ * @link jvm/src/native.c native.c@endlink without any other
+ * modification to that file except a @e single entry to actually
+ * invoke the method.
+ *
+ */
+/*@{*/
+
+/*!
+ * @brief Complete list of local native method ordinals
+ * for @c @b java.lang.Thread
+ */
+#define NATIVE_TABLE_JLTHREAD           \
+    case JLTHREAD_NMO_CURRENTTHREAD:    \
+    case JLTHREAD_NMO_YIELD:            \
+    case JLTHREAD_NMO_INTERRUPT:        \
+    case JLTHREAD_NMO_INTERRUPTED:      \
+    case JLTHREAD_NMO_ISINTERRUPTED:    \
+    case JLTHREAD_NMO_SLEEP:            \
+    case JLTHREAD_NMO_SLEEP_NANOS:      \
+    case JLTHREAD_NMO_JOIN4EVER:        \
+    case JLTHREAD_NMO_JOINTIMED:        \
+    case JLTHREAD_NMO_JOINTIMED_NANOS:  \
+    case JLTHREAD_NMO_ISALIVE:          \
+    case JLTHREAD_NMO_START:            \
+    case JLTHREAD_NMO_COUNTSTACKFRAMES: \
+    case JLTHREAD_NMO_HOLDSLOCK:        \
+    case JLTHREAD_NMO_SETPRIORITY:      \
+    case JLTHREAD_NMO_GETPRIORITY:      \
+    case JLTHREAD_NMO_DESTROY:          \
+    case JLTHREAD_NMO_CHECKACCESS:      \
+    case JLTHREAD_NMO_SETDAEMON:        \
+    case JLTHREAD_NMO_ISDAEMON:         \
+    case JLTHREAD_NMO_STOP:
+
+/*!
+ * @brief Table of local native methods and their descriptors
+ * for @c @b java.lang.Thread
+ */
+#define NATIVE_TABLE_JLTHREAD_ORDINALS                                 \
+    {                                                                  \
+/*static*/ { JLTHREAD_NMO_CURRENTTHREAD,"currentThread",               \
+                                           "()Ljava/lang/Thread;"   }, \
+/*static*/ { JLTHREAD_NMO_YIELD,        "yield",            "()V"   }, \
+           { JLTHREAD_NMO_INTERRUPT,    "interrupt",        "()V"   }, \
+/*static*/ { JLTHREAD_NMO_INTERRUPTED,  "interrupted",      "()Z"   }, \
+           { JLTHREAD_NMO_ISINTERRUPTED,"isInterrupted",    "()Z"   }, \
+/*static*/ { JLTHREAD_NMO_SLEEP,        "sleep",            "(J)V"  }, \
+/*static*/ { JLTHREAD_NMO_SLEEP_NANOS,  "sleep",            "(JI)V" }, \
+           { JLTHREAD_NMO_JOIN4EVER,    "join",             "()V"   }, \
+           { JLTHREAD_NMO_JOINTIMED,    "join",             "(J)V"  }, \
+           { JLTHREAD_NMO_JOINTIMED_NANOS,                             \
+                                        "join",             "(JI)V" }, \
+           { JLTHREAD_NMO_ISALIVE,      "isAlive",          "()Z"   }, \
+           { JLTHREAD_NMO_START,        "start",            "()V"   }, \
+           { JLTHREAD_NMO_COUNTSTACKFRAMES,                            \
+                                        "countStackFrames", "()I"   }, \
+/*static*/ { JLTHREAD_NMO_HOLDSLOCK,    "holdsLock",                   \
+                                           "(Ljava/lang/Object;)Z" },  \
+           { JLTHREAD_NMO_SETPRIORITY,  "setPriority",     "(I)V"  },  \
+           { JLTHREAD_NMO_GETPRIORITY,  "getPriority",     "()I"   },  \
+           { JLTHREAD_NMO_DESTROY,      "destroy",         "()V"   },  \
+           { JLTHREAD_NMO_CHECKACCESS,  "checkAccess",     "()V"   },  \
+           { JLTHREAD_NMO_SETDAEMON,    "setDaemon",       "(Z)V"  },  \
+           { JLTHREAD_NMO_ISDAEMON,     "isDaemon",        "()Z"   },  \
+           { JLTHREAD_NMO_STOP,         "stop",            "()V"   },  \
+           { JLTHREAD_NMO_SUSPEND,      "suspend",         "()V"   },  \
+           { JLTHREAD_NMO_RESUME,       "resume",          "()V"   },  \
+                                                                       \
+        /* Add other method entries here */                            \
+                                                                       \
+                                                                       \
+        /* End of table marker, regardless of static array[size] */    \
+        { JVMCFG_JLOBJECT_NMO_NULL,                                    \
+          CHEAT_AND_USE_NULL_TO_INITIALIZE,                            \
+          CHEAT_AND_USE_NULL_TO_INITIALIZE }                           \
+    }
+
+/*!
+ * @brief @c @b (jvoid) local native method ordinal table
+ * for @c @b java.lang.Thread
+ */
+#define NATIVE_TABLE_JLTHREAD_JVOID     \
+    case JLTHREAD_NMO_YIELD:            \
+    case JLTHREAD_NMO_INTERRUPT:        \
+    case JLTHREAD_NMO_SLEEP:            \
+    case JLTHREAD_NMO_SLEEP_NANOS:      \
+    case JLTHREAD_NMO_JOIN4EVER:        \
+    case JLTHREAD_NMO_JOINTIMED:        \
+    case JLTHREAD_NMO_JOINTIMED_NANOS:  \
+    case JLTHREAD_NMO_START:            \
+    case JLTHREAD_NMO_SETPRIORITY:      \
+    case JLTHREAD_NMO_DESTROY:          \
+    case JLTHREAD_NMO_CHECKACCESS:      \
+    case JLTHREAD_NMO_SETDAEMON:        \
+    case JLTHREAD_NMO_STOP:             \
+    case JLTHREAD_NMO_SUSPEND:          \
+    case JLTHREAD_NMO_RESUME:
+
+/*!
+ * @brief @c @b (jobject) local native method ordinal table
+ * for @c @b java.lang.Thread
+ */
+#define NATIVE_TABLE_JLTHREAD_JOBJECT   \
+    case JLTHREAD_NMO_CURRENTTHREAD:
+
+/*!
+ * @brief @c @b (jint) local native method ordinal table
+ * for @c @b java.lang.Thread
+ */
+#define NATIVE_TABLE_JLTHREAD_JINT      \
+    case JLTHREAD_NMO_INTERRUPTED:      \
+    case JLTHREAD_NMO_ISINTERRUPTED:    \
+    case JLTHREAD_NMO_ISALIVE:          \
+    case JLTHREAD_NMO_COUNTSTACKFRAMES: \
+    case JLTHREAD_NMO_HOLDSLOCK:        \
+    case JLTHREAD_NMO_GETPRIORITY:      \
+    case JLTHREAD_NMO_ISDAEMON:
+
+#define NATIVE_TABLE_JLTHREAD_JFLOAT  /**< No @c @b (jfloat) methods */
+#define NATIVE_TABLE_JLTHREAD_JLONG   /**< No @c @b (jlong) methods */
+#define NATIVE_TABLE_JLTHREAD_JDOUBLE /**< No @c @b (jdouble) methods*/
+
+/*@}*/
+
+#endif /* _jlThread_h_included_ */
+
+
+/* EOF */

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/arch.h
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/arch.h?rev=307257&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/arch.h (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/arch.h Fri Oct  7 21:27:56 2005
@@ -0,0 +1,427 @@
+#ifndef _arch_h_included_
+#define _arch_h_included_
+
+/*!
+ * @file arch.h
+ *
+ * @brief Global project definitions for name, version, copyright,
+ * license, global configuration, and architectural features.
+ *
+ * Derive specific architectural definitions from configuration
+ * parameters set up in @link config/config.h config.h@endlink and
+ * present them for normative use by the compiler.  Also global
+ * constant strings for several purposes.
+ *
+ * Define critical symbols as tested below.
+ * This is done by the @link ./config.sh config.sh@endlink script.
+ *
+ * <b>DO NOT FORGET</b> to use the GCC options found
+ * in @b ../config/confopts.gcc on the GCC command
+ * line!  This can be done as,
+ * @verbatim
+
+       $ gcc `cat ../config/config_opts_always.gcc` \
+             `cat ../config/config_opts_usually.gcc` \
+             -otheropts -c filename.c ...
+  
+       $ gcc `cat ../config/config_opts_always.gccld` \
+             ... *.o -o targetbinary
+
+   @endverbatim
+ *
+ * @todo There needs to be a Java equivalent written for the
+ *       macros @link ##ARCH_COPYRIGHT_TEXT_APACHE
+         ARCH_COPYRIGHT_TEXT_APACHE@endlink, @link
+         #ARCH_LICENSE_TEXT_APACHE ARCH_LICENSE_TEXT_APACHE@endlink,
+ *      and @link #ARCH_COPYRIGHT_APACHE ARCH_COPYRIGHT_APACHE()@endlink
+ *
+ * @section Control
+ *
+ * \$URL: https://svn.apache.org/harmony/project/arch.h  $ \$Id: arch.h 0 09/28/2005 dlydick $
+ *
+ * Copyright 2005 The Apache Software Foundation
+ * or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 ("the License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied.
+ *
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * @version \$LastChangedRevision: 0 $
+ *
+ * @date \$LastChangedDate: 09/28/2005 $
+ *
+ * @author \$LastChangedBy: dlydick $
+ *         Original code contributed by Daniel Lydick on 09/28/2005.
+ *
+ * @section Reference
+ *
+ */
+
+
+/*!
+ * @def ARCH_COPYRIGHT_TEXT_APACHE
+ *
+ * @brief Copyright declaration string for the Apache Software
+ * Foundation for all files in program.
+ *
+ */
+
+#define ARCH_COPYRIGHT_TEXT_APACHE \
+"Copyright 2005 The Apache Software Foundation or its licensors, as applicable."
+
+
+/*!
+ * @def ARCH_LICENSE_TEXT_APACHE
+ *
+ * @brief License declaration string for the Apache Software
+ * Foundation for all files in program.
+ *
+ */
+
+#define ARCH_LICENSE_TEXT_APACHE \
+"Licensed under the Apache License, Version 2.0 (\"the License\");\n\
+you may not use this file except in compliance with the License.\n\
+You may obtain a copy of the License at\n\
+\n\
+    http://www.apache.org/licenses/LICENSE-2.0\n\
+\n\
+Unless required by applicable law or agreed to in writing,\n\
+software distributed under the License is distributed on an\n\
+\"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n\
+either express or implied.\n\
+\n\
+See the License for the specific language governing permissions\n\
+and limitations under the License."
+
+
+/*!
+ * @def ARCH_COPYRIGHT_APACHE()
+ *
+ * @brief Copyright declaration macro for the Apache Software Foundation
+ * for all files in program.
+ *
+ * This macro declares the copyright by the Apache Software Foundation
+ * for all source files.
+ *
+ * Declare a static string containing SVN info plus copyright and
+ * declare a static function that references the string, plus a
+ * local that recursively calls the function.  This function is
+ * used to satisfy the compiler that the static string is being
+ * referenced without also generating a similar message about the
+ * static function not being referenced.
+ *
+ * @param filetoken   Any string that, when concatenated with an
+ *                    underscore (_) and the @p @b exttoken parameter,
+ *                    forms a globally unique combination.  This
+ *                    is typically the file name itself without
+ *                    the file extension name, unquoted.
+ *
+ * @param exttoken    Any string that, when the @p @b filetoken
+ *                    parameter and an underscore (_) are concatenated
+ *                    before it, forms a globally unique combination.
+ *                    This is typically the file extension name itself
+ *                    without the file name, unquoted.
+ *
+ * @param svnidstring Source code management token representing
+ *                    as much information about the file as is
+ *                    desired to insert into the static copyright
+ *                    string for each source file and header file.
+ *                    For RCS and CVS systems, this would typically
+ *                    be the <b>@$<code>Header:</code> @$</b> token,
+ *                    in double quotes.  As currently managed in
+ *                    the Apache SVN repository, it contains the string
+ *       &quot;<b>@$<code>URL:</code> @$ @$<code>Id:</code> @$</b>&quot;
+ *
+ *
+ * @returns @link #rvoid rvoid@endlink
+ *
+ *
+ * @internal The @c @b svnidstring parameter contains highly mangled
+ *           source code control keyword strings.  They are mangled so
+ *           as to hide them from version control substitution, yet
+ *           display in the compiled documentation correctly.
+ *
+ * @internal The initial ASCII \\0 (NUL) character is inserted to
+ *           guarantee that the string itself will @e never be
+ *           appended to some previous text-type data, thus not
+ *           being the beginning of a string for search purposes
+ *           in the output (binary) form of the file invoking the macro.
+ *           Refer to @link ./getsvndata.sh getsvndata.sh@endlink
+ *           for more information.
+ *
+ */
+
+#define ARCH_COPYRIGHT_APACHE(filetoken, exttoken, svnidstring)    \
+static char *filetoken##_##exttoken##_copyright = "\0" svnidstring \
+" " ARCH_COPYRIGHT_TEXT_APACHE;                                    \
+                                                                   \
+static void filetoken##_##exttoken##_dummy(void) {                 \
+    char *p = filetoken##_##exttoken##_copyright;                  \
+              filetoken##_##exttoken##_copyright = p;              \
+              filetoken##_##exttoken##_dummy(); }
+
+/*!
+ * @brief Static copyright string for @e this source file.
+ *
+ */
+ARCH_COPYRIGHT_APACHE(arch, h, "$URL: https://svn.apache.org/harmony/project/arch.h $ $Id: arch.h 0 09/28/2005 dlydick $");
+
+#include "config.h"
+
+/*!
+ * Definition of platform architectures,
+ * including machine hardware type and
+ * operating system type.
+ *
+ * These symbols control various compilation
+ * constructs such as integer word width and
+ * endianness.
+ *
+ * One of these deals with real machine architecture,
+ * the other with operating system.  It is up to YOU
+ * to make sure that both are valid and work together.
+ * For example, CONFIG_SPARC32 works with CONFIG_SOLARIS32
+ * and CONFIG_LINUX32, but not with CONFIG_WINDOWS64.
+ *
+ * One of these MUST be defined on the compile
+ * line:
+ *
+ * CONFIG_SPARC32     Sun Sparc architecture, 32-bit word
+ * CONFIG_SPARC64     Sun Sparc architecture, 64-bit word
+ *
+ * CONFIG_INTEL32     Intel x86 architecture, 32-bit word
+ * CONFIG_INTEL64     Intel x86 architecture, 64-bit word
+ *
+ *
+ * ... others as available ...
+ *
+ *
+ * One of these MUST be defined on the compile
+ * line:
+ *
+ * CONFIG_SOLARIS32   Sun Solaris, 32-bit word
+ * CONFIG_SOLARIS64   Sun Solaris, 64-bit word
+ *
+ * CONFIG_LINUX32     Linux operating system, 32-bit word
+ * CONFIG_LINUX64     Linux operating system, 64-bit word
+ *
+ * CONFIG_WINDOWS32   Microsoft Windows operating system, 32-bit word
+ * CONFIG_WINDOWS64   Microsoft Windows operating system, 64-bit word
+ *
+ *
+ * ... others as available ...
+ *
+ *
+ */
+
+/*!
+ * @internal Demand that EXACTLY ONE hardware architecture be defined
+ */
+
+#ifdef CONFIG_SPARC32
+#define _ARCH_DEFINED_
+#endif
+
+#ifdef CONFIG_SPARC64
+#ifdef _ARCH_DEFINED_
+#error "Multiple machine architectures defined"
+#else
+#define _ARCH_DEFINED_
+#endif
+#endif
+
+#ifdef CONFIG_INTEL32
+#ifdef _ARCH_DEFINED_
+#error "Multiple machine architectures defined"
+#else
+#define _ARCH_DEFINED_
+#endif
+#endif
+
+#ifdef CONFIG_INTEL64
+#ifdef _ARCH_DEFINED_
+#error "Multiple machine architectures defined"
+#else
+#define _ARCH_DEFINED_
+#endif
+#endif
+
+/*!
+ * @internal Check that that EXACTLY ONE architecture has been defined
+ */
+#ifndef _ARCH_DEFINED_
+#error "Need to explicitly define a machine architecture"
+#endif
+
+
+/* Demand that EXACTLY ONE software architecture be defined */
+#undef _ARCH_DEFINED_
+
+#ifdef CONFIG_SOLARIS32
+#define _ARCH_DEFINED_
+#endif
+
+#ifdef CONFIG_SOLARIS64
+#ifdef _ARCH_DEFINED_
+#error "Multiple OS architectures defined"
+#else
+#define _ARCH_DEFINED_
+#endif
+#endif
+
+#ifdef CONFIG_LINUX32
+#ifdef _ARCH_DEFINED_
+#error "Multiple OS architectures defined"
+#else
+#define _ARCH_DEFINED_
+#endif
+#endif
+
+#ifdef CONFIG_LINUX64
+#ifdef _ARCH_DEFINED_
+#error "Multiple OS architectures defined"
+#else
+#define _ARCH_DEFINED_
+#endif
+#endif
+
+#ifdef CONFIG_WINDOWS32
+#ifdef _ARCH_DEFINED_
+#error "Multiple OS architectures defined"
+#else
+#define _ARCH_DEFINED_
+#endif
+#endif
+
+#ifdef CONFIG_WINDOWS64
+#ifdef _ARCH_DEFINED_
+#error "Multiple OS architectures defined"
+#else
+#define _ARCH_DEFINED_
+#endif
+#endif
+
+/*!
+ * @internal Check that that EXACTLY ONE architecture has been defined
+ */
+#ifdef _ARCH_DEFINED_
+/*!
+ * @internal Make available, especially to
+ * @link jvm/src/jvmcfg.h jvmcfg.h@endlink
+ *
+ */
+#define _VALID_ARCH_DEFINED_
+#else
+#error "Need to explicitly define an OS architecture"
+#endif
+#undef _ARCH_DEFINED_
+
+/*!
+ * @def ARCH_ODD4_ADDRESS_SIGSEGV
+ * @brief Check architectural hardware error oddities related to
+ * even/odd byte addressing.
+ *
+ * The behavioral oddities to be flagged for a specific architecture
+ * include:
+ *
+ * <ul>
+ * <li>
+ * @b ARCH_ODD2_ADDRESS_SIGSEGV ... When a 2-byte access causes
+ *                                  @b SIGSEGV on a read or write
+ *                                  operation.
+ * </li>
+ *
+ * <li>
+ * @b ARCH_ODD4_ADDRESS_SIGSEGV ... When a 4-byte access causes
+ *                                  SIGSEGV on a read or write
+ *                                  operation.  This will also mean
+ *                                  that a 2-byte access will also
+ *                                  cause @b SIGSEGV.
+ * </li>
+ *
+ * <li>
+ * @b xyz                       ... Your favorite bug is defined here...
+ * </li>
+ * </ul>
+ *
+ */
+
+#ifdef CONFIG_SOLARIS32
+#define ARCH_ODD4_ADDRESS_SIGSEGV
+#endif
+
+/*!
+ * @def ARCH_ODD2_ADDRESS_SIGSEGV
+ * @brief See @link
+ * #ARCH_ODD4_ADDRESS_SIGSEGV ARCH_ODD4_ADDRESS_SIGSEGV@endlink.
+ */
+/* rm this if/endif when there is an architecture that needs only ODD2*/
+#if 0
+#ifdef CONFIG_SOLARIS32
+#define ARCH_ODD2_ADDRESS_SIGSEGV
+#endif
+#endif
+
+/*
+ * ... Define other issues here ...
+ */
+
+
+
+/*********** End of unique definitions.  Start derived definitions ****/
+
+
+/* Endianness of real machine word */
+
+#ifdef CONFIG_INTEL
+/*!
+ * @def ARCH_LITTLE_ENDIAN
+ * @brief Defined only for little endian architectures, in opposition
+ * to @link #ARCH_BIG_ENDIAN ARCH_BIG_ENDIAN@endlink.
+ *
+ * Used by swapping functions in
+ * @link jvm/src/bytegames.c bytegames.c@endlink and
+ * derived macros in @link jvm/src/cfmacros.h cfmacros.h@endlink.
+ */
+#define ARCH_LITTLE_ENDIAN
+#else
+/*!
+ * @def ARCH_BIG_ENDIAN
+ * @brief Defined only for big endian architectures, in opposition
+ * to @link #ARCH_LITTLE_ENDIAN ARCH_LITTLE_ENDIAN@endlink.
+ *
+ * Used by swapping functions in
+ * @link jvm/src/bytegames.c bytegames.c@endlink and
+ * derived macros in @link jvm/src/cfmacros.h cfmacros.h@endlink.
+ */
+#define ARCH_BIG_ENDIAN
+#endif
+
+/*!
+ * @brief Define more general case of odd-address @b SIGSEGV.
+ *
+ * If either ARCH_ODD4_ADDRESS_SIGSEGV or ARCH_ODD2_ADDRESS_SIGSEGV
+ * are defined, then this symbol is also defined as a union of the
+ * definitions.
+ */
+#ifdef  ARCH_ODD4_ADDRESS_SIGSEGV
+#define ARCH_ODD_ADDRESS_SIGSEGV
+#else
+#ifdef  ARCH_ODD2_ADDRESS_SIGSEGV
+#define ARCH_ODD_ADDRESS_SIGSEGV
+#endif
+#endif
+
+#endif /* _arch_h_included_ */
+
+/* EOF */

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/argv.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/argv.c?rev=307257&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/argv.c (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/argv.c Fri Oct  7 21:27:56 2005
@@ -0,0 +1,705 @@
+/*!
+ * @file argv.c
+ *
+ * @brief Process command line arguments passed in to JVM program.
+ *
+ * Read @link #jvm() command line parameters@endlink from,
+ * @code main(int argc, char **argv, char **envp) @endcode
+ *
+ * These parameters typically are passed from the
+ * @link #main() actual 'C' program entry point@endlink.
+ * Process these parameters and use a subset to construct the Java
+ * command line parameters to pass in to the main Java entry point,
+ * @code public static void main(String[] args) @endcode
+ *
+ * Part of this process is to read environment settings for
+ * @b JAVA_HOME, @b CLASSPATH, and @b BOOTCLASSPATH, which may be
+ * overridden from the command line.
+ *
+ * The HEAP_INIT() function must have been called before using
+ * these functions so the environment variables can be stored
+ * into it and not depend on the argument or environment pointers
+ * to always be unchanged.
+ *
+ * The tmparea_init() function must have been called before these
+ * functions so the internal @b CLASSPATH can be set up properly.
+ *
+ *
+ * @section Control
+ *
+ * \$URL: https://svn.apache.org/path/name/argv.c $ \$Id: argv.c 0 09/28/2005 dlydick $
+ *
+ * Copyright 2005 The Apache Software Foundation
+ * or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 ("the License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied.
+ *
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * @version \$LastChangedRevision: 0 $
+ *
+ * @date \$LastChangedDate: 09/28/2005 $
+ *
+ * @author \$LastChangedBy: dlydick $
+ *         Original code contributed by Daniel Lydick on 09/28/2005.
+ *
+ * @section Reference
+ *
+ */
+
+#include "arch.h"
+ARCH_COPYRIGHT_APACHE(argv, c ,"$URL: https://svn.apache.org/path/name/argv.c $ $Id: argv.c 0 09/28/2005 dlydick $");
+
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "jvmcfg.h" 
+#include "classfile.h" 
+#include "classpath.h" 
+#include "exit.h" 
+#include "heap.h" 
+#include "jvm.h" 
+#include "util.h" 
+
+
+/*!
+ * @brief Parse command line
+ *
+ * Retrieve parameters from the program entry point
+ * @code main(int argc, char **argv, char **envp) @endcode
+ * and parse them into internal form.  Since this program
+ * is delivered primarily as a library, these will have
+ * to be reported as parameters to
+ * @link jvm(int argc, char **argv, char **envp)@endlink
+ * from the invoking program.
+ *
+ * The syntax for the command line is:
+ *
+ * @code
+ * main_pgm_name [{-Xjh    | -Xjavahome | -Xjava_home}  dir_name]
+ *               [{-cp     | -classpath}                dir_name]
+ *               [{-Xbcp   | -Xbootclasspath}           dir_name]
+ *               [{-Xdebug | -Xdebuglevel | -Xdebug_level} level]
+ *
+ *               [-jar any/path/name/jarfilename]
+ *               start.class.name
+ *
+ *               [java_arg1 [java_arg2 [...]]]
+ *
+ *
+ * main_pgm_name -show
+ *               -version
+ *               -copyright
+ *               -help
+ * @endcode
+ *
+ * If more than one '-\<token\>' or '-X\<token\>' option entry is
+ * found on the command line for a given token type, the last one
+ * wins If one of these tokens is the last parameter on a command
+ * line, it is ignored.  After the option entries are reviewed, the
+ * starting class name is specified, preceded by an optional '-jar'
+ * modifier which, if present, indicates that the specified jar file
+ * should be read to locate the starting class.  Any parameters after
+ * the starting class name are passed to the JVM as '(String) args[]'.
+ *
+ *
+ * @param argc    Number of arguments on command line
+ * @param argv    Argument vector from the command line
+ * @param envp    Environment pointer from command line environ
+ *
+ * @returns @link #rvoid rvoid@endlink
+ */
+rvoid argv_init(int argc, char **argv, char **envp)
+{
+    rchar *chkjh;  chkjh =  (rchar *) rnull;
+    rchar *chkcp;  chkcp =  (rchar *) rnull;
+    rchar *chkbcp; chkbcp = (rchar *) rnull;
+
+    pjvm->startjar   = (rchar *) rnull;
+    pjvm->startclass = (rchar *) rnull;
+
+    /* Save off startup parameters, incl. pgm name (argv0) */
+    pjvm->argc = argc;
+    pjvm->argv = argv;
+    pjvm->envp = envp;
+
+    /* Extract program name from path, defaulting to whole invocation */
+    pjvm->argv0 = argv[0];
+    pjvm->argv0name = strrchr(pjvm->argv0,
+                              JVMCFG_PATHNAME_DELIMITER_CHAR);
+    if (rnull != pjvm->argv0name)
+    {
+        pjvm->argv0name++;
+    }
+    else
+    {
+        pjvm->argv0name = pjvm->argv0;
+    }
+
+    /*
+     * Initially extract @b JAVA_HOME, @b CLASSPATH, and
+     * @p @b BOOTCLASSPATH from environment (could do this with
+     * @b envp, but @c @b getenv(3) is easier).
+     */
+    chkjh  = getenv(JVMCFG_ENVIRONMENT_VARIABLE_JAVA_HOME);
+    chkcp  = getenv(JVMCFG_ENVIRONMENT_VARIABLE_CLASSPATH);
+    chkbcp = getenv(JVMCFG_ENVIRONMENT_VARIABLE_BOOTCLASSPATH);
+
+    /*
+     * Look in command line, scan WHOLE command line for
+     * '-X<clspthtoken> classpath', last entry wins.
+     * Ignore trailing token without a following parameter.
+     */
+    rint  i;
+    rint show_flag = rfalse;
+
+    for (i = 1; i < argc; i++)
+    {
+        /*
+         * Options that terminate program execution
+         */
+        if (0 == strcmp(JVMCFG_COMMAND_LINE_HELP_PARM, argv[i]))
+        {
+            argv_helpmsg();
+            exit_jvm(EXIT_ARGV_HELP);
+/*NOTREACHED*/
+        }
+        else
+        if (0 == strcmp(JVMCFG_COMMAND_LINE_LICENSE_PARM, argv[i]))
+        {
+            argv_licensemsg();
+            exit_jvm(EXIT_ARGV_LICENSE);
+/*NOTREACHED*/
+        }
+        else
+        if (0 == strcmp(JVMCFG_COMMAND_LINE_VERSION_PARM, argv[i]))
+        {
+            argv_versionmsg();
+            exit_jvm(EXIT_ARGV_VERSION);
+/*NOTREACHED*/
+        }
+        else
+        if (0 == strcmp(JVMCFG_COMMAND_LINE_COPYRIGHT_PARM, argv[i]))
+        {
+            argv_copyrightmsg();
+            exit_jvm(EXIT_ARGV_COPYRIGHT);
+/*NOTREACHED*/
+        }
+        else
+        /*
+         * Reporting options
+         */
+        if (0 == strcmp(JVMCFG_COMMAND_LINE_SHOW_PARM, argv[i]))
+        {
+            /* Display command line parms after parsing */
+            show_flag = rtrue;
+            continue;
+        }
+        else
+        /*
+         * Options that affect program execution,
+         * not including JVM arguments (below).
+         */
+        if ((0 == strcmp(JVMCFG_JAVA_HOME_ABBREV_PARM, argv[i])) ||
+            (0 == strcmp(JVMCFG_JAVA_HOME_MID_PARM,    argv[i])) ||
+            (0 == strcmp(JVMCFG_JAVA_HOME_FULL_PARM,   argv[i])))
+        {
+            if (argc - 1 > i)
+            {
+                chkjh = argv[i + 1];
+                i++;
+            }
+        }
+        else
+        if ((0 == strcmp(JVMCFG_CLASSPATH_ABBREV_PARM, argv[i])) ||
+            (0 == strcmp(JVMCFG_CLASSPATH_FULL_PARM, argv[i])))
+        {
+            if (argc - 1 > i)
+            {
+                chkcp = argv[i + 1];
+                i++;
+            }
+        }
+        else
+        if ((0 == strcmp(JVMCFG_BOOTCLASSPATH_ABBREV_PARM, argv[i])) ||
+            (0 == strcmp(JVMCFG_BOOTCLASSPATH_FULL_PARM, argv[i])))
+        {
+            if (argc - 1 > i)
+            {
+                chkbcp = argv[i + 1];
+                i++;
+            }
+        }
+        else
+        if ((0 == strcmp(JVMCFG_DEBUGMSGLEVEL_ABBREV_PARM, argv[i])) ||
+            (0 == strcmp(JVMCFG_DEBUGMSGLEVEL_MID_PARM,    argv[i])) ||
+            (0 == strcmp(JVMCFG_DEBUGMSGLEVEL_FULL_PARM,   argv[i])))
+        {
+            if (argc - 1 > i)
+            {
+                rint chkdml = atol(argv[i + 1]);
+
+                if ((DMLOFF == chkdml) ||
+                    ((DMLMIN <= chkdml) && (DMLMAX >= chkdml)))
+                {
+                    jvmutil_set_dml(chkdml);
+
+                 /* sysDbgMsg(DMLMIN, */
+                    sysErrMsg("argv_init",
+                              "debug message level %d",
+                              chkdml);
+                }
+                else
+                {
+                    sysErrMsg("argv_init",
+                           "invalid debug message level %d.  Ignored",
+                              chkdml);
+                }
+
+                i++;
+            }
+        }
+        else
+        /*
+         * Java class to run (terminates option scanning),
+         * either JAR or class file.
+         */
+        if (0 == strcmp(JVMCFG_JARFILE_STARTCLASS_PARM, argv[i]))
+        {
+            if (argc - 1 > i)
+            {
+                pjvm->startjar = argv[i + 1];
+                i++;
+                i++;
+            }
+
+            break; /* End of token parsing.  Quit for() loop */
+        }
+        else
+        {
+            /* If not a -xxxxx token, it must be the startup class */
+            pjvm->startclass = argv[i];
+            i++;
+
+            break; /* End of token parsing.  Quit for() loop */
+        }
+
+    } /* for i */
+
+    /*
+     * Now get JVM Java @c @b args[] list from rest
+     * of @b argv parms
+     */
+
+    /* Add 1 NUL byte at the end, initialize to zeroes (NUL) */
+    pjvm->argcj = 0;
+    pjvm->argvj = HEAP_GET_DATA(sizeof(rchar *) * ( 1 + argc - i),
+                                rtrue);
+
+    /*
+     * If any @b argv parms left, load them into
+     * @c @b pjvm->argvj
+     */
+    if (i < argc)
+    {
+        /*
+         * Keep scanning @c @b argv[] , only initialization
+         * for @c @b pjvm->argvj
+         */
+
+        /* @warning  NON-STANDARD TERMINATION CONDITION <= VERSUS < */
+        rint j;
+        for (j = 0; i <= argc; i++, j++)
+        {
+            /* Done when all @b argv is scanned and NUL byte added */
+            if (i == argc)
+            {
+                pjvm->argvj[j] = (rchar *) rnull;
+                break;
+            }
+
+            pjvm->argcj++;
+            pjvm->argvj[j] = argv[i];
+        }
+    }
+
+    /* Try to get a valid @b JAVA_HOME even if not found elsewhere */
+    chkjh = (rchar *) ((rnull == chkjh)
+                       ? JVMCFG_JAVA_HOME_DEFAULT
+                       : chkjh);
+
+    pjvm->java_home = (rchar *) rnull;
+    if (rnull != chkjh)
+    {
+        /* Copy '\0' byte also*/
+        pjvm->java_home = HEAP_GET_DATA(sizeof(rchar) + strlen(chkjh),
+                                        rfalse);
+
+        memcpy(pjvm->java_home, chkjh, sizeof(rchar) + strlen(chkjh));
+    }
+
+    /* Try to get a valid @b CLASSPATH even if not found elsewhere */
+    chkcp = (rchar *) ((rnull == chkcp)
+                         ? JVMCFG_CLASSPATH_DEFAULT
+                         : (const rchar *) chkcp);
+
+    pjvm->classpath = (rchar *) rnull;
+    if (rnull != chkcp)
+    {
+        /* Copy '\0' byte also */
+        pjvm->classpath = HEAP_GET_DATA(sizeof(rchar) + strlen(chkcp),
+                                        rfalse);
+
+        memcpy(pjvm->classpath, chkcp, sizeof(rchar) + strlen(chkcp));
+    }
+#ifdef JVMCFG_HARDCODED_TEST_CLASSPATH
+    pjvm->classpath = JVMCFG_HARDCODED_TEST_CLASSPATH;
+#endif
+
+    /* Try to get a valid @b BOOTCLASSPATH even if not found elsewhere*/
+    chkbcp = (rchar *) ((rnull == chkbcp)
+                          ?
+#ifdef CONFIG_HACKED_BOOTCLASSPATH
+                            JVMCFG_CLASSPATH_DEFAULT
+#else
+                            JVMCFG_BOOTCLASSPATH_DEFAULT
+#endif
+                          : (const rchar *) chkbcp);
+
+    pjvm->bootclasspath = (rchar *) rnull;
+    if (rnull != chkbcp)
+    {
+        /* Copy '\0' byte also */
+        pjvm->bootclasspath = HEAP_GET_DATA(sizeof(rchar) +
+                                                strlen(chkbcp),
+                                            rfalse);
+
+        memcpy(pjvm->bootclasspath,
+               chkbcp,
+               sizeof(rchar) + strlen(chkbcp));
+    }
+
+    /* Show summary of what command line resoved into */
+    if (rtrue == show_flag)
+    {
+        argv_showmsg();
+    }
+
+    /* Display copyright msg and finish */
+    argv_copyrightmsg();
+
+    /* Declare this module initialized */
+    jvm_argv_initialized = rtrue;
+
+    return;
+
+} /* END of argv_init() */
+
+
+/*!
+ * @brief Show program version message to standard output.
+ *
+ *
+ * @b Parameters: @link #rvoid rvoid@endlink
+ *
+ *
+ *       @returns @link #rvoid rvoid@endlink
+ *
+ */
+rvoid argv_versionmsg(rvoid)
+{
+    fprintfLocalStdout("%s\n", CONFIG_RELEASE_LEVEL);
+
+    return;
+
+} /* END of argv_versionmsg() */
+
+
+/*!
+ * @brief Show program copyright message to standard output.
+ *
+ *
+ * @b Parameters: @link #rvoid rvoid@endlink
+ *
+ *
+ *       @returns @link #rvoid rvoid@endlink
+ *
+ */
+rvoid argv_copyrightmsg(rvoid)
+{
+    fprintfLocalStdout("\n%s:  %s, version %s\n%s\n\n",
+                       CONFIG_PROGRAM_NAME,
+                       CONFIG_PROGRAM_DESCRIPTION,
+                       CONFIG_RELEASE_LEVEL,
+                       ARCH_COPYRIGHT_TEXT_APACHE);
+
+    return;
+
+} /* END of argv_copyrightmsg() */
+
+
+/*!
+ * @brief Show program software license message to standard output.
+ *
+ *
+ * @b Parameters: @link #rvoid rvoid@endlink
+ *
+ *
+ *       @returns @link #rvoid rvoid@endlink
+ *
+ */
+rvoid argv_licensemsg(rvoid)
+{
+    argv_copyrightmsg();
+    fprintfLocalStdout("%s\n\n", ARCH_LICENSE_TEXT_APACHE);
+
+    return;
+
+} /* END of argv_licensemsg() */
+
+
+#define LEADING_SPACES "                  "
+
+/*!
+ * @brief Show program syntax and usage message to standard output.
+ *
+ *
+ * @b Parameters: @link #rvoid rvoid@endlink
+ *
+ *
+ *       @returns @link #rvoid rvoid@endlink
+ *
+ */
+rvoid argv_helpmsg(rvoid)
+{
+    argv_copyrightmsg();
+
+    fprintfLocalStdout(
+"%s:  version %s\n\n",
+                       pjvm->argv0name,
+                       CONFIG_RELEASE_LEVEL);
+    fprintfLocalStdout(
+"Invoke a class: %s: [options] start.class.name [args]\n",
+                       pjvm->argv0name);
+    fprintfLocalStdout(
+"Invoke a jar:   %s: [options] -jar filename    [args]\n\n",
+                       pjvm->argv0name);
+
+    fprintfLocalStdout(
+"Where:\n");
+
+    fprintfLocalStdout(
+"    %s filename %s",
+                       JVMCFG_JARFILE_STARTCLASS_PARM,
+            "Invoke class from JAR file whose main() appears in the\n");
+    fprintfLocalStdout(
+"%senclosed '%s' file on the '%s'\n",
+                       LEADING_SPACES,
+                       JVMCFG_JARFILE_MANIFEST_FILENAME,
+                       JVMCFG_JARFILE_MANIFEST_MAIN_CLASS);
+    fprintfLocalStdout(
+"%sattribute line.  This name may not cause the line to be\n",
+                       LEADING_SPACES);
+    fprintfLocalStdout(
+"%smore than %d characters wide.  Line continuations are\n",
+                       LEADING_SPACES,
+                       JVMCFG_JARFILE_MANIFEST_LINE_MAX);
+    fprintfLocalStdout(
+"%snot supported for locating this class name.\n\n",
+                       LEADING_SPACES);
+
+    fprintfLocalStdout("    %s         %s",
+                       JVMCFG_COMMAND_LINE_SHOW_PARM,
+   "Show how command line and environment resolves after parsing.\n");
+    fprintfLocalStdout("    %s      %s",
+                       JVMCFG_COMMAND_LINE_VERSION_PARM,
+   "Display the program release level.\n");
+
+    fprintfLocalStdout("    %s    %s",
+                       JVMCFG_COMMAND_LINE_COPYRIGHT_PARM,
+   "Display the program copyright.\n");
+
+    fprintfLocalStdout("    %s      %s",
+                       JVMCFG_COMMAND_LINE_LICENSE_PARM,
+   "Display the program software license.\n");
+
+    fprintfLocalStdout("    %s         %s",
+                       JVMCFG_COMMAND_LINE_HELP_PARM,
+   "Display this help message.\n\n");
+
+
+    fprintfLocalStdout("    %s pathname\n", JVMCFG_JAVA_HOME_FULL_PARM);
+    fprintfLocalStdout("    %s  pathname\n", JVMCFG_JAVA_HOME_MID_PARM);
+    fprintfLocalStdout(
+"    %s        pathname\n",
+                       JVMCFG_JAVA_HOME_ABBREV_PARM);
+    fprintfLocalStdout(
+"%sOverride JAVA_HOME environment variable, if any.\n",
+                       LEADING_SPACES);
+    fprintfLocalStdout(
+"%sIf none found, this option @e must be present.\n",
+                       LEADING_SPACES);
+    fprintfLocalStdout(
+"%sIt points to the Java home directory for this invocation.\n\n",
+                       LEADING_SPACES);
+
+    fprintfLocalStdout(
+"    %s path1%cpath2%c...pathN\n",
+                       JVMCFG_CLASSPATH_FULL_PARM,
+                       CLASSPATH_ITEM_DELIMITER_CHAR,
+                       CLASSPATH_ITEM_DELIMITER_CHAR);
+    fprintfLocalStdout(
+"    %s        path1%cpath2%c...pathN\n",
+                       JVMCFG_CLASSPATH_ABBREV_PARM,
+                       CLASSPATH_ITEM_DELIMITER_CHAR,
+                       CLASSPATH_ITEM_DELIMITER_CHAR);
+    fprintfLocalStdout(
+"%sOverride CLASSPATH environment variable, if any.\n",
+                       LEADING_SPACES);
+    fprintfLocalStdout(
+"%sIf none found, this option @e must be present.\n",
+                       LEADING_SPACES);
+    fprintfLocalStdout(
+"%sContains a search paths of directories and/or jar files.\n",
+                       LEADING_SPACES);
+    fprintfLocalStdout(
+"%sto use for locating classfiles.  Each entry is\n",
+                       LEADING_SPACES);
+    fprintfLocalStdout(
+"%san /absolute/path/name and is separated by a '%c' character.\n\n",
+                       LEADING_SPACES,
+                       CLASSPATH_ITEM_DELIMITER_CHAR);
+
+    fprintfLocalStdout(
+"    %s path1%cpath2%c...pathN\n",
+                       JVMCFG_BOOTCLASSPATH_FULL_PARM,
+                       CLASSPATH_ITEM_DELIMITER_CHAR,
+                       CLASSPATH_ITEM_DELIMITER_CHAR);
+    fprintfLocalStdout(
+"    %s           path1%cpath2%c...pathN\n",
+                       JVMCFG_BOOTCLASSPATH_ABBREV_PARM,
+                       CLASSPATH_ITEM_DELIMITER_CHAR,
+                       CLASSPATH_ITEM_DELIMITER_CHAR);
+    fprintfLocalStdout(
+"%sOverride BOOTCLASSPATH environment variable, if any.\n",
+                       LEADING_SPACES);
+    fprintfLocalStdout(
+"%sPerforms similar function to CLASSPATH, but used for\n",
+                       LEADING_SPACES);
+    fprintfLocalStdout("%ssystem startup purposes.\n\n",
+                       LEADING_SPACES);
+    fprintfLocalStdout(
+"    args          Optional arguments to pass to JVM, if any.\n\n");
+
+
+    return;
+
+} /* END of argv_helpmsg() */
+
+
+/*!
+ * @brief Show resolution of command line to standard output.
+ *
+ *
+ * @b Parameters: @link #rvoid rvoid@endlink
+ *
+ *
+ *       @returns @link #rvoid rvoid@endlink
+ *
+ */
+rvoid argv_showmsg(rvoid)
+{
+    fprintfLocalStdout("JAVA_HOME=%s\n", pjvm->java_home);
+
+    fprintfLocalStdout("CLASSPATH=%s\n", pjvm->classpath);
+
+    fprintfLocalStdout("BOOTCLASSPATH=%s\n", pjvm->bootclasspath);
+
+    if (rnull != pjvm->startjar)
+    {
+        fprintfLocalStdout("entry=%s\n", pjvm->startjar);
+    }
+    else
+    if (rnull != pjvm->startclass)
+    {
+        fprintfLocalStdout("entry=%s\n", pjvm->startclass);
+    }
+    else
+    {
+        fprintfLocalStdout("entry=UNKNOWN\n");
+    }
+
+    rint argc;
+    for (argc = 0; rnull != pjvm->argvj[argc]; argc++)
+    {
+        ; /* Simply count number of args, terminated by rnull slot */
+    }
+
+    fprintfLocalStdout("argc=%d\n", argc);
+
+    fprintfLocalStdout("args=");
+
+    rint i;
+    for (i = 0; i < argc; i++)
+    {
+        fprintfLocalStdout("%s ", pjvm->argvj[i]);
+
+    }
+    
+    fprintfLocalStdout("\n\n");
+
+
+    return;
+
+} /* END of argv_showmsg() */
+
+
+/*!
+ * @brief Clean up from argv[] setup after JVM execution.
+ *
+ *
+ * @b Parameters: @link #rvoid rvoid@endlink
+ *
+ *
+ *       @returns @link #rvoid rvoid@endlink
+ *
+ */
+rvoid argv_shutdown(rvoid)
+{
+    HEAP_FREE_DATA(pjvm->bootclasspath);
+    pjvm->bootclasspath = (rchar *) rnull;
+
+    HEAP_FREE_DATA(pjvm->classpath);
+    pjvm->classpath = (rchar *) rnull;
+
+    HEAP_FREE_DATA(pjvm->java_home);
+    pjvm->java_home = (rchar *) rnull;
+
+    rint argidx;
+    for (argidx = 0; argidx < pjvm->argcj; argidx++)
+    {
+        HEAP_FREE_DATA(pjvm->argvj[argidx]);
+    }
+    HEAP_FREE_DATA(pjvm->argvj);
+    pjvm->argvj = (char **) rnull;
+
+    /* Declare this module uninitialized */
+    jvm_argv_initialized = rfalse;
+
+    return;
+
+} /* END of argv_shutdown() */
+
+
+/* EOF */

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/attribute.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/attribute.c?rev=307257&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/attribute.c (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/attribute.c Fri Oct  7 21:27:56 2005
@@ -0,0 +1,411 @@
+/*!
+ * @file attribute.c
+ *
+ * @brief Manipulate ClassFile attributes.
+ *
+ *
+ * @section Control
+ *
+ * \$URL: https://svn.apache.org/path/name/attribute.c $ \$Id: attribute.c 0 09/28/2005 dlydick $
+ *
+ * Copyright 2005 The Apache Software Foundation
+ * or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 ("the License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied.
+ *
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * @version \$LastChangedRevision: 0 $
+ *
+ * @date \$LastChangedDate: 09/28/2005 $
+ *
+ * @author \$LastChangedBy: dlydick $
+ *         Original code contributed by Daniel Lydick on 09/28/2005.
+ *
+ * @section Reference
+ *
+ */
+
+#include "arch.h"
+ARCH_COPYRIGHT_APACHE(attribute, c, "$URL: https://svn.apache.org/path/name/attribute.c $ $Id: attribute.c 0 09/28/2005 dlydick $");
+
+
+#include "jvmcfg.h"
+#include "cfmacros.h"
+#include "classfile.h"
+#include "jvm.h"
+#include "linkage.h"
+#include "utf.h"
+
+
+/*!
+ * @brief Locate an attribute by constant_pool entry for a field,
+ * method, or class.  The attribute pointer passed in is valid for
+ * all three types.
+ *
+ *
+ * @param  pcfs     Pointer to ClassFile area
+ *
+ * @param  acount   Attribute count from field, method, or class.
+ *
+ * @param  patr     Attribute array for a field, method, or class.
+ *
+ * @param  atrname  UTF8 constant_pool entry of name of attribute in
+ *                    field, method, or class.
+ *
+ *
+ * @returns Attribute table index ofthie attribute or
+ *        @link #jvm_attribute_index_bad jvm_attribute_index_bad@endlink
+ *          if not found.
+ *
+ */
+static jvm_attribute_index attribute_name_common_find(
+                               ClassFile           *pcfs,
+                               u2                   acount,
+                               attribute_info_dup **patr,
+                               cp_info_dup         *atrname)
+{
+    /* Search for match of attribute array against requested name */
+    jvm_attribute_index atridx;
+
+    for (atridx = 0; atridx < acount; atridx++)
+    {
+        if (0 == utf_pcfs_strcmp(PTR_THIS_CP_Utf8(atrname),
+                                 pcfs,
+                                 atridx))
+        {
+            return(atridx);
+        }
+    }
+
+    /* Not found */
+    return(jvm_attribute_index_bad);
+
+} /* END of attribute_name_common_find() */
+
+
+/*!
+ * @brief Locate an attribute by enumeration for a field, method,
+ * or class.
+ *
+ * The attribute pointer passed in is valid for all three types.
+ *
+ *
+ * @param  pcfs     Pointer to ClassFile area
+ *
+ * @param  acount   Attribute count from field, method, or class.
+ *
+ * @param  patr     Attribute array for a field, method, or class.
+ *
+ * @param  atrenum  Attribute enumeration (from
+ *                    @link jvm/src/classfile.h classfile.h@endlink)
+ *                    for attribute of field, method, or class to locate
+ *                    (e.g. LOCAL_CODE_ATTRIBUTE).
+ *
+ *
+ * @returns Attribute table index ofthie attribute or
+ *        @link #jvm_attribute_index_bad jvm_attribute_index_bad@endlink
+ *          if not found.
+ *
+ */
+static jvm_attribute_index attribute_enum_common_find(
+                               ClassFile                 *pcfs,
+                               u2                         acount,
+                               attribute_info_dup       **patr,
+                               classfile_attribute_enum   atrenum)
+{
+    /* Search for match of attribute array against requested enum */
+    jvm_attribute_index atridx;
+
+    for (atridx = 0; atridx < acount; atridx++)
+    {
+        if (atrenum ==
+            cfattrib_atr2enum(pcfs,
+                              patr[atridx]->ai.attribute_name_index))
+        {
+            return(atridx);
+        }
+    }
+
+    /* Not found */
+    return(jvm_attribute_index_bad);
+
+} /* END of attribute_enum_common_find() */
+
+
+/*!
+ * @brief Locate by constant_pool entry the attribute_info index for an
+ * attribute in a field attribute area.
+ *
+ *
+ * @param  clsidx            Class index of class whose field is to be
+ *                             searched for an attribute.
+ *
+ * @param  fldidx            Field index of field to search.
+ *
+ * @param  atrname           UTF8 constant_pool entry of name of
+ *                             attribute name to locate.
+ *
+ *
+ * @returns attribute table index of this attribute in field, or
+ *        @link #jvm_attribute_index_bad jvm_attribute_index_bad@endlink
+ *         if not found.
+ *
+ */
+jvm_attribute_index
+    attribute_find_in_field_by_cp_entry(jvm_class_index  clsidx,
+                                        jvm_field_index  fldidx,
+                                        cp_info_dup     *atrname)
+{
+    /* Prohibit invalid class parameter */
+    if (jvm_class_index_null == clsidx)
+    {
+        return(jvm_attribute_index_bad);
+    }
+
+    /* Point to class structure, then look for attribute */
+    ClassFile *pcfs = CLASS_OBJECT_LINKAGE(clsidx)->pcfs;
+
+    /* Prohibit invalid field parameter */
+    if (pcfs->fields_count <= fldidx)
+    {
+        return(jvm_attribute_index_bad);
+    }
+
+    return(
+        attribute_name_common_find(pcfs,
+                                 pcfs->fields[fldidx]->attributes_count,
+                                   pcfs->fields[fldidx]->attributes,
+                                   atrname));
+
+} /* END of attribute_find_in_field_by_cp_entry() */
+
+
+/*!
+ * @brief Locate by enumeration the attribute_info index for an
+ * attribute in a field attribute area.
+ *
+ *
+ * @param  clsidx            Class index of class whose field is to be
+ *                             searched for an attribute.
+ *
+ * @param  fldidx            Field index of field to search.
+ *
+ * @param  atrenum           @link #classfile_attribute_enum
+                             LOCAL_xxxx_ATTRIBUTE@endlink enumeration of
+ *                           attribute to locate.
+ *
+ * @returns attribute table index of this attribute in field, or
+ *        @link #jvm_attribute_index_bad jvm_attribute_index_bad@endlink
+ *          if not found.
+ *
+ */
+jvm_attribute_index
+    attribute_find_in_field_by_enum(jvm_class_index          clsidx,
+                                    jvm_field_index          fldidx,
+                                    classfile_attribute_enum atrenum)
+{
+    /* Prohibit invalid class parameter */
+    if (jvm_class_index_null == clsidx)
+    {
+        return(jvm_attribute_index_bad);
+    }
+
+    /* Point to class structure, then look for attribute */
+    ClassFile *pcfs = CLASS_OBJECT_LINKAGE(clsidx)->pcfs;
+
+    /* Prohibit invalid field parameter */
+    if (pcfs->fields_count <= fldidx)
+    {
+        return(jvm_attribute_index_bad);
+    }
+
+    return(attribute_enum_common_find(pcfs,
+                                 pcfs->fields[fldidx]->attributes_count,
+                                      pcfs->fields[fldidx]->attributes,
+                                      atrenum));
+
+} /* END of attribute_find_in_field_by_enum() */
+
+
+/*!
+ * @brief Locate by constant_pool entry the attribute_info index for
+ * an attribute in a method attribute area.
+ *
+ *
+ * @param  clsidx            Class index of class whose method is to be
+ *                             searched for an attribute.
+ *
+ * @param  mthidx            Method index of method to search.
+ *
+ * @param  atrname           UTF8 constant_pool entry of name of
+ *                             attribute name to locate.
+ *
+ * @returns attribute table index of this attribute in method, or
+ *        @link #jvm_attribute_index_bad jvm_attribute_index_bad@endlink
+ *          if not found.
+ *
+ */
+jvm_attribute_index
+    attribute_find_in_method_by_cp_entry(jvm_class_index   clsidx,
+                                         jvm_method_index  mthidx,
+                                         cp_info_dup      *atrname)
+{
+    /* Prohibit invalid class parameter */
+    if (jvm_class_index_null == clsidx)
+    {
+        return(jvm_attribute_index_bad);
+    }
+
+    /* Point to class structure, then look for attribute */
+    ClassFile *pcfs = CLASS_OBJECT_LINKAGE(clsidx)->pcfs;
+
+    /* Prohibit invalid method parameter */
+    if (pcfs->methods_count <= mthidx)
+    {
+        return(jvm_attribute_index_bad);
+    }
+
+    return(
+        attribute_name_common_find(pcfs,
+                                pcfs->methods[mthidx]->attributes_count,
+                                   pcfs->methods[mthidx]->attributes,
+                                   atrname));
+
+} /* END of attribute_find_in_method_by_cp_entry() */
+
+
+/*!
+ * @brief Locate by enumeration the attribute_info index for an
+ * attribute in a method attribute area.
+ *
+ *
+ * @param  clsidx            Class index of class whose method is to be
+ *                             searched for an attribute.
+ *
+ * @param  mthidx            Method index of method to search.
+ *
+ * @param  atrenum           @link #classfile_attribute_enum
+                             LOCAL_xxxx_ATTRIBUTE@endlink enumeration of
+ *                           attribute to locate.
+ *
+ * @returns attribute table index of this attribute in method, or
+ *        @link #jvm_attribute_index_bad jvm_attribute_index_bad@endlink
+ *          if not found.
+ *
+ */
+jvm_attribute_index
+    attribute_find_in_method_by_enum(jvm_class_index          clsidx,
+                                     jvm_method_index         mthidx,
+                                     classfile_attribute_enum atrenum)
+{
+    /* Prohibit invalid class parameter */
+    if (jvm_class_index_null == clsidx)
+    {
+        return(jvm_attribute_index_bad);
+    }
+
+    /* Point to class structure, then look for attribute */
+    ClassFile *pcfs = CLASS_OBJECT_LINKAGE(clsidx)->pcfs;
+
+    /* Prohibit invalid method parameter */
+    if (pcfs->methods_count <= mthidx)
+    {
+        return(jvm_attribute_index_bad);
+    }
+
+    return(attribute_enum_common_find(pcfs,
+                                pcfs->methods[mthidx]->attributes_count,
+                                      pcfs->methods[mthidx]->attributes,
+                                      atrenum));
+
+} /* END of attribute_find_in_method_by_enum() */
+
+
+/*!
+ * @brief Locate by constant_pool entry the attribute_info index for
+ * an attribute in a class attribute area.
+ *
+ *
+ * @param  clsidx            Class index of class be searched for an
+ *                             attribute.
+ *
+ * @param  atrname           UTF8 constant_pool entry of name of
+ *                             attribute name to locate.
+ *
+ * @returns attribute table index of this attribute in class, or
+ *        @link #jvm_attribute_index_bad jvm_attribute_index_bad@endlink
+ *          if not found.
+ *
+ */
+jvm_attribute_index
+    attribute_find_in_class_by_cp_entry(jvm_class_index  clsidx,
+                                        cp_info_dup     *atrname)
+{
+    /* Prohibit invalid class parameter */
+    if (jvm_class_index_null == clsidx)
+    {
+        return(jvm_attribute_index_bad);
+    }
+
+    /* Point to class structure, then look for attribute */
+    ClassFile *pcfs = CLASS_OBJECT_LINKAGE(clsidx)->pcfs;
+
+    return(
+        attribute_name_common_find(pcfs,
+                                   pcfs->attributes_count,
+                                   pcfs->attributes,
+                                   atrname));
+
+} /* END of attribute_find_in_method_by_cp_entry() */
+
+
+/*!
+ * @brief Locate by enumeration the attribute_info index for
+ * an attribute in a class attribute area.
+ *
+ *
+ * @param  clsidx            Class index of class whose method is to be
+ *                             searched for an attribute.
+ *
+ * @param  atrenum           @link #classfile_attribute_enum
+                             LOCAL_xxxx_ATTRIBUTE@endlink enumeration of
+ *                           attribute to locate.
+ *
+ * @returns attribute table index of this attribute in class, or
+ *        @link #jvm_attribute_index_bad jvm_attribute_index_bad@endlink
+ *          if not found.
+ *
+ */
+jvm_attribute_index
+    attribute_find_in_class_by_enum(jvm_class_index          clsidx,
+                                    classfile_attribute_enum atrenum)
+{
+    /* Prohibit invalid class parameter */
+    if (jvm_class_index_null == clsidx)
+    {
+        return(jvm_attribute_index_bad);
+    }
+
+    /* Point to class structure, then look for attribute */
+    ClassFile *pcfs = CLASS_OBJECT_LINKAGE(clsidx)->pcfs;
+
+    return(attribute_enum_common_find(pcfs,
+                                      pcfs->attributes_count,
+                                      pcfs->attributes,
+                                      atrenum));
+
+} /* END of attribute_find_in_class_by_enum() */
+
+
+/* EOF */