1 % Version management for Unified Process Methodology
3 % Copyright (c) 2006-2007 Stephane GALLAND <galland@arakhne.org>
4 % Copyright (c) 2013 Stephane GALLAND <galland@arakhne.org>
6 % This program is free library; you can redistribute it and/or modify
7 % it under the terms of the GNU Lesser General Public License as
8 % published by the Free Software Foundation; either version 3 of the
9 % License, or any later version.
11 % This library is distributed in the hope that it will be useful, but
12 % WITHOUT ANY WARRANTY; without even the implied warranty of
13 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 % Lesser General Public License for more details.
16 % You should have received a copy of the GNU Lesser General Public
17 % License along with this library; see the file COPYING. If not,
18 % write to the Free Software Foundation, Inc., 59 Temple Place - Suite
19 % 330, Boston, MA 02111-1307, USA.
22 \global\edef\upm@package@version@ver{2013/08/26}
24 \NeedsTeXFormat{LaTeX2e}[1995/12/01]
25 \ProvidesPackage{upmethodology-version}[\upm@package@version@ver]
27 \RequirePackage{upmethodology-p-common}
30 \def\upm@version@lang@english{
31 \gdef\upm@lang@@{\message{**** upmethodology-version is using English language ****}}%
32 \gdef\upm@lang@date{Date}
33 \gdef\upm@lang@updates{Updates}
34 \gdef\upm@lang@version{Version}
35 \gdef\upm@lang@version@history{Version History}
36 \gdef\upm@lang@restricted{Confidential}
37 \gdef\upm@lang@validable{Validable}
38 \gdef\upm@lang@validated{Validated}
39 \gdef\upm@lang@public{Public}
41 \def\upm@version@lang@french{
42 \gdef\upm@lang@@{\message{**** upmethodology-version is using French language ****}}%
43 \gdef\upm@lang@date{Date}
44 \gdef\upm@lang@updates{Modifications}
45 \gdef\upm@lang@version{Version}
46 \gdef\upm@lang@version@history{Historique}
47 \gdef\upm@lang@restricted{Confidentiel}
48 \gdef\upm@lang@validable{Validable}
49 \gdef\upm@lang@validated{Valid\'e}
50 \gdef\upm@lang@public{Publique}
53 %----------------------------------------
55 %----------------------------------------
56 \DeclareOption{french}{%
57 \upm@version@lang@french
59 \DeclareOption{francais}{%
60 \upm@version@lang@french
62 \DeclareOption{english}{%
63 \upm@version@lang@english
65 \ExecuteOptions{english}
70 \RequirePackage{upmethodology-fmt}
75 % Internal information: first and last registered dates
76 \let\upm@thefirstdate\@undefined
77 \let\upm@thelastdate\@undefined
79 %increment major part of version number
80 \def\upm@incmajorversion#1.#2{%
81 \upm@tmp@a=#1\advance\upm@tmp@a + 1%
82 \global\edef\theupmversion{\the\upm@tmp@a.0}%
85 %increment minor part of version number
86 \def\upm@incminorversion#1.#2{%
87 \upm@tmp@a=#2\advance\upm@tmp@a + 1%
88 \global\edef\theupmversion{#1.\the\upm@tmp@a}%
92 \def\upm@update@list{}
94 %add an update to the list
95 \newcommand{\upm@addupdatetolist}[4]{%
96 \global\protected@edef\upm@update@list{%
98 #1 & #2 & #3 \protect\\%
103 % Available status' constants
104 \def\upmrestricted{\upm@lang@restricted}
105 \def\upmvalidable{\upm@lang@validable}
106 \def\upmvalidated{\upm@lang@validated}
107 \def\upmpublic{\upm@lang@public}
110 % Replies the modification date of the given version
111 \newcommand{\upmdate}[1]{\@nameuse{upm@version@#1@updatedate}}
114 % Replies the modification description of the given version
115 \newcommand{\upmdescription}[1]{\@nameuse{upm@version@#1@description}}
118 % Replies the status of the given version
119 \newcommand{\upmstatus}[1]{\@nameuse{upm@version@#1@level}}
122 \newcommand{\upm@updateversion}[4]{%
123 \gdef\theupmdate{#2}%
124 \gdef\theupmlastmodif{#3}%
125 \gdef\theupmstatus{#4}%
126 \ifx\upm@thefirstdate\@undefined
127 \global\edef\upm@thefirstdate{#2}
129 \global\edef\upm@thelastdate{#2}
130 \@namedef{upm@version@#1@updatedate}{#2}%
131 \@namedef{upm@version@#1@description}{#3}%
132 \@namedef{upm@version@#1@level}{#4}%
133 \upm@addupdatetolist{#1}{#2}{#3}{#4}%
137 %\updateversion{new_version}{update_date}{description}{status}
138 \newcommand{\updateversion}[4]{%
139 \gdef\theupmversion{#1}%
140 \upm@updateversion{#1}{#2}{#3}{#4}%
144 %\initialversion[version]{date}{description}{status}
145 \newcommand{\initialversion}[4][0.1]{%
146 \updateversion{#1}{#2}{#3}{#4}%
150 %\incversion{update_date}{description}{status}
151 \newcommand{\incversion}[3]{%
152 \expandafter\upm@incmajorversion\theupmversion%
153 \upm@updateversion{\theupmversion}{#1}{#2}{#3}%
157 %\incsubversion{update_date}{description}{status}
158 \newcommand{\incsubversion}[3]{%
159 \expandafter\upm@incminorversion\theupmversion%
160 \upm@updateversion{\theupmversion}{#1}{#2}{#3}%
165 \def\theupmversion{0.1}
166 \edef\theupmdate{\today}
167 \def\theupmlastmodif{}
168 \def\theupmstatus{\upmrestricted}
171 % Display the version history
173 \newcommand{\upmhistory}[1][\linewidth]{%
174 \noindent\expandafter\begin{mtabular}[#1]{3}{|c|c|X|}
175 \tabulartitle{\upm@lang@version@history}%
176 \tabularheader{\upm@lang@version}{\upm@lang@date}{\upm@lang@updates}%
179 \expandafter\end{mtabular}\par\vspace{.5cm}%
185 \newcommand{\upmcopyrightdate}{%
186 \ifx\upm@thefirstdate\@undefined%
187 \edef\upm@tmp@copyright@a{\the\year}%
189 \edef\upm@tmp@copyright@a{\extractyear{\upm@thefirstdate}}%
191 \ifx\upm@thelastdate\@undefined%
192 \def\upm@tmp@copyright@b{\the\year}%
194 \edef\upm@tmp@copyright@b{\extractyear{\upm@thelastdate}}%
196 \ifthenelse{\equal{\upm@tmp@copyright@a}{\upm@tmp@copyright@b}}{%
197 \upm@tmp@copyright@a%
199 \upm@tmp@copyright@a-\upm@tmp@copyright@b%