diff options
Diffstat (limited to 'Build')
-rw-r--r-- | Build/source/texk/web2c/ctiedir/ctie-k.ch | 123 |
1 files changed, 60 insertions, 63 deletions
diff --git a/Build/source/texk/web2c/ctiedir/ctie-k.ch b/Build/source/texk/web2c/ctiedir/ctie-k.ch index 3bb1f763e6b..e4f258ffbaf 100644 --- a/Build/source/texk/web2c/ctiedir/ctie-k.ch +++ b/Build/source/texk/web2c/ctiedir/ctie-k.ch @@ -17,7 +17,7 @@ % the web2c system and on comm-w2c.ch from the Web2C 7.4.5 distribution % by Wlodek Bzyl and Olaf Weber. -@x l.19 Add macro definitions +@x [0] l.19 Add macro definitions \def\title{The CTIE processor} \def\botofcontents{% \vfill @@ -64,7 +64,7 @@ permission notice identical to this one. \datecontentspage @z -@x l.81 +@x [1] l.81 @d copyright "Copyright 2002,2003 Julian Gilbey. All rights reserved. There is no warranty.\n\ Run with the --version option for other important information." @@ -75,28 +75,27 @@ Run with the --version option for other important information." "Run with the --version option for other important information." @z -@x l.102 +@x [3] l.102 main(argc, argv) int argc; string *argv; @y int main (int argc, string *argv) @z -@x l.105 Set up kpathsea stuff +@x [3] l.105 Set up kpathsea stuff @<Initialise parameters@>; @y @<Set up |PROGNAME| feature and initialise the search path mechanism@>@; @<Initialise parameters@>@; @z -@x l.107 +@x [3] l.107 @<Print the banners@>; @y @<Print the banners@>@; @z -boolean and string are defined by kpathsea. -@x l.116 +@x [4] l.116 boolean and string are defined by kpathsea. @ We include the additional types |boolean| and |string|. \.{CTIE} replaces the complex \.{TIE} character set handling (based on that of the original \.{WEB} system) with the standard \.{CWEB} behaviour, and @@ -124,7 +123,7 @@ them here. @s const_string int @z -@x l.129 The kpathsea include files find the right header file for these. +@x [5] l.129 The kpathsea include files find the right header file for these. @ We predeclare some standard string-handling functions here instead of including their system header files, because the names of the header files are not as standard as the names of the functions. (There's confusion @@ -142,19 +141,19 @@ the \.{kpathsea} headers do the right thing by including \.{<string.h>} behind the scenes. @z -@x l.149 +@x [6] l.149 @d xisupper(c) (isupper(c)&&((unsigned char)c<0200)) @y @d xisupper(c) (isupper((unsigned char)c)&&((unsigned char)c<0200)) @z -@x l.155 +@x [7] l.155 This variable must be initialized. @y This variable must be initialised. @z -@x l.158 +@x [7] l.158 @d spotless 0 @d troublesome 1 @d fatal 2 @@ -170,7 +169,7 @@ typedef enum { static return_code history=spotless; @z -@x l.170 The kpathsea include files must be first. +@x [8] l.170 The kpathsea include files must be first. predefined as we include the \.{stdio.h} definitions. @<Global \&{\#include}s@>= @@ -185,7 +184,7 @@ through the \.{kpathsea} interface. #include <lib/lib.h> @z -@x l.176 And this. +@x [9] l.176 And this. @ And we need dynamic memory allocation. This should cause no trouble in any \CEE/ program. @^system dependencies@> @@ -203,7 +202,7 @@ The \.{kpathsea} include files handle the definition of |@!malloc|, too. @^system dependencies@> @z -@x l.190 +@x [10] l.190 files) are treated the same way. To organize the @y files) are treated the same way. To organise the @@ -211,19 +210,19 @@ files) are treated the same way. To organise the Sections 10 and 11: use enum as requested in ctie.w -@x l.204 +@x [10] l.204 \leavevmode |file_types| is used to describe whether a file @y \leavevmode \&{file\_types} is used to describe whether a file @z -@x l.208 +@x [10] l.208 the kind of output. (this would even be necessary if we @y the kind of output. (This would even be necessary if we @z -@x l.212 +@x [10] l.212 #define search 0 #define test 1 #define reading 2 @@ -245,13 +244,13 @@ typedef enum { @!chf } file_types; @z -@x l.223 +@x [11] l.223 @ A variable of type |out_md_type| will tell us in what state the output @y @ A variable of type \&{out\_md\_type} will tell us in what state the output @z -@x l.230 dito +@x [11] l.230 dito #define normal 0 #define pre 1 #define post 2 @@ -263,13 +262,13 @@ typedef enum { @!post } out_md_type; @z -@x l.284 way too short! +@x [15] l.284 way too short! @d max_file_name_length 60 @y @d max_file_name_length 1024 @z -@x l.329 +@x [19] l.329 boolean get_line(i, do_includes) file_index i; boolean do_includes; @y @@ -277,27 +276,25 @@ static boolean get_line (file_index i, boolean do_includes) @z -@x l.361 +@x [20] l.361 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 @z -Handle input lines with CRLF - -@x l.376 +@x [20] l.376 Handle input lines with CRLF if ((*(k++) = c) != ' ') inp_desc->limit = k; @y if ((*(k++) = c) != ' ' && c != '\r') inp_desc->limit = k; @z -@x l.386 +@x [20] l.386 @<Increment the line number and print a progess report at @y @<Increment the line number and print a progress report at @z -@x l.436 +@x [24] l.436 if ((*(k++) = c) != ' ') inp_desc->limit = k; @y if ((*(k++) = c) != ' ' && c != '\r') inp_desc->limit = k; @@ -306,7 +303,7 @@ Handle input lines with CRLF The next piece is simplified using the kpathsea kpse_find_file function. -@x l.497 +@x [27] l.497 If the environment variable \.{CWEBINPUTS} is set, or if the compiler flag of the same name was defined at compile time, \.{CWEB} will look for include files in the directory thus named, if @@ -317,7 +314,7 @@ We use the \Kpathsea/ library (in particular, the \.{CWEBINPUTS} variable) to search for this file.@.CWEBINPUTS@> @z -@x l.510 Don't need the same variables any longer +@x [27] l.510 Don't need the same variables any longer char temp_file_name[max_file_name_length]; char *file_name_end; char *k, *kk; @@ -328,7 +325,7 @@ variable) to search for this file.@.CWEBINPUTS@> char *k; @z -@x l.534 Replace with kpse_find_file +@x [27] l.534 Replace with kpse_find_file if ((new_inc->the_file=fopen(new_inc->file_name, "r"))!=NULL) { @y if ((fullname=kpse_find_cweb(new_inc->file_name))!=NULL @| @@ -336,7 +333,7 @@ variable) to search for this file.@.CWEBINPUTS@> free(fullname); @z -@x l.539 And this part is replaced by kpse_find_file +@x [27] l.539 And this part is replaced by kpse_find_file kk=getenv("CWEBINPUTS"); if (kk!=NULL) { if ((l=strlen(kk))>max_file_name_length-2) too_long(); @@ -364,7 +361,7 @@ variable) to search for this file.@.CWEBINPUTS@> @y @z -@x l.565 slightly more useful error message +@x [27] l.565 slightly more useful error message err_print(i, "! Cannot open include file"); @y if (fullname) { @@ -375,13 +372,13 @@ variable) to search for this file.@.CWEBINPUTS@> @z -@x l.585 +@x [28] l.585 void err_print(); @y void err_print (file_index, const char *); @z -@x l.590 +@x [29] l.590 void err_print(i, s) /* prints `\..' and location of error message */ file_index i; char *s; @y @@ -389,13 +386,13 @@ void err_print (file_index i, const char *s) /* prints `\..' and location of error message */ @z -@x l.664 +@x [32] l.664 int wrap_up() @y int wrap_up (void) @z -@x l.667 +@x [32] l.667 if (history > spotless) return 1; else return 0; @y @@ -403,32 +400,32 @@ int wrap_up (void) else return EXIT_SUCCESS; @z -@x l.674 +@x [33] l.674 int wrap_up(); @y int wrap_up (void); @z -@x l.697 +@x [35] l.697 void pfatal_error(); @y void pfatal_error (const char *, const char *); @z -@x l.700 +@x [36] l.700 void pfatal_error(s, t) char *s, *t; @y void pfatal_error (const char *s, const char *t) @z -@x l.707 +@x [36] l.707 else fprintf(stderr, "\n"); @y else putc('\n', stderr); @z -@x l.713 +@x [37] l.713 @ We need an include file for the above. @<Global \&{\#include}s@>= @@ -438,20 +435,20 @@ void pfatal_error (const char *s, const char *t) interface. @z -@x l.731 Use binary mode for output files +@x [38] l.731 Use binary mode for output files out_file=fopen(out_name, "w"); if (out_file==NULL) { @y if ((out_file=fopen(out_name, "wb"))==NULL) { @z -@x l.739 +@x [39] l.739 @ The name of the file and the file desciptor are stored in @y @ The name of the file and the file descriptor are stored in @z -@x l.747 Use the kpathsea library to do this +@x [40] l.747 Use the kpathsea library to do this @ For the master file we start by reading its first line into the buffer, if we could open it. @@ -486,7 +483,7 @@ the file. @.Cannot find master file@> @z -@x l.768 And this +@x [41] l.768 And this @<Prepare the change files@>= { file_index i; @@ -521,7 +518,7 @@ the file. @.Cannot find change file@> @z -@x l.792 +@x [42] l.792 boolean lines_dont_match(i, j) file_index i, j; @y @@ -529,7 +526,7 @@ static boolean lines_dont_match (file_index i, file_index j) @z -@x l.809 +@x [43] l.809 void init_change_file(i) file_index i; @y @@ -537,13 +534,13 @@ static void init_change_file (file_index i) @z -@x l.833 +@x [44] l.833 if (xisupper(ccode)) ccode=tolower(ccode); @y if (xisupper(ccode)) ccode=tolower((unsigned char)ccode); @z -@x l.858 +@x [46] l.858 void put_line(j) file_index j; @y @@ -551,7 +548,7 @@ static void put_line (file_index j) @z -@x l.873 +@x [47] l.873 boolean e_of_ch_module(i) file_index i; @y @@ -559,7 +556,7 @@ static boolean e_of_ch_module (file_index i) @z -@x l.894 +@x [48] l.894 boolean e_of_ch_preamble(i) file_index i; @y @@ -567,7 +564,7 @@ static boolean e_of_ch_preamble (file_index i) @z -@x l.1079 +@x [57] l.1079 if (out_mode==post) /* last line has been changed */ fprintf(out_file, "@@z\n"); @y @@ -577,7 +574,7 @@ if (out_mode==post) /* last line has been changed */ fprintf(out_file, "@@z\n"); @z -@x l.1106 +@x [59] l.1106 void usage_error() { @<Print the banners@>; @@ -590,13 +587,13 @@ usage_error (void) fprintf(stderr, "Usage: ctie -m|-c outfile master changefile(s)\n"); @z -@x l.1111 +@x [59] l.1111 exit(1); @y exit(EXIT_FAILURE); @z -@x l.1119 Add Web2C version to banner string +@x [60] l.1119 Add Web2C version to banner string printf("%s\n", banner); /* print a ``banner line'' */ @y printf("%s%s\n", banner, versionstring); /* print a ``banner line'' */ @@ -604,19 +601,19 @@ printf("%s%s\n", banner, versionstring); /* print a ``banner line'' */ Section 63: use 'none' more than once. -@x l.1169 +@x [63] l.1169 (which is the case if |no_ch==(-1)|) or if the next element of @y (which is the case if |no_ch==none|) or if the next element of @z -@x l.1174 +@x [63] l.1174 if (no_ch==(-1)) { @y if (no_ch==none) { @z -@x l.1218 +@x [66] l.1218 string CTIEHELP[] = { "Usage: ctie -[mc] outfile master changefile(s)", @y @@ -624,7 +621,7 @@ const_string CTIEHELP[] = { "Usage: ctie -m|-c outfile master changefile(s)", @z -@x l.1233 +@x [67] l.1233 void usage_help(); void print_version_and_exit(); @y @@ -632,7 +629,7 @@ static void usage_help (void); static void print_version_and_exit (const_string, const_string); @z -@x l.1238 +@x [68] l.1238 void usage_help() { string *message=CTIEHELP; @@ -643,13 +640,13 @@ usage_help (void) const_string *message=CTIEHELP; @z -@x l.1248 +@x [68] l.1248 exit(0); @y exit(EXIT_SUCCESS); @z -@x l.1253 +@x [69] l.1253 void print_version_and_exit(name, version) string name, version; { @@ -687,7 +684,7 @@ print_version_and_exit (const_string name, const_string version) We use the path-searching initialisation code taken almost verbatim from comm-w2c.ch. -@x l.1267 +@x [70] l.1267 @* System-dependent changes. This section should be replaced, if necessary, by changes to the program that are necessary to make \.{CTIE} |