summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/docmfp/docmfp.sty
blob: f27333d300a0ddb9546c35e7be0491b78d371e09 (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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
%%
%% This is file `docmfp.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% docmfp.dtx  (with options: `usc')
%% 
%%  Copyright 1999 Peter R. Wilson
%% 
%%  This program is provided under the terms of the
%%  LaTeX Project Public License distributed from CTAN
%%  archives in directory macros/latex/base/lppl.txt.
%% 
%% Author: Peter Wilson (CUA)
%%         now at: peter.r.wilson@boeing.com
%% 
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{docmfp}[2000/10/28 v1.1 General coding extension to the doc package]

\newcommand{\m@fpmakeuscoreletter}{\catcode`\_11\relax}
\newcommand{\m@fpmakehashletter}{\catcode`\#11\relax}
\newcommand{\Makem@fpPrivateLetters}{\m@fpmakeuscoreletter\m@fpmakehashletter}

\def\routine{\begingroup
  \catcode`\\12
  \Makem@fpPrivateLetters \m@fpm@cro@ \iffalse}
\let\endroutine\endtrivlist

\def\variable{\begingroup
  \catcode`\\12
  \Makem@fpPrivateLetters \m@fpm@cro@ \iftrue}
\let\endvariable\endroutine

\long\def\m@fpm@cro@#1#2{\endgroup \topsep\MacroTopsep \trivlist
  \def\makelabel##1{\llap{##1}}%
  \if@inlabel
    \let\@tempa\@empty \count@\macro@cnt
    \loop \ifnum\count@>\z@
      \edef\@tempa{\@tempa\hbox{\strut}}\advance\count@\m@ne \repeat
    \edef\makelabel##1{\llap{\vtop to\baselineskip
                              {\@tempa\hbox{##1}\vss}}}%
    \advance \macro@cnt \@ne
  \else
    \macro@cnt\@ne
  \fi
  \edef\@tempa{\noexpand\item[\noexpand\PrintMfpName{\string#2}]}%
  \@tempa
  \global\advance\c@CodelineNo\@ne
  #1%
    \SpecialMainMfpIndex{#2}{\variablestring}{\variableheadname}\nobreak
  \else
    \SpecialMainMfpIndex{#2}{\routinestring}{\routineheadname}\nobreak
  \fi
  \global\advance\c@CodelineNo\m@ne
  \ignorespaces}

\newcommand{\routinestring}{\space(routine)}
\newcommand{\routineheadname}{routines:}

\newcommand{\variablestring}{\space(variable)}
\newcommand{\variableheadname}{variables:}

\def\Describe{\leavevmode\@bsphack\begingroup\Makem@fpPrivateLetters
  \Describem@fp}

\def\Describem@fp#1#2#3{\endgroup
  \marginpar{\raggedleft\PrintMfpName{#3}}%
  \SpecialMfpIndex{#3}{#2}{#1}\@esphack\ignorespaces}

\def\Code{\begingroup
 %%  \catcode`\\12
  \Makem@fpPrivateLetters \m@fpm@c}
\let\endCode\endtrivlist

\long\def\m@fpm@c#1#2#3{\endgroup \topsep\MacroTopsep \trivlist
  \def\makelabel##1{\llap{##1}}%
  \if@inlabel
    \let\@tempa\@empty \count@\macro@cnt
    \loop \ifnum\count@>\z@
      \edef\@tempa{\@tempa\hbox{\strut}}%
      \advance\count@\m@ne \repeat
    \edef\makelabel##1{\llap{\vtop to\baselineskip
                             {\@tempa\hbox{##1}\vss}}}%
    \advance\macro@cnt\@ne
  \else
    \macro@cnt\@ne
  \fi
  \edef\@tempa{\noexpand\item[\noexpand\PrintMfpName{\string#3}]}%
  \@tempa
  \global\advance\c@CodelineNo\@ne
  \SpecialMainMfpIndex{#3}{#2}{#1}\nobreak
  \global\advance\c@CodelineNo\m@ne
  \ignorespaces}

\providecommand{\PrintMfpName}[1]{\strut \MacroFont \string #1\ }

\newcommand{\SpecialMainMfpIndex}[3]{\@bsphack
  \special@index{%
    \string#1\actualchar
    \string\verb\quotechar*\verbatimchar\string#1\verbatimchar
    #2 \encapchar main}%
  \special@index{#3\levelchar
    \string#1\actualchar
    \string\verb\quotechar*\verbatimchar\string#1\verbatimchar
    \encapchar main}
  \@esphack}

\def\DescribeRoutine{\leavevmode\@bsphack\begingroup\Makem@fpPrivateLetters
  \Describem@fpRoutine}
\def\Describem@fpRoutine#1{\endgroup
  \marginpar{\raggedleft\PrintMfpName{#1}}%
  \SpecialMfpIndex{#1}{\routinestring}{\routineheadname}\@esphack\ignorespaces}

\def\DescribeVariable{\leavevmode\@bsphack\begingroup\Makem@fpPrivateLetters
  \Describem@fpVariable}
\def\Describem@fpVariable#1{\endgroup
  \marginpar{\raggedleft\PrintMfpName{#1}}%
  \SpecialMfpIndex{#1}{\variablestring}{\variableheadname}\@esphack\ignorespaces}

\newcommand{\SpecialMfpIndex}[3]{\@bsphack
  \index{%
    \string#1\actualchar
    \string\verb\quotechar*\verbatimchar\string#1\verbatimchar
    #2 \encapchar usage}%
  \index{#3\levelchar
    \string#1\actualchar
    \string\verb\quotechar*\verbatimchar\string#1\verbatimchar
    \encapchar usage}
  \@esphack}

\endinput
%%
%% End of file `docmfp.sty'.