Change some size_t vars to ints.
[rsync.git] / mkproto.pl
blobcdeb2ea3c9b815130d81bdf667a0c8a3d7c88d90
1 # generate prototypes for rsync
3 $old_protos = '';
4 if (open(IN, 'proto.h')) {
5 $old_protos = join('', <IN>);
6 close IN;
9 %FN_MAP = (
10 BOOL => 'BOOL ',
11 CHAR => 'char ',
12 INTEGER => 'int ',
13 STRING => 'char *',
16 $inheader = 0;
17 $protos = qq|/* This file is automatically generated with "make proto". DO NOT EDIT */\n\n|;
19 while (<>) {
20 if ($inheader) {
21 if (/[)][ \t]*$/) {
22 $inheader = 0;
23 s/$/;/;
25 $protos .= $_;
26 } elsif (/^FN_(LOCAL|GLOBAL)_([^(]+)\(([^,()]+)/) {
27 $ret = $FN_MAP{$2};
28 $func = $3;
29 $arg = $1 eq 'LOCAL' ? 'int module_id' : 'void';
30 $protos .= "$ret$func($arg);\n";
31 } elsif (/^static|^extern/ || /[;]/ || !/^[A-Za-z][A-Za-z0-9_]* /) {
33 } elsif (/[(].*[)][ \t]*$/) {
34 s/$/;/;
35 $protos .= $_;
36 } elsif (/[(]/) {
37 $inheader = 1;
38 $protos .= $_;
42 if ($old_protos ne $protos) {
43 open(OUT, '>proto.h') or die $!;
44 print OUT $protos;
45 close OUT;
48 open(OUT, '>proto.h-tstamp') and close OUT;