2 ### Class CLib: Create a clib file ############################################
10 my $class = ref($proto) || $proto;
12 $self->{SFD
} = $params{'sfd'};
14 bless ($self, $class);
20 my $sfd = $self->{SFD
};
26 $v =~ s/^\$[I]d: .*? ([0-9.]+).*/$1/;
27 $d =~ s
,^\
$[I
]d
: .*?
[0-9.]+ (\d
{4})/(\d{2})/(\d
{2}).*,($3.$2.$1),;
29 print "/* Automatically generated header! Do not edit! */\n";
31 print "#ifndef CLIB_$$sfd{'BASENAME'}_PROTOS_H\n";
32 print "#define CLIB_$$sfd{'BASENAME'}_PROTOS_H\n";
35 print "** \$VER: $$sfd{'basename'}_protos.h $v $d\n";
37 print "** C prototypes. For use with 32 bit integers only.\n";
39 print "** $$sfd{'copyright'}\n";
40 print "** All Rights Reserved\n";
44 foreach my $inc (@
{$$sfd{'includes'}}) {
45 print "#include $inc\n";
48 foreach my $td (@
{$$sfd{'typedefs'}}) {
49 print "typedef $td;\n";
53 print "#ifdef __cplusplus\n";
54 print "extern \"C\" {\n";
55 print "#endif /* __cplusplus */\n";
64 my $prototype = $params{'prototype'};
65 my $sfd = $self->{SFD
};
67 # Don't process private functions
68 if ($prototype->{private
}) {
72 if ($self->{VERSION
} != $$prototype{'version'}) {
73 $self->{VERSION
} = $$prototype{'version'};
76 print "/*--- functions in V$self->{VERSION} or higher ---*/\n";
79 if ($$prototype{'comment'} ne '') {
80 my $comment = $$prototype{'comment'};
82 $comment =~ s
,^(\s?
)(.*)$,/*$1$2$1*/,mg
;
88 my $args = join (', ',@
{$$prototype{'args'}});
94 print "$$prototype{'return'} $$prototype{'funcname'}($args)";
96 if ($$classes{'target'} eq 'morphos' &&
97 $$prototype{'type'} eq 'varargs' &&
98 $$prototype{'subtype'} ne 'tagcall') {
99 print " __attribute__((varargs68k))";
107 my $sfd = $self->{SFD
};
110 print "#ifdef __cplusplus\n";
112 print "#endif /* __cplusplus */\n";
114 print "#endif /* CLIB_$$sfd{'BASENAME'}_PROTOS_H */\n";