summaryrefslogtreecommitdiff
path: root/macros/plain
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-05-26 03:05:34 +0000
committerNorbert Preining <norbert@preining.info>2021-05-26 03:05:34 +0000
commit8982c52e00ffb3fb5a913fc60913ebd9070f091a (patch)
tree6a395986e3502fefcf42364f8dd87519b45a2441 /macros/plain
parent07dc96bc3bbd691fc52aca15a172eaf41a89d873 (diff)
CTAN sync 202105260305
Diffstat (limited to 'macros/plain')
-rw-r--r--macros/plain/contrib/xintsession/README.md22
-rw-r--r--macros/plain/contrib/xintsession/xintsession.tex138
2 files changed, 109 insertions, 51 deletions
diff --git a/macros/plain/contrib/xintsession/README.md b/macros/plain/contrib/xintsession/README.md
index 5df362a399..a53772f9d8 100644
--- a/macros/plain/contrib/xintsession/README.md
+++ b/macros/plain/contrib/xintsession/README.md
@@ -1,6 +1,6 @@
# xintsession README #
-Release: 0.2a (2021-05-06)
+Release: 0.2b (2021-05-23)
## Usage ##
@@ -59,6 +59,26 @@ hitting `S` it may work to bring you back to normal session.
For important explanations, enter `&help` at the prompt.
+## Change log ##
+
+- 0.2b (2021-05-23)
+ - use `\errorcontextlines=0` regime (if not paused)
+ - load `xintexpr` with `\newlinechar` set to `10` to track
+ nicer error messages coming with `xintexpr 1.4g`
+ - add help panel navigation via `n`, `p`, `q` and `1`, ..., `5`
+ - fix catcode of @ was set to letter
+ - fix version was not updated to `0.2a` in banner
+ - fix some spaces in help and welcome panels
+- 0.2a (2021-05-06)
+ - fix help panels mentioning topics obsoleted by `xintexpr 1.4f`
+- 0.2 (2021-05-05)
+ - fix typos in help panels, improve welcome panel
+ - fix "can't send `\par` to background typesetting"
+ - track `xintexpr 1.4f`
+ - add `&fp=N` parameterized floating point mode interface
+- 0.1 (2021-04-13)
+ Initial release
+
## License ##
Copyright (c) 2021 Jean-François Burnol
diff --git a/macros/plain/contrib/xintsession/xintsession.tex b/macros/plain/contrib/xintsession/xintsession.tex
index 4bc478e85c..b37d69dc26 100644
--- a/macros/plain/contrib/xintsession/xintsession.tex
+++ b/macros/plain/contrib/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%