Next: Output, Previous: dico_database_module, Up: Dico Module Interface [Contents][Index]
A search strategy is described by the following structure:
struct dico_strategy { char *name; /* Strategy name */ char *descr; /* Strategy description */ dico_select_t sel; /* Selector function */ void *closure; /* Additional data for SEL */ int is_default; /* True, if this is a default strategy */ dico_list_t stratcl; /* Strategy access control list */ };
The first two members are mandatory and must be defined for each strategy:
char *
name ¶Short name of the strategy. It is used as second argument to the
MATCH
command (see The MATCH Command) and is displayed in the first
column of output by the SHOW STRAT
command (see SHOW STRAT).
char *
descr ¶Strategy description. It is the string shown in the second column of
SHOW STRAT
output (see SHOW STRAT).
A selector function, which is used in iterative matches to
select matching headwords. The sel
function is called for each
headword in the database with the headword and search key as its
arguments and returns 1 if the headword matches the key and 0
otherwise. The dico_select_t
type is defined as:
typedef int (*dico_select_t) (int, dico_key_t, const char *);
See Strategy Selectors, for a detailed description.
void *
closure ¶An opaque data pointer intended for use by the selector function.
This member is set to 1 by the server if this strategy is selected as the default one (see default strategy).
A control list associated with this strategy. See Strategies and Default Searches.
Next: Output, Previous: dico_database_module, Up: Dico Module Interface [Contents][Index]