diff options
Diffstat (limited to 'source4/heimdal/cf/make-proto.pl')
-rw-r--r-- | source4/heimdal/cf/make-proto.pl | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/source4/heimdal/cf/make-proto.pl b/source4/heimdal/cf/make-proto.pl index 04733e1281..bc323b9433 100644 --- a/source4/heimdal/cf/make-proto.pl +++ b/source4/heimdal/cf/make-proto.pl @@ -12,7 +12,7 @@ my $debug = 0; my $oproto = 1; my $private_func_re = "^_"; -do Getopts('x:m:o:p:dqE:R:P:') || die "foo"; +Getopts('x:m:o:p:dqE:R:P:') || die "foo"; if($opt_d) { $debug = 1; @@ -180,6 +180,7 @@ sub foo { local ($arg) = @_; $_ = $arg; s/.*\/([^\/]*)/$1/; + s/.*\\([^\\]*)/$1/; s/[^a-zA-Z0-9]/_/g; "__" . $_ . "__"; } @@ -253,8 +254,14 @@ $private_h_trailer = ""; foreach(sort keys %funcs){ if(/^(main)$/) { next } + if ($funcs{$_} =~ /\^/) { + $beginblock = "#ifdef __BLOCKS__\n"; + $endblock = "#endif /* __BLOCKS__ */\n"; + } else { + $beginblock = $endblock = ""; + } if(!defined($exported{$_}) && /$private_func_re/) { - $private_h .= $funcs{$_} . "\n\n"; + $private_h .= $beginblock . $funcs{$_} . "\n" . $endblock . "\n"; if($funcs{$_} =~ /__attribute__/) { $private_attribute_seen = 1; } @@ -267,7 +274,7 @@ foreach(sort keys %funcs){ $public_h .= "#ifndef HAVE_$fupper\n"; } } - $public_h .= $funcs{$_} . "\n"; + $public_h .= $beginblock . $funcs{$_} . "\n" . $endblock; if($funcs{$_} =~ /__attribute__/) { $public_attribute_seen = 1; } @@ -310,26 +317,33 @@ extern \"C\" { } if ($opt_E) { $public_h_header .= "#ifndef $opt_E +#ifndef ${opt_E}_FUNCTION #if defined(_WIN32) -#define ${opt_E}_FUNCTION __stdcall __declspec(dllimport) +#define ${opt_E}_FUNCTION __declspec(dllimport) +#define ${opt_E}_CALL __stdcall #define ${opt_E}_VARIABLE __declspec(dllimport) #else #define ${opt_E}_FUNCTION +#define ${opt_E}_CALL #define ${opt_E}_VARIABLE #endif #endif - +#endif "; $private_h_header .= "#ifndef $opt_E +#ifndef ${opt_E}_FUNCTION #if defined(_WIN32) -#define ${opt_E}_FUNCTION __stdcall __declspec(dllimport) +#define ${opt_E}_FUNCTION __declspec(dllimport) +#define ${opt_E}_CALL __stdcall #define ${opt_E}_VARIABLE __declspec(dllimport) #else #define ${opt_E}_FUNCTION +#define ${opt_E}_CALL #define ${opt_E}_VARIABLE #endif #endif +#endif "; } |