]> mj.ucw.cz Git - libucw.git/blobdiff - ucw/fastbuf.h
Opt: Make OPT_LAST_ARG actually work and document interface of opt_parse()
[libucw.git] / ucw / fastbuf.h
index f6dd6132da48f18ca79d4a39860e854ae6f39a08..9b0f72510fcc793e571a4da995fafd0348ec3702 100644 (file)
 #include <string.h>
 #include <alloca.h>
 
+#ifdef CONFIG_UCW_CLEAN_ABI
+#define bbcopy_slow ucw_bbcopy_slow
+#define bclose ucw_bclose
+#define bclose_file_helper ucw_bclose_file_helper
+#define bconfig ucw_bconfig
+#define beof_slow ucw_beof_slow
+#define bfdopen ucw_bfdopen
+#define bfdopen_internal ucw_bfdopen_internal
+#define bfdopen_shared ucw_bfdopen_shared
+#define bfilesize ucw_bfilesize
+#define bfilesync ucw_bfilesync
+#define bfix_tmp_file ucw_bfix_tmp_file
+#define bflush ucw_bflush
+#define bfmmopen_internal ucw_bfmmopen_internal
+#define bgetc_slow ucw_bgetc_slow
+#define bgets ucw_bgets
+#define bgets0 ucw_bgets0
+#define bgets_bb ucw_bgets_bb
+#define bgets_mp ucw_bgets_mp
+#define bgets_nodie ucw_bgets_nodie
+#define bgets_stk_init ucw_bgets_stk_init
+#define bgets_stk_step ucw_bgets_stk_step
+#define bopen ucw_bopen
+#define bopen_fd_name ucw_bopen_fd_name
+#define bopen_file ucw_bopen_file
+#define bopen_file_try ucw_bopen_file_try
+#define bopen_limited_fd ucw_bopen_limited_fd
+#define bopen_tmp ucw_bopen_tmp
+#define bopen_tmp_file ucw_bopen_tmp_file
+#define bopen_try ucw_bopen_try
+#define bpeekc_slow ucw_bpeekc_slow
+#define bprintf ucw_bprintf
+#define bputc_slow ucw_bputc_slow
+#define bread_slow ucw_bread_slow
+#define brefill ucw_brefill
+#define brewind ucw_brewind
+#define bseek ucw_bseek
+#define bsetpos ucw_bsetpos
+#define bskip_slow ucw_bskip_slow
+#define bspout ucw_bspout
+#define bthrow ucw_bthrow
+#define bwrite_slow ucw_bwrite_slow
+#define fb_tie ucw_fb_tie
+#define fbatomic_internal_write ucw_fbatomic_internal_write
+#define fbatomic_open ucw_fbatomic_open
+#define fbbuf_init_read ucw_fbbuf_init_read
+#define fbbuf_init_write ucw_fbbuf_init_write
+#define fbdir_cheat ucw_fbdir_cheat
+#define fbdir_open_fd_internal ucw_fbdir_open_fd_internal
+#define fbgrow_create ucw_fbgrow_create
+#define fbgrow_create_mp ucw_fbgrow_create_mp
+#define fbgrow_get_buf ucw_fbgrow_get_buf
+#define fbgrow_reset ucw_fbgrow_reset
+#define fbgrow_rewind ucw_fbgrow_rewind
+#define fbmem_clone_read ucw_fbmem_clone_read
+#define fbmem_create ucw_fbmem_create
+#define fbmulti_append ucw_fbmulti_append
+#define fbmulti_create ucw_fbmulti_create
+#define fbmulti_remove ucw_fbmulti_remove
+#define fbpar_cf ucw_fbpar_cf
+#define fbpar_def ucw_fbpar_def
+#define fbpool_end ucw_fbpool_end
+#define fbpool_init ucw_fbpool_init
+#define fbpool_start ucw_fbpool_start
+#define open_tmp ucw_open_tmp
+#define temp_file_name ucw_temp_file_name
+#define vbprintf ucw_vbprintf
+#endif
+
 /***
  * === Internal structure [[internal]]
  *
@@ -491,35 +560,34 @@ static inline void fbatomic_commit(struct fastbuf *b)
  * You aren't allowed to do anything with the underlying buffers while these
  * are connected into fbmulti.
  *
- * You may init a fbmulti by @fbmulti_create(bufsize, fb1, fb2, ..., NULL).
- * This call returns a fastbuf that concatenates all the given fastbufs.
- * The last parameter of @fbmulti_create must be NULL.
+ * The fbmulti is inited by @fbmulti_create(). It returns an empty fbmulti.
+ * Then you call @fbmulti_append() for each fbmulti.
  *
  * If @bclose() is called on fbmulti, all the underlying buffers get closed
  * recursively.
  *
- * You may init a fbmulti by @fbmulti_create(bufsize) with no underlying buffers
- * and then append the underlying buffers one by one.
- *
- * If used in some formatter, you'll probably have a large and deep structure
- * of nested fastbufs. Just before reading from the fbmulti, you may call
- * @fbmulti_flatten() to flatten the structure. After @fbmulti_flatten(), the
- * fbmulti is seeked to the beginning, flushed and ready to read the whole buffer.
- *
- * If you want to remove a fastbuf from the chain, just call @fbmulti_remove
- * where the second parameter is a pointer to the removed fastbuf. If you pass
- * NULL, all the underlying fastbufs are removed.
+ * If you want to keep an underlying fastbuf open after @bclose, just remove it
+ * by @fbmulti_remove where the second parameter is a pointer to the removed
+ * fastbuf. If you pass NULL, all the underlying fastbufs are removed.
  *
- * When a fastbuf is removed from the chain, the overall position may change:
- * If bstop pointed into it, after removal it points to the boundary of the
- * previous and next fastbufs. Length of the removed fastbuf is subtracted from
- * the overall offset of all the fastbufs after the removed fb in the chain.
+ * After @fbmulti_remove, the state of the fbmulti is undefined. The only allowed
+ * operation is either another @fbmulti_remove or @bclose on the fbmulti.
  ***/
 
-struct fastbuf *fbmulti_create(uns bufsize, ...) SENTINEL_CHECK;
-void fbmulti_append(struct fastbuf *f, struct fastbuf *fa);
-void fbmulti_remove(struct fastbuf *f, struct fastbuf *fb);
+/**
+ * Create an empty fbmulti
+ **/
+struct fastbuf *fbmulti_create(void);
 
+/**
+ * Append a fb to fbmulti
+ **/
+void fbmulti_append(struct fastbuf *f, struct fastbuf *fb);
+
+/**
+ * Remove a fb from fbmulti
+ **/
+void fbmulti_remove(struct fastbuf *f, struct fastbuf *fb);
 
 /*** === Configuring stream parameters [[bconfig]] ***/