6 my $header_name = '_PROTO_H_';
8 if ($ARGV[0] eq '-h') {
10 $header_name = shift @ARGV;
15 print "#ifndef $header_name\n";
16 print "#define $header_name\n\n";
17 print "/* This file is automatically generated with \"make proto\". DO NOT EDIT */\n\n";
21 printf "\n#endif /* %s */\n", $header_name;
28 if ($line =~ /^FN_(GLOBAL|LOCAL)_(CONST_STRING|STRING|BOOL|CHAR|INTEGER|LIST)\((\w+),.*\)/o) {
35 "CONST_STRING" => "const char *",
39 "LIST" => "const char **",
47 print "$tmap{$type}$name($smap{$scope});\n";
59 open(FH, "< $filename") || die "Failed to open $filename";
64 print "\n/* The following definitions come from $filename */\n\n";
66 while ($line = <FH>) {
67 # this ignores most lines
68 next if ($line =~ /^\s/);
72 if ($line =~ /^static|^extern/o ||
73 $line !~ /^[a-zA-Z]/o ||
78 if ($line =~ /^FN_/) {
79 handle_loadparm($line);
82 next unless ($line =~ /\(/);
85 ^void|^BOOL|^int|^struct|^char|^const|^\w+_[tT]\s|^uint|^unsigned|^long|
86 ^NTSTATUS|^ADS_STATUS|^enum\s.*\(|^DATA_BLOB|^WERROR|^XFILE|^FILE|^DIR|
87 ^double|^TDB_CONTEXT|^TDB_DATA|^TALLOC_CTX|^NTTIME
93 # goto next line if we don't have a start
94 next unless $gotstart;
96 if ( $line =~ /\(.*\)\s*$/o ) {
104 while ($line = <FH>) {
106 if ($line =~ /\)\s*$/o) {
116 foreach my $filename (@ARGV) {
117 process_file($filename);