src/c2html.h

changeset 57
eba880c1705c
parent 56
81d99e9ceb20
child 66
1b12cf799fee
     1.1 --- a/src/c2html.h	Wed Aug 31 14:47:01 2016 +0200
     1.2 +++ b/src/c2html.h	Wed Aug 31 16:20:58 2016 +0200
     1.3 @@ -39,19 +39,22 @@
     1.4      
     1.5  #define VERSION_MAJOR   2
     1.6  #define VERSION_MINOR   0
     1.7 -#define VERSION_DEVELOP 1 /* set this to zero for release version */
     1.8 +#define VERSION_DEVELOP 0 /* set this to zero for release version */
     1.9  
    1.10  /**
    1.11   * Reads a source file from the input buffer and writes at most
    1.12   * <code>maxlen</code> bytes of the formatted output to the output buffer.
    1.13   * 
    1.14   * The output buffer must either be large enough to hold <code>maxlen</code>
    1.15 - * bytes or the write function must trigger an automatic extension of the buffer.
    1.16 + * bytes or the write function must trigger an automatic extension of the
    1.17 + * buffer.
    1.18 + * 
    1.19 + * The input is copied via an intermediate buffer to an internal buffer.
    1.20   * 
    1.21   * @param inputbuffer the input buffer
    1.22   * @param rfnc a read function operating for the input buffer
    1.23   * @param ibuf intermediate processing buffer
    1.24 - * @param ibuflen length of intermediate processing buffer (recommended: 4 KB)
    1.25 + * @param ibuflen length of intermediate processing buffer
    1.26   * @param outputbuffer the output buffer
    1.27   * @param wfnc a write function for the output buffer
    1.28   * @param maxlen the maximum amount bytes which will be written to the
    1.29 @@ -76,10 +79,12 @@
    1.30   * The output buffer must either be large enough to hold the formatted data
    1.31   * or the write function must trigger an automatic extension of the buffer.
    1.32   * 
    1.33 + * The input is copied via an intermediate buffer to an internal buffer.
    1.34 + * 
    1.35   * @param inputbuffer the input buffer
    1.36   * @param rfnc a read function operating for the input buffer
    1.37   * @param ibuf intermediate processing buffer
    1.38 - * @param ibuflen length of intermediate processing buffer (recommended: 4 KB)
    1.39 + * @param ibuflen length of intermediate processing buffer
    1.40   * @param outputbuffer the output buffer
    1.41   * @param wfnc a write function for the output buffer
    1.42   * @param hltr the highlighter function
    1.43 @@ -102,9 +107,13 @@
    1.44   * The output buffer must either be large enough to hold the formatted data
    1.45   * or the write function must trigger an automatic extension of the buffer.
    1.46   * 
    1.47 + * The input is copied via an intermediate buffer to an internal buffer.
    1.48 + * For files, the recommended intermediate buffer length is the file system
    1.49 + * block size.
    1.50 + * 
    1.51   * @param inputfile the input file stream
    1.52   * @param ibuf intermediate processing buffer
    1.53 - * @param ibuflen length of intermediate processing buffer (recommended: 4 KB)
    1.54 + * @param ibuflen length of intermediate processing buffer
    1.55   * @param outputbuffer the output buffer
    1.56   * @param wfnc a write function for the output buffer
    1.57   * @param hltr the highlighter function
    1.58 @@ -116,7 +125,7 @@
    1.59   * @see c2html_c_highlighter()
    1.60   * @see c2html_java_highlighter()
    1.61   */
    1.62 -size_t c2html_format_file(FILE* inputfile, char *ibuf, size_t ibuflen,
    1.63 +size_t c2html_fformat(FILE* inputfile, char *ibuf, size_t ibuflen,
    1.64          void* outputbuffer, write_func wfnc,
    1.65          c2html_highlighter_func hltr, int showln);
    1.66  
    1.67 @@ -124,6 +133,9 @@
    1.68   * Reads a source file from the specified input file stream and directly writes
    1.69   * the formatted output to the output file stream.
    1.70   * 
    1.71 + * For files, the recommended intermediate buffer length is the file system
    1.72 + * block size.
    1.73 + * 
    1.74   * @param inputfile the input file stream
    1.75   * @param ibuf intermediate processing buffer
    1.76   * @param ibuflen length of intermediate processing buffer (recommended: 4 KB)
    1.77 @@ -135,7 +147,69 @@
    1.78   * @see c2html_c_highlighter()
    1.79   * @see c2html_java_highlighter()
    1.80   */
    1.81 -void c2html_fformat_file(FILE *inputfile, char *ibuf, size_t ibuflen,
    1.82 +void c2html_fformatf(FILE *inputfile, char *ibuf, size_t ibuflen,
    1.83 +        FILE* outputfile, c2html_highlighter_func hltr, int showln);
    1.84 +
    1.85 +
    1.86 +/**
    1.87 + * Writes at most <code>maxlen</code> bytes of formatted source data to the
    1.88 + * output buffer.
    1.89 + * 
    1.90 + * @param inputbuffer the source file data as string
    1.91 + * @param inputbuflen the length of the source file
    1.92 + * @param outputbuffer the output buffer
    1.93 + * @param wfnc a write function for the output buffer
    1.94 + * @param maxlen the maximum amount bytes which will be written to the
    1.95 + * output buffer
    1.96 + * @param hltr the highlighter function
    1.97 + * @param showln zero, if line numbers shall be omitted, nonzero otherwise
    1.98 + * 
    1.99 + * @return total amount of bytes written to the output buffer
   1.100 + * 
   1.101 + * @see c2html_plain_highlighter()
   1.102 + * @see c2html_c_highlighter()
   1.103 + * @see c2html_java_highlighter()
   1.104 + */
   1.105 +size_t c2html_bformatn(const char* inputbuffer, size_t inputbuflen,
   1.106 +        void* outputbuffer, write_func wfnc,
   1.107 +        size_t maxlen, c2html_highlighter_func hltr, int showln);
   1.108 +    
   1.109 +
   1.110 +/**
   1.111 + * Writes the formatted source data to the output buffer.
   1.112 + * 
   1.113 + * @param inputbuffer the source file data as string
   1.114 + * @param inputbuflen the length of the source file
   1.115 + * @param outputbuffer the output buffer
   1.116 + * @param wfnc a write function for the output buffer
   1.117 + * @param hltr the highlighter function
   1.118 + * @param showln zero, if line numbers shall be omitted, nonzero otherwise
   1.119 + * 
   1.120 + * @return total amount of bytes written to the output buffer
   1.121 + * 
   1.122 + * @see c2html_plain_highlighter()
   1.123 + * @see c2html_c_highlighter()
   1.124 + * @see c2html_java_highlighter()
   1.125 + */
   1.126 +size_t c2html_bformat(const char* inputbuffer, size_t inputbuflen,
   1.127 +        void* outputbuffer, write_func wfnc,
   1.128 +        c2html_highlighter_func hltr, int showln);
   1.129 +
   1.130 +
   1.131 +/**
   1.132 + * Writes the formatted source data directly to the specified file stream.
   1.133 + * 
   1.134 + * @param inputbuffer the source file data as string
   1.135 + * @param inputbuflen the length of the source file
   1.136 + * @param outputfile the output file stream
   1.137 + * @param hltr the highlighter function
   1.138 + * @param showln zero, if line numbers shall be omitted, nonzero otherwise
   1.139 + * 
   1.140 + * @see c2html_plain_highlighter()
   1.141 + * @see c2html_c_highlighter()
   1.142 + * @see c2html_java_highlighter()
   1.143 + */
   1.144 +void c2html_bformatf(const char* inputbuffer, size_t inputbuflen,
   1.145          FILE* outputfile, c2html_highlighter_func hltr, int showln);
   1.146  
   1.147  #ifdef __cplusplus

mercurial