-
Notifications
You must be signed in to change notification settings - Fork 9
/
Gate68k.pl
86 lines (69 loc) · 2.06 KB
/
Gate68k.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
### Class Gate68k: Create a AmigaOS gatestub file #############################
BEGIN {
package Gate68k;
use vars qw(@ISA);
@ISA = qw( Gate );
sub new {
my $proto = shift;
my $class = ref($proto) || $proto;
my $self = $class->SUPER::new( @_ );
bless ($self, $class);
return $self;
}
sub function_start {
my $self = shift;
my %params = @_;
my $prototype = $params{'prototype'};
my $sfd = $self->{SFD};
print "$prototype->{return}\n";
print "$gateprefix$prototype->{funcname}(";
}
sub function_arg {
my $self = shift;
my %params = @_;
my $prototype = $params{'prototype'};
my $argtype = $params{'argtype'};
my $argname = $params{'argname'};
my $argreg = $params{'argreg'};
my $argnum = $params{'argnum'};
my $sfd = $self->{SFD};
if ($argnum != 0) {
print ",\n";
}
print " $prototype->{___args}[$argnum] __asm(\"$argreg\")";
}
sub function_end {
my $self = shift;
my %params = @_;
my $prototype = $params{'prototype'};
my $sfd = $self->{SFD};
if ($libarg ne 'none' && !$prototype->{nb}) {
if ($prototype->{numargs} > 0 ) {
print ",\n";
}
print " $sfd->{basetype} _base __asm(\"a6\")";
}
elsif ($prototype->{numargs} == 0) {
print "void";
}
if ($self->{PROTO}) {
print ");\n";
}
else {
print ")\n";
print "{\n";
print " return $libprefix$prototype->{funcname}(";
if ($libarg eq 'first' && !$prototype->{nb}) {
print "_base";
print $prototype->{numargs} > 0 ? ", " : "";
}
print join (', ', @{$prototype->{___argnames}});
if ($libarg eq 'last' && !$prototype->{nb}) {
print $prototype->{numargs} > 0 ? ", " : "";
print "_base";
}
print ");\n";
print "}\n";
}
}
}