7 package Nasm
::insns
::Flags
;
14 # 8086 186 286 386 486
15 # X64 X86_64 PENT CYRIX P6 IA64
21 our( %map2id, %also_enable, @arch);
23 # load up variables from the data below __DATA__
28 open( my $data, '<&DATA' ) or die;
33 # seek to end of Perl code
34 local $/ = "\n__DATA__\n";
38 # split the embedded YAML code on '...'
40 @yaml_streams = <$data>;
45 #use Data::Dump 'dump';
47 use Scalar
::Util qw
'reftype';
49 my $dir = Load
$yaml_streams[0];
50 for my $variable_name ( keys %$dir ){
51 my $index = $dir->{$variable_name};
53 $variable_name =~ s/^([%@\$])//;
62 my $ref = Load
$yaml_streams[$index] or
63 warn "unable to load YAML item \"$variable_name\"\n";
65 my $reftype = reftype
$ref;
73 $type ||= $type_map{$reftype};
76 die unless $reftype eq 'HASH';
77 %{*$variable_name} = %$ref;
78 }elsif( $type eq '@' ){
79 die unless $reftype eq 'ARRAY';
80 @
{*$variable_name} = @
$ref;
81 }elsif( $type eq '$' ){
82 ${*$variable_name} = $ref;
88 #use Data::Dump 'dump';
90 #say dump $_ for ( \%map2id, \%also_enable, \@arch);
91 # end of initialization
99 Creates a new Nasm::insns::Flags object
104 my( $class, $string ) = @_;
106 my $self = bless [], $class;
108 $string =~ s/^ \s+ //gx;
109 $string =~ s/ \s+ $//gx;
111 return $self unless $string;
112 return $self if $string eq 'ignore';
114 @
$self = split ',', $string;
122 # All YAML streams must be seperated by a single "..." line
124 # The first YAML stream should start immediately after the __DATA__ line
126 # The first YAML stream is the dir stream, it is used to map the global variable
131 # "global variable": "YAML stream number"
132 # all of the following global variables should have been
133 # defined with "our %global" at the top of the file
135 # any stream not referenced here will not be loaded
141 # "external name": "internal id"
148 # "internal id": "external name"
149 # if an internal id is not in this stream
150 # then use the internal id for external name
154 # when Pentium is enabled: 486 is also enabled
155 # which then enables 386, etc