s/^\&\&// && do { $new .= " &&"; next;}; # handle && operator
s/^\&([\(a-z\)]+)/$1/i; # hack for things that take the address of
s/^(\s+)// && do {$new .= ' '; next;};
- s/^(0X[0-9A-F]+)[UL]*//i && do {$new .= lc($1); next;};
- s/^(-?\d+\.\d+E[-+]\d+)F?//i && do {$new .= $1; next;};
+ s/^(0X[0-9A-F]+)[UL]*//i && do {$new .= lc($1); next;};
+ s/^(-?\d+\.\d+E[-+]?\d+)[FL]?//i && do {$new .= $1; next;};
s/^(\d+)\s*[LU]*//i && do {$new .= $1; next;};
s/^("(\\"|[^"])*")// && do {$new .= $1; next;};
s/^'((\\"|[^"])*)'// && do {
# Eliminate typedefs
/\(([\w\s]+)[\*\s]*\)\s*[\w\(]/ && do {
foreach (split /\s+/, $1) { # Make sure all the words are types,
- last unless ($isatype{$_} or $_ eq 'struct');
+ last unless ($isatype{$_} or $_ eq 'struct' or $_ eq 'union');
}
s/\([\w\s]+[\*\s]*\)// && next; # then eliminate them.
};
};
s/^([_a-zA-Z]\w*)// && do {
my $id = $1;
- if ($id eq 'struct') {
+ if ($id eq 'struct' || $id eq 'union') {
s/^\s+(\w+)//;
$id .= ' ' . $1;
$isatype{$id} = 1;
$in =~ s/\?\?</{/g; # | ??<| {|
$in =~ s/\?\?>/}/g; # | ??>| }|
}
+ if ($in =~ /^\#ifdef __LANGUAGE_PASCAL__/) {
+ # Tru64 disassembler.h evilness: mixed C and Pascal.
+ while (<IN>) {
+ last if /^\#endif/;
+ }
+ next READ;
+ }
if ($in =~ s/\\$//) { # \-newline
$out .= ' ';
next READ;
or
+ cd /usr/include; h2ph * sys/* arpa/* netinet/*
+
+or
+
cd /usr/include; h2ph -r -l .
The output files are placed in the hierarchy rooted at Perl's