Actually submit previous change.
[p5sagit/p5-mst-13.2.git] / ext / Encode / bin / enc2xs
index 7665fa5..2179f61 100644 (file)
@@ -271,6 +271,8 @@ if ($doC)
 
     # push(@{$encoding{$name}},outstring(\*C,$e2u->{Cname}.'_def',$erep));
    }
+  my $cpp  = ($Config{d_cplusplus} || '') eq 'define';
+  my $ext_c = $cpp ? 'extern "C" ' : "";
   foreach my $enc (sort cmp_name keys %encoding)
    {
     # my ($e2u,$u2e,$rep,$min_el,$max_el,$rsym) = @{$encoding{$enc}};
@@ -282,9 +284,9 @@ if ($doC)
     $sym =~ s/\W+/_/g;
     my @info = ($e2u->{Cname},$u2e->{Cname},"${sym}_rep_character",$replen,
         $min_el,$max_el);
-    print C "static const U8 ${sym}_rep_character[] = \"$rep\";\n";
-    print C "static const char ${sym}_enc_name[] = \"$enc\";\n\n";
-    print C "const encode_t $sym = \n";
+    print C "${ext_c}static const U8 ${sym}_rep_character[] = \"$rep\";\n";
+    print C "${ext_c}static const char ${sym}_enc_name[] = \"$enc\";\n\n";
+    print C "${ext_c}const encode_t $sym = \n";
     # This is to make null encoding work -- dankogai
     for (my $i = (scalar @info) - 1;  $i >= 0; --$i){
     $info[$i] ||= 1;
@@ -1190,7 +1192,7 @@ Encode uses the Unicode Character Map (UCM) format for source character
 mappings.  This format is used by IBM's ICU package and was adopted
 by Nick Ing-Simmons for use with the Encode module.  Since UCM is
 more flexible than Tcl's Encoding Map and far more user-friendly,
-this is the recommended formet for Encode now.
+this is the recommended format for Encode now.
 
 A UCM file looks like this.