/***********************************************************************
gutenfetch - query and fetch electronic texts from project gutenberg
Copyright (C) 2001, 2002, 2003 Russell Francis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
Last updated on $Date: 2004/03/21 05:14:23 $ by $Author: johntabularasa $.
***********************************************************************/
#ifndef LIBGUTENFETCH_FILTER_H
#define LIBGUTENFETCH_FILTER_H
#include "stddefs.h"
#include "libgutenfetch_error.h"
#include "list.h"
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#if ((HAVE_REGEX_H==1) && (USE_C_REGEX==1))
# include <regex.h>
#else
# if ((HAVE_GNUREGEX_H) && (USE_LIBGNUREGEX==1))
# include <gnuregex.h>
# else
# include "gnuregex.h"
# endif
#endif
/*
* These can be passed as the first argument to
* gutenfetch_ifilter_match to use these already created
* predefined filters.
*/
enum {
IFILTER_GUTINDEX_OLD,
IFILTER_GUTINDEX_NEW,
IFILTER_AUTHOR,
IFILTER_OLD_TITLE,
IFILTER_NEW_TITLE,
IFILTER_LS_LR_DETAIL_DIRECTORY,
IFILTER_LS_LR_DETAIL_ENTRY,
IFILTER_LS_R_DETAIL_DIRECTORY,
IFILTER_LS_R_DETAIL_ENTRY,
IFILTER_FILENAME_BASE_EXT,
NUM_OF_IFILTER
};
typedef struct {
int sub; /* should we return the values which match? */
regex_t *regex; /* The compiled regular expression. */
} gutenfetch_filter_t;
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
gutenfetch_error_t gutenfetch_filter_init(void);
gutenfetch_error_t gutenfetch_filter_shutdown(void);
gutenfetch_filter_t* gutenfetch_filter_create(
const char *, int);
list_t* gutenfetch_ifilter_match(
int,
const char *);
list_t* gutenfetch_filter_match(
gutenfetch_filter_t *,
const char *);
void gutenfetch_filter_destroy(
gutenfetch_filter_t *);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* FILTER_H */
syntax highlighted by Code2HTML, v. 0.9.1