harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dlyd...@apache.org
Subject svn commit: r326481 [1/2] - in /incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src: argv.c exit.c field.c heap.h heap_bimodal.c heap_simple.c jvm.h main.c manifest.c nts.c tmparea.c utf.c util.h
Date Wed, 19 Oct 2005 08:42:15 GMT
Author: dlydick
Date: Wed Oct 19 01:41:30 2005
New Revision: 326481

URL: http://svn.apache.org/viewcvs?rev=326481&view=rev
Log:
Substitute portable_XXX() version of system calls and library calls.

Updated ARCH_xxx() macros for better diagnostic support.

Minor documentation adjustments.

Modified:
    incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/argv.c
    incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/exit.c
    incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/field.c
    incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/heap.h
    incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/heap_bimodal.c
    incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/heap_simple.c
    incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jvm.h
    incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/main.c
    incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/manifest.c
    incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/nts.c
    incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/tmparea.c
    incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/utf.c
    incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/util.h

Modified: 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=326481&r1=326480&r2=326481&view=diff
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/argv.c (original)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/argv.c Wed Oct 19 01:41:30 2005
@@ -27,7 +27,9 @@
  *
  * @section Control
  *
- * \$URL$ \$Id$
+ * \$URL$
+ *
+ * \$Id$
  *
  * Copyright 2005 The Apache Software Foundation
  * or its licensors, as applicable.
@@ -51,6 +53,7 @@
  * @date \$LastChangedDate$
  *
  * @author \$LastChangedBy$
+ *
  *         Original code contributed by Daniel Lydick on 09/28/2005.
  *
  * @section Reference
@@ -58,11 +61,13 @@
  */
 
 #include "arch.h"
-ARCH_COPYRIGHT_APACHE(argv, c ,"$URL$ $Id$");
+ARCH_SOURCE_COPYRIGHT_APACHE(argv, c,
+"$URL$",
+"$Id$");
 
 
-#include <stdlib.h>
-#include <string.h>
+/* #include <stdlib.h> */
+/* #include <string.h> */
 
 #include "jvmcfg.h" 
 #include "classfile.h" 
@@ -101,6 +106,7 @@
  * main_pgm_name -show
  *               -version
  *               -copyright
+ *               -license
  *               -help
  * @endcode
  *
