summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/ptexdir/tests/free_pena.tex
blob: 184720a80a269ef6f5eeaa282ec461dda6f6dad9 (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
%#!eptex -ini -etex
\let\dump\relax
\batchmode
\input plain

\errorstopmode
\catcode`@=11
\newcount\@tempcnta
\newcount\@tempcntb
\newcount\@tempcntc
\mathchardef\LIM=256

\def\MYCHAR#1{%
  \@tempcntc=\numexpr7*#1+"101\relax
  \@tempcnta=\@tempcntc\divide\@tempcnta 94
  \@tempcntb=\numexpr\@tempcntc-94*\@tempcnta+1\relax
  \ifnum\@tempcntb<0\advance\@tempcntb94 \advance\@tempcnta-1\fi
  \advance\@tempcnta18 % 18区以降
  \CNTA=\kuten\numexpr"100*\@tempcnta+\@tempcntb\relax
}

\newcount\CNT\newcount\CNTA
\CNT=0
\loop
  \MYCHAR\CNT
  \message{\the\CNT.}
  \prebreakpenalty\CNTA=\numexpr\CNT+1\relax
  \advance\CNT1\relax
  \ifnum\CNT<\LIM
\repeat

\newcount\CNTB

\loop
  \MYCHAR\CNTB
  \global\prebreakpenalty\CNTA=0
{%
\CNT=0
\loop
  \MYCHAR\CNT
  \count@=\numexpr -\CNT-1+\prebreakpenalty\CNTA\relax
  \ifnum\count@=0\else\ifnum\CNTB=\CNT\else\errmessage{<\the\CNTB, \the\CNT>}\fi\fi
  \advance\CNT1\relax
  \ifnum\CNT<\LIM
\repeat
}
  \MYCHAR\CNTB
  \global\prebreakpenalty\CNTA=\numexpr\CNTB+1\relax
  \advance\CNTB1\relax
  \ifnum\CNTB<\LIM
\repeat
\bye