diff options
author | Matthias Hopf <mhopf@suse.de> | 2009-06-25 19:42:06 +0200 |
---|---|---|
committer | Matthias Hopf <mhopf@suse.de> | 2009-06-25 19:42:06 +0200 |
commit | 7fdbc6c7c972771fa32db58f140d618bd4259377 (patch) | |
tree | 7270166a05ef160e5f31adf3faeadfba6b642f02 | |
parent | 8f46ebda24e8bfd99d49b0e07db503ffceb5fb07 (diff) |
Fix handling of preprocessed files. Fix <unparseable> output.
-rw-r--r-- | datastructs_factory.pl | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/datastructs_factory.pl b/datastructs_factory.pl index a549b41..7d2961c 100644 --- a/datastructs_factory.pl +++ b/datastructs_factory.pl @@ -15,6 +15,7 @@ while (<>) { $l++; + next if /^#/; if (/^\s*typedef\s+(struct|union)\s+_(\w+)/) { $t = $1; $tv= $t eq "union" ? "(union) " : ""; @@ -26,6 +27,7 @@ while (<>) { print " if (d) {\n"; while (<>) { $l++; + next if /^#/; chomp; s|\s*//.*||g; next if /^\s*\{\s*$/ || /^\s*$/; @@ -55,7 +57,7 @@ while (<>) { $loop_beg.= " " if $b ne ""; $loop_beg.= "$tv$e $n$b%s"; $loop_arg = ", IND(indent)"; - $loop_arg.= ", ((uint8_t*)&$loop_dst)-start" if $b eq ""; + $loop_arg.= ", (int)(((uint8_t*)&$loop_dst)-start)" if $b eq ""; $loop_arg.= ", FILL(".length($tv.$e.$n.$b).")"; $loop_end = ""; } else { @@ -65,7 +67,7 @@ while (<>) { $loop_beg.= " " if $b ne ""; $loop_beg.= "$tv$e $n$b%s [%d]"; $loop_arg = ", IND(indent)"; - $loop_arg.= ", ((uint8_t*)&$loop_dst)-start" if $b eq ""; + $loop_arg.= ", (int)(((uint8_t*)&$loop_dst)-start)" if $b eq ""; $loop_arg.= ", FILL(".(length($tv.$e.$n.$b)+4)."+(i>9)), i"; $loop_end = " }"; } @@ -77,6 +79,7 @@ while (<>) { print "$loop_beg = %08x\\n\"$loop_arg, $loop_dst);$loop_end\n"; } else { if ($b ne "") { + s/"/''/g; print " printf (\"%s <unparsable> line $l: $_\\n%sskipping...\\n\", IND(indent), IND(indent));\n"; last; } else { @@ -84,6 +87,7 @@ while (<>) { } } } else { + s/"/''/g; print " printf (\"%s <unparsable> line $l: $_\\n%sskipping...\\n\", IND(indent), IND(indent));\n"; last; } |