grepDb.pl: expand tabs
Warning, cannot access the index:
_darcs/index: opening of '_darcs/index' failed: permission denied (Permission denied)
diff -rN -u old-bii_scripts/bin/grepDb.pl new-bii_scripts/bin/grepDb.pl
--- old-bii_scripts/bin/grepDb.pl 2022-12-09 19:29:16.054124824 +0100
+++ new-bii_scripts/bin/grepDb.pl 2022-12-09 19:29:16.054124824 +0100
@@ -76,8 +76,8 @@
" -tt/-it <recType>: match/ignore record <recType>\n".
" -tr/-ir <recName>: match/ignore record <recName>\n".
" -tf/-if <fieldType>: match/ignore field <fieldType>\n".
- " -tv/-iv <value>: match/ignore field contains <value>\n".
- " -tl:<value> show db linkage (other trace options usable to reduce output)\n\n".
+ " -tv/-iv <value>: match/ignore field contains <value>\n".
+ " -tl:<value> show db linkage (other trace options usable to reduce output)\n\n".
" -th: show hardware access fields (other trace options usable to reduce output)\n\n".
"PRINT OPTIONS: defines the output fields. The record name and type is allways shown.\n".
" Default output is the field defined with '-tf' option or all fields if '-tf' isn't defined:\n\n".
@@ -120,7 +120,7 @@
my $igFieldName = "___";
die $usage unless GetOptions("tt=s"=>\$trigRecType, "tr=s"=>\$trigRecName, "tf=s"=>\$trigFieldName, "tv=s"=>\$trigFieldValue,
- "it=s"=>\$trIgRecType, "ir=s"=>\$trIgRecName, "if=s"=>\$trIgFieldName, "iv=s"=>\$trIgFieldValue,
+ "it=s"=>\$trIgRecType, "ir=s"=>\$trIgRecName, "if=s"=>\$trIgFieldName, "iv=s"=>\$trIgFieldValue,
"pt"=>\$prRecType, "pr=s"=>\$prRecName, "pf=s"=>\$prFieldName, "ipf=s"=>\$igFieldName,
"i"=>\$ignore,"pT"=>\$ptable,"pH"=>\$pHash,"v"=>\$verbose,"q"=>\$quiet,"th"=>\$hwFields,"tl=s"=>\$links);
@@ -130,7 +130,7 @@
if( defined $quiet && defined $verbose )
{
warn "Option 'quiet' overrides option 'verbose'";
- $verbose = undef;
+ $verbose = undef;
}
if( defined $ignore )
@@ -145,23 +145,23 @@
if( defined $links && !defined $hwFields)
{
$trigFieldName = "INP|OUT|LNK|DOL";
- $trigFieldValue = $links;
+ $trigFieldValue = $links;
}
elsif( defined $hwFields && !defined $links)
{
$trigFieldName = "DTYP";
- $trIgFieldValue = "Soft|Hw";
- if( $prFieldName ne "." ) {
- $prFieldName = "$prFieldName|DTYP|OUT|INP|PORT|OBJ|MUX\$";
- }
- else {
- $prFieldName = "DTYP|OUT|INP|MUX|BTYP|CLAS|OBJ|INHB|PORT|UTYP|ATYP|DLEN\$";
- }
- $ptable = 1;
+ $trIgFieldValue = "Soft|Hw";
+ if( $prFieldName ne "." ) {
+ $prFieldName = "$prFieldName|DTYP|OUT|INP|PORT|OBJ|MUX\$";
+ }
+ else {
+ $prFieldName = "DTYP|OUT|INP|MUX|BTYP|CLAS|OBJ|INHB|PORT|UTYP|ATYP|DLEN\$";
+ }
+ $ptable = 1;
}
elsif( defined $hwFields && defined $links )
{
- die("What a confusion, define just one option: -tl OR -th !");
+ die("What a confusion, define just one option: -tl OR -th !");
}
# default if NO print options are set: the trigger options!
@@ -194,8 +194,8 @@
}
my ($rH_records,$rH_recName2recType) = parseDb($file,$filename);
-
- # process trigger options
+
+ # process trigger options
foreach my $record (keys(%$rH_records))
{
my $recT = $rH_recName2recType->{$record} ;
@@ -205,10 +205,10 @@
foreach my $field ( keys( %{$rH_records->{$record}} ) )
{
my $fVal = $rH_records->{$record}->{$field};
- next if(match($recT,$trIgRecType) );
- next if(match($record,$trIgRecName) );
- next if(match($field,$trIgFieldName) );
- next if(match($fVal,$trIgFieldValue) );
+ next if(match($recT,$trIgRecType) );
+ next if(match($record,$trIgRecName) );
+ next if(match($field,$trIgFieldName) );
+ next if(match($fVal,$trIgFieldValue) );
if( (defined $filename) && match($field,$trigFieldName) && match($fVal,$trigFieldValue) )
{
$printStr .= "File: \"$filename\"\n" unless defined $quiet;
@@ -227,40 +227,40 @@
if( defined $ptable )
{
- my $idx=1; # idx 0 is the record name!
- my $rH_recIdx;
- my $rA_header;
- foreach (sort(keys(%$rH_fields)))
- {
- $rA_header->[$idx]=$_;
- $rH_fields->{$_} =$idx++
- }
- $rA_header->[0]="Record";
- $idx=0;
- $rH_recIdx->{$_} =$idx++ foreach (sort(keys(%$rH_prTable)));
-
- my $rA_table;
-
- if($ptable eq "HASH") {
- print Dumper($rH_prTable);
- }
- else
- {
- foreach my $rec (keys(%$rH_prTable))
- {
- $rA_table->[$rH_recIdx->{$rec}]->[0] = $rec;
- foreach my $field (sort(keys( %{$rH_prTable->{$rec}} )))
- {
- $rA_table->[$rH_recIdx->{$rec}]->[$rH_fields->{$field}] = $rH_prTable->{$rec}->{$field};
- }
- }
+ my $idx=1; # idx 0 is the record name!
+ my $rH_recIdx;
+ my $rA_header;
+ foreach (sort(keys(%$rH_fields)))
+ {
+ $rA_header->[$idx]=$_;
+ $rH_fields->{$_} =$idx++
+ }
+ $rA_header->[0]="Record";
+ $idx=0;
+ $rH_recIdx->{$_} =$idx++ foreach (sort(keys(%$rH_prTable)));
+
+ my $rA_table;
+
+ if($ptable eq "HASH") {
+ print Dumper($rH_prTable);
+ }
+ else
+ {
+ foreach my $rec (keys(%$rH_prTable))
+ {
+ $rA_table->[$rH_recIdx->{$rec}]->[0] = $rec;
+ foreach my $field (sort(keys( %{$rH_prTable->{$rec}} )))
+ {
+ $rA_table->[$rH_recIdx->{$rec}]->[$rH_fields->{$field}] = $rH_prTable->{$rec}->{$field};
+ }
+ }
- printData::printTable($rA_table,$rA_header,0);
- }
+ printData::printTable($rA_table,$rA_header,0);
+ }
}
else
{
- print $printStr;
+ print $printStr;
}
sub parseDb
@@ -272,12 +272,12 @@
my $rH_recName2recType;
foreach my $recname (keys %$r_h)
{
- foreach my $key (keys(%{$r_h->{$recname}->{FIELDS}}))
- {
- $r_h->{$recname}->{FIELDS}->{$key} =~ s/\$\((.*?),recursive\)/\$($1)/g;
- $r_h->{$recname}->{FIELDS}->{$key} =~ s/\$\((.*?),undefined\)/\$($1)/g;
- }
- $rH_records->{$recname}= $r_h->{$recname}->{FIELDS};
+ foreach my $key (keys(%{$r_h->{$recname}->{FIELDS}}))
+ {
+ $r_h->{$recname}->{FIELDS}->{$key} =~ s/\$\((.*?),recursive\)/\$($1)/g;
+ $r_h->{$recname}->{FIELDS}->{$key} =~ s/\$\((.*?),undefined\)/\$($1)/g;
+ }
+ $rH_records->{$recname}= $r_h->{$recname}->{FIELDS};
$rH_recName2recType->{$recname}= $r_h->{$recname}->{TYPE};
};
@@ -296,22 +296,22 @@
my $recordFlag;
$prFieldName .= '|RTYP' unless $prFieldName =~ /RTYP/;
if( defined $ptable )
- { $rH_records->{$record}->{'RTYP'} = $recT;
+ { $rH_records->{$record}->{'RTYP'} = $recT;
- foreach my $field ( sort(keys( %{$rH_records->{$record}} )) )
- {
+ foreach my $field ( sort(keys( %{$rH_records->{$record}} )) )
+ {
my $fVal = $rH_records->{$record}->{$field};
if( (not defined $recordFlag) && match($record,$prRecName) && match($recT,$prRecType) && match($field,$prFieldName) )
{
- $recordFlag = 1;
+ $recordFlag = 1;
}
if( (defined $recordFlag) && match($field,$prFieldName) )
{
- $rH_prTable->{$record}->{$field}=$fVal;
- $rH_fields->{$field}=1;
+ $rH_prTable->{$record}->{$field}=$fVal;
+ $rH_fields->{$field}=1;
}
- }
- return;
+ }
+ return;
}
foreach my $field ( sort(keys( %{$rH_records->{$record}} )) )
{
patch 21dba3079e2da3002a6eb53624c99d27d6a3bb34
Author: Bernhard.Kuner@bessy.de
Date: Thu Oct 28 12:43:15 CEST 2021
* grepDb.pl: expand tab