Mon, 24 Apr 2023 20:54:38 +0200
upgrade to ucx 3.0
1 /*
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 *
4 * Copyright 2016 Mike Becker. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE.
27 *
28 */
30 #ifndef C2HTML_H
31 #define C2HTML_H
33 #include <stdio.h>
34 #include <cx/list.h>
35 #include "highlighter.h"
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
41 #define VERSION_MAJOR 3
42 #define VERSION_MINOR 0
43 #define VERSION_DEVELOP 0 /* set this to zero for release version */
45 /**
46 * Writes the formatted source data to the output buffer.
47 *
48 * @param inputbuffer the source file data as string
49 * @param inputbuflen the length of the source file
50 * @param outbuf the output buffer
51 * @param wfnc a write function for the output buffer
52 * @param hltr the highlighter function
53 * @param showln zero, if line numbers shall be omitted, nonzero otherwise
54 *
55 * @return total amount of bytes written to the output buffer
56 *
57 * @see c2html_plain_highlighter()
58 * @see c2html_c_highlighter()
59 * @see c2html_java_highlighter()
60 */
61 size_t c2html_bformat(char const* inputbuffer, size_t inputbuflen,
62 void* outbuf, cx_write_func wfnc,
63 c2html_highlighter_func hltr, int showln);
65 /**
66 * Writes the formatted source data to the output buffer.
67 *
68 * This function takes a list of \c char* that point to the beginning of each
69 * line. These pointers may point directly into the source text and the strings
70 * do not need to be zero-terminated, but the line-breaks must be included.
71 *
72 * @param lines a list of pointers to the beginning of each line
73 * @param outbuf the output buffer
74 * @param wfnc a write function for the output buffer
75 * @param hltr the highlighter function
76 * @param showln zero, if line numbers shall be omitted, nonzero otherwise
77 *
78 * @return total amount of bytes written to the output buffer
79 *
80 * @see c2html_plain_highlighter()
81 * @see c2html_c_highlighter()
82 * @see c2html_java_highlighter()
83 */
84 size_t c2html_format(CxList const* lines,
85 void* outbuf, cx_write_func wfnc,
86 c2html_highlighter_func hltr, int showln);
88 #ifdef __cplusplus
89 }
90 #endif
92 #endif /* C2HTML_H */