- for ($self->{LIST}) {
- pos $_ = 0;
- if ($bits > 1) {
- LINE:
- while (/^([0-9a-fA-F]+)(?:\t([0-9a-fA-F]+)?)(?:\t([0-9a-fA-F]+))?/mg) {
- my $min = hex $1;
- my $max = (defined $2 ? hex $2 : $min);
- my $val = hex $3;
- next if $max < $start;
- print "$min $max $val\n" if DEBUG;
- if ($none) {
- if ($min < $start) {
- $val += $start - $min if $val < $none;
- $min = $start;
- }
- for ($key = $min; $key <= $max; $key++) {
- last LINE if $key >= $end;
- print STDERR "$key => $val\n" if DEBUG;
- vec($swatch, $key - $start, $bits) = $val;
- ++$val if $val < $none;
- }
- }
- else {
- if ($min < $start) {
- $val += $start - $min;
- $min = $start;
- }
- for ($key = $min; $key <= $max; $key++, $val++) {
- last LINE if $key >= $end;
- print STDERR "$key => $val\n" if DEBUG;
- vec($swatch, $key - $start, $bits) = $val;
- }
- }
- }
- }
- else {
- LINE:
- while (/^([0-9a-fA-F]+)(?:\t([0-9a-fA-F]+))?/mg) {
- my $min = hex $1;
- my $max = (defined $2 ? hex $2 : $min);
- next if $max < $start;
- if ($min < $start) {
- $min = $start;
- }
- for ($key = $min; $key <= $max; $key++) {
- last LINE if $key >= $end;
- print STDERR "$key => 1\n" if DEBUG;
- vec($swatch, $key - $start, 1) = 1;
- }
- }
- }
- }
- for my $x ($self->{EXTRAS}) {
- pos $x = 0;
- while ($x =~ /^([-+!])(.*)/mg) {
- my $char = $1;
- my $name = $2;
- print STDERR "INDIRECT $1 $2\n" if DEBUG;
- my $otherbits = $self->{$name}->{BITS};
- croak("SWASHGET size mismatch") if $bits < $otherbits;
- my $other = $self->{$name}->SWASHGET($start, $len);
- if ($char eq '+') {
- if ($bits == 1 and $otherbits == 1) {
- $swatch |= $other;
- }
- else {
- for ($key = 0; $key < $len; $key++) {
- vec($swatch, $key, $bits) = vec($other, $key, $otherbits);
- }
- }
- }
- elsif ($char eq '!') {
- if ($bits == 1 and $otherbits == 1) {
- $swatch |= ~$other;
- }
- else {
- for ($key = 0; $key < $len; $key++) {
- if (!vec($other, $key, $otherbits)) {
- vec($swatch, $key, $bits) = 1;
- }
- }
- }
- }
- elsif ($char eq '-') {
- if ($bits == 1 and $otherbits == 1) {
- $swatch &= ~$other;
- }
- else {
- for ($key = 0; $key < $len; $key++) {
- if (vec($other, $key, $otherbits)) {
- vec($swatch, $key, $bits) = 0;
- }
- }
- }
- }
- }
- }
- if (DEBUG) {
- print STDERR "CELLS ";
- for ($key = 0; $key < $len; $key++) {
- print STDERR vec($swatch, $key, $bits), " ";
- }
- print STDERR "\n";
- }
- $swatch;