37 extern "C" { |
37 extern "C" { |
38 #endif |
38 #endif |
39 |
39 |
40 #define VERSION_MAJOR 2 |
40 #define VERSION_MAJOR 2 |
41 #define VERSION_MINOR 0 |
41 #define VERSION_MINOR 0 |
42 #define VERSION_DEVELOP 1 /* set this to zero for release version */ |
42 #define VERSION_DEVELOP 0 /* set this to zero for release version */ |
43 |
43 |
44 /** |
44 /** |
45 * Reads a source file from the input buffer and writes at most |
45 * Reads a source file from the input buffer and writes at most |
46 * <code>maxlen</code> bytes of the formatted output to the output buffer. |
46 * <code>maxlen</code> bytes of the formatted output to the output buffer. |
47 * |
47 * |
48 * The output buffer must either be large enough to hold <code>maxlen</code> |
48 * The output buffer must either be large enough to hold <code>maxlen</code> |
49 * bytes or the write function must trigger an automatic extension of the buffer. |
49 * bytes or the write function must trigger an automatic extension of the |
|
50 * buffer. |
|
51 * |
|
52 * The input is copied via an intermediate buffer to an internal buffer. |
50 * |
53 * |
51 * @param inputbuffer the input buffer |
54 * @param inputbuffer the input buffer |
52 * @param rfnc a read function operating for the input buffer |
55 * @param rfnc a read function operating for the input buffer |
53 * @param ibuf intermediate processing buffer |
56 * @param ibuf intermediate processing buffer |
54 * @param ibuflen length of intermediate processing buffer (recommended: 4 KB) |
57 * @param ibuflen length of intermediate processing buffer |
55 * @param outputbuffer the output buffer |
58 * @param outputbuffer the output buffer |
56 * @param wfnc a write function for the output buffer |
59 * @param wfnc a write function for the output buffer |
57 * @param maxlen the maximum amount bytes which will be written to the |
60 * @param maxlen the maximum amount bytes which will be written to the |
58 * output buffer |
61 * output buffer |
59 * @param hltr the highlighter function |
62 * @param hltr the highlighter function |
74 * to an output buffer. |
77 * to an output buffer. |
75 * |
78 * |
76 * The output buffer must either be large enough to hold the formatted data |
79 * The output buffer must either be large enough to hold the formatted data |
77 * or the write function must trigger an automatic extension of the buffer. |
80 * or the write function must trigger an automatic extension of the buffer. |
78 * |
81 * |
|
82 * The input is copied via an intermediate buffer to an internal buffer. |
|
83 * |
79 * @param inputbuffer the input buffer |
84 * @param inputbuffer the input buffer |
80 * @param rfnc a read function operating for the input buffer |
85 * @param rfnc a read function operating for the input buffer |
81 * @param ibuf intermediate processing buffer |
86 * @param ibuf intermediate processing buffer |
82 * @param ibuflen length of intermediate processing buffer (recommended: 4 KB) |
87 * @param ibuflen length of intermediate processing buffer |
83 * @param outputbuffer the output buffer |
88 * @param outputbuffer the output buffer |
84 * @param wfnc a write function for the output buffer |
89 * @param wfnc a write function for the output buffer |
85 * @param hltr the highlighter function |
90 * @param hltr the highlighter function |
86 * @param showln zero, if line numbers shall be omitted, nonzero otherwise |
91 * @param showln zero, if line numbers shall be omitted, nonzero otherwise |
87 * |
92 * |
100 * formatted output to an output buffer. |
105 * formatted output to an output buffer. |
101 * |
106 * |
102 * The output buffer must either be large enough to hold the formatted data |
107 * The output buffer must either be large enough to hold the formatted data |
103 * or the write function must trigger an automatic extension of the buffer. |
108 * or the write function must trigger an automatic extension of the buffer. |
104 * |
109 * |
|
110 * The input is copied via an intermediate buffer to an internal buffer. |
|
111 * For files, the recommended intermediate buffer length is the file system |
|
112 * block size. |
|
113 * |
105 * @param inputfile the input file stream |
114 * @param inputfile the input file stream |
106 * @param ibuf intermediate processing buffer |
115 * @param ibuf intermediate processing buffer |
107 * @param ibuflen length of intermediate processing buffer (recommended: 4 KB) |
116 * @param ibuflen length of intermediate processing buffer |
108 * @param outputbuffer the output buffer |
117 * @param outputbuffer the output buffer |
109 * @param wfnc a write function for the output buffer |
118 * @param wfnc a write function for the output buffer |
110 * @param hltr the highlighter function |
119 * @param hltr the highlighter function |
111 * @param showln zero, if line numbers shall be omitted, nonzero otherwise |
120 * @param showln zero, if line numbers shall be omitted, nonzero otherwise |
112 * |
121 * |
113 * @return total amount of bytes written to the output buffer |
122 * @return total amount of bytes written to the output buffer |
114 * |
123 * |
115 * @see c2html_plain_highlighter() |
124 * @see c2html_plain_highlighter() |
116 * @see c2html_c_highlighter() |
125 * @see c2html_c_highlighter() |
117 * @see c2html_java_highlighter() |
126 * @see c2html_java_highlighter() |
118 */ |
127 */ |
119 size_t c2html_format_file(FILE* inputfile, char *ibuf, size_t ibuflen, |
128 size_t c2html_fformat(FILE* inputfile, char *ibuf, size_t ibuflen, |
120 void* outputbuffer, write_func wfnc, |
129 void* outputbuffer, write_func wfnc, |
121 c2html_highlighter_func hltr, int showln); |
130 c2html_highlighter_func hltr, int showln); |
122 |
131 |
123 /** |
132 /** |
124 * Reads a source file from the specified input file stream and directly writes |
133 * Reads a source file from the specified input file stream and directly writes |
125 * the formatted output to the output file stream. |
134 * the formatted output to the output file stream. |
126 * |
135 * |
|
136 * For files, the recommended intermediate buffer length is the file system |
|
137 * block size. |
|
138 * |
127 * @param inputfile the input file stream |
139 * @param inputfile the input file stream |
128 * @param ibuf intermediate processing buffer |
140 * @param ibuf intermediate processing buffer |
129 * @param ibuflen length of intermediate processing buffer (recommended: 4 KB) |
141 * @param ibuflen length of intermediate processing buffer (recommended: 4 KB) |
130 * @param outputfile the output file stream |
142 * @param outputfile the output file stream |
131 * @param hltr the highlighter function |
143 * @param hltr the highlighter function |
133 * |
145 * |
134 * @see c2html_plain_highlighter() |
146 * @see c2html_plain_highlighter() |
135 * @see c2html_c_highlighter() |
147 * @see c2html_c_highlighter() |
136 * @see c2html_java_highlighter() |
148 * @see c2html_java_highlighter() |
137 */ |
149 */ |
138 void c2html_fformat_file(FILE *inputfile, char *ibuf, size_t ibuflen, |
150 void c2html_fformatf(FILE *inputfile, char *ibuf, size_t ibuflen, |
|
151 FILE* outputfile, c2html_highlighter_func hltr, int showln); |
|
152 |
|
153 |
|
154 /** |
|
155 * Writes at most <code>maxlen</code> bytes of formatted source data to the |
|
156 * output buffer. |
|
157 * |
|
158 * @param inputbuffer the source file data as string |
|
159 * @param inputbuflen the length of the source file |
|
160 * @param outputbuffer the output buffer |
|
161 * @param wfnc a write function for the output buffer |
|
162 * @param maxlen the maximum amount bytes which will be written to the |
|
163 * output buffer |
|
164 * @param hltr the highlighter function |
|
165 * @param showln zero, if line numbers shall be omitted, nonzero otherwise |
|
166 * |
|
167 * @return total amount of bytes written to the output buffer |
|
168 * |
|
169 * @see c2html_plain_highlighter() |
|
170 * @see c2html_c_highlighter() |
|
171 * @see c2html_java_highlighter() |
|
172 */ |
|
173 size_t c2html_bformatn(const char* inputbuffer, size_t inputbuflen, |
|
174 void* outputbuffer, write_func wfnc, |
|
175 size_t maxlen, c2html_highlighter_func hltr, int showln); |
|
176 |
|
177 |
|
178 /** |
|
179 * Writes the formatted source data to the output buffer. |
|
180 * |
|
181 * @param inputbuffer the source file data as string |
|
182 * @param inputbuflen the length of the source file |
|
183 * @param outputbuffer the output buffer |
|
184 * @param wfnc a write function for the output buffer |
|
185 * @param hltr the highlighter function |
|
186 * @param showln zero, if line numbers shall be omitted, nonzero otherwise |
|
187 * |
|
188 * @return total amount of bytes written to the output buffer |
|
189 * |
|
190 * @see c2html_plain_highlighter() |
|
191 * @see c2html_c_highlighter() |
|
192 * @see c2html_java_highlighter() |
|
193 */ |
|
194 size_t c2html_bformat(const char* inputbuffer, size_t inputbuflen, |
|
195 void* outputbuffer, write_func wfnc, |
|
196 c2html_highlighter_func hltr, int showln); |
|
197 |
|
198 |
|
199 /** |
|
200 * Writes the formatted source data directly to the specified file stream. |
|
201 * |
|
202 * @param inputbuffer the source file data as string |
|
203 * @param inputbuflen the length of the source file |
|
204 * @param outputfile the output file stream |
|
205 * @param hltr the highlighter function |
|
206 * @param showln zero, if line numbers shall be omitted, nonzero otherwise |
|
207 * |
|
208 * @see c2html_plain_highlighter() |
|
209 * @see c2html_c_highlighter() |
|
210 * @see c2html_java_highlighter() |
|
211 */ |
|
212 void c2html_bformatf(const char* inputbuffer, size_t inputbuflen, |
139 FILE* outputfile, c2html_highlighter_func hltr, int showln); |
213 FILE* outputfile, c2html_highlighter_func hltr, int showln); |
140 |
214 |
141 #ifdef __cplusplus |
215 #ifdef __cplusplus |
142 } |
216 } |
143 #endif |
217 #endif |