summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/arabi/arabiftoday.sty
blob: 85175e0377b8c7868ed7695e06327cd5443319de (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
% \iffalse meta-comment
%
% Copyright 2006      Youssef Jabri
% 
% 
% This file is part of the `Arabi' system.
% -------------------------------------------
% 
% It may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3b
% of this license or (at your option) any later version.
% The latest version of this license is in
%    http://www.latex-project.org/lppl.txt
% and version 1.3b or later is part of all distributions of LaTeX 
% version 2005/12/01 or later.
% 
% This file has the LPPL maintenance status "maintained".
% 
% 
% \fi
%
% Filename: `Arabiftoday.sty' Farsi Jalai date module for use with
% the Arabi package.
%
%% %%%%%%%%%%%%%%%%% MODIFICATION %%%%%%%%%%%%%%%%%%%%%%%%%%
%% just renamed the months properly for use with Arabi
%% Did not want to use any local encoding, so we used the 
%% internal glyphs names!
%% And added the control sequence \farsimonth
%%
%% Youssef JABRI   January 2006
%%==========================================================
%%
%%  This file is a part of FarsiTeX, a Persian/English typesetting system.
%%
%%  Copyright (C) 1996 Hassan Abolhassani
%%  Copyright (C) 1996-2001 Roozbeh Pournader <roozbeh@sharif.edu>
%%  Copytight (C) 2000-2001 Behdad Esfahbod <behdad@bamdad.org>
%%
%%  FarsiTeX is free software; you can redistribute it and/or modify
%%  it under the terms of the GNU General Public License as published by
%%  the Free Software Foundation; either version 2 of the License, or
%%  (at your option) any later version.
%%
%%  FarsiTeX 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 General Public License for more details.
%%
%%  You should have received a copy of the GNU General Public License
%%  along with FarsiTeX; if not, write to the Free Software
%%  Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307,
%%  USA.
%%
%%  Any licensing or usage questions should be directed to Roozbeh
%%  Pournader <roozbeh@sharif.edu>.
%%

\newif\ifFT@leap \newif\ifFT@kabiseh
\newcount\FT@i  \newcount\FT@y  \newcount\FT@m  \newcount\FT@d
\newcount\FT@latini    \newcount\FT@farsii
\newcount\FT@latinii   \newcount\FT@farsiii
\newcount\FT@latiniii  \newcount\FT@farsiiii
\newcount\FT@latiniv   \newcount\FT@farsiiv
\newcount\FT@latinv    \newcount\FT@farsiv
\newcount\FT@latinvi   \newcount\FT@farsivi
\newcount\FT@latinvii  \newcount\FT@farsivii
\newcount\FT@latinviii \newcount\FT@farsiviii
\newcount\FT@latinix   \newcount\FT@farsiix
\newcount\FT@latinx    \newcount\FT@farsix
\newcount\FT@latinxi   \newcount\FT@farsixi
\newcount\FT@latinxii  \newcount\FT@farsixii
                       \newcount\FT@farsixiii

\newcount\FT@temp
\newcount\FT@temptwo
\newcount\FT@tempthree
\newcount\FT@yModHundred
\newcount\FT@thirtytwo
\newcount\FT@dn
\newcount\FT@sn
\newcount\FT@mminusone

\def\ftoday{%
\FT@y=\year \FT@m=\month \FT@d=\day
%
\FT@temp=\FT@y
\divide\FT@temp by 100\relax
\multiply\FT@temp by 100\relax
\FT@yModHundred=\FT@y
\advance\FT@yModHundred by -\FT@temp\relax
%
\ifodd\FT@yModHundred
   \FT@leapfalse
\else
   \FT@temp=\FT@yModHundred
   \divide\FT@temp by 2\relax
   \ifodd\FT@temp\FT@leapfalse
   \else
      \ifnum\FT@yModHundred=0%
         \FT@temp=\FT@y
         \divide\FT@temp by 400\relax
         \multiply\FT@temp by 400\relax
         \ifnum\FT@y=\FT@temp\FT@leaptrue\else\FT@leapfalse\fi
      \else\FT@leaptrue
      \fi
   \fi
\fi
%
\FT@latini=31\relax
\ifFT@leap
  \FT@latinii = 29\relax
\else
  \FT@latinii = 28\relax
\fi
\FT@latiniii = 31\relax
\FT@latiniv  = 30\relax
\FT@latinv = 31\relax
\FT@latinvi = 30\relax
\FT@latinvii = 31\relax
\FT@latinviii = 31\relax
\FT@latinix = 30\relax
\FT@latinx = 31\relax
\FT@latinxi = 30\relax
\FT@latinxii = 31\relax
%
\FT@thirtytwo=32\relax
%
\FT@temp=\FT@y
\advance\FT@temp by -17\relax
\FT@temptwo=\FT@temp
\divide\FT@temptwo by 33\relax
\multiply\FT@temptwo by 33\relax
\advance\FT@temp by -\FT@temptwo
\ifnum\FT@temp=\FT@thirtytwo\FT@kabisehfalse
\else
   \FT@temptwo=\FT@temp
   \divide\FT@temptwo by 4\relax
   \multiply\FT@temptwo by 4\relax
   \advance\FT@temp by -\FT@temptwo
   \ifnum\FT@temp=\z@\FT@kabisehtrue\else\FT@kabisehfalse\fi
\fi
%
% --BE
% In fact farsii is equal to the Leap years from a fixed year to the last
% year minus the Kabise years from a fixed year to the last year plus a const.
%
\FT@tempthree=\FT@y                 % Number of Leap years
\advance\FT@tempthree by -1
\FT@temp=\FT@tempthree              % T := (MY-1) div 4
\divide\FT@temp by 4\relax
\FT@temptwo=\FT@tempthree           % T := T - ((MY-1) div 100)
\divide\FT@temptwo by 100\relax
\advance\FT@temp by -\FT@temptwo
\FT@temptwo=\FT@tempthree           % T := T + ((MY-1) div 400)
\divide\FT@temptwo by 400\relax
\advance\FT@temp by \FT@temptwo
\advance\FT@tempthree by -611       % Number of Kabise years
\FT@temptwo=\FT@tempthree           % T := T - ((SY+10) div 33) * 8
\divide\FT@temptwo by 33\relax
\multiply\FT@temptwo by 8\relax
\advance\FT@temp by -\FT@temptwo
\FT@temptwo=\FT@tempthree           %
\divide\FT@temptwo by 33\relax
\multiply\FT@temptwo by 33\relax
\advance\FT@tempthree by -\FT@temptwo
\ifnum\FT@tempthree=32\advance\FT@temp by 1\fi % if (SY+10) mod 33=32 then Inc(T);
\divide\FT@tempthree by 4\relax     % T := T - ((SY+10) mod 33) div 4
\advance\FT@temp by -\FT@tempthree
\advance\FT@temp by -137            % T := T - 137  Adjust the value
\FT@farsii=31
\advance\FT@farsii by -\FT@temp                 % now 31 - T is the farsii
%
\FT@farsiii = 30\relax
\ifFT@kabiseh
  \FT@farsiiii = 30\relax
\else
  \FT@farsiiii = 29\relax
\fi
\FT@farsiiv  = 31\relax
\FT@farsiv   = 31\relax
\FT@farsivi  = 31\relax
\FT@farsivii = 31\relax
\FT@farsiviii= 31\relax
\FT@farsiix  = 31\relax
\FT@farsix   = 30\relax
\FT@farsixi  = 30\relax
\FT@farsixii = 30\relax
\FT@farsixiii= 30\relax
%
\FT@dn= 0\relax
\FT@sn= 0\relax
\FT@mminusone=\FT@m
\advance\FT@mminusone by -1\relax
%
\FT@i=0\relax
\ifnum\FT@i < \FT@mminusone
\loop
\advance \FT@i by 1\relax
\advance\FT@dn by \csname FT@latin\romannumeral\the\FT@i\endcsname
\ifnum\FT@i<\FT@mminusone \repeat
\fi
\advance \FT@dn by \FT@d
%
\FT@i=1\relax
\FT@sn = \FT@farsii
\ifnum \FT@sn<\FT@dn
\loop
\advance \FT@i by 1\relax
\advance\FT@sn by \csname FT@farsi\romannumeral\the\FT@i\endcsname
\ifnum \FT@sn<\FT@dn \repeat
\fi
\ifnum \FT@i < 4
   \FT@m = 9 \advance\FT@m by \FT@i
   \advance \FT@y by -622\relax
\else
   \FT@m = \FT@i \advance \FT@m by -3\relax
   \advance \FT@y by -621\relax
\fi
\advance\FT@sn by -\csname FT@farsi\romannumeral\the\FT@i%
\endcsname
\ifnum\FT@i = 1
  \FT@d = \FT@dn \advance \FT@d by 30 \advance\FT@d by -\FT@farsii
\else
  \FT@d = \FT@dn \advance \FT@d by -\FT@sn
\fi
\beginL\number\FT@d\endL\space%
%Changedc from here YJ
\farsimonth{\FT@m}\space\beginL\number\FT@y\endL%
}
% added \farsimonth YJ
\def\farsimonth#1{\ifcase#1\or \fa\ra\waw\ra\dal\ya\nun\or 
\alef\ra\dal\ya\baa\ha\sheen\taa\or 
\kha\ra\dal\alef\dal\or \taa\ya\ra\or 
\meem\ra\dal\alef\dal\or 
\sheen\ha\ra\ya\waw\ra\or \meem\ha\ra\or 
\alefmadda\baa\alef\nun\or \alefmadda\dhal\ra\or 
\dal\ya\or \baa\ha\meem\nun\or 
\alef\seen\fa\nun\dal\fi}
\endinput