Make sure __u64 is defined.
[AROS.git] / tools / sfdc / MacroAROS.pl
blob08d2980da8e11d7ee0211c4b6d50a724d6947c59
2 ### Class MacroAROS: Implements AROS macro files ##############################
4 BEGIN {
5 package MacroAROS;
6 use vars qw(@ISA);
7 @ISA = qw( Macro );
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;
19 my $sfd = $self->{SFD};
21 $self->SUPER::header (@_);
23 print "#ifndef AROS_LIBCALL_H\n";
24 print "#include <aros/libcall.h>\n";
25 print "#endif /* !AROS_LIBCALL_H */\n";
26 print "\n";
28 if ($$sfd{'base'} ne '') {
29 print "#ifndef $self->{BASE}\n";
30 print "#define $self->{BASE} $$sfd{'base'}\n";
31 print "#endif /* !$self->{BASE} */\n";
32 print "\n";
36 sub function_start {
37 my $self = shift;
38 my %params = @_;
39 my $prototype = $params{'prototype'};
40 my $sfd = $self->{SFD};
41 my $numargs = $$prototype{'numargs'};
43 if ($prototype->{nb}) {
44 $numargs--;
46 if ($$prototype{'type'} eq 'function') {
47 printf " AROS_LC%d%s(%s, %s, \\\n",
48 $numargs,
49 $$prototype{'return'} eq 'void'
50 || $$prototype{'return'} eq 'VOID' ? "NR" : "",
51 $$prototype{'return'}, $$prototype{'funcname'};
53 else {
54 $self->SUPER::function_start (@_);
59 sub function_arg {
60 my $self = shift;
61 my %params = @_;
62 my $prototype = $params{'prototype'};
64 if ($$prototype{'type'} eq 'function') {
65 my $argreg = uc $params{'argreg'};
67 if ($argreg ne 'A6') {
68 my $argtype = $params{'argtype'};
69 my $argname = $params{'argname'};
71 print " AROS_LCA($argtype, ($argname), $argreg), \\\n";
74 else {
75 $self->SUPER::function_arg (@_);
79 sub function_end {
80 my $self = shift;
81 my %params = @_;
82 my $prototype = $params{'prototype'};
83 my $sfd = $self->{SFD};
85 if ($$prototype{'type'} eq 'function') {
86 if( !$prototype->{nb}) {
87 print " $$sfd{'basetype'}, (___base), ";
89 else {
90 my $bt = "/* bt */";
91 my $bn = "/* bn */";
93 for my $i (0 .. $#{$prototype->{regs}}) {
94 if ($prototype->{regs}[$i] eq 'a6') {
95 $bt = $prototype->{argtypes}[$i];
96 $bn =$prototype->{___argnames}[$i];
97 last;
101 print " $bt, $bn, ";
104 print $$prototype{'bias'} / 6;
105 print ", $sfd->{Basename})\n";
107 else {
108 $self->SUPER::function_end (@_);