Index: trunk/mkstructinfo.awk
===================================================================
--- trunk/mkstructinfo.awk	(revision 169)
+++ trunk/mkstructinfo.awk	(revision 187)
@@ -3,9 +3,33 @@
 BEGIN {
 	brace = 0;
+	incomment = 0;
 	buffer_len = 0;
 }
+
+# multiline comment handling
+{
+	# removes one line comment
+	gsub(/\/\*(.+?)\*\//, " ");
+}
+/\*\// {
+	if (incomment) {
+		sub(/.*\*\//, "");
+		incomment = 0;
+	}
+}
+incomment {
+	next;
+}
+/\/\*/ {
+	sub(/\/\*.*/, "");
+	incomment = 1;
+	# fall through
+}
+
+# skip file/line mark here to be faster
 /^#/ {
 	next;
 }
+
 /^}.*;/ {
 	if (instruct) {
@@ -54,5 +78,5 @@
 {
 	if (brace == 1 && instruct) {
-		gsub(/\/\*(.+?)\*\//, " "); # removes one line comment
+		gsub(/(^[\t ]+|[\t ]+$)/, ""); # trim whitespaces
 		sub(/.*[{}]/, "");
 		gsub(/\[[^\]]+\]/, ""); # ignore [...]
@@ -67,4 +91,6 @@
 		}
 		else {
+			# process normal variables
+
 			# ignore any ()s
 			while (gsub(/(\([^)]*\))/, "")) {
@@ -83,4 +109,5 @@
 				next;
 			}
+			# print "=DEBUG=" $0 "==";
 			split($0, chunks, ";");
 			# [unsigned int a, b, c]
@@ -102,5 +129,7 @@
 				}
 				if (last_piece == "") {
-					print "=====" chunks[i];
+					# print "=ERROR=" chunks[i] "==";
+					delete chunks[i];
+					continue;
 				}
 				# a
@@ -123,5 +152,5 @@
 	next;
 }
-/^typedef struct .*\{/ {
+/^typedef struct .*\{[^}]*$/ {
 	brace = 1;
 	instruct = 1;
