From f7ebdddf35f9299d2b1cb463b08a58026f4e60ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Fri, 3 Sep 2004 08:50:57 +0000 Subject: [PATCH] add cpluscplus extern "C" support git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14183 ec53bebd-3082-4978-b11e-865c3cabbd6b --- cf/make-proto.pl | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/cf/make-proto.pl b/cf/make-proto.pl index 4de9c245b..aac1fe2a9 100644 --- a/cf/make-proto.pl +++ b/cf/make-proto.pl @@ -27,7 +27,8 @@ if($opt_R) { 'multiline-proto' => 1, 'header' => 1, 'function-blocking' => 0, - 'gnuc-attribute' => 1 + 'gnuc-attribute' => 1, + 'cxx' => 1 ); if($opt_m) { foreach $i (split(/,/, $opt_m)) { @@ -36,6 +37,7 @@ if($opt_m) { $flags{"header"} = 0; $flags{"function-blocking"} = 0; $flags{"gnuc-attribute"} = 0; + $flags{"cxx"} = 0; } else { if(substr($i, 0, 3) eq "no-") { $flags{substr($i, 3)} = 0; @@ -209,6 +211,7 @@ if ($oproto) { "; } +$public_h_trailer = ""; $private_h_header = "/* This is a generated file */ #ifndef $private @@ -233,6 +236,7 @@ if($oproto) { "; } +$private_h_trailer = ""; foreach(sort keys %funcs){ if(/^(main)$/) { next } @@ -277,6 +281,19 @@ if($flags{"gnuc-attribute"}) { "; } +} +if($flags{"cxx"}) { + $public_h_header .= "#ifdef __cplusplus +extern \"C\" { +#endif + +"; + $public_h_trailer .= "#ifdef __cplusplus +} +#endif + +"; + } if ($opt_E) { $public_h_header .= "#ifndef $opt_E @@ -301,10 +318,12 @@ if ($opt_E) { } if ($public_h ne "" && $flags{"header"}) { - $public_h = $public_h_header . $public_h . "#endif /* $block */\n"; + $public_h = $public_h_header . $public_h . + $public_h_trailer . "#endif /* $block */\n"; } if ($private_h ne "" && $flags{"header"}) { - $private_h = $private_h_header . $private_h . "#endif /* $private */\n"; + $private_h = $private_h_header . $private_h . + $private_h_trailer . "#endif /* $private */\n"; } if($opt_o) {