mirror of
https://github.com/python/cpython.git
synced 2025-09-14 04:37:29 +00:00
Separate out a \cfuncline macro from the cfuncdesc environment.
This matches many other of the *desc environments, and is useful when multiple functions share a description.
This commit is contained in:
parent
1251b0eb24
commit
34adb8a8ec
2 changed files with 25 additions and 9 deletions
|
@ -907,16 +907,29 @@ sub get_refcount{
|
||||||
$TLSTART = '<span class="typelabel">';
|
$TLSTART = '<span class="typelabel">';
|
||||||
$TLEND = '</span>';
|
$TLEND = '</span>';
|
||||||
|
|
||||||
sub do_env_cfuncdesc{
|
sub cfuncline_helper{
|
||||||
local($_) = @_;
|
my ($type, $name, $args) = @_;
|
||||||
my $return_type = next_argument();
|
|
||||||
my $function_name = next_argument();
|
|
||||||
my $arg_list = next_argument();
|
|
||||||
my $idx = make_str_index_entry(
|
my $idx = make_str_index_entry(
|
||||||
"<tt class=\"cfunction\">$function_name()</tt>" . get_indexsubitem());
|
"<tt class=\"cfunction\">$name()</tt>" . get_indexsubitem());
|
||||||
$idx =~ s/ \(.*\)//;
|
$idx =~ s/ \(.*\)//;
|
||||||
$idx =~ s/\(\)//; # ???? - why both of these?
|
$idx =~ s/\(\)//; # ???? - why both of these?
|
||||||
my $result_rc = get_refcount($function_name, '');
|
return "$type <b>$idx</b>(<var>$args</var>)";
|
||||||
|
}
|
||||||
|
sub do_cmd_cfuncline{
|
||||||
|
local($_) = @_;
|
||||||
|
my $type = next_argument();
|
||||||
|
my $name = next_argument();
|
||||||
|
my $args = next_argument();
|
||||||
|
my $siginfo = cfuncline_helper($type, $name, $args);
|
||||||
|
return "<dt>$siginfo\n<dd>" . $_;
|
||||||
|
}
|
||||||
|
sub do_env_cfuncdesc{
|
||||||
|
local($_) = @_;
|
||||||
|
my $type = next_argument();
|
||||||
|
my $name = next_argument();
|
||||||
|
my $args = next_argument();
|
||||||
|
my $siginfo = cfuncline_helper($type, $name, $args);
|
||||||
|
my $result_rc = get_refcount($name, '');
|
||||||
my $rcinfo = '';
|
my $rcinfo = '';
|
||||||
if ($result_rc eq '+1') {
|
if ($result_rc eq '+1') {
|
||||||
$rcinfo = 'New reference';
|
$rcinfo = 'New reference';
|
||||||
|
@ -933,7 +946,7 @@ sub do_env_cfuncdesc{
|
||||||
. "\n <span class=\"value\">$rcinfo.</span>"
|
. "\n <span class=\"value\">$rcinfo.</span>"
|
||||||
. "\n</div>");
|
. "\n</div>");
|
||||||
}
|
}
|
||||||
return "<dl><dt>$return_type <b>$idx</b>(<var>$arg_list</var>)\n<dd>"
|
return "<dl><dt>$siginfo\n<dd>"
|
||||||
. $rcinfo
|
. $rcinfo
|
||||||
. $_
|
. $_
|
||||||
. '</dl>';
|
. '</dl>';
|
||||||
|
|
|
@ -585,9 +585,12 @@
|
||||||
% \begin{cfuncdesc}[refcount]{type}{name}{arglist}
|
% \begin{cfuncdesc}[refcount]{type}{name}{arglist}
|
||||||
% Note that the [refcount] slot should only be filled in by
|
% Note that the [refcount] slot should only be filled in by
|
||||||
% tools/anno-api.py; it pulls the value from the refcounts database.
|
% tools/anno-api.py; it pulls the value from the refcounts database.
|
||||||
|
\newcommand{\cfuncline}[3]{
|
||||||
|
\item[\code{#1 \bfcode{#2}(\py@varvars{#3})}\index{#2@{\py@idxcode{#2()}}}]
|
||||||
|
}
|
||||||
\newenvironment{cfuncdesc}[4][\py@badkey]{
|
\newenvironment{cfuncdesc}[4][\py@badkey]{
|
||||||
\begin{fulllineitems}
|
\begin{fulllineitems}
|
||||||
\item[\code{#2 \bfcode{#3}(\py@varvars{#4})}\index{#3@{\py@idxcode{#3()}}}]
|
\cfuncline{#2}{#3}{#4}
|
||||||
\ifx#1\@undefined\else%
|
\ifx#1\@undefined\else%
|
||||||
\emph{Return value: \textbf{#1}.}\\
|
\emph{Return value: \textbf{#1}.}\\
|
||||||
\fi
|
\fi
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue