dic_search.c File Reference


Detailed Description

Dictionary lookup functions.

Author:
Antoine Fraboulet
Date:
2002

Definition in file dic_search.c.

#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include "dic_internals.h"
#include "dic.h"
#include "regexp.h"
#include "dic_search.h"
#include "libdic_a-er.h"
#include "scanner.h"
#include "automaton.h"

Go to the source code of this file.

Data Structures

struct  params_7plus1_t
 global variables for Dic_search_word_by_len : More...
struct  params_cross_t
struct  params_regexp_t

Functions

static int yy_init_globals (yyscan_t yyscanner)
static Dawg_edgeDic_seek_edgeptr (const Dictionary dic, const char *s, Dawg_edge *eptr)
 Dic_seel_edgeptr walk the dictionary until the end of the word.
int Dic_search_word (const Dictionary dic, const char *word)
 Search for a word in the dictionnary.
static void Dic_search_word_by_len (struct params_7plus1_t *params, int i, Dawg_edge *edgeptr)
void Dic_search_7pl1 (const Dictionary dic, const char *rack, char buff[DIC_LETTERS][RES_7PL1_MAX][DIC_WORD_MAX], int joker)
 Search for all feasible word with "rack" plus one letter.
void Dic_search_Racc (const Dictionary dic, const char *word, char wordlist[RES_RACC_MAX][DIC_WORD_MAX])
 Search for all feasible word adding a letter in front or at the end.
void Dic_search_Benj (const Dictionary dic, const char *word, char wordlist[RES_BENJ_MAX][DIC_WORD_MAX])
 Search for benjamins.
void Dic_search_cross_rec (struct params_cross_t *params, char wordlist[RES_CROS_MAX][DIC_WORD_MAX], Dawg_edge *edgeptr)
void Dic_search_Cros (const Dictionary dic, const char *mask, char wordlist[RES_CROS_MAX][DIC_WORD_MAX])
 Search for crosswords.
void Dic_search_regexp_rec (struct params_regexp_t *params, int state, Dawg_edge *edgeptr, char wordlist[RES_REGE_MAX][DIC_WORD_MAX])
int regexpparse (yyscan_t scanner, NODE **root, struct search_RegE_list_t *list, struct regexp_error_report_t *err)
 function prototype for parser generated by bison
void Dic_search_RegE (const Dictionary dic, const char *re, char wordlist[RES_REGE_MAX][DIC_WORD_MAX], struct search_RegE_list_t *list)
 Search for words matching a regular expression.


Function Documentation

void Dic_search_7pl1 Dictionary  dic,
const char *  rack,
char  wordlist[DIC_LETTERS][RES_7PL1_MAX][DIC_WORD_MAX],
int  joker
 

Search for all feasible word with "rack" plus one letter.

Parameters:
dic : dictionary
rack : letters
wordlist : results

Definition at line 163 of file dic_search.c.

References _Dictionary::dawg, DIC_CHAR_MASK, DIC_LETTERS, Dic_search_word_by_len(), _Dawg_edge::ptr, RES_7PL1_MAX, _Dictionary::root, params_7plus1_t::search_dic, params_7plus1_t::search_len, params_7plus1_t::search_letters, params_7plus1_t::search_wordlist, params_7plus1_t::search_wordlistlen, params_7plus1_t::search_wordlistlenmax, and params_7plus1_t::search_wordtst.

Referenced by Plus1Frame::refresh().

void Dic_search_Benj Dictionary  dic,
const char *  word,
char  wordlist[RES_BENJ_MAX][DIC_WORD_MAX]
 

Search for benjamins.

Parameters:
dic : dictionary
rack : letters
wordlist : results

Definition at line 296 of file dic_search.c.

References _Dawg_edge::chr, _Dictionary::dawg, Dic_seek_edgeptr(), _Dawg_edge::ptr, RES_BENJ_MAX, _Dictionary::root, and _Dawg_edge::term.

Referenced by BenjFrame::refresh().

void Dic_search_Cros Dictionary  dic,
const char *  mask,
char  wordlist[RES_CROS_MAX][DIC_WORD_MAX]
 

Search for crosswords.

Parameters:
dic : dictionary
rack : letters
wordlist : results

Definition at line 385 of file dic_search.c.

References DIC_CHAR_MASK, params_cross_t::mask, and RES_CROS_MAX.

Referenced by eliottxt_get_cross().

void Dic_search_cross_rec struct params_cross_t params,
char  wordlist[RES_CROS_MAX][DIC_WORD_MAX],
Dawg_edge edgeptr
 

Definition at line 343 of file dic_search.c.

References _Dawg_edge::chr, _Dictionary::dawg, params_cross_t::dic, DIC_CHAR_MASK, params_cross_t::mask, _Dawg_edge::ptr, _Dawg_edge::term, params_cross_t::wordlen, params_cross_t::wordlistlen, and params_cross_t::wordlistlenmax.

void Dic_search_Racc Dictionary  dic,
const char *  word,
char  wordlist[RES_RACC_MAX][DIC_WORD_MAX]
 

Search for all feasible word adding a letter in front or at the end.

Parameters:
dic : dictionary
word : word
wordlist : results

Definition at line 242 of file dic_search.c.

References Dic_search_word(), and RES_RACC_MAX.

Referenced by RaccFrame::refresh().

void Dic_search_RegE Dictionary  dic,
const char *  re,
char  wordlist[RES_REGE_MAX][DIC_WORD_MAX],
struct search_RegE_list_t list
 

Search for words matching a regular expression.

Parameters:
dic : dictionary
re : regular expression
wordlist : results

Definition at line 473 of file dic_search.c.

References params_regexp_t::automaton, automaton_build(), automaton_delete(), automaton_get_init(), params_regexp_t::charlist, _Dictionary::dawg, params_regexp_t::dic, Dic_search_regexp_rec(), params_regexp_t::maxlength, search_RegE_list_t::maxlength, params_regexp_t::minlength, search_RegE_list_t::minlength, regexp_error_report_t::msg, regexp_error_report_t::pos1, regexp_error_report_t::pos2, node::PP, regexp_delete_tree(), REGEXP_MAX, regexp_parcours(), regexp_possuivante(), regexpparse(), RES_REGE_MAX, _Dictionary::root, params_regexp_t::word, params_regexp_t::wordlen, params_regexp_t::wordlistlen, and params_regexp_t::wordlistlenmax.

Referenced by PRegExp::compute_enter(), and main().

void Dic_search_regexp_rec struct params_regexp_t params,
int  state,
Dawg_edge edgeptr,
char  wordlist[RES_REGE_MAX][DIC_WORD_MAX]
 

Definition at line 429 of file dic_search.c.

References params_regexp_t::automaton, automaton_get_accept(), automaton_get_next_state(), _Dawg_edge::chr, _Dictionary::dawg, params_regexp_t::dic, params_regexp_t::maxlength, params_regexp_t::minlength, _Dawg_edge::ptr, _Dawg_edge::term, params_regexp_t::word, params_regexp_t::wordlen, params_regexp_t::wordlistlen, and params_regexp_t::wordlistlenmax.

Referenced by Dic_search_RegE().

int Dic_search_word const Dictionary  dic,
const char *  word
 

Search for a word in the dictionnary.

Parameters:
dic : dictionary
word : word to lookup
Returns:
0 not a valid word, 1 ok

Definition at line 80 of file dic_search.c.

References _Dictionary::dawg, Dic_seek_edgeptr(), _Dictionary::root, and _Dawg_edge::term.

Referenced by Game::checkPlayedWord(), Dic_search_Racc(), loop_duplicate(), loop_freegame(), loop_training(), and VerifFrame::verif().

static void Dic_search_word_by_len struct params_7plus1_t params,
int  i,
Dawg_edge edgeptr
[static]
 

Definition at line 108 of file dic_search.c.

References _Dawg_edge::chr, _Dictionary::dawg, _Dawg_edge::ptr, params_7plus1_t::search_dic, params_7plus1_t::search_len, params_7plus1_t::search_letters, params_7plus1_t::search_wordlist, params_7plus1_t::search_wordlistlen, params_7plus1_t::search_wordlistlenmax, params_7plus1_t::search_wordtst, and _Dawg_edge::term.

Referenced by Dic_search_7pl1().

static Dawg_edge* Dic_seek_edgeptr const Dictionary  dic,
const char *  s,
Dawg_edge eptr
[static]
 

Dic_seel_edgeptr walk the dictionary until the end of the word.

Parameters:
dic : dictionnary
s : current pointer to letters
eptr : current edge in the dawg

Definition at line 56 of file dic_search.c.

References _Dawg_edge::chr, _Dictionary::dawg, DIC_CHAR_MASK, and _Dawg_edge::ptr.

Referenced by Dic_search_Benj(), and Dic_search_word().

int regexpparse yyscan_t  scanner,
NODE **  root,
struct search_RegE_list_t list,
struct regexp_error_report_t err
 

function prototype for parser generated by bison

Referenced by Dic_search_RegE().

static int yy_init_globals yyscan_t  yyscanner  )  [static]
 

Definition at line 42 of file dic_search.c.


Generated on Thu Dec 29 02:01:15 2005 for Eliot by  doxygen 1.4.5