summaryrefslogtreecommitdiff
path: root/web/tango-weevil/tw.sty
blob: 64ffd9b3d89a5b1b213a90f3985ea55b53dc3fdc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
\def\filedate{1995/2/6}
\def\fileversion{v1.0}
%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{tw}
\RequirePackage{moreverb}
\RequirePackage{multicol}
\typeout{Package: `tw' \fileversion \space <\filedate>}
%
\newlength{\tw@width}
%
\newcommand{\twstartcode}{\begingroup\footnotesize}
\newcommand{\twendcode}{\endgroup}
\newcommand{\twmacrodecl}[2]{\par\parindent=0pt\parskip=0pt\label{#2}%
                            {\noindent\sffamily\bfseries Code Chunk: #1}%
                            \index{#1@\textit{#1}|textbf}}
\newcommand{\twmacrouse}[2]{{\rm @\(<\)#1\(>\)%
                            (Macro \ref{#2} on page \pageref{#2})}%
                            \index{#1@\textit{#1}}}
\newcommand{\tw@use}[1]{\index{#1}#1}%
\newcommand{\tw@decl}[1]{\index{#1|textbf}#1}%
\newcommand{\u@line}[1]{\settowidth{\tw@width}{#1}\parbox{\tw@width}%
                        {#1\hspace{-\tw@width}\rule[-2pt]{\tw@width}{.2pt}}}
\newenvironment{twuses}
{
   \parindent=0pt%
   \multicolsep=0pt%
   \let\twuse\tw@use%
   \begin{multicols}{2}[\u@line{\sffamily Uses:}]
   \raggedright
}
{\end{multicols}\smallskip}
%
\newenvironment{twdecls}
{
   \parindent=0pt%
   \multicolsep=0pt%
   \let\twdecl\tw@decl%
   \begin{multicols}{2}[\u@line{\sffamily Declares:}]
   \raggedright
}
{\end{multicols}\smallskip}
%
\newcommand{\tw@Description}{\end{minipage}\par\smallskip
\parbox[t]{1in}{\hfill Description:\hspace*{1em}}\begin{minipage}[t]{3.5in}}
%
\newcommand{\tw@SideEffects}{\end{minipage}\par\smallskip
\parbox[t]{1in}{\hfill Side Effects:\hspace*{1em}}\begin{minipage}[t]{3.5in}}
%
\newcommand{\tw@ReturnValues}{\end{minipage}\par\smallskip
\parbox[t]{1in}{\hfill Return Vals:\hspace*{1em}}\begin{minipage}[t]{3.5in}}
%
\newcommand{\tw@Inputs}{\end{minipage}\par\smallskip
\parbox[t]{1in}{\hfill Inputs:\hspace*{1em}}\begin{minipage}[t]{3.5in}}
%
\newcommand{\tw@Outputs}{\end{minipage}\par\smallskip
\parbox[t]{1in}{\hfill Outputs:\hspace*{1em}}\begin{minipage}[t]{3.5in}}
%
\newcommand{\tw@StartCode}{\end{minipage}\par}
\newcommand{\twiscode}{\expandafter\ifx\csname twnocode\endcsname\relax}%
\newcommand{\twisproc}{\expandafter\ifx\csname twnoproc\endcsname\relax}%
%
\twisproc
   \newenvironment{twproc}[1]
   {
      \par
      \parskip=0pt%
      \let\Description\tw@Description%
      \let\SideEffects\tw@SideEffects%
      \let\ReturnValues\tw@ReturnValues%
      \let\Inputs\tw@Inputs%
      \let\Outputs\tw@Outputs%
      \let\StartCode\tw@StartCode%
      \begin{minipage}{4.5in}\textbf{Procedure: #1}}
      {}
\else%
   \newenvironment{twproc}[1]
   {
      \@bsphack
      \let\do\@makeother\dospecials\catcode`\^^M\active
      \let\verbatim@startline\relax
      \let\verbatim@addtoline\@gobble
      \let\verbatim@processline\relax
      \let\verbatim@finish\relax
      \verbatim@
   }
   {\@esphack}
\fi
%
\twiscode
   \newenvironment{twcodechunk}{}{}
\else%
   \newenvironment{twcodechunk}
   {
      \@bsphack
      \let\do\@makeother\dospecials\catcode`\^^M\active
      \let\verbatim@startline\relax
      \let\verbatim@addtoline\@gobble
      \let\verbatim@processline\relax
      \let\verbatim@finish\relax
      \verbatim@
   }
   {\@esphack}
\fi
%
\newcommand{\twparmlist@label}[1]{\mbox{\texttt{#1} - }\hfil}
\newenvironment{twparmlist}
{%
   \begin{list}{}%
         {\setlength{\itemsep}{0pt}%
          \setlength{\parsep}{0pt}%
          \renewcommand{\makelabel}{\twparmlist@label}}%
}%
{\end{list}}