7 die "Usage: $0 <JEP106 PDF document>\n\n"
8 . "Convert the JEDEC document containing manufacturer identification codes\n"
9 . "to an array initializer suitable for incusion into jep106.c. The latest\n"
10 . "version of the document can be found here:\n"
11 . "http://www.jedec.org/standards-documents/results/jep106\n";
14 my $outfile = dirname($0) . "/jep106.inc";
16 open(my $out, ">", $outfile) || die "Cannot open $outfile: $!\n";
17 open(my $pdftotext, "pdftotext -layout $ARGV[0] - |") || die "Cannot fork: $!\n";
19 print $out "/* Autogenerated with " . basename($0) . "*/\n";
23 while (<$pdftotext>) {
24 if (/^[0-9]+[[:space:]]+(.*?)[[:space:]]+([01][[:space:]]+){8}([0-9A-F]{2})$/) {
28 my $id=sprintf("0x%02x",hex($3)&0x7f);
29 print $out "[$bank][$id - 1] = \"$1\",\n";
33 close $pdftotext || die "Error: $! $?\n";
35 print $out "/* EOF */\n";