make xsubpp generate well-formed code with CAPI && !PERL_OBJECT
Gurusamy Sarathy [Mon, 21 Sep 1998 20:34:10 +0000 (20:34 +0000)]
p4raw-id: //depot/perl@1795

lib/ExtUtils/xsubpp

index 523dabc..5c45a85 100755 (executable)
@@ -1254,30 +1254,37 @@ EOF
 }
 
 # print initialization routine
-if ($WantCAPI) {
+
 print Q<<"EOF";
-#
 ##ifdef __cplusplus
 #extern "C"
 ##endif
+EOF
+
+if ($WantCAPI) {
+print Q<<"EOF";
+##ifdef PERL_CAPI
 #XS(boot__CAPI_entry)
-#[[
-#    dXSARGS;
-#    char* file = __FILE__;
-#
+##else
 EOF
-} else {
+}
+
 print Q<<"EOF";
-##ifdef __cplusplus
-#extern "C"
-##endif
 #XS(boot_$Module_cname)
+EOF
+
+if ($WantCAPI) {
+print Q<<"EOF";
+##endif        /* PERL_CAPI */
+EOF
+}
+
+print Q<<"EOF";
 #[[
 #    dXSARGS;
 #    char* file = __FILE__;
 #
 EOF
-}
 
 print Q<<"EOF" if $WantVersionChk ;
 #    XS_VERSION_BOOTCHECK ;
@@ -1312,7 +1319,7 @@ EOF
 
 if ($WantCAPI) { 
 print Q<<"EOF";
-#
+##ifdef PERL_CAPI
 ##define XSCAPI(name) void name(CV* cv, void* pPerl)
 #
 ##ifdef __cplusplus
@@ -1323,7 +1330,7 @@ print Q<<"EOF";
 #    SetCPerlObj(pPerl);
 #    boot__CAPI_entry(cv);
 #]]
-#
+##endif        /* PERL_CAPI */
 EOF
 }