/usr/include/namazu/libnamazu.h is in libnmz7-dev 2.0.21-10.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | /*
*
* libnamazu.h - Namazu library api
*
* $Id: libnamazu.h,v 1.46.4.9 2009-02-17 01:28:39 opengl2772 Exp $
*
*/
#ifndef _LIBNAMAZU_H
#define _LIBNAMAZU_H
#include <stdio.h> /* for FILE struct */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/*
* Set the message of error occurred in libnmz.
*/
#ifdef __GNUC__
#define nmz_set_dyingmsg(msg) \
{ \
if (nmz_is_debugmode()) { \
nmz_set_dyingmsg_sub("%s:%d (%s): %s", \
__FILE__, __LINE__, __PRETTY_FUNCTION__, msg);\
} else { \
nmz_set_dyingmsg_sub("%s", msg);\
} \
}
#else /* !__GNUC__ */
#define nmz_set_dyingmsg(msg) \
{ \
if (nmz_is_debugmode()) { \
nmz_set_dyingmsg_sub("%s:%d: %s", __FILE__, __LINE__, msg);\
} else { \
nmz_set_dyingmsg_sub("%s", msg);\
} \
}
#endif /* __GNUC__ */
/*
*
* Critical values.
*
*/
enum {
/* Size of general buffers. This MUST be larger than QUERY_MAX */
BUFSIZE = 1024,
QUERY_TOKEN_MAX = 32, /* Max number of tokens in the query. */
QUERY_MAX = 256, /* Max length of the query. */
INDEX_MAX = 64 /* Max number of databases */
};
/*
*
* Magic Numbers.
*
*/
enum {
ESC = 0x1b, /* Code of ESC */
STDIN = 0, /* stdin's fd */
STDOUT = 1, /* stdout's fd */
STDERR = 2 /* stderr's fd */
};
/*
*
* Data Structures.
*
*/
typedef unsigned char uchar;
/*
* forward declarations of namazu types.
*/
typedef struct _NmzResult NmzResult;
/*
* Status code for error handling.
*/
enum nmz_stat {
FAILURE = -1,
SUCCESS,
ERR_FATAL,
ERR_TOO_LONG_QUERY,
ERR_INVALID_QUERY,
ERR_TOO_MANY_TOKENS,
ERR_TOO_MUCH_MATCH,
ERR_TOO_MUCH_HIT,
ERR_REGEX_SEARCH_FAILED,
ERR_PHRASE_SEARCH_FAILED,
ERR_FIELD_SEARCH_FAILED,
ERR_CANNOT_OPEN_INDEX,
ERR_NO_PERMISSION,
ERR_CANNOT_OPEN_RESULT_FORMAT_FILE,
ERR_INDEX_IS_LOCKED,
ERR_OLD_INDEX_FORMAT
};
/*
* Modes of searching.
*/
enum nmz_searchmethod {
WORD_MODE,
PREFIX_MODE,
REGEX_MODE,
PHRASE_MODE,
FIELD_MODE,
ERROR_MODE
};
/*
* Methods of sorting.
*/
enum nmz_sortmethod {
SORT_BY_SCORE,
SORT_BY_DATE,
SORT_BY_FIELD
};
/*
* Orders of sorting.
*/
enum nmz_sortorder {
ASCENDING,
DESCENDING
};
/*
* Data structure for each hit document.
*/
struct nmz_data {
int score;
int docid; /* document ID */
int idxid; /* index ID */
int date; /* document's date */
int rank; /* ranking data for stable sorting */
char *field; /* field's contents for field-specified search */
};
/*
* Data structure for search result.
*/
struct _NmzResult {
int num; /* number of elements in its data */
enum nmz_stat stat; /* status code mainly used for error handling */
struct nmz_data *data; /* dynamic array for storing nmz_data's. */
};
/*
* NMZ.* files' names.
*/
struct nmz_names {
#define MAXPATH BUFSIZE
char i[MAXPATH];
char ii[MAXPATH];
char head[MAXPATH]; /* followed by a language code */
char foot[MAXPATH]; /* followed by a language code */
char body[MAXPATH]; /* followed by a language code */
char lock[MAXPATH];
char result[MAXPATH];
char slog[MAXPATH];
char w[MAXPATH];
char wi[MAXPATH];
char field[MAXPATH]; /* followed by a field name */
char t[MAXPATH];
char p[MAXPATH];
char pi[MAXPATH];
char tips[MAXPATH];
char access[MAXPATH];
char version[MAXPATH];
char warnlog[MAXPATH];
};
/*
* NMZ.* files' file pointers
*/
struct nmz_files {
FILE *i;
FILE *ii;
FILE *p;
FILE *pi;
FILE *w;
FILE *wi;
};
struct nmz_indices {
int num; /* Number of indices */
char *names[INDEX_MAX + 1]; /* Index names */
struct nmz_hitnumlist
*hitnumlists[INDEX_MAX + 1]; /* hitnum list of each index */
int totalhitnums[INDEX_MAX + 1]; /* total hit number of each index */
};
struct nmz_query {
int tokennum; /* Number of tokens in the query */
char str[BUFSIZE]; /* Query string */
char *tab[QUERY_TOKEN_MAX + 1]; /* Token pointers pointed to str */
};
/*
* List containig hit numbers of each index word by word.
*/
struct nmz_hitnumlist {
char *word;
int hitnum;
enum nmz_stat stat; /* status code mainly used for error handling */
struct nmz_hitnumlist *phrase; /* for a result of a phrase search */
struct nmz_hitnumlist *next;
};
/*
* Field cache information
*/
struct field_cache {
int idxid;
int docid;
char field[BUFSIZE];
char data[BUFSIZE];
};
extern void nmz_free_aliases ( void );
extern void nmz_free_replaces ( void );
extern void nmz_set_sortmethod ( enum nmz_sortmethod method );
extern enum nmz_sortmethod nmz_get_sortmethod(void);
extern void nmz_set_sortorder ( enum nmz_sortorder order );
extern enum nmz_sortorder nmz_get_sortorder(void);
extern void nmz_set_maxhit ( int max );
extern int nmz_get_maxhit ( void );
extern void nmz_set_maxmatch ( int max );
extern int nmz_get_maxmatch ( void );
extern void nmz_set_debugmode ( int mode );
extern int nmz_is_debugmode ( void );
extern void nmz_set_loggingmode ( int mode );
extern int nmz_is_loggingmode ( void );
extern void nmz_set_regex_searchmode ( int mode );
extern int nmz_is_regex_searchmode ( void );
extern void nmz_set_output_warn_to_file ( int mode );
extern int nmz_is_output_warn_to_file ( void );
extern char *nmz_get_dyingmsg ( void );
extern char *nmz_set_dyingmsg_sub(const char *fmt, ...);
extern char *nmz_msg(const char *fmt, ...);
extern void nmz_free_internal(void);
/* since v2.0.13 */
extern char *nmz_get_version();
/* since v2.0.17 */
#define nmz_isascii(c) (!(c & 0x80))
#define nmz_isprint(c) (nmz_isascii(c) && isprint(c))
#define nmz_isdigit(c) (nmz_isascii(c) && isdigit(c))
#define nmz_isalnum(c) (nmz_isascii(c) && isalnum(c))
#define nmz_isalpha(c) (nmz_isascii(c) && isalpha(c))
#define nmz_iscntrl(c) (nmz_isascii(c) && iscntrl(c))
#define nmz_islower(c) (nmz_isascii(c) && islower(c))
#define nmz_ispunct(c) (nmz_isascii(c) && ispunct(c))
#define nmz_isspace(c) (nmz_isascii(c) && isspace(c))
#define nmz_isupper(c) (nmz_isascii(c) && isupper(c))
#define nmz_isxdigit(c) (nmz_isascii(c) && isxdigit(c))
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* _LIBNAMAZU_H */
|