Main Page | Modules | Data Structures | Data Fields | Related Pages | Examples

Search
[Page cache]

Search the Teletext page cache. More...

Typedefs

typedef vbi_search vbi_search
 Opaque search context.


Enumerations

enum  vbi_search_status {
  VBI_SEARCH_ERROR = -3,
  VBI_SEARCH_CACHE_EMPTY,
  VBI_SEARCH_CANCELED,
  VBI_SEARCH_NOT_FOUND = 0,
  VBI_SEARCH_SUCCESS
}
 Return codes of the vbi_search_next() function. More...


Functions

vbi_searchvbi_search_new (vbi_decoder *vbi, vbi_pgno pgno, vbi_subno subno, uint16_t *pattern, vbi_bool casefold, vbi_bool regexp, int(*progress)(vbi_page *pg))
void vbi_search_delete (vbi_search *search)
vbi_search_status vbi_search_next (vbi_search *search, vbi_page **pg, int dir)

Detailed Description

Search the Teletext page cache.


Enumeration Type Documentation

enum vbi_search_status
 

Return codes of the vbi_search_next() function.

Enumeration values:
VBI_SEARCH_ERROR  Pattern not found, pg is invalid. Another vbi_search_next() will restart from the original starting point.
VBI_SEARCH_CACHE_EMPTY  The search has been canceled by the progress function. pg points to the current page as in success case, except for the highlighting. Another vbi_search_next() continues from this page.
VBI_SEARCH_CANCELED  No pages in the cache, pg is invalid.
VBI_SEARCH_NOT_FOUND  Some error occured, condition unclear. Call vbi_search_delete().
VBI_SEARCH_SUCCESS  Pattern found. pg points to the page ready for display with the pattern highlighted, pg->pgno etc.


Function Documentation

vbi_search* vbi_search_new vbi_decoder *  vbi,
vbi_pgno  pgno,
vbi_subno  subno,
uint16_t *  pattern,
vbi_bool  casefold,
vbi_bool  regexp,
int(*  progress)(vbi_page *pg)
 

Parameters:
vbi Initialized vbi decoding context.
pgno 
subno Page and subpage number of the first (forward) or last (backward) page to visit. Optional VBI_ANY_SUBNO.
pattern The Unicode (UCS-2, not UTF-16) search pattern, a 0-terminated string.
casefold Boolean, search case insensitive.
regexp Boolean, the search pattern is a regular expression.
progress A function called for each page scanned, can be NULL. Shall return FALSE to abort the search. pg is valid for display (e. g. pg->pgno), do not call vbi_unref_page() or modify this page.
Allocate a vbi_search context and prepare for searching the Teletext page cache. The context must be freed with vbi_search_delete().

Regular expression searching supports the standard set of operators and constants, with these extensions:

....hexadecimal number of up to 4 digits
....hexadecimal number of up to 4 digits
....hexadecimal number of up to 4 digits
....hexadecimal number of up to 4 digits
:title:Unicode specific character class
:gfx:Teletext G1 or G3 graphics
:drcs:Teletext DRCS
,N2,...,NnCharacter properties class
,N2,...,NnNegated character properties class

NProperty
1alphanumeric
2alpha
3control
4digit
5graphical
6lowercase
7printable
8punctuation
9space
10uppercase
11hex digit
12title
13defined
14wide
15nonspacing
16Teletext G1 or G3 graphics
17Teletext DRCS

Character classes can contain literals, constants, and character property classes. Example: [abc,3,4]. Note double height and size characters will match twice, on the upper and lower row, and double width and size characters count as one (reducing the line width) so one can find combinations of normal and enlarged characters.

Bug:
In a multithreaded application the data service decoder may receive and cache new pages during a search session. When these page numbers have been visited already the pages are not searched. At a channel switch (and in future at any time) pages can be removed from cache. All this has yet to be addressed.
Returns:
A vbi_search context or NULL on error.

void vbi_search_delete vbi_search search  ) 
 

Parameters:
search vbi_search context.
Delete the search context created by vbi_search_new().

vbi_search_status vbi_search_next vbi_search search,
vbi_page **  pg,
int  dir
 

Parameters:
search Initialized search context.
pg Place to store the formatted (as with vbi_fetch_vt_page()) Teletext page containing the found pattern. Do not call vbi_unref_page() for this page. Also the page must not be modified. See vbi_search_status for semantics.
dir Search direction +1 forward or -1 backward.
Find the next occurence of the search pattern.

Returns:
vbi_search_status.


Generated on Wed Jul 28 19:57:14 2004 for ZVBI Library by doxygen 1.3.7