Hi, This is the macro for Jalali Calendar taken from xepersian %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newif\ifFT@leap \newif\ifFT@kabiseh \newcount\FT@i \newcount\FT@y \newcount\FT@m \newcount\FT@d \newcount\FT@latini \newcount\FT@persiani \newcount\FT@latinii \newcount\FT@persianii \newcount\FT@latiniii \newcount\FT@persianiii \newcount\FT@latiniv \newcount\FT@persianiv \newcount\FT@latinv \newcount\FT@persianv \newcount\FT@latinvi \newcount\FT@persianvi \newcount\FT@latinvii \newcount\FT@persianvii \newcount\FT@latinviii \newcount\FT@persianviii \newcount\FT@latinix \newcount\FT@persianix \newcount\FT@latinx \newcount\FT@persianx \newcount\FT@latinxi \newcount\FT@persianxi \newcount\FT@latinxii \newcount\FT@persianxii \newcount\FT@persianxiii \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 % % --VK % In fact persiani 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@persiani=31 \advance\FT@persiani by -\FT@temp % now 31 - T is the persiani % \FT@persianii = 30\relax \ifFT@kabiseh \FT@persianiii = 30\relax \else \FT@persianiii = 29\relax \fi \FT@persianiv = 31\relax \FT@persianv = 31\relax \FT@persianvi = 31\relax \FT@persianvii = 31\relax \FT@persianviii= 31\relax \FT@persianix = 31\relax \FT@persianx = 30\relax \FT@persianxi = 30\relax \FT@persianxii = 30\relax \FT@persianxiii= 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@persiani \ifnum \FT@sn<\FT@dn \loop \advance \FT@i by 1\relax \advance\FT@sn by \csname FT@persian\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@persian\romannumeral\the\FT@i% \endcsname \ifnum\FT@i = 1 \FT@d = \FT@dn \advance \FT@d by 30 \advance\FT@d by -\FT@persiani \else \FT@d = \FT@dn \advance \FT@d by -\FT@sn \fi \beginL\number\FT@d\endL\space% %Changedc from here YJ \persianmonth{\FT@m}\space\beginL\number\FT@y\endL% } % added \persianmonth YJ \def\persianmonth#1{\ifcase#1\or فروردین\or اردیبهشت\or خرداد\or تیر\or مرداد\or شهریور\or مهر\or آبان\or آذر\or دی\or بهمن\or اسفند\fi} \let\originaltoday=\today \def\today{\lr{\originaltoday}} \let\romantoday\today \def\today{\rl{\ftoday}} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% can you include this in MKIV? Is there copyright issues?
Ilda Khaki wrote:
Hi,
This is the macro for Jalali Calendar taken from xepersian
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newif\ifFT@leap \newif\ifFT@kabiseh \newcount\FT@i \newcount\FT@y \newcount\FT@m \newcount\FT@d \newcount\FT@latini \newcount\FT@persiani \newcount\FT@latinii \newcount\FT@persianii \newcount\FT@latiniii \newcount\FT@persianiii \newcount\FT@latiniv \newcount\FT@persianiv \newcount\FT@latinv \newcount\FT@persianv \newcount\FT@latinvi \newcount\FT@persianvi \newcount\FT@latinvii \newcount\FT@persianvii \newcount\FT@latinviii \newcount\FT@persianviii \newcount\FT@latinix \newcount\FT@persianix \newcount\FT@latinx \newcount\FT@persianx \newcount\FT@latinxi \newcount\FT@persianxi \newcount\FT@latinxii \newcount\FT@persianxii \newcount\FT@persianxiii
\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 % % --VK % In fact persiani 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@persiani=31 \advance\FT@persiani by -\FT@temp % now 31 - T is the persiani % \FT@persianii = 30\relax \ifFT@kabiseh \FT@persianiii = 30\relax \else \FT@persianiii = 29\relax \fi \FT@persianiv = 31\relax \FT@persianv = 31\relax \FT@persianvi = 31\relax \FT@persianvii = 31\relax \FT@persianviii= 31\relax \FT@persianix = 31\relax \FT@persianx = 30\relax \FT@persianxi = 30\relax \FT@persianxii = 30\relax \FT@persianxiii= 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@persiani \ifnum \FT@sn<\FT@dn \loop \advance \FT@i by 1\relax \advance\FT@sn by \csname FT@persian\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@persian\romannumeral\the\FT@i% \endcsname \ifnum\FT@i = 1 \FT@d = \FT@dn \advance \FT@d by 30 \advance\FT@d by -\FT@persiani \else \FT@d = \FT@dn \advance \FT@d by -\FT@sn \fi \beginL\number\FT@d\endL\space% %Changedc from here YJ \persianmonth{\FT@m}\space\beginL\number\FT@y\endL% } % added \persianmonth YJ \def\persianmonth#1{\ifcase#1\or فروردین\or اردیبهشت\or خرداد\or تیر\or مرداد\or شهریور\or مهر\or آبان\or آذر\or دی\or بهمن\or اسفند\fi} \let\originaltoday=\today \def\today{\lr{\originaltoday}} \let\romantoday\today \def\today{\rl{\ftoday}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
can you include this in MKIV? Is there copyright issues?
i have no problem with adding a conversion routine to mkiv, but not in this form; what is the official formula? the original so to say? maybe in pseudo c-code Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
participants (2)
-
Hans Hagen
-
Ilda Khaki