summaryrefslogtreecommitdiff
path: root/macros/plain/contrib/misc/thirteen.tex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/plain/contrib/misc/thirteen.tex')
-rw-r--r--macros/plain/contrib/misc/thirteen.tex202
1 files changed, 202 insertions, 0 deletions
diff --git a/macros/plain/contrib/misc/thirteen.tex b/macros/plain/contrib/misc/thirteen.tex
new file mode 100644
index 0000000000..034723dc4d
--- /dev/null
+++ b/macros/plain/contrib/misc/thirteen.tex
@@ -0,0 +1,202 @@
+ \parindent=0pt
+ \font\big=cmb10 scaled\magstep3
+ \centerline{\big FRIDAY THE THIRTEEN}
+ \normalbaselineskip=12pt
+ \noindent
+ \newcount\dw % Gets day of the week
+ \newcount\leap % Leap year fingaler
+ \newcount\m % Temp register
+ \newcount\y % Another temp register
+ \newcount\a
+ \newcount\b
+ \newcount\x
+ \newcount\jd
+ \newcount\aantal
+ \newcount\kalmaand
+ \newcount\alfa
+ \newcount\eindjaar
+ \newcount\tempjaar
+ \newcount\firstyear
+ \newcount\lastyear
+ \newcount\c
+ \newcount\d
+ \newcount\e
+ \newcount\f
+ \newcount\z
+ \newcount\jda
+ \newcount\jdb
+ \newcount\difference
+ \newcount\jaar
+ \newcount\maand
+ \newcount\dag
+ \newcount\jr
+ \newcount\mnd
+ \newcount\dg
+%
+\parskip=1.5cm
+%
+\def\daydifference
+{
+\message{date 1: }
+\datjul
+\jda=\jd
+\message{date 2: }
+\datjul
+\jdb=\jd
+\advance\jdb by-\jda
+\difference=\jdb
+\ifnum\difference<0
+\multiply\difference by -1
+\fi
+\hbox{\number\difference}\hfill\break
+}
+\def\dayafter
+{
+\message{date 1: }
+\datjul
+\message{day difference :}
+\read16 to\difference
+\advance\jd by\difference
+\number\difference\hfill\break
+\z=\jd
+\juldat
+\hbox{\number\jr\ \number\mnd\ \number\dg}\hfill\break
+}
+
+\def\datjul{
+%
+%
+%
+%
+\jaar=1991
+%\read16 to\maand
+%\read16 to\dag
+%\hbox{\number\jaar\ \number\maand\ \number\dag}\hfill\break
+\global\eindjaar=\jaar
+\global\advance\eindjaar by15
+\maand=1
+\dag=1
+\ifnum\maand>2
+ \y=\jaar
+ \m=\maand
+\else
+ \y=\jaar \advance\y by-1
+ \m=\maand \advance\m by12
+\fi
+\a=\y
+\divide\a by100
+\b=2
+\advance\b by-\a
+\x=\a
+\divide\x by4
+\advance\b by\x
+%
+\jd=\y
+\multiply\jd by36525
+\divide\jd by100
+%
+\x=\m
+\advance\x by1
+\multiply\x by306001
+\divide\x by10000
+\advance\jd by\x
+\advance\jd by\dag
+\advance\jd by1720995
+\advance\jd by\b
+}
+%
+\def\dayofweek{
+\x=\jd
+\advance\x by 1
+\dw=\x \divide\x by 7 \multiply\x by 7 \advance\dw by -\x
+}
+
+%
+%
+\def\juldat{
+\ifnum\z<2299161
+ \a=\z
+\else
+ \alfa=\z
+ \multiply\alfa by100
+ \advance\alfa by-186721625
+ \divide\alfa by3652425
+ \a=\z
+ \advance\a by1
+ \advance\a by\alfa
+ \divide\alfa by4
+ \advance\a by-\alfa
+\fi
+%
+\b=\a
+\advance\b by1524
+%
+\c=\b
+\multiply\c by100
+\advance\c by-12210
+\divide\c by36525
+%
+\d=\c
+\multiply\d by36525
+\divide\d by100
+%
+\e=\b
+\advance\e by-\d
+\multiply\e by10000
+\divide\e by306001
+%
+%
+\x=\b
+\advance\x by-\d
+\dg=\x
+\x=\e
+\multiply\x by306001
+\divide\x by10000
+\advance\dg by-\x
+%
+\mnd=\e
+\advance\mnd by-1
+\ifnum\e>13
+ \advance\mnd by-12
+\fi
+%
+\jr=\c
+\advance\jr by-4715
+\ifnum\mnd>2
+ \advance\jr by-1
+\fi
+}
+%
+\def\leesjul{
+\relax
+\read16 to \z
+}
+\newdimen\cf
+\setbox0=\hbox{\rm0}
+\cf=\wd0
+\def\breedte{\kern\cf}
+\def\dertien{
+\datjul
+\kalmaand=\maand
+\dayofweek
+\z=\jd
+\juldat
+\loop\ifnum\jr<\eindjaar
+ \dayofweek
+ \ifnum\dg=13
+ \ifnum\dw=5
+ \hbox{\number\jr\ \number\dg\ \number\mnd}
+ \fi
+ \fi
+ \advance\z by1
+ \jd=\z
+ \juldat
+\repeat
+}
+%
+\dertien
+\bye
+
+
+
+