Fixes for compiling on 64bit and outside the source dir
[AROS.git] / tools / sfdc / GateMOS.pl
blobb3387fa7829068bc770405b0426e95ac691cc468
2 ### Class GateMOS: Create a MorphOS gatestub file #############################
4 BEGIN {
5 package GateMOS;
6 use vars qw(@ISA);
7 @ISA = qw( Gate );
9 sub new {
10 my $proto = shift;
11 my $class = ref($proto) || $proto;
12 my $self = $class->SUPER::new( @_ );
13 bless ($self, $class);
14 return $self;
17 sub header {
18 my $self = shift;
20 $self->SUPER::header (@_);
22 print "#include <emul/emulregs.h>\n";
23 print "\n";
26 sub function_start {
27 my $self = shift;
28 my %params = @_;
29 my $prototype = $params{'prototype'};
30 my $sfd = $self->{SFD};
32 print "$prototype->{return}\n";
33 print "$gateprefix$prototype->{funcname}(void)";
35 if ($self->{PROTO}) {
36 print ";\n";
38 else {
39 print "\n";
40 print "{\n";
44 sub function_arg {
45 my $self = shift;
47 if (!$self->{PROTO}) {
48 my %params = @_;
49 my $prototype = $params{'prototype'};
50 my $argtype = $params{'argtype'};
51 my $argname = $params{'argname'};
52 my $argreg = $params{'argreg'};
53 my $argnum = $params{'argnum'};
54 my $sfd = $self->{SFD};
56 print " $prototype->{___args}[$argnum] = ($argtype) REG_" .
57 (uc $argreg) . ";\n";
61 sub function_end {
62 my $self = shift;
64 if (!$self->{PROTO}) {
65 my %params = @_;
66 my $prototype = $params{'prototype'};
67 my $sfd = $self->{SFD};
69 if ($libarg ne 'none' && !$prototype->{nb}) {
70 print " $sfd->{basetype} _base = ($sfd->{basetype}) ".
71 "REG_A6;\n";
74 print " return $libprefix$prototype->{funcname}(";
76 if ($libarg eq 'first' && !$prototype->{nb}) {
77 print "_base";
78 print $prototype->{numargs} > 0 ? ", " : "";
81 print join (', ', @{$prototype->{___argnames}});
83 if ($libarg eq 'last' && !$prototype->{nb}) {
84 print $prototype->{numargs} > 0 ? ", " : "";
85 print "_base";
88 print ");\n";
89 print "}\n";