15 require Nasm
::Regs
::Register
;
16 require Nasm
::Regs
::Format
;
20 Creates Nasm::Regs object
24 my($class,$filename) = @_;
25 my $self = bless {}, $class;
27 if( @_ > 1 and $filename ){
28 $self->ProcessFile($filename);
41 my($self,$filename) = @_;
44 if( $filename eq '-'){
47 open $file, '<', $filename or die;
49 $self->{filename
} = $filename;
51 my %current =( line_number
=> -1 );
53 while( my $line = <$file> ){
54 $current{line_number
}++;
56 $line =~ s/\s*(?:\#.*)?$//;
57 next unless length $line;
59 $current{line
} = $line;
60 $self->_ProcessLine(\
%current);
70 my($self,$current) = @_;
72 unless( $current->{line
} =~ /^\s*(\S+)\s*(\S+)\s*(\S+)\s*([0-9]+)$/ ){
76 my ($register,$a_class,$d_classes,$x86regno) = ($1,$2,$3,$4);
82 (.*?
) (\d
+) - (\d
+) (.*)
86 push @reg_list, $1. $i . $4
90 @reg_list = $register;
93 # force numeric conversion
96 my @d_classes = split ',', $d_classes;
99 for my $register(@reg_list){
100 my $reg_obj = Nasm
::Regs
::Register
->new($register,$a_class,[@d_classes],$x86regno);
101 $self->{register
}{$register} = $reg_obj;
103 for my $class (@d_classes){
104 $self->{disassembler
}{$class}[$x86regno] = $reg_obj
116 Returns a sorted list of RegisterNames
122 return $self->RegisterNames;
127 Returns a sorted list of RegisterNames
132 my @keys = sort grep { length $_ } keys %{$self->{register
}};
134 return @keys if wantarray;
140 =head2 Register( $register_name )
142 Returns a Register object
146 my($self,$register_name) = @_;
147 return $self->{register
}{$register_name};
150 =head2 DisassemblerClasses
152 Returns a sorted list of DisassemblerClasses
155 sub DisassemblerClasses
{
157 my @return = sort keys %{$self->{disassembler
}};
159 return @return if wantarray;
163 =head2 DisassemblerClass( $class )
168 sub DisassemblerClass
{
169 my($self,$class) = @_;
170 my $return = $self->{disassembler
}{$class};
171 return @
$return if wantarray;
176 =head2 format( $format_type )
178 Returns regs info in a given format
183 require Nasm
::Regs
::Format
;
184 Nasm
::Regs
::Format
::format
($self,$fmt);
190 Returns the name of the file the data was loaded from
195 return $self->{filename
};