src/c2html.h

Mon, 24 Apr 2023 20:54:38 +0200

author
Mike Becker <universe@uap-core.de>
date
Mon, 24 Apr 2023 20:54:38 +0200
changeset 66
1b12cf799fee
parent 57
eba880c1705c
child 70
60cecca5e484
permissions
-rw-r--r--

upgrade to ucx 3.0

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

mercurial