summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/dialogl/diatest.tex
blob: a6eb0c2801d93549087ac9a7f781c9be47952421 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
% Copyright 1994 Michael John Downes
% Copyright 2013 TeX Users Group
% This file is part of the dialogl package, released under the LPPL;
% see dialogl.ins for details.

%  Test of the `menus' package. You can run this file with (at least)
%  plain TeX, LaTeX (2e), and old LaTeX (2.09).
%
%  Some chicanery to make this file work in several different contexts.
\ifx\undefined\documentclass
  \def\NeedsTeXFormat#1{}\def\RequirePackage#1{\input #1.sty \relax}
  \def\ProvidesPackage#1[#2]{}
  \ifx\undefined\documentstyle
    \def\startup{\input menus.sty \relax}
  \else
    \def\startup{\documentstyle[menus]{article}}
  \fi
\else
  \def\startup{%
    \documentclass{article}%
    \usepackage{menus}%
  }
\fi

\startup

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\mesj{
The following series of tests is designed to cover most of the
features that are provided by dialog.sty. If you compare what you
see on screen with the contents of the file diatest.tex you will
see how they correspond.

Press the Return or Enter key to continue:}
\readline{}\xyz

\promptmesj{

Testing \mesj:
Press return to continue: }
\readline{}\xyz\mesj{}
\mesj{Give ~  me %^^L an &|
   \newif #}

\promptmesj{
Testing \xmesj:
Press return to continue: }
\readline{}\xyz\mesj{}
\xmesj{Do we have \{\}\\ characters?
And \iftrue\.true\else\.false\fi.
Not to mention ampersand \&,    since \string\iftrue.}

\promptmesj{
Testing \xmesj inside of a \def:
Press return to continue: }
\readline{}\xyz\mesj{}
\def\next{\xmesj{Abc space:\ , control-M: \^^M, and percent:\%\
and another line break.}}
\next

\promptmesj{
Testing \promptmesj:
Press return to continue: }
\readline{}\xyz\mesj{}
\promptmesj{Enter this or that: }
\readline{}\xyz

\promptmesj{
Testing \storemesj:
Press return to continue: }
\readline{}\xyz\mesj{}
\storemesj\foo{This is a fine old message, isn't it?:
\mesj{Give ~  me %^^L an &|
   \newif }}
\xmesj{\foo}

\promptmesj{
Testing \storexmesj now with an arg:
Press return to continue: }
\readline{}\xyz\mesj{}
\storexmesj\foo#1{This is a fine old message, isn't it?:
\\mesj{Give ~  me \%^^L an \&|#1
   \\newif \#}}
\xmesj{\foo{KABLOO}}

\promptmesj{
Testing \fmesj:
Press return to continue: }
\readline{}\xyz\mesj{}
\fmesj\foo{This is a fine old message, isn't it?:
\mesj{Give ~  me %^^L an &|
   \newif}}
\foo

\promptmesj{
Testing \fxmesj now with an arg:
Press return to continue: }
\readline{}\xyz\mesj{}
\fxmesj\foo#1{This is a fine old message, isn't it?:
\\mesj{Give ~  me \%^^L an \&|#1
   \\newif \#}}
\foo{KABLOO}

\promptmesj{
Would you like to try out \readline? [yes or no]: }
\readline{}\answer
\xmesj{Well, if I understood you correctly, you answered `\answer'}

\promptmesj{
OK, now try give me an executable answer, such as
"\iftrue yes\else no\fi": }
\xreadline{}\answer
\xmesj{Well, and now if I try to execute that: "\answer"}

\promptmesj{
OK, now let's try \readchar. Give me an arbitrary answer of
one or more characters: }
\readchar{}\answer
\xmesj{Taking the first character from your answer, I get: "\answer"}

\promptmesj{
OK, now let's try \readChar. Give me an arbitrary answer of
one or more letters: }
\readChar{}\answer
\xmesj{Taking the first character from your answer, and
uppercasing it, I get: "\answer"}

\promptmesj{
OK, give me a number then, so that I can
check it with \checkinteger: }
\readline{}\answer
\checkinteger\answer\fam
\xmesj{\ifnum\fam=-\maxdimen%
Gee, I don't think that was\else\.Got\fi%
 a valid number: "\answer"}

\def\dimtest#1{\promptxmesj{#1}%
  \readline{}\answer
  \ifx\empty\answer
  \else
    \checkdimen\answer\vfuzz
    \ifdim\vfuzz=-\maxdimen%
      \xmesj{Sorry, that doesn't look like a TeX dimen to me: "\answer"}%
    \else
      \xmesj{Looks like a valid TeX dimen: "\answer" = \the\vfuzz}%
    \fi
    \expandafter\dimtestb
  \fi
}

\def\dimtesta{\dimtest{\
OK, give me a dimen then, so that I can\
check it with \\checkdimen:\
}}

\def\dimtestb{\dimtest{\
How about another dimen: }}

\def\empty{}

%    Iterate once with one prompt, then several times with a shorter
%    prompt.
\dimtesta

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\csname stop\endcsname
\end