% eclcalen.sty 
% (C) Hideki ISOZAKI 1990
% 1993.1.7

% ���s���󔒂ɂ��Ȃ��D
\endlinechar=-1

% �㉺���E�̃}�[�W���̒���
\topmargin-1cm
\headsep\z@
\headheight\z@
\textheight 60pc \textwidth 40pc 
\oddsidemargin -1cm

% �y�[�W�ԍ������Ȃ��D
\pagestyle{empty}

% �ʖ�
%
\let\��=\multiply
\let\�a=\advance
\let\��=\divide
%
% ���̃R�}���h�Q�́C�v���O������ǂ݈Ղ�������C
% �����g�[�N���̏I���𖾎������肷��̂Ɏg����D
% 
\let\�G=\relax
\let\then=\relax
\let\nop=\relax
\let\ficase=\fi
\let\finum=\fi

%
% �G���[�\������Ƃ��ɁC�ǂ��ŃG���[�����������\������D
%
\def\���t�\��{\typeout{}\message{\the\�� ��:}}	
\def\errorstop{\typeout{�ُ�I��}\batchmode\stop}

%  Integers
\newcount\�l�T������] 
%
%  �j����\���� \�j���ԍ� �� \�l�T������] ���狁�߂���D
%
% \�j���ԍ� 0:���j 1:���j ... 6:�y�j
%
\newcount\�j���ԍ� 

%
% �[�N�̉e�����v�Z���邽�߁C2��������N�x�̋�؂�Ƃ���
% �v�Z���Ղ�����D
%
% \�v�Z��   3: 3��, 4: 4��,  ... 12: 12��, 13: 1��, 14: 2��
% \�v�Z�N   3�� ... 12�� = \�N,	 1�� ... 2�� : \�N - 1 
%
\newcount\�v�Z�N
\newcount\�v�Z��
%
% �N�ɂ�邸��̏C��
%
\newcount\�C������
%
% ��] #1 mod #2 -> #1 �̌v�Z
%
\newcount\@��
%
\def\��]#1#2{\@��=#1\�G\��\@�� #2\�G\��\@�� #2\�G\�a #1 -\@��\�G}

%
% �����͉��N��������?
%
\newcount\�N
\newcount\��
\newcount\��  % [0]

\newif\if�j��	      % [2] �j��(5��4���܂�)�ƐU�֋x���� True
\newif\if�U�֋x��     % [2] �U�֋x���̌����ƂȂ������j���ƌ��j���� True
\newif\if�N���N�n�x   % �N���N�n�x
\newif\if�v����       % ���̑�

\newcount\����	      % �����̎�� 0:���� 1:�x�� 2:���̑�

\def\������{3cm}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%		  �u�x���v�Ɨj��
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\def\�j�����v�Z{
%
% \�v�Z��   if 1�� or 2�� then \�� + 12 else \�� fi
% \�v�Z�N   if 1�� or 2�� then \�N -  1 else \�N fi
%
\�v�Z��=\��\�G\�v�Z�N=\�N\�G
\ifnum\��<3\then\�a\�v�Z�� 12\�G\�a\�v�Z�N -1\�G\finum
%
% \�l�T������] = 
% (\�� + 30*\�v�Z�� + 3���ȍ~�̑�̌��̐� + �N�ɂ��C�� - 16) mod 28
%
% 3���ȍ~�̑�̌��̐� = floor((�v�Z�� - (�v�Z��<9) - (�v�Z��<14)) / 2)
%
\�l�T������]=\�v�Z��\�G
\ifnum\�v�Z��<9\then\�a\�l�T������] -1\�G\finum
\ifnum\�v�Z��<14\then\�a\�l�T������] -1\�G\finum
\��\�l�T������] 2\�G
%
% (30*\�v�Z�� + 3���ȍ~�̑�̌��̐�) mod 28 
%     = (3���ȍ~�̑�̌��̐� + \�v�Z�� + \�v�Z��) mod 28
%
\�a\�l�T������]\�v�Z��\�G\�a\�l�T������]\�v�Z��\�G
%
% �N�ɂ��C�� = \�v�Z�N + �[�N�̉e��
%    (365 mod 28 = 1 �Ȃ̂ŁC�[�N�ȊO�ł�1���������D)
%
% �[�N�̉e�� = floor(\�v�Z�N/4) - floor(\�v�Z�N/100) + floor(\�v�Z�N/400)
%   (�[�N�� 4 �Ŋ���؂��N�ɂ���C100 �Ŋ���؂��N�ɂȂ��C
%    400 �Ŋ���؂��N�ɂ���D)
%
\�C������=\�v�Z�N\�G\�a\�l�T������]\�C������\�G
\��\�C������ 4\�G\�a\�l�T������]\�C������\�G
\��\�C������ 25\�G\�a\�l�T������] -\�C������\�G
\��\�C������ 4\�G\�a\�l�T������]\�C������\�G
%
%  7�������� \�j���ԍ�	   �͓��j�� 0
% �ɂȂ�悤�ɃV�t�g����D
%
\�a\�l�T������]\��\�G
% 
%    \�j���ԍ� �����߂� 
%
\�j���ԍ�=\�l�T������]\�G
\�a\�j���ԍ� 3\�G
\��]\�j���ԍ�{7}\�G
%
%    \�l�T������] �����߂� 
%
\�a\�l�T������] -16\�G
\��]\�l�T������]{28}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                            �t���H��
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ���̌v�Z���� fj.sci.misc �̑O�c  �����C����� 1990�N12��4���̋L��
% �ɂ��B
% �t��	1980-2099	[20.8431 + 0.242194*(�N-1980)-[(�N-1980)/4]]
% �H��	1980-2099	[23.2488 + 0.242194*(�N-1980)-[(�N-1980)/4]]
\newdimen\�t�Hdim
% ���̌v�Z���� fj.questions.misc �̗�؁@�r�F�����1992�N1��30���̋L���ɂ��
%�@(8(y-1980)+687)/33-(y-1980)/4    (1900-2099)(�t)�@�E�E�E(28)
%�@(8(y-1980)+766)/33-(y-1980)/4    (1980-2099)(�H)�@�E�E�E(29)

