src/c2html.h

Wed, 31 Aug 2016 14:47:01 +0200

author
Mike Becker <universe@uap-core.de>
date
Wed, 31 Aug 2016 14:47:01 +0200
changeset 56
81d99e9ceb20
parent 55
bf54085ce341
child 57
eba880c1705c
permissions
-rw-r--r--

fixes ancient header macro

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@39 42 #define VERSION_DEVELOP 1 /* 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@55 49 * bytes or the write function must trigger an automatic extension of the buffer.
universe@55 50 *
universe@55 51 * @param inputbuffer the input buffer
universe@55 52 * @param rfnc a read function operating for the input buffer
universe@55 53 * @param ibuf intermediate processing buffer
universe@55 54 * @param ibuflen length of intermediate processing buffer (recommended: 4 KB)
universe@55 55 * @param outputbuffer the output buffer
universe@55 56 * @param wfnc a write function for the output buffer
universe@55 57 * @param maxlen the maximum amount bytes which will be written to the
universe@55 58 * output buffer
universe@55 59 * @param hltr the highlighter function
universe@55 60 * @param showln zero, if line numbers shall be omitted, nonzero otherwise
universe@55 61 *
universe@55 62 * @return total amount of bytes written to the output buffer
universe@55 63 *
universe@55 64 * @see c2html_plain_highlighter()
universe@55 65 * @see c2html_c_highlighter()
universe@55 66 * @see c2html_java_highlighter()
universe@55 67 */
universe@55 68 size_t c2html_formatn(void* inputbuffer, read_func rfnc,
universe@55 69 char* ibuf, size_t ibuflen, void* outputbuffer, write_func wfnc,
universe@55 70 size_t maxlen, c2html_highlighter_func hltr, int showln);
universe@55 71
universe@55 72 /**
universe@55 73 * Reads a source file from the input buffer and writes the formatted output
universe@55 74 * to an output buffer.
universe@55 75 *
universe@55 76 * The output buffer must either be large enough to hold the formatted data
universe@55 77 * or the write function must trigger an automatic extension of the buffer.
universe@55 78 *
universe@55 79 * @param inputbuffer the input buffer
universe@55 80 * @param rfnc a read function operating for the input buffer
universe@55 81 * @param ibuf intermediate processing buffer
universe@55 82 * @param ibuflen length of intermediate processing buffer (recommended: 4 KB)
universe@55 83 * @param outputbuffer the output buffer
universe@55 84 * @param wfnc a write function for the output buffer
universe@55 85 * @param hltr the highlighter function
universe@55 86 * @param showln zero, if line numbers shall be omitted, nonzero otherwise
universe@55 87 *
universe@55 88 * @return total amount of bytes written to the output buffer
universe@55 89 *
universe@55 90 * @see c2html_plain_highlighter()
universe@55 91 * @see c2html_c_highlighter()
universe@55 92 * @see c2html_java_highlighter()
universe@55 93 */
universe@55 94 size_t c2html_format(void* inputbuffer, read_func rfnc,
universe@55 95 char* ibuf, size_t ibuflen, void* outputbuffer, write_func wfnc,
universe@55 96 c2html_highlighter_func hltr, int showln);
universe@22 97
universe@55 98 /**
universe@55 99 * Reads a source file from the specified input file stream and writes the
universe@55 100 * formatted output to an output buffer.
universe@55 101 *
universe@55 102 * The output buffer must either be large enough to hold the formatted data
universe@55 103 * or the write function must trigger an automatic extension of the buffer.
universe@55 104 *
universe@55 105 * @param inputfile the input file stream
universe@55 106 * @param ibuf intermediate processing buffer
universe@55 107 * @param ibuflen length of intermediate processing buffer (recommended: 4 KB)
universe@55 108 * @param outputbuffer the output buffer
universe@55 109 * @param wfnc a write function for the output buffer
universe@55 110 * @param hltr the highlighter function
universe@55 111 * @param showln zero, if line numbers shall be omitted, nonzero otherwise
universe@55 112 *
universe@55 113 * @return total amount of bytes written to the output buffer
universe@55 114 *
universe@55 115 * @see c2html_plain_highlighter()
universe@55 116 * @see c2html_c_highlighter()
universe@55 117 * @see c2html_java_highlighter()
universe@55 118 */
universe@55 119 size_t c2html_format_file(FILE* inputfile, char *ibuf, size_t ibuflen,
universe@55 120 void* outputbuffer, write_func wfnc,
universe@55 121 c2html_highlighter_func hltr, int showln);
universe@55 122
universe@55 123 /**
universe@55 124 * Reads a source file from the specified input file stream and directly writes
universe@55 125 * the formatted output to the output file stream.
universe@55 126 *
universe@55 127 * @param inputfile the input file stream
universe@55 128 * @param ibuf intermediate processing buffer
universe@55 129 * @param ibuflen length of intermediate processing buffer (recommended: 4 KB)
universe@55 130 * @param outputfile the output file stream
universe@55 131 * @param hltr the highlighter function
universe@55 132 * @param showln zero, if line numbers shall be omitted, nonzero otherwise
universe@55 133 *
universe@55 134 * @see c2html_plain_highlighter()
universe@55 135 * @see c2html_c_highlighter()
universe@55 136 * @see c2html_java_highlighter()
universe@55 137 */
universe@55 138 void c2html_fformat_file(FILE *inputfile, char *ibuf, size_t ibuflen,
universe@55 139 FILE* outputfile, c2html_highlighter_func hltr, int showln);
universe@22 140
universe@56 141 #ifdef __cplusplus
universe@22 142 }
universe@22 143 #endif
universe@22 144
universe@56 145 #endif /* C2HTML_H */
universe@22 146

mercurial