if($fieldn =~ m/^[^\(.]*\(\s*([0-1]+)\s*\).*$/) {
if(length($1) == $fields[$count]) {
- push(@bitlist,$1);
+ push(@bitlist,'S'.$1);
$fieldn =~ s/\s?\(\s*[0-1]+\s*\)//;
$pvline = 1;
}
else {
- $x = '';
- for($i = 1; $i <= $fields[$count]; $i++) {
- $x .= 'X';
- }
- push(@bitlist,$x);
+ $x = 'LX';
+ push(@bitlist,$x);
}
}
else {
- $x = '';
- for($i = 1; $i <= $fields[$count]; $i++) {
- $x .= 'X';
- }
+ $x = 'LX';
push(@bitlist,$x);
}
#$tabular .= $fieldn.": ". $bits." \\\\";
$count++;
}
- my $bitlist = join("",@bitlist);
#$tabular .= "\\textbf{names:} @fieldnames \n";
#$tabular .= "\\textbf{bitlist:} $bitlist \n";
$bline .= "\\\\ \\hline \n";
}
- #build bitvalue
- $vline .= substr($bitlist,($bits-1)-$i,1);
- if($i != 0) {
- $vline .= " & ";
- }
- else {
- $vline .= "\\\\ \\hline \n";
- }
-
- #build nameline
+ #build nameline and bitvalue
#because of multicolumn we need to limit execution
if($i == $count) {
$nline .= "\\multicolumn{@fields[0]}{>{\\columncolor{names}}c|}{@fieldnames[0]}";
+ if(substr(@bitlist[0],0,1) eq "L") {
+ $vline .= "\\multicolumn{@fields[0]}{>{\\columncolor{bitval}}c|}{".substr(@bitlist[0],1)."}";
+ }
+ else {
+ for(my $j = 1; $j <= @fields[0]; $j++) {
+ $vline .= substr(@bitlist[0],$j,1);
+ if($j != @fields[0]) {
+ $vline .= " & ";
+ }
+ }
+ }
+
#update count
$count -= @fields[0];
if($count < 0) {
$nline .= "\\\\ \\hline \n";
+ $vline .= "\\\\ \\hline \n";
}
else {
$nline .= " & ";
+ $vline .= " & ";
}
+ shift(@bitlist);
shift(@fieldnames);
shift(@fields);
}