add a missing section header table index conversion
[tangerine.git] / tools / sfdc / MacroAROS.pl
blob3c87db5404e0206b2f4c35bafe6da351b8f44f54
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};
42 if ($$prototype{'type'} eq 'function') {
43 printf " AROS_LC%d%s(%s, %s, \\\n",
44 $$prototype{'numargs'}, $prototype->{nb} ? "I" : "",
45 $$prototype{'return'}, $$prototype{'funcname'};
47 else {
48 $self->SUPER::function_start (@_);
53 sub function_arg {
54 my $self = shift;
55 my %params = @_;
56 my $prototype = $params{'prototype'};
58 if ($$prototype{'type'} eq 'function') {
59 my $argtype = $params{'argtype'};
60 my $argname = $params{'argname'};
61 my $argreg = $params{'argreg'};
63 print " AROS_LCA($argtype, ($argname), " . uc $argreg . "), \\\n";
65 else {
66 $self->SUPER::function_arg (@_);
70 sub function_end {
71 my $self = shift;
72 my %params = @_;
73 my $prototype = $params{'prototype'};
74 my $sfd = $self->{SFD};
76 if ($$prototype{'type'} eq 'function') {
77 if( !$prototype->{nb}) {
78 print " $$sfd{'basetype'}, (___base), ";
80 else {
81 my $bt = "/* bt */";
82 my $bn = "/* bn */";
84 for my $i (0 .. $#{$prototype->{regs}}) {
85 if ($prototype->{regs}[$i] eq 'a6') {
86 $bt = $prototype->{argtypes}[$i];
87 $bn =$prototype->{___argnames}[$i];
88 last;
92 print " $bt, $bn, ";
95 print $$prototype{'bias'} / 6;
96 print ", $sfd->{Basename})\n";
98 else {
99 $self->SUPER::function_end (@_);