8484# apidoc_item
8585my $item_flags_re = qr / [dD fF mM nN oO pT uU Wx;]/ xx ;
8686
87- # This is a copy of the list in regen/embed.pl.
88- my @have_compatibility_macros = qw(
89- deb
90- form
91- load_module
92- mess
93- newSVpvf
94- sv_catpvf
95- sv_catpvf_mg
96- sv_setpvf
97- sv_setpvf_mg
98- warn
99- warner
100- ) ;
101- my %has_compat_macro ;
102- $has_compat_macro {$_ } = 1 for @have_compatibility_macros ;
87+ # Certain functions have plain and no_context versions, and meet the criteria
88+ # stated here. Each of their pods has been modified to have a marker line
89+ # which this program replaces by this wording. This way we can tweak the
90+ # wording in one place, and still have it placed in the individual pod entries
91+ # where it makes the most sense.
92+ my $PLAIN_vs_NOCONTEXT_wording = <<~EOT ;
93+ C<WHICH> and C<WHICH_nocontext> behave identically when called from outside
94+ the perl core unless C<PERL_WANT_VARARGS> has been explicitly #defined.
95+ When it has, or when called from inside the core, they differ only in that
96+ C<WHICH> requires the thread context (C<aTHX>) to be available.
97+ EOT
10398
10499use constant {
105100 NOT_APIDOC => -1,
@@ -1665,7 +1660,6 @@ ($fh, $section_name, $element_name, $docref)
16651660 my @deprecated ;
16661661 my @experimental ;
16671662 my @xrefs ;
1668- my @compat_macros ;
16691663
16701664 for (my $i = 0; $i < @items ; $i ++) {
16711665 last if $docref -> {' xref_only' }; # Place holder
@@ -1682,7 +1676,6 @@ ($fh, $section_name, $element_name, $docref)
16821676
16831677 push @deprecated , " C<$name >" if $item -> {flags } =~ / D/ ;
16841678 push @experimental , " C<$name >" if $item -> {flags } =~ / x/ ;
1685- push @compat_macros , $name if $has_compat_macro {$name };
16861679 }
16871680
16881681 # While we're going though the items, construct a nice list of where
@@ -1780,6 +1773,13 @@ ($fh, $section_name, $element_name, $docref)
17801773 }
17811774
17821775 chomp $pod ; # Make sure prints pod with a single trailing \n
1776+
1777+ # Replace this marker line in the pod with what we say it should expand
1778+ # to.
1779+ $pod =~ s { \b __PLAIN_vs_NOCONTEXT_wording__ \( (\w +) \) } {
1780+ my $this = $1 ;
1781+ $PLAIN_vs_NOCONTEXT_wording =~ s/WHICH/$this /gr
1782+ } xeg ;
17831783 print $fh " \n " , $pod , " \n " ;
17841784
17851785 # Accumulate the usage section of the entry into this array. Output below
@@ -2186,18 +2186,6 @@ ($fh, $section_name, $element_name, $docref)
21862186 }
21872187 }
21882188
2189- for my $compat (@compat_macros ) {
2190- print $fh <<~"EOT" ;
2191-
2192- Note: When called from XS code, $compat (...) expands to
2193- C<Perl_${compat} _no_context(...)> unless C<PERL_WANT_VARARGS> has
2194- been C<#defined>, in which case it expands to
2195- C<Perl_$compat (aTHX_ ...)>. When called from the perl core,
2196- it assumes C<aTHX> is available, so expands to
2197- C<Perl_$compat (aTHX_ ...)>
2198- EOT
2199- }
2200-
22012189 if (grep { / \S / } @usage ) {
22022190 print $fh " \n =over $usage_indent \n\n " ;
22032191 print $fh join " " , @usage ;
0 commit comments