summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/docmfp/docmfp.sty
blob: dc79ef59528fe86cee7a4db8f836b64bb76cd8b4 (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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
%%
%% This is file `docmfp.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% docmfp.dtx  (with options: `usc')
%% 
%% -----------------------------------------------------------------
%%   Author: Peter Wilson (Herries Press)
%%   Maintainer: Will Robertson (will dot robertson at latex-project dot org)
%%   Copyright 1999--2005 Peter R. Wilson
%% 
%%   This work may be distributed and/or modified under the
%%   conditions of the LaTeX Project Public License, either
%%   version 1.3c of this license or (at your option) any
%%   later version: <http://www.latex-project.org/lppl.txt>
%% 
%%   This work has the LPPL maintenance status "maintained".
%%   The Current Maintainer of this work is Will Robertson.
%% 
%%   This work consists of the files listed in the README file.
%% -----------------------------------------------------------------
%% 
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{docmfp}[2004/05/14 v1.2b 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}

\renewcommand{\check@checksum}{\relax
      \ifnum\check@sum=\bslash@cnt
        \typeout{*******************}%
        \typeout{* Checksum passed *}%
        \typeout{*******************}%
      \else
        \PackageError{docmfp}{Checksum not passed
                   (\the\check@sum<>\the\bslash@cnt)}%
         {The file currently documented seems to be wrong.^^J%
          Try to get a correct version.}%
      \fi
      \global\check@sum\z@}

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