diff options
Diffstat (limited to 'cf/make-proto.pl')
-rw-r--r-- | cf/make-proto.pl | 90 |
1 files changed, 65 insertions, 25 deletions
diff --git a/cf/make-proto.pl b/cf/make-proto.pl index 577876c2d9e0..4af21916b80d 100644 --- a/cf/make-proto.pl +++ b/cf/make-proto.pl @@ -4,7 +4,7 @@ use Getopt::Std; use File::Compare; -use JSON; +use JSON::PP my $comment = 0; my $doxygen = 0; @@ -70,7 +70,7 @@ if($opt_x) { my $EXP; local $/; open(EXP, '<', $opt_x) || die "open ${opt_x}"; - my $obj = JSON->new->utf8->decode(<EXP>); + my $obj = JSON::PP->new->utf8->decode(<EXP>); close $EXP; foreach my $x (keys %$obj) { @@ -95,6 +95,13 @@ while(<>) { } elsif ($doxygen) { $funcdoc .= $_; next; } elsif ($comment) { next; } + # Handle CPP #define's + $define = 1 if /^\s*\#\s*define/; + if ($define) { + $define = 0 if ! /\\$/; + next; + } + if(/^\#if 0/) { $if_0 = 1; } @@ -415,34 +422,67 @@ extern \"C\" { } if ($opt_E) { $public_h_header .= "#ifndef $opt_E -#ifndef ${opt_E}_FUNCTION -#if defined(_WIN32) -#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 + #ifndef ${opt_E}_FUNCTION + #if defined(_WIN32) + #define ${opt_E}_FUNCTION __declspec(dllimport) + #else + #define ${opt_E}_FUNCTION + #endif + #endif + #ifndef ${opt_E}_NORETURN_FUNCTION + #if defined(_WIN32) + #define ${opt_E}_NORETURN_FUNCTION __declspec(dllimport noreturn) + #else + #define ${opt_E}_NORETURN_FUNCTION + #endif + #endif + #ifndef ${opt_E}_CALL + #if defined(_WIN32) + #define ${opt_E}_CALL __stdcall + #else + #define ${opt_E}_CALL + #endif + #endif + #ifndef ${opt_E}_VARIABLE + #if defined(_WIN32) + #define ${opt_E}_VARIABLE __declspec(dllimport) + #else + #define ${opt_E}_VARIABLE + #endif + #endif #endif "; $private_h_header .= "#ifndef $opt_E -#ifndef ${opt_E}_FUNCTION -#if defined(_WIN32) -#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 + #ifndef ${opt_E}_FUNCTION + #if defined(_WIN32) + #define ${opt_E}_FUNCTION __declspec(dllimport) + #else + #define ${opt_E}_FUNCTION + #endif + #endif + #ifndef ${opt_E}_NORETURN_FUNCTION + #if defined(_WIN32) + #define ${opt_E}_NORETURN_FUNCTION __declspec(dllimport noreturn) + #else + #define ${opt_E}_NORETURN_FUNCTION + #endif + #endif + #ifndef ${opt_E}_CALL + #if defined(_WIN32) + #define ${opt_E}_CALL __stdcall + #else + #define ${opt_E}_CALL + #endif + #endif + #ifndef ${opt_E}_VARIABLE + #if defined(_WIN32) + #define ${opt_E}_VARIABLE __declspec(dllimport) + #else + #define ${opt_E}_VARIABLE + #endif + #endif #endif -#endif - "; } |