From: Mischa POSLAWSKY Date: Mon, 21 Nov 2022 19:40:41 +0000 (+0100) Subject: logarithmic repeat markers multiply by 10 X-Git-Tag: v1.10~33 X-Git-Url: http://git.shiar.nl/barcat.git/commitdiff_plain/87c290944ab32022709bdd9e72bc2733745bc2a3 logarithmic repeat markers multiply by 10 Quick solution to make it at least somewhat useful. --- diff --git a/barcat b/barcat index 1ffdeda..431ed40 100755 --- a/barcat +++ b/barcat @@ -263,10 +263,10 @@ if ($opt{markers} and $size > 0) { return $func; } elsif ($func =~ /\A\/($float)\z/) { - my @range = $1; - #TODO log - for (my $next = $1; $next < $maxval; $next += $range[0]) { - push @range, $next; + my @range = my $multiple = my $next = $1; + while ($next < $maxval) { + $multiple *= 10 if $opt{log}; + push @range, $next += $multiple; } return @range; } diff --git a/t/t2258-repeat_markers_--mark=:/1.out b/t/t2258-repeat_markers_--mark=:/1.out index 369ae19..c23950d 100644 --- a/t/t2258-repeat_markers_--mark=:/1.out +++ b/t/t2258-repeat_markers_--mark=:/1.out @@ -6,4 +6,4 @@ 6 ---:---:---:---:----:---: 7 ---:---:---:---:----:---:---:- 8 ---:---:---:---:----:---:---:---:- -9 ---:---:---:---:----:---:---:---:----- +9 ---:---:---:---:----:---:---:---:----: diff --git a/t/t2259-log_axis.in b/t/t2259-log_axis.in new file mode 120000 index 0000000..655505d --- /dev/null +++ b/t/t2259-log_axis.in @@ -0,0 +1 @@ +t1260-powers_of_ten.in \ No newline at end of file diff --git a/t/t2259-log_axis_-e_--markers=+/1.out b/t/t2259-log_axis_-e_--markers=+/1.out new file mode 100644 index 0000000..4cd6f7c --- /dev/null +++ b/t/t2259-log_axis_-e_--markers=+/1.out @@ -0,0 +1,7 @@ + 1 + 10 ----+- + 100 ----+-----+ + 1000 ----+-----+----+- + 1e4 ----+-----+----+-----+ +100000 ----+-----+----+-----+----+- + 1e6 ----+-----+----+-----+----+-----+