2 ### Class GateAROS: Create an AROS gatestub file ##############################
11 my $class = ref($proto) || $proto;
12 my $self = $class->SUPER::new
( @_ );
13 bless ($self, $class);
19 my $sfd = $self->{SFD
};
21 $self->SUPER::header
(@_);
23 print "#include <aros/libcall.h>\n";
30 my $prototype = $params{'prototype'};
31 my $sfd = $self->{SFD
};
33 if ($prototype->{type
} eq 'cfunction') {
34 print "#define $gateprefix$prototype->{funcname} " .
36 "$gateprefix$prototype->{funcname},$sfd->{Basename})\n\n";
39 $self->SUPER::function
(@_);
45 my $prototype = $params{'prototype'};
46 my $sfd = $self->{SFD
};
47 my $nb = $prototype->{nb
} || $libarg eq 'none';
49 # AROS macros cannot handle function pointer arguments :-(
51 for my $i (0 .. $prototype->{numargs
} - 1) {
52 if ($prototype->{argtypes
}[$i] =~ /\(\*\)/) {
53 my $typedef = $prototype->{argtypes
}[$i];
54 my $typename = "$sfd->{Basename}_$prototype->{funcname}_fp$i";
56 $typedef =~ s/\(\*\)/(*_$typename)/;
58 print "typedef $typedef;\n";
63 printf "AROS_LD%d%s(", $prototype->{numargs
}, $nb ?
"I" : "";
66 printf "AROS_LH%d%s(", $prototype->{numargs
}, $nb ?
"I" : "";
68 print "$prototype->{return}, $gateprefix$prototype->{funcname},\n";
74 my $prototype = $params{'prototype'};
75 my $argtype = $params{'argtype'};
76 my $argname = $params{'argname'};
77 my $argreg = $params{'argreg'};
78 my $argnum = $params{'argnum'};
79 my $sfd = $self->{SFD
};
81 if ($argtype =~ /\(\*\)/) {
82 $argtype = "_$sfd->{Basename}_$prototype->{funcname}_fp$argnum";
86 print " AROS_LDA($argtype, $argname, " . (uc $argreg) . "),\n";
89 print " AROS_LHA($argtype, $argname, " . (uc $argreg) . "),\n";
96 my $prototype = $params{'prototype'};
97 my $sfd = $self->{SFD
};
102 if ($prototype->{nb
}) {
103 for my $i (0 .. $#{$prototype->{regs}}) {
104 if ($prototype->{regs
}[$i] eq 'a6') {
105 $bt = $prototype->{argtypes
}[$i];
106 $bn =$prototype->{___argnames
}[$i];
112 $bt = $sfd->{basetype
};
116 printf " $bt, $bn, %d, $sfd->{Basename})",
117 $prototype->{bias
} / 6;
119 if ($self->{PROTO
}) {
121 print "#define $gateprefix$prototype->{funcname} " .
123 "$gateprefix$prototype->{funcname},$sfd->{Basename})\n";
128 print " AROS_LIBFUNC_INIT\n";
129 print " return $libprefix$prototype->{funcname}(";
131 if ($libarg eq 'first' && !$prototype->{nb
}) {
133 print $prototype->{numargs
} > 0 ?
", " : "";
136 print join (', ', @
{$prototype->{___argnames
}});
138 if ($libarg eq 'last' && !$prototype->{nb
}) {
139 print $prototype->{numargs
} > 0 ?
", " : "";
144 print " AROS_LIBFUNC_EXIT\n";