texlive[55309] Build/source/texk/web2c/tiedir: [TIE] Complete

commits+ascherer at tug.org commits+ascherer at tug.org
Thu May 28 11:46:42 CEST 2020


Revision: 55309
          http://tug.org/svn/texlive?view=revision&revision=55309
Author:   ascherer
Date:     2020-05-28 11:46:41 +0200 (Thu, 28 May 2020)
Log Message:
-----------
[TIE] Complete overhaul of TIE changefile.

While incorporating Igor Liferenko's changes for conformant error
reporting (see https://tug.org/pipermail/tex-k/2020-May/003181.html),
I noticed a few other places that deserved improvements, so I took the
time to revamp the whole 'tie-w2c.ch'.

Modified Paths:
--------------
    trunk/Build/source/texk/web2c/tiedir/ChangeLog
    trunk/Build/source/texk/web2c/tiedir/tie-w2c.ch

Modified: trunk/Build/source/texk/web2c/tiedir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/tiedir/ChangeLog	2020-05-27 22:59:32 UTC (rev 55308)
+++ trunk/Build/source/texk/web2c/tiedir/ChangeLog	2020-05-28 09:46:41 UTC (rev 55309)
@@ -1,3 +1,7 @@
+2020-05-28  Andreas Scherer  <https://ascherer.github.io>
+
+	* tie-w2c.ch: Incorporated Igor Liferenko's changes.
+
 2020-04-30  Andreas Scherer  <https://ascherer.github.io>
 
 	* tie-w2c.ch: Fix type format in section 60.

Modified: trunk/Build/source/texk/web2c/tiedir/tie-w2c.ch
===================================================================
--- trunk/Build/source/texk/web2c/tiedir/tie-w2c.ch	2020-05-27 22:59:32 UTC (rev 55308)
+++ trunk/Build/source/texk/web2c/tiedir/tie-w2c.ch	2020-05-28 09:46:41 UTC (rev 55309)
@@ -1,14 +1,27 @@
 % Changes to adapt tie to web2c.
 % Copyright 2001 by Olaf Weber
+% Copyright 2020 Andreas Scherer
 % This file is in the Public Domain.
 
- at x Already in cpascal.h.
+Section 2
+
+ at x l.113 -- improve typography
+@<Global |#include|s@>@;
+ at y
+@<Global \&{\#include}s@>@;
+ at z
+
+Section 3
+
+ at x l.123 -- Already in cpascal.h.
 @d incr(v) v+=1 /* increase a variable by unity */
 @d decr(v) v-=1 /* decrease a variable by unity */
 @y
 @z
 
- at x
+Section 4
+
+ at x l.130
 @ Furthermore we include the additional types |boolean| and |string|.
 @d false 0
 @d true 1
@@ -16,13 +29,15 @@
 typedef int boolean;
 typedef char* string;
 @y
-@ Furthermore we include the additional types |boolean| and |string|.
-/* |boolean|, |false|, |true|; |string|; all from \.{<kpathsea/simpletypes.h>} */
+@ The types |boolean| (with values |false| and |true|) and
+|string| come from \.{<kpathsea/simpletypes.h>}.
 @s boolean int
 @s string int
 @z
 
- at x -- we need more input files.
+Section 5
+
+ at x l.144 -- we need more input files.
 #define max_file_index 9
 /* we don't think that anyone needs more than 9 change files,
 @y
@@ -30,29 +45,64 @@
 /* we don't think that anyone needs more than 32 change files,
 @z
 
- at x
+Section 6
+
+l.155
+ at x -- replace preprocessor macros
+ at d spotless 0
+ at d troublesome 1
+ at d fatal 2
+
+@<Global variables@>=
+static int history=spotless;
+ at y
+@<Global variables@>=
+typedef enum {
+    spotless,
+    troublesome,
+    fatal } return_code;
+static return_code history=spotless;
+ at z
+
+Section 15
+
+ at x l.461
 @d print(a)  fprintf(term_out,a) /* `|print|' means write on the terminal */
 @y
 @d print(a)  fprintf(term_out,"%s",a) /* `|print|' means write on the terminal */
 @z
 
- at x
+ at x l.463 -- function used only for error messages
+ at d print3(a,b,c)  fprintf(term_out,a,b,c) /* same with three arguments */
+ at y
+ at d print3(a,b,c)  fprintf(stderr,a,b,c) /* same with three arguments */
+ at z
+
+ at x l.468
 @d print_ln(v)  {fprintf(term_out,v);term_new_line;}
 @y
 @d print_ln(v)  {fprintf(term_out,"%s",v);term_new_line;}
 @z
 
- at x -- add to global includes.
+ at x l.471 -- used only for error reporting
+ at d print3_ln(a,b,c)  {print3(a,b,c);term_new_line;}
+ at y
+ at d print3_ln(a,b,c)  {print3(a,b,c);new_line(stderr);}
+ at z
+
+ at x l.478 -- add to global includes.
+@<Global |#include|s@>=
 #include <stdio.h>
 @y
+@<Global \&{\#include}s@>=
 #include "cpascal.h" /* |decr| and |incr| */
 #include <kpathsea/kpathsea.h>
 #define usage tieusage /* Also redefine |usage| to avoid clash with function from lib. */
 @z
 
-Section 16: Remove redundant #include directives.
+Section 16
 
- at x l.483
+ at x l.483 -- Remove redundant #include directives.
 This should cause no trouble in any \Cl\ program.
 @^system dependencies@>
 
@@ -105,6 +155,8 @@
     post } out_md_type;
 @z
 
+Section 24
+
 @x l.617
 void get_line(i)
 	file_index i;
@@ -113,7 +165,9 @@
 get_line (file_index i)
 @z
 
- at x l.650
+Section 27
+
+ at x l.650 -- fix typo
 replacement part of a change file, or in an incomplerte check if the
 @y
 replacement part of a change file, or in an incomplete check if the
@@ -125,6 +179,14 @@
    if (c!=@' ' && c!=tab_mark && c!=@'\r')
 @z
 
+Section 31
+
+ at x l.742 -- print errors on 'stderr'
+ at d err_print(m)  { @+ print_nl(m); error_loc
+ at y
+ at d err_print(m)  { @+ new_line(stderr); fprintf(stderr,"%s",m); error_loc
+ at z
+
 @x l.745
 void err_loc(i) /* prints location of error */
         int i;
@@ -133,6 +195,27 @@
 err_loc (int i) /* prints location of error */
 @z
 
+Section 32
+
+ at x l.761 -- print errors on 'stderr'
+         print(m); print_c('.'); history=fatal;
+	 term_new_line; jump_out();
+ at y
+         fprintf(stderr,"%s",m);
+         fputc('.',stderr); history=fatal;
+	 new_line(stderr); jump_out();
+ at z
+
+Section 33
+
+ at x l.774
+ at d jump_out() exit(1)
+ at y
+ at d jump_out() exit(EXIT_FAILURE)
+ at z
+
+Section 34
+
 @x l.790 Use binary mode for output files
     out_file=fopen(out_name,"w");
 @y
@@ -139,6 +222,8 @@
     out_file=fopen(out_name,"wb");
 @z
 
+Section 36
+
 @x l.811
 	  fopen(input_organization[0]->name_of_file,"r");
 @y
@@ -145,6 +230,8 @@
 	  kpse_open_file(input_organization[0]->name_of_file, kpse_web_format);
 @z
 
+Section 37
+
 @x l.830
 	fopen(input_organization[i]->name_of_file,"r");
 @y
@@ -151,7 +238,9 @@
 	kpse_open_file(input_organization[i]->name_of_file, kpse_web_format);
 @z
 
- at x
+Section 38
+
+ at x l.851
 boolean lines_dont_match(i,j)
 	file_index i,j;
 @y
@@ -159,7 +248,9 @@
 lines_dont_match (file_index i, file_index j)
 @z
 
- at x
+Section 39
+
+ at x l.872
 void init_change_file(i,b)
 	file_index i; boolean b;
 @y
@@ -167,7 +258,9 @@
 init_change_file (file_index i, boolean b)
 @z
 
- at x
+Section 42
+
+ at x l.919
 void put_line(j)
 	file_index j;
 @y
@@ -175,7 +268,9 @@
 put_line (file_index j)
 @z
 
- at x
+Section 43
+
+ at x l.935
 boolean e_of_ch_module(i)
 	file_index i;
 @y
@@ -183,7 +278,9 @@
 e_of_ch_module (file_index i)
 @z
 
- at x
+Section 44
+
+ at x l.955
 boolean e_of_ch_preamble(i)
 	file_index i;
 @y
@@ -191,7 +288,9 @@
 e_of_ch_preamble (file_index i)
 @z
 
- at x l.1005
+Section 47
+
+ at x l.1005 -- fix typo
 a line to write and |test_input| ist set to |none|.
 @y
 a line to write and |test_input| is set to |none|.
@@ -217,7 +316,9 @@
 else
 @z
 
- at x
+Section 55
+
+ at x l.1158
 void usage()
 {
    print("Usage: tie -[mc] outfile master changefile(s)");
@@ -228,13 +329,17 @@
    print("Usage: tie -m|-c outfile master changefile(s)");
 @z
 
- at x l.1169
+Section 56
+
+ at x l.1169 -- fix typo
 change files.  The names fo the file parameters will be inserted into
 @y
 change files.  The names of the file parameters will be inserted into
 @z
 
- at x
+Section 59
+
+ at x l.1236
 main(argc,argv)
         int argc; string *argv;
 @y
@@ -241,7 +346,7 @@
 int main (int argc, string *argv)
 @z
 
- at x
+ at x l.1241
   print_ln(banner); /* print a ``banner line'' */
   print_ln(copyright); /* include the copyright notice */
 @y
@@ -251,25 +356,43 @@
   print_ln(copyright); /* include the copyright notice */
 @z
 
- at x l.1256
+Section 60
+
+ at x l.1256 -- fix typo
 Additionaly we report the history to the user, although this may not
 @y
 Additionally we report the history to the user, although this may not
 @z
 
- at x
+ at x l.1261 -- rewrite error reporting
 @<Print the job |history|@>=
 {string msg;
+   switch (history) {
+      case spotless: msg="No errors were found"; break;
+      case troublesome: msg="Pardon me, but I think I spotted something wrong.";
+	        break;
+      case fatal: msg="That was a fatal error, my friend";  break;
+      } /* there are no other cases */
+   print2_nl("(%s.)",msg);  term_new_line;
+   exit ( history == spotless  ?  0 : 1 );
+}
 @y
 @s const_string int
 
 @<Print the job |history|@>=
 {const_string msg;
- at z
-
- at x -- silence unitialized warning
-      case fatal: msg="That was a fatal error, my friend";  break;
- at y
+   switch (history) {
+      case spotless: print2_nl("(%s.)", "No errors were found");
+        term_new_line; break;
+      case troublesome: new_line(stderr); fprintf(stderr,
+        "(Pardon me, but I think I spotted something wrong.)");
+        new_line(stderr); break;
+      case fatal:
       default: /* Anything except spotless, troublesome, or fatal is a bug. */
-      case fatal: msg="That was a fatal error, my friend";  break;
+        new_line(stderr);
+        fprintf(stderr, "(That was a fatal error, my friend.)");
+        new_line(stderr); break;
+      }
+   exit ( history == spotless ?  EXIT_SUCCESS : EXIT_FAILURE );
+}
 @z



More information about the tex-live-commits mailing list.