-
Notifications
You must be signed in to change notification settings - Fork 6
/
search.h
97 lines (87 loc) · 2.57 KB
/
search.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*
* libzvbi -- Teletext page cache search functions
*
* Copyright (C) 2000, 2001, 2002 Michael H. Schimek
* Copyright (C) 2000, 2001 Iñaki G. Etxebarria
*
* Originally based on AleVT 1.5.1 by Edgar Toernig
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*/
/* $Id: search.h,v 1.5 2008/02/19 00:35:22 mschimek Exp $ */
#ifndef SEARCH_H
#define SEARCH_H
#ifndef VBI_DECODER
#define VBI_DECODER
typedef struct vbi_decoder vbi_decoder;
#endif
/* Public */
/**
* @ingroup Search
* @brief Return codes of the vbi_search_next() function.
*/
typedef enum {
/**
* Pattern not found, @a pg is invalid. Another vbi_search_next()
* will restart from the original starting point.
*/
VBI_SEARCH_ERROR = -3,
/**
* The search has been canceled by the progress function.
* @a pg points to the current page as in success case,
* except for the highlighting. Another vbi_search_next()
* continues from this page.
*/
VBI_SEARCH_CACHE_EMPTY,
/**
* No pages in the cache, @a pg is invalid.
*/
VBI_SEARCH_CANCELED,
/**
* Some error occured, condition unclear. Call vbi_search_delete().
*/
VBI_SEARCH_NOT_FOUND = 0,
/**
* Pattern found. @a pg points to the page ready for display with the pattern
* highlighted, @a pg->pgno etc.
*/
VBI_SEARCH_SUCCESS
} vbi_search_status;
/**
* @ingroup Search
* @brief Opaque search context.
*/
typedef struct vbi_search vbi_search;
/**
* @addtogroup Search
* @{
*/
extern 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));
extern void vbi_search_delete(vbi_search *search);
extern vbi_search_status vbi_search_next(vbi_search *search, vbi_page **pg, int dir);
/** @} */
/* Private */
#endif /* SEARCH_H */
/*
Local variables:
c-set-style: K&R
c-basic-offset: 8
End:
*/