summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/cwebdir/comm-w2c.ch
diff options
context:
space:
mode:
authorAndreas Scherer <andreas_tex@freenet.de>2020-04-28 07:10:49 +0000
committerAndreas Scherer <andreas_tex@freenet.de>2020-04-28 07:10:49 +0000
commita6fd3ebb4fd662514711805865af6824b7339e1e (patch)
tree05658f036939bf91f4c254116ffe0c8ec7bc63cb /Build/source/texk/web2c/cwebdir/comm-w2c.ch
parent112684041f08e0ef08dc7997abcc87ac63c36fa2 (diff)
[CWEB] Purge standard interface of common.w.
<kpathsea/kpathsea.h> #include's a large set of standard C header files. With some CWEB magic, redundant inclusion is greatly reduced---just for fun and education. Note that neither ctangle.w nor cweave.w can be treated in a similar fashion, because they do not include the KPathSea interface, not even through comm-w2c.h. git-svn-id: svn://tug.org/texlive/trunk@54920 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/cwebdir/comm-w2c.ch')
-rw-r--r--Build/source/texk/web2c/cwebdir/comm-w2c.ch35
1 files changed, 27 insertions, 8 deletions
diff --git a/Build/source/texk/web2c/cwebdir/comm-w2c.ch b/Build/source/texk/web2c/cwebdir/comm-w2c.ch
index 7087e7b040e..518f4743915 100644
--- a/Build/source/texk/web2c/cwebdir/comm-w2c.ch
+++ b/Build/source/texk/web2c/cwebdir/comm-w2c.ch
@@ -82,6 +82,15 @@ common_init(void)
@z
@x
+\.{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
@d non_eq 032 /* `\.{!=}'\,; corresponds to MIT's {\tentex\char'32} */
@@ -114,6 +123,13 @@ char *id_loc; /* just after the current identifier in the buffer */
@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 */
@y
@@ -326,6 +342,12 @@ The remainder of the \.{@@i} line after the file name is ignored.
@z
@x
+@<Include...@>=
+#include <stdlib.h> /* declaration of |getenv| and |exit| */
+@y
+@z
+
+@x
char temp_file_name[max_file_name_length];
char *cur_file_name_end=cur_file_name+max_file_name_length-1;
char *k=cur_file_name, *kk;
@@ -1127,13 +1149,10 @@ extern char* strcpy(); /* copy one string to another */
extern int strncmp(); /* compare up to $n$ string characters */
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|.
+@ For string handling we include the {\mc ANSI C} system header file---through
+the \Kpathsea/ interface---instead of predeclaring the standard system
+functions |strlen|, |strcmp|, |strcpy|, |strncmp|, and |strncpy|.
@^system dependencies@>
-
-@<Include...@>=
-#include <string.h>
@z
@x
@@ -1176,12 +1195,12 @@ static void check_change(void);@/
static void prime_the_change_buffer(void);@/
@* Standard C library interfaces. This updated version of \.{CWEB} uses
-standard C types for boolean values, pointers, and objects with fixed sizes.
+standard C types for boolean values, pointers, and objects with fixed sizes
+(already in \Kpathsea/).
@<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.