| 1 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 2 |
% |
| 3 |
% Module: ZzTeX Error Handling |
| 4 |
% |
| 5 |
% Synopsis: |
| 6 |
% |
| 7 |
% Author: Paul C. Anagnostopoulos |
| 8 |
% Created: 13 August 1989 |
| 9 |
% |
| 10 |
% Copyright 1989--2020 by Paul C. Anagnostopoulos |
| 11 |
% under The MIT License (opensource.org/licenses/MIT) |
| 12 |
% |
| 13 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 14 |
|
| 15 |
% Remarks & Errors |
| 16 |
% ------- - ------ |
| 17 |
|
| 18 |
|
| 19 |
\def \remark #1{% {text} |
| 20 |
\messagenl{_ZzTeX: #1_}} |
| 21 |
|
| 22 |
\def \warning #1#2{% {help-id}{text} |
| 23 |
\zsethelp{#1}% |
| 24 |
\zerrmsg{warning}{#2}} |
| 25 |
|
| 26 |
\def \error #1#2{% {help-id}{text} |
| 27 |
\zsethelp{#1}% |
| 28 |
\zerrmsg{error}{#2}% |
| 29 |
\remark{Continuing from an error may cause unpredictable results.}} |
| 30 |
|
| 31 |
\def \zzerror #1{% {text} |
| 32 |
\zerrmsg{internal error}{#1}% |
| 33 |
\remark{Continuing from an internal error will cause erroneous results.}} |
| 34 |
|
| 35 |
\def \zerrmsg #1#2{% {prefix}{text} |
| 36 |
{\newlinechar = `\_% |
| 37 |
\errmessage{ZzTeX #1: #2}}} |
| 38 |
|
| 39 |
%%%\def \zerrcontext #1{% |
| 40 |
%%% \listtop{\znext}{\zblockstack}% |
| 41 |
%%% \writelog{ZzTeX context: #1 \znext\space \the\typesizename |
| 42 |
%%% \the\typestyle \the\typeencoding.}} |
| 43 |
%%% |
| 44 |
%%%\def \context {% |
| 45 |
%%% \zerrcontext{???}% |
| 46 |
%%% \zend} |
| 47 |
|
| 48 |
% To-Do Facility |
| 49 |
% ----- -------- |
| 50 |
|
| 51 |
|
| 52 |
\definecount{\ztodocount}{0} |
| 53 |
|
| 54 |
|
| 55 |
%~ The |\todo| command accepts a note that is stored in the composite |
| 56 |
%~ cross-reference file as a reminder of something that needs to |
| 57 |
%~ be done later. ZzExplore can display a list of the outstanding |
| 58 |
%~ to-dos. |
| 59 |
|
| 60 |
\long\def \todo #1{% {note} |
| 61 |
\zwritetodo{#1}% |
| 62 |
\ztodo #1\zmark |
| 63 |
\global\increment \ztodocount} |
| 64 |
|
| 65 |
\long\def \ztodo #1#2\zmark{% {char1}{rest of message} |
| 66 |
\if \codeeqlp{#1}{!}% |
| 67 |
{\errorcontextlines = 0 |
| 68 |
\def \znext {#2}% |
| 69 |
\zerrmsg{to-do}{\expandafter\zdefof \meaning\znext\zmark\space |
| 70 |
[\the\divisionname]}}% |
| 71 |
\else\if \codeeqlp{#1}{.}% |
| 72 |
\def \znext {#2}% |
| 73 |
\writelog{ZzTeX to-do: \expandafter\zdefof \meaning\znext\zmark\space |
| 74 |
[\the\divisionname]}% |
| 75 |
\else\if \codeeqlp{#1}{?}% |
| 76 |
\def \znext {#2}% |
| 77 |
\messagenl{_ZzTeX to-do: To come: \expandafter\zdefof \meaning\znext\zmark\space |
| 78 |
[\the\divisionname]_}% |
| 79 |
\if \DVIWindoinuse \colorspecial{ifview color push rgb 1 0 0}\fi |
| 80 |
???% |
| 81 |
\if \DVIWindoinuse \colorspecial{ifview color pop}\fi |
| 82 |
\else |
| 83 |
\def \znext {#1#2}% |
| 84 |
\messagenl{_ZzTeX to-do: \expandafter\zdefof \meaning\znext\zmark\space |
| 85 |
[\the\divisionname]_}% |
| 86 |
\fi\fi\fi} |
| 87 |
|
| 88 |
% Write a todo entry into the cross-reference file. |
| 89 |
|
| 90 |
\long\def \zwritetodo #1{% {message} |
| 91 |
\zbeginhidewrite |
| 92 |
\def \znext {#1}% |
| 93 |
\edef \znext {\noexpand\xref{todo}{\noexpand\folio}{} |
| 94 |
{\expandafter\zdefof \meaning\znext\zmark} |
| 95 |
{\the\divisionname}}% |
| 96 |
\znext |
| 97 |
\zendhidewrite} |
| 98 |
|
| 99 |
% There is nothing to do with each entry in the cross-reference file |
| 100 |
% when it is loaded. |
| 101 |
|
| 102 |
\long\def \xreftodo #1#2#3#4{} |
| 103 |
|
| 104 |
% This macro is invoked at the end of the run. |
| 105 |
|
| 106 |
\def \ztodomsg {% |
| 107 |
\if \posp{\ztodocount}% |
| 108 |
\remark{Number of to-do reminders encountered: \the\ztodocount}% |
| 109 |
\fi} |
| 110 |
|
| 111 |
|
| 112 |
% Help Text |
| 113 |
% ---- ---- |
| 114 |
|
| 115 |
|
| 116 |
\def \zsethelp #1{% |
| 117 |
\if \definedp{\=zH:#1}% |
| 118 |
\global\errhelp = \expandafterthrice{\name{\=zH:#1}}% |
| 119 |
\else |
| 120 |
\global\errhelp = {No additional help is available.}% |
| 121 |
\fi} |
| 122 |
|
| 123 |
|