You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
497 B
38 lines
497 B
3 years ago
|
#! /usr/bin/perl
|
||
|
|
||
|
while(<>) {
|
||
|
if(/^\s*\[\s*\S+\s*(\S+)\s*(\S+)\s*(\S+)\s*\]/) {
|
||
|
$k{hex $1} = 1;
|
||
|
$k{hex $2} = 1;
|
||
|
$k{hex $3} = 1;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
delete $k{0};
|
||
|
|
||
|
@f = sort { $a <=> $b } (keys %k);
|
||
|
|
||
|
print "-a ";
|
||
|
|
||
|
for (@f) {
|
||
|
if(!defined($i)) {
|
||
|
printf "0x%02x", $_;
|
||
|
$sep = ',';
|
||
|
}
|
||
|
elsif($_ == $i + 1) {
|
||
|
$sep = '-';
|
||
|
}
|
||
|
else {
|
||
|
printf "-0x%02x", $i if $sep eq '-';
|
||
|
printf ",0x%02x", $_;
|
||
|
$sep = ',';
|
||
|
}
|
||
|
|
||
|
$i = $_;
|
||
|
}
|
||
|
|
||
|
printf "-0x%02x", $i if $sep eq '-';
|
||
|
|
||
|
print "\n";
|
||
|
|