src/c2html.h

Mon, 03 Oct 2022 12:56:28 +0200

author
Mike Becker <universe@uap-core.de>
date
Mon, 03 Oct 2022 12:56:28 +0200
changeset 65
7dd4fd1e7071
parent 57
eba880c1705c
child 66
1b12cf799fee
permissions
-rw-r--r--

rewrite Makefile to work with different getopt implementations

22
f463693b5eeb added command line parameters for header and footer file
Mike Becker <universe@uap-core.de>
parents:
diff changeset
1 /*
f463693b5eeb added command line parameters for header and footer file
Mike Becker <universe@uap-core.de>
parents:
diff changeset
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
f463693b5eeb added command line parameters for header and footer file
Mike Becker <universe@uap-core.de>
parents:
diff changeset
3 *
35
abaf2489c549 adjusted copyright info
Mike Becker <universe@uap-core.de>
parents: 24
diff changeset
4 * Copyright 2016 Mike Becker. All rights reserved.
22
f463693b5eeb added command line parameters for header and footer file
Mike Becker <universe@uap-core.de>
parents:
diff changeset
5 *
f463693b5eeb added command line parameters for header and footer file
Mike Becker <universe@uap-core.de>
parents:
diff changeset
6 * Redistribution and use in source and binary forms, with or without
f463693b5eeb added command line parameters for header and footer file
Mike Becker <universe@uap-core.de>
parents:
diff changeset
7 * modification, are permitted provided that the following conditions are met:
f463693b5eeb added command line parameters for header and footer file
Mike Becker <universe@uap-core.de>
parents:
diff changeset
8 *
f463693b5eeb added command line parameters for header and footer file
Mike Becker <universe@uap-core.de>
parents:
diff changeset
9 * 1. Redistributions of source code must retain the above copyright
f463693b5eeb added command line parameters for header and footer file
Mike Becker <universe@uap-core.de>
parents:
diff changeset
10 * notice, this list of conditions and the following disclaimer.
f463693b5eeb added command line parameters for header and footer file
Mike Becker <universe@uap-core.de>
parents:
diff changeset
11 *
f463693b5eeb added command line parameters for header and footer file
Mike Becker <universe@uap-core.de>
parents:
diff changeset
12 * 2. Redistributions in binary form must reproduce the above copyright
f463693b5eeb added command line parameters for header and footer file
Mike Becker <universe@uap-core.de>
parents:
diff changeset
13 * notice, this list of conditions and the following disclaimer in the
f463693b5eeb added command line parameters for header and footer file
Mike Becker <universe@uap-core.de>
parents:
diff changeset
14 * documentation and/or other materials provided with the distribution.
f463693b5eeb added command line parameters for header and footer file
Mike Becker <universe@uap-core.de>
parents:
diff changeset
15 *
f463693b5eeb added command line parameters for header and footer file
Mike Becker <universe@uap-core.de>
parents:
diff changeset
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
f463693b5eeb added command line parameters for header and footer file
Mike Becker <universe@uap-core.de>
parents:
diff changeset
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
f463693b5eeb added command line parameters for header and footer file
Mike Becker <universe@uap-core.de>
parents:
diff changeset
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
f463693b5eeb added command line parameters for header and footer file
Mike Becker <universe@uap-core.de>
parents:
diff changeset
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
f463693b5eeb added command line parameters for header and footer file
Mike Becker <universe@uap-core.de>
parents:
diff changeset
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
f463693b5eeb added command line parameters for header and footer file
Mike Becker <universe@uap-core.de>
parents:
diff changeset
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
f463693b5eeb added command line parameters for header and footer file
Mike Becker <universe@uap-core.de>
parents:
diff changeset
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
f463693b5eeb added command line parameters for header and footer file
Mike Becker <universe@uap-core.de>
parents:
diff changeset
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
f463693b5eeb added command line parameters for header and footer file
Mike Becker <universe@uap-core.de>
parents:
diff changeset
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
f463693b5eeb added command line parameters for header and footer file
Mike Becker <universe@uap-core.de>
parents:
diff changeset
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
f463693b5eeb added command line parameters for header and footer file
Mike Becker <universe@uap-core.de>
parents:
diff changeset
26 * POSSIBILITY OF SUCH DAMAGE.
f463693b5eeb added command line parameters for header and footer file
Mike Becker <universe@uap-core.de>
parents:
diff changeset
27 *
f463693b5eeb added command line parameters for header and footer file
Mike Becker <universe@uap-core.de>
parents:
diff changeset
28 */
f463693b5eeb added command line parameters for header and footer file
Mike Becker <universe@uap-core.de>
parents:
diff changeset
29
f463693b5eeb added command line parameters for header and footer file
Mike Becker <universe@uap-core.de>
parents:
diff changeset
30 #ifndef C2HTML_H
56
81d99e9ceb20 fixes ancient header macro
Mike Becker <universe@uap-core.de>
parents: 55
diff changeset
31 #define C2HTML_H
22
f463693b5eeb added command line parameters for header and footer file
Mike Becker <universe@uap-core.de>
parents:
diff changeset
32
55
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
33 #include <stdio.h>
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
34 #include "highlighter.h"
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
35
56
81d99e9ceb20 fixes ancient header macro
Mike Becker <universe@uap-core.de>
parents: 55
diff changeset
36 #ifdef __cplusplus
22
f463693b5eeb added command line parameters for header and footer file
Mike Becker <universe@uap-core.de>
parents:
diff changeset
37 extern "C" {
f463693b5eeb added command line parameters for header and footer file
Mike Becker <universe@uap-core.de>
parents:
diff changeset
38 #endif
37
1a67185e5496 adds version number and changes build system
Mike Becker <universe@uap-core.de>
parents: 35
diff changeset
39
1a67185e5496 adds version number and changes build system
Mike Becker <universe@uap-core.de>
parents: 35
diff changeset
40 #define VERSION_MAJOR 2
1a67185e5496 adds version number and changes build system
Mike Becker <universe@uap-core.de>
parents: 35
diff changeset
41 #define VERSION_MINOR 0
57
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
42 #define VERSION_DEVELOP 0 /* set this to zero for release version */
22
f463693b5eeb added command line parameters for header and footer file
Mike Becker <universe@uap-core.de>
parents:
diff changeset
43
55
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
44 /**
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
45 * Reads a source file from the input buffer and writes at most
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
46 * <code>maxlen</code> bytes of the formatted output to the output buffer.
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
47 *
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
48 * The output buffer must either be large enough to hold <code>maxlen</code>
57
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
49 * bytes or the write function must trigger an automatic extension of the
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
50 * buffer.
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
51 *
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
52 * The input is copied via an intermediate buffer to an internal buffer.
55
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
53 *
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
54 * @param inputbuffer the input buffer
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
55 * @param rfnc a read function operating for the input buffer
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
56 * @param ibuf intermediate processing buffer
57
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
57 * @param ibuflen length of intermediate processing buffer
55
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
58 * @param outputbuffer the output buffer
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
59 * @param wfnc a write function for the output buffer
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
60 * @param maxlen the maximum amount bytes which will be written to the
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
61 * output buffer
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
62 * @param hltr the highlighter function
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
63 * @param showln zero, if line numbers shall be omitted, nonzero otherwise
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
64 *
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
65 * @return total amount of bytes written to the output buffer
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
66 *
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
67 * @see c2html_plain_highlighter()
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
68 * @see c2html_c_highlighter()
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
69 * @see c2html_java_highlighter()
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
70 */
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
71 size_t c2html_formatn(void* inputbuffer, read_func rfnc,
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
72 char* ibuf, size_t ibuflen, void* outputbuffer, write_func wfnc,
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
73 size_t maxlen, c2html_highlighter_func hltr, int showln);
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
74
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
75 /**
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
76 * Reads a source file from the input buffer and writes the formatted output
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
77 * to an output buffer.
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
78 *
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
79 * The output buffer must either be large enough to hold the formatted data
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
80 * or the write function must trigger an automatic extension of the buffer.
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
81 *
57
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
82 * The input is copied via an intermediate buffer to an internal buffer.
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
83 *
55
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
84 * @param inputbuffer the input buffer
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
85 * @param rfnc a read function operating for the input buffer
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
86 * @param ibuf intermediate processing buffer
57
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
87 * @param ibuflen length of intermediate processing buffer
55
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
88 * @param outputbuffer the output buffer
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
89 * @param wfnc a write function for the output buffer
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
90 * @param hltr the highlighter function
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
91 * @param showln zero, if line numbers shall be omitted, nonzero otherwise
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
92 *
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
93 * @return total amount of bytes written to the output buffer
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
94 *
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
95 * @see c2html_plain_highlighter()
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
96 * @see c2html_c_highlighter()
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
97 * @see c2html_java_highlighter()
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
98 */
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
99 size_t c2html_format(void* inputbuffer, read_func rfnc,
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
100 char* ibuf, size_t ibuflen, void* outputbuffer, write_func wfnc,
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
101 c2html_highlighter_func hltr, int showln);
22
f463693b5eeb added command line parameters for header and footer file
Mike Becker <universe@uap-core.de>
parents:
diff changeset
102
55
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
103 /**
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
104 * Reads a source file from the specified input file stream and writes the
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
105 * formatted output to an output buffer.
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
106 *
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
107 * The output buffer must either be large enough to hold the formatted data
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
108 * or the write function must trigger an automatic extension of the buffer.
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
109 *
57
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
110 * The input is copied via an intermediate buffer to an internal buffer.
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
111 * For files, the recommended intermediate buffer length is the file system
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
112 * block size.
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
113 *
55
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
114 * @param inputfile the input file stream
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
115 * @param ibuf intermediate processing buffer
57
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
116 * @param ibuflen length of intermediate processing buffer
55
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
117 * @param outputbuffer the output buffer
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
118 * @param wfnc a write function for the output buffer
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
119 * @param hltr the highlighter function
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
120 * @param showln zero, if line numbers shall be omitted, nonzero otherwise
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
121 *
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
122 * @return total amount of bytes written to the output buffer
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
123 *
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
124 * @see c2html_plain_highlighter()
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
125 * @see c2html_c_highlighter()
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
126 * @see c2html_java_highlighter()
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
127 */
57
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
128 size_t c2html_fformat(FILE* inputfile, char *ibuf, size_t ibuflen,
55
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
129 void* outputbuffer, write_func wfnc,
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
130 c2html_highlighter_func hltr, int showln);
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
131
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
132 /**
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
133 * Reads a source file from the specified input file stream and directly writes
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
134 * the formatted output to the output file stream.
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
135 *
57
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
136 * For files, the recommended intermediate buffer length is the file system
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
137 * block size.
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
138 *
55
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
139 * @param inputfile the input file stream
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
140 * @param ibuf intermediate processing buffer
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
141 * @param ibuflen length of intermediate processing buffer (recommended: 4 KB)
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
142 * @param outputfile the output file stream
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
143 * @param hltr the highlighter function
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
144 * @param showln zero, if line numbers shall be omitted, nonzero otherwise
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
145 *
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
146 * @see c2html_plain_highlighter()
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
147 * @see c2html_c_highlighter()
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
148 * @see c2html_java_highlighter()
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
149 */
57
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
150 void c2html_fformatf(FILE *inputfile, char *ibuf, size_t ibuflen,
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
151 FILE* outputfile, c2html_highlighter_func hltr, int showln);
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
152
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
153
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
154 /**
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
155 * Writes at most <code>maxlen</code> bytes of formatted source data to the
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
156 * output buffer.
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
157 *
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
158 * @param inputbuffer the source file data as string
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
159 * @param inputbuflen the length of the source file
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
160 * @param outputbuffer the output buffer
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
161 * @param wfnc a write function for the output buffer
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
162 * @param maxlen the maximum amount bytes which will be written to the
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
163 * output buffer
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
164 * @param hltr the highlighter function
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
165 * @param showln zero, if line numbers shall be omitted, nonzero otherwise
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
166 *
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
167 * @return total amount of bytes written to the output buffer
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
168 *
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
169 * @see c2html_plain_highlighter()
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
170 * @see c2html_c_highlighter()
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
171 * @see c2html_java_highlighter()
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
172 */
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
173 size_t c2html_bformatn(const char* inputbuffer, size_t inputbuflen,
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
174 void* outputbuffer, write_func wfnc,
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
175 size_t maxlen, c2html_highlighter_func hltr, int showln);
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
176
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
177
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
178 /**
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
179 * Writes the formatted source data to the output buffer.
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
180 *
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
181 * @param inputbuffer the source file data as string
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
182 * @param inputbuflen the length of the source file
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
183 * @param outputbuffer the output buffer
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
184 * @param wfnc a write function for the output buffer
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
185 * @param hltr the highlighter function
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
186 * @param showln zero, if line numbers shall be omitted, nonzero otherwise
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
187 *
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
188 * @return total amount of bytes written to the output buffer
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
189 *
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
190 * @see c2html_plain_highlighter()
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
191 * @see c2html_c_highlighter()
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
192 * @see c2html_java_highlighter()
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
193 */
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
194 size_t c2html_bformat(const char* inputbuffer, size_t inputbuflen,
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
195 void* outputbuffer, write_func wfnc,
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
196 c2html_highlighter_func hltr, int showln);
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
197
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
198
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
199 /**
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
200 * Writes the formatted source data directly to the specified file stream.
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
201 *
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
202 * @param inputbuffer the source file data as string
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
203 * @param inputbuflen the length of the source file
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
204 * @param outputfile the output file stream
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
205 * @param hltr the highlighter function
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
206 * @param showln zero, if line numbers shall be omitted, nonzero otherwise
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
207 *
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
208 * @see c2html_plain_highlighter()
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
209 * @see c2html_c_highlighter()
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
210 * @see c2html_java_highlighter()
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
211 */
eba880c1705c improves API and adds functions for strings
Mike Becker <universe@uap-core.de>
parents: 56
diff changeset
212 void c2html_bformatf(const char* inputbuffer, size_t inputbuflen,
55
bf54085ce341 adds appropriate public API
Mike Becker <universe@uap-core.de>
parents: 52
diff changeset
213 FILE* outputfile, c2html_highlighter_func hltr, int showln);
22
f463693b5eeb added command line parameters for header and footer file
Mike Becker <universe@uap-core.de>
parents:
diff changeset
214
56
81d99e9ceb20 fixes ancient header macro
Mike Becker <universe@uap-core.de>
parents: 55
diff changeset
215 #ifdef __cplusplus
22
f463693b5eeb added command line parameters for header and footer file
Mike Becker <universe@uap-core.de>
parents:
diff changeset
216 }
f463693b5eeb added command line parameters for header and footer file
Mike Becker <universe@uap-core.de>
parents:
diff changeset
217 #endif
f463693b5eeb added command line parameters for header and footer file
Mike Becker <universe@uap-core.de>
parents:
diff changeset
218
56
81d99e9ceb20 fixes ancient header macro
Mike Becker <universe@uap-core.de>
parents: 55
diff changeset
219 #endif /* C2HTML_H */
22
f463693b5eeb added command line parameters for header and footer file
Mike Becker <universe@uap-core.de>
parents:
diff changeset
220

mercurial