File: cxref-1.5c-webcpp.patch

package info (click to toggle)
cxref 1.6c-2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 2,608 kB
  • ctags: 2,058
  • sloc: ansic: 18,218; yacc: 2,086; sh: 915; lex: 462; perl: 452; makefile: 418; lisp: 256; cpp: 188; python: 80
file content (126 lines) | stat: -rw-r--r-- 4,128 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
diff -ru cxref-1.5c/cxref.c cxref-1.5cu1/cxref.c
--- cxref-1.5c/cxref.c	Sat Jan  6 14:05:12 2001
+++ cxref-1.5cu1/cxref.c	Mon Feb 18 17:41:20 2002
@@ -57,6 +57,7 @@
     option_xref=0,                      /*+ do cross referencing. +*/
     option_warn=0,                      /*+ produce warnings. +*/
     option_index=0,                     /*+ produce an index. +*/
+    option_webcpp=0,                    /*+ use webcpp for sources +*/
     option_raw=0,                       /*+ produce raw output. +*/
     option_latex=0,                     /*+ produce LaTeX output. +*/
     option_html=0,                      /*+ produce HTML output. +*/
@@ -379,6 +380,7 @@
        "             [-warn[-all][-comment][-xref]]\n"
        "             [-index[-all][-file][-func][-var][-type]]\n"
        "             [-latex209|-latex2e] [-html20|-html32] [-rtf] [-sgml] [-raw]\n"
+       "             [-webcpp]\n"
        "             [-Idirname] [-Ddefine] [-Udefine]\n"
        "             [-CPP cpp_program] [-- cpp_arg [ ... cpp_arg]]\n"
        "\n"
@@ -407,6 +409,7 @@
           "\n"
           "-latex209 | -latex2e   : Produce LaTeX output (version 2.09 or 2e - default=2e).\n"
           "-html20 | -html32      : Produce HTML output (version 2.0 or 3.2 - default=3.2).\n"
+	  "  -webcpp              : use webcpp to colorize sources.\n"
           "-rtf                   : Produce RTF output (version 1.x).\n"
           "-sgml                  : Produce SGML output (for SGML tools version 1.0.x).\n"
           "-raw                   : Produce raw output .\n"
@@ -678,6 +681,9 @@
 
     if(!strcmp(args[i],"-no-comments"))
       {option_no_comments=1; run_command=ConcatStrings(3,run_command," ",args[i]); continue;}
+
+    if(!strcmp(args[i],"-webcpp"))
+      {option_webcpp=1; run_command=ConcatStrings(3,run_command," ",args[i]); continue;}
 
     if(!strncmp(args[i],"-xref",5))
       {
diff -ru cxref-1.5c/html.c cxref-1.5cu1/html.c
--- cxref-1.5c/html.c	Sat Jan  6 14:05:12 2001
+++ cxref-1.5cu1/html.c	Fri Feb 15 18:18:06 2002
@@ -42,6 +42,9 @@
 /*+ The comments are to be inserted verbatim. +*/
 extern int option_verbatim_comments;
 
+/*+ wether to use webcpp for source highlighting +*/
+extern int option_webcpp;
+
 /*+ The type of HTML output to produce. +*/
 extern int option_html;
 
@@ -1426,38 +1429,43 @@
  ifile=name;
  ofile=ConcatStrings(4,option_odir,"/",name,HTML_SRC_FILE);
 
- in =fopen(ifile,"r");
- if(!in)
-   {fprintf(stderr,"cxref: Failed to open the source file '%s'\n",ifile);exit(1);}
-
- out=fopen(ofile,"w");
- if(!out)
-   {fprintf(stderr,"cxref: Failed to open the HTML output source file '%s'\n",ofile);exit(1);}
-
- WriteHTMLPreamble(out,ConcatStrings(2,"Source File ",name),0);
- fputs("<pre>\n",out);
-
- strcpy(pad,"    ");
-
- while(fgets(line,256,in))
-   {
-    lineno++;
-    if(lineno==10)
-       pad[3]=0;
-    else if(lineno==100)
-       pad[2]=0;
-    else if(lineno==1000)
-       pad[1]=0;
-    else if(lineno==10000)
-       pad[0]=0;
-    fprintf(out,"<a name=\"line%d\">%d%s|</a> %s",lineno,lineno,pad,html(line,1));
-   }
-
- fputs("</pre>\n",out);
- WriteHTMLPostamble(out,0);
-
- fclose(in);
- fclose(out);
+ if(option_webcpp) {
+   snprintf(line, 256, "webcpp %s %s -l -x", ifile, ofile);
+   system (line);
+ } else {
+   in =fopen(ifile,"r");
+   if(!in)
+     {fprintf(stderr,"cxref: Failed to open the source file '%s'\n",ifile);exit(1);}
+   
+   out=fopen(ofile,"w");
+   if(!out)
+     {fprintf(stderr,"cxref: Failed to open the HTML output source file '%s'\n",ofile);exit(1);}
+   
+   WriteHTMLPreamble(out,ConcatStrings(2,"Source File ",name),0);
+   fputs("<pre>\n",out);
+   
+   strcpy(pad,"    ");
+   
+   while(fgets(line,256,in))
+     {
+       lineno++;
+       if(lineno==10)
+	 pad[3]=0;
+       else if(lineno==100)
+	 pad[2]=0;
+       else if(lineno==1000)
+	 pad[1]=0;
+       else if(lineno==10000)
+	 pad[0]=0;
+       fprintf(out,"<a name=\"line%d\">%d%s|</a> %s",lineno,lineno,pad,html(line,1));
+     }
+   
+   fputs("</pre>\n",out);
+   WriteHTMLPostamble(out,0);
+   
+   fclose(in);
+   fclose(out);
+ }
 }