diff options
-rw-r--r-- | Build/source/texk/web2c/ChangeLog | 7 | ||||
-rw-r--r-- | Build/source/texk/web2c/dvicopy.ch | 6 | ||||
-rw-r--r-- | Build/source/texk/web2c/gftodvi.ch | 12 | ||||
-rw-r--r-- | Build/source/texk/web2c/gftopk.ch | 2 | ||||
-rw-r--r-- | Build/source/texk/web2c/gftype.ch | 4 | ||||
-rw-r--r-- | Build/source/texk/web2c/mf.ch | 6 | ||||
-rw-r--r-- | Build/source/texk/web2c/mft.ch | 2 | ||||
-rw-r--r-- | Build/source/texk/web2c/patgen.ch | 15 | ||||
-rw-r--r-- | Build/source/texk/web2c/pktype.ch | 2 | ||||
-rw-r--r-- | Build/source/texk/web2c/tangle.ch | 18 | ||||
-rw-r--r-- | Build/source/texk/web2c/tex.ch | 18 | ||||
-rw-r--r-- | Build/source/texk/web2c/weave.ch | 18 |
12 files changed, 98 insertions, 12 deletions
diff --git a/Build/source/texk/web2c/ChangeLog b/Build/source/texk/web2c/ChangeLog index 8eca662546e..1bbc932bf51 100644 --- a/Build/source/texk/web2c/ChangeLog +++ b/Build/source/texk/web2c/ChangeLog @@ -2,12 +2,17 @@ * dvicopy.ch, * dvitype.ch, + * gftodvi.ch, * gftopk.ch, * gftype.ch, * mf.ch, * mft.ch, + * patgen.ch, * pktogf.ch, - * pktype.ch: Purge non-local 'goto' labels. + * pktype.ch, + * tangle.ch, + * tex.ch, + * weave.ch: Purge non-local 'goto' labels and 'jump_out' leftovers. 2020-07-25 Andreas Scherer <https://ascherer.github.io> diff --git a/Build/source/texk/web2c/dvicopy.ch b/Build/source/texk/web2c/dvicopy.ch index 838402b6400..1b14c54b760 100644 --- a/Build/source/texk/web2c/dvicopy.ch +++ b/Build/source/texk/web2c/dvicopy.ch @@ -156,6 +156,7 @@ begin mark_fatal; close_files_and_terminate; goto final_end; end; @y +@f noreturn==procedure @d abort(#)==begin write_ln(stderr, ' ',#,'.'); jump_out; end @@ -170,6 +171,11 @@ end; @z @x [24] Declare confusion as noreturn +says |confusion(|indication of where we are|)|. +@y +says |confusion|(indication of where we are). +@z +@x procedure confusion(@!p:pckt_pointer); @y noreturn procedure confusion(@!p:pckt_pointer); diff --git a/Build/source/texk/web2c/gftodvi.ch b/Build/source/texk/web2c/gftodvi.ch index a66511b1ed6..1c473a863a6 100644 --- a/Build/source/texk/web2c/gftodvi.ch +++ b/Build/source/texk/web2c/gftodvi.ch @@ -99,9 +99,17 @@ procedure initialize; {this procedure gets things started properly} @z @x [8] Add newline to end of abort() message, and exit abnormally. +so a procedure called |jump_out| has been introduced. This procedure, which +simply transfers control to the label |final_end| at the end of the program, +contains the only non-local |goto| statement in \.{GFtoDVI}. +@^system dependencies@> + @d abort(#)==@+begin print(' ',#); jump_out;@+end @y -@d abort(#)==@+begin write_ln (stderr, #); uexit (1);@+end +so a procedure called |jump_out| has been introduced. +@^system dependencies@> + +@d abort(#)==@+begin write_ln (stderr, #); jump_out;@+end @z % [8] Remove nonlocal goto. @@ -112,7 +120,7 @@ begin goto final_end; end; @y @p procedure jump_out; -begin uexit(0); +begin uexit(1); end; @z diff --git a/Build/source/texk/web2c/gftopk.ch b/Build/source/texk/web2c/gftopk.ch index 28f20a83b3a..8b9d7d2d9d0 100644 --- a/Build/source/texk/web2c/gftopk.ch +++ b/Build/source/texk/web2c/gftopk.ch @@ -91,7 +91,7 @@ so a procedure called |jump_out| has been introduced. This procedure, which simply transfers control to the label |final_end| at the end of the program, contains the only non-local |goto| statement in \.{GFtoPK}. @y -so a procedure called |jump_out| has been introduced. +so we might want to |abort| the program with an error message. @z @x @d abort(#)==begin print(' ',#); jump_out; diff --git a/Build/source/texk/web2c/gftype.ch b/Build/source/texk/web2c/gftype.ch index a0fa00b686d..143fbb0f5eb 100644 --- a/Build/source/texk/web2c/gftype.ch +++ b/Build/source/texk/web2c/gftype.ch @@ -135,11 +135,13 @@ image_array := nil; @z @x [7] Purge 'final_end' label. +Such errors might be discovered inside of subroutines inside of subroutines, so a procedure called |jump_out| has been introduced. This procedure, which simply transfers control to the label |final_end| at the end of the program, contains the only non-local |goto| statement in \.{GFtype}. @y -so a procedure called |jump_out| has been introduced. +Such errors might be discovered inside of subroutines inside of subroutines, +so we might want to |abort| the program with an error message. @z @x [7] Remove jump_out, and make `abort' end with a newline. diff --git a/Build/source/texk/web2c/mf.ch b/Build/source/texk/web2c/mf.ch index bfd297440e8..411ec092ccd 100644 --- a/Build/source/texk/web2c/mf.ch +++ b/Build/source/texk/web2c/mf.ch @@ -646,12 +646,14 @@ procedure jump_out; begin goto end_of_MF; end; @y -@ The |jump_out| procedure just cuts across all active procedure levels and -simply calls +@ The |jump_out| procedure just cuts across all active procedure levels. +The body of |jump_out| simply calls `|close_files_and_terminate|;\thinspace' followed by a call on some system procedure that quietly terminates the program. @^system dependencies@> +@f noreturn==procedure + @d do_final_end==begin update_terminal; ready_already:=0; diff --git a/Build/source/texk/web2c/mft.ch b/Build/source/texk/web2c/mft.ch index ed18c7391f9..8213bd31543 100644 --- a/Build/source/texk/web2c/mft.ch +++ b/Build/source/texk/web2c/mft.ch @@ -226,7 +226,7 @@ and exits back to the operating system. @<Error handling...@>= procedure jump_out; begin -@t\4\4@>{here files should be closed if the operating system requires it} +{here files should be closed if the operating system requires it} @<Print the job |history|@>; new_line; if (history <> spotless) and (history <> harmless_message) then diff --git a/Build/source/texk/web2c/patgen.ch b/Build/source/texk/web2c/patgen.ch index 4a8c177d2fb..3d9054a446d 100644 --- a/Build/source/texk/web2c/patgen.ch +++ b/Build/source/texk/web2c/patgen.ch @@ -58,7 +58,22 @@ begin print_ln (version_string); @z +@x [10] Purge 'jump_out' and 'end_of_PATGEN'. +error message about what caused the error. Such errors might be +discovered inside of subroutines inside of subroutines, so a \.{WEB} +macro called |jump_out| has been introduced. This macro, which transfers +control to the label |end_of_PATGEN| at the end of the program, contains +the only non-local |@!goto| statement in \.{PATGEN}. Some \PASCAL\ +compilers do not implement non-local |goto| statements. In such cases +the |goto end_of_PATGEN| in the definition of |jump_out| should simply +be replaced by a call on some system procedure that quietly terminates +the program. +@y +error message about what caused the error. +@z @x Error handling +@d jump_out==goto end_of_PATGEN {terminates \.{PATGEN}} +@# @d error(#)==begin print_ln(#); jump_out; end @y @d error(#)==begin write_ln(stderr, #); uexit(1); end; diff --git a/Build/source/texk/web2c/pktype.ch b/Build/source/texk/web2c/pktype.ch index 96096eddc95..c8c0d59108a 100644 --- a/Build/source/texk/web2c/pktype.ch +++ b/Build/source/texk/web2c/pktype.ch @@ -60,7 +60,7 @@ begin @<Labels...@>=final_end; @y @ This module is deleted, because it is only useful for -a non-local goto, which we don't use in C. +a non-local |goto|, which we don't use in C. @z % [6] No need for |name_length| or |terminal_line_length|. Since these diff --git a/Build/source/texk/web2c/tangle.ch b/Build/source/texk/web2c/tangle.ch index c1b568a1056..34c187129cf 100644 --- a/Build/source/texk/web2c/tangle.ch +++ b/Build/source/texk/web2c/tangle.ch @@ -52,9 +52,11 @@ @z @x [2] Eliminate the |end_of_TANGLE| label. -@d end_of_TANGLE = 9999 {go here to wrap it up} +calls the `|jump_out|' procedure, which goes to the label |end_of_TANGLE|. +@d end_of_TANGLE = 9999 {go here to wrap it up} @y +calls the `|jump_out|' procedure. @z @x label end_of_TANGLE; {go here to finish} @@ -193,6 +195,16 @@ rewrite (Pascal_file, pascal_name); @z @x [34] Fix `jump_out'. +and jumps out of the program. This is the only non-local |goto| statement +in \.{TANGLE}. It is used when no recovery from a particular error has +been provided. + +Some \PASCAL\ compilers do not implement non-local |goto| statements. +@^system dependencies@> +In such cases the code that appears at label |end_of_TANGLE| should be +copied into the |jump_out| procedure, followed by a call to a system procedure +that terminates the program. + @d fatal_error(#)==begin new_line; print(#); error; mark_fatal; jump_out; end @@ -201,9 +213,11 @@ procedure jump_out; begin goto end_of_TANGLE; end; @y +and jumps out of the program. + @d jump_out==uexit(1) @d fatal_error(#)==begin new_line; write(stderr, #); - error; mark_fatal; uexit(1); + error; mark_fatal; jump_out; end @z diff --git a/Build/source/texk/web2c/tex.ch b/Build/source/texk/web2c/tex.ch index 5b549168236..c07f9948e9e 100644 --- a/Build/source/texk/web2c/tex.ch +++ b/Build/source/texk/web2c/tex.ch @@ -822,11 +822,29 @@ else % under Unix. We call it `uexit' because there's a WEB symbol called % `exit' already. We use a C macro to change `uexit' back to `exit'. @x [6.81] l.1852 - Eliminate nonlocal goto, since C doesn't have them. +@ The |jump_out| procedure just cuts across all active procedure levels and +goes to |end_of_TEX|. This is the only nontrivial |@!goto| statement in the +whole program. It is used when there is no recovery from a particular error. + +Some \PASCAL\ compilers do not implement non-local |goto| statements. +@^system dependencies@> +In such cases the body of |jump_out| should simply be +`|close_files_and_terminate|;\thinspace' followed by a call on some system +procedure that quietly terminates the program. + @<Error hand...@>= procedure jump_out; begin goto end_of_TEX; end; @y +@ The |jump_out| procedure just cuts across all active procedure levels. +The body of |jump_out| simply calls +`|close_files_and_terminate|;\thinspace' followed by a call on some system +procedure that quietly terminates the program. +@^system dependencies@> + +@f noreturn==procedure + @d do_final_end==begin update_terminal; ready_already:=0; diff --git a/Build/source/texk/web2c/weave.ch b/Build/source/texk/web2c/weave.ch index 2bdbb6c04af..649ad827075 100644 --- a/Build/source/texk/web2c/weave.ch +++ b/Build/source/texk/web2c/weave.ch @@ -63,6 +63,13 @@ @z @x [2] No global labels, define and call parse_arguments. +calls the `|jump_out|' procedure, which goes to the label |end_of_WEAVE|. + +@d end_of_WEAVE = 9999 {go here to wrap it up} +@y +calls the `|jump_out|' procedure. +@z +@x label end_of_WEAVE; {go here to finish} const @<Constants in the outer block@>@/ type @<Types in the outer block@>@/ @@ -225,7 +232,16 @@ rewrite(tex_file,tex_name); begin while not eoln(f) do vgetc(f); @z -@x [??] Fix jump_out +@x [33] Fix jump_out +Some \PASCAL\ compilers do not implement non-local |goto| statements. +@^system dependencies@> +In such cases the code that appears at label |end_of_WEAVE| should be +copied into the |jump_out| procedure, followed by a call to a system procedure +that terminates the program. + +@y +@z +@x @d fatal_error(#)==begin new_line; print(#); error; mark_fatal; jump_out; end |