[kaffe] kaffeh and inner classes

Kurt Miller truk at optonline.net
Sat Jul 16 09:59:51 PDT 2005


From: "Guilhem Lavaux" <guilhem at kaffe.org>
> Thank you very much for your patch ! We are sometimes a bit low to
> answer and sorry for that. I will try it and if it looks ok it will go
> into CVS.

No worries. :-)

Here's a new version that also adds -bootclasspath for better
compatiblity with Suns javah.

I've got some other patches I'm working on for kaffeh/support.c
that fixes some issues there. I'll send that in a few days when
I've verified some more things.

--- kaffe/kaffeh/main.c.orig	Mon May  3 01:53:27 2004
+++ kaffe/kaffeh/main.c	Sat Jul 16 09:20:23 2005
@@ -60,7 +60,7 @@ int
 main(int argc, char* argv[])
 {
 	char* nm;
-	int i, first = 1;
+	int i, j, first = 1;
 	int farg;
 
 	/* Process arguments */
@@ -88,28 +88,37 @@ main(int argc, char* argv[])
 	for (nm = argv[farg]; nm != 0; nm = argv[++farg]) {
 
 		/* Derive various names from class name */
-		for (i = 0; nm[i] != 0; i++) {
-			if (i >= BUFSZ - 100) {
+		for (i = j = 0; nm[i] != 0; i++, j++) {
+			if (i >= BUFSZ - 100 || j >= BUFSZ - 105) {
 				dprintf(
 				    "kaffeh: class name too long\n");
 				exit(1);
 			}
 			switch (nm[i]) {
 			case '/':
-			case '$':
 			case '.':
-				className[i] = '_';
+				className[j] = '_';
 				pathName[i] = '/';
 				includeName[i] = '_';
 				break;
+			case '$':
+				className[j++] = '_';
+				className[j++] = '0';
+				className[j++] = '0';
+				className[j++] = '0';
+				className[j++] = '2';
+				className[j] = '4';
+				pathName[i] = nm[i];
+				includeName[i] = '_';
+				break;
 			default:
-				className[i] = nm[i];
+				className[j] = nm[i];
 				pathName[i] = nm[i];
 				includeName[i] = nm[i];
 				break;
 			}
 		}
-		className[i] = 0;
+		className[j] = 0;
 		pathName[i] = 0;
 		includeName[i] = 0;
 
@@ -234,6 +243,10 @@ options(int argc, char** argv)
 			i++;
 			strcpy(realClassPath, argv[i]);
 		}
+		else if (strcmp(argv[i], "-bootclasspath") == 0) {
+			i++;
+			strcpy(realClassPath, argv[i]);
+		}
 		else if (strcmp(argv[i], "-o") == 0) {
 			i++;
 			outputName = argv[i];
@@ -263,6 +276,7 @@ usage(void)
 	dprintf("	-help			Print this message\n");
 	dprintf("	-version		Print version number\n");
 	dprintf("	-classpath <path>	Set classpath\n");
+	dprintf("	-bootclasspath <path>	Set classpath\n");
 	dprintf("	-jni			Generate JNI interface\n");
 #ifdef KAFFE_VMDEBUG
 	dprintf("	-Xdebug <opts>		Kaffe debug options.\n");




More information about the kaffe mailing list