diff options
Diffstat (limited to 'source4/script/mkproto.pl')
-rwxr-xr-x | source4/script/mkproto.pl | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/source4/script/mkproto.pl b/source4/script/mkproto.pl index 51888c704f..f1c2cf9d0e 100755 --- a/source4/script/mkproto.pl +++ b/source4/script/mkproto.pl @@ -68,20 +68,24 @@ GetOptions( 'help' => \&usage ) or exit(1); -if (not defined($public_define) and defined($public_file)) { - $public_define = ".." . uc($public_file) . "__"; - $public_define =~ tr{./}{__}; -} elsif (not defined($public_define)) { - $public_define = '_PROTO_H_'; -} +sub normalize_define($$) +{ + my ($define, $file) = @_; + + if (not defined($define) and defined($file)) { + $define = "__" . uc($file) . "__"; + $define =~ tr{./}{__}; + $define =~ tr{\-}{_}; + } elsif (not defined($define)) { + $define = '_PROTO_H_'; + } -if (not defined($private_define) and defined($private_file)) { - $private_define = "__" . uc($private_file) . "__"; - $private_define =~ tr{./}{__}; -} elsif (not defined($public_define)) { - $public_define = '_PROTO_H_'; + return $define; } +$public_define = normalize_define($public_define, $public_file); +$private_define = normalize_define($private_define, $private_file); + if ((defined($private_file) and defined($public_file) and ($private_file eq $public_file)) or (not defined($private_file) and not defined($public_file))) { $private_data = $public_data; @@ -129,7 +133,6 @@ sub handle_loadparm($$) my %tmap = ( "BOOL" => "bool ", - "bool" => "bool ", "CONST_STRING" => "const char *", "STRING" => "const char *", "INTEGER" => "int ", @@ -138,8 +141,8 @@ sub handle_loadparm($$) ); my %smap = ( - "GLOBAL" => "void", - "LOCAL" => "int " + "GLOBAL" => "struct loadparm_context *", + "LOCAL" => "struct loadparm_service *" ); $file->("$tmap{$type}$name($smap{$scope});\n"); @@ -194,8 +197,8 @@ sub process_file($$$) } next unless ( $is_public || $line =~ / - (_DEPRECATED_ |_NORETURN_ |_WARN_UNUSED_RESULT_ |_PURE_ )*^( - void|BOOL|bool|int|struct|char|const|\w+_[tT]\s|uint|unsigned|long|NTSTATUS| + ^(_DEPRECATED_ |_NORETURN_ |_WARN_UNUSED_RESULT_ |_PURE_ )*( + void|bool|int|struct|char|const|\w+_[tT]\s|uint|unsigned|long|NTSTATUS| ADS_STATUS|enum\s.*\(|DATA_BLOB|WERROR|XFILE|FILE|DIR| double|TDB_CONTEXT|TDB_DATA|TALLOC_CTX|NTTIME|FN_|init_module| GtkWidget|GType|smb_ucs2_t|krb5_error_code) @@ -205,7 +208,6 @@ sub process_file($$$) $target->("\n$comment") if (defined($comment)); $comment = undef; - $line =~ s/BOOL /bool /g; if ( $line =~ /\(.*\)\s*$/o ) { chomp $line; $target->("$line;\n"); @@ -215,7 +217,6 @@ sub process_file($$$) $target->($line); while ($line = <FH>) { - $line =~ s/BOOL /bool /g; if ($line =~ /\)\s*$/o) { chomp $line; $target->("$line;\n"); |