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},".
37 ($prototype->{bias
}/6).")\n\n";
40 $self->SUPER::function
(@_);
46 my $prototype = $params{'prototype'};
47 my $sfd = $self->{SFD
};
48 my $nb = $prototype->{nb
} || $libarg eq 'none';
50 # AROS macros cannot handle function pointer arguments :-(
52 for my $i (0 .. $prototype->{numargs
} - 1) {
53 if ($prototype->{argtypes
}[$i] =~ /\(\*\)/) {
54 my $typedef = $prototype->{argtypes
}[$i];
55 my $typename = "$sfd->{Basename}_$prototype->{funcname}_fp$i";
57 $typedef =~ s/\(\*\)/(*_$typename)/;
59 print "typedef $typedef;\n";
64 printf "AROS_LD%d%s(", $prototype->{numargs
}, $nb ?
"I" : "";
67 printf "AROS_LH%d%s(", $prototype->{numargs
}, $nb ?
"I" : "";
69 print "$prototype->{return}, $gateprefix$prototype->{funcname},\n";
75 my $prototype = $params{'prototype'};
76 my $argtype = $params{'argtype'};
77 my $argname = $params{'argname'};
78 my $argreg = $params{'argreg'};
79 my $argnum = $params{'argnum'};
80 my $sfd = $self->{SFD
};
82 if ($argtype =~ /\(\*\)/) {
83 $argtype = "_$sfd->{Basename}_$prototype->{funcname}_fp$argnum";
87 print " AROS_LDA($argtype, $argname, " . (uc $argreg) . "),\n";
90 print " AROS_LHA($argtype, $argname, " . (uc $argreg) . "),\n";
97 my $prototype = $params{'prototype'};
98 my $sfd = $self->{SFD
};
103 if ($prototype->{nb
}) {
104 for my $i (0 .. $#{$prototype->{regs}}) {
105 if ($prototype->{regs
}[$i] eq 'a6') {
106 $bt = $prototype->{argtypes
}[$i];
107 $bn =$prototype->{___argnames
}[$i];
113 $bt = $sfd->{basetype
};
117 printf " $bt, $bn, %d, $sfd->{Basename})",
118 $prototype->{bias
} / 6;
120 if ($self->{PROTO
}) {
122 print "#define $gateprefix$prototype->{funcname} " .
124 "$gateprefix$prototype->{funcname},$sfd->{Basename},".($prototype->{bias
}/6).")\n";
129 print " AROS_LIBFUNC_INIT\n";
130 print " return $libprefix$prototype->{funcname}(";
132 if ($libarg eq 'first' && !$prototype->{nb
}) {
134 print $prototype->{numargs
} > 0 ?
", " : "";
137 print join (', ', @
{$prototype->{___argnames
}});
139 if ($libarg eq 'last' && !$prototype->{nb
}) {
140 print $prototype->{numargs
} > 0 ?
", " : "";
145 print " AROS_LIBFUNC_EXIT\n";