From 6ba5eefd5e3fdecc3b03012e41558a35af163321 Mon Sep 17 00:00:00 2001 From: Michael Wiebusch Date: Mon, 8 Dec 2014 17:57:58 +0100 Subject: [PATCH] added --norepeat option to xmldb2tex.pl, supresses excessive printing of repeated registers --- xml-db/xml-db2tex.pl | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/xml-db/xml-db2tex.pl b/xml-db/xml-db2tex.pl index b229bac..7ac49ee 100755 --- a/xml-db/xml-db2tex.pl +++ b/xml-db/xml-db2tex.pl @@ -31,6 +31,7 @@ GetOptions( 'standalone' => \$opt->{standalone}, 'wide|w' => \$opt->{wideformat}, 'collapse' => \$opt->{collapse}, + 'norepeat' => \$opt->{norepeat}, 'dumpItem|d' => \$opt->{dumpItem} ); @@ -103,9 +104,12 @@ Options: alternating gray and white boxes (default) - --collapse Dont show extra field line, if a register contains + --collapse Don't show extra field line, if a register contains only single field without description + --norepeat Summarize repeated registers instead of printing + every slice + --standalone generate standalone compilable latex file --pdf compile directly to pdf (compiles twice) @@ -208,15 +212,22 @@ sub produceTable { } for (my $i=0;$i<$repeat;$i++){ my $name_ = $name; - if ($repeat > 1) { - $name_ = $name.".$i"; - } my $addr_ = $node->{address}+$i*$stepsize; my $hexaddr = sprintf("%04x",$addr_ ); + + if ($repeat > 1) { + if ($self->{opt}->{norepeat}){ + $name_ = $name.".0-".($repeat-1); + $hexaddr = sprintf("%04x...%04x", $addr_, $addr_ + $stepsize*($repeat-1)); + } else { + $name_ = $name.".$i"; + } + } my $rw = $node->{mode}; if ($type eq 'register' || $type eq 'registerfield' || $type eq 'memory'){ #write register names bold +# $name_ = '\textbf{'.$name_.'}'.'\\ \hfill('.$rw.')'; $name_ = '\textbf{'.$name_.'}'.'\hfill('.$rw.')'; } if ($type eq 'field'){ @@ -231,6 +242,9 @@ sub produceTable { addr_uint => $addr_, description => $description }); + + last if $self->{opt}->{norepeat}; + } } -- 2.43.0