| 1 |
#!/usr/bin/perl |
| 2 |
|
| 3 |
require 'sizeof.ph'; |
| 4 |
|
| 5 |
$LIB = '/usr/local/lib/perl'; |
| 6 |
|
| 7 |
foreach $include (@ARGV) { |
| 8 |
printf STDERR "including %s\n", $include; |
| 9 |
do $include; |
| 10 |
warn "sourcing $include: $@\n" if ($@); |
| 11 |
if (!open (INCLUDE,'<',"$LIB/$include")) { |
| 12 |
warn "can't open $LIB/$include: $!\n"; |
| 13 |
next; |
| 14 |
} |
| 15 |
while (<INCLUDE>) { |
| 16 |
chop; |
| 17 |
if (/^\s*eval\s+'sub\s+(\w+)\s.*[^{]$/ || /^\s*sub\s+(\w+)\s.*[^{]$/) { |
| 18 |
$var = $1; |
| 19 |
$val = eval "&$var;"; |
| 20 |
if ($@) { |
| 21 |
warn "$@: $_"; |
| 22 |
print <<EOT; |
| 23 |
warn "\$$var isn't correctly set" if defined \$_main{'$var'}; |
| 24 |
EOT |
| 25 |
next; |
| 26 |
} |
| 27 |
( $nval = sprintf ("%x",$val ) ) =~ tr/a-z/A-Z/; |
| 28 |
printf "\$%s = 0x%s;\n", $var, $nval; |
| 29 |
} |
| 30 |
} |
| 31 |
} |