% 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