[Python-checkins] python/dist/src/Doc/texinputs python.sty,1.95,1.96

fdrake@users.sourceforge.net fdrake@users.sourceforge.net
Tue, 02 Jul 2002 13:32:52 -0700


Update of /cvsroot/python/python/dist/src/Doc/texinputs
In directory usw-pr-cvs1:/tmp/cvs-serv10448/texinputs

Modified Files:
	python.sty 
Log Message:
Abstract the creation of signature lines for callable things; the new
\py@sigline macro will wrap the argument list so it will not extend into
the right margin.
Substantially based on a contribution from Dave Cole.
This addresses one of the comments in SF bug #574742.


Index: python.sty
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/python.sty,v
retrieving revision 1.95
retrieving revision 1.96
diff -C2 -d -r1.95 -r1.96
*** python.sty	15 Apr 2002 20:48:40 -0000	1.95
--- python.sty	2 Jul 2002 20:32:50 -0000	1.96
***************
*** 582,585 ****
--- 582,595 ----
  \newcommand{\py@unspecified}{...}
  
+ 
+ \newlength{\py@argswidth}
+ \newcommand{\py@sigparams}[1]{%
+   \parbox[t]{\py@argswidth}{\py@varvars{#1}\code{)}}}
+ \newcommand{\py@sigline}[2]{%
+   \settowidth{\py@argswidth}{#1\code{(}}%
+   \addtolength{\py@argswidth}{-2\py@argswidth}%
+   \addtolength{\py@argswidth}{\textwidth}%
+   \item[#1\code{(}\py@sigparams{#2}]}
+ 
  % C functions ------------------------------------------------------------
  % \begin{cfuncdesc}[refcount]{type}{name}{arglist}
***************
*** 587,591 ****
  % 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]{
--- 597,602 ----
  % tools/anno-api.py; it pulls the value from the refcounts database.
  \newcommand{\cfuncline}[3]{
!   \py@sigline{\code{#1 \bfcode{#2}}}{#3}%
!   \index{#2@{\py@idxcode{#2()}}}
  }
  \newenvironment{cfuncdesc}[4][\py@badkey]{
***************
*** 646,650 ****
  
  % similar to {funcdesc}, but doesn't add to the index
! \newcommand{\funclineni}[2]{\item[\code{\bfcode{#1}(\py@varvars{#2})}]}
  \newenvironment{funcdescni}[2]{
    \begin{fulllineitems}
--- 657,662 ----
  
  % similar to {funcdesc}, but doesn't add to the index
! \newcommand{\funclineni}[2]{%
!   \py@sigline{\bfcode{#1}}{#2}}
  \newenvironment{funcdescni}[2]{
    \begin{fulllineitems}
***************
*** 658,663 ****
    \global\def\py@thisclass{#1}
    \begin{fulllineitems}
!     \item[\strong{class }\code{\bfcode{#1}(\py@varvars{#2})}%
!       \index{#1@{\py@idxcode{#1}} (class in \py@thismodule)}]
  }{\end{fulllineitems}}
  
--- 670,675 ----
    \global\def\py@thisclass{#1}
    \begin{fulllineitems}
!     \py@sigline{\strong{class }\bfcode{#1}}{#2}%
!     \index{#1@{\py@idxcode{#1}} (class in \py@thismodule)}
  }{\end{fulllineitems}}
  
***************
*** 677,682 ****
    \global\def\py@thisclass{#1}
    \begin{fulllineitems}
!     \item[\strong{exception }\code{\bfcode{#1}(\py@varvars{#2})}%
!       \index{#1@{\py@idxcode{#1}} (exception in \py@thismodule)}]
  }{\end{fulllineitems}}
  
--- 689,694 ----
    \global\def\py@thisclass{#1}
    \begin{fulllineitems}
!     \py@sigline{\strong{exception }\bfcode{#1}}{#2}%
!     \index{#1@{\py@idxcode{#1}} (exception in \py@thismodule)}
  }{\end{fulllineitems}}
  
***************
*** 710,714 ****
  % (never actually uses the optional argument)
  \newcommand{\methodlineni}[3][\py@classbadkey]{%
!   \item[\code{\bfcode{#2}(\py@varvars{#3})}]}
  \newenvironment{methoddescni}[3][\py@classbadkey]{
    \begin{fulllineitems}
--- 722,726 ----
  % (never actually uses the optional argument)
  \newcommand{\methodlineni}[3][\py@classbadkey]{%
!   \py@sigline{\bfcode{#2}}{#3}}
  \newenvironment{methoddescni}[3][\py@classbadkey]{
    \begin{fulllineitems}