-
Notifications
You must be signed in to change notification settings - Fork 9
/
FuncTable.pl
52 lines (42 loc) · 1.2 KB
/
FuncTable.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
### Class FuncTable: Create a function table fragment #########################
BEGIN {
package FuncTable;
sub new {
my $proto = shift;
my %params = @_;
my $class = ref($proto) || $proto;
my $self = {};
$self->{SFD} = $params{'sfd'};
bless ($self, $class);
return $self;
}
sub header {
my $self = shift;
my $sfd = $self->{SFD};
print "/* Automatically generated function table (sfdc SFDC_VERSION)! Do not edit! */\n";
print "\n";
print "#ifdef __SFDC_FUNCTABLE_M68K__\n";
print "# define _sfdc_func(f) &m68k ## f\n";
print "#else\n";
print "# define _sfdc_func(f) f\n";
print "#endif\n";
}
sub function {
my $self = shift;
my %params = @_;
my $prototype = $params{'prototype'};
if ($prototype->{bias} == 0) {
return;
}
if ($prototype->{type} eq 'function' ||
$prototype->{type} eq 'cfunction') {
print " (CONST_APTR) _sfdc_func($gateprefix$prototype->{funcname}),\n";
}
}
sub footer {
my $self = shift;
my $sfd = $self->{SFD};
print "#undef _sfdc_func\n";
print "\n";
}
}