src/c2html.h

changeset 55
bf54085ce341
parent 52
33ded421c512
child 56
81d99e9ceb20
equal deleted inserted replaced
54:b3f24e23bc25 55:bf54085ce341
28 */ 28 */
29 29
30 #ifndef C2HTML_H 30 #ifndef C2HTML_H
31 #define C2HTML_H 31 #define C2HTML_H
32 32
33 #include <stdio.h>
34 #include "highlighter.h"
35
33 #ifdef __cplusplus 36 #ifdef __cplusplus
34 extern "C" { 37 extern "C" {
35 #endif 38 #endif
36 39
37 #define VERSION_MAJOR 2 40 #define VERSION_MAJOR 2
38 #define VERSION_MINOR 0 41 #define VERSION_MINOR 0
39 #define VERSION_DEVELOP 1 /* set this to zero for release version */ 42 #define VERSION_DEVELOP 1 /* set this to zero for release version */
40 43
41 typedef struct { 44 /**
42 char* outfilename; 45 * Reads a source file from the input buffer and writes at most
43 char* headerfile; 46 * <code>maxlen</code> bytes of the formatted output to the output buffer.
44 char* footerfile; 47 *
45 char* infilename; 48 * The output buffer must either be large enough to hold <code>maxlen</code>
46 int showlinenumbers; 49 * bytes or the write function must trigger an automatic extension of the buffer.
47 } Settings; 50 *
51 * @param inputbuffer the input buffer
52 * @param rfnc a read function operating for the input buffer
53 * @param ibuf intermediate processing buffer
54 * @param ibuflen length of intermediate processing buffer (recommended: 4 KB)
55 * @param outputbuffer the output buffer
56 * @param wfnc a write function for the output buffer
57 * @param maxlen the maximum amount bytes which will be written to the
58 * output buffer
59 * @param hltr the highlighter function
60 * @param showln zero, if line numbers shall be omitted, nonzero otherwise
61 *
62 * @return total amount of bytes written to the output buffer
63 *
64 * @see c2html_plain_highlighter()
65 * @see c2html_c_highlighter()
66 * @see c2html_java_highlighter()
67 */
68 size_t c2html_formatn(void* inputbuffer, read_func rfnc,
69 char* ibuf, size_t ibuflen, void* outputbuffer, write_func wfnc,
70 size_t maxlen, c2html_highlighter_func hltr, int showln);
71
72 /**
73 * Reads a source file from the input buffer and writes the formatted output
74 * to an output buffer.
75 *
76 * 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.
78 *
79 * @param inputbuffer the input buffer
80 * @param rfnc a read function operating for the input buffer
81 * @param ibuf intermediate processing buffer
82 * @param ibuflen length of intermediate processing buffer (recommended: 4 KB)
83 * @param outputbuffer the output buffer
84 * @param wfnc a write function for the output buffer
85 * @param hltr the highlighter function
86 * @param showln zero, if line numbers shall be omitted, nonzero otherwise
87 *
88 * @return total amount of bytes written to the output buffer
89 *
90 * @see c2html_plain_highlighter()
91 * @see c2html_c_highlighter()
92 * @see c2html_java_highlighter()
93 */
94 size_t c2html_format(void* inputbuffer, read_func rfnc,
95 char* ibuf, size_t ibuflen, void* outputbuffer, write_func wfnc,
96 c2html_highlighter_func hltr, int showln);
48 97
98 /**
99 * Reads a source file from the specified input file stream and writes the
100 * formatted output to an output buffer.
101 *
102 * 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.
104 *
105 * @param inputfile the input file stream
106 * @param ibuf intermediate processing buffer
107 * @param ibuflen length of intermediate processing buffer (recommended: 4 KB)
108 * @param outputbuffer the output buffer
109 * @param wfnc a write function for the output buffer
110 * @param hltr the highlighter function
111 * @param showln zero, if line numbers shall be omitted, nonzero otherwise
112 *
113 * @return total amount of bytes written to the output buffer
114 *
115 * @see c2html_plain_highlighter()
116 * @see c2html_c_highlighter()
117 * @see c2html_java_highlighter()
118 */
119 size_t c2html_format_file(FILE* inputfile, char *ibuf, size_t ibuflen,
120 void* outputbuffer, write_func wfnc,
121 c2html_highlighter_func hltr, int showln);
122
123 /**
124 * Reads a source file from the specified input file stream and directly writes
125 * the formatted output to the output file stream.
126 *
127 * @param inputfile the input file stream
128 * @param ibuf intermediate processing buffer
129 * @param ibuflen length of intermediate processing buffer (recommended: 4 KB)
130 * @param outputfile the output file stream
131 * @param hltr the highlighter function
132 * @param showln zero, if line numbers shall be omitted, nonzero otherwise
133 *
134 * @see c2html_plain_highlighter()
135 * @see c2html_c_highlighter()
136 * @see c2html_java_highlighter()
137 */
138 void c2html_fformat_file(FILE *inputfile, char *ibuf, size_t ibuflen,
139 FILE* outputfile, c2html_highlighter_func hltr, int showln);
49 140
50 #ifdef __cplusplus 141 #ifdef __cplusplus
51 } 142 }
52 #endif 143 #endif
53 144

mercurial