diff options
author | Karl Berry <karl@freefriends.org> | 2021-05-25 20:50:28 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-05-25 20:50:28 +0000 |
commit | cad3f28be3ebb49d163eed80ddf78ae6b17e48a8 (patch) | |
tree | db67b1b582fd0e8306a2be78eef4be8279f866d7 /Master/texmf-dist/tex/plain/xintsession | |
parent | 03a92032945834131e8e52057361813f373a3f8c (diff) |
xintsession (25may21)
git-svn-id: svn://tug.org/texlive/trunk@59350 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/plain/xintsession')
-rw-r--r-- | Master/texmf-dist/tex/plain/xintsession/xintsession.tex | 138 |
1 files changed, 88 insertions, 50 deletions
diff --git a/Master/texmf-dist/tex/plain/xintsession/xintsession.tex b/Master/texmf-dist/tex/plain/xintsession/xintsession.tex index 4bc478e85cb..b37d69dc262 100644 --- a/Master/texmf-dist/tex/plain/xintsession/xintsession.tex +++ b/Master/texmf-dist/tex/plain/xintsession/xintsession.tex @@ -1,20 +1,25 @@ -% Release 0.2a (2021-05-06) of xintsession.tex +% Release 0.2b (2021-05-23) of xintsession.tex % author: Jean-Francois Burnol % License: LPPL 1.3c (author-maintained) -% Usage: execute etex or pdftex -% then enter "xintsession" at the ** prompt +% Usage: execute "etex (or pdftex) xintsession" +% If available use "rlwrap etex xintsession" for a better experience +\edef\xsrestorenewlinechar{\newlinechar\the\newlinechar\relax}\newlinechar10\relax% +% we load it with \newlinechar set in order for its error messages +% to be nicer (since xintexpr 1.4g) \input xintexpr.sty\relax% -% AJOUTER CHECK DE VERSION ICI +\unless\ifdefined\xintreloadxintlog% defined at 1.4e +{\catcode32=11% +\errhelp{Please update xintexpr to at least 1.4e. Aborting input.^^JSay `x' to exit.}% +\errmessage{xintexpr is too old. Say `x' to exit, `h' for help}}\endinput\fi% \input xintbinhex.sty\relax% -\input polexpr.sty\relax% attention will crash if < 0.8 +\input polexpr.sty\relax% this will crash with polexpr versions < 0.8 \let\PolToExprOneTerm\PolToExprOneTermStyleB% -%\let\PolToExprTimes\empty% -% we do assume standard catcodes on loading and use -% \XINTrestorecatcodes as a convenience facility. -% It stores \endlinechar but not \newlinechar -% and was renamed at 1.4e -\edef\xsrestorecatcodes{\XINTrestorecatcodes% - \newlinechar\the\newlinechar\relax}% +% \XINTrestorecatcodes. Although we morally assume normal catcodes +% we use it as a convenience: strangely named, it is to be used in +% an \edef to store there catcodes and \endlinechar (but not +% \newlinechar). It was renamed at 1.4e and this is one reason +% why we aborted input with earlier xintexpr... +\edef\xsrestorecatcodes{\XINTrestorecatcodes\xsrestorenewlinechar}% \endlinechar 13 % \newlinechar 10 \catcode`_ 11 @@ -51,7 +56,7 @@ }% ?immediate?write128{% - xintsession 0.2 + xintsession 0.2b Copyright (c) Jean-Francois Burnol, 2021. \jobname is ?jobname @@ -228,15 +233,15 @@ \def\xs_magic@&mod{\xs_message{current mode: \xs_mode}}% \def\xs_setcats {% - \newlinechar10\endlinechar13% - \catcode13\active\catcode`@ 11\relax + \newlinechar10\endlinechar13\errorcontextlines0\relax + \catcode13\active }% \def\xs_storecats{\edef\xs_resetcats {% \newlinechar\the\newlinechar \endlinechar\the\endlinechar - \catcode13=\the\catcode13 - \catcode`@\the\catcode`@\relax + \errorcontextlines\the\errorcontextlines + \catcode13=\the\catcode13\relax }}% \begingroup \catcode13\active\catcode32\active% @@ -251,12 +256,17 @@ Magic words: `&pause' (or `;'), `&help', `&bye', `&exact', `&fp', `&int', `&pol'. - Say e.g. `&fp=24' to activate floating point mode with Digits=24. + Say e.g. `&fp=24' to activate floating point mode with Digits=24. Starting in}\xs_magic@&exa\let -=\xs_fetch}\gdef\xintresume{\edef {\string }\xs_storecats\xs_setcats% -\message{Welcome back to xintexpr interactive mode!}\let -=\xs_fetch}\catcode`?0\catcode`\\12?gdef?xs_help?xs_fetch_a{?def -{""J}?edef {?string }?message{% +=\xs_fetch}% +\gdef\xintresume{\edef {\string }\xs_storecats\xs_setcats% +\message{Welcome back to xintexpr interactive mode!}% +\let +=\xs_fetch}% +\catcode`?0\catcode`\\12\relax% +?gdef?xs_help?xs_fetch_a{?begingroup?def +{""J}?edef {?string }?xs_help_i}% +?gdef?xs_help_i{?message{% - Terminate inputs using the `;' character. Input can extend over multiple lines (<RET> terminated). @@ -274,16 +284,20 @@ - Issue `&mode' if you forgot in what mode you are currently in. +(1/5) say `n' (or directly <return>) for next, `q' to quit, or one of + `2', `3', `4', or `5' to jump directly to corresponding panel.% +}?def?xs_help_next##1 +{?if?xintFirstItem{##1n}n?xint_dothis?xs_help_ii?fi% +?ifnum10<1?expandafter?string?romannumeral0?xintfirstitem{##1}?relax% +?xint_dothis{?csname?xint_gobble_i xs_help_?romannumeral?xintFirstItem{##1}?endcsname}?fi% +?xint_orthat?xs_help_quit}?xs_help_next}% +?gdef?xs_help_ii{?message{% - Say `&exact' resp. `&fp' to go back and forth between exact and floating point mode -(1/5) HIT <RET> KEY% -}?let -=?xs_help_b}?gdef?xs_help_b{?def -{""J}?message{% - Say `&fp=<number>' for example `&fp=32' at the prompt to activate fp mode at a given Digits setting. This can be done in the midst - of the input of a multi-line computation! + of the input of a multi-line computation! - Math functions are supported up to Digits=62 (since xint 1.4e); sqrt() and powers with integer exponents work in fp mode with Digits @@ -295,18 +309,21 @@ definition, else a variable definition is done. * IMPORTANT: using a `=' by oversight will cause breakage as - xintsession thinks it is then handling a numerical evaluation, - not a definition, but there is no `=' operator in xintexpr syntax. + xintsession thinks it is handling an evaluation, not a definition. % Perhaps in future it will be allowed to make definitions using `=' % and xintsession will check if it is not misinterpreting a `=' from % `<=', `>=', `!=', `==' or `seq()' syntax but this currently was % considered to add too much overhead for the benefit. % -(2/5) HIT <RET> KEY% -}?let -=?xs_help_c}?gdef?xs_help_c{?def -{""J}?message{% +(2/5) say `n' (next), `p' (previous), `q' (quit), or one of `1' to `5'.% +}?def?xs_help_next##1 +{?if?xintFirstItem{##1n}n?xint_dothis?xs_help_iii?fi% +?if?xintFirstItem{##1}p?xint_dothis?xs_help_i?fi% +?ifnum10<1?expandafter?string?romannumeral0?xintfirstitem{##1}?relax% +?xint_dothis{?csname?xint_gobble_i xs_help_?romannumeral?xintFirstItem{##1}?endcsname}?fi% +?xint_orthat?xs_help_quit}?xs_help_next}% +?gdef?xs_help_iii{?message{% - Functions defined in one mode are not available for usage in other modes without further steps; check xintexpr doc. @@ -326,10 +343,14 @@ the automatic variable @_<integer> holds the whole thing, which may be a nutple or an ople, in addition to individual variables. -(3/5) HIT <RET> KEY% -}?let -=?xs_help_d}?gdef?xs_help_d{?def -{""J}?message{% +(3/5) say `n' (next), `p' (previous), `q' (quit), or one of `1' to `5'.% +}?def?xs_help_next##1 +{?if?xintFirstItem{##1n}n?xint_dothis?xs_help_iv?fi% +?if?xintFirstItem{##1}p?xint_dothis?xs_help_ii?fi% +?ifnum10<1?expandafter?string?romannumeral0?xintfirstitem{##1}?relax% +?xint_dothis{?csname?xint_gobble_i xs_help_?romannumeral?xintFirstItem{##1}?endcsname}?fi% +?xint_orthat?xs_help_quit}?xs_help_next}% +?gdef?xs_help_iv{?message{% - Variables defined in any mode can be used in any mode except: * polynomials can be used as variables only in the pol and the exact modes, @@ -348,10 +369,14 @@ - Exact mode does not reduce to lowest terms, use reduce(). -(4/5) HIT <RET> KEY% -}?let -=?xs_help_e}?gdef?xs_help_e{?def -{""J}?message{% +(4/5) say `n' (next), `p' (previous), `q' (quit), or one of `1' to `5'.% +}?def?xs_help_next##1 +{?if?xintFirstItem{##1n}n?xint_dothis?xs_help_v?fi% +?if?xintFirstItem{##1}p?xint_dothis?xs_help_iii?fi% +?ifnum10<1?expandafter?string?romannumeral0?xintfirstitem{##1}?relax% +?xint_dothis{?csname?xint_gobble_i xs_help_?romannumeral?xintFirstItem{##1}?endcsname}?fi% +?xint_orthat?xs_help_quit}?xs_help_next}% +?gdef?xs_help_v{?message{% (cont.) - A session transcript file is created which can be executed by eTeX to redo all calculations; however @_, @__, and @___ will @@ -367,16 +392,29 @@ Miscellany: - Misformed xintexpr input can drop you into TeX error mode. In that - case, try escaping using `S'. It does work sometimes. + Some exceptions are caught by xintexpr itself: enter <return> at + the prompt and a recovery will be attempted. If deep in core + TeX errors, try escaping using `S'. It does work sometimes. -(5/5) You are back to the xintexpr interactive session! (mode: ?xs_mode) - Use `&bye' to terminate the session and the TeX run.% -}?let -=?xs_fetch?xs_fetch_a}?endgroup -\let\xs_magic@&hel\xs_help -\xsrestorecatcodes -\csname xs_storecats\endcsname +(5/5) say `p' (previous), `q' (quit), or one of `1' to `5'.% +}?def?xs_help_next##1 +{?if?xintFirstItem{##1n}p?xint_dothis?xs_help_iv?fi% +?ifnum10<1?expandafter?string?romannumeral0?xintfirstitem{##1}?relax% +?xint_dothis{?csname?xint_gobble_i xs_help_?romannumeral?xintFirstItem{##1}?endcsname}?fi% +?xint_orthat?xs_help_quit}?xs_help_next}% +?gdef?xs_help_quit{?message{% + You are back to the xintexpr interactive session! + (current mode: ?xs_mode) + + Waiting for input... + +(say `&bye' at any time to terminate the session and the TeX run.)% +}?endgroup?xs_fetch}% +?endgroup +\let\xs_magic@&hel\xs_help\let\xs_help_vi\xs_help_quit\let\xs_help_vii\xs_help_quit +\let\xs_help_viii\xs_help_quit\let\xs_help_ix\xs_help_quit +\xsrestorecatcodes% +\csname xs\string _storecats\endcsname\endlinechar13\relax% \catcode13\active\def {\xintstart }\endinput% |