Indentation fix, cleanup.
[AROS.git] / tools / sfdc / Proto.pl
blob11249ff224bd87cf45cf4867afcd3a307feec810
2 ### Class Proto: Create a proto file ##########################################
4 BEGIN {
5 package Proto;
7 sub new {
8 my $proto = shift;
9 my %params = @_;
10 my $class = ref($proto) || $proto;
11 my $self = {};
12 $self->{SFD} = $params{'sfd'};
13 bless ($self, $class);
14 return $self;
17 sub header {
18 my $self = shift;
19 my $sfd = $self->{SFD};
21 my $base = $$sfd{'base'};
22 my $basename = $$sfd{'basename'};
23 my $BASENAME = $$sfd{'BASENAME'};
24 my $BaseName = $$sfd{'BaseName'};
25 my $basetype = $$sfd{'basetype'};
27 print "/* Automatically generated header! Do not edit! */\n";
28 print "\n";
29 print "#ifndef PROTO_${BASENAME}_H\n";
30 print "#define PROTO_${BASENAME}_H\n";
31 print "\n";
32 print "#include <clib/${basename}_protos.h>\n";
33 print "\n";
34 print "#ifndef _NO_INLINE\n";
35 print "# if defined(__GNUC__)\n";
36 print "# ifdef __AROS__\n";
37 print "# include <defines/${basename}.h>\n";
38 print "# else\n";
39 print "# include <inline/${basename}.h>\n";
40 print "# endif\n";
41 print "# else\n";
42 print "# include <pragmas/${basename}_pragmas.h>\n";
43 print "# endif\n";
44 print "#endif /* _NO_INLINE */\n";
45 print "\n";
47 if ($base ne '') {
48 print "#ifdef __amigaos4__\n";
49 print "# include <interfaces/${basename}.h>\n";
50 print "# ifndef __NOGLOBALIFACE__\n";
51 print " extern struct ${BaseName}IFace *I${BaseName};\n";
52 print "# endif /* __NOGLOBALIFACE__*/\n";
53 print "#else /* !__amigaos4__ */\n";
54 print "# ifndef __NOLIBBASE__\n";
55 print " extern ${basetype}\n";
56 print "# ifdef __CONSTLIBBASEDECL__\n";
57 print " __CONSTLIBBASEDECL__\n";
58 print "# endif /* __CONSTLIBBASEDECL__ */\n";
59 print " ${base};\n";
60 print "# endif /* !__NOLIBBASE__ */\n";
61 print "#endif /* !__amigaos4__ */\n";
62 print "\n";
66 sub function {
67 # Nothing to do here ...
70 sub footer {
71 my $self = shift;
72 my $sfd = $self->{SFD};
74 print "#endif /* !PROTO_$$sfd{'BASENAME'}_H */\n";