4 $SIG{__WARN__} = sub { die @_; };
6 # xxx much of the comment below is TODO
8 # We generate a physical indication of which commit was used.
10 # We provide for a scaling factor
12 # $Commitid_pixelsz = 0.4;
13 # $Commitid_depth = 1.5; // in pixels
15 # For each form we have
17 # module Commitid_Form_2D(pixelsz=0.4)
18 # module Commitid_Form(pixelsz=0.4, depth=pixelsz)
20 # function Commitid_Form_size(pixelsz=$Commitid_pixelsz) => [ xsz, ysz ]
23 # We can generate these forms:
31 # git rev-list --first-parent --count HEAD
32 # typically 3-4 characters but we allow for up to 6
39 # same but in two lines eg
53 # git-rev-list --first-parent --count HEAD
59 sub p { print @_ or die $!; }
65 last if %cellmap && !m/\S/;
74 my @chrs = split / /, $_;
75 <DATA> !~ m/\S/ or die;
76 foreach my $row (reverse 0..4) {
87 foreach my $chr (@chrs) {
88 s{^ }{} or die "$chr $_ ?";
89 foreach my $col (0..2) {
95 $f =~ s/\b\d/ sprintf '%05d', $col*4000 + $&*2050 /ge;
96 $f =~ s/\d\b/ sprintf '%05d', $row*4000 + $&*2050 /ge;
97 push @{ $chrpolys{$chr} }, [ split / /, $f ];
109 foreach my $chr (sort keys %chrpolys) {
110 my $chrx = sprintf '%#x', ord $chr;
111 my $mod = "Commitid__chr_$chrx";
112 p "module $mod () {\n";
113 foreach my $poly (@{ $chrpolys{$chr} }) {
116 foreach my $pt (@$poly) {
118 $pt =~ s{\d{5}}{$&,};
119 $pt =~ s{\b\d}{$&.}g;
126 my $px = @demo % $democols;
127 my $py = int(@demo / $democols);
128 push @demo, " translate([$px * 1.600, $py * 2.400]) $mod ();\n";
130 p "module Commitid_FontDemo(){\n";
135 # print Dumper(\%chrpolys);
140 #p "Commitid_FontDemo();\n";
154 /#\ r /#\ ##\ # # ### // ### /#\ /#\
155 # # /# # # # # # # # # # # #
156 # # # /#/ ##< \## ##\ ##\ // >#< \##
157 # # # # # # # # # # # # #
158 \#/ /#\ ### ##/ # ##/ \#/ # \#/ ##/
163 /## ##\ /## /## /#\ #
164 # # # # # # # #r/ ###
166 \## ##/ \## \## \#/ #