[kaffe] kaffeh and inner classes

Kurt Miller truk at optonline.net
Fri Jul 15 14:07:35 PDT 2005


From: "Kurt Miller" <truk at optonline.net>
> can kaffeh be used on inner classes? 
> 
> It seems like it doesn't deal with the $ character correctly
> and interprets it as a path separator.

Here's a patch that deals with the $ for inner classes.
The "class name too long" check looks arbitrary to me.
Not really sure where 100 comes from.

--- kaffe/kaffeh/main.c.orig	Mon May  3 01:53:27 2004
+++ kaffe/kaffeh/main.c	Fri Jul 15 17:40:44 2005
@@ -60,7 +60,7 @@
 main(int argc, char* argv[])
 {
 	char* nm;
-	int i, first = 1;
+	int i, j, first = 1;
 	int farg;
 
 	/* Process arguments */
@@ -88,28 +88,37 @@
 	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;
 




More information about the kaffe mailing list