don't check when its clang masquerading as gcc
[AROS.git] / tools / cxref / contrib / cxref-1.5c-webcpp.patch
blobf5ac90732e700e5a3fee3b6da57317c6ce979900
1 diff -ru cxref-1.5c/cxref.c cxref-1.5cu1/cxref.c
2 --- cxref-1.5c/cxref.c Sat Jan 6 14:05:12 2001
3 +++ cxref-1.5cu1/cxref.c Mon Feb 18 17:41:20 2002
4 @@ -57,6 +57,7 @@
5 option_xref=0, /*+ do cross referencing. +*/
6 option_warn=0, /*+ produce warnings. +*/
7 option_index=0, /*+ produce an index. +*/
8 + option_webcpp=0, /*+ use webcpp for sources +*/
9 option_raw=0, /*+ produce raw output. +*/
10 option_latex=0, /*+ produce LaTeX output. +*/
11 option_html=0, /*+ produce HTML output. +*/
12 @@ -379,6 +380,7 @@
13 " [-warn[-all][-comment][-xref]]\n"
14 " [-index[-all][-file][-func][-var][-type]]\n"
15 " [-latex209|-latex2e] [-html20|-html32] [-rtf] [-sgml] [-raw]\n"
16 + " [-webcpp]\n"
17 " [-Idirname] [-Ddefine] [-Udefine]\n"
18 " [-CPP cpp_program] [-- cpp_arg [ ... cpp_arg]]\n"
19 "\n"
20 @@ -407,6 +409,7 @@
21 "\n"
22 "-latex209 | -latex2e : Produce LaTeX output (version 2.09 or 2e - default=2e).\n"
23 "-html20 | -html32 : Produce HTML output (version 2.0 or 3.2 - default=3.2).\n"
24 + " -webcpp : use webcpp to colorize sources.\n"
25 "-rtf : Produce RTF output (version 1.x).\n"
26 "-sgml : Produce SGML output (for SGML tools version 1.0.x).\n"
27 "-raw : Produce raw output .\n"
28 @@ -678,6 +681,9 @@
30 if(!strcmp(args[i],"-no-comments"))
31 {option_no_comments=1; run_command=ConcatStrings(3,run_command," ",args[i]); continue;}
33 + if(!strcmp(args[i],"-webcpp"))
34 + {option_webcpp=1; run_command=ConcatStrings(3,run_command," ",args[i]); continue;}
36 if(!strncmp(args[i],"-xref",5))
38 diff -ru cxref-1.5c/html.c cxref-1.5cu1/html.c
39 --- cxref-1.5c/html.c Sat Jan 6 14:05:12 2001
40 +++ cxref-1.5cu1/html.c Fri Feb 15 18:18:06 2002
41 @@ -42,6 +42,9 @@
42 /*+ The comments are to be inserted verbatim. +*/
43 extern int option_verbatim_comments;
45 +/*+ wether to use webcpp for source highlighting +*/
46 +extern int option_webcpp;
48 /*+ The type of HTML output to produce. +*/
49 extern int option_html;
51 @@ -1426,38 +1429,43 @@
52 ifile=name;
53 ofile=ConcatStrings(4,option_odir,"/",name,HTML_SRC_FILE);
55 - in =fopen(ifile,"r");
56 - if(!in)
57 - {fprintf(stderr,"cxref: Failed to open the source file '%s'\n",ifile);exit(1);}
59 - out=fopen(ofile,"w");
60 - if(!out)
61 - {fprintf(stderr,"cxref: Failed to open the HTML output source file '%s'\n",ofile);exit(1);}
63 - WriteHTMLPreamble(out,ConcatStrings(2,"Source File ",name),0);
64 - fputs("<pre>\n",out);
66 - strcpy(pad," ");
68 - while(fgets(line,256,in))
69 - {
70 - lineno++;
71 - if(lineno==10)
72 - pad[3]=0;
73 - else if(lineno==100)
74 - pad[2]=0;
75 - else if(lineno==1000)
76 - pad[1]=0;
77 - else if(lineno==10000)
78 - pad[0]=0;
79 - fprintf(out,"<a name=\"line%d\">%d%s|</a> %s",lineno,lineno,pad,html(line,1));
80 - }
82 - fputs("</pre>\n",out);
83 - WriteHTMLPostamble(out,0);
85 - fclose(in);
86 - fclose(out);
87 + if(option_webcpp) {
88 + snprintf(line, 256, "webcpp %s %s -l -x", ifile, ofile);
89 + system (line);
90 + } else {
91 + in =fopen(ifile,"r");
92 + if(!in)
93 + {fprintf(stderr,"cxref: Failed to open the source file '%s'\n",ifile);exit(1);}
95 + out=fopen(ofile,"w");
96 + if(!out)
97 + {fprintf(stderr,"cxref: Failed to open the HTML output source file '%s'\n",ofile);exit(1);}
99 + WriteHTMLPreamble(out,ConcatStrings(2,"Source File ",name),0);
100 + fputs("<pre>\n",out);
102 + strcpy(pad," ");
104 + while(fgets(line,256,in))
106 + lineno++;
107 + if(lineno==10)
108 + pad[3]=0;
109 + else if(lineno==100)
110 + pad[2]=0;
111 + else if(lineno==1000)
112 + pad[1]=0;
113 + else if(lineno==10000)
114 + pad[0]=0;
115 + fprintf(out,"<a name=\"line%d\">%d%s|</a> %s",lineno,lineno,pad,html(line,1));
118 + fputs("</pre>\n",out);
119 + WriteHTMLPostamble(out,0);
121 + fclose(in);
122 + fclose(out);