summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/rcsinfo/rcsinfo.sty
blob: 0baf60b0ae362cdb85c2710068ce7bb7f1c2e18a (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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
%%
%% This is file `rcsinfo.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% rcsinfo.dtx  (with options: `header,package')
%% 
%% IMPORTANT NOTICE:
%% 
%% For the copyright see the source file.
%% 
%% Any modified versions of this file must be renamed
%% with new filenames distinct from rcsinfo.sty.
%% 
%% For distribution of the original source see the terms
%% for copying and modification in the file rcsinfo.dtx.
%% 
%% This generated file may be distributed as long as the
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% `rcsinfo' package to use with LaTeX2e.
%%
%% This package is used to extract the revision and file information provided
%% by the RCS revision control system.
%% A PERL-package supporting rcsinfo and LaTeX2HTML is provieded too.
%%
%% Copyright (C) 1995 Dr. Juergen Vollmer
%%                    Viktoriastrasse 15, D-76133 Karlsruhe, Germany
%%                    Juergen.Vollmer@informatik-vollmer.de
%% License:
%%   This program can be redistributed and/or modified under the terms
%%   of the LaTeX Project Public License Distributed from CTAN
%%   archives in directory macros/latex/base/lppl.txt; either
%%   version 1 of the License, or any later version.
%%
%% If you find this software useful, please send me a postcard.
%%
%% $Id: rcsinfo.dtx,v 1.7 2005/02/25 08:37:03 vollmer draft vollmer $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% \CheckSum{397}
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{rcsinfo}[2005/02/20 v1.10]
\newcount\@rcsInfoDay
\newcount\@rcsInfoMonth
\newcount\@rcsInfoYear
\newcount\@rcsInfoYearTmp
\newcount\@rcsInfoMonthTmp
\newcount\@rcsInfoDayTmp
\newif\if@rcsInfoToday@
\DeclareOption{today}{
  \@rcsInfoToday@true
}
\DeclareOption{notoday}{
  \@rcsInfoToday@false
}
\newif\if@rcsInfoUseFancy@
\newif\if@rcsInfoUseFancyhdr@
\newif\if@rcsInfoUseScrpage@
\DeclareOption{fancy}{
  \@rcsInfoUseFancy@true
  \@rcsInfoUseFancyhdr@false
  \@rcsInfoUseScrpage@false
}
\DeclareOption{fancyhdr}{
  \@rcsInfoUseFancy@false
  \@rcsInfoUseFancyhdr@true
  \@rcsInfoUseScrpage@false
}
\DeclareOption{scrpage2}{
  \@rcsInfoUseFancy@false
  \@rcsInfoUseFancyhdr@false
  \@rcsInfoUseScrpage@true
}
\DeclareOption{nofancy}{
  \@rcsInfoUseFancy@false
  \@rcsInfoUseFancyhdr@false
  \@rcsInfoUseScrpage@false
}
\newif\if@rcsInfoLong@
\DeclareOption{long}{
  \@rcsInfoLong@true
}
\DeclareOption{short}{
  \@rcsInfoLong@false
}
\newif\if@rcsInfoDateHyphen@
\DeclareOption{datehyphen}{
  \@rcsInfoDateHyphen@true
}
\ExecuteOptions{today,long}
\IfFileExists{rcsinfo.cfg}{\input{rcsinfo.cfg}}{}
\ProcessOptions
\if@rcsInfoUseFancy@
    \RequirePackage{fancyheadings}
\fi
\if@rcsInfoUseFancyhdr@
    \RequirePackage{fancyhdr}
\fi
\if@rcsInfoUseScrpage@
    \RequirePackage{scrpage2}
\fi
\def\today{\ifcase\month\or
  January\or February\or March\or April\or May\or June\or
  July\or August\or September\or October\or November\or December\fi
  \space\number\day, \number\year}
\newif\if@rcsInfoColonIsActive@

\def\rcsInfo {
   \catcode`\_=13
   \ifnum\catcode`\:=13
      \@rcsInfoColonIsActive@true
      \catcode`:=12
   \else
      \@rcsInfoColonIsActive@false
   \fi
   \@rcsInfoReadArgs
}

\def\@rcsInfoReadArgs #1Id#2 {
  \@rcsInfoDefaults
  \if $#2 \let \@rcsInfoNext = \@rcsInfoEat
  \else   \let \@rcsInfoNext = \@rcsInfoEatColon
  \fi
  \if@rcsInfoColonIsActive@
     \catcode`:=13
  \fi
  \@rcsInfoNext $Id#2
}

\def\@rcsInfoEat #1 {\catcode`\_=8}

\def\@rcsInfoEatColon  $Id:#1 {
  \if $#1 \let \@rcsInfoNext = \@rcsInfoEat
  \else   \let \@rcsInfoNext = \@rcsInfoCrackAndEat
  \fi
  \@rcsInfoNext #1
}

\def\@rcsInfoCrackAndEat #1,v #2 #3 #4 #5 #6 #7 {
  \@rcsInfoCrackString #1,v #2 #3 #4 #5 #6 #7
  \@rcsInfoNext
}

\def\@rcsInfoCrackString #1,v #2 #3 #4 #5 #6 #7 {
  \def\rcsInfoFile{#1}
  \def\rcsInfoRevision{#2}
  \def\rcsInfoTime{#4}
  \def\rcsInfoOwner{#5}
  \def\rcsInfoStatus{#6}
  \write\@mainaux{\string\def\string\rcsInfoFILE{#1}}
  \write\@mainaux{\string\def\string\rcsInfoREVISION{#2}}
  \write\@mainaux{\string\def\string\rcsInfoTIME{#4}}
  \write\@mainaux{\string\def\string\rcsInfoOWNER{#5}}
  \write\@mainaux{\string\def\string\rcsInfoSTATUS{#6}}

  \if $#7
    \def\rcsInfoLocker{--not-locked--}
    \write\@mainaux{\string\def\string\rcsInfoLocker{--not-locked--}}
    \let \@rcsInfoNext = \relax
  \else
    \def\rcsInfoLocker{#7}
    \write\@mainaux{\string\def\string\rcsInfoLocker{#7}}
    \let \@rcsInfoNext = \@rcsInfoEat
  \fi
  \catcode`\_=8
  \@rcsInfoSplitDate x#3x
  \def\rcsInfoLongDate{\@rcsInfoToday}
  \if@rcsInfoToday@
    \year  = \@rcsInfoYear
    \month = \@rcsInfoMonth
    \day   = \@rcsInfoDay
  \fi
}
\if@rcsInfoDateHyphen@
\def\@rcsInfoSplitDate x#1-#2-#3x{
  \@rcsInfoDay  = #3
  \@rcsInfoMonth= #2
  \@rcsInfoYear = #1
  \write\@mainaux{\string\def\string\rcsInfoDAY{#3}}
  \write\@mainaux{\string\def\string\rcsInfoMONTH{#2}}
  \write\@mainaux{\string\def\string\rcsInfoYEAR{#1}}
}
\else
\def\@rcsInfoSplitDate x#1/#2/#3x{
  \@rcsInfoDay  = #3
  \@rcsInfoMonth= #2
  \@rcsInfoYear = #1
  \write\@mainaux{\string\def\string\rcsInfoDAY{#3}}
  \write\@mainaux{\string\def\string\rcsInfoMONTH{#2}}
  \write\@mainaux{\string\def\string\rcsInfoYEAR{#1}}
}
\fi
\def\@rcsInfoToday {%
   \@rcsInfoYearTmp  = \year
   \@rcsInfoMonthTmp = \month
   \@rcsInfoDayTmp   = \day
   \year  = \@rcsInfoYear
   \month = \@rcsInfoMonth
   \day   = \@rcsInfoDay
   \today%
   \year  = \@rcsInfoYearTmp
   \month = \@rcsInfoMonthTmp
   \day   = \@rcsInfoDayTmp
}
\def\@rcsInfoDefaults {
  \@rcsInfoYear  = \year
  \@rcsInfoMonth = \month
  \@rcsInfoDay   = \day
  \def\rcsInfoFile{--sourcefile--}
  \def\rcsInfoDate{\the\@rcsInfoYear/\two@digits\@rcsInfoMonth/%
                   \two@digits\@rcsInfoDay}
  \def\rcsInfoTime{--time--}
  \def\rcsInfoRevision{--revision--}
  \def\rcsInfoOwner{--owner--}
  \def\rcsInfoStatus{--status--}
  \def\rcsInfoLocker{--locker--}
  \def\rcsInfoYear{\the\@rcsInfoYear}
  \def\rcsInfoMonth{\the\@rcsInfoMonth}
  \def\rcsInfoDay{\the\@rcsInfoDay}
  \def\rcsInfoLongDate{\@rcsInfoToday}
}
\def\@rcsInfoFancyFoot {
  \if@rcsInfoLong@
    \def\@rcsInfoFancyInfo{{\footnotesize%
                           \emph{Rev: \rcsInfoRevision,
                                      \rcsInfoStatus,
                                      \rcsInfoLongDate}}}
  \else
    \def\@rcsInfoFancyInfo{{\footnotesize%
                          \emph{Rev: \rcsInfoRevision,
                                     \rcsInfoStatus,
                                     \rcsInfoDate}}}
  \fi
  \def\@rcsInfoFancyFile{{\footnotesize\emph{\rcsInfoFile}}}
  \if@rcsInfoUseFancy@
    \rfoot[\fancyplain{\@rcsInfoFancyFile}{\@rcsInfoFancyFile}]%
          {\fancyplain{\@rcsInfoFancyInfo}{\@rcsInfoFancyInfo}}
    \lfoot[\fancyplain{\@rcsInfoFancyInfo}{\@rcsInfoFancyInfo}]%
          {\fancyplain{\@rcsInfoFancyFile}{\@rcsInfoFancyFile}}
    \setlength{\footrulewidth}{0.4pt}
    \setlength{\plainfootrulewidth}{0.4pt}
  \fi
  \if@rcsInfoUseFancyhdr@
    \fancyfoot[LE,RO]{\@rcsInfoFancyInfo}
    \fancyfoot[LO,RE]{\@rcsInfoFancyFile}
    \fancyfoot[CO,CE]{\thepage}
    \renewcommand{\footrulewidth}{0.4pt}
    \fancypagestyle{plain}{%
       \fancyfoot[LE,RO]{\@rcsInfoFancyInfo}
       \fancyfoot[LO,RE]{\@rcsInfoFancyFile}
       \fancyfoot[CO,CE]{\thepage}
       \renewcommand{\footrulewidth}{0.4pt}
    }
  \fi
 \if@rcsInfoUseScrpage@
    \clearscrheadfoot
    \ohead{\headmark}
    \cfoot[\emph{\@rcsInfoFancyInfo}]{\emph{\@rcsInfoFancyInfo}}
    \ifoot[\@rcsInfoFancyFile]{\@rcsInfoFancyFile}
    \ofoot[\pagemark]{\pagemark}
    \pagestyle{scrheadings}
  \fi
}

\@rcsInfoDefaults

\AtBeginDocument{
  \if@rcsInfoUseFancy@
    \@rcsInfoFancyFoot
  \fi
  \if@rcsInfoUseFancyhdr@
    \@rcsInfoFancyFoot
  \fi
  \if@rcsInfoUseScrpage@
    \@rcsInfoFancyFoot
  \fi
}
\endinput
%%
%% End of file `rcsinfo.sty'.