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

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

mercurial