ZVBI Library  0.2.37
Data Structures | Macros | Functions

Data Structures

struct  vbi_export
 
struct  vbi_export_class
 

Macros

#define VBI_OPTION_BOUNDS_INITIALIZER_(type_, def_, min_, max_, step_)    { type_ = def_ }, { type_ = min_ }, { type_ = max_ }, { type_ = step_ }
 
#define VBI_OPTION_BOOL_INITIALIZER(key_, label_, def_, tip_)
 
#define VBI_OPTION_INT_RANGE_INITIALIZER(key_, label_, def_, min_, max_, step_, tip_)
 
#define VBI_OPTION_INT_MENU_INITIALIZER(key_, label_, def_, menu_, entries_, tip_)
 
#define VBI_OPTION_REAL_RANGE_INITIALIZER(key_, label_, def_, min_, max_, step_, tip_)
 
#define VBI_OPTION_REAL_MENU_INITIALIZER(key_, label_, def_, menu_, entries_, tip_)
 
#define VBI_OPTION_STRING_INITIALIZER(key_, label_, def_, tip_)
 
#define VBI_OPTION_STRING_MENU_INITIALIZER(key_, label_, def_, menu_, entries_, tip_)
 
#define VBI_OPTION_MENU_INITIALIZER(key_, label_, def_, menu_, entries_, tip_)
 
#define VBI_AUTOREG_EXPORT_MODULE(name)
 

Functions

void vbi_register_export_module (vbi_export_class *)
 
void _vbi_export_malloc_error (vbi_export *e)
 
void vbi_export_write_error (vbi_export *)
 
void vbi_export_unknown_option (vbi_export *, const char *keyword)
 
void vbi_export_invalid_option (vbi_export *, const char *keyword,...)
 
char * vbi_export_strdup (vbi_export *, char **d, const char *s)
 
void vbi_export_error_printf (vbi_export *, const char *templ,...)
 
int vbi_ucs2be (void)
 

Detailed Description

This is the private interface between the public libzvbi export functions and export modules. libzvbi client applications don't use this.

Export modules include "export.h" to get these definitions. See example module exp-templ.c.

Macro Definition Documentation

◆ VBI_OPTION_BOOL_INITIALIZER

#define VBI_OPTION_BOOL_INITIALIZER (   key_,
  label_,
  def_,
  tip_ 
)
Value:
{ VBI_OPTION_BOOL, key_, label_, VBI_OPTION_BOUNDS_INITIALIZER_( \
.num, def_, 0, 1, 1), { .num = NULL }, tip_ }
@ VBI_OPTION_BOOL
Definition: export.h:100

Helper macro for export modules to build option lists. Use like this:

("mute", N_("Switch sound on/off"), FALSE, N_("I am a tooltip"));
#define VBI_OPTION_BOOL_INITIALIZER(key_, label_, def_, tip_)
Definition: export.h:539
Information about an export option.
Definition: export.h:218

N_() marks the string for i18n, see info gettext for details.

Examples
src/exp-templ.c.

◆ VBI_OPTION_INT_RANGE_INITIALIZER

#define VBI_OPTION_INT_RANGE_INITIALIZER (   key_,
  label_,
  def_,
  min_,
  max_,
  step_,
  tip_ 
)
Value:
{ VBI_OPTION_INT, key_, label_, \
VBI_OPTION_BOUNDS_INITIALIZER_(.num, def_, min_, max_, step_), \
{ .num = NULL }, tip_ }
@ VBI_OPTION_INT
Definition: export.h:122

Helper macro for export modules to build option lists. Use like this:

("sampling", N_("Sampling rate"), 44100, 8000, 48000, 100, NULL);
#define VBI_OPTION_INT_RANGE_INITIALIZER(key_, label_, def_, min_, max_, step_, tip_)
Definition: export.h:553

Here we have no tooltip (NULL).

Examples
src/exp-templ.c.

◆ VBI_OPTION_INT_MENU_INITIALIZER

#define VBI_OPTION_INT_MENU_INITIALIZER (   key_,
  label_,
  def_,
  menu_,
  entries_,
  tip_ 
)
Value:
{ VBI_OPTION_INT, key_, label_, \
VBI_OPTION_BOUNDS_INITIALIZER_(.num, def_, 0, (entries_) - 1, 1), \
{ .num = menu_ }, tip_ }

Helper macro for export modules to build option lists. Use like this:

int mymenu[] = { 29, 30, 31 };
("days", NULL, 1, mymenu, 3, NULL);
#define VBI_OPTION_INT_MENU_INITIALIZER(key_, label_, def_, menu_, entries_, tip_)
Definition: export.h:571

No label and tooltip (NULL), i. e. this option is not to be listed in the user interface. Default is entry 1 ("30") of 3 entries.

Examples
src/exp-templ.c.

◆ VBI_OPTION_REAL_RANGE_INITIALIZER

#define VBI_OPTION_REAL_RANGE_INITIALIZER (   key_,
  label_,
  def_,
  min_,
  max_,
  step_,
  tip_ 
)
Value:
{ VBI_OPTION_REAL, key_, label_, \
VBI_OPTION_BOUNDS_INITIALIZER_(.dbl, def_, min_, max_, step_), \
{ .dbl = NULL }, tip_ }
@ VBI_OPTION_REAL
Definition: export.h:143

Helper macro for export modules to build option lists. Use like VBI_OPTION_INT_RANGE_INITIALIZER(), just with doubles but ints.

Examples
src/exp-templ.c.

◆ VBI_OPTION_REAL_MENU_INITIALIZER

#define VBI_OPTION_REAL_MENU_INITIALIZER (   key_,
  label_,
  def_,
  menu_,
  entries_,
  tip_ 
)
Value:
{ VBI_OPTION_REAL, key_, label_, \
VBI_OPTION_BOUNDS_INITIALIZER_(.num, def_, 0, (entries_) - 1, 1), \
{ .dbl = menu_ }, tip_ }

Helper macro for export modules to build option lists. Use like VBI_OPTION_INT_MENU_INITIALIZER(), just with an array of doubles but ints.

◆ VBI_OPTION_STRING_INITIALIZER

#define VBI_OPTION_STRING_INITIALIZER (   key_,
  label_,
  def_,
  tip_ 
)
Value:
{ VBI_OPTION_STRING, key_, label_, VBI_OPTION_BOUNDS_INITIALIZER_( \
.str, def_, NULL, NULL, NULL), { .str = NULL }, tip_ }
@ VBI_OPTION_STRING
Definition: export.h:166

Helper macro for export modules to build option lists. Use like this:

("comment", N_("Comment"), "bububaba", "Please enter a string");
#define VBI_OPTION_STRING_INITIALIZER(key_, label_, def_, tip_)
Definition: export.h:602
Examples
src/exp-templ.c.

◆ VBI_OPTION_STRING_MENU_INITIALIZER

#define VBI_OPTION_STRING_MENU_INITIALIZER (   key_,
  label_,
  def_,
  menu_,
  entries_,
  tip_ 
)
Value:
{ VBI_OPTION_STRING, key_, label_, \
VBI_OPTION_BOUNDS_INITIALIZER_(.str, def_, 0, (entries_) - 1, 1), \
{ .str = menu_ }, tip_ }

Helper macro for export modules to build option lists. Use like this:

char *mymenu[] = { "txt", "html" };
("extension", "Ext", 0, mymenu, 2, N_("Select an extension"));
#define VBI_OPTION_STRING_MENU_INITIALIZER(key_, label_, def_, menu_, entries_, tip_)
Definition: export.h:621

Remember this is like VBI_OPTION_STRING_INITIALIZER() in the sense that the vbi client can pass any string as option value, not just those proposed in the menu. In contrast a plain menu option as with VBI_OPTION_MENU_INITIALIZER() expects menu indices as input.

◆ VBI_OPTION_MENU_INITIALIZER

#define VBI_OPTION_MENU_INITIALIZER (   key_,
  label_,
  def_,
  menu_,
  entries_,
  tip_ 
)
Value:
{ VBI_OPTION_MENU, key_, label_, \
VBI_OPTION_BOUNDS_INITIALIZER_(.num, def_, 0, (entries_) - 1, 1), \
{ .str = (char **)(menu_) }, tip_ }
@ VBI_OPTION_MENU
Definition: export.h:183

Helper macro for export modules to build option lists. Use like this:

char *mymenu[] = { N_("Monday"), N_("Tuesday") };
("weekday", "Weekday", 0, mymenu, 2, N_("Select a weekday"));
#define VBI_OPTION_MENU_INITIALIZER(key_, label_, def_, menu_, entries_, tip_)
Definition: export.h:636
Examples
src/exp-templ.c.

◆ VBI_AUTOREG_EXPORT_MODULE

#define VBI_AUTOREG_EXPORT_MODULE (   name)

Doesn't work, sigh.

Examples
src/exp-templ.c.

Function Documentation

◆ vbi_register_export_module()

void vbi_register_export_module ( vbi_export_class new_module)
Parameters
new_moduleStatic pointer to initialized vbi_export_class structure.

Registers a new export module.

References vbi_export_info::keyword.

◆ vbi_export_write_error()

void vbi_export_write_error ( vbi_export export)
Parameters
exportPointer to a initialized vbi_export object.

Similar to vbi_export_error_printf this function stores an error description in the export object, after examining the errno variable and choosing an appropriate message. Only export modules call this function.

References vbi_export::name, and vbi_export_error_printf().

Referenced by vbi_export_file().

◆ vbi_export_unknown_option()

void vbi_export_unknown_option ( vbi_export export,
const char *  keyword 
)
Parameters
exportPointer to a initialized vbi_export object.
keywordName of the unknown option.

Store an error description in the export object.

References vbi_export_error_printf().

Referenced by vbi_export_option_get(), and vbi_export_option_info_keyword().

◆ vbi_export_invalid_option()

void vbi_export_invalid_option ( vbi_export export,
const char *  keyword,
  ... 
)
Parameters
exportPointer to a initialized vbi_export object.
keywordName of the unknown option.
...Invalid value, type depending on the option.

Store an error description in the export object.

References vbi_option_info::type, vbi_export_error_printf(), vbi_export_option_info_keyword(), VBI_OPTION_BOOL, VBI_OPTION_INT, VBI_OPTION_MENU, VBI_OPTION_REAL, and VBI_OPTION_STRING.

◆ vbi_export_strdup()

char* vbi_export_strdup ( vbi_export export,
char **  d,
const char *  s 
)
Parameters
exportPointer to a initialized vbi_export object.
dIf non-zero, store pointer to allocated string here. When *d is non-zero, free(*d) the old string first.
sString to be duplicated.

Helper function for export modules.

Same as the libc strdup(), except for d argument and setting the export error string on failure.

Returns
NULL on failure, pointer to malloc()ed string otherwise.

References vbi_export_error_printf().

Referenced by vbi_export_option_get(), and vbi_export_option_set().

◆ vbi_export_error_printf()

void vbi_export_error_printf ( vbi_export export,
const char *  templ,
  ... 
)
Parameters
exportPointer to a initialized vbi_export object.
templSee printf().
...See printf().

Store an error description in the export object. Including the current error description (to append or prepend) is safe.

References vbi_export::errstr.

Referenced by vbi_export_file(), vbi_export_invalid_option(), vbi_export_strdup(), vbi_export_unknown_option(), and vbi_export_write_error().

◆ vbi_ucs2be()

int vbi_ucs2be ( void  )

Helper function for export modules, since iconv seems undecided what it really wants (not every iconv supports UCS-2LE/BE).

Returns
1 if iconv "UCS-2" is BE on this machine, 0 if LE, -1 if unknown.

Referenced by vbi_print_page_region().