diff -r 81d99e9ceb20 -r eba880c1705c src/c2html.h
--- a/src/c2html.h Wed Aug 31 14:47:01 2016 +0200
+++ b/src/c2html.h Wed Aug 31 16:20:58 2016 +0200
@@ -39,19 +39,22 @@
#define VERSION_MAJOR 2
#define VERSION_MINOR 0
-#define VERSION_DEVELOP 1 /* set this to zero for release version */
+#define VERSION_DEVELOP 0 /* set this to zero for release version */
/**
* Reads a source file from the input buffer and writes at most
* maxlen
bytes of the formatted output to the output buffer.
*
* The output buffer must either be large enough to hold maxlen
- * bytes or the write function must trigger an automatic extension of the buffer.
+ * bytes or the write function must trigger an automatic extension of the
+ * buffer.
+ *
+ * The input is copied via an intermediate buffer to an internal buffer.
*
* @param inputbuffer the input buffer
* @param rfnc a read function operating for the input buffer
* @param ibuf intermediate processing buffer
- * @param ibuflen length of intermediate processing buffer (recommended: 4 KB)
+ * @param ibuflen length of intermediate processing buffer
* @param outputbuffer the output buffer
* @param wfnc a write function for the output buffer
* @param maxlen the maximum amount bytes which will be written to the
@@ -76,10 +79,12 @@
* The output buffer must either be large enough to hold the formatted data
* or the write function must trigger an automatic extension of the buffer.
*
+ * The input is copied via an intermediate buffer to an internal buffer.
+ *
* @param inputbuffer the input buffer
* @param rfnc a read function operating for the input buffer
* @param ibuf intermediate processing buffer
- * @param ibuflen length of intermediate processing buffer (recommended: 4 KB)
+ * @param ibuflen length of intermediate processing buffer
* @param outputbuffer the output buffer
* @param wfnc a write function for the output buffer
* @param hltr the highlighter function
@@ -102,9 +107,13 @@
* The output buffer must either be large enough to hold the formatted data
* or the write function must trigger an automatic extension of the buffer.
*
+ * The input is copied via an intermediate buffer to an internal buffer.
+ * For files, the recommended intermediate buffer length is the file system
+ * block size.
+ *
* @param inputfile the input file stream
* @param ibuf intermediate processing buffer
- * @param ibuflen length of intermediate processing buffer (recommended: 4 KB)
+ * @param ibuflen length of intermediate processing buffer
* @param outputbuffer the output buffer
* @param wfnc a write function for the output buffer
* @param hltr the highlighter function
@@ -116,7 +125,7 @@
* @see c2html_c_highlighter()
* @see c2html_java_highlighter()
*/
-size_t c2html_format_file(FILE* inputfile, char *ibuf, size_t ibuflen,
+size_t c2html_fformat(FILE* inputfile, char *ibuf, size_t ibuflen,
void* outputbuffer, write_func wfnc,
c2html_highlighter_func hltr, int showln);
@@ -124,6 +133,9 @@
* Reads a source file from the specified input file stream and directly writes
* the formatted output to the output file stream.
*
+ * For files, the recommended intermediate buffer length is the file system
+ * block size.
+ *
* @param inputfile the input file stream
* @param ibuf intermediate processing buffer
* @param ibuflen length of intermediate processing buffer (recommended: 4 KB)
@@ -135,7 +147,69 @@
* @see c2html_c_highlighter()
* @see c2html_java_highlighter()
*/
-void c2html_fformat_file(FILE *inputfile, char *ibuf, size_t ibuflen,
+void c2html_fformatf(FILE *inputfile, char *ibuf, size_t ibuflen,
+ FILE* outputfile, c2html_highlighter_func hltr, int showln);
+
+
+/**
+ * Writes at most maxlen
bytes of formatted source data to the
+ * output buffer.
+ *
+ * @param inputbuffer the source file data as string
+ * @param inputbuflen the length of the source file
+ * @param outputbuffer the output buffer
+ * @param wfnc a write function for the output buffer
+ * @param maxlen the maximum amount bytes which will be written to the
+ * output buffer
+ * @param hltr the highlighter function
+ * @param showln zero, if line numbers shall be omitted, nonzero otherwise
+ *
+ * @return total amount of bytes written to the output buffer
+ *
+ * @see c2html_plain_highlighter()
+ * @see c2html_c_highlighter()
+ * @see c2html_java_highlighter()
+ */
+size_t c2html_bformatn(const char* inputbuffer, size_t inputbuflen,
+ void* outputbuffer, write_func wfnc,
+ size_t maxlen, c2html_highlighter_func hltr, int showln);
+
+
+/**
+ * Writes the formatted source data to the output buffer.
+ *
+ * @param inputbuffer the source file data as string
+ * @param inputbuflen the length of the source file
+ * @param outputbuffer the output buffer
+ * @param wfnc a write function for the output buffer
+ * @param hltr the highlighter function
+ * @param showln zero, if line numbers shall be omitted, nonzero otherwise
+ *
+ * @return total amount of bytes written to the output buffer
+ *
+ * @see c2html_plain_highlighter()
+ * @see c2html_c_highlighter()
+ * @see c2html_java_highlighter()
+ */
+size_t c2html_bformat(const char* inputbuffer, size_t inputbuflen,
+ void* outputbuffer, write_func wfnc,
+ c2html_highlighter_func hltr, int showln);
+
+
+/**
+ * Writes the formatted source data directly to the specified file stream.
+ *
+ * @param inputbuffer the source file data as string
+ * @param inputbuflen the length of the source file
+ * @param outputfile the output file stream
+ * @param hltr the highlighter function
+ * @param showln zero, if line numbers shall be omitted, nonzero otherwise
+ *
+ * @see c2html_plain_highlighter()
+ * @see c2html_c_highlighter()
+ * @see c2html_java_highlighter()
+ */
+void c2html_bformatf(const char* inputbuffer, size_t inputbuflen,
FILE* outputfile, c2html_highlighter_func hltr, int showln);
#ifdef __cplusplus