src/c2html.h

Mon, 13 Nov 2017 14:17:46 +0100

author
Mike Becker <universe@uap-core.de>
date
Mon, 13 Nov 2017 14:17:46 +0100
changeset 62
3fff4c364ffc
parent 57
eba880c1705c
child 66
1b12cf799fee
permissions
-rw-r--r--

removes build/ucx from makefile

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

mercurial