Index: libcfa/prototypes.awk
===================================================================
--- libcfa/prototypes.awk	(revision 9df2dd5344c55f908ed94138b07f1a215d240ef2)
+++ libcfa/prototypes.awk	(revision ad8e0628661fb3a1280de308f864deccdc6779b6)
@@ -1,4 +1,5 @@
 BEGIN {
     FS = "("
+    # order so string search is longest string
     types[0]  = "UINTMAX";			vtypes[0]  = "unsigned long int"
     types[1]  = "UINT16";			vtypes[1]  = "short int"
@@ -46,5 +47,5 @@
     types[43] = "PID";				vtypes[43] = "int"
     N = 44
-}
+} # BEGIN
 
 /^BT_/ { prototypes[$1] = $1 }
@@ -55,7 +56,8 @@
     printf( "#define BT_LAST(NAME) FUNC_SIMPLE(void, NAME)\n\n" );
 
+    # generate C types for macros names
     for ( i = 0; i < N; i += 1 ) {
 	printf( "#define BT_%s %s\n", types[i], vtypes[i] )
-    }
+    } # for
     printf( "\n" )
 
@@ -63,35 +65,41 @@
 	if ( index( "BT_LAST", prototype ) == 1 ) {
 	    continue
-	}
+	} # if
+
+	if ( sub( "BT_FN_", "", prototype ) == 0 ) {
+	    if ( sub( "BT_", "", prototype ) == 0 ) {
+		printf( "\n********** BAD MACRO NAME \"%s\" **********\n", prototype )
+		exit 0
+	    } #if
+	} # if
+
 	printf( "#define %s(NAME) FUNC_SIMPLE(", prototype )
-	    
-	if ( sub( "BT_FN_", "", prototype) == 0 )
-	    if ( sub( "BT_", "", prototype) == 0 ) {
-		printf( "\n********** BAD MACRO NAME **********\n" )
-		exit 0
-	    }
-	for ( t = 0; t < N; t += 1 ) {
+
+	# generate function return type as macro
+	for ( t = 0; t < N; t += 1 ) {			# find longest match 
 	    type = types[t];
-	    if ( index( prototype, type ) == 1 ) {
+	    if ( index( prototype, type ) == 1 ) {	# found match
 		printf( "BT_%s, NAME", type )
-		sub( type, "", prototype)
+		sub( type, "", prototype )
 		break;
-	    }
-	}
-	if ( index( prototype, "VAR" ) != 2 ) {
-	    for ( p = 0; length( prototype ) > 0; p += 1 ) {
-		sub( "_", "", prototype)
+	    } # if
+	} # for
+
+	# generate function parameter types as macro
+	if ( index( prototype, "VAR" ) != 2 ) {		# C-style empty parameters ?
+	    for ( p = 0; length( prototype ) > 0; p += 1 ) { # until all parameters types are removed
+		sub( "_", "", prototype)		# remove "_"
 		printf( ", ", type )
 		temp = prototype
-		for ( t = 0; t < N; t += 1 ) {
+		for ( t = 0; t < N; t += 1 ) {		# find longest match
 		    type = types[t];
-		    if ( index( prototype, type ) == 1 ) {
+		    if ( index( prototype, type ) == 1 ) { # found match
 			printf( "BT_%s", type )
-			sub( type, "", prototype)
+			sub( type, "", prototype )
 			break;
 		    } # if
 		} # for
-		if ( temp == prototype ) {
-		    printf( "\n********** MISSING TYPE **********\n" )
+		if ( temp == prototype ) {		# no match found for parameter in macro table
+		    printf( "\n********** MISSING TYPE \"%s\" **********\n", prototype )
 		    exit 0
 		} # if
@@ -99,9 +107,10 @@
 	} # if
 	printf( ")\n" )
-    }
+    } # for
 
+    # extras
     printf( "\n#include \"builtins.def\"\n\n" );
     printf( "typedef void ** __builtin_va_list;\n" );
     printf( "extern const char *__PRETTY_FUNCTION__;\n" );
     printf( "typedef int wchar_t;\n" );
-}
+} # END