@@ -115,13 +121,23 @@
  *
  *
  * @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)
 {
+    ARCH_FUNCTION_NAME(argv_init);
+
+    rint     argclocal = (rint)     argc;
+    rchar ** argvlocal = (rchar **) argv;
+    rchar ** envplocal = (rchar **) envp;
+
     rchar *chkjh;  chkjh =  (rchar *) rnull;
     rchar *chkcp;  chkcp =  (rchar *) rnull;
     rchar *chkbcp; chkbcp = (rchar *) rnull;
@@ -130,14 +146,22 @@
     pjvm->startclass = (rchar *) rnull;
 
     /* Save off startup parameters, incl. pgm name (argv0) */
-    pjvm->argc = argc;
-    pjvm->argv = argv;
-    pjvm->envp = envp;
+    pjvm->argc = argclocal;
+    pjvm->argv = argvlocal;
+    pjvm->envp = envplocal;
 
     /* Extract program name from path, defaulting to whole invocation */
-    pjvm->argv0 = argv[0];
-    pjvm->argv0name = strrchr(pjvm->argv0,
-                              JVMCFG_PATHNAME_DELIMITER_CHAR);
+    pjvm->argv0 = argvlocal[0];
+    pjvm->argv0name = portable_strrchr(pjvm->argv0,
+                                       JVMCFG_PATHNAME_DELIMITER_CHAR);
+#ifdef CONFIG_CYGWIN
+    if (rnull == pjvm->argv0name)
+    {
+        pjvm->argv0name = portable_strrchr(pjvm->argv0,
+                                    JVMCFG_PATHNAME_ALT_DELIMITER_CHAR);
+    }
+#endif
+
     if (rnull != pjvm->argv0name)
     {
         pjvm->argv0name++;
@@ -152,9 +176,9 @@
      * @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);
+    chkjh  = portable_getenv(JVMCFG_ENVIRONMENT_VARIABLE_JAVA_HOME);
+    chkcp  = portable_getenv(JVMCFG_ENVIRONMENT_VARIABLE_CLASSPATH);
+    chkbcp = portable_getenv(JVMCFG_ENVIRONMENT_VARIABLE_BOOTCLASSPATH);
 
     /*
      * Look in command line, scan WHOLE command line for
@@ -164,33 +188,37 @@
     rint  i;
     rint show_flag = rfalse;
 
-    for (i = 1; i < argc; i++)
+    for (i = 1; i < argclocal; i++)
     {
         /*
          * Options that terminate program execution
          */
-        if (0 == strcmp(JVMCFG_COMMAND_LINE_HELP_PARM, argv[i]))
+        if (0 == portable_strcmp(JVMCFG_COMMAND_LINE_HELP_PARM,
+                                 argvlocal[i]))
         {
             argv_helpmsg();
             exit_jvm(EXIT_ARGV_HELP);
 /*NOTREACHED*/
         }
         else
-        if (0 == strcmp(JVMCFG_COMMAND_LINE_LICENSE_PARM, argv[i]))
+        if (0 == portable_strcmp(JVMCFG_COMMAND_LINE_LICENSE_PARM,
+                                 argvlocal[i]))
         {
             argv_licensemsg();
             exit_jvm(EXIT_ARGV_LICENSE);
 /*NOTREACHED*/
         }
         else
-        if (0 == strcmp(JVMCFG_COMMAND_LINE_VERSION_PARM, argv[i]))
+        if (0 == portable_strcmp(JVMCFG_COMMAND_LINE_VERSION_PARM,
+                                 argvlocal[i]))
         {
             argv_versionmsg();
             exit_jvm(EXIT_ARGV_VERSION);
 /*NOTREACHED*/
         }
         else
-        if (0 == strcmp(JVMCFG_COMMAND_LINE_COPYRIGHT_PARM, argv[i]))
+        if (0 == portable_strcmp(JVMCFG_COMMAND_LINE_COPYRIGHT_PARM,
+                                 argvlocal[i]))
         {
             argv_copyrightmsg();
             exit_jvm(EXIT_ARGV_COPYRIGHT);
@@ -200,7 +228,8 @@
         /*
          * Reporting options
          */
-        if (0 == strcmp(JVMCFG_COMMAND_LINE_SHOW_PARM, argv[i]))
+        if (0 == portable_strcmp(JVMCFG_COMMAND_LINE_SHOW_PARM,
+                                 argvlocal[i]))
         {
             /* Display command line parms after parsing */
             show_flag = rtrue;
@@ -211,44 +240,54 @@
          * 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 ((0 == portable_strcmp(JVMCFG_JAVA_HOME_ABBREV_PARM,
+                                                       argvlocal[i])) ||
+            (0 == portable_strcmp(JVMCFG_JAVA_HOME_MID_PARM,
+                                                       argvlocal[i])) ||
+            (0 == portable_strcmp(JVMCFG_JAVA_HOME_FULL_PARM,
+                                                       argvlocal[i])))
         {
-            if (argc - 1 > i)
+            if (argclocal - 1 > i)
             {
-                chkjh = argv[i + 1];
+                chkjh = argvlocal[i + 1];
                 i++;
             }
         }
         else
-        if ((0 == strcmp(JVMCFG_CLASSPATH_ABBREV_PARM, argv[i])) ||
-            (0 == strcmp(JVMCFG_CLASSPATH_FULL_PARM, argv[i])))
+        if ((0 == portable_strcmp(JVMCFG_CLASSPATH_ABBREV_PARM,
+                                  argvlocal[i])) ||
+            (0 == portable_strcmp(JVMCFG_CLASSPATH_FULL_PARM,
+                                  argvlocal[i])))
         {
-            if (argc - 1 > i)
+            if (argclocal - 1 > i)
             {
-                chkcp = argv[i + 1];
+                chkcp = argvlocal[i + 1];
                 i++;
             }
         }
         else
-        if ((0 == strcmp(JVMCFG_BOOTCLASSPATH_ABBREV_PARM, argv[i])) ||
-            (0 == strcmp(JVMCFG_BOOTCLASSPATH_FULL_PARM, argv[i])))
+        if ((0 == portable_strcmp(JVMCFG_BOOTCLASSPATH_ABBREV_PARM,
+                                  argvlocal[i])) ||
+            (0 == portable_strcmp(JVMCFG_BOOTCLASSPATH_FULL_PARM,
+                                  argvlocal[i])))
         {
-            if (argc - 1 > i)
+            if (argclocal - 1 > i)
             {
-                chkbcp = argv[i + 1];
+                chkbcp = argvlocal[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 ((0 == portable_strcmp(JVMCFG_DEBUGMSGLEVEL_ABBREV_PARM,
+                                                       argvlocal[i])) ||
+            (0 == portable_strcmp(JVMCFG_DEBUGMSGLEVEL_MID_PARM,
+                                                       argvlocal[i])) ||
+            (0 == portable_strcmp(JVMCFG_DEBUGMSGLEVEL_FULL_PARM,
+                                                       argvlocal[i])))
         {
-            if (argc - 1 > i)
+            if (argclocal - 1 > i)
             {
-                rint chkdml = atol(argv[i + 1]);
+                rint chkdml = portable_atol(argvlocal[i + 1]);
 
                 if ((DMLOFF == chkdml) ||
                     ((DMLMIN <= chkdml) && (DMLMAX >= chkdml)))
@@ -256,13 +295,13 @@
                     jvmutil_set_dml(chkdml);
 
                  /* sysDbgMsg(DMLMIN, */
-                    sysErrMsg("argv_init",
+                    sysErrMsg(arch_function_name,
                               "debug message level %d",
                               chkdml);
                 }
                 else
                 {
-                    sysErrMsg("argv_init",
+                    sysErrMsg(arch_function_name,
                            "invalid debug message level %d.  Ignored",
                               chkdml);
                 }
@@ -275,11 +314,12 @@
          * Java class to run (terminates option scanning),
          * either JAR or class file.
          */
-        if (0 == strcmp(JVMCFG_JARFILE_STARTCLASS_PARM, argv[i]))
+        if (0 == portable_strcmp(JVMCFG_JARFILE_STARTCLASS_PARM,
+                                 argvlocal[i]))
         {
-            if (argc - 1 > i)
+            if (argclocal - 1 > i)
             {
-                pjvm->startjar = argv[i + 1];
+                pjvm->startjar = argvlocal[i + 1];
                 i++;
                 i++;
             }
@@ -289,7 +329,7 @@
         else
         {
             /* If not a -xxxxx token, it must be the startup class */
-            pjvm->startclass = argv[i];
+            pjvm->startclass = argvlocal[i];
             i++;
 
             break; /* End of token parsing.  Quit for() loop */
@@ -304,14 +344,14 @@
 
     /* Add 1 NUL byte at the end, initialize to zeroes (NUL) */
     pjvm->argcj = 0;
-    pjvm->argvj = HEAP_GET_DATA(sizeof(rchar *) * ( 1 + argc - i),
+    pjvm->argvj = HEAP_GET_DATA(sizeof(rchar *) * ( 1 + argclocal - i),
                                 rtrue);
 
     /*
      * If any @b argv parms left, load them into
      * @c @b pjvm->argvj
      */
-    if (i < argc)
+    if (i < argclocal)
     {
         /*
          * Keep scanning @c @b argv[] , only initialization
@@ -320,17 +360,17 @@
 
         /* @warning  NON-STANDARD TERMINATION CONDITION <= VERSUS < */
         rint j;
-        for (j = 0; i <= argc; i++, j++)
+        for (j = 0; i <= argclocal; i++, j++)
         {
             /* Done when all @b argv is scanned and NUL byte added */
-            if (i == argc)
+            if (i == argclocal)
             {
                 pjvm->argvj[j] = (rchar *) rnull;
                 break;
             }
 
             pjvm->argcj++;
-            pjvm->argvj[j] = argv[i];
+            pjvm->argvj[j] = argvlocal[i];
         }
     }
 
@@ -343,10 +383,12 @@
     if (rnull != chkjh)
     {
         /* Copy '\0' byte also*/
-        pjvm->java_home = HEAP_GET_DATA(sizeof(rchar) + strlen(chkjh),
-                                        rfalse);
+        pjvm->java_home =
+          HEAP_GET_DATA(sizeof(rchar) + portable_strlen(chkjh), rfalse);
 
-        memcpy(pjvm->java_home, chkjh, sizeof(rchar) + strlen(chkjh));
+        portable_memcpy(pjvm->java_home,
+                        chkjh,
+                        sizeof(rchar) + portable_strlen(chkjh));
     }
 
     /* Try to get a valid @b CLASSPATH even if not found elsewhere */
@@ -358,10 +400,13 @@
     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));
+        pjvm->classpath =
+            HEAP_GET_DATA(sizeof(rchar) + portable_strlen(chkcp),
+                          rfalse);
+
+        portable_memcpy(pjvm->classpath,
+                        chkcp, 
+                        sizeof(rchar) + portable_strlen(chkcp));
     }
 #ifdef JVMCFG_HARDCODED_TEST_CLASSPATH
     pjvm->classpath = JVMCFG_HARDCODED_TEST_CLASSPATH;
@@ -381,13 +426,12 @@
     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));
+        pjvm->bootclasspath =
+          HEAP_GET_DATA(sizeof(rchar) + portable_strlen(chkbcp),rfalse);
+
+        portable_memcpy(pjvm->bootclasspath,
+                        chkbcp,
+                        sizeof(rchar) + portable_strlen(chkbcp));
     }
 
     /* Show summary of what command line resoved into */
@@ -414,11 +458,13 @@
  * @b Parameters: @link #rvoid rvoid@endlink
  *
  *
- *       @returns @link #rvoid rvoid@endlink
+ * @returns @link #rvoid rvoid@endlink
  *
  */
 rvoid argv_versionmsg(rvoid)
 {
+    ARCH_FUNCTION_NAME(argv_versionmsg);
+
     fprintfLocalStdout("%s\n", CONFIG_RELEASE_LEVEL);
 
     return;
@@ -433,11 +479,13 @@
  * @b Parameters: @link #rvoid rvoid@endlink
  *
  *
- *       @returns @link #rvoid rvoid@endlink
+ * @returns @link #rvoid rvoid@endlink
  *
  */
 rvoid argv_copyrightmsg(rvoid)
 {
+    ARCH_FUNCTION_NAME(argv_copyrightmsg);
+
     fprintfLocalStdout("\n%s:  %s, version %s\n%s\n\n",
                        CONFIG_PROGRAM_NAME,
                        CONFIG_PROGRAM_DESCRIPTION,
@@ -456,11 +504,13 @@
  * @b Parameters: @link #rvoid rvoid@endlink
  *
  *
- *       @returns @link #rvoid rvoid@endlink
+ * @returns @link #rvoid rvoid@endlink
  *
  */
 rvoid argv_licensemsg(rvoid)
 {
+    ARCH_FUNCTION_NAME(argv_licensemsg);
+
     argv_copyrightmsg();
     fprintfLocalStdout("%s\n\n", ARCH_LICENSE_TEXT_APACHE);
 
@@ -478,11 +528,13 @@
  * @b Parameters: @link #rvoid rvoid@endlink
  *
  *
- *       @returns @link #rvoid rvoid@endlink
+ * @returns @link #rvoid rvoid@endlink
  *
  */
 rvoid argv_helpmsg(rvoid)
 {
+    ARCH_FUNCTION_NAME(argv_helpmsg);
+
     argv_copyrightmsg();
 
     fprintfLocalStdout(
@@ -615,11 +667,13 @@
  * @b Parameters: @link #rvoid rvoid@endlink
  *
  *
- *       @returns @link #rvoid rvoid@endlink
+ * @returns @link #rvoid rvoid@endlink
  *
  */
 rvoid argv_showmsg(rvoid)
 {
+    ARCH_FUNCTION_NAME(argv_showmsg);
+
     fprintfLocalStdout("JAVA_HOME=%s\n", pjvm->java_home);
 
     fprintfLocalStdout("CLASSPATH=%s\n", pjvm->classpath);
@@ -672,11 +726,13 @@
  * @b Parameters: @link #rvoid rvoid@endlink
  *
  *
- *       @returns @link #rvoid rvoid@endlink
+ * @returns @link #rvoid rvoid@endlink
  *
  */
 rvoid argv_shutdown(rvoid)
 {
+    ARCH_FUNCTION_NAME(argv_shutdown);
+
     HEAP_FREE_DATA(pjvm->bootclasspath);
     pjvm->bootclasspath = (rchar *) rnull;
 
@@ -692,7 +748,7 @@
         HEAP_FREE_DATA(pjvm->argvj[argidx]);
     }
     HEAP_FREE_DATA(pjvm->argvj);
-    pjvm->argvj = (char **) rnull;
+    pjvm->argvj = (rchar **) rnull;
 
     /* Declare this module uninitialized */
     jvm_argv_initialized = rfalse;

Modified: incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/exit.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/exit.c?rev=326481&r1=326480&r2=326481&view=diff
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/exit.c (original)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/exit.c Wed Oct 19 01:41:30 2005
@@ -14,7 +14,7 @@
  * design of @c @b longjmp(3), which will force
  * @link #EXIT_LONGJMP_ARGERROR EXIT_LONGJMP_ARGERROR@endlink instead.
  *
- * @link #exit_init() exit_init()@endlink must be invoked at a
+ * @link #EXIT_INIT() EXIT_INIT()@endlink must be invoked at a
  * higher level than where @link #pjvm pjvm@endlink is used to
  * access anything, namely, @c @b pjvm->xxx since the
  * main JVM structure cannot be initialized at the same time
@@ -22,7 +22,7 @@
  * It typically will be armed at the very entry to the JVM and
  * will never be re-armed since it is global in its scope of coverage.
  *
- * @link #exit_exception_setup() exit_exception_setup()@endlink
+ * @link #EXIT_EXCEPTION_SETUP() EXIT_EXCEPTION_SETUP()@endlink
  * has similar requirements.  However, since it is involved more
  * closely with @link #jvm_init() jvm_init()@endlink, it is typically
  * invoked at the beginning of that function.  Once initialization
@@ -33,7 +33,7 @@
  * JVMCLASS_JAVA_LANG_LINKAGEERROR@endlink subclasses through
  * the virtual execution engine before shutting down the JVM.
  *
- * @link #exit_end_thread_setup() exit_end_thread_setup()@endlink
+ * @link #OPCODE_END_THREAD_SETUP() OPCODE_END_THREAD_SETUP()@endlink
  * is not so much an error handler as a simplification of the JVM
  * inner loop execution in @link #opcode_run() opcode_run()@endlink
  * that eliminates the need for two of the tests needed for continuing
@@ -46,7 +46,9 @@
  *
  * @section Control
  *
- * \$URL$ \$Id$
+ * \$URL$
+ *
+ * \$Id$
  *
  * Copyright 2005 The Apache Software Foundation
  * or its licensors, as applicable.
@@ -70,6 +72,7 @@
  * @date \$LastChangedDate$
  *
  * @author \$LastChangedBy$
+ *
  *         Original code contributed by Daniel Lydick on 09/28/2005.
  *
  * @section Reference
@@ -77,11 +80,12 @@
  */
 
 #include "arch.h"
-ARCH_COPYRIGHT_APACHE(exit, c, "$URL$ $Id$");
+ARCH_SOURCE_COPYRIGHT_APACHE(exit, c,
+"$URL$",
+"$Id$");
 
 
-#include <setjmp.h>
-
+#define PORTABLE_JMP_BUF_VISIBLE
 #include "jvmcfg.h"
 #include "classfile.h"
 #include "jvm.h"
@@ -104,6 +108,8 @@
  */
 rchar *exit_get_name(exit_code_enum code)
 {
+    ARCH_FUNCTION_NAME(exit_get_name);
+
     switch(code)
     {
         case EXIT_MAIN_OKAY:        return(EXIT_MAIN_OKAY_DESC);
@@ -137,18 +143,9 @@
 } /* END of exit_get_name() */
 
 
-/*! 
- * Handler linkage for fatal errors.  Does not need global visibility,
- * just needs file scope.
- */
-static jmp_buf exit_general_failure;
+/* Moved to portability library:  static jmp_buf exit_general_failure;*/
 
-
-/*!
- * Handler linkage for @b LinkageError.  Does not need global
- * visibility, just needs file scope.
- */
-static jmp_buf exit_LinkageError;
+/* Moved to portability library:  static jmp_buf exit_LinkageError; */
 
 
 /*!
@@ -168,61 +165,32 @@
 
 
 /*!
- * @brief Global handler setup for fatal JVM errors-- implements
- * @c @b setjmp(3).
- *
- * @b Parameters: @link #rvoid rvoid@endlink
- *
- *
- * @returns From normal setup, integer @link
-            #EXIT_MAIN_OKAY EXIT_MAIN_OKAY@endlink.  Otherwise,
- *          return error code from @link #exit_jvm() exit_jvm()@endlink,
- *          typically using a code found in
- *          @link jvm/src/exit.h exit.h@endlink
- */
-
-int exit_init()
-{
-    /* Return point from @c @b longjmp(3) as declared in exit_jvm() */
-    return(setjmp(exit_general_failure));
-
-} /* END of exit_init() */
-
-
-
-/*!
- * @brief Global handler setup for fatal
+ * @brief Global handler setup (part 1) for fatal
  * @link jvm_init() jvm_init()@endlink errors and other
  * @c @b java.lang.Throwable events-- implements
  * @c @b setjmp(3).
  *
  *
- * Use this function to arm handler for throwing
- * @c @b java.lang.Error and @c @b java.lang.Exception
- * throwable events.
+ * This function @e must be used in conjunction with
+ * @link EXIT_EXCEPTION_SETUP() EXIT_EXCEPTION_SETUP()@endlink
+ * to properly arm handler for throwing @c @b java.lang.Error and
+ * @c @b java.lang.Exception throwable events.
  *
  * @b Parameters: @link #rvoid rvoid@endlink
  *
  *
- * @returns From normal setup, integer
- *          @link #EXIT_MAIN_OKAY EXIT_MAIN_OKAY@endlink.
- *          Otherwise, return
- *          @link #exit_code_enum exit code enumeration@endlink from
- *          @link #exit_jvm() exit_jvm()@endlink.
+ * @returns @link #rvoid rvoid@endlink
  *
  */
 
-int exit_exception_setup(rvoid)
+rvoid exit_exception_setup(rvoid)
 {
+    ARCH_FUNCTION_NAME(exit_exception_setup);
 
     exit_LinkageError_subclass = (rchar *) rnull;
     exit_LinkageError_thridx   = jvm_thread_index_null;
 
-    /*
-     * Return point from @c @b longjmp(3) as declared
-     * in @link #exit_throw_exception() exit_throw_exception()@endlink
-     */
-    return(setjmp(exit_LinkageError));
+    return;
 
 } /* END of exit_exception_setup() */
 
@@ -271,9 +239,10 @@
              JVMCLASS_JAVA_LANG_VERIFYERROR@endlink </li>
  * </ul>
  *
+ *
  * @returns non-local state restoration from setup via @c @b setjmp(3)
- *          as stored in @link
-            #exit_LinkageError exit_LinkageError@endlink
+ *          as stored in @link #portable_exit_LinkageError
+            portable_exit_LinkageError@endlink
  *          buffer by @link #exit_init() exit_init()@endlink
  *          in @link #jvm_init() jvm_init()@endlink before any of
  *          these errors could occur. All code invoking this
@@ -286,13 +255,15 @@
 
 rvoid exit_throw_exception(exit_code_enum rcenum, rchar *preason)
 {
+    ARCH_FUNCTION_NAME(exit_throw_exception);
+
     /* Report error class to handler */
     exit_LinkageError_subclass = preason;
     exit_LinkageError_thridx   = CURRENT_THREAD;
 
     /* Returns to @c @b setjmp(3) */
     int rc = (int) rcenum;
-    longjmp(exit_LinkageError, rc);
+    PORTABLE_LONGJMP(&portable_exit_LinkageError, rc);
 /*NOTREACHED*/
 
 } /* END of exit_throw_exception() */
@@ -306,20 +277,23 @@
  *
  *
  * @returns non-local state restoration from setup via @c @b setjmp(3)
- *          above as stored in @link
-            #exit_general_failure exit_general_failure@endlink.
+ *          above as stored in @link #portable_exit_general_failure
+            portable_exit_general_failure@endlink.
  *          All code invoking this function should use the
  *          standard @c @b lint(1) comment for "code not reached" as
  *          shown after the @c @b longjmp(3) function call in
  *          the source code of this function:
  *          <b>/</b><b>*NOTREACHED*</b><b>/</b>
+ *
  */
 
 rvoid exit_jvm(exit_code_enum rcenum)
 {
+    ARCH_FUNCTION_NAME(exit_jvm);
+
     /* Returns to @c @b setjmp(3) as declared in exit_jvm() */
     int rc = (int) rcenum;
-    longjmp(exit_general_failure, rc);
+    PORTABLE_LONGJMP(&portable_exit_general_failure, rc);
 /*NOTREACHED*/
 
 } /* END of exit_jvm() */

Modified: incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/field.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/field.c?rev=326481&r1=326480&r2=326481&view=diff
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/field.c (original)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/field.c Wed Oct 19 01:41:30 2005
@@ -6,7 +6,9 @@
  *
  * @section Control
  *
- * \$URL$ \$Id$
+ * \$URL$
+ *
+ * \$Id$
  *
  * Copyright 2005 The Apache Software Foundation
  * or its licensors, as applicable.
@@ -30,6 +32,7 @@
  * @date \$LastChangedDate$
  *
  * @author \$LastChangedBy$
+ *
  *         Original code contributed by Daniel Lydick on 09/28/2005.
  *
  * @section Reference
@@ -37,10 +40,12 @@
  */
 
 #include "arch.h"
-ARCH_COPYRIGHT_APACHE(field, c, "$URL$ $Id$");
+ARCH_SOURCE_COPYRIGHT_APACHE(field, c,
+"$URL$",
+"$Id$");
 
 
-#include <strings.h>
+/* #include <strings.h> */
 
 #include "jvmcfg.h"
 #include "cfmacros.h"
@@ -60,13 +65,13 @@
  *
  *
  * @param  clsidx            Class index of class whose field is to be
- *                             located.
+ *                           located.
  *
- * @param  fldname           UTF8 constant_pool entry of name of field
- *                             in class.
+ * @param  fldname           UTF8 @c @b constant_pool entry of name of
+ *                           field in class.
  *
- * @param  flddesc           UTF8 constant_pool entry of description of
- *                             field type.
+ * @param  flddesc           UTF8 @c @b constant_pool entry of
+ *                           description of field type.
  *
  *
  * @returns field table index of this field in class or
@@ -87,6 +92,8 @@
                                        cp_info_dup     *fldname,
                                        cp_info_dup     *flddesc)
 {
+    ARCH_FUNCTION_NAME(field_find_by_cp_entry);
+
     /* Prohibit invalid parameter */
     if (jvm_class_index_null == clsidx)
     {
@@ -141,6 +148,8 @@
 rboolean field_index_is_class_static(jvm_class_index clsidx,
                                      jvm_field_index fldidx)
 {
+    ARCH_FUNCTION_NAME(field_index_is_class_static);
+
     /* Prohibit invalid parameter */
     if (jvm_field_index_bad == fldidx)
     {
@@ -175,13 +184,14 @@
  *
  *
  * @param  clsidx            Class index of class whose field is to be
- *                             located.
+ *                           located.
  *
- * @param  fldname           UTF8 constant_pool entry of name of field
- *                             in class.
+ * @param  fldname           UTF8 @c @b constant_pool entry of name of
+ *                           field in class.
+ *
+ * @param  flddesc           UTF8 @c @b constant_pool entry of
+ *                           description of field type.
  *
- * @param  flddesc           UTF8 constant_pool entry of description of
- *                             field type.
  *
  * @returns @link #rtrue rtrue@endlink if this field is a class static
  *          field, otherwise @link #rfalse rfalse@endlink.
@@ -191,6 +201,8 @@
                                     cp_info_dup     *fldname,
                                     cp_info_dup     *flddesc)
 {
+    ARCH_FUNCTION_NAME(field_name_is_class_static);
+
     return(field_index_is_class_static(
                clsidx,
                field_find_by_cp_entry(clsidx, fldname, flddesc)));
@@ -216,6 +228,8 @@
 rboolean field_index_is_object_instance(jvm_class_index clsidx,
                                         jvm_field_index fldidx)
 {
+    ARCH_FUNCTION_NAME(field_index_is_object_instance);
+
     /* Prohibit invalid parameter */
     if (jvm_field_index_bad == fldidx)
     {
@@ -250,13 +264,13 @@
  *
  *
  * @param  clsidx            Class index of class whose field is to be
- *                             located.
+ *                           located.
  *
- * @param  fldname           UTF8 constant_pool entry of name of field
- *                             in class.
+ * @param  fldname           UTF8 @c @b constant_pool entry of name of
+ *                           field in class.
  *
- * @param  flddesc           UTF8 constant_pool entry of description of
- *                             field type.
+ * @param  flddesc           UTF8 @c @b constant_pool entry of
+ *                           description of field type.
  *
  *
  * @returns @link #rtrue rtrue@endlink if this field is an object
@@ -267,6 +281,8 @@
                                        cp_info_dup     *fldname,
                                        cp_info_dup     *flddesc)
 {
+    ARCH_FUNCTION_NAME(field_name_is_object_instance);
+
     return(field_index_is_object_instance(
                clsidx,
                field_find_by_cp_entry(clsidx, fldname, flddesc)));
@@ -293,6 +309,8 @@
     field_index_get_class_static_lookup(jvm_class_index  clsidx,
                                         jvm_field_index fldidx)
 {
+    ARCH_FUNCTION_NAME(field_index_get_class_static_lookup);
+
     /* Prohibit invalid parameter */
     if (jvm_field_index_bad == fldidx)
     {
@@ -327,13 +345,14 @@
  *
  *
  * @param  clsidx            Class index of class whose field is to be
- *                             located.
+ *                           located.
+ *
+ * @param  fldname           UTF8 @c @b constant_pool entry of name of
+ *                           field in class.
  *
- * @param  fldname           UTF8 constant_pool entry of name of field
- *                             in class.
+ * @param  flddesc           UTF8 @c @b constant_pool entry of
+ *                           description of field type.
  *
- * @param  flddesc           UTF8 constant_pool entry of description of
- *                             field type.
  *
  * @returns class static field lookup index of located field, otherwise
  *          @link #jvm_field_index_bad jvm_field_index_bad@endlink.
@@ -344,6 +363,8 @@
                                        cp_info_dup     *fldname,
                                        cp_info_dup     *flddesc)
 {
+    ARCH_FUNCTION_NAME(field_name_get_class_static_lookup);
+
     return(field_index_get_class_static_lookup(
                clsidx,
                field_find_by_cp_entry(clsidx, fldname, flddesc)));
@@ -372,6 +393,8 @@
     field_index_get_object_instance_lookup(jvm_class_index  clsidx,
                                            jvm_field_index fldidx)
 {
+    ARCH_FUNCTION_NAME(field_ndex_get_object_instance_lookup);
+
     /* Prohibit invalid parameter */
     if (jvm_field_index_bad == fldidx)
     {
@@ -406,13 +429,13 @@
  *
  *
  * @param  clsidx            Class index of class whose field is to be
- *                             located.
+ *                           located.
  *
- * @param  fldname           UTF8 constant_pool entry of name of field
- *                             in class.
+ * @param  fldname           UTF8 @c @b constant_pool entry of name of
+ *                           field in class.
  *
- * @param  flddesc           UTF8 constant_pool entry of description of
- *                             field type.
+ * @param  flddesc           UTF8 @c @b constant_pool entry of
+ *                           description of field type.
  *
  *
  * @returns object instance field lookup index of located field,
@@ -425,6 +448,8 @@
                                           cp_info_dup     *fldname,
                                           cp_info_dup     *flddesc)
 {
+    ARCH_FUNCTION_NAME(field_name_get_object_instance_lookup);
+
     return(field_index_get_object_instance_lookup(
                clsidx,
                field_find_by_cp_entry(clsidx, fldname, flddesc)));
@@ -451,6 +476,8 @@
 jvalue *field_index_get_class_static_pjvalue(jvm_class_index  clsidx,
                                              jvm_field_index fldidx)
 {
+    ARCH_FUNCTION_NAME(field_index_get_class_static_pjvalue);
+
     /* Prohibit invalid parameter */
     if (jvm_field_index_bad == fldidx)
     {
@@ -484,13 +511,13 @@
  *
  *
  * @param  clsidx            Class index of class whose field is to be
- *                             located.
+ *                           located.
  *
- * @param  fldname           UTF8 constant_pool entry of name of field
- *                             in class.
+ * @param  fldname           UTF8 @c @b constant_pool entry of name of
+ *                           field in class.
  *
- * @param  flddesc           UTF8 constant_pool entry of description of
- *                             field type.
+ * @param  flddesc           UTF8 @c @b constant_pool entry of
+ *                           description of field type.
  *
  *
  * @returns pointer to class static field data, otherwise
@@ -501,6 +528,8 @@
                                             cp_info_dup     *fldname,
                                             cp_info_dup     *flddesc)
 {
+    ARCH_FUNCTION_NAME(field_name_get_class_static_pjvalue);
+
     return(field_index_get_class_static_pjvalue(
                clsidx,
                field_find_by_cp_entry(clsidx, fldname, flddesc)));
@@ -526,6 +555,8 @@
 jvalue *field_index_get_object_instance_pjvalue(jvm_object_hash objhash,
                                                 jvm_field_index fldidx)
 {
+    ARCH_FUNCTION_NAME(field_index_get_object_instance_pjvalue);
+
     jvm_class_index clsidx = OBJECT_CLASS_LINKAGE(objhash)->clsidx;
 
     jvm_field_lookup_index oifldidx;
@@ -556,13 +587,13 @@
  *
  *
  * @param  objhash           Object hash of object whose field is to be
- *                             located.
+ *                           located.
  *
- * @param  fldname           UTF8 constant_pool entry of name of field
- *                             in class.
+ * @param  fldname           UTF8 @c @b constant_pool entry of name of
+ *                           field in class.
  *
- * @param  flddesc           UTF8 constant_pool entry of description of
- *                             field type.
+ * @param  flddesc           UTF8 @c @b constant_pool entry of
+ *                           description of field type.
  *
  *
  * @returns Pointer to object instance field data, otherwise
@@ -573,6 +604,8 @@
                                                cp_info_dup     *fldname,
                                                cp_info_dup     *flddesc)
 {
+    ARCH_FUNCTION_NAME(field_name_get_object_instance_pjvalue);
+
     return(field_index_get_object_instance_pjvalue(
                objhash,
                field_find_by_cp_entry(
@@ -593,7 +626,6 @@
  *
  * @param  fldidx            Field index in class of field to be stored.
  *
- *
  * @param  _jvalue           Data to be stored.
  *
  *
@@ -607,6 +639,8 @@
                                          jvm_field_index  fldidx,
                                          jvalue          *_jvalue)
 {
+    ARCH_FUNCTION_NAME(field_index_put_class_static_pjvalue);
+
     /* Prohibit invalid parameter */
     if (jvm_field_index_bad == fldidx)
     {
@@ -625,9 +659,10 @@
         if (fldidx ==
             (CLASS(clsidx).class_static_field_lookup)[csflidx])
         {
-            memcpy(&CLASS(clsidx).class_static_field_data[csflidx],
-                   _jvalue,
-                   sizeof(jvalue));
+            portable_memcpy(
+                &CLASS(clsidx).class_static_field_data[csflidx],
+                _jvalue,
+                sizeof(jvalue));
             return(fldidx);
         }
     }
@@ -644,13 +679,13 @@
  *
  *
  * @param  clsidx            Class index of class whose field is to be
- *                             stored.
+ *                           stored.
  *
- * @param  fldname           UTF8 constant_pool entry of name of field
- *                             in class.
+ * @param  fldname           UTF8 @c @b constant_pool entry of name of
+ *                           field in class.
  *
- * @param  flddesc           UTF8 constant_pool entry of description of
- *                             field type.
+ * @param  flddesc           UTF8 @c @b constant_pool entry of
+ *                           description of field type.
  *
  * @param  _jvalue           Data to be stored.
  *
@@ -666,6 +701,8 @@
                                         cp_info_dup     *flddesc,
                                         jvalue          *_jvalue)
 {
+    ARCH_FUNCTION_NAME(field_name_put_class_static_pjvalue);
+
     return(field_index_put_class_static_pjvalue(
                clsidx,
                field_find_by_cp_entry(clsidx,
@@ -698,6 +735,8 @@
                                             jvm_field_index  fldidx,
                                             jvalue          *_jvalue)
 {
+    ARCH_FUNCTION_NAME(field_index_put_object_instance_pjvalue);
+
     jvm_class_index clsidx = OBJECT_CLASS_LINKAGE(objhash)->clsidx;
 
     jvm_field_lookup_index oifldidx;
@@ -712,9 +751,10 @@
         if (fldidx ==
             (CLASS(clsidx).object_instance_field_lookup)[oifldidx])
         {
-           memcpy(&OBJECT(objhash).object_instance_field_data[oifldidx],
-                   _jvalue,
-                   sizeof(jvalue));
+           portable_memcpy(
+                &OBJECT(objhash).object_instance_field_data[oifldidx],
+                _jvalue,
+                sizeof(jvalue));
             return(fldidx);
         }
     }
@@ -731,13 +771,13 @@
  *
  *
  * @param  objhash           Object hash of object whose field is to be
- *                             located.
+ *                           located.
  *
- * @param  fldname           UTF8 constant_pool entry of name of field
- *                             in class.
+ * @param  fldname           UTF8 @c @b constant_pool entry of name of
+ *                           field in class.
  *
- * @param  flddesc           UTF8 constant_pool entry of description of
- *                             field type.
+ * @param  flddesc           UTF8 @c @b constant_pool entry of
+ *                           description of field type.
  *
  * @param  _jvalue           Data to be stored.
  *
@@ -753,6 +793,8 @@
                                            cp_info_dup     *flddesc,
                                            jvalue          *_jvalue)
 {
+    ARCH_FUNCTION_NAME(field_name_put_object_instance_pjvalue);
+
     return(field_index_put_object_instance_pjvalue(
                objhash,
                field_find_by_cp_entry(

Modified: incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/heap.h
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/heap.h?rev=326481&r1=326480&r2=326481&view=diff
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/heap.h (original)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/heap.h Wed Oct 19 01:41:30 2005
@@ -23,7 +23,9 @@
  *
  * @section Control
  *
- * \$URL$ \$Id$
+ * \$URL$
+ *
+ * \$Id$
  *
  * Copyright 2005 The Apache Software Foundation
  * or its licensors, as applicable.
@@ -47,13 +49,16 @@
  * @date \$LastChangedDate$
  *
  * @author \$LastChangedBy$
+ *
  *         Original code contributed by Daniel Lydick on 09/28/2005.
  *
  * @section Reference
  *
  */
 
-ARCH_COPYRIGHT_APACHE(heap, h, "$URL$ $Id$");
+ARCH_HEADER_COPYRIGHT_APACHE(heap, h,
+"$URL$",
+"$Id$");
 
 #ifdef CONFIG_HEAP_TYPE_SIMPLE
 /*!
@@ -107,9 +112,9 @@
 extern rvoid HEAP_INIT(rvoid);
 extern rvoid HEAP_SHUTDOWN(rvoid);
 
-extern rvoid *HEAP_GET_METHOD(int size, rboolean clrmem_flag);
-extern rvoid *HEAP_GET_STACK(int size, rboolean clrmem_flag);
-extern rvoid *HEAP_GET_DATA(int size, rboolean clrmem_flag);
+extern rvoid *HEAP_GET_METHOD(rint size, rboolean clrmem_flag);
+extern rvoid *HEAP_GET_STACK(rint size, rboolean clrmem_flag);
+extern rvoid *HEAP_GET_DATA(rint size, rboolean clrmem_flag);
 
 extern rvoid HEAP_FREE_METHOD(rvoid *heap_block);
 extern rvoid HEAP_FREE_STACK(rvoid *heap_block);

Modified: incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/heap_bimodal.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/heap_bimodal.c?rev=326481&r1=326480&r2=326481&view=diff
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/heap_bimodal.c (original)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/heap_bimodal.c Wed Oct 19 01:41:30 2005
@@ -45,7 +45,9 @@
  *
  * @section Control
  *
- * \$URL$ \$Id$
+ * \$URL$
+ *
+ * \$Id$
  *
  * Copyright 2005 The Apache Software Foundation
  * or its licensors, as applicable.
@@ -69,6 +71,7 @@
  * @date \$LastChangedDate$
  *
  * @author \$LastChangedBy$
+ *
  *         Original code contributed by Daniel Lydick on 09/28/2005.
  *
  * @section Reference
@@ -76,13 +79,15 @@
  */
 
 #include "arch.h"
-ARCH_COPYRIGHT_APACHE(heap_bimodal, c, "$URL$ $Id$");
+ARCH_SOURCE_COPYRIGHT_APACHE(heap_bimodal, c,
+"$URL$",
+"$Id$");
 
 #if defined(CONFIG_HEAP_TYPE_BIMODAL) || defined(CONFIG_COMPILE_ALL_OPTIONS)
 
 
 #include <errno.h>
-#include <stdlib.h>
+/* #include <stdlib.h> */
 
 #include "jvmcfg.h"
 #include "exit.h"
@@ -143,20 +148,24 @@
  * @b Parameters: @link #rvoid rvoid@endlink
  *
  *
- *        @return @link #rvoid rvoid@endlink
+ * @returns @link #rvoid rvoid@endlink
  *
  */
 rvoid heap_init_bimodal()
 {
+    ARCH_FUNCTION_NAME(heap_init_bimodal);
+
     rlong heapidx;
 
     /* Set up slot flags */
     pheap_slot_in_use =
-        malloc(sizeof(rboolean) * HEAP_NUMBER_OF_SLOTS);
+        (rboolean *) portable_malloc(sizeof(rboolean) * 
+                                     HEAP_NUMBER_OF_SLOTS);
 
     if (rnull == pheap_slot_in_use)
     {
-        sysErrMsg("heap_init", "Cannot allocate slot flag storage");
+        sysErrMsg(arch_function_name,
+                  "Cannot allocate slot flag storage");
         exit_jvm(EXIT_HEAP_ALLOC);
 /*NOTREACHED*/
     }
@@ -171,16 +180,15 @@
 
 
     /* Set up slot storage itself, do not need to initialize */
-    pheap_slot =
-        malloc(sizeof(rbyte) *
-        HEAP_SLOT_SIZE *
-        HEAP_NUMBER_OF_SLOTS);
+    pheap_slot = (rbyte *) (portable_malloc(sizeof(rbyte) *
+                                            HEAP_SLOT_SIZE *
+                                            HEAP_NUMBER_OF_SLOTS));
 
     if (rnull == pheap_slot)
     {
-        free(pheap_slot_in_use);
+        portable_free(pheap_slot_in_use);
 
-        sysErrMsg("heap_init", "Cannot allocate slot storage");
+        sysErrMsg(arch_function_name, "Cannot allocate slot storage");
         exit_jvm(EXIT_HEAP_ALLOC);
 /*NOTREACHED*/
     }
@@ -264,13 +272,13 @@
  *                     return it with its existing contents.
  *
  *
- * @return (@link #rvoid rvoid@endlink *) to allocated area.
- *         This pointer may be cast to any desired data type.  If
- *         size of zero bytes is requested, return
- *         @link #rnull rnull@endlink and let caller croak
- *         on @b SIGSEGV.  If no memory is available
- *         or some OS system call error happened, throw error,
- *         but do @e not return.
+ * @returns (@link #rvoid rvoid@endlink *) to allocated area.
+ *          This pointer may be cast to any desired data type.  If
+ *          size of zero bytes is requested, return
+ *          @link #rnull rnull@endlink and let caller croak
+ *          on @b SIGSEGV.  If no memory is available
+ *          or some OS system call error happened, throw error,
+ *          but do @e not return.
  *
  *
  * @throws JVMCLASS_JAVA_LANG_OUTOFMEMORYERROR
@@ -282,12 +290,15 @@
  *         if other allocation error@endlink.
  *
  */
-static rvoid *heap_get_common_simple_bimodal(int size,
+static rvoid *heap_get_common_simple_bimodal(rint size,
                                              rboolean clrmem_flag)
 {
+    ARCH_FUNCTION_NAME(heap_get_common_simple_bimodal);
+
     rvoid *rc;
+    int sizelocal = (int) size;
 
-    rc = malloc(size);
+    rc = portable_malloc(sizelocal);
 
     /*
      * If specific errors are returned, GC could free up some heap,
@@ -301,7 +312,7 @@
             case ENOMEM:
             case EAGAIN:
                 GC_RUN(rtrue);
-                rc = malloc(size);
+                rc = portable_malloc(sizelocal);
 
                 if (rnull == rc)
                 {
@@ -349,7 +360,7 @@
         rbyte *pb = (rbyte *) rc;
 
         int i;
-        for (i = 0; i < size; i++)
+        for (i = 0; i < sizelocal; i++)
         {
             pb[i] = '\0';
         }
@@ -397,13 +408,13 @@
  *                       return it with its existing contents.
  *
  *
- * @return (@link #rvoid rvoid@endlink *) to allocated area.
- *         This pointer may be cast to any desired data type.  If
- *         size of zero bytes is requested, return
- *         @link #rnull rnull@endlink and let caller croak
- *         on @b SIGSEGV.  If no memory is available
- *         or some OS system call error happened, throw error,
- *         but do @e not return.
+ * @returns (@link #rvoid rvoid@endlink *) to allocated area.
+ *          This pointer may be cast to any desired data type.  If
+ *          size of zero bytes is requested, return
+ *          @link #rnull rnull@endlink and let caller croak
+ *          on @b SIGSEGV.  If no memory is available
+ *          or some OS system call error happened, throw error,
+ *          but do @e not return.
  *
  *
  * @throws JVMCLASS_JAVA_LANG_OUTOFMEMORYERROR
@@ -415,8 +426,12 @@
  *         if other allocation error@endlink.
  *
  */
-static rvoid *heap_get_common_bimodal(int size, rboolean clrmem_flag)
+static rvoid *heap_get_common_bimodal(rint size, rboolean clrmem_flag)
 {
+    ARCH_FUNCTION_NAME(heap_get_common_bimodal);
+
+    int sizelocal = (int) size;
+
     rvoid *rc; /* Separate LOCATE_SLOT calc. from return() for debug */
     rc = (rvoid *) rnull;
 
@@ -424,7 +439,7 @@
      * Return rnull pointer when zero size requested.
      * Let caller fix that problem.
      */
-    if (0 == size)
+    if (0 == sizelocal)
     {
         return((rvoid *) rnull);
     }
@@ -433,7 +448,7 @@
 
 
     /* Use pre-allocated area for small requests */
-    if (HEAP_SLOT_SIZE >= size)
+    if (HEAP_SLOT_SIZE >= sizelocal)
     {
         /* Mark last allocated-- faster than always starting at 0 */
         static rlong heapidxLAST = HEAP_NUMBER_OF_SLOTS - 1;
@@ -477,7 +492,7 @@
                     rbyte *pb = (rbyte *) rc;                      \
                                                                    \
                     rint i;                                        \
-                    for (i = 0; i < size; i++)                     \
+                    for (i = 0; i < sizelocal; i++)                \
                     {                                              \
                         pb[i] = '\0';                              \
                     }                                              \
@@ -513,7 +528,7 @@
     }
     else
     {
-        return(heap_get_common_simple_bimodal(size, clrmem_flag));
+        return(heap_get_common_simple_bimodal(sizelocal, clrmem_flag));
     }
 /*NOTREACHED*/
     return((rvoid *) rnull); /* Satisfy compiler */
@@ -541,13 +556,13 @@
  *                       not (@link #rfalse rfalse@endlink)
  *
  *
- * @return (@link #rvoid rvoid@endlink *) to allocated area.
- *         This pointer may be cast to any desired data type.  If
- *         size of zero bytes is requested, return
- *         @link #rnull rnull@endlink and let
- *         caller croak on @b SIGSEGV.  If no memory is available
- *         or some OS system call error happened, throw error,
- *         but do @e not return.
+ * @returns (@link #rvoid rvoid@endlink *) to allocated area.
+ *          This pointer may be cast to any desired data type.  If
+ *          size of zero bytes is requested, return
+ *          @link #rnull rnull@endlink and let
+ *          caller croak on @b SIGSEGV.  If no memory is available
+ *          or some OS system call error happened, throw error,
+ *          but do @e not return.
  *
  *
  * @throws JVMCLASS_JAVA_LANG_OUTOFMEMORYERROR
@@ -559,8 +574,10 @@
  *         if other allocation error@endlink.
  *
  */
-rvoid *heap_get_method_bimodal(int size, rboolean clrmem_flag)
+rvoid *heap_get_method_bimodal(rint size, rboolean clrmem_flag)
 {
+    ARCH_FUNCTION_NAME(heap_get_method_bimodal);
+
     return(heap_get_common_bimodal(size, clrmem_flag));
 
 } /* END of heap_get_method_bimodal() */
@@ -581,13 +598,13 @@
  *                       not (@link #rfalse rfalse@endlink)
  *
  *
- * @return (@link #rvoid rvoid@endlink *) to allocated area.
- *         This pointer may be cast to any desired data type.  If
- *         size of zero bytes is requested, return
- *         @link #rnull rnull@endlink and let
- *         caller croak on @b SIGSEGV.  If no memory is available
- *         or some OS system call error happened, throw error,
- *         but do @e not return.
+ * @returns (@link #rvoid rvoid@endlink *) to allocated area.
+ *          This pointer may be cast to any desired data type.  If
+ *          size of zero bytes is requested, return
+ *          @link #rnull rnull@endlink and let
+ *          caller croak on @b SIGSEGV.  If no memory is available
+ *          or some OS system call error happened, throw error,
+ *          but do @e not return.
  *
  *
  * @throws JVMCLASS_JAVA_LANG_OUTOFMEMORYERROR
@@ -601,8 +618,10 @@
  *
  *
  */
-rvoid *heap_get_stack_bimodal(int size, rboolean clrmem_flag)
+rvoid *heap_get_stack_bimodal(rint size, rboolean clrmem_flag)
 {
+    ARCH_FUNCTION_NAME(heap_get_stack_bimodal);
+
     return(heap_get_common_bimodal(size, clrmem_flag));
 
 } /* END of heap_get_stack_bimodal() */
@@ -623,13 +642,13 @@
  *                       not (@link #rfalse rfalse@endlink)
  *
  *
- * @return (@link #rvoid rvoid@endlink *) to allocated area.
- *         This pointer may be cast to any desired data type.  If
- *         size of zero bytes is requested, return
- *         @link #rnull rnull@endlink and let
- *         caller croak on @b SIGSEGV.  If no memory is available
- *         or some OS system call error happened, throw error,
- *         but do @e not return.
+ * @returns (@link #rvoid rvoid@endlink *) to allocated area.
+ *          This pointer may be cast to any desired data type.  If
+ *          size of zero bytes is requested, return
+ *          @link #rnull rnull@endlink and let
+ *          caller croak on @b SIGSEGV.  If no memory is available
+ *          or some OS system call error happened, throw error,
+ *          but do @e not return.
  *
  *
  * @throws JVMCLASS_JAVA_LANG_OUTOFMEMORYERROR
@@ -643,8 +662,10 @@
  *
  *
  */
-rvoid *heap_get_data_bimodal(int size, rboolean clrmem_flag)
+rvoid *heap_get_data_bimodal(rint size, rboolean clrmem_flag)
 {
+    ARCH_FUNCTION_NAME(heap_get_data_bimodal);
+
     return(heap_get_common_bimodal(size, clrmem_flag));
 
 } /* END of heap_get_data_bimodal() */
@@ -665,30 +686,34 @@
                         heap_get_XXX_bimodal()@endlink functions.
  *
  *
- * @return @link #rvoid rvoid@endlink
+ * @returns @link #rvoid rvoid@endlink
  *
  *
  */
 static rvoid heap_free_common_bimodal(rvoid *pheap_block)
 {
+    ARCH_FUNCTION_NAME(heap_free_common_bimodal);
+
+    void *pheap_block_local = (void *) pheap_block;
+
     /* Ignore @link #rnull rnull@endlink pointer */
-    if (rnull != pheap_block)
+    if (rnull != pheap_block_local)
     {
         /*
          * Free pre-allocated area from deallocation of
          * small requests, all of which were allocated
          * in this block
          */
-        if ((((rbyte *) &pheap_slot[0]) <= ((rbyte *) pheap_block))
+        if ((((rbyte *) &pheap_slot[0]) <= ((rbyte *)pheap_block_local))
             &&
             (((rbyte *)
               &pheap_slot[sizeof(rbyte)  *
                           HEAP_SLOT_SIZE *
                           HEAP_NUMBER_OF_SLOTS]) >
-                                           ((rbyte *) pheap_block)))
+                                         ((rbyte *) pheap_block_local)))
         {
             rlong heapidx =
-                (((rbyte *) pheap_block) - &pheap_slot[0]) /
+                (((rbyte *) pheap_block_local) - &pheap_slot[0]) /
                 HEAP_SLOT_SIZE;
    
             pheap_slot_in_use[heapidx] = rfalse;
@@ -703,7 +728,7 @@
             /* Free larger requests */
             heap_free_count++;
 
-            free(pheap_block);
+            portable_free(pheap_block_local);
 
             return;
         }
@@ -729,11 +754,13 @@
                         heap_get_method_bimodal()@endlink
  *
  *
- * @return @link #rvoid rvoid@endlink
+ * @returns @link #rvoid rvoid@endlink
  *
  */
 rvoid heap_free_method_bimodal(rvoid *pheap_block)
 {
+    ARCH_FUNCTION_NAME(heap_free_method_bimodal);
+
     heap_free_common_bimodal(pheap_block);
 
 } /* END of heap_free_method_bimodal() */
@@ -749,11 +776,13 @@
                         heap_get_stack_bimodal()@endlink
  *
  *
- * @return @link #rvoid rvoid@endlink
+ * @returns @link #rvoid rvoid@endlink
  *
  */
 rvoid heap_free_stack_bimodal(rvoid *pheap_block)
 {
+    ARCH_FUNCTION_NAME(heap_free_stack_bimodal);
+
     heap_free_common_bimodal(pheap_block);
 
 } /* END of heap_free_stack_bimodal() */
@@ -769,11 +798,13 @@
                         heap_get_data_bimodal()@endlink
  *
  *
- * @return @link #rvoid rvoid@endlink
+ * @returns @link #rvoid rvoid@endlink
  *
  */
 rvoid heap_free_data_bimodal(rvoid *pheap_block)
 {
+    ARCH_FUNCTION_NAME(heap_free_data_bimodal);
+
     heap_free_common_bimodal(pheap_block);
 
 } /* END of heap_free_data_bimodal() */
@@ -802,9 +833,12 @@
  */
 int  heap_get_error_bimodal(rvoid *badptr)
 {
+    ARCH_FUNCTION_NAME(heap_get_error_bimodal);
+
     int rc;
+    void *badptrlocal = (void *) badptr;
 
-    if (rnull == badptr)
+    if (rnull == badptrlocal)
     {
         rc = heap_last_errno;
         heap_last_errno = ERROR0;
@@ -827,11 +861,13 @@
  * @b Parameters: @link #rvoid rvoid@endlink
  *
  *
- *        @return @link #rvoid rvoid@endlink
+ * @returns @link #rvoid rvoid@endlink
  *
  */
 rvoid heap_shutdown_bimodal()
 {
+    ARCH_FUNCTION_NAME(heap_shutdown_bimodal);
+
     heap_last_errno = ERROR0;
 
     /* Declare this module uninitialized */

Modified: incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/heap_simple.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/heap_simple.c?rev=326481&r1=326480&r2=326481&view=diff
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/heap_simple.c (original)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/heap_simple.c Wed Oct 19 01:41:30 2005
@@ -19,7 +19,9 @@
  *
  * @section Control
  *
- * \$URL$ \$Id$
+ * \$URL$
+ *
+ * \$Id$
  *
  * Copyright 2005 The Apache Software Foundation
  * or its licensors, as applicable.
@@ -43,6 +45,7 @@
  * @date \$LastChangedDate$
  *
  * @author \$LastChangedBy$
+ *
  *         Original code contributed by Daniel Lydick on 09/28/2005.
  *
  * @section Reference
@@ -50,12 +53,14 @@
  */
 
 #include "arch.h"
-ARCH_COPYRIGHT_APACHE(heap_simple, c, "$URL$ $Id$");
+ARCH_SOURCE_COPYRIGHT_APACHE(heap_simple, c,
+"$URL$",
+"$Id$");
 
 #if defined(CONFIG_HEAP_TYPE_SIMPLE) || defined(CONFIG_COMPILE_ALL_OPTIONS)
 
 #include <errno.h>
-#include <stdlib.h>
+/* #include <stdlib.h> */
 
 #include "jvmcfg.h"
 #include "exit.h"
@@ -75,11 +80,13 @@
  * @b Parameters: @link #rvoid rvoid@endlink
  *
  *
- *       @returns @link #rvoid rvoid@endlink
+ * @returns @link #rvoid rvoid@endlink
  *
  */
 rvoid heap_init_simple()
 {
+    ARCH_FUNCTION_NAME(heap_init_simple);
+
     ; /* Nothing to do in this methodology */
 
     /* Declare this module initialized */
@@ -150,11 +157,14 @@
  *         if other allocation error@endlink.
  *
  */
-static rvoid *heap_get_common_simple(int size, rboolean clrmem_flag)
+static rvoid *heap_get_common_simple(rint size, rboolean clrmem_flag)
 {
+    ARCH_FUNCTION_NAME(heap_get_comon_simple);
+
     rvoid *rc;
+    int sizelocal = (int) size;
 
-    rc = malloc(size);
+    rc = portable_malloc(sizelocal);
 
     /*
      * If specific errors are returned, GC could free up some heap,
@@ -168,7 +178,7 @@
             case ENOMEM:
             case EAGAIN:
                 GC_RUN(rtrue);
-                rc = malloc(size);
+                rc = portable_malloc(sizelocal);
 
                 if (rnull == rc)
                 {
@@ -216,7 +226,7 @@
         rbyte *pb = (rbyte *) rc;
 
         int i;
-        for (i = 0; i < size; i++)
+        for (i = 0; i < sizelocal; i++)
         {
             pb[i] = '\0';
         }
@@ -267,8 +277,10 @@
  *         if other allocation error@endlink.
  *
  */
-rvoid *heap_get_method_simple(int size, rboolean clrmem_flag)
+rvoid *heap_get_method_simple(rint size, rboolean clrmem_flag)
 {
+    ARCH_FUNCTION_NAME(heap_get_method_simple);
+
     return(heap_get_common_simple(size, clrmem_flag));
 
 } /* END of heap_get_method_simple() */
@@ -309,8 +321,10 @@
  *
  *
  */
-rvoid *heap_get_stack_simple(int size, rboolean clrmem_flag)
+rvoid *heap_get_stack_simple(rint size, rboolean clrmem_flag)
 {
+    ARCH_FUNCTION_NAME(heap_get_stack_simple);
+
     return(heap_get_common_simple(size, clrmem_flag));
 
 } /* END of heap_get_stack_simple() */
@@ -351,8 +365,10 @@
  *
  *
  */
-rvoid *heap_get_data_simple(int size, rboolean clrmem_flag)
+rvoid *heap_get_data_simple(rint size, rboolean clrmem_flag)
 {
+    ARCH_FUNCTION_NAME(heap_get_data_simple);
+
     return(heap_get_common_simple(size, clrmem_flag));
 
 } /* END of heap_get_data_simple() */
@@ -380,13 +396,17 @@
  */
 static rvoid heap_free_common_simple(rvoid *pheap_block)
 {
+    ARCH_FUNCTION_NAME(heap_free_common_simple);
+
+    void *pheap_block_local = (void *) pheap_block;
+
     /* Ignore @link #rnull rnull@endlink pointer */
-    if (rnull != pheap_block)
+    if (rnull != pheap_block_local)
     {
         /* Free larger requests */
         heap_free_count++;
 
-        free(pheap_block);
+        portable_free(pheap_block_local);
     }
 
     return;
@@ -415,6 +435,8 @@
  */
 rvoid heap_free_method_simple(rvoid *pheap_block)
 {
+    ARCH_FUNCTION_NAME(heap_free_method_simple);
+
     heap_free_common_simple(pheap_block);
 
 } /* END of heap_free_method_simple() */
@@ -436,6 +458,8 @@
  */
 rvoid heap_free_stack_simple(rvoid *pheap_block)
 {
+    ARCH_FUNCTION_NAME(heap_free_stack_simple);
+
     heap_free_common_simple(pheap_block);
 
 } /* END of heap_free_stack_simple() */
@@ -457,6 +481,8 @@
  */
 rvoid heap_free_data_simple(rvoid *pheap_block)
 {
+    ARCH_FUNCTION_NAME(heap_free_data_simple);
+
     heap_free_common_simple(pheap_block);
 
 } /* END of heap_free_data_simple() */
@@ -485,9 +511,12 @@
  */
 int  heap_get_error_simple(rvoid *badptr)
 {
+    ARCH_FUNCTION_NAME(heap_get_error_simple);
+
     int rc;
+    void *badptrlocal = (void *) badptr;
 
-    if (rnull == badptr)
+    if (rnull == badptrlocal)
     {
         rc = heap_last_errno;
         heap_last_errno = ERROR0;
@@ -510,11 +539,13 @@
  * @b Parameters: @link #rvoid rvoid@endlink
  *
  *
- *       @returns @link #rvoid rvoid@endlink
+ * @returns @link #rvoid rvoid@endlink
  *
  */
 rvoid heap_shutdown_simple()
 {
+    ARCH_FUNCTION_NAME(heap_shutdown_simple);
+
     heap_last_errno = ERROR0;
 
     /* Declare this module uninitialized */

Modified: incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jvm.h
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jvm.h?rev=326481&r1=326480&r2=326481&view=diff
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jvm.h (original)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jvm.h Wed Oct 19 01:41:30 2005
@@ -20,14 +20,16 @@
  * and was the basis for the ClassFile structure of this implementation.
  *
  *
- * @todo Need to verify which web document for the
+ * @todo HARMONY-6-jvm-jvm.h-1 Need to verify which web document for the
  *       Java 5 class file definition is either "official",
  *       actually correct, or is the <em>de facto</em> standard.
  *
  *
  * @section Control
  *
- * \$URL$ \$Id$
+ * \$URL$
+ *
+ * \$Id$
  *
  * Copyright 2005 The Apache Software Foundation
  * or its licensors, as applicable.
@@ -51,17 +53,19 @@
  * @date \$LastChangedDate$
  *
  * @author \$LastChangedBy$
+ *
  *         Original code contributed by Daniel Lydick on 09/28/2005.
  *
  * @section Reference
  *
  */
 
-ARCH_COPYRIGHT_APACHE(jvm, h, "$URL$ $Id$");
+ARCH_HEADER_COPYRIGHT_APACHE(jvm, h,
+"$URL$",
+"$Id$");
 
 
 #include <pthread.h> /* For mutex(3THR) functions */
-#include <setjmp.h>  /* For jmp_buf structure for setjmp(3)/longjmp(3)*/
 
 #include "jvalue.h"
 #include "class.h"
@@ -82,20 +86,20 @@
      */
 
     /* Command line parms */
-    int    argc;      /**< Direct copy of main(argc,,) */
-    char **argv;      /**< Direct copy of main(,argv,) */
-    char **envp;      /**< Direct copy of main(,,envp) */
+    rint    argc;     /**< Direct copy of main(argc,,) */
+    rchar **argv;     /**< Direct copy of main(,argv,) */
+    rchar **envp;     /**< Direct copy of main(,,envp) */
 
     /* Slices of command line parms */
-    char *argv0;      /**< Program name, @p @b argv[0] in 'C',
+    rchar *argv0;     /**< Program name, @p @b argv[0] in 'C',
                            $0 in @b sh */
 
-    char *argv0name;  /**< Program name argv0,but without path
+    rchar *argv0name; /**< Program name argv0,but without path
                            component*/
 
-    int    argcj;     /**< Index of argv[] passed to JVM main(). */
+    rint   argcj;     /**< Index of argv[] passed to JVM main(). */
 
-    char **argvj;     /**< Portion of argv[] passed to JVM main().
+    rchar **argvj;    /**< Portion of argv[] passed to JVM main().
                        * Should @b never be @link #rnull rnull@endlink,
                        * but zero args will have argvj[0] as
                        * @link #rnull rnull@endlink, which always
@@ -129,12 +133,14 @@
                        * as a producer-consumer item of a single
                        * @c @b volatile byte.
                        *
-                       * @todo  Verify this is okay.  The @link
-                         rthread#sleeptime rthread.sleeptime@endlink
-                       * item is a multi-byte integer, and so could be
-                       * unsafe if not mutexed.  (It is still made
-                       * @c @b volatile just to raise the
-                       * awareness of users to this issue.)
+                       * @todo  HARMONY-6-jvm-jvm.h-2 Verify this is
+                       *        okay.  The @link
+                                rthread#sleeptime
+                                rthread.sleeptime@endlink item is a
+                       *        multi-byte integer, and so could be
+                       *        unsafe if not mutexed.  (It is still
+                       *        made @c @b volatile just to raise the
+                       *        awareness of users to this issue.)
                        */
 
     rbyte unused2[3]; /**< 4-byte alignment */

Modified: incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/main.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/main.c?rev=326481&r1=326480&r2=326481&view=diff
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/main.c (original)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/main.c Wed Oct 19 01:41:30 2005
@@ -11,7 +11,9 @@
  *
  * @section Control
  *
- * \$URL$ \$Id$
+ * \$URL$
+ *
+ * \$Id$
  *
  * Copyright 2005 The Apache Software Foundation
  * or its licensors, as applicable.
@@ -35,6 +37,7 @@
  * @date \$LastChangedDate$
  *
  * @author \$LastChangedBy$
+ *
  *         Original code contributed by Daniel Lydick on 09/28/2005.
  *
  * @section Reference
@@ -42,7 +45,9 @@
  */
 
 #include "arch.h"
-ARCH_COPYRIGHT_APACHE(main, c, "$URL$ $Id$");
+ARCH_SOURCE_COPYRIGHT_APACHE(main, c,
+"$URL$",
+"$Id$");
 
 
 #include <stdlib.h>
@@ -72,6 +77,8 @@
  */
 int main(int argc, char **argv, char **envp)
 {
+    ARCH_FUNCTION_NAME(main);
+
     /* Run the JVM and retrieve its return code */
     int rc = jvm(argc, argv, envp);
 

Modified: incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/manifest.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/manifest.c?rev=326481&r1=326480&r2=326481&view=diff
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/manifest.c (original)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/manifest.c Wed Oct 19 01:41:30 2005
@@ -6,7 +6,9 @@
  *
  * @section Control
  *
- * \$URL$ \$Id$
+ * \$URL$
+ *
+ * \$Id$
  *
  * Copyright 2005 The Apache Software Foundation
  * or its licensors, as applicable.
@@ -30,6 +32,7 @@
  * @date \$LastChangedDate$
  *
  * @author \$LastChangedBy$
+ *
  *         Original code contributed by Daniel Lydick on 09/28/2005.
  *
  * @section Reference
@@ -37,12 +40,14 @@
  */
 
 #include "arch.h"
-ARCH_COPYRIGHT_APACHE(manifest, c, "$URL$ $Id$");
+ARCH_SOURCE_COPYRIGHT_APACHE(manifest, c,
+"$URL$",
+"$Id$");
 
 
-#include <stdio.h>
-#include <ctype.h>
-#include <strings.h>
+/* #include <stdio.h> */
+/* #include <ctype.h> */
+/* #include <strings.h> */
 
 #include "jvmcfg.h"
 #include "heap.h" 
@@ -71,12 +76,15 @@
   
    @endverbatim
  *
- * @todo  Although such a continuation is supported by the JAR file,
- * this implementation does not support it (yet).  With this
- * restriction, the if only one single space separates the name of
- * the attribute and the class name, then since a line may be up
- * to 72 characters long (that is JVMCFG_JARFILE_MANIFEST_LINE_MAX
- * characters), then the class name may be 61 characters long.
+ * @todo  HARMONY-6-jvm-manifest.c-1 Although such a continuation
+ *        is supported by the JAR file, this implementation does
+ *        not support it (yet).  With this restriction, the
+ *        if only one single space separates the name of the
+ *        attribute and the class name, then since a line may be
+ *        up to 72 characters long (that is
+ *        @link #JVMCFG_JARFILE_MANIFEST_LINE_MAX
+          JVMCFG_JARFILE_MANIFEST_LINE_MAX@endlink characters), then
+ *        the class name may be 61 characters long.
  *
  *
  * @param  mnfname   JAR manifest file name, /absolute/path/name
@@ -89,7 +97,11 @@
  */
 rchar *manifest_get_main(rchar *mnfname)
 {
-    FILE *mf = fopen(mnfname, "r");
+    ARCH_FUNCTION_NAME(manifest_get_main);
+
+    rvoid *mf;  /* Portability library does (FILE) part */
+
+    mf = portable_fopen(mnfname, "r");
 
     if (rnull == mf)
     {
@@ -98,18 +110,19 @@
 
     rchar *mnfdata = HEAP_GET_DATA(JVMCFG_STDIO_BFR, rfalse);
 
-    int mclen =  strlen(JVMCFG_JARFILE_MANIFEST_MAIN_CLASS);
+    int mclen =  portable_strlen(JVMCFG_JARFILE_MANIFEST_MAIN_CLASS);
 
     /* Read until end of file or match located */
-    while (mnfdata == (rchar *) fgets(mnfdata, JVMCFG_STDIO_BFR, mf))
+    while (mnfdata ==
+           (rchar *) portable_fgets(mnfdata, JVMCFG_STDIO_BFR, mf))
     {
         /*
          * Scan for ^Main-Class: attribute name (text starting
          * at beginnin of line)
          */
-        if (0 != strncmp(mnfdata,
-                         JVMCFG_JARFILE_MANIFEST_MAIN_CLASS,
-                         mclen))
+        if (0 != portable_strncmp(mnfdata,
+                                  JVMCFG_JARFILE_MANIFEST_MAIN_CLASS,
+                                  mclen))
         {
             continue;
         }
@@ -121,10 +134,10 @@
          * This will be the start of the class name.
          */
         rint i;
-        for (i = mclen; i < strlen(mnfdata); i++)
+        for (i = mclen; i < portable_strlen(mnfdata); i++)
         {
             /* if <b>white space</b> is rfalse */
-            if (0 == isspace((int) mnfdata[i]))
+            if (0 == portable_isspace((int) mnfdata[i]))
             {
                 break; /* Found first non-white-space character */
             }
@@ -138,17 +151,17 @@
          * This will be the end of the class name.
          */
         rint j;
-        for (j = i; j < strlen(mnfdata); j++)
+        for (j = i; j < portable_strlen(mnfdata); j++)
         {
             /* if <b>white space</b> is @link #rtrue rtrue@endlink */
-            if (0 != isspace((int) mnfdata[j]))
+            if (0 != portable_isspace((int) mnfdata[j]))
             {
                 break;  /* Found first white-space character */
             }
         }
         /* If nothing else, the \n at end of line is white space */
 
-        fclose(mf);
+        portable_fclose(mf);
 
         /* Allocate space for non-empty class name plus NUL byte */
         rchar *mnfresult;
@@ -163,21 +176,21 @@
             /* Do not process empty class name, declare error instead */
             HEAP_FREE_DATA(mnfdata);
 
-            sysErrMsg("manifest_get_main",
+            sysErrMsg(arch_function_name,
                       "Missing class name in manifest file %s",
                       mnfname);
             exit_jvm(EXIT_MANIFEST_JAR);
 /*NOTREACHED*/
         }
 
-        memcpy(mnfresult, &mnfdata[i], j - i);
+        portable_memcpy(mnfresult, &mnfdata[i], j - i);
         mnfresult[j - i] = '\0';
 
         HEAP_FREE_DATA(mnfdata);
         return(mnfresult);
     }
 
-    fclose(mf);
+    portable_fclose(mf);
 
     HEAP_FREE_DATA(mnfdata);
 

Modified: incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/nts.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/nts.c?rev=326481&r1=326480&r2=326481&view=diff
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/nts.c (original)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/nts.c Wed Oct 19 01:41:30 2005
@@ -13,7 +13,9 @@
  *
  * @section Control
  *
- * \$URL$ \$Id$
+ * \$URL$
+ *
+ * \$Id$
  *
  * Copyright 2005 The Apache Software Foundation
  * or its licensors, as applicable.
@@ -37,6 +39,7 @@
  * @date \$LastChangedDate$
  *
  * @author \$LastChangedBy$
+ *
  *         Original code contributed by Daniel Lydick on 09/28/2005.
  *
  * @section Reference
@@ -44,10 +47,12 @@
  */
 
 #include "arch.h"
-ARCH_COPYRIGHT_APACHE(nts, c, "$URL$ $Id$");
+ARCH_SOURCE_COPYRIGHT_APACHE(nts, c,
+"$URL$",
+"$Id$");
 
 
-#include <string.h>
+/* #include <string.h> */
 
 #include "jvmcfg.h" 
 #include "cfmacros.h"
@@ -62,9 +67,9 @@
  * @param    inbfr   String (rchar *) string
  *
  *
- * @returns  UTF8 structure containing length and rchar bfr (plus tag),
- *           but return in (cp_info_dup) for full proper word alignment.
- *           When done with the data, call HEAP_FREE_DATA() on it.
+ * @returns UTF8 structure containing length and rchar bfr (plus tag),
+ *          but return in (cp_info_dup) for full proper word alignment.
+ *          When done with the data, call HEAP_FREE_DATA() on it.
  *
  *    @c @b rc-\>bytes      UTF8 version of @b inbfr string
  *
@@ -74,7 +79,9 @@
 
 cp_info_dup *nts_prchar2utf(rchar *inbfr)
 {
-    jshort len = strlen(inbfr);
+    ARCH_FUNCTION_NAME(nts_prchar2utf);
+
+    jshort len = portable_strlen(inbfr);
 
     /*
      * Allocate enough heap space for output string, but within the
@@ -95,7 +102,7 @@
     pcpui->tag = CONSTANT_Utf8;
     pcpui->length = len;
 
-    memcpy((jubyte *) pcpui->bytes, inbfr, len);
+    portable_memcpy((jubyte *) pcpui->bytes, inbfr, len);
 
     rc->empty[0] = FILL_INFO_DUP0;
     rc->empty[1] = FILL_INFO_DUP1;
@@ -131,11 +138,13 @@
 
 jshort nts_prchar2unicode(rchar *inbfr, jchar *outbfr)
 {
+    ARCH_FUNCTION_NAME(nts_prchar2unicode);
+
     jshort charcnvcount;
 
     jchar inbfrcnv;
 
-    jshort len = strlen(inbfr);
+    jshort len = portable_strlen(inbfr);
 
     
     for (charcnvcount = 0; charcnvcount < len; charcnvcount++)
@@ -166,11 +175,11 @@
  * @param    arraydims Number of array dimensions
  *
  *
- * @returns  UTF8 structure containing length and rchar bfr (plus tag),
- *           but return in (cp_info_dup) for full proper word alignment.
- *           When done with the data, call HEAP_FREE_DATA() on it.
- *           With @b inbfr of @c @b some/path/name/filename,
- *           the result will be, with 3 array dimensions:
+ * @returns UTF8 structure containing length and rchar bfr (plus tag),
+ *          but return in (cp_info_dup) for full proper word alignment.
+ *          When done with the data, call HEAP_FREE_DATA() on it.
+ *          With @b inbfr of @c @b some/path/name/filename,
+ *          the result will be, with 3 array dimensions:
  *
  * @verbatim
 
@@ -193,7 +202,9 @@
 cp_info_dup *nts_prchar2utf_classname(rchar         *inbfr,
                                       jvm_array_dim  arraydims)
 {
-    jshort inbfrlen = strlen(inbfr);
+    ARCH_FUNCTION_NAME(nts_prchar2utf_classname);
+
+    jshort inbfrlen = portable_strlen(inbfr);
 
     /*
      * Allocate enough heap space for output string, but within the
@@ -233,7 +244,7 @@
     pcpui->bytes[utfidx] = BASETYPE_CHAR_L;
     utfidx++;
 
-    memcpy((jubyte *) &pcpui->bytes[utfidx], inbfr, inbfrlen);
+    portable_memcpy((jubyte *) &pcpui->bytes[utfidx], inbfr, inbfrlen);
 
     rc->empty[0] = FILL_INFO_DUP0;
     rc->empty[1] = FILL_INFO_DUP1;
@@ -272,8 +283,8 @@
  * @param    inbfr   (rchar *) string.
  *
  *
- * @returns  Number of array dimensions in string.  For example,
- *           this string contains three array dimensions:
+ * @returns Number of array dimensions in string.  For example,
+ *          this string contains three array dimensions:
  *
  * @verbatim
 
@@ -290,6 +301,8 @@
 
 jvm_array_dim nts_get_prchar_arraydims(rchar *inbfr)
 {
+    ARCH_FUNCTION_NAME(nts_get_prchar_arraydims);
+
     /* Make return code wider than max to check overflow */
     u4 rc = 0;
 
@@ -323,13 +336,15 @@
  * @param    inbfr   (rchar *) string.
  *
  *
- * @returns  @link #rtrue rtrue@endlink if this is an array
- *           specfication, else @link #rfalse rfalse@endlink.
+ * @returns @link #rtrue rtrue@endlink if this is an array
+ *          specfication, else @link #rfalse rfalse@endlink.
  *
  */
 
 rboolean nts_prchar_isarray(rchar *inbfr)
 {
+    ARCH_FUNCTION_NAME(nts_prchar_isarray);
+
     return((BASETYPE_CHAR_ARRAY == (u1) inbfr[0]) ? rtrue : rfalse);
 
 } /* END of nts_prchar_isarray() */
@@ -361,6 +376,8 @@
 
 rboolean nts_prchar_isprimativeformatted(rchar *src)
 {
+    ARCH_FUNCTION_NAME(nts_isprimativeformatted);
+
     jvm_array_dim arraydims = nts_get_prchar_arraydims(src);
 
     /*
@@ -407,6 +424,8 @@
 
 rboolean nts_prchar_isclassformatted(rchar *src)
 {
+    ARCH_FUNCTION_NAME(nts_isclassformatted);
+
     u2 idx;
     rint rc = rfalse;
 
@@ -426,7 +445,7 @@
      * nothing else matters and string cannot be formatted.
      */
     u1 *pbytes = src;
-    int len    = strlen(src);
+    int len    = portable_strlen(src);
 
     for (idx = 0; idx < len; idx++)
     {
@@ -487,7 +506,9 @@
 
 rchar *nts_prchar2prchar_unformatted_classname(rchar *inbfr)
 {
-    int inbfrlen            = strlen(inbfr);
+    ARCH_FUNCTION_NAME(nts_prchar2prcahr_unformatted_classname);
+
+    int inbfrlen            = portable_strlen(inbfr);
     rint isfmt              = nts_prchar_isclassformatted(inbfr);
     jvm_array_dim arraydims = nts_get_prchar_arraydims(inbfr);
     rchar *psemi;
@@ -496,7 +517,7 @@
 
     if (rtrue == isfmt)
     {
-        psemi = strchr(inbfr, BASETYPE_CHAR_L_TERM);
+        psemi = portable_strchr(inbfr, BASETYPE_CHAR_L_TERM);
         psemi--;
 
         allocsize = inbfrlen -   /* Input data size */
@@ -519,7 +540,7 @@
     rchar *rc = HEAP_GET_DATA(allocsize, rfalse);
 
     /* Extract input class name from input buffer, add null char */
-    memcpy(rc, &inbfr[startposn], allocsize);
+    portable_memcpy(rc, &inbfr[startposn], allocsize);
     rc[allocsize - sizeof(u1)] = '\0';
 
     return(rc);

Modified: incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/tmparea.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/tmparea.c?rev=326481&r1=326480&r2=326481&view=diff
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/tmparea.c (original)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/tmparea.c Wed Oct 19 01:41:30 2005
@@ -7,7 +7,9 @@
  *
  * @section Control
  *
- * \$URL$ \$Id$
+ * \$URL$
+ *
+ * \$Id$
  *
  * Copyright 2005 The Apache Software Foundation
  * or its licensors, as applicable.
@@ -31,6 +33,7 @@
  * @date \$LastChangedDate$
  *
  * @author \$LastChangedBy$
+ *
  *         Original code contributed by Daniel Lydick on 09/28/2005.
  *
  * @section Reference
@@ -38,13 +41,14 @@
  */
 
 #include "arch.h"
-ARCH_COPYRIGHT_APACHE(tmparea, c, "$URL$ $Id$");
+ARCH_SOURCE_COPYRIGHT_APACHE(tmparea, c,
+"$URL$",
+"$Id$");
 
  
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/stat.h>
+/* #include <stdlib.h> */
+/* #include <string.h> */
+/* #include <unistd.h> */
 
 #include "jvmcfg.h"
 #include "exit.h"
@@ -59,7 +63,7 @@
  * @b Parameters: @link #rvoid rvoid@endlink
  *
  *
- *       @returns @link #rvoid rvoid@endlink
+ * @returns @link #rvoid rvoid@endlink
  *
  */
 static rchar *env_tmpdir = CHEAT_AND_USE_NULL_TO_INITIALIZE;
@@ -68,8 +72,19 @@
 
 rvoid tmparea_init(char **argv)
 {
-    struct stat statbfr;
-    char *argv0name = strrchr(argv[0], JVMCFG_PATHNAME_DELIMITER_CHAR);
+    ARCH_FUNCTION_NAME(tmparea_init);
+
+    rvoid *statbfr; /* Portability library does (struct stat) part */
+    char *argv0name = portable_strrchr(argv[0],
+                                       JVMCFG_PATHNAME_DELIMITER_CHAR);
+
+#ifdef CONFIG_CYGWIN
+    if (rnull == argv0name)
+    {
+        argv0name = portable_strrchr(argv[0],
+                                    JVMCFG_PATHNAME_ALT_DELIMITER_CHAR);
+    }
+#endif
 
     if (rnull != argv0name)
     {
@@ -80,9 +95,9 @@
         argv0name = argv[0];
     }
 
-    int pid = getpid();
+    int pid = portable_getpid();
 
-    env_tmpdir = getenv("TMPDIR");
+    env_tmpdir = portable_getenv(JVMCFG_ENVIRONMENT_VARIABLE_TMPDIR);
 
     if (rnull == env_tmpdir)
     {
@@ -93,17 +108,19 @@
                  "%s%ctmp.%s.%d",
                  env_tmpdir,
                  JVMCFG_PATHNAME_DELIMITER_CHAR,
-                 "bootJVM", /* @todo fix gmj : argv0name, */
+                 argv0name,
                  pid);
-                 
-    int rc = mkdir(tmparea, 0755); /* Could use <sys/stat.h> constants*/
+
+    /* Could use <sys/stat.h> constants for directory creation mode */
+    (rvoid) portable_mkdir(tmparea, 0755);
 
     /* Verify existence of directory */
-    rc = stat(tmparea, &statbfr);
+    statbfr = portable_stat(tmparea);
+    HEAP_FREE_DATA(statbfr);
 
-    if (0 != rc)
+    if (rnull == statbfr)
     {
-        sysErrMsg("tmparea_init",
+        sysErrMsg(arch_function_name,
                   "Cannot create temp directory %s",
                   tmparea);
         exit_jvm(EXIT_TMPAREA_MKDIR);
@@ -129,6 +146,8 @@
  */
 const rchar *tmparea_get()
 {
+    ARCH_FUNCTION_NAME(tmparea_get);
+
     return((const rchar *) tmparea);
 
 } /* END of tmparea_get() */
@@ -141,11 +160,13 @@
  * @b Parameters: @link #rvoid rvoid@endlink
  *
  *
- *       @returns @link #rvoid rvoid@endlink
+ * @returns @link #rvoid rvoid@endlink
  *
  */
 rvoid tmparea_shutdown(rvoid)
 {
+    ARCH_FUNCTION_NAME(tmparea_shutdown);
+
 
 /* Normal method requires directory to be empty:
  *
@@ -153,7 +174,7 @@
  *
  *  if (0 != rc)
  *  {
- *      sysErrMsg("tmparea_shutdown",
+ *      sysErrMsg(arch_function_name,
  *                "Cannot remove temp directory %s",
  *                tmparea);
  *      exit_jvm(EXIT_TMPAREA_RMDIR);
@@ -162,28 +183,29 @@
  *
  */
 
-    struct stat statbfr;
+    rvoid *statbfr; /* Portability library does (struct stat) part */
 
 /* Since there will be temp files here, cheat just a @e little bit: */
 
 
     rchar *rmscript =        /* format spec %s make strlen longer than
                                 it needs to be, but it is benign */
-        HEAP_GET_DATA(strlen(JVMCFG_TMPAREA_REMOVE_SCRIPT) +
-                          strlen(tmparea) +
+        HEAP_GET_DATA(portable_strlen(JVMCFG_TMPAREA_REMOVE_SCRIPT) +
+                          portable_strlen(tmparea) +
                           sizeof(rchar) /* NUL byte */,
                       rfalse);
 
     sprintfLocal(rmscript, JVMCFG_TMPAREA_REMOVE_SCRIPT, tmparea);
 
-    int rc = system(rmscript);
+    /* int rc = */ portable_system(rmscript);
 
     /* Verify missing directory */
-    rc = stat(tmparea, &statbfr);
+    statbfr = portable_stat(tmparea);
+    HEAP_FREE_DATA(statbfr);
 
-    if (0 == rc)
+    if (rnull != statbfr)
     {
-        sysErrMsg("tmparea_shutdown",
+        sysErrMsg(arch_function_name,
                   "Cannot remove temp directory %s",
                   tmparea);
         exit_jvm(EXIT_TMPAREA_RMDIR);



Mime
View raw message