w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

ctie-k.c
Go to the documentation of this file.
1 #define version_number "1.1"
2 #define banner "This is CTIE, Version 1.1"
3 #define copyright \
4 "Copyright 2002,2003 Julian Gilbey." \
5 " All rights reserved. There is no warranty.\n" \
6 "Run with the --version option for other important information." \
7  \
8 
9 #define buf_size 1024
10 #define max_file_index 32 \
11 
12 #define xisupper(c) (isupper((unsigned char) c) &&((unsigned char) c<0200) ) \
13  \
14 
15 #define max_include_files 20 \
16 
17 #define max_file_name_length 1024 \
18 
19 #define too_long() {total_include_files--;free(new_inc) ; \
20 err_print(i,"! Include file name too long") ;goto restart;} \
21 
22 #define fatal_error(i,s,t) { \
23 fprintf(stderr,"\n%s",s) ; \
24 err_print(i,t) ; \
25 history= fatal; \
26 exit(wrap_up() ) ; \
27 } \
28  \
29 
30 #define none (-1) \
31 
32 #define kpse_find_cweb(name) kpse_find_file(name,kpse_cweb_format,true) \
33 
34 /*2:*/
35 #line 89 "ctie.w"
36 
37 /*8:*/
38 #line 182 "ctie-k.ch"
39 
40 #include <kpathsea/kpathsea.h>
41 #line 174 "ctie.w"
42 
43 
44 #line 198 "ctie-k.ch"
45 /*:8*/
46 #line 90 "ctie.w"
47 
48 /*10:*/
49 #line 211 "ctie.w"
50 
51 #line 235 "ctie-k.ch"
52 typedef enum{
57 typedef enum{
61 #line 221 "ctie.w"
62 
63 
64 #line 249 "ctie-k.ch"
65 /*:10*//*11:*/
66 #line 229 "ctie.w"
67 
68 #line 258 "ctie-k.ch"
69 typedef enum{
73 #line 234 "ctie.w"
74 
75 
76 /*:11*//*12:*/
77 #line 239 "ctie.w"
78 
79 typedef int file_index;
80 
81 
82 /*:12*//*13:*/
83 #line 246 "ctie.w"
84 
85 typedef struct _indsc{
87 long line;
89 struct _indsc*parent;
91 
92 
93 /*:13*//*14:*/
94 #line 259 "ctie.w"
95 
96 typedef struct _idsc{
97 string file_name;
100 long line;
104 char*limit;
105 char*loc;
109 
110 
111 /*:14*/
112 #line 91 "ctie.w"
113 
114 /*28:*/
115 #line 584 "ctie.w"
116 
117 #line 381 "ctie-k.ch"
118 void err_print(file_index,const char*);
119 #line 586 "ctie.w"
120 
121 /*:28*//*33:*/
122 #line 673 "ctie.w"
123 
124 #line 409 "ctie-k.ch"
125 int wrap_up(void);
126 #line 675 "ctie.w"
127 
128 /*:33*//*35:*/
129 #line 696 "ctie.w"
130 
131 #line 415 "ctie-k.ch"
132 void pfatal_error(const char*,const char*);
133 #line 698 "ctie.w"
134 
135 /*:35*//*67:*/
136 #line 1232 "ctie.w"
137 
138 #line 623 "ctie-k.ch"
139 static void usage_help(void);
141 #line 1235 "ctie.w"
142 
143 
144 /*:67*/
145 #line 92 "ctie.w"
146 
147 /*7:*/
148 #line 165 "ctie-k.ch"
149 
150 typedef enum{
155 #line 164 "ctie.w"
156 
157 
158 /*:7*//*15:*/
159 #line 286 "ctie.w"
160 
162 
163 /*:15*//*16:*/
164 #line 292 "ctie.w"
165 
169 
170 /*:16*//*18:*/
171 #line 309 "ctie.w"
172 
174 
175 
176 /*:18*//*22:*/
177 #line 406 "ctie.w"
178 
179 boolean input_has_ended= false;
180 
181 
182 /*:22*//*39:*/
183 #line 742 "ctie.w"
184 
186 string out_name;
187 
188 
189 #line 461 "ctie-k.ch"
190 /*:39*//*66:*/
191 #line 1217 "ctie.w"
192 
193 #line 615 "ctie-k.ch"
195 "Usage: ctie -m|-c outfile master changefile(s)",
196 #line 1220 "ctie.w"
197 " Create a new master file or change file from the given",
198 " master (C)WEB file and changefiles.",
199 " All filenames are taken literally; no suffixes are added.",
200 "",
201 "-m create a new master file from original (C)WEB and change file(s)",
202 "-c create a master change file for original (C)WEB file from changefile(s)",
203 "--help display this help and exit",
204 "--version display version information and exit",
205 NULL
206 };
207 
208 
209 /*:66*/
210 #line 93 "ctie.w"
211 
212 /*29:*/
213 #line 589 "ctie.w"
214 
215 #line 388 "ctie-k.ch"
216 void err_print(file_index i,const char*s)
217 
218 #line 592 "ctie.w"
219 {
220 char*k,*l;
221 fprintf(stderr,*s=='!'?"\n%s":"%s",s);
222 if(i>=0)/*30:*/
223 #line 611 "ctie.w"
224 
225 {
226 register input_description*inp_desc= input_organisation[i];
227 register include_description*inc_desc= inp_desc->current_include;
228 
229 if(inc_desc!=NULL){
230 fprintf(stderr,". (l. %ld of include file %s",inc_desc->line,
231 inc_desc->file_name);
232 fprintf(stderr," included from l. %ld of %s file %s)\n",
233 inp_desc->line,
234 inp_desc->type_of_file==master?"master":"change",
235 inp_desc->file_name);
236 }
237 else
238 fprintf(stderr,". (l. %ld of %s file %s)\n",inp_desc->line,
239 inp_desc->type_of_file==master?"master":"change",
240 inp_desc->file_name);
241 l= (inp_desc->loc>=inp_desc->limit?inp_desc->limit:inp_desc->loc);
242 if(l> inp_desc->buffer){
243 for(k= inp_desc->buffer;k<l;k++)
244 if(*k=='\t')putc(' ',stderr);
245 else putc(*k,stderr);
246 putc('\n',stderr);
247 for(k= inp_desc->buffer;k<l;k++)
248 putc(' ',stderr);
249 }
250 for(k= l;k<inp_desc->limit;k++)
251 putc(*k,stderr);
252 putc('\n',stderr);
253 }
254 
255 
256 /*:30*/
257 #line 595 "ctie.w"
258 
259 else putc('\n',stderr);
260 fflush(stderr);
262 }
263 
264 /*:29*//*36:*/
265 #line 699 "ctie.w"
266 
267 #line 422 "ctie-k.ch"
268 void pfatal_error(const char*s,const char*t)
269 #line 702 "ctie.w"
270 {
271 char*strerr= strerror(errno);
272 
273 fprintf(stderr,"\n%s%s",s,t);
274 if(strerr)fprintf(stderr," (%s)\n",strerr);
275 else fprintf(stderr,"\n");
276 history= fatal;
277 exit(wrap_up());
278 }
279 
280 
281 #line 431 "ctie-k.ch"
282 /*:36*/
283 #line 94 "ctie.w"
284 
285 /*19:*/
286 #line 328 "ctie.w"
287 
288 #line 274 "ctie-k.ch"
289 static boolean
290 get_line(file_index i,boolean do_includes)
291 #line 331 "ctie.w"
292 {
293 register input_description*inp_desc= input_organisation[i];
294 register FILE*fp;
295 
296 if(inp_desc->mode==ignore)return false;
297 
298 restart:
299 if(inp_desc->current_include!=NULL){
300 register include_description*inc_desc= inp_desc->current_include;
301 
302 fp= inc_desc->the_file;
303 /*24:*/
304 #line 426 "ctie.w"
305 
306 {
307 register int c;
308 register char*k;
309 
310 if(feof(fp))
311 /*25:*/
312 #line 452 "ctie.w"
313 
314 {
315 include_description*temp= inc_desc->parent;
316 
317 fclose(fp);
318 free(inc_desc);
320 inp_desc->current_include= temp;
321 goto restart;
322 }
323 
324 
325 /*:25*/
326 #line 432 "ctie.w"
327 
328 
329 inp_desc->limit= k= inp_desc->buffer;
330 while(k<=inp_desc->buffer_end&&(c= getc(fp))!=EOF&&c!='\n')
331 #line 301 "ctie-k.ch"
332 if((*(k++)= c)!=' '&&c!='\r')inp_desc->limit= k;
333 #line 437 "ctie.w"
334 if(k> inp_desc->buffer_end)
335 if((c= getc(fp))!=EOF&&c!='\n'){
336 ungetc(c,fp);inp_desc->loc= inp_desc->buffer;
337 err_print(i,"! Input line too long");
338 
339 }
340 if(c==EOF&&inp_desc->limit==inp_desc->buffer)
341 /*25:*/
342 #line 452 "ctie.w"
343 
344 {
345 include_description*temp= inc_desc->parent;
346 
347 fclose(fp);
348 free(inc_desc);
350 inp_desc->current_include= temp;
351 goto restart;
352 }
353 
354 
355 /*:25*/
356 #line 444 "ctie.w"
357 
358 
359 inc_desc->line++;
360 }
361 
362 /*:24*/
363 #line 342 "ctie.w"
364 
365 }
366 else{
367 fp= inp_desc->the_file;
368 /*20:*/
369 #line 366 "ctie.w"
370 
371 {
372 register int c;
373 register char*k;
374 
375 if(feof(fp))
376 /*21:*/
377 #line 394 "ctie.w"
378 
379 {
380 inp_desc->mode= ignore;
381 inp_desc->limit= NULL;
382 if(inp_desc->type_of_file==master)input_has_ended= true;
383 fclose(fp);
384 return false;
385 }
386 
387 
388 /*:21*/
389 #line 372 "ctie.w"
390 
391 
392 inp_desc->limit= k= inp_desc->buffer;
393 while(k<=inp_desc->buffer_end&&(c= getc(fp))!=EOF&&c!='\n')
394 #line 289 "ctie-k.ch"
395 if((*(k++)= c)!=' '&&c!='\r')inp_desc->limit= k;
396 #line 377 "ctie.w"
397 if(k> inp_desc->buffer_end)
398 if((c= getc(fp))!=EOF&&c!='\n'){
399 ungetc(c,fp);inp_desc->loc= inp_desc->buffer;
400 err_print(i,"! Input line too long");
401 
402 }
403 if(c==EOF&&inp_desc->limit==inp_desc->buffer)
404 /*21:*/
405 #line 394 "ctie.w"
406 
407 {
408 inp_desc->mode= ignore;
409 inp_desc->limit= NULL;
410 if(inp_desc->type_of_file==master)input_has_ended= true;
411 fclose(fp);
412 return false;
413 }
414 
415 
416 /*:21*/
417 #line 384 "ctie.w"
418 
419 
420 #line 295 "ctie-k.ch"
421 /*23:*/
422 #line 414 "ctie.w"
423 
424 inp_desc->line++;
425 if(inp_desc->type_of_file==master&&inp_desc->line%100==0){
426 if(inp_desc->line%500==0)printf("%ld",inp_desc->line);
427 else putchar('.');
428 fflush(stdout);
429 }
430 
431 
432 /*:23*/
433 #line 387 "ctie.w"
434 
435 #line 388 "ctie.w"
436 }
437 
438 
439 /*:20*/
440 #line 346 "ctie.w"
441 
442 }
443 
444 if(do_includes)
445 /*26:*/
446 #line 467 "ctie.w"
447 
448 {
449 inp_desc->loc= inp_desc->buffer;
450 *inp_desc->limit= ' ';
451 if(*inp_desc->buffer=='@'&&
452 (inp_desc->buffer[1]=='i'||inp_desc->buffer[1]=='I')){
453 inp_desc->loc= inp_desc->buffer+2;
454 *inp_desc->limit= '"';
455 while(*inp_desc->loc==' '||*inp_desc->loc=='\t')
456 inp_desc->loc++;
457 if(inp_desc->loc>=inp_desc->limit){
458 err_print(i,"! Include file name not given");
459 
460 goto restart;
461 }
463 err_print(i,"! Too many nested includes");
464 
465 goto restart;
466 }
468 /*27:*/
469 #line 507 "ctie.w"
470 
471 {
472 include_description*new_inc;
473 #line 324 "ctie-k.ch"
474 char*file_name_end;
475 string fullname;
476 char*k;
477 #line 514 "ctie.w"
478 
480 if(new_inc==NULL)
481 fatal_error(i,"! No memory for new include descriptor","");
482 new_inc->line= 0;
483 k= new_inc->file_name;
484 file_name_end= k+max_file_name_length-1;
485 
486 if(*inp_desc->loc=='"'){
487 inp_desc->loc++;
488 while(*inp_desc->loc!='"'&&k<=file_name_end)
489 *k++= *inp_desc->loc++;
490 if(inp_desc->loc==inp_desc->limit)
491 k= file_name_end+1;
492 }else
493 while(*inp_desc->loc!=' '&&*inp_desc->loc!='\t'&&
494 *inp_desc->loc!='"'&&k<=file_name_end)*k++= *inp_desc->loc++;
495 if(k> file_name_end)too_long();
496 
497 *k= '\0';
498 #line 332 "ctie-k.ch"
499 fullname= kpse_find_cweb(new_inc->file_name);
500 if(fullname)
501 new_inc->the_file= fopen(fullname,"r");
502 if(fullname!=NULL&&new_inc->the_file!=NULL){
503 free(fullname);
504 #line 535 "ctie.w"
505 new_inc->parent= inp_desc->current_include;
506 inp_desc->current_include= new_inc;
507 goto restart;
508 }
509 #line 563 "ctie.w"
511 free(new_inc);
512 #line 370 "ctie-k.ch"
513 if(fullname){
514 free(fullname);
515 err_print(i,"! Cannot open include file");
516 }else
517 err_print(i,"! Cannot find include file");
518 #line 566 "ctie.w"
519 
520 goto restart;
521 }
522 
523 
524 
525 /*:27*/
526 #line 488 "ctie.w"
527 ;
528 }
529 }
530 
531 
532 /*:26*/
533 #line 351 "ctie.w"
534 
535 return true;
536 }
537 
538 
539 /*:19*//*32:*/
540 #line 663 "ctie.w"
541 
542 #line 395 "ctie-k.ch"
543 int wrap_up(void)
544 #line 665 "ctie.w"
545 {
546 /*34:*/
547 #line 682 "ctie.w"
548 
549 switch(history){
550 case spotless:
551 printf("\n(No errors were found.)\n");break;
552 case troublesome:
553 printf("\n(Pardon me, but I think I spotted something wrong.)\n");break;
554 case fatal:printf("(That was a fatal error, my friend.)\n");
555 }
556 
557 
558 /*:34*/
559 #line 666 "ctie.w"
560 ;
561 #line 402 "ctie-k.ch"
562 if(history> spotless)return EXIT_FAILURE;
563 else return EXIT_SUCCESS;
564 #line 669 "ctie.w"
565 }
566 
567 /*:32*//*42:*/
568 #line 791 "ctie.w"
569 
570 #line 530 "ctie-k.ch"
571 static boolean
573 #line 794 "ctie.w"
574 {
575 register input_description*iptr= input_organisation[i],
576 *jptr= input_organisation[j];
577 
578 if(iptr->limit-iptr->buffer!=jptr->limit-jptr->buffer)
579 return true;
580 return strncmp(iptr->buffer,jptr->buffer,iptr->limit-iptr->buffer);
581 }
582 
583 
584 /*:42*//*43:*/
585 #line 808 "ctie.w"
586 
587 #line 538 "ctie-k.ch"
588 static void
590 #line 811 "ctie.w"
591 {
592 register input_description*inp_desc= input_organisation[i];
593 char ccode;
594 
595 inp_desc->limit= inp_desc->buffer;
596 /*44:*/
597 #line 827 "ctie.w"
598 
599 while(1){
600 if(!get_line(i,false))return;
601 if(inp_desc->limit<inp_desc->buffer+2)continue;
602 if(inp_desc->buffer[0]!='@')continue;
603 ccode= inp_desc->buffer[1];
604 #line 545 "ctie-k.ch"
605 if(xisupper(ccode))ccode= tolower((unsigned char)ccode);
606 #line 834 "ctie.w"
607 if(ccode=='x')break;
608 if(ccode=='y'||ccode=='z'||ccode=='i'){
609 inp_desc->loc= inp_desc->buffer+2;
610 err_print(i,"! Missing @x in change file");
611 
612 }
613 }
614 
615 /*:44*/
616 #line 816 "ctie.w"
617 
618 /*45:*/
619 #line 844 "ctie.w"
620 
621 do{
622 if(!get_line(i,true)){
623 err_print(i,"! Change file ended after @x");
624 
625 return;
626 }
627 }while(inp_desc->limit==inp_desc->buffer);
628 
629 
630 /*:45*/
631 #line 817 "ctie.w"
632 
633 inp_desc->dont_match= 0;
634 }
635 
636 
637 /*:43*//*46:*/
638 #line 857 "ctie.w"
639 
640 #line 552 "ctie-k.ch"
641 static void
643 #line 860 "ctie.w"
644 {
646 char*lmt= input_organisation[j]->limit;
647 
648 while(ptr<lmt)putc(*ptr++,out_file);
649 putc('\n',out_file);
650 }
651 
652 
653 /*:46*//*47:*/
654 #line 872 "ctie.w"
655 
656 #line 560 "ctie-k.ch"
657 static boolean
659 #line 875 "ctie.w"
660 {
661 register input_description*inp_desc= input_organisation[i];
662 
663 if(inp_desc->limit==NULL){
664 err_print(i,"! Change file ended without @z");
665 
666 return true;
667 }else if(inp_desc->limit>=inp_desc->buffer+2)
668 if(inp_desc->buffer[0]=='@'&&
669 (inp_desc->buffer[1]=='Z'||inp_desc->buffer[1]=='z'))
670 return true;
671 return false;
672 }
673 
674 
675 /*:47*//*48:*/
676 #line 893 "ctie.w"
677 
678 #line 568 "ctie-k.ch"
679 static boolean
681 #line 896 "ctie.w"
682 {
683 register input_description*inp_desc= input_organisation[i];
684 
685 if(inp_desc->limit>=inp_desc->buffer+2&&inp_desc->buffer[0]=='@')
686 if(inp_desc->buffer[1]=='Y'||inp_desc->buffer[1]=='y'){
687 if(inp_desc->dont_match> 0){
688 inp_desc->loc= inp_desc->buffer+2;
689 fprintf(stderr,"\n! Hmm... %d ",inp_desc->dont_match);
690 err_print(i,"of the preceding lines failed to match");
691 }
692 return true;
693 }
694 return false;
695 }
696 
697 
698 
699 /*:48*//*59:*/
700 #line 1105 "ctie.w"
701 
702 #line 578 "ctie-k.ch"
703 static void
705 {
706 /*60:*/
707 #line 1118 "ctie.w"
708 
709 #line 594 "ctie-k.ch"
711 #line 1120 "ctie.w"
712 printf("%s\n",copyright);
713 
714 
715 /*:60*/
716 #line 581 "ctie-k.ch"
717 ;
718 fprintf(stderr,"Usage: ctie -m|-c outfile master changefile(s)\n");
719 #line 1110 "ctie.w"
720 fprintf(stderr,"Type ctie --help for more information\n");
721 #line 588 "ctie-k.ch"
723 #line 1112 "ctie.w"
724 }
725 
726 
727 /*:59*/
728 #line 95 "ctie.w"
729 
730 /*3:*/
731 #line 101 "ctie.w"
732 
733 #line 82 "ctie-k.ch"
734 int main(int argc,string*argv)
735 #line 104 "ctie.w"
736 {
737 #line 88 "ctie-k.ch"
738 /*71:*/
739 #line 725 "ctie-k.ch"
740 
741 kpse_set_program_name(argv[0],"ctie");
742 #line 1278 "ctie.w"
743 
744 
745 /*:71*/
746 #line 88 "ctie-k.ch"
747 
748 /*17:*/
749 #line 300 "ctie.w"
750 
751 actual_input= 0;
753 
754 /*:17*/
755 #line 89 "ctie-k.ch"
756 
757 #line 106 "ctie.w"
758 /*61:*/
759 #line 1135 "ctie.w"
760 
761 {
763 no_ch= -1;
764 while(--argc> 0){
765 argv++;
766 if(strcmp("-help",*argv)==0||strcmp("--help",*argv)==0)
767 /*64:*/
768 #line 1202 "ctie.w"
769 
770 usage_help();
771 
772 
773 
774 /*:64*/
775 #line 1142 "ctie.w"
776 ;
777 if(strcmp("-version",*argv)==0||strcmp("--version",*argv)==0)
778 /*65:*/
779 #line 1208 "ctie.w"
780 
781 {
783 
784 }
785 
786 
787 /*:65*/
788 #line 1144 "ctie.w"
789 ;
790 if(**argv=='-')/*62:*/
791 #line 1158 "ctie.w"
792 
794 else
795 switch(*(*argv+1)){
796 case'c':case'C':prod_chf= chf;break;
797 case'm':case'M':prod_chf= master;break;
798 default:usage_error();
799 }
800 
801 
802 /*:62*/
803 #line 1145 "ctie.w"
804 
805 else/*63:*/
806 #line 1172 "ctie.w"
807 
808 {
809 #line 608 "ctie-k.ch"
810 if(no_ch==none){
811 #line 1175 "ctie.w"
812 out_name= *argv;
813 }else{
814 register input_description*inp_desc;
815 
816 inp_desc= (input_description*)malloc(sizeof(input_description));
817 if(inp_desc==NULL)
818 fatal_error(-1,"! No memory for input descriptor","");
819 
820 inp_desc->mode= search;
821 inp_desc->line= 0;
822 inp_desc->type_of_file= chf;
823 inp_desc->limit= inp_desc->buffer;
824 inp_desc->buffer[0]= ' ';
825 inp_desc->loc= inp_desc->buffer+1;
826 inp_desc->buffer_end= inp_desc->buffer+buf_size-2;
827 inp_desc->file_name= *argv;
828 inp_desc->current_include= NULL;
829 input_organisation[no_ch]= inp_desc;
830 }
831 no_ch++;
832 }
833 
834 
835 /*:63*/
836 #line 1146 "ctie.w"
837 
838 }
840 }
841 
842 
843 /*:61*/
844 #line 106 "ctie.w"
845 
846 #line 95 "ctie-k.ch"
847 /*60:*/
848 #line 1118 "ctie.w"
849 
850 #line 594 "ctie-k.ch"
852 #line 1120 "ctie.w"
853 printf("%s\n",copyright);
854 
855 
856 /*:60*/
857 #line 95 "ctie-k.ch"
858 
859 #line 108 "ctie.w"
860 /*40:*/
861 #line 465 "ctie-k.ch"
862 
863 {
864 string fullname;
865 
867 if(fullname)
868 input_organisation[0]->the_file= fopen(fullname,"r");
869 
870 if(fullname==NULL||input_organisation[0]->the_file==NULL){
871 if(fullname){
872 pfatal_error("! Cannot open master file ",
874 }else{
875 fatal_error(-1,"! Cannot find master file ",
877 }
878 }
879 else free(fullname);
880 
881 
882 #line 759 "ctie.w"
883 printf("(%s)\n",input_organisation[0]->file_name);
885 get_line(0,true);
886 }
887 
888 
889 /*:40*/
890 #line 108 "ctie.w"
891 
892 /*41:*/
893 #line 501 "ctie-k.ch"
894 
895 {
896 file_index i;
897 string fullname;
898 
899 i= 1;
900 while(i<no_ch){
902 if(fullname)
903 input_organisation[i]->the_file= fopen(fullname,"r");
904 
905 if(fullname==NULL||input_organisation[i]->the_file==NULL){
906 if(fullname){
907 pfatal_error("! Cannot open change file ",
909 }else{
910 fatal_error(-1,"! Cannot find change file ",
912 }
913 }
914 else free(fullname);
915 
916 
917 #line 780 "ctie.w"
920 i++;
921 }
922 }
923 
924 
925 /*:41*/
926 #line 109 "ctie.w"
927 
928 /*38:*/
929 #line 729 "ctie.w"
930 
931 {
932 #line 438 "ctie-k.ch"
933 out_file= fopen(out_name,"wb");
934 #line 732 "ctie.w"
935 if(out_file==NULL){
936 pfatal_error("! Cannot open/create output file","");
937 
938 }
939 }
940 
941 
942 #line 444 "ctie-k.ch"
943 /*:38*/
944 #line 110 "ctie.w"
945 
946 /*57:*/
947 #line 1074 "ctie.w"
948 
949 actual_input= 0;
950 input_has_ended= false;
951 while(input_has_ended==false||actual_input!=0)
952 /*49:*/
953 #line 917 "ctie.w"
954 
955 {
957 
958 /*50:*/
959 #line 934 "ctie.w"
960 
961 {
962 register input_description*inp_desc;
965 if(inp_desc->type_of_file==master){
966 
967 fatal_error(-1,"! This can't happen: change file is master file","");
968 
969 }
970 inp_desc->mode= search;
973 &&actual_input> 0))
974 actual_input--;
975 }
976 }
977 
978 
979 /*:50*/
980 #line 921 "ctie.w"
981 
982 if(input_has_ended&&actual_input==0)break;
983 /*51:*/
984 #line 960 "ctie.w"
985 
988 while(test_input==none&&test_file<no_ch-1){
989 test_file++;
991 case search:
995 }
996 break;
997 case test:
999 
1001 }
1003 break;
1004 case reading:
1005 break;
1006 case ignore:
1007 break;
1008 }
1009 }
1010 
1011 
1012 /*:51*/
1013 #line 923 "ctie.w"
1014 
1015 /*52:*/
1016 #line 993 "ctie.w"
1017 
1018 if(prod_chf==chf){
1019 while(1){
1020 /*53:*/
1021 #line 1007 "ctie.w"
1022 
1023 if(out_mode==normal){
1024 if(test_input!=none){
1025 fprintf(out_file,"@x\n");
1026 out_mode= pre;
1027 }else break;
1028 }
1029 
1030 
1031 /*:53*/
1032 #line 996 "ctie.w"
1033 
1034 /*54:*/
1035 #line 1021 "ctie.w"
1036 
1037 if(out_mode==pre){
1038 if(test_input==none){
1039 fprintf(out_file,"@y\n");
1040 out_mode= post;
1041 }else{
1042 if(input_organisation[actual_input]->type_of_file==master)
1044 break;
1045 }
1046 }
1047 
1048 
1049 /*:54*/
1050 #line 997 "ctie.w"
1051 
1052 /*55:*/
1053 #line 1040 "ctie.w"
1054 
1055 if(out_mode==post){
1056 if(input_organisation[actual_input]->type_of_file==chf){
1058 break;
1059 }else{
1060 fprintf(out_file,"@z\n\n");
1061 out_mode= normal;
1062 }
1063 }
1064 
1065 
1066 /*:55*/
1067 #line 998 "ctie.w"
1068 
1069 }
1070 }else
1072 
1073 
1074 /*:52*/
1075 #line 924 "ctie.w"
1076 
1077 /*56:*/
1078 #line 1055 "ctie.w"
1079 
1080 get_line(actual_input,true);
1081 if(test_input!=none){
1082 get_line(test_input,true);
1083 if(e_of_ch_preamble(test_input)==true){
1084 get_line(test_input,true);
1087 test_input= none;
1088 }
1089 }
1090 
1091 
1092 /*:56*/
1093 #line 925 "ctie.w"
1094 
1095 }
1096 
1097 
1098 /*:49*/
1099 #line 1078 "ctie.w"
1100 
1101 if(out_mode==post)
1102 fprintf(out_file,"@z\n");
1103 
1104 
1105 /*:57*/
1106 #line 111 "ctie.w"
1107 
1108 /*58:*/
1109 #line 1087 "ctie.w"
1110 
1111 {
1112 file_index i;
1113 
1114 for(i= 1;i<no_ch;i++){
1117 err_print(i,"! Change file entry did not match");
1118 
1119 }
1120 }
1121 }
1122 
1123 
1124 /*:58*/
1125 #line 112 "ctie.w"
1126 
1127 exit(wrap_up());
1128 }
1129 
1130 #line 112 "ctie-k.ch"
1131 /*:3*/
1132 #line 96 "ctie.w"
1133 
1134 
1135 /*:2*//*68:*/
1136 #line 1237 "ctie.w"
1137 
1138 #line 632 "ctie-k.ch"
1139 static void
1141 {
1143 #line 1241 "ctie.w"
1144 
1145 while(*message){
1146 fputs(*message,stdout);
1147 putchar('\n');
1148 ++message;
1149 }
1150 putchar('\n');
1151 #line 641 "ctie-k.ch"
1153 #line 1249 "ctie.w"
1154 }
1155 
1156 
1157 /*:68*//*69:*/
1158 #line 1252 "ctie.w"
1159 
1160 #line 658 "ctie-k.ch"
1161 static void
1163 {
1164 printf("%s %s\n",name,version);
1166 
1167 puts("Copyright (C) 2002,2003 Julian Gilbey.");
1168 puts("Kpathsea is copyright (C) 1999 Free Software Foundation, Inc.");
1169 
1170 puts("There is NO warranty. This is free software.");
1171 puts("Redistribution of this software is covered by the terms of");
1172 puts("both the CTIE copyright and the GNU General Public Licence.");
1173 puts("For more information about these matters, see the files");
1174 puts("named COPYING and the CTIE source.");
1175 puts("Primary author of CTIE: Julian Gilbey.");
1176 puts("Kpathsea written by Karl Berry and others.");
1177 
1179 }
1180 #line 1265 "ctie.w"
1181 
1182 
1183 #line 695 "ctie-k.ch"
1184 /*:69*/
#define message
Definition: aptex-macros.h:418
#define name
#define mode
Definition: aptex-macros.h:510
#define buf_size
Definition: ctie-k.c:9
static boolean lines_dont_match(file_index i, file_index j)
Definition: ctie-k.c:572
file_types
Definition: ctie-k.c:57
@ unknown
Definition: ctie-k.c:58
@ chf
Definition: ctie-k.c:60
@ master
Definition: ctie-k.c:59
#define version_number
Definition: ctie-k.c:1
static boolean e_of_ch_module(file_index i)
Definition: ctie-k.c:658
static void print_version_and_exit(const_string, const_string)
Definition: ctie-k.c:1162
boolean input_has_ended
Definition: ctie-k.c:179
#define fatal_error(i, s, t)
Definition: ctie-k.c:22
#define max_file_name_length
Definition: ctie-k.c:17
static void usage_error(void)
Definition: ctie-k.c:704
int wrap_up(void)
Definition: ctie-k.c:543
out_md_type
Definition: ctie-k.c:69
@ pre
Definition: ctie-k.c:71
@ post
Definition: ctie-k.c:72
@ normal
Definition: ctie-k.c:70
static boolean e_of_ch_preamble(file_index i)
Definition: ctie-k.c:680
const_string CTIEHELP[]
Definition: ctie-k.c:194
void pfatal_error(const char *, const char *)
Definition: ctie-k.c:268
struct _idsc input_description
out_md_type out_mode
Definition: ctie-k.c:168
#define banner
Definition: ctie-k.c:2
static void init_change_file(file_index i)
Definition: ctie-k.c:589
void err_print(file_index, const char *)
Definition: ctie-k.c:216
file_index actual_input
Definition: ctie-k.c:166
#define kpse_find_cweb(name)
Definition: ctie-k.c:32
#define none
Definition: ctie-k.c:30
static void put_line(file_index j)
Definition: ctie-k.c:642
int file_index
Definition: ctie-k.c:79
input_description * input_organisation[32+1]
Definition: ctie-k.c:173
static return_code history
Definition: ctie-k.c:154
#define max_file_index
Definition: ctie-k.c:10
static void usage_help(void)
Definition: ctie-k.c:1140
in_file_modes
Definition: ctie-k.c:52
@ ignore
Definition: ctie-k.c:56
@ reading
Definition: ctie-k.c:55
@ search
Definition: ctie-k.c:53
@ test
Definition: ctie-k.c:54
return_code
Definition: ctie-k.c:150
@ spotless
Definition: ctie-k.c:151
@ troublesome
Definition: ctie-k.c:152
@ fatal
Definition: ctie-k.c:153
file_index test_input
Definition: ctie-k.c:166
FILE * out_file
Definition: ctie-k.c:185
static boolean get_line(file_index i, boolean do_includes)
Definition: ctie-k.c:290
struct _indsc include_description
#define max_include_files
Definition: ctie-k.c:15
int main(int argc, string *argv)
Definition: ctie-k.c:734
#define too_long()
Definition: ctie-k.c:19
string out_name
Definition: ctie-k.c:186
#define copyright
Definition: ctie-k.c:3
int total_include_files
Definition: ctie-k.c:161
#define xisupper(c)
Definition: ctie-k.c:12
file_index no_ch
Definition: ctie-k.c:166
file_types prod_chf
Definition: ctie-k.c:167
#define free(a)
Definition: decNumber.cpp:310
#define fopen
Definition: xxstdio.h:21
#define fflush
Definition: xxstdio.h:24
int strcmp()
Definition: coll.cpp:143
int printf()
char * temp
Definition: dvidvi.c:137
#define s
Definition: afcover.h:80
#define c(n)
Definition: gpos-common.c:150
#define putc
Definition: jbib.h:20
#define EXIT_SUCCESS
Definition: cdjpeg.h:175
#define EXIT_FAILURE
Definition: cdjpeg.h:169
#define NULL
Definition: ftobjs.h:61
small capitals from c petite p scientific i
Definition: afcover.h:80
void exit()
#define EOF
Definition: afmparse.c:59
int errno
#define fclose
Definition: debug.h:100
#define getc
Definition: line.c:39
const char * const_string
Definition: simpletypes.h:59
const char * kpathsea_version_string
Definition: version.c:23
#define fputs
Definition: mendex.h:67
#define fprintf
Definition: mendex.h:64
static char * strerror(int errnum)
Definition: error.c:56
static eight_bits ccode[256]
Definition: ctangleboot.c:354
char file_name[][1024]
Definition: cwebboot.c:318
char * buffer_end
Definition: cwebboot.c:308
#define malloc
Definition: alloca.c:91
int strncmp()
static int test_file(char c, char *name)
Definition: mktexmf.c:25
#define version
Definition: nup.c:10
int k
Definition: otp-parser.c:70
set set set set set set set set set set set set set set set set set set set set *set set set macro pixldst op &r &cond WK op &r &cond WK op &r &cond WK else op &m &cond &ia op &r &cond WK else op &m &cond &ia elseif elseif else error unsupported base if elseif elseif else error unsupported unaligned pixldst unaligned endm macro pixst base base else pixldst base endif endm macro PF ptr
#define fp
#define tolower(ch)
Definition: utype.h:137
Definition: ctie-k.c:96
int dont_match
Definition: ctie-k.c:107
string file_name
Definition: ctie-k.c:97
char * loc
Definition: ctie-k.c:105
FILE * the_file
Definition: ctie-k.c:106
long line
Definition: ctie-k.c:100
in_file_modes mode
Definition: ctie-k.c:99
file_types type_of_file
Definition: ctie-k.c:101
char * buffer_end
Definition: ctie-k.c:103
char * limit
Definition: ctie-k.c:104
char buffer[1024]
Definition: ctie-k.c:98
include_description * current_include
Definition: ctie-k.c:102
Definition: ctie-k.c:85
char file_name[1024]
Definition: ctie-k.c:86
struct _indsc * parent
Definition: ctie-k.c:89
FILE * the_file
Definition: ctie-k.c:88
long line
Definition: ctie-k.c:87
Definition: utils.c:300
Definition: ttf.h:449
Definition: dvips.h:235
#define FILE
Definition: t1stdio.h:34
#define ungetc(c, f)
Definition: t1stdio.h:106
#define feof(f)
Definition: t1stdio.h:109
int j
Definition: t4ht.c:1589
#define argv
Definition: xmain.c:270
#define argc
Definition: xmain.c:269