Added New regs.pl, and associated modules
[nasm/perl-rewrite.git] / perl / lib / Nasm / Regs / Register.pm
blob04ee8814cb8eb9c3e653a4360892a5f14b28ed13
1 use strict;
2 use warnings;
4 package Nasm::Regs::Register;
6 sub new{
7 my($class,@v) = @_;
8 $v[0] =~ s/^\s+|\s+$//g;
10 my $self = bless \@v, $class;
12 return $self;
15 BEGIN{
16 my $i = -1;
17 for my $sub_name(qw'RegisterName AssemblerClass',undef,'x86RegisterNumber'){
18 no strict 'refs';
19 $i++;
20 my $i = $i;
21 next unless $sub_name;
22 *$sub_name = sub{
23 my($self) = @_;
24 return $self->[$i];
29 sub DisassemberClasses{
30 my($self) = @_;
31 my @classes;
32 if( ref $self->[2] ){
33 @classes = @{$self->[2]}
34 }else{
35 @classes = $self->[2]
37 return @classes if wantarray;
38 return \@classes;