From 34adb8a8ec035afef6bbef0607ad48ed0973f838 Mon Sep 17 00:00:00 2001 From: Fred Drake Date: Mon, 15 Apr 2002 20:48:40 +0000 Subject: 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. --- Doc/perl/python.perl | 29 +++++++++++++++++++++-------- Doc/texinputs/python.sty | 5 ++++- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/Doc/perl/python.perl b/Doc/perl/python.perl index 515b1e8..5d33a6b 100644 --- a/Doc/perl/python.perl +++ b/Doc/perl/python.perl @@ -907,16 +907,29 @@ sub get_refcount{ $TLSTART = ''; $TLEND = ''; -sub do_env_cfuncdesc{ - local($_) = @_; - my $return_type = next_argument(); - my $function_name = next_argument(); - my $arg_list = next_argument(); +sub cfuncline_helper{ + my ($type, $name, $args) = @_; my $idx = make_str_index_entry( - "$function_name()" . get_indexsubitem()); + "$name()" . get_indexsubitem()); $idx =~ s/ \(.*\)//; $idx =~ s/\(\)//; # ???? - why both of these? - my $result_rc = get_refcount($function_name, ''); + return "$type $idx($args)"; +} +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 "
$siginfo\n
" . $_; +} +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 = ''; if ($result_rc eq '+1') { $rcinfo = 'New reference'; @@ -933,7 +946,7 @@ sub do_env_cfuncdesc{ . "\n $rcinfo." . "\n"); } - return "
$return_type $idx($arg_list)\n
" + return "
$siginfo\n
" . $rcinfo . $_ . '
'; diff --git a/Doc/texinputs/python.sty b/Doc/texinputs/python.sty index 5807416..5756213 100644 --- a/Doc/texinputs/python.sty +++ b/Doc/texinputs/python.sty @@ -585,9 +585,12 @@ % \begin{cfuncdesc}[refcount]{type}{name}{arglist} % Note that the [refcount] slot should only be filled in by % 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]{ \begin{fulllineitems} - \item[\code{#2 \bfcode{#3}(\py@varvars{#4})}\index{#3@{\py@idxcode{#3()}}}] + \cfuncline{#2}{#3}{#4} \ifx#1\@undefined\else% \emph{Return value: \textbf{#1}.}\\ \fi -- cgit v0.12