ascherer / cwebbin

Literate Programming in C/C++
https://github.com/ascherer/cweb
MIT License
28 stars 5 forks source link

Purge redundant #includes in TeX Live CWEB. #26

Closed ascherer closed 4 years ago

ascherer commented 4 years ago
diff --git a/texk/web2c/cwebdir/comm-w2c.ch b/texk/web2c/cwebdir/comm-w2c.ch
index 7087e7b04..ec8748525 100644
--- a/texk/web2c/cwebdir/comm-w2c.ch
+++ b/texk/web2c/cwebdir/comm-w2c.ch
@@ -81,6 +81,15 @@ common_init(void)
   @<Scan arguments and open output files@>@;
 @z

+@x l.100
+\.{ctype.h} header file.
+
+@<Include files@>=
+#include <ctype.h>
+@y
+\.{ctype.h} header file, included through the \Kpathsea/ interface.
+@z
+
 @x
 @d not_eq 032 /* `\.{!=}'\,;  corresponds to MIT's {\tentex\char'32} */
 @y
@@ -113,6 +122,13 @@ char *id_loc; /* just after the current identifier in the buffer */
 @d xisupper(c) (isupper((eight_bits)c)&&((eight_bits)c<0200))
 @z

+@x
+@ @<Include files@>=
+#include <stdio.h>
+@y
+@ Most of the standard \CEE/ interface comes from \Kpathsea/.
+@z
+
 @x
 int input_ln(fp) /* copies a line into |buffer| or returns 0 */
 FILE *fp; /* what file to read from */
@@ -1129,11 +1145,8 @@ extern char* strncpy(); /* copy up to $n$ string characters */
 @y
 @ For string handling we include the {\mc ANSI C} system header file instead
 of predeclaring the standard system functions |strlen|, |strcmp|, |strcpy|,
-|strncmp|, and |strncpy|.
+|strncmp|, and |strncpy|; this comes through the \Kpathsea/ interface.
 @^system dependencies@>
-
-@<Include...@>=
-#include <string.h>
 @z

 @x
@@ -1181,7 +1194,6 @@ standard C types for boolean values, pointers, and objects with fixed sizes.
 @<Include files@>=
 #include <stdbool.h> /* type definition of |bool| */
 #include <stddef.h> /* type definition of |ptrdiff_t| */
-#include <stdint.h> /* type definition of |uint8_t| et al. */

 @ The |scan_args| and |cb_show_banner| routines and the |bindtextdomain|
 argument string need a few extra variables.
ascherer commented 4 years ago

Excellent! It appears that only the common module is affected; ctangle and cweave do not #include <kpathsea/kpathsea.h>, not even via comm-w2c.h.