\newcount\�t�Hcnt
\def\�t���H���v�Z{
	\�t�Hcnt=\�N \advance\�t�Hcnt by -1980 
	{\divide\�t�Hcnt by 4 \xdef\�t�H����{\the\�t�Hcnt}}
	\multiply\�t�Hcnt by 8 \edef\�t�H���{{\the\�t�Hcnt}
	\advance\�t�Hcnt by 687 
	\divide\�t�Hcnt by 33 \advance\�t�Hcnt by -\�t�H����
	\edef\�t��{\the\�t�Hcnt}%
	\�t�Hcnt=\�t�H���{
	\advance\�t�Hcnt by 766 
	\divide\�t�Hcnt by 33 \advance\�t�Hcnt by -\�t�H����
	\edef\�H��{\the\�t�Hcnt}}		

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%			       �j��
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%   �j����\������ 
%
\def\�j��{\ifcase\�j���ԍ� ��\or ��\or ��\or ��\or ��\or ��\or �y\ficase}%[1]

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%			     �x���Ȃ�
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% 
%		�j���̌v�Z 
%
\def\�j�����v�Z{\�j��false\�N���N�n�xfalse\�v����false
\ifcase\��\or\�ꌎ�̗\��\or\�񌎂̗\��\or\�O���̗\��\or
\�l���̗\��\or\�܌��̗\��\or\�Z���̗\��\or
\�����̗\��\or\�����̗\��\or\�㌎�̗\��\or
\�\���̗\��\or\�\�ꌎ�̗\��\or\�\�񌎂̗\��\ficase}

\def\�ꌎ�̗\��{
\ifnum\��=1\then\�j��true\def\�x�ޗ��R{����}\finum
%%%%%\ifnum\��=2\then\�N���N�n�xtrue\def\�x�ޗ��R{�N�n}\finum
%%%%%\ifnum\��=3\then\�N���N�n�xtrue\def\�x�ޗ��R{�N�n}\finum
\ifnum\��=9\then\�j��true\def\�x�ޗ��R{���l�̓�}\finum
\�ꌎ�̃R�����g}

\def\�񌎂̗\��{
\ifnum\��=11\then\�j��true\def\�x�ޗ��R{�����L�O��}\finum
\�񌎂̃R�����g}

\def\�O���̗\��{
\ifnum\��=\�t��\then\�j��true\def\�x�ޗ��R{�t���̓�}\finum
\�O���̃R�����g}

\def\�l���̗\��{
\then\ifnum\��=29\then\�j��true\def\�x�ޗ��R{�݂ǂ�̓�}\finum
\�l���̃R�����g}

\def\�܌��̗\��{
\ifnum\��=3\then\�j��true\def\�x�ޗ��R{���@�L�O��}\finum
\ifnum\��=4\then\�j��true\def\�x�ޗ��R{(�����̋x��)}\finum 
\ifnum\��=5\then\�j��true\def\�x�ޗ��R{���ǂ��̓�}\finum
\�܌��̃R�����g}


\def\�Z���̗\��{
\�Z���̃R�����g}

\def\�����̗\��{
\�����̃R�����g}

\def\�����̗\��{
\�����̃R�����g}


\def\�㌎�̗\��{
%\ifnum\��=15\then\�j��true\def\�x�ޗ��R{�h�V�̓�}\finum
%\ifnum\��=\�H��\then\�j��true\def\�x�ޗ��R{�H���̓�}\finum
\�㌎�̃R�����g}


\def\�\���̗\��{
\ifnum\��=10\then\�j��true\def\�x�ޗ��R{�̈�̓�}\finum
\�\���̃R�����g}


\def\�\�ꌎ�̗\��{
\ifnum\��=3\then\�j��true\def\�x�ޗ��R{�����̓�}\finum
\ifnum\��=23\then\�j��true\def\�x�ޗ��R{�ΘJ���ӂ̓�}\finum
\�\�ꌎ�̃R�����g}


\def\�\�񌎂̗\��{
\ifnum\��=23\then\�j��true\def\�x�ޗ��R{�V�c�a����}\finum
\ifnum\��>29\then
	\�N���N�n�xtrue\def\�x�ޗ��R{�N��}\finum
\�\�񌎂̃R�����g}

\let\�ꌎ�̃R�����g=\relax
\let\�񌎂̃R�����g=\relax
\let\�O���̃R�����g=\relax
\let\�l���̃R�����g=\relax
\let\�܌��̃R�����g=\relax
\let\�Z���̃R�����g=\relax
\let\�����̃R�����g=\relax
\let\�����̃R�����g=\relax
\let\�㌎�̃R�����g=\relax
\let\�\���̃R�����g=\relax
\let\�\�ꌎ�̃R�����g=\relax
\let\�\�񌎂̃R�����g=\relax

\def\�v����#1����#2�̓�{\ifnum\��=#1\then\�v����true\def\���ӎ���{#2}\finum}

\newcount\�[�N

\def\�[�N�v�Z{\�[�N=\�N \��]\�[�N{400}
	\ifnum\�[�N=0\then\def\�񌎖���{29}
	\else\�[�N=\�N \��]\�[�N{100}
		\ifnum\�[�N=0\then\def\�񌎖���{28}
		\else
			\�[�N=\�N \��]\�[�N{4}
			\ifnum\�[�N=0\then\def\�񌎖���{29}
				\else\def\�񌎖���{28}
			\finum
		\finum
	\finum}

\newcount\�T�ԍ�	

\def\�J�����_�[#1�N#2��{
	\begin{minipage}{12cm}\centering\fbox{
	\unitlength=1.5cm\begin{picture}(7,7.3)(-0.5,-6.9)
	\�N=#1\relax\��=#2\relax\��=1\relax
	\�t���H���v�Z
	\�U�֋x��false % �����܂�����U�֋x���͂��܂��ܑ��݂��Ȃ��D
	\normalsize
	\put(0,-0.3){\makebox(0,0){��}}
	\put(1,-0.3){\makebox(0,0){��}}
	\put(2,-0.3){\makebox(0,0){��}}
	\put(3,-0.3){\makebox(0,0){��}}
	\put(4,-0.3){\makebox(0,0){��}}
	\put(5,-0.3){\makebox(0,0){��}}
	\put(6,-0.3){\makebox(0,0){�y}}
	\large
	\put(-0.5,0.1){\hbox to 7\unitlength{
		\leaders\hrule\@height2ex\hfill
		{ \bf\the\�N �N\the\�� �� }
		\leaders\hrule\@height2ex\hfill}}
	\ifnum\��=2\�[�N�v�Z\finum
	\edef\����{\ifcase\��\or31\or\�񌎖���\or31\or30\or31\or30
		\or31\or31\or30\or31\or30\or31\ficase}
	\��=0\relax\�T�ԍ�=1\relax
	\@whilenum\��<\����\do{
		\def\�x�ޗ��R{}\def\���ӎ���{}
		\�a\�� 1\relax
		\�j�����v�Z    \�j�����v�Z   \�������f
		\put(\the\�j���ԍ�,-\the\�T�ԍ�){\makebox(0,0){\�}�[�N}}
		\ifnum\�j���ԍ�=6\then\�a\�T�ԍ� 1\finum}
	\end{picture}}\hss\end{minipage}}

\def\�������f{\����=0\relax
	\if�v����\����=2\relax\fi
	\ifnum\�j���ԍ�=0\then\����=1\relax
		\if�j��\then\�U�֋x��true\fi
	\finum
	\if�N���N�n�x\����=1\relax\fi
	\if�j��\����=1\relax\fi
	\ifnum\�j���ԍ�=1\then\if�U�֋x��\then\����=1\relax
		\def\�x�ޗ��R{�U��}\�U�֋x��false\fi\finum
	\ifnum\�j���ԍ�=6\then\����=1\relax\finum
	\def\�}�[�N{\hbox{\footnotesize
		\vtop to 0pt{\offinterlineskip
		\hbox to \unitlength{\large\strut
			\hss\ifcase\����{\rm\the\��}\or
			\framebox[1cm]{\bf\the\��}\or{\it\the\��}\ficase\hss}
		\hbox to \unitlength{\hss\�x�ޗ��R\hss}
		\hbox to \unitlength{\hss\���ӎ���\hss}\vss}}}}

\endlinechar=13
\endinput

