]> AND Private Git Repository - these_charles_emile.git/blob - upmethodology-version.sty
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
RCE : Update du 9/1/2016
[these_charles_emile.git] / upmethodology-version.sty
1 % Version management for Unified Process Methodology
2 %
3 % Copyright (c) 2006-2007 Stephane GALLAND <galland@arakhne.org>
4 % Copyright (c) 2013 Stephane GALLAND <galland@arakhne.org>
5
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.
10 %
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.
15 %
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.
20 %
21
22 \global\edef\upm@package@version@ver{2013/08/26}
23
24 \NeedsTeXFormat{LaTeX2e}[1995/12/01]
25 \ProvidesPackage{upmethodology-version}[\upm@package@version@ver]
26
27 \RequirePackage{upmethodology-p-common}
28
29 %locales
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}
40 }
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}
51 }
52
53 %----------------------------------------
54 % OPTIONS
55 %----------------------------------------
56 \DeclareOption{french}{%
57   \upm@version@lang@french
58 }
59 \DeclareOption{francais}{%
60   \upm@version@lang@french
61 }
62 \DeclareOption{english}{%
63   \upm@version@lang@english
64 }
65 \ExecuteOptions{english}
66 \ProcessOptions*
67
68 \upm@lang@@
69
70 \RequirePackage{upmethodology-fmt}
71
72 %tmp counter
73 \newcount{\upm@tmp@a}
74
75 % Internal information: first and last registered dates
76 \let\upm@thefirstdate\@undefined
77 \let\upm@thelastdate\@undefined
78
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}%
83 }
84
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}%
89 }
90
91 %list of updates
92 \def\upm@update@list{}
93
94 %add an update to the list
95 \newcommand{\upm@addupdatetolist}[4]{%
96         \global\protected@edef\upm@update@list{%
97                 \upm@update@list%
98                 #1 & #2 & #3 \protect\\%
99         }
100 }
101
102 %-----
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}
108
109 %-----
110 % Replies the modification date of the given version
111 \newcommand{\upmdate}[1]{\@nameuse{upm@version@#1@updatedate}}
112
113 %-----
114 % Replies the modification description of the given version
115 \newcommand{\upmdescription}[1]{\@nameuse{upm@version@#1@description}}
116
117 %-----
118 % Replies the status of the given version
119 \newcommand{\upmstatus}[1]{\@nameuse{upm@version@#1@level}}
120
121 %-----
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}
128         \fi
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}%
134 }
135
136 %-----
137 %\updateversion{new_version}{update_date}{description}{status}
138 \newcommand{\updateversion}[4]{%
139         \gdef\theupmversion{#1}%
140         \upm@updateversion{#1}{#2}{#3}{#4}%
141 }
142
143 %-----
144 %\initialversion[version]{date}{description}{status}
145 \newcommand{\initialversion}[4][0.1]{%
146         \updateversion{#1}{#2}{#3}{#4}%
147 }
148
149 %-----
150 %\incversion{update_date}{description}{status}
151 \newcommand{\incversion}[3]{%
152         \expandafter\upm@incmajorversion\theupmversion%
153         \upm@updateversion{\theupmversion}{#1}{#2}{#3}%
154 }
155
156 %-----
157 %\incsubversion{update_date}{description}{status}
158 \newcommand{\incsubversion}[3]{%
159         \expandafter\upm@incminorversion\theupmversion%
160         \upm@updateversion{\theupmversion}{#1}{#2}{#3}%
161 }
162
163 %-----
164 % Version variables
165 \def\theupmversion{0.1}
166 \edef\theupmdate{\today}
167 \def\theupmlastmodif{}
168 \def\theupmstatus{\upmrestricted}
169
170 %-----
171 % Display the version history
172 %\upmhistory[width]
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}%
177         \upm@update@list
178         \hline
179         \expandafter\end{mtabular}\par\vspace{.5cm}%
180 }
181
182 %-----
183 % Copyright date
184 %\upmcopyrightdate
185 \newcommand{\upmcopyrightdate}{%
186         \ifx\upm@thefirstdate\@undefined%
187                 \edef\upm@tmp@copyright@a{\the\year}%
188         \else%
189                 \edef\upm@tmp@copyright@a{\extractyear{\upm@thefirstdate}}%
190         \fi%
191         \ifx\upm@thelastdate\@undefined%
192                 \def\upm@tmp@copyright@b{\the\year}%
193         \else%
194                 \edef\upm@tmp@copyright@b{\extractyear{\upm@thelastdate}}%
195         \fi%
196         \ifthenelse{\equal{\upm@tmp@copyright@a}{\upm@tmp@copyright@b}}{%
197                 \upm@tmp@copyright@a%
198         }{%
199                 \upm@tmp@copyright@a-\upm@tmp@copyright@b%
200         }%
201 }
202
203 \endinput