Reworked test files for better error reporting
[nasm/perl-rewrite.git] / perl / lib / Nasm / Regs / Format / VC.pm
blobeeabe40cd17da230644c5448dd25fb6f8c6b4686
1 =head1 NAME
3 Nasm::Regs::Format::VC
5 =cut
7 package Nasm::Regs::Format::VC;
8 use strict;
9 use warnings;
11 sub _format{
12 my($regs) = @_;
13 my $filename = $regs->filename;
15 my $out = <<END;
16 /* automatically generated from $filename - do not edit */
18 #include "tables.h"
20 const int nasm_regvals[] = {
21 -1,
22 END
24 my @names = $regs->names;
26 #$out .= qq[ "];
27 for my $name (@names){
28 my $reg = $regs->Register($name)->x86RegisterNumber;
29 $out .= sprintf(" %2d, /* %-5s */\n", $reg, $name)
32 $out .= "};\n";
34 return $out;
38 __END__
40 # Output regvals.c
41 print "/* automatically generated from $file - do not edit */\n\n";
42 print "#include \"tables.h\"\n\n";
43 print "const int nasm_regvals[] = {\n";
44 print " -1,\n"; # Dummy entry for 0
45 foreach $reg ( sort(keys(%regs)) ) {
46 # Print the x86 value of the register
47 printf " %2d, /* %-5s */\n", $regvals{$reg}, $reg;
49 print "};\n";