summaryrefslogtreecommitdiff
path: root/macros/plain/contrib/crw/crw.tex
blob: 44e80f910272f59508cdef4fceb651c9d7e97e2c (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
%C.G. van der Laan, Hunzeweg 57, 9893PB, Garnwerd. Holland. 05941-1525.
%                                                           cgl@risc1.rug.nl
\let\ea=\expandafter \newif\ifpuzzle
\newcount\cnt \puzzletrue \cnt=0
\newdimen\csize\csize=3ex
%
\def\bdata{\bgroup\obeylines\obeyspaces%
\store}
\def\store#1\edata{\egroup\def\data{#1}}
{\obeyspaces\global\let =\relax}
\def\usersize{}
%
{\catcode`\^^M=13 %local scope
\gdef\crw{\boxit{\usersize\setbox0=%
  \hbox to\csize{\vrule\hss\vrule%
  height.8\csize depth.2\csize width%
  \csize\hss\vrule}%
\hrule\ea\fifol\data\lofif^^M}}
\gdef\sol{\boxit{\def\num{}\puzzlefalse%
\usersize\setbox0=\hbox to\csize{\vrule%
  \hss\vrule height.8\csize depth%
  .2\csize width\csize\hss\vrule}%
\hrule\ea\fifol\data\lofif^^M}}
\gdef\fifol#1^^M{\ifx\lofif#1\lofif\fi%
\processl{#1}\fifol}}%end local scope
%
\def\lofif#1\fifol{\fi}
\def\processl#1{\hbox{\fifo#1\ofif}\hrule}
\def\fifo#1{\ifx\ofif#1\ofif\fi%
\process#1\fifo}    \def\ofif#1\fifo{\fi}
%
\def\process#1{\if*#1\copy0\relax\else%
\ifx\relax#1\copy0\relax\else\ifnum`#1=
        \uccode`#1\cap#1\else\low#1\fi%
\fi\fi}
\def\low#1{\hbox to\csize{\vrule
height.8\csize depth.2\csize\relax%
\ifpuzzle\null\else\hss\uppercase{#1}\fi%
\hss\vrule}}
\def\cap#1{\hbox to\csize{\vrule
height.8\csize depth.2\csize\relax%
\num\ifpuzzle\null\else\hss#1\fi%
\hss\vrule}}
%
\def\num{\global\advance\cnt1\relax%
\vbox to.8\csize{\rlap{\kern1pt%
\fiverm\the\cnt\hss}\vfil}}
%
\def\boxit#1{\vbox{\hrule\hbox{\vrule%
\vbox{#1}\vrule}\hrule}}%
%\endinput %end macros %cgl@risc1.rug.nl