1 # Make prototypes from .c files
11 do Getopts
('o:p:d') || die "foo";
18 print $brace, " ", $_ if($debug);
22 if($if_0 && /^\#endif/) {
45 if(!/^static/ && !/^PRIVATE/){
46 if(/(.*)(__attribute__\s?\(.*\))/) {
56 while(s/\(([^()]*),(.*)\)/($1\$$2)/g){}
61 /([a-zA-Z0-9_]+)\s*@/;
63 # only add newline if more than one parameter
64 $LP = "(("; # XXX workaround for indentation bug in emacs
73 # insert newline before function name
74 s/(.*)\s([a-zA-Z0-9_]+ __P)/$1\n$2/;
91 $line = $line . " " . $_;
104 open(OUT
, ">$opt_o");
105 $block = &foo
($opt_o);
107 $block = "__public_h__";
111 open(PRIV
, ">$opt_p");
112 $private = &foo
($opt_p);
114 $private = "__private_h__";
120 $public_h_header = "/* This is a generated file */
137 $private_h_header = "/* This is a generated file */
154 foreach(sort keys %funcs){
155 if(/^(main)$/) { next }
157 $private_h .= $funcs{$_} . "\n\n";
158 if($funcs{$_} =~ /__attribute__/) {
159 $private_attribute_seen = 1;
162 $public_h .= $funcs{$_} . "\n\n";
163 if($funcs{$_} =~ /__attribute__/) {
164 $public_attribute_seen = 1;
169 if ($public_attribute_seen) {
170 $public_h_header .= "#if !defined(__GNUC__) && !defined(__attribute__)
171 #define __attribute__(x)
177 if ($private_attribute_seen) {
178 $private_h_header .= "#if !defined(__GNUC__) && !defined(__attribute__)
179 #define __attribute__(x)
186 if ($public_h ne "") {
187 $public_h = $public_h_header . $public_h . "#endif /* $block */\n";
189 if ($private_h ne "") {
190 $private_h = $private_h_header . $private_h . "#endif /* $private */\n";
197 print PRIV
$private_h;