OSDN Git Service

* gij.cc (main): Formatting fixes.
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 15 Oct 1999 16:53:41 +0000 (16:53 +0000)
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 15 Oct 1999 16:53:41 +0000 (16:53 +0000)
(_Jv_Compiler_Properties): Define.
* java/lang/natSystem.cc (_Jv_Environment_Properties): Don't
declare.
(init_properties): Set properites from _Jv_Compiler_Properties.
* include/java-props.h (_Jv_Compiler_Properties,
_Jv_Environment_Properties): Declare.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@30020 138bc75d-0d04-0410-961f-82ee72b054a4

libjava/ChangeLog
libjava/gij.cc
libjava/include/java-props.h
libjava/java/lang/natSystem.cc

index ae6a17d..4f37d8a 100644 (file)
@@ -1,5 +1,13 @@
 1999-10-15  Tom Tromey  <tromey@cygnus.com>
 
+       * gij.cc (main): Formatting fixes.
+       (_Jv_Compiler_Properties): Define.
+       * java/lang/natSystem.cc (_Jv_Environment_Properties): Don't
+       declare.
+       (init_properties): Set properites from _Jv_Compiler_Properties.
+       * include/java-props.h (_Jv_Compiler_Properties,
+       _Jv_Environment_Properties): Declare.
+
        * include/java-props.h: Added copyright.
 
 1999-10-13  Anthony Green  <green@cygnus.com>
index ffe1515..b851b77 100644 (file)
@@ -15,13 +15,20 @@ details.  */
 #include <java/lang/System.h>
 #include <java/util/Properties.h>
 
-int main (int argc, const char **argv)
+// This is used to initialize the compiled-in system properties.
+const char *_Jv_Compiler_Properties[] =
+{
+  NULL
+};
+
+int
+main (int argc, const char **argv)
 {
   if (argc < 2)
     {
-      printf ("usage: %s <class name> args\n", argv[0]);
+      printf ("usage: %s CLASS [ARGS]...\n", argv[0]);
       exit (1);
     }
 
-  _Jv_RunMain (argv[1], argc-1, argv+1);
+  _Jv_RunMain (argv[1], argc - 1, argv + 1);
 }
index 53ecb09..65130da 100644 (file)
@@ -19,5 +19,11 @@ typedef struct
   size_t      value_length;
 } property_pair;
 
+// The compiler generates this declaration.
+extern char *_Jv_Compiler_Properties[];
+
+// Properties taken from the user's environment.
+extern property_pair *_Jv_Environment_Properties;
+
 #endif
 
index f146f3e..268c1cc 100644 (file)
@@ -53,7 +53,6 @@ details.  */
 #define SystemClass _CL_Q34java4lang6System
 extern java::lang::Class SystemClass;
 
-extern property_pair *_Jv_Environment_Properties;
 \f
 
 #if defined (ECOS)
@@ -336,8 +335,8 @@ java::lang::System::init_properties (void)
 
   while (buf_r != NULL)
     {
-      int r = getpwuid_adaptor
-       (getpwuid_r, user_id, &pwd_r, buf_r, len_r, &pwd_entry);
+      int r = getpwuid_adaptor (getpwuid_r, user_id, &pwd_r,
+                               buf_r, len_r, &pwd_entry);
       if (r == 0)
        break;
       else if (r != ERANGE)
@@ -379,6 +378,19 @@ java::lang::System::init_properties (void)
     free (buffer);
 #endif
 
+  // Set some properties according to whatever was compiled in with
+  // `-D'.
+  for (int i = 0; _Jv_Compiler_Properties[i]; ++i)
+    {
+      const char *s, *p;
+      // Find the `='.
+      for (s = p = _Jv_Compiler_Properties[i]; *s && *s != '='; ++s)
+       ;
+      jstring name = JvNewStringLatin1 (p, s - p);
+      jstring val = JvNewStringLatin1 (*s == '=' ? s + 1 : s);
+      properties->put (name, val);
+    }
+
   // Set the system properties from the user's environment.
   if (_Jv_Environment_Properties)
     {