summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/upmethodology/upmethodology-version.sty
blob: f5ea7d90f4417e61ca11926888fdcd18eb32281a (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
% Version management for Unified Process Methodology
%
% Copyright (c) 2006-2007 Stephane GALLAND <galland@arakhne.org>
% 
% This program is free library; you can redistribute it and/or modify
% it under the terms of the GNU Lesser General Public License as
% published by the Free Software Foundation; either version 3 of the
% License, or any later version.
%
% This library is distributed in the hope that it will be useful, but
% WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
% Lesser General Public License for more details.
%
% You should have received a copy of the GNU Lesser General Public
% License along with this library; see the file COPYING.  If not,
% write to the Free Software Foundation, Inc., 59 Temple Place - Suite
% 330, Boston, MA 02111-1307, USA.
%
% Creation date: 2006-04-06
% Modifications:
%   2009-12-30   Bug fix: incversion may reset subversion number.
%   2009-10-30   Clean code.
%   2008-06-24   Update English words.
%   2007-07-03   Add the copyright date building function.
%   2007-03-19   Add localization.
%                Move date functions into fmt package.
%   2006-04-19   Add version number
%

\global\edef\upm@package@version@ver{2009/12/30}

\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{upmethodology-version}[\upm@package@version@ver]

\RequirePackage{upmethodology-p-common}

%locales
\def\upm@version@lang@english{
  \gdef\upm@lang@@{\message{**** upmethodology-version is using English language ****}}%
  \gdef\upm@lang@date{Date}
  \gdef\upm@lang@updates{Updates}
  \gdef\upm@lang@version{Version}
  \gdef\upm@lang@version@history{Version History}
  \gdef\upm@lang@restricted{Confidential}
  \gdef\upm@lang@validable{Validable}
  \gdef\upm@lang@validated{Validated}
  \gdef\upm@lang@public{Public}
}
\def\upm@version@lang@french{
  \gdef\upm@lang@@{\message{**** upmethodology-version is using French language ****}}%
  \gdef\upm@lang@date{Date}
  \gdef\upm@lang@updates{Modifications}
  \gdef\upm@lang@version{Version}
  \gdef\upm@lang@version@history{Historique}
  \gdef\upm@lang@restricted{Confidentiel}
  \gdef\upm@lang@validable{Validable}
  \gdef\upm@lang@validated{Valid\'e}
  \gdef\upm@lang@public{Publique}
}

%----------------------------------------
% OPTIONS
%----------------------------------------
\DeclareOption{french}{%
  \upm@version@lang@french
}
\DeclareOption{francais}{%
  \upm@version@lang@french
}
\DeclareOption{english}{%
  \upm@version@lang@english
}
\ExecuteOptions{english}
\ProcessOptions*

\upm@lang@@

\RequirePackage{upmethodology-fmt}

%tmp counter
\newcount{\upm@tmp@a}

% Internal information: first and last registered dates
\let\upm@thefirstdate\@undefined
\let\upm@thelastdate\@undefined

%increment major part of version number
\def\upm@incmajorversion#1.#2{%
	\upm@tmp@a=#1\advance\upm@tmp@a + 1%
	\global\edef\theupmversion{\the\upm@tmp@a.0}%
}

%increment minor part of version number
\def\upm@incminorversion#1.#2{%
	\upm@tmp@a=#2\advance\upm@tmp@a + 1%
	\global\edef\theupmversion{#1.\the\upm@tmp@a}%
}

%list of updates
\def\upm@update@list{}

%add an update to the list
\newcommand{\upm@addupdatetolist}[4]{%
	\global\protected@edef\upm@update@list{%
		\upm@update@list%
		#1 & #2 & #3 \protect\\%
	}
}

%-----
% Available status' constants
\def\upmrestricted{\upm@lang@restricted}
\def\upmvalidable{\upm@lang@validable}
\def\upmvalidated{\upm@lang@validated}
\def\upmpublic{\upm@lang@public}

%-----
% Replies the modification date of the given version
\newcommand{\upmdate}[1]{\@nameuse{upm@version@#1@updatedate}}

%-----
% Replies the modification description of the given version
\newcommand{\upmdescription}[1]{\@nameuse{upm@version@#1@description}}

%-----
% Replies the status of the given version
\newcommand{\upmstatus}[1]{\@nameuse{upm@version@#1@level}}

%-----
\newcommand{\upm@updateversion}[4]{%
	\gdef\theupmdate{#2}%
	\gdef\theupmlastmodif{#3}%
	\gdef\theupmstatus{#4}%
	\ifx\upm@thefirstdate\@undefined
		\global\edef\upm@thefirstdate{#2}
	\fi
	\global\edef\upm@thelastdate{#2}
	\@namedef{upm@version@#1@updatedate}{#2}%
	\@namedef{upm@version@#1@description}{#3}%
	\@namedef{upm@version@#1@level}{#4}%
	\upm@addupdatetolist{#1}{#2}{#3}{#4}%
}

%-----
%\updateversion{new_version}{update_date}{description}{status}
\newcommand{\updateversion}[4]{%
	\gdef\theupmversion{#1}%
	\upm@updateversion{#1}{#2}{#3}{#4}%
}

%-----
%\initialversion[version]{date}{description}{status}
\newcommand{\initialversion}[4][0.1]{%
	\updateversion{#1}{#2}{#3}{#4}%
}

%-----
%\incversion{update_date}{description}{status}
\newcommand{\incversion}[3]{%
	\expandafter\upm@incmajorversion\theupmversion%
	\upm@updateversion{\theupmversion}{#1}{#2}{#3}%
}

%-----
%\incsubversion{update_date}{description}{status}
\newcommand{\incsubversion}[3]{%
	\expandafter\upm@incminorversion\theupmversion%
	\upm@updateversion{\theupmversion}{#1}{#2}{#3}%
}

%-----
% Version variables
\def\theupmversion{0.1}
\edef\theupmdate{\today}
\def\theupmlastmodif{}
\def\theupmstatus{\upmrestricted}

%-----
% Display the version history
%\upmhistory[width]
\newcommand{\upmhistory}[1][\linewidth]{%
	\noindent\expandafter\begin{mtabular}[#1]{3}{|c|c|X|}
	\tabulartitle{\upm@lang@version@history}%
	\tabularheader{\upm@lang@version}{\upm@lang@date}{\upm@lang@updates}%
	\hline
	\upm@update@list
	\hline
	\expandafter\end{mtabular}\par\vspace{.5cm}%
}

%-----
% Copyright date
%\upmcopyrightdate
\newcommand{\upmcopyrightdate}{%
	\ifx\upm@thefirstdate\@undefined%
		\edef\upm@tmp@copyright@a{\the\year}%
	\else%
		\edef\upm@tmp@copyright@a{\extractyear{\upm@thefirstdate}}%
	\fi%
	\ifx\upm@thelastdate\@undefined%
		\def\upm@tmp@copyright@b{\the\year}%
	\else%
		\edef\upm@tmp@copyright@b{\extractyear{\upm@thelastdate}}%
	\fi%
	\ifthenelse{\equal{\upm@tmp@copyright@a}{\upm@tmp@copyright@b}}{%
		\upm@tmp@copyright@a%
	}{%
		\upm@tmp@copyright@a-\upm@tmp@copyright@b%
	}%
}

\endinput