Reworked test files for better error reporting
[nasm/perl-rewrite.git] / perl / phash.pl
blob646fe7f46103c0c10ae2b6e225e59bda09a60d72
1 #! /usr/bin/env perl
4 # not completed, possibly not needed
6 use strict;
7 use warnings;
9 use lib 'lib';
11 use phash;
13 my %data = read_input;
14 my($n, $sv, $g) = gen_perfect_hash(%data);
16 use Data::Dump 'dump';
17 use 5.010;
18 say STDERR dump \%data;
19 say STDERR dump $n,$sv,$g;
22 print "static int HASHNAME_fg1[$n] =\n{\n";
24 for( my $i = 0; $i < $n; $i++ ){
25 no warnings 'uninitialized';
26 my $h = ${$g}[$i*2+0] || 'UNUSED';
27 say $h;
28 #print "\t", ${$g}[${$f1}[$i]], "\n";
31 print "};\n\n";
35 print "static int HASHNAME_fg2[$n] =\n{\n";
37 for( my $i = 0; $i < $n; $i++ ){
38 no warnings 'uninitialized';
39 no warnings 'uninitialized';
40 my $h = ${$g}[$i*2+1] || 'UNUSED';
41 say $h;
42 #print "\t", ${$g}[${$f2}[$i]], "\n";
45 print "};\n\n";
48 print <<END;
49 struct p_hash HASHNAME =
51 \t$n
52 \t$sv->[0],$sv->[1]
53 \tHASHNAME_fg1,
54 \tHASHNAME_fg2,
56 END