OSDN Git Service

2023 -> 2024
[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   if not socket then
15     socket = socket or {}; socket.gettime = os.socketgettime
16   end
17   my_a=socket.gettime()
18 }
19
20 \mycnt=0
21 \loop\ifnum\mycnt<100000\relax
22   \leavevmode TEST\par
23   \advance\mycnt by1\relax
24 \repeat
25
26 \directlua{
27   my_b=socket.gettime()
28 }
29 \typeout{01> \the\ht\strutbox, \directlua{tex.sprint(my_b-my_a)}}
30
31 %%% \expandafter...(space)
32 \makeatletter
33 \protected\def\ltj@@unhbox{\ltj@reset@globaldefs\afterassignment\ltj@@unhbox@\ltj@tempcnta}
34 \protected\def\ltj@@unhcopy{\ltj@reset@globaldefs\afterassignment\ltj@@unhcopy@\ltj@tempcnta}
35 \def\ltj@@unhbox@#1{%
36   \protected\def\ltj@@unhbox@{\ltj@@lua@unboxcheckdir\expandafter\ltj@@orig@unhbox\the\ltj@tempcnta#1}%
37 }
38 \def\ltj@@unhcopy@#1{%
39   \protected\def\ltj@@unhcopy@{%
40     \ltj@@lua@uncopycheckdir\expandafter\ltj@@orig@unhcopy\the\ltj@tempcnta#1
41     \ltj@@lua@uncopy@restore@whatsit}%
42 }
43 \ltj@@unhbox@{ }\ltj@@unhcopy@{ }
44 \let\unhbox\ltj@@unhbox %% PRIMITIVE
45 \let\unhcopy\ltj@@unhcopy %% PRIMITIVE
46
47 \directlua{
48   my_a=socket.gettime()
49 }
50
51 \mycnt=0
52 \loop\ifnum\mycnt<100000\relax
53   \leavevmode TEST\par
54   \advance\mycnt by1\relax
55 \repeat
56
57 \directlua{
58   my_b=socket.gettime()
59 }
60 \typeout{02> \the\ht\strutbox, \directlua{tex.sprint(my_b-my_a)}}
61
62 %%% \begingroup...\endgroup
63 \makeatletter
64 \protected\def\ltj@@unhbox{\begingroup\ltj@reset@globaldefs\afterassignment\ltj@@unhbox@\ltj@tempcnta}
65 \protected\def\ltj@@unhbox@{\ltj@@lua@unboxcheckdir\ltj@@orig@unhbox\ltj@tempcnta\endgroup}
66 \protected\def\ltj@@unhcopy{\begingroup\ltj@reset@globaldefs\afterassignment\ltj@@unhcopy@\ltj@tempcnta}
67 \protected\def\ltj@@unhcopy@{%
68   \ltj@@lua@uncopycheckdir\ltj@@orig@unhcopy\ltj@tempcnta
69   \ltj@@lua@uncopy@restore@whatsit\endgroup}%
70 \let\unhbox\ltj@@unhbox %% PRIMITIVE
71 \let\unhcopy\ltj@@unhcopy %% PRIMITIVE
72
73 \directlua{
74   my_a=socket.gettime()
75 }
76
77 \mycnt=0
78 \loop\ifnum\mycnt<100000\relax
79   \leavevmode TEST\par
80   \advance\mycnt by1\relax
81 \repeat
82
83 \directlua{
84   my_b=socket.gettime()
85 }
86 \typeout{03> \the\ht\strutbox, \directlua{tex.sprint(my_b-my_a)}}
87
88
89 \end{document}
90