GophHub - kevinboone/epub2txt2/src/wrap.h


Raw File

    1	/*============================================================================
    2	  epub2txt v2 
    3	  wraptext.h
    4	  Copyright (c)2020 Kevin Boone, GPL v3.0
    5	============================================================================*/
    6	
    7	#ifndef __WRAPTEXT_H
    8	#define __WRAPTEXT_H
    9	
   10	#include <stdint.h>
   11	
   12	// The largest number of bytes required to store a unicode character as
   13	// UTF8, including a terminating 0
   14	#define WT_UTF8_MAX_BYTES 8 
   15	
   16	// Hard line break should be an unusued code point
   17	#define WT_HARD_LINE_BREAK 9999
   18	
   19	typedef uint32_t WT_UTF32;
   20	typedef char WT_UTF8;
   21	
   22	typedef void (*WrapTextOutputFn) (void *app_data, WT_UTF32 c);
   23	
   24	struct _WrapTextContextPriv;
   25	
   26	typedef struct _WrapTextContext
   27	  {
   28	  struct _WrapTextContextPriv *priv;
   29	  } WrapTextContext;
   30	
   31	#ifdef __CPLUSPLUS
   32	extern "C" {
   33	#endif
   34	
   35	void wraptext_wrap_utf32 (WrapTextContext *context, const WT_UTF32 *utf32);
   36	
   37	WrapTextContext *wraptext_context_new (void);
   38	
   39	void wraptext_context_free (WrapTextContext *self);
   40	
   41	void wraptext_context_set_output_fn (WrapTextContext *self, 
   42	  WrapTextOutputFn fn);
   43	
   44	unsigned int wraptext_context_get_fmt (WrapTextContext *self);
   45	void wraptext_context_zero_fmt (WrapTextContext *self);
   46	void wraptext_context_set_fmt (WrapTextContext *self, unsigned int fmt);
   47	void wraptext_context_reset_fmt (WrapTextContext *self, unsigned int fmt);
   48	void wraptext_context_set_app_opts (WrapTextContext *self, void *app_opts);
   49	void *wraptext_context_get_app_opts (WrapTextContext *self);
   50	
   51	void wraptext_context_set_flags (WrapTextContext *self, int flags);
   52	
   53	void wraptext_context_set_width (WrapTextContext *self, int width);
   54	
   55	void wraptext_context_set_app_data (WrapTextContext *self, void *app_data);
   56	
   57	void wraptext_context_reset (WrapTextContext *self);
   58	
   59	void wraptext_eof (WrapTextContext *context);
   60	
   61	WT_UTF32 *wraptext_convert_utf8_to_utf32 (const WT_UTF8 *utf8);
   62	
   63	const int wraptext_utf32_length (const WT_UTF32 *s);
   64	
   65	#ifdef __CPLUSPLUS
   66	}
   67	#endif
   68	
   69	#endif
   70	

Generated by GNU Enscript 1.6.6, and GophHub 1.3.