diff options
author | Cecil Hugh Watson <knoppmyth@gmail.com> | 2009-01-07 09:44:40 (GMT) |
---|---|---|
committer | Cecil Hugh Watson <knoppmyth@gmail.com> | 2009-01-07 09:44:40 (GMT) |
commit | 22cb9c31cde8a125c3b7d159d8b50941cb5c7714 (patch) | |
tree | ffdf1f5463d1c6fcc968ef15a82837210fba0a39 /abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts | |
parent | f018045129450cc43d0e86eedcdd7b43d53ff691 (diff) | |
download | linhes_pkgbuild-22cb9c31cde8a125c3b7d159d8b50941cb5c7714.zip linhes_pkgbuild-22cb9c31cde8a125c3b7d159d8b50941cb5c7714.tar.gz linhes_pkgbuild-22cb9c31cde8a125c3b7d159d8b50941cb5c7714.tar.bz2 |
Updated kernel to 2.6.27. Updated latest PKGBUILD for various packages and recompiled.
Diffstat (limited to 'abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts')
15 files changed, 661 insertions, 0 deletions
diff --git a/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/.svn/dir-prop-base b/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/.svn/dir-prop-base new file mode 100644 index 0000000..1a8363b --- /dev/null +++ b/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/.svn/dir-prop-base @@ -0,0 +1,8 @@ +K 10 +svn:ignore +V 23 +get_version +make.opts + + +END diff --git a/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/.svn/entries b/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/.svn/entries new file mode 100644 index 0000000..1f4156e --- /dev/null +++ b/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/.svn/entries @@ -0,0 +1,164 @@ +9 + +dir +1870 +svn://svn.shaftnet.org/linux-wlan-ng/trunk/scripts +svn://svn.shaftnet.org/linux-wlan-ng + + + +2008-08-12T13:17:35.118175Z +1868 +pizza +has-props + +svn:special svn:externals svn:needs-lock + + + + + + + + + + + +7c16ee9a-e2ed-0310-ae25-9f6e1be264fe + +get_version.c +file + + + + +2009-01-07T08:13:01.000000Z +28a802bf81fdd843b9fceab4cefa67a3 +2006-08-21T14:49:06.038127Z +1796 +pizza +has-props + + + + + + + + + + + + + + + + + + + + +144 + +Makefile.get_options +file + + + + +2009-01-07T08:13:01.000000Z +394bde240e5a4dbf73109f16cb933ff4 +2008-08-12T13:17:35.118175Z +1868 +pizza +has-props + + + + + + + + + + + + + + + + + + + + +411 + +Makefile +file + + + + +2009-01-07T08:13:01.000000Z +1d3dc7da1e2009ca5ca029315c1c0de6 +2002-09-03T17:47:11.000000Z +1054 +solomon +has-props + + + + + + + + + + + + + + + + + + + + +939 + +pda.pl +file + + + + +2009-01-07T08:13:01.000000Z +cb2f8a47e96b9051c3b0fd68749b12d3 +2001-03-11T03:18:54.000000Z +567 +mark +has-props + + + + + + + + + + + + + + + + + + + + +5036 + diff --git a/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/.svn/format b/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/.svn/format new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/.svn/format @@ -0,0 +1 @@ +9 diff --git a/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/.svn/prop-base/Makefile.get_options.svn-base b/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/.svn/prop-base/Makefile.get_options.svn-base new file mode 100644 index 0000000..7b57b30 --- /dev/null +++ b/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/.svn/prop-base/Makefile.get_options.svn-base @@ -0,0 +1,9 @@ +K 13 +svn:eol-style +V 6 +native +K 12 +svn:keywords +V 23 +Author Date Id Revision +END diff --git a/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/.svn/prop-base/Makefile.svn-base b/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/.svn/prop-base/Makefile.svn-base new file mode 100644 index 0000000..7b57b30 --- /dev/null +++ b/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/.svn/prop-base/Makefile.svn-base @@ -0,0 +1,9 @@ +K 13 +svn:eol-style +V 6 +native +K 12 +svn:keywords +V 23 +Author Date Id Revision +END diff --git a/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/.svn/prop-base/get_version.c.svn-base b/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/.svn/prop-base/get_version.c.svn-base new file mode 100644 index 0000000..7b57b30 --- /dev/null +++ b/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/.svn/prop-base/get_version.c.svn-base @@ -0,0 +1,9 @@ +K 13 +svn:eol-style +V 6 +native +K 12 +svn:keywords +V 23 +Author Date Id Revision +END diff --git a/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/.svn/prop-base/pda.pl.svn-base b/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/.svn/prop-base/pda.pl.svn-base new file mode 100644 index 0000000..5336d10 --- /dev/null +++ b/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/.svn/prop-base/pda.pl.svn-base @@ -0,0 +1,13 @@ +K 13 +svn:eol-style +V 6 +native +K 14 +svn:executable +V 1 +* +K 12 +svn:keywords +V 23 +Author Date Id Revision +END diff --git a/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/.svn/text-base/Makefile.get_options.svn-base b/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/.svn/text-base/Makefile.get_options.svn-base new file mode 100644 index 0000000..d8a1524 --- /dev/null +++ b/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/.svn/text-base/Makefile.get_options.svn-base @@ -0,0 +1,10 @@ +KERNEL_VERSION := $(shell $(CURR_DIR)/get_version) +KERNEL_RELEASE := $(shell echo $(KERNEL_VERSION) | cut -d\" -f2| cut -c-5) + +include Makefile + +get_version_target: + echo "KERNEL_RELEASE=$(KERNEL_VERSION)" >> $(CURR_DIR)/make.opts + echo "CROSS_COMPILE='$(CROSS_COMPILE)'" >> $(CURR_DIR)/make.opts + echo "HOST_CC='$(HOSTCC)'" >> $(CURR_DIR)/make.opts + echo "HOST_CFLAGS='$(HOSTCFLAGS)'" >> $(CURR_DIR)/make.opts diff --git a/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/.svn/text-base/Makefile.svn-base b/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/.svn/text-base/Makefile.svn-base new file mode 100644 index 0000000..7f37e49 --- /dev/null +++ b/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/.svn/text-base/Makefile.svn-base @@ -0,0 +1,36 @@ +CURR_DIR :=$(shell pwd) + +export CURR_DIR + +.PHONY: get_version + +all: clean get_version get_options + +get_version: + @if [ ! -d $(KERNEL_SOURCE)/ ]; then \ + echo "";\ + echo "$(KERNEL_SOURCE) directory does not exist. Please edit the file 'config'";\ + echo "in this directory and set KERNEL_SOURCE to the correct location of your ";\ + echo "kernel source.";\ + echo "";\ + echo "You are currently running kernel version `uname -r`, the source code should";\ + echo "be for this version.";\ + echo "";\ + exit 1;\ + fi + @if [ ! -f $(KERNEL_SOURCE)/include/linux/version.h ]; then \ + echo "$(KERNEL_SOURCE)/include/linux/version.h is missing. Please run make config";\ + echo "in your kernel source tree";\ + exit 1;\ + fi + + $(CC) -I$(KERNEL_SOURCE)/include get_version.c -o get_version + +get_options: + $(MAKE) -f $(CURR_DIR)/Makefile.get_options -C $(KERNEL_SOURCE) get_version_target + +clean: + $(RM) get_version make.opts + +distclean: clean + diff --git a/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/.svn/text-base/get_version.c.svn-base b/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/.svn/text-base/get_version.c.svn-base new file mode 100644 index 0000000..cde9707 --- /dev/null +++ b/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/.svn/text-base/get_version.c.svn-base @@ -0,0 +1,11 @@ +#include <linux/version.h> + +#ifndef UTS_RELEASE +#include <linux/utsrelease.h> +#endif + +#include <stdio.h> +main() +{ + printf("%s", UTS_RELEASE); +} diff --git a/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/.svn/text-base/pda.pl.svn-base b/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/.svn/text-base/pda.pl.svn-base new file mode 100644 index 0000000..4d2464f --- /dev/null +++ b/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/.svn/text-base/pda.pl.svn-base @@ -0,0 +1,167 @@ +#!/usr/bin/perl + +use Getopt::Long; +GetOptions(qw(pda! diff! repl! xdiff=s)); + +sub usage { + print(q{ +Usage: +pda.pl pdafile +or +pda.pl --pda --diff --xdiff=0x0104,0x0007 pda1 pda2 > diff-pda1-pda2.pda + +--diff takes 2 filenams and prints a diff (2nd file will override the first on + records that are present in both +--pda saves output suitable for loading via prism2dl (mainly for --diff) +--repl generates merged PDA, that could be used as a replacement (prism2dl -p) +--xdiff exclude given PDR's from beeing overridden by dst PDA => those will be + generated from src pdafile (comma separated hexlist) +}); + exit(0); +} + +$pdr_codes = { + 0x0001 => 'PCB_PARTNUM', 0x0002 => 'PCB_TRACENUM', 0x0003 => 'NIC_SERIAL', + 0x0004 => 'MKK_MEASUREMENTS', 0x0005 => 'NIC_RAMSIZE', 0x0006 => 'MFISUPRANGE', + 0x0007 => 'CFISUPRANGE', 0x0008 => 'NICID', 0x0010 => 'REFDAC_MEASUREMENTS', + 0x0020 => 'VGDAC_MEASUREMENTS', 0x0030 => 'LEVEL_COMP_MEASUREMENTS', + 0x0040 => 'MODEM_TRIMDAC_MEASUREMENTS', 0x0101 => 'MAC_ADDRESS', 0x0102 => 'MKK_CALLNAME', + 0x0103 => 'REGDOMAIN', 0x0104 => 'ALLOWED_CHANNEL', 0x0105 => 'DEFAULT_CHANNEL', + 0x0106 => 'PRIVACY_OPTION', 0x0107 => 'TEMPTYPE', 0x0110 => 'REFDAC_SETUP', + 0x0120 => 'VGDAC_SETUP', 0x0130 => 'LEVEL_COMP_SETUP', 0x0140 => 'TRIMDAC_SETUP', + 0x0200 => 'IFR_SETTING', 0x0201 => 'RFR_SETTING', 0x0202 => 'HFA3861_BASELINE', + 0x0203 => 'HFA3861_SHADOW', 0x0204 => 'HFA3861_IFRF', 0x0300 => 'HFA3861_CHCALSP', + 0x0301 => 'HFA3861_CHCALI', 0x0900 => 'HFA3861_MANF_TESTSP', 0x0901 => 'HFA3861_MANF_TESTI', + 0x0000 => 'END_OF_PDA', +}; + +$pdr_fmt = { + 0x0001 => \&x2ascii_list, 0x0002 => \&x2ascii_list, 0x0003 => \&x2ascii_list, + 0x0101 => \&x2hex_list, 0x0103 => \&x2dec_list, 0x0104 => \&x2bit_list, + 0x0001 => \&x2ascii_list, +}; + +$srcfile=$ARGV[0]; +$dstfile=$ARGV[1]; + +if (defined $opt_xdiff) { + @xdiff = map {hex} split /\s*,\s*/, $opt_xdiff; + print "@@ xdiff: $opt_xdiff\n"; +} + +if (!defined $srcfile) { + usage(); +} +$src=read_pda($srcfile); + +if ($opt_diff) { + if (!defined $dstfile) { + usage(); + } + $dst=read_pda($dstfile); + + map { $join{$_->{code}} = 1; $src{$_->{code}} = $_; } @$src; + map { $join{$_->{code}} = 1; $dst{$_->{code}} = $_; } @$dst; + + for $code (sort {($a || $a+0x1000) <=> ($b || $b+0x1000)} keys %join) { + if (!defined $dst{$code}) { + push @{$diff{src}}, $src{$code}; + } elsif (!defined $src{$code}) { + push @{$diff{dst}}, $dst{$code}; + } elsif ($src{$code}{data} ne $dst{$code}{data}) { + push @{$diff{diff}}, [$src{$code}, $dst{$code}]; + } else { + push @{$diff{same}}, [$src{$code}, $dst{$code}]; + } + } + print "@@ Only in $srcfile:\n"; + for my $pdr (@{$diff{src}}) { + print_pdr($pdr, {prefix=>$opt_pda && !$opt_repl ? "#- " : ""}); + } + print "@@ Only in $dstfile:\n"; + for my $pdr (@{$diff{dst}}) { + print_pdr($pdr); + } + print "@@ Different:\n"; + for my $pdr (@{$diff{diff}}) { + if (grep {$_ == $pdr->[0]{code}} @xdiff) { + print_pdr($pdr->[0]); + } else { + if ($opt_pda && !$opt_repl && $pdr->[0]{len} != $pdr->[1]{len}) { + printf "0x%04x, 0x%04x,\n", 1, $pdr->[0]{code}; + } + print_pdr($pdr->[0], {prefix=>($opt_pda ? "#" : "").'- '}); + print_pdr($pdr->[1], {prefix=>($opt_pda ? "" : "+ ")}); + } + } + print "@@ Same:\n"; + for my $pdr (@{$diff{same}}) { + print_pdr($pdr->[0], {header=>!$opt_pda}); + } +} else { + for $pdr (sort {($a->{code} || $a->{code}+0x1000) <=> ($b->{code} || $b->{code}+0x1000)} @$src) { + print_pdr($pdr); + } +} +sub x2ascii_list { + my ($pdr) = @_; + my ($data) = $pdr->{data}; + $data =~ s/[\x0-\x1f\x80-\x9f]/sprintf "\\x%02x", $&/eg; + return $data; +} + +sub x2hex_list { + my ($pdr) = @_; + + return join(':', map { sprintf "%02x", ord($_) } split //, $pdr->{data}); +} +sub x2dec_list { + my ($pdr) = @_; + + return join(',', unpack('C*', $pdr->{data})); +} +sub x2bit_list { + my ($pdr) = @_; + my ($start) = 1; + + return join(',', map { $_ ? $start++ : scalar($start++, undef) } + split //, unpack("b*", $pdr->{data})); +} + +sub print_pdr { + my ($pdr, $opts) = @_; + my $data; + + if (exists($pdr_fmt->{$pdr->{code}})) { + $data = &{$pdr_fmt->{$pdr->{code}}}($pdr); + } + printf "%s# %s (0x%04x/0x%04x) %s\n", $opts->{prefix}, + $pdr_codes->{$pdr->{code}}, $pdr->{code}, $pdr->{len}, $data && "= $data"; + print $opts->{prefix}.join('', map {sprintf "0x%04x, ", $_} $pdr->{len}, $pdr->{code}, @{$pdr->{nums}})."\n" + unless $opts->{header}; +} + +sub read_pda { + my ($file) = @_; + my (@pda, $pdrs); + + open PDA, "$file" or die "$file: $!\n"; + while (<PDA>) { + s/[^\s\da-fx,].*//; + push @pda, grep { /^0x[\da-z]+$/i } split /[^x\da-z]+/i; + } + close PDA; + + my ($len, $op, @data); + + for (my $i=0; $i < @pda; $i+=$len+1) { + $len = hex($pda[$i]); + $code = hex($pda[$i+1]); + next unless $code; + $nums = [ map { hex } @pda[$i+2 .. $i+$len] ]; + $data = pack("v*", @$nums); + + push @$pdrs, {len=>$len, code=>$code, data=>$data, nums=>$nums}; + } + return $pdrs; +} diff --git a/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/Makefile b/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/Makefile new file mode 100644 index 0000000..7f37e49 --- /dev/null +++ b/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/Makefile @@ -0,0 +1,36 @@ +CURR_DIR :=$(shell pwd) + +export CURR_DIR + +.PHONY: get_version + +all: clean get_version get_options + +get_version: + @if [ ! -d $(KERNEL_SOURCE)/ ]; then \ + echo "";\ + echo "$(KERNEL_SOURCE) directory does not exist. Please edit the file 'config'";\ + echo "in this directory and set KERNEL_SOURCE to the correct location of your ";\ + echo "kernel source.";\ + echo "";\ + echo "You are currently running kernel version `uname -r`, the source code should";\ + echo "be for this version.";\ + echo "";\ + exit 1;\ + fi + @if [ ! -f $(KERNEL_SOURCE)/include/linux/version.h ]; then \ + echo "$(KERNEL_SOURCE)/include/linux/version.h is missing. Please run make config";\ + echo "in your kernel source tree";\ + exit 1;\ + fi + + $(CC) -I$(KERNEL_SOURCE)/include get_version.c -o get_version + +get_options: + $(MAKE) -f $(CURR_DIR)/Makefile.get_options -C $(KERNEL_SOURCE) get_version_target + +clean: + $(RM) get_version make.opts + +distclean: clean + diff --git a/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/Makefile.get_options b/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/Makefile.get_options new file mode 100644 index 0000000..d8a1524 --- /dev/null +++ b/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/Makefile.get_options @@ -0,0 +1,10 @@ +KERNEL_VERSION := $(shell $(CURR_DIR)/get_version) +KERNEL_RELEASE := $(shell echo $(KERNEL_VERSION) | cut -d\" -f2| cut -c-5) + +include Makefile + +get_version_target: + echo "KERNEL_RELEASE=$(KERNEL_VERSION)" >> $(CURR_DIR)/make.opts + echo "CROSS_COMPILE='$(CROSS_COMPILE)'" >> $(CURR_DIR)/make.opts + echo "HOST_CC='$(HOSTCC)'" >> $(CURR_DIR)/make.opts + echo "HOST_CFLAGS='$(HOSTCFLAGS)'" >> $(CURR_DIR)/make.opts diff --git a/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/get_version.c b/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/get_version.c new file mode 100644 index 0000000..cde9707 --- /dev/null +++ b/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/get_version.c @@ -0,0 +1,11 @@ +#include <linux/version.h> + +#ifndef UTS_RELEASE +#include <linux/utsrelease.h> +#endif + +#include <stdio.h> +main() +{ + printf("%s", UTS_RELEASE); +} diff --git a/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/pda.pl b/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/pda.pl new file mode 100755 index 0000000..4d2464f --- /dev/null +++ b/abs/core-testing/wlan-ng26-utils/tmp/trunk/scripts/pda.pl @@ -0,0 +1,167 @@ +#!/usr/bin/perl + +use Getopt::Long; +GetOptions(qw(pda! diff! repl! xdiff=s)); + +sub usage { + print(q{ +Usage: +pda.pl pdafile +or +pda.pl --pda --diff --xdiff=0x0104,0x0007 pda1 pda2 > diff-pda1-pda2.pda + +--diff takes 2 filenams and prints a diff (2nd file will override the first on + records that are present in both +--pda saves output suitable for loading via prism2dl (mainly for --diff) +--repl generates merged PDA, that could be used as a replacement (prism2dl -p) +--xdiff exclude given PDR's from beeing overridden by dst PDA => those will be + generated from src pdafile (comma separated hexlist) +}); + exit(0); +} + +$pdr_codes = { + 0x0001 => 'PCB_PARTNUM', 0x0002 => 'PCB_TRACENUM', 0x0003 => 'NIC_SERIAL', + 0x0004 => 'MKK_MEASUREMENTS', 0x0005 => 'NIC_RAMSIZE', 0x0006 => 'MFISUPRANGE', + 0x0007 => 'CFISUPRANGE', 0x0008 => 'NICID', 0x0010 => 'REFDAC_MEASUREMENTS', + 0x0020 => 'VGDAC_MEASUREMENTS', 0x0030 => 'LEVEL_COMP_MEASUREMENTS', + 0x0040 => 'MODEM_TRIMDAC_MEASUREMENTS', 0x0101 => 'MAC_ADDRESS', 0x0102 => 'MKK_CALLNAME', + 0x0103 => 'REGDOMAIN', 0x0104 => 'ALLOWED_CHANNEL', 0x0105 => 'DEFAULT_CHANNEL', + 0x0106 => 'PRIVACY_OPTION', 0x0107 => 'TEMPTYPE', 0x0110 => 'REFDAC_SETUP', + 0x0120 => 'VGDAC_SETUP', 0x0130 => 'LEVEL_COMP_SETUP', 0x0140 => 'TRIMDAC_SETUP', + 0x0200 => 'IFR_SETTING', 0x0201 => 'RFR_SETTING', 0x0202 => 'HFA3861_BASELINE', + 0x0203 => 'HFA3861_SHADOW', 0x0204 => 'HFA3861_IFRF', 0x0300 => 'HFA3861_CHCALSP', + 0x0301 => 'HFA3861_CHCALI', 0x0900 => 'HFA3861_MANF_TESTSP', 0x0901 => 'HFA3861_MANF_TESTI', + 0x0000 => 'END_OF_PDA', +}; + +$pdr_fmt = { + 0x0001 => \&x2ascii_list, 0x0002 => \&x2ascii_list, 0x0003 => \&x2ascii_list, + 0x0101 => \&x2hex_list, 0x0103 => \&x2dec_list, 0x0104 => \&x2bit_list, + 0x0001 => \&x2ascii_list, +}; + +$srcfile=$ARGV[0]; +$dstfile=$ARGV[1]; + +if (defined $opt_xdiff) { + @xdiff = map {hex} split /\s*,\s*/, $opt_xdiff; + print "@@ xdiff: $opt_xdiff\n"; +} + +if (!defined $srcfile) { + usage(); +} +$src=read_pda($srcfile); + +if ($opt_diff) { + if (!defined $dstfile) { + usage(); + } + $dst=read_pda($dstfile); + + map { $join{$_->{code}} = 1; $src{$_->{code}} = $_; } @$src; + map { $join{$_->{code}} = 1; $dst{$_->{code}} = $_; } @$dst; + + for $code (sort {($a || $a+0x1000) <=> ($b || $b+0x1000)} keys %join) { + if (!defined $dst{$code}) { + push @{$diff{src}}, $src{$code}; + } elsif (!defined $src{$code}) { + push @{$diff{dst}}, $dst{$code}; + } elsif ($src{$code}{data} ne $dst{$code}{data}) { + push @{$diff{diff}}, [$src{$code}, $dst{$code}]; + } else { + push @{$diff{same}}, [$src{$code}, $dst{$code}]; + } + } + print "@@ Only in $srcfile:\n"; + for my $pdr (@{$diff{src}}) { + print_pdr($pdr, {prefix=>$opt_pda && !$opt_repl ? "#- " : ""}); + } + print "@@ Only in $dstfile:\n"; + for my $pdr (@{$diff{dst}}) { + print_pdr($pdr); + } + print "@@ Different:\n"; + for my $pdr (@{$diff{diff}}) { + if (grep {$_ == $pdr->[0]{code}} @xdiff) { + print_pdr($pdr->[0]); + } else { + if ($opt_pda && !$opt_repl && $pdr->[0]{len} != $pdr->[1]{len}) { + printf "0x%04x, 0x%04x,\n", 1, $pdr->[0]{code}; + } + print_pdr($pdr->[0], {prefix=>($opt_pda ? "#" : "").'- '}); + print_pdr($pdr->[1], {prefix=>($opt_pda ? "" : "+ ")}); + } + } + print "@@ Same:\n"; + for my $pdr (@{$diff{same}}) { + print_pdr($pdr->[0], {header=>!$opt_pda}); + } +} else { + for $pdr (sort {($a->{code} || $a->{code}+0x1000) <=> ($b->{code} || $b->{code}+0x1000)} @$src) { + print_pdr($pdr); + } +} +sub x2ascii_list { + my ($pdr) = @_; + my ($data) = $pdr->{data}; + $data =~ s/[\x0-\x1f\x80-\x9f]/sprintf "\\x%02x", $&/eg; + return $data; +} + +sub x2hex_list { + my ($pdr) = @_; + + return join(':', map { sprintf "%02x", ord($_) } split //, $pdr->{data}); +} +sub x2dec_list { + my ($pdr) = @_; + + return join(',', unpack('C*', $pdr->{data})); +} +sub x2bit_list { + my ($pdr) = @_; + my ($start) = 1; + + return join(',', map { $_ ? $start++ : scalar($start++, undef) } + split //, unpack("b*", $pdr->{data})); +} + +sub print_pdr { + my ($pdr, $opts) = @_; + my $data; + + if (exists($pdr_fmt->{$pdr->{code}})) { + $data = &{$pdr_fmt->{$pdr->{code}}}($pdr); + } + printf "%s# %s (0x%04x/0x%04x) %s\n", $opts->{prefix}, + $pdr_codes->{$pdr->{code}}, $pdr->{code}, $pdr->{len}, $data && "= $data"; + print $opts->{prefix}.join('', map {sprintf "0x%04x, ", $_} $pdr->{len}, $pdr->{code}, @{$pdr->{nums}})."\n" + unless $opts->{header}; +} + +sub read_pda { + my ($file) = @_; + my (@pda, $pdrs); + + open PDA, "$file" or die "$file: $!\n"; + while (<PDA>) { + s/[^\s\da-fx,].*//; + push @pda, grep { /^0x[\da-z]+$/i } split /[^x\da-z]+/i; + } + close PDA; + + my ($len, $op, @data); + + for (my $i=0; $i < @pda; $i+=$len+1) { + $len = hex($pda[$i]); + $code = hex($pda[$i+1]); + next unless $code; + $nums = [ map { hex } @pda[$i+2 .. $i+$len] ]; + $data = pack("v*", @$nums); + + push @$pdrs, {len=>$len, code=>$code, data=>$data, nums=>$nums}; + } + return $pdrs; +} |