OSDN Git Service

e002c70420fd23b8c32926c3a801f3ae9a5cd75d
[luatex-ja/luatexja.git] / test / test61-unhcopy.tex
1 \documentclass{minimal}
2 \usepackage{luatexja}
3
4 \begin{document}
5 \output={\setbox60000=\box255\deadcycles=0\relax}
6 \newcount\mycnt
7 \typeout{00> \the\ht\strutbox}
8
9 \everypar{\strut}
10
11 %%% \expandafter...\relax
12
13 \directlua{
14   socket=require'socket'
15   my_a=socket.gettime()
16 }
17
18 \mycnt=0
19 \loop\ifnum\mycnt<100000\relax
20   \leavevmode TEST\par
21   \advance\mycnt by1\relax
22 \repeat
23
24 \directlua{
25   my_b=socket.gettime()
26 }
27 \typeout{01> \the\ht\strutbox, \directlua{tex.sprint(my_b-my_a)}}
28
29 %%% \expandafter...(space)
30 \makeatletter
31 \protected\def\ltj@@unhbox{\ltj@reset@globaldefs\afterassignment\ltj@@unhbox@\ltj@tempcnta}
32 \protected\def\ltj@@unhcopy{\ltj@reset@globaldefs\afterassignment\ltj@@unhcopy@\ltj@tempcnta}
33 \def\ltj@@unhbox@#1{%
34   \protected\def\ltj@@unhbox@{\ltj@@lua@unboxcheckdir\expandafter\ltj@@orig@unhbox\the\ltj@tempcnta#1}%
35 }
36 \def\ltj@@unhcopy@#1{%
37   \protected\def\ltj@@unhcopy@{%
38     \ltj@@lua@uncopycheckdir\expandafter\ltj@@orig@unhcopy\the\ltj@tempcnta#1
39     \ltj@@lua@uncopy@restore@whatsit}%
40 }
41 \ltj@@unhbox@{ }\ltj@@unhcopy@{ }
42 \let\unhbox\ltj@@unhbox %% PRIMITIVE
43 \let\unhcopy\ltj@@unhcopy %% PRIMITIVE
44
45 \directlua{
46   my_a=socket.gettime()
47 }
48
49 \mycnt=0
50 \loop\ifnum\mycnt<100000\relax
51   \leavevmode TEST\par
52   \advance\mycnt by1\relax
53 \repeat
54
55 \directlua{
56   my_b=socket.gettime()
57 }
58 \typeout{02> \the\ht\strutbox, \directlua{tex.sprint(my_b-my_a)}}
59
60 %%% \begingroup...\endgroup
61 \makeatletter
62 \protected\def\ltj@@unhbox{\begingroup\ltj@reset@globaldefs\afterassignment\ltj@@unhbox@\ltj@tempcnta}
63 \protected\def\ltj@@unhbox@{\ltj@@lua@unboxcheckdir\ltj@@orig@unhbox\ltj@tempcnta\endgroup}
64 \protected\def\ltj@@unhcopy{\begingroup\ltj@reset@globaldefs\afterassignment\ltj@@unhcopy@\ltj@tempcnta}
65 \protected\def\ltj@@unhcopy@{%
66   \ltj@@lua@uncopycheckdir\ltj@@orig@unhcopy\ltj@tempcnta
67   \ltj@@lua@uncopy@restore@whatsit\endgroup}%
68 \let\unhbox\ltj@@unhbox %% PRIMITIVE
69 \let\unhcopy\ltj@@unhcopy %% PRIMITIVE
70
71 \directlua{
72   my_a=socket.gettime()
73 }
74
75 \mycnt=0
76 \loop\ifnum\mycnt<100000\relax
77   \leavevmode TEST\par
78   \advance\mycnt by1\relax
79 \repeat
80
81 \directlua{
82   my_b=socket.gettime()
83 }
84 \typeout{03> \the\ht\strutbox, \directlua{tex.sprint(my_b-my_a)}}
85
86
87 \end{document}
88