harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject svn commit: r480852 - in /harmony/enhanced/jdktools/trunk/modules/samsa: build.xml src/main/native/samsa/samsa.c
Date Thu, 30 Nov 2006 06:20:39 GMT
Author: geirm
Date: Wed Nov 29 22:20:38 2006
New Revision: 480852

URL: http://svn.apache.org/viewvc?view=rev&rev=480852
Log:
add ablility to be "java" too... (although
it's an awful hack.. works for now, I guess


Modified:
    harmony/enhanced/jdktools/trunk/modules/samsa/build.xml
    harmony/enhanced/jdktools/trunk/modules/samsa/src/main/native/samsa/samsa.c

Modified: harmony/enhanced/jdktools/trunk/modules/samsa/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/samsa/build.xml?view=diff&rev=480852&r1=480851&r2=480852
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/samsa/build.xml (original)
+++ harmony/enhanced/jdktools/trunk/modules/samsa/build.xml Wed Nov 29 22:20:38 2006
@@ -53,6 +53,8 @@
         <chmod file="${hy.jdk}/bin/javap${exe.suffix}" perm="ugo+x" />
         <copy file="${hy.jdk}/bin/samsa${exe.suffix}" tofile="${hy.jdk}/bin/javah${exe.suffix}"
/>
         <chmod file="${hy.jdk}/bin/javah${exe.suffix}" perm="ugo+x" />
+        <copy file="${hy.jdk}/bin/samsa${exe.suffix}" tofile="${hy.jdk}/bin/java${exe.suffix}"
/>
+        <chmod file="${hy.jdk}/bin/java${exe.suffix}" perm="ugo+x" />
 
         <delete file="${hy.jdk}/bin/samsa${exe.suffix}"/>
 

Modified: harmony/enhanced/jdktools/trunk/modules/samsa/src/main/native/samsa/samsa.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/samsa/src/main/native/samsa/samsa.c?view=diff&rev=480852&r1=480851&r2=480852
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/samsa/src/main/native/samsa/samsa.c (original)
+++ harmony/enhanced/jdktools/trunk/modules/samsa/src/main/native/samsa/samsa.c Wed Nov 29
22:20:38 2006
@@ -70,42 +70,48 @@
     strcpy(fullExePath, jdkRoot);
     strcat(fullExePath, EXE_POSTFIX);
     
-    char *classpath = (char *) malloc(strlen(jdkRoot) * 2 + strlen(LIB_POSTFIX) * 2
-                    + strlen(TOOL_JAR) + strlen(ECJ_JAR) + strlen(CLASSPATH_SEP) + 1);
-         
-    strcpy(classpath, jdkRoot);
-    strcat(classpath, LIB_POSTFIX);
-    strcat(classpath, TOOL_JAR);
-    strcat(classpath, CLASSPATH_SEP);
-    strcat(classpath, jdkRoot);
-    strcat(classpath, LIB_POSTFIX);
-    strcat(classpath, ECJ_JAR);
-
     /*
      *  we're invoking java with the following 
      *    -cp toolpath  clasname .......
      */
     myArgv[newIndex++] = fullExePath;
-    myArgv[newIndex++] = "-cp";
-    myArgv[newIndex++] = classpath;
-
-    char *buffer = (char *) malloc(strlen(CLASS_PREFIX) + strlen(toolName) + strlen(CLASS_POSTFIX)
+ 1);
-
-    strcpy(buffer, CLASS_PREFIX);
-    strcat(buffer, toolName);
-    strcat(buffer, CLASS_POSTFIX);
     
-    myArgv[newIndex++] = buffer;
+    /*
+     *  if we're not java, put the tools on cp, figure out the tool class to invoke...
+     */
+    if (strcmp(toolName, "java")) {
+        char *classpath = (char *) malloc(strlen(jdkRoot) * 2 + strlen(LIB_POSTFIX) * 2
+                    + strlen(TOOL_JAR) + strlen(ECJ_JAR) + strlen(CLASSPATH_SEP) + 1);
+         
+        strcpy(classpath, jdkRoot);
+        strcat(classpath, LIB_POSTFIX);
+        strcat(classpath, TOOL_JAR);
+        strcat(classpath, CLASSPATH_SEP);
+        strcat(classpath, jdkRoot);
+        strcat(classpath, LIB_POSTFIX);
+        strcat(classpath, ECJ_JAR);
+                
+        myArgv[newIndex++] = "-cp";
+        myArgv[newIndex++] = classpath;
+
+        char *buffer = (char *) malloc(strlen(CLASS_PREFIX) + strlen(toolName) + strlen(CLASS_POSTFIX)
+ 1);
     
+        strcpy(buffer, CLASS_PREFIX);
+        strcat(buffer, toolName);
+        strcat(buffer, CLASS_POSTFIX);
+        
+        myArgv[newIndex++] = buffer;
+    }
+        
     for (i = 1; i < argc; i++) {
         myArgv[newIndex++] = argv[i];
     }
     
     myArgv[newIndex] = '\0';
 
-    for (i=0; i < myArgvCount; i++) { 
-        printf(" %d = %s\n", i, myArgv[i]);
-    }
+//    for (i=0; i < myArgvCount; i++) { 
+//        printf(" %d = %s\n", i, myArgv[i]);
+//    }
     
     /*
      * now simply execv() the java app w/ the new params
@@ -124,8 +130,11 @@
 char *cleanToolName(const char *name) 
 {
     int i;
-    char *toolNames[] = { "javac", "javap", "javah" };
+    char *toolNames[] = { "javac", "javap", "javah", "java" };
     
+    /* 
+     *  FIXME :  this is an awful hack, easy to fool, but for now...
+     */
     for (i=0; i < sizeof(toolNames)/sizeof(toolNames[0]); i++) { 
         if (strstr(name, toolNames[i])) {
             return toolNames[i];



Mime
View raw message