Changeset 187
- Timestamp:
- 09/19/2006 12:37:06 AM (2 years ago)
- Files:
-
- 1 modified
-
trunk/mkstructinfo.awk (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/mkstructinfo.awk
r169 r187 3 3 BEGIN { 4 4 brace = 0; 5 incomment = 0; 5 6 buffer_len = 0; 6 7 } 8 9 # multiline comment handling 10 { 11 # removes one line comment 12 gsub(/\/\*(.+?)\*\//, " "); 13 } 14 /\*\// { 15 if (incomment) { 16 sub(/.*\*\//, ""); 17 incomment = 0; 18 } 19 } 20 incomment { 21 next; 22 } 23 /\/\*/ { 24 sub(/\/\*.*/, ""); 25 incomment = 1; 26 # fall through 27 } 28 29 # skip file/line mark here to be faster 7 30 /^#/ { 8 31 next; 9 32 } 33 10 34 /^}.*;/ { 11 35 if (instruct) { … … 54 78 { 55 79 if (brace == 1 && instruct) { 56 gsub(/ \/\*(.+?)\*\//, " "); # removes one line comment80 gsub(/(^[\t ]+|[\t ]+$)/, ""); # trim whitespaces 57 81 sub(/.*[{}]/, ""); 58 82 gsub(/\[[^\]]+\]/, ""); # ignore [...] … … 67 91 } 68 92 else { 93 # process normal variables 94 69 95 # ignore any ()s 70 96 while (gsub(/(\([^)]*\))/, "")) { … … 83 109 next; 84 110 } 111 # print "=DEBUG=" $0 "=="; 85 112 split($0, chunks, ";"); 86 113 # [unsigned int a, b, c] … … 102 129 } 103 130 if (last_piece == "") { 104 print "=====" chunks[i]; 131 # print "=ERROR=" chunks[i] "=="; 132 delete chunks[i]; 133 continue; 105 134 } 106 135 # a … … 123 152 next; 124 153 } 125 /^typedef struct .*\{ / {154 /^typedef struct .*\{[^}]*$/ { 126 155 brace = 1; 127 156 instruct = 1;

