2 ### Class SDIAROS: Create an AROS SDI stub 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";
24 print "#include <SDI_lib.h>\n";
31 my $prototype = $params{'prototype'};
32 my $sfd = $self->{SFD
};
34 if ($prototype->{type
} eq 'cfunction') {
35 print "#define $gateprefix$prototype->{funcname} " .
37 "$gateprefix$prototype->{funcname},$sfd->{Basename},".
38 ($prototype->{bias
}/6).")\n\n";
41 $self->SUPER::function
(@_);
47 my $prototype = $params{'prototype'};
48 my $sfd = $self->{SFD
};
49 my $nb = $prototype->{nb
} || $libarg eq 'none';
51 # AROS macros cannot handle function pointer arguments :-(
53 for my $i (0 .. $prototype->{numargs
} - 1) {
54 if ($prototype->{argtypes
}[$i] =~ /\(\*\)/) {
55 my $typedef = $prototype->{argtypes
}[$i];
56 my $typename = "$sfd->{Basename}_$prototype->{funcname}_fp$i";
58 $typedef =~ s/\(\*\)/(*_$typename)/;
60 print "typedef $typedef;\n";
64 printf "AROS_LD%d(", $prototype->{numargs
};
67 printf "AROS_LH%d(", $prototype->{numargs
};
70 print "$prototype->{return}, $gateprefix$prototype->{funcname},\n";
76 my $prototype = $params{'prototype'};
77 my $argtype = $params{'argtype'};
78 my $argname = $params{'argname'};
79 my $argreg = $params{'argreg'};
80 my $argnum = $params{'argnum'};
81 my $sfd = $self->{SFD
};
83 if ($argtype =~ /\(\*\)/) {
84 $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
};
114 $bn = "__BASE_OR_IFACE_VAR";
117 print " $bt, $bn, 0, LIBSTUB\n)";
119 if ($self->{PROTO
}) {
125 print " AROS_LIBFUNC_INIT\n";
127 if ($prototype->{numargs
} > 0) {
128 print " return CALL_LFUNC($libprefix$prototype->{funcname}, ";
129 print join (', ', @
{$prototype->{___argnames
}});
132 print " return CALL_LFUNC_NP($libprefix$prototype->{funcname}";
136 print " AROS_LIBFUNC_EXIT\n";