mirror of
git://git.savannah.nongnu.org/eliot.git
synced 2024-12-25 21:59:30 +01:00
- 32/64 bits types
- unused function parameters
This commit is contained in:
parent
33e5b23004
commit
d86bd2af4a
29 changed files with 198 additions and 184 deletions
39
.cvsignore
39
.cvsignore
|
@ -1,34 +1,35 @@
|
|||
.*
|
||||
ABOUT-NLS
|
||||
intl
|
||||
m4
|
||||
core
|
||||
core.*
|
||||
gmon.out
|
||||
configure
|
||||
config.h
|
||||
config.h.*
|
||||
config.guess
|
||||
config.log
|
||||
config.cache
|
||||
config.rpath
|
||||
config.status
|
||||
config.sub
|
||||
Makefile
|
||||
Makefile.in
|
||||
aclocal.m4
|
||||
autom4te.cache
|
||||
compile
|
||||
depcomp
|
||||
install-sh
|
||||
missing
|
||||
mkinstalldirs
|
||||
stamp-*
|
||||
config.cache
|
||||
config.guess
|
||||
config.h
|
||||
config.h.*
|
||||
config.log
|
||||
config.rpath
|
||||
config.status
|
||||
config.sub
|
||||
configure
|
||||
core
|
||||
core.*
|
||||
cscope.files
|
||||
cscope.out
|
||||
depcomp
|
||||
dic/cscope.files
|
||||
dic/cscope.out
|
||||
game/cscope.files
|
||||
game/cscope.out
|
||||
gmon.out
|
||||
install-sh
|
||||
intl
|
||||
m4
|
||||
missing
|
||||
mkinstalldirs
|
||||
stamp-*
|
||||
wxwin/cscope.files
|
||||
wxwin/cscope.out
|
||||
ylwrap
|
||||
|
|
13
INSTALL
13
INSTALL
|
@ -4,18 +4,23 @@ Installation sous Linux (Un*x) (bien/facile)
|
|||
|
||||
./bootstrap
|
||||
|
||||
./configure --prefix=/usr/local/eliot
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
|
||||
* Pour installer à partir de l'archive tar.gz
|
||||
|
||||
./configure --prefix=/usr/local/eliot
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
|
||||
Il suffit de rajouter le chemin pour trouver eliot
|
||||
sur sa ligne de commande et le tour est joué.
|
||||
|
||||
il existe en fait 3 versions d'eliot, une en mode texte, une avec une
|
||||
interface curses et une avec wxwidgets. Les modes peuvent être
|
||||
sélectionnés à l'aide de la commande configure lors de la compilation
|
||||
du programme.
|
||||
|
||||
./configure --enable-text --enable-ncurses --enable-wxwidgets
|
||||
|
||||
|
||||
|
||||
|
|
36
configure.in
36
configure.in
|
@ -19,11 +19,12 @@ AC_PROG_MAKE_SET
|
|||
AC_PROG_RANLIB
|
||||
|
||||
AC_PROG_YACC
|
||||
if test "$YACC" = yacc; then
|
||||
if test "$YACC" = yacc ; then
|
||||
AC_MSG_ERROR([Could not find the 'bison' program on your system])
|
||||
fi
|
||||
|
||||
AM_PROG_LEX
|
||||
if test "$LEX" != flex; then
|
||||
if test "$LEX" != "flex" ; then
|
||||
AC_MSG_ERROR([Could not find the 'flex' program on your system])
|
||||
fi
|
||||
|
||||
|
@ -32,28 +33,39 @@ dnl Checks for compilation flags
|
|||
dnl --------------------------------------------------------------
|
||||
CFLAGS_save="${CFLAGS}"
|
||||
AC_CACHE_CHECK([if \$CC accepts -Wall],
|
||||
[ac_cv_c_Wall],
|
||||
[CFLAGS="-Wall ${CFLAGS_save}"
|
||||
AC_TRY_COMPILE([],,ac_cv_c_Wall=yes, ac_cv_c_Wall=no)])
|
||||
[ac_cv_c_Wall],
|
||||
[CFLAGS="-Wall ${CFLAGS_save}"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[ac_cv_c_Wall=yes],[ac_cv_c_Wall=no])])
|
||||
CFLAGS="${CFLAGS_save}"
|
||||
if test "${ac_cv_c_Wall}" != "no"; then
|
||||
CFLAGS="-Wall ${CFLAGS}"
|
||||
CXXFLAGS="-Wall ${CXXFLAGS}"
|
||||
CFLAGS+=" -Wall"
|
||||
CXXFLAGS+=" -Wall"
|
||||
fi
|
||||
|
||||
CFLAGS_save="${CFLAGS}"
|
||||
AC_CACHE_CHECK([if \$CC accepts -Wextra],
|
||||
[ac_cv_c_Wextra],
|
||||
[CFLAGS="-Wextra ${CFLAGS_save}"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[ac_cv_c_Wextra=yes],[ac_cv_c_Wextra=no])])
|
||||
CFLAGS="${CFLAGS_save}"
|
||||
if test "${ac_cv_c_Wextra}" != "no"; then
|
||||
CFLAGS+=" -Wextra"
|
||||
CXXFLAGS+=" -Wextra"
|
||||
fi
|
||||
|
||||
dnl Debug mode
|
||||
AC_ARG_ENABLE([debug],AC_HELP_STRING([--enable-debug],[debug mode (default disabled)]))
|
||||
if test "${enable_debug}" = "yes"; then
|
||||
CFLAGS="${CFLAGS} -g -DDEBUG"
|
||||
CPPFLAGS="${CPPFLAGS} -g -DDEBUG"
|
||||
CFLAGS+=" -g -DDEBUG"
|
||||
CXXFLAGS+=" -g -DDEBUG"
|
||||
fi
|
||||
|
||||
dnl Profile mode
|
||||
AC_ARG_ENABLE([profile],AC_HELP_STRING([--enable-profile],[profile mode (default disabled)]))
|
||||
if test "${enable_profile}" = "yes"; then
|
||||
CFLAGS="${CFLAGS} -pg -DPROFILE"
|
||||
CPPFLAGS="${CPPFLAGS} -pg -DPROFILE"
|
||||
LDFLAGS="${LDFLAGS} -pg"
|
||||
CFLAGS+=" -pg -DPROFILE"
|
||||
CXXFLAGS+=" -pg -DPROFILE"
|
||||
LDFLAGS+=" -pg"
|
||||
fi
|
||||
|
||||
dnl Regexp / Listdic / Compdic build enable
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <stdlib.h>
|
||||
#include "alist.h"
|
||||
|
||||
#define __UNUSED__ __attribute__((unused))
|
||||
|
||||
struct alist_elt_t {
|
||||
void* info;
|
||||
|
@ -166,7 +167,7 @@ alist_get_first(alist l)
|
|||
}
|
||||
|
||||
alist_elt
|
||||
alist_get_next(alist l, alist_elt e)
|
||||
alist_get_next(alist __UNUSED__ l, alist_elt e)
|
||||
{
|
||||
return e->next;
|
||||
}
|
||||
|
|
114
dic/automaton.c
114
dic/automaton.c
|
@ -72,8 +72,6 @@ static Automaton s_automaton_create ();
|
|||
static void s_automaton_delete (Automaton a);
|
||||
|
||||
static alist s_automaton_id_create (int id);
|
||||
static char* s_automaton_id_to_str (alist id);
|
||||
|
||||
static astate s_automaton_state_create (alist id);
|
||||
|
||||
static void s_automaton_add_state (Automaton a, astate s);
|
||||
|
@ -82,7 +80,9 @@ static astate s_automaton_get_state (Automaton a, alist id);
|
|||
static Automaton s_automaton_PS_to_NFA (int init_state, int *ptl, int *PS);
|
||||
static Automaton s_automaton_NFA_to_DFA (Automaton a, struct search_RegE_list_t *list);
|
||||
static automaton s_automaton_finalize (Automaton a);
|
||||
|
||||
#ifdef DEBUG_AUTOMATON
|
||||
static char* s_automaton_id_to_str (alist id);
|
||||
static void s_automaton_dump (Automaton a, char* filename);
|
||||
#endif
|
||||
|
||||
|
@ -114,8 +114,7 @@ struct automaton_t {
|
|||
exported functions for static automata
|
||||
* ************************************************** */
|
||||
|
||||
automaton
|
||||
automaton_build(int init_state, int *ptl, int *PS, struct search_RegE_list_t *list)
|
||||
automaton automaton_build(int init_state, int *ptl, int *PS, struct search_RegE_list_t *list)
|
||||
{
|
||||
Automaton nfa,dfa;
|
||||
automaton final;
|
||||
|
@ -137,8 +136,7 @@ automaton_build(int init_state, int *ptl, int *PS, struct search_RegE_list_t *li
|
|||
return final;
|
||||
}
|
||||
|
||||
void
|
||||
automaton_delete(automaton a)
|
||||
void automaton_delete(automaton a)
|
||||
{
|
||||
int i;
|
||||
free(a->accept);
|
||||
|
@ -148,32 +146,27 @@ automaton_delete(automaton a)
|
|||
free(a);
|
||||
}
|
||||
|
||||
inline int
|
||||
automaton_get_nstates(automaton a)
|
||||
inline int automaton_get_nstates(automaton a)
|
||||
{
|
||||
return a->nstates;
|
||||
}
|
||||
|
||||
inline int
|
||||
automaton_get_init(automaton a)
|
||||
inline int automaton_get_init(automaton a)
|
||||
{
|
||||
return a->init;
|
||||
}
|
||||
|
||||
inline int
|
||||
automaton_get_accept(automaton a, int state)
|
||||
inline int automaton_get_accept(automaton a, int state)
|
||||
{
|
||||
return a->accept[state];
|
||||
}
|
||||
|
||||
inline int
|
||||
automaton_get_next_state(automaton a, int state, char l)
|
||||
inline int automaton_get_next_state(automaton a, int state, char l)
|
||||
{
|
||||
return a->trans[state][(int)l];
|
||||
}
|
||||
|
||||
void
|
||||
automaton_dump(automaton a, char* filename)
|
||||
void automaton_dump(automaton a, char* filename)
|
||||
{
|
||||
int i,l;
|
||||
FILE* f;
|
||||
|
@ -223,16 +216,14 @@ automaton_dump(automaton a, char* filename)
|
|||
* ************************************************** *
|
||||
* ************************************************** */
|
||||
|
||||
void
|
||||
state_delete_fun(void* ps)
|
||||
void state_delete_fun(void* ps)
|
||||
{
|
||||
astate s = ps;
|
||||
alist_delete(s->id);
|
||||
free(s);
|
||||
}
|
||||
|
||||
static Automaton
|
||||
s_automaton_create()
|
||||
static Automaton s_automaton_create()
|
||||
{
|
||||
Automaton a;
|
||||
a = (Automaton)malloc(sizeof(struct Automaton_t));
|
||||
|
@ -244,37 +235,20 @@ s_automaton_create()
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
s_automaton_delete(Automaton a)
|
||||
static void s_automaton_delete(Automaton a)
|
||||
{
|
||||
alist_delete(a->states);
|
||||
free(a);
|
||||
}
|
||||
|
||||
static alist
|
||||
s_automaton_id_create(int id)
|
||||
static alist s_automaton_id_create(int id)
|
||||
{
|
||||
alist a = alist_create();
|
||||
alist_add(a,(void*)id);
|
||||
alist_add(a,(void*)((unsigned long)id));
|
||||
return a;
|
||||
}
|
||||
|
||||
static char* s_automaton_id_to_str(alist id)
|
||||
{
|
||||
static char s[250];
|
||||
memset(s,0,sizeof(s));
|
||||
alist_elt ptr;
|
||||
for(ptr = alist_get_first(id); ptr ; ptr = alist_get_next(id,ptr))
|
||||
{
|
||||
char tmp[50];
|
||||
sprintf(tmp,"%d ",(int)alist_elt_get_value(ptr));
|
||||
strcat(s,tmp);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
static astate
|
||||
s_automaton_state_create(alist id)
|
||||
static astate s_automaton_state_create(alist id)
|
||||
{
|
||||
astate s;
|
||||
s = (astate)malloc(sizeof(struct automaton_state_t));
|
||||
|
@ -285,16 +259,14 @@ s_automaton_state_create(alist id)
|
|||
return s;
|
||||
}
|
||||
|
||||
static void
|
||||
s_automaton_add_state(Automaton a, astate s)
|
||||
static void s_automaton_add_state(Automaton a, astate s)
|
||||
{
|
||||
a->nstates ++;
|
||||
alist_add(a->states,(void*)s);
|
||||
DMSG(printf("** state %s added to automaton\n",s_automaton_id_to_str(s->id)));
|
||||
}
|
||||
|
||||
static astate
|
||||
s_automaton_get_state(Automaton a, alist id)
|
||||
static astate s_automaton_get_state(Automaton a, alist id)
|
||||
{
|
||||
astate s;
|
||||
alist_elt ptr;
|
||||
|
@ -314,8 +286,7 @@ s_automaton_get_state(Automaton a, alist id)
|
|||
* ************************************************** *
|
||||
* ************************************************** */
|
||||
|
||||
Automaton
|
||||
s_automaton_PS_to_NFA(int init_state_id, int *ptl, int *PS)
|
||||
Automaton s_automaton_PS_to_NFA(int init_state_id, int *ptl, int *PS)
|
||||
{
|
||||
int p;
|
||||
int maxpos = PS[0];
|
||||
|
@ -352,7 +323,7 @@ s_automaton_PS_to_NFA(int init_state_id, int *ptl, int *PS)
|
|||
for(pos = 1; pos <= maxpos; pos++)
|
||||
{
|
||||
if (ptl[pos] == current_letter &&
|
||||
(int)alist_elt_get_value(alist_get_first(current_state->id)) & (1 << (pos - 1)))
|
||||
(unsigned long)alist_elt_get_value(alist_get_first(current_state->id)) & (1 << (pos - 1)))
|
||||
ens |= PS[pos];
|
||||
}
|
||||
/* 5: transition from current_state to temp_state */
|
||||
|
@ -383,7 +354,7 @@ s_automaton_PS_to_NFA(int init_state_id, int *ptl, int *PS)
|
|||
for(ptr = alist_get_first(nfa->states); ptr ; ptr = alist_get_next(nfa->states,ptr))
|
||||
{
|
||||
astate s = (astate)alist_elt_get_value(ptr);
|
||||
if ((int)alist_elt_get_value(alist_get_first(s->id)) & (1 << (maxpos - 1)))
|
||||
if ((unsigned long)alist_elt_get_value(alist_get_first(s->id)) & (1 << (maxpos - 1)))
|
||||
s->accept = 1;
|
||||
}
|
||||
|
||||
|
@ -394,8 +365,7 @@ s_automaton_PS_to_NFA(int init_state_id, int *ptl, int *PS)
|
|||
* ************************************************** *
|
||||
* ************************************************** */
|
||||
|
||||
static alist
|
||||
s_automaton_successor(alist S, int letter, Automaton nfa, struct search_RegE_list_t *list)
|
||||
static alist s_automaton_successor(alist S, int letter, Automaton nfa, struct search_RegE_list_t *list)
|
||||
{
|
||||
alist R,r;
|
||||
alist_elt ptr;
|
||||
|
@ -406,7 +376,7 @@ s_automaton_successor(alist S, int letter, Automaton nfa, struct search_RegE_lis
|
|||
int i;
|
||||
alist t, Ry; astate y,z;
|
||||
|
||||
i = (int)alist_elt_get_value(ptr);
|
||||
i = (unsigned long)alist_elt_get_value(ptr);
|
||||
t = s_automaton_id_create(i);
|
||||
assert(y = s_automaton_get_state(nfa,t));
|
||||
alist_delete(t);
|
||||
|
@ -461,8 +431,7 @@ s_automaton_successor(alist S, int letter, Automaton nfa, struct search_RegE_lis
|
|||
return R;
|
||||
}
|
||||
|
||||
static void
|
||||
s_automaton_node_set_accept(astate s, Automaton nfa)
|
||||
static void s_automaton_node_set_accept(astate s, Automaton nfa)
|
||||
{
|
||||
void* idx;
|
||||
alist_elt ptr;
|
||||
|
@ -482,8 +451,7 @@ s_automaton_node_set_accept(astate s, Automaton nfa)
|
|||
DMSG(printf("\n"));
|
||||
}
|
||||
|
||||
static Automaton
|
||||
s_automaton_NFA_to_DFA(Automaton nfa, struct search_RegE_list_t *list)
|
||||
static Automaton s_automaton_NFA_to_DFA(Automaton nfa, struct search_RegE_list_t *list)
|
||||
{
|
||||
Automaton dfa = NULL;
|
||||
alist temp_id;
|
||||
|
@ -555,8 +523,7 @@ s_automaton_NFA_to_DFA(Automaton nfa, struct search_RegE_list_t *list)
|
|||
* ************************************************** *
|
||||
* ************************************************** */
|
||||
|
||||
static automaton
|
||||
s_automaton_finalize(Automaton a)
|
||||
static automaton s_automaton_finalize(Automaton a)
|
||||
{
|
||||
int i,l;
|
||||
automaton fa = NULL;
|
||||
|
@ -609,8 +576,24 @@ s_automaton_finalize(Automaton a)
|
|||
* ************************************************** *
|
||||
* ************************************************** */
|
||||
|
||||
static void
|
||||
s_automaton_print_nodes(FILE* f, Automaton a)
|
||||
#ifdef DEBUG_AUTOMATON
|
||||
static char* s_automaton_id_to_str(alist id)
|
||||
{
|
||||
static char s[250];
|
||||
memset(s,0,sizeof(s));
|
||||
alist_elt ptr;
|
||||
for(ptr = alist_get_first(id); ptr ; ptr = alist_get_next(id,ptr))
|
||||
{
|
||||
char tmp[50];
|
||||
sprintf(tmp,"%d ",(int)alist_elt_get_value(ptr));
|
||||
strcat(s,tmp);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
#endif // DEBUG_AUTOMATON
|
||||
|
||||
#ifdef DEBUG_AUTOMATON
|
||||
static void s_automaton_print_nodes(FILE* f, Automaton a)
|
||||
{
|
||||
char * sid;
|
||||
astate s;
|
||||
|
@ -632,9 +615,10 @@ s_automaton_print_nodes(FILE* f, Automaton a)
|
|||
}
|
||||
fprintf(f,"\n");
|
||||
}
|
||||
#endif // DEBUG_AUTOMATON
|
||||
|
||||
static void
|
||||
s_automaton_print_edges(FILE* f, Automaton a)
|
||||
#ifdef DEBUG_AUTOMATON
|
||||
static void s_automaton_print_edges(FILE* f, Automaton a)
|
||||
{
|
||||
int letter;
|
||||
char * sid;
|
||||
|
@ -657,9 +641,10 @@ s_automaton_print_edges(FILE* f, Automaton a)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif // DEBUG_AUTOMATON
|
||||
|
||||
static void
|
||||
s_automaton_dump(Automaton a, char* filename)
|
||||
#ifdef DEBUG_AUTOMATON
|
||||
static void s_automaton_dump(Automaton a, char* filename)
|
||||
{
|
||||
FILE* f;
|
||||
#ifdef HAVE_SYS_WAIT_H
|
||||
|
@ -686,6 +671,7 @@ s_automaton_dump(Automaton a, char* filename)
|
|||
}
|
||||
#endif
|
||||
}
|
||||
#endif // DEBUG_AUTOMATON
|
||||
|
||||
/* ************************************************** *
|
||||
* ************************************************** *
|
||||
|
|
|
@ -119,14 +119,14 @@ void
|
|||
print_header_info(Dict_header *header)
|
||||
{
|
||||
printf("============================\n");
|
||||
printf("keyword length %u bytes\n", strlen(_COMPIL_KEYWORD_));
|
||||
printf("keyword size %u bytes\n", sizeof(_COMPIL_KEYWORD_));
|
||||
printf("header size %u bytes\n", sizeof(Dict_header));
|
||||
printf("keyword length %lu bytes\n", (unsigned long)strlen(_COMPIL_KEYWORD_));
|
||||
printf("keyword size %lu bytes\n", (unsigned long)sizeof(_COMPIL_KEYWORD_));
|
||||
printf("header size %lu bytes\n", (unsigned long)sizeof(Dict_header));
|
||||
printf("\n");
|
||||
printf("%d words\n",header->nwords);
|
||||
printf("\n");
|
||||
printf("root : %7d (edge)\n",header->root);
|
||||
printf("root : %7u (byte)\n",header->root * sizeof(Dawg_edge));
|
||||
printf("root : %7lu (byte)\n",(unsigned long) header->root * sizeof(Dawg_edge));
|
||||
printf("\n");
|
||||
printf("nodes : %d+%d\n",header->nodesused, header->nodessaved);
|
||||
printf("edges : %d+%d\n",header->edgesused, header->edgessaved);
|
||||
|
@ -280,6 +280,7 @@ main(int argc, char* argv[])
|
|||
Dawg_edge rootnode = {0,0,0,0,0};
|
||||
Dawg_edge specialnode = {0,0,0,0,0};
|
||||
|
||||
int size;
|
||||
char* outfilename;
|
||||
char outfilenamedefault[] = "dict.daw";
|
||||
clock_t starttime, endtime;
|
||||
|
@ -290,13 +291,14 @@ main(int argc, char* argv[])
|
|||
exit(1);
|
||||
}
|
||||
|
||||
dicsize = file_length (argv[1]);
|
||||
if (dicsize < 0)
|
||||
size = file_length (argv[1]);
|
||||
if (size < 0)
|
||||
{
|
||||
fprintf(stderr,"Cannot stat uncompressed dictionary %s\n",argv[1]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
dicsize = size;
|
||||
outfilename = (argc == 3) ? argv[2] : outfilenamedefault;
|
||||
|
||||
if ((global_outfile = fopen (outfilename,"wb")) == NULL)
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
#include "dic_internals.h"
|
||||
#include "dic.h"
|
||||
|
||||
#define __UNUSED__ __attribute__((unused))
|
||||
|
||||
#if defined(WORDS_BIGENDIAN)
|
||||
static uint32_t swap4(uint32_t v)
|
||||
{
|
||||
|
@ -87,7 +89,7 @@ Dic_check_header(Dict_header *header, const char *path)
|
|||
}
|
||||
|
||||
static void
|
||||
Dic_convert_data_to_arch(Dictionary dic)
|
||||
Dic_convert_data_to_arch(Dictionary __UNUSED__ dic)
|
||||
{
|
||||
#if defined(WORDS_BIGENDIAN)
|
||||
int i;
|
||||
|
|
|
@ -87,12 +87,12 @@ struct _Dict_header {
|
|||
char ident[sizeof(_COMPIL_KEYWORD_)];
|
||||
char unused_1;
|
||||
char unused_2;
|
||||
int root;
|
||||
int nwords;
|
||||
unsigned int edgesused;
|
||||
unsigned int nodesused;
|
||||
unsigned int nodessaved;
|
||||
unsigned int edgessaved;
|
||||
int32_t root;
|
||||
int32_t nwords;
|
||||
uint32_t edgesused;
|
||||
uint32_t nodesused;
|
||||
uint32_t nodessaved;
|
||||
uint32_t edgessaved;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -33,19 +33,17 @@
|
|||
#include "dic.h"
|
||||
#include "regexp.h"
|
||||
#include "dic_search.h"
|
||||
#include "libdic_a-er.h" /* generated by bison */
|
||||
#include "scanner.h" /* generated by flex */
|
||||
#include "libdic_a-ery.h" /* generated by bison */
|
||||
#include "libdic_a-erl.h" /* generated by flex */
|
||||
#include "automaton.h"
|
||||
|
||||
/*
|
||||
* shut down the compiler
|
||||
/**
|
||||
* function prototype for bison generated parser
|
||||
*/
|
||||
static int yy_init_globals (yyscan_t yyscanner )
|
||||
{
|
||||
yy_init_globals(yyscanner);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int regexpparse(yyscan_t scanner, NODE** root,
|
||||
struct search_RegE_list_t *list,
|
||||
struct regexp_error_report_t *err);
|
||||
|
||||
/**
|
||||
* Dic_seel_edgeptr
|
||||
* walk the dictionary until the end of the word
|
||||
|
@ -585,13 +583,6 @@ Dic_search_regexp_rec(struct params_regexp_t *params,
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* function prototype for parser generated by bison
|
||||
*/
|
||||
int regexpparse(yyscan_t scanner, NODE** root,
|
||||
struct search_RegE_list_t *list,
|
||||
struct regexp_error_report_t *err);
|
||||
|
||||
void
|
||||
Dic_search_RegE_inner(const Dictionary dic, const char* re,
|
||||
char wordlist[RES_REGE_MAX][DIC_WORD_MAX],
|
||||
|
@ -680,7 +671,7 @@ Dic_search_RegE(const Dictionary dic, const wchar_t* re,
|
|||
wchar_t wordlist[RES_REGE_MAX][DIC_WORD_MAX],
|
||||
struct search_RegE_list_t *list)
|
||||
{
|
||||
int i, j;
|
||||
int i;
|
||||
char tmp_buff[RES_REGE_MAX][DIC_WORD_MAX];
|
||||
char *tmp_re = malloc(wcslen(re) + 1);
|
||||
sprintf(tmp_re, "%ls", re);
|
||||
|
|
|
@ -102,20 +102,20 @@ print_header(char* filename)
|
|||
|
||||
Dic_check_header(&header,filename);
|
||||
|
||||
#define OO(IDENT) offsetof(Dict_header,IDENT)
|
||||
#define OO(IDENT) (unsigned long)offsetof(Dict_header,IDENT)
|
||||
|
||||
printf("Dictionary header information\n");
|
||||
printf("0x%02x ident : %s\n", OO(ident) ,header.ident);
|
||||
printf("0x%02x unused 1 : %6d %06x\n",OO(unused_1) ,header.unused_1 ,header.unused_1);
|
||||
printf("0x%02x unused 2 : %6d %06x\n",OO(unused_2) ,header.unused_2 ,header.unused_2);
|
||||
printf("0x%02x root : %6d %06x\n",OO(root) ,header.root ,header.root);
|
||||
printf("0x%02x words : %6d %06x\n",OO(nwords) ,header.nwords ,header.nwords);
|
||||
printf("0x%02x edges used : %6d %06x\n",OO(edgesused) ,header.edgesused ,header.edgesused);
|
||||
printf("0x%02x nodes used : %6d %06x\n",OO(nodesused) ,header.nodesused ,header.nodesused);
|
||||
printf("0x%02x nodes saved : %6d %06x\n",OO(nodessaved),header.nodessaved,header.nodessaved);
|
||||
printf("0x%02x edges saved : %6d %06x\n",OO(edgessaved),header.edgessaved,header.edgessaved);
|
||||
printf("0x%02lx ident : %s\n", OO(ident) ,header.ident);
|
||||
printf("0x%02lx unused 1 : %6d %06x\n",OO(unused_1) ,header.unused_1 ,header.unused_1);
|
||||
printf("0x%02lx unused 2 : %6d %06x\n",OO(unused_2) ,header.unused_2 ,header.unused_2);
|
||||
printf("0x%02lx root : %6d %06x\n",OO(root) ,header.root ,header.root);
|
||||
printf("0x%02lx words : %6d %06x\n",OO(nwords) ,header.nwords ,header.nwords);
|
||||
printf("0x%02lx edges used : %6d %06x\n",OO(edgesused) ,header.edgesused ,header.edgesused);
|
||||
printf("0x%02lx nodes used : %6d %06x\n",OO(nodesused) ,header.nodesused ,header.nodesused);
|
||||
printf("0x%02lx nodes saved : %6d %06x\n",OO(nodessaved),header.nodessaved,header.nodessaved);
|
||||
printf("0x%02lx edges saved : %6d %06x\n",OO(edgessaved),header.edgessaved,header.edgessaved);
|
||||
printf("\n");
|
||||
printf("sizeof(header) = 0x%x (%u)\n", sizeof(header), sizeof(header));
|
||||
printf("sizeof(header) = 0x%lx (%lu)\n", (unsigned long)sizeof(header), (unsigned long)sizeof(header));
|
||||
}
|
||||
|
||||
|
||||
|
@ -129,8 +129,8 @@ print_node_hex(Dictionary dic, int i)
|
|||
|
||||
ee.e = dic->dawg[i];
|
||||
|
||||
printf("0x%04x %08x |%4d ptr=%8d t=%d l=%d f=%d chr=%2d (%c)\n",
|
||||
i*sizeof(ee), (unsigned int)(ee.s),
|
||||
printf("0x%04lx %08x |%4d ptr=%8d t=%d l=%d f=%d chr=%2d (%c)\n",
|
||||
(unsigned long)i*sizeof(ee), (unsigned int)(ee.s),
|
||||
i, ee.e.ptr, ee.e.term, ee.e.last, ee.e.fill, ee.e.chr, ee.e.chr +'a' -1);
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
#include "regexp.h"
|
||||
#include "dic_search.h"
|
||||
|
||||
#define __UNUSED__ __attribute__((unused))
|
||||
|
||||
/********************************************************/
|
||||
/********************************************************/
|
||||
/********************************************************/
|
||||
|
@ -85,7 +87,7 @@ void init_letter_lists(struct search_RegE_list_t *list)
|
|||
/********************************************************/
|
||||
/********************************************************/
|
||||
void
|
||||
usage(int argc, char* argv[])
|
||||
usage(int __UNUSED__ argc, char* argv[])
|
||||
{
|
||||
fprintf(stderr,"usage: %s dictionary\n",argv[0]);
|
||||
fprintf(stderr," dictionary : path to dawg eliot dictionary\n");
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "results.h"
|
||||
#include "board.h"
|
||||
#include "debug.h"
|
||||
#include "game.h"
|
||||
|
||||
#define oo 0
|
||||
#define __ 1
|
||||
|
@ -345,9 +346,9 @@ int Board::checkRoundAux(Matrix<Tile> &iTilesMx,
|
|||
}
|
||||
|
||||
/* Set the iPointsMx and bonus */
|
||||
pts = ptscross + pts * wordmul + 50 * (fromrack == 7);
|
||||
pts = ptscross + pts * wordmul + Game::BONUS_POINTS * (fromrack == Game::RACK_SIZE);
|
||||
iRound.setPoints(pts);
|
||||
iRound.setBonus(fromrack == 7);
|
||||
iRound.setBonus(fromrack == Game::RACK_SIZE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -465,6 +466,7 @@ int Board::getLetterMultiplier(int iRow, int iCol) const
|
|||
}
|
||||
|
||||
|
||||
// #define CELL_STRING_FORMAT "[%c:%s:%2d]"
|
||||
#define CELL_STRING_FORMAT "[%s:%2d]"
|
||||
|
||||
string Board::getCellContent_row(int row, int col) const
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "board.h"
|
||||
#include "encoding.h"
|
||||
#include "debug.h"
|
||||
#include "game.h"
|
||||
|
||||
/*
|
||||
* computes the score of a word, coordinates may be changed to reflect
|
||||
|
@ -74,8 +75,9 @@ static void BoardSearchEvalMove(const Board &iBoard,
|
|||
fromrack++;
|
||||
}
|
||||
}
|
||||
pts = ptscross + pts * wordmul + 50 * (fromrack == 7);
|
||||
iWord.setBonus(fromrack == 7);
|
||||
|
||||
pts = ptscross + pts * wordmul + Game::BONUS_POINTS * (fromrack == Game::RACK_SIZE);
|
||||
iWord.setBonus(fromrack == Game::RACK_SIZE);
|
||||
iWord.setPoints(pts);
|
||||
|
||||
if (iWord.getCoord().getDir() == Coord::VERTICAL)
|
||||
|
@ -89,8 +91,6 @@ static void BoardSearchEvalMove(const Board &iBoard,
|
|||
// Restore the coordinates
|
||||
iWord.accessCoord().swap();
|
||||
}
|
||||
|
||||
/* fprintf(stdout,"eval: %s\n",convertToMb(iWord.toString()).c_str()); */
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -35,8 +35,8 @@
|
|||
#include "debug.h"
|
||||
|
||||
|
||||
const int Game::RACK_SIZE = 7;
|
||||
|
||||
const int Game::RACK_SIZE = 7;
|
||||
const int Game::BONUS_POINTS = 50;
|
||||
|
||||
Game::Game(const Dictionary &iDic):
|
||||
m_dic(&iDic)
|
||||
|
|
|
@ -46,6 +46,11 @@ using namespace std;
|
|||
class Game
|
||||
{
|
||||
public:
|
||||
/// Game specs.
|
||||
static const int RACK_SIZE;
|
||||
static const int BONUS_POINTS;
|
||||
|
||||
|
||||
Game(const Dictionary &iDic);
|
||||
virtual ~Game();
|
||||
|
||||
|
@ -136,7 +141,6 @@ public:
|
|||
* 2 : the rack check was set on and failed
|
||||
* 3 : the rack cannot be completed (Game_*_setrackrandom only)
|
||||
*************************/
|
||||
static const int RACK_SIZE;
|
||||
enum set_rack_mode {RACK_ALL, RACK_NEW, RACK_MANUAL};
|
||||
int setRack(int player, set_rack_mode mode, bool check, const wstring& str);
|
||||
|
||||
|
|
|
@ -88,7 +88,8 @@ const Turn& History::getPreviousTurn() const
|
|||
|
||||
const Turn& History::getTurn(unsigned int n) const
|
||||
{
|
||||
ASSERT(0 <= n && n < m_history.size(), "Wrong turn number");
|
||||
// ASSERT(0 <= n && n < m_history.size(), "Wrong turn number");
|
||||
ASSERT(n < m_history.size(), "Wrong turn number");
|
||||
return *(m_history[n]);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
#define FROMRACK 0x2
|
||||
#define JOKER 0x4
|
||||
|
||||
#define __UNUSED__ __attribute__((unused))
|
||||
|
||||
|
||||
Round::Round()
|
||||
{
|
||||
|
@ -116,7 +118,7 @@ void Round::addRightFromBoard(Tile c)
|
|||
}
|
||||
|
||||
|
||||
void Round::removeRightToBoard(Tile c)
|
||||
void Round::removeRightToBoard(Tile __UNUSED__ c)
|
||||
{
|
||||
// c is unused.
|
||||
m_word.pop_back();
|
||||
|
@ -136,7 +138,7 @@ void Round::addRightFromRack(Tile c, bool iJoker)
|
|||
}
|
||||
|
||||
|
||||
void Round::removeRightToRack(Tile c, bool iJoker)
|
||||
void Round::removeRightToRack(Tile __UNUSED__ c, bool __UNUSED__ iJoker)
|
||||
{
|
||||
// c is unused.
|
||||
m_word.pop_back();
|
||||
|
|
|
@ -749,7 +749,7 @@ void eliot_regexp_build_default_llist(struct search_RegE_list_t &llist)
|
|||
}
|
||||
}
|
||||
|
||||
void eliot_regexp(const Dictionary& iDic, wchar_t *cmd,
|
||||
void eliot_regexp(const Dictionary& iDic, wchar_t __attribute__((unused)) *cmd,
|
||||
const wchar_t *delim, wchar_t **state)
|
||||
{
|
||||
/*
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
using namespace std;
|
||||
|
||||
#define __UNUSED__ __attribute__((unused))
|
||||
|
||||
void GameIO::printBoard(ostream &out, const Game &iGame)
|
||||
{
|
||||
|
@ -190,7 +191,7 @@ void GameIO::printNonPlayed(ostream &out, const Game &iGame)
|
|||
}
|
||||
|
||||
|
||||
void GameIO::printPlayedRack(ostream &out, const Game &iGame, int n)
|
||||
void GameIO::printPlayedRack(ostream &out, const Game &iGame, int __UNUSED__ n)
|
||||
{
|
||||
out << convertToMb(iGame.getCurrentPlayer().getCurrentRack().toString(PlayedRack::RACK_SIMPLE)) << endl;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ bin_PROGRAMS = eliot
|
|||
|
||||
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/dic -I$(top_srcdir)/game
|
||||
|
||||
AM_CPPFLAGS = @WX_CPPFLAGS@
|
||||
AM_CPPFLAGS = @WX_CPPFLAGS@ ## -Wno-strict-aliasing
|
||||
|
||||
eliot_SOURCES = \
|
||||
configdb.cc configdb.h \
|
||||
|
@ -36,6 +36,7 @@ eliot_SOURCES = \
|
|||
mainframe.cc mainframe.h \
|
||||
main.cc ewx.h
|
||||
|
||||
## eliot_CPPFLAGS=
|
||||
eliot_LDADD = @WX_LIBS@ ../dic/libdic.a ../game/libgame.a
|
||||
|
||||
EXTRA_DIST = \
|
||||
|
|
|
@ -167,7 +167,7 @@ BagFrame::BagFrame(wxFrame* parent, Game& iGame):
|
|||
}
|
||||
|
||||
void
|
||||
BagFrame::Refresh(refresh_t force)
|
||||
BagFrame::Refresh(refresh_t __UNUSED__ force)
|
||||
{
|
||||
//debug(" BagFrame::Refresh\n");
|
||||
int n,index;
|
||||
|
@ -210,7 +210,7 @@ SearchFrame::SearchFrame(wxFrame *parent, Dictionary _dic):
|
|||
}
|
||||
|
||||
void
|
||||
SearchFrame::Refresh(refresh_t force)
|
||||
SearchFrame::Refresh(refresh_t __UNUSED__ force)
|
||||
{
|
||||
//debug(" SearchFrame::Refresh\n");
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ VerifFrame::OnText(wxCommandEvent&)
|
|||
}
|
||||
|
||||
void
|
||||
VerifFrame::Refresh(refresh_t force)
|
||||
VerifFrame::Refresh(refresh_t __UNUSED__ force)
|
||||
{
|
||||
//debug(" VerifFrame::Refresh\n");
|
||||
}
|
||||
|
@ -313,7 +313,7 @@ AuxFrameList::AuxFrameList(wxFrame* parent, int _id, wxString _name, wxString _c
|
|||
}
|
||||
|
||||
void
|
||||
AuxFrameList::OnCopy(wxCommandEvent& event)
|
||||
AuxFrameList::OnCopy(wxCommandEvent __UNUSED__ &event)
|
||||
{
|
||||
wxString textdata;
|
||||
|
||||
|
@ -338,7 +338,7 @@ AuxFrameList::Waiting()
|
|||
}
|
||||
|
||||
void
|
||||
AuxFrameList::Refresh(refresh_t force)
|
||||
AuxFrameList::Refresh(refresh_t __UNUSED__ force)
|
||||
{
|
||||
//debug(" %s : Refresh start\n",(const char*)name.mb_str());
|
||||
if (game == NULL)
|
||||
|
@ -518,7 +518,7 @@ GameFrame::GameFrame(wxFrame* parent, Game& iGame):
|
|||
}
|
||||
|
||||
void
|
||||
GameFrame::Refresh(refresh_t force)
|
||||
GameFrame::Refresh(refresh_t __UNUSED__ force)
|
||||
{
|
||||
std::ostringstream mos;
|
||||
m_game.save(mos);
|
||||
|
@ -591,7 +591,7 @@ ResultFrame::GetSelected()
|
|||
}
|
||||
|
||||
void
|
||||
ResultFrame::OnSize(wxSizeEvent& e)
|
||||
ResultFrame::OnSize(wxSizeEvent __UNUSED__ &e)
|
||||
{
|
||||
int w,h;
|
||||
GetClientSize(&w,&h);
|
||||
|
|
|
@ -88,7 +88,7 @@ public:
|
|||
|
||||
void SwitchDisplay();
|
||||
void Reload();
|
||||
virtual void Refresh(refresh_t force = REFRESH) {};
|
||||
virtual void Refresh(refresh_t __UNUSED__ force = REFRESH) {};
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -412,7 +412,7 @@ ConfDimDlg::writeconf()
|
|||
}
|
||||
|
||||
void
|
||||
ConfDimDlg::OnCloseWindow(wxCloseEvent& event)
|
||||
ConfDimDlg::OnCloseWindow(wxCloseEvent __UNUSED__ &event)
|
||||
{
|
||||
if (IsModal() == TRUE)
|
||||
EndModal(1);
|
||||
|
@ -421,7 +421,7 @@ ConfDimDlg::OnCloseWindow(wxCloseEvent& event)
|
|||
}
|
||||
|
||||
void
|
||||
ConfDimDlg::OnButtonOk(wxCommandEvent& event)
|
||||
ConfDimDlg::OnButtonOk(wxCommandEvent __UNUSED__ &event)
|
||||
{
|
||||
writeconf();
|
||||
if (IsModal() == TRUE)
|
||||
|
@ -431,7 +431,7 @@ ConfDimDlg::OnButtonOk(wxCommandEvent& event)
|
|||
}
|
||||
|
||||
void
|
||||
ConfDimDlg::OnButtonCancel(wxCommandEvent &event)
|
||||
ConfDimDlg::OnButtonCancel(wxCommandEvent __UNUSED__ &event)
|
||||
{
|
||||
if (IsModal() == TRUE)
|
||||
EndModal(1);
|
||||
|
@ -440,13 +440,13 @@ ConfDimDlg::OnButtonCancel(wxCommandEvent &event)
|
|||
}
|
||||
|
||||
void
|
||||
ConfDimDlg::OnButtonSave(wxCommandEvent& event)
|
||||
ConfDimDlg::OnButtonSave(wxCommandEvent __UNUSED__ &event)
|
||||
{
|
||||
writeconf();
|
||||
}
|
||||
|
||||
void
|
||||
ConfDimDlg::OnConfPage(wxCommandEvent& event)
|
||||
ConfDimDlg::OnConfPage(wxCommandEvent __UNUSED__ &event)
|
||||
{
|
||||
//#if defined(__WXGTK__)
|
||||
pagesetupdata = printdata;
|
||||
|
@ -462,7 +462,7 @@ ConfDimDlg::OnConfPage(wxCommandEvent& event)
|
|||
}
|
||||
|
||||
void
|
||||
ConfDimDlg::OnConfPrinter(wxCommandEvent& event)
|
||||
ConfDimDlg::OnConfPrinter(wxCommandEvent __UNUSED__ &event)
|
||||
{
|
||||
//#if defined(__WXGTK__)
|
||||
wxPrintDialogData printDialogData(printdata);
|
||||
|
@ -479,13 +479,13 @@ ConfDimDlg::OnConfPrinter(wxCommandEvent& event)
|
|||
}
|
||||
|
||||
void
|
||||
ConfDimDlg::OnConfFontHead(wxCommandEvent& event)
|
||||
ConfDimDlg::OnConfFontHead(wxCommandEvent __UNUSED__ &event)
|
||||
{
|
||||
headfont = config.ChooseFont((wxFrame*)this,headfont);
|
||||
}
|
||||
|
||||
void
|
||||
ConfDimDlg::OnConfFontText(wxCommandEvent& event)
|
||||
ConfDimDlg::OnConfFontText(wxCommandEvent __UNUSED__ &event)
|
||||
{
|
||||
textfont = config.ChooseFont((wxFrame*)this,textfont);
|
||||
}
|
||||
|
|
|
@ -627,7 +627,7 @@ float ConfigDB::getPrintLineScale()
|
|||
return 0.2;
|
||||
}
|
||||
|
||||
void ConfigDB::setPrintLineScale(float s)
|
||||
void ConfigDB::setPrintLineScale(float)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -42,6 +42,8 @@
|
|||
# define TODO(x...)
|
||||
#endif
|
||||
|
||||
#define __UNUSED__ __attribute__((unused))
|
||||
|
||||
#if defined(__WIN32__) || defined(__WIN95__) || defined(__WXMSW__)
|
||||
# define ENABLE_LC_NO_HEADER
|
||||
# define ENABLE_RESLIST_IN_MAIN
|
||||
|
|
|
@ -92,7 +92,7 @@ GfxBoard::~GfxBoard(void)
|
|||
*/
|
||||
|
||||
void
|
||||
GfxBoard::OnSize(wxSizeEvent& e)
|
||||
GfxBoard::OnSize(wxSizeEvent __UNUSED__ &e)
|
||||
{
|
||||
GFXDEBUG(std::cerr << "On size : ");
|
||||
|
||||
|
|
|
@ -217,7 +217,7 @@ GfxResult::OnListCtrlActivated(wxListEvent& event)
|
|||
/* ************************************************** */
|
||||
|
||||
void
|
||||
GfxResult::OnSize(wxSizeEvent& e)
|
||||
GfxResult::OnSize(wxSizeEvent __UNUSED__ &e)
|
||||
{
|
||||
int w,h;
|
||||
GetClientSize(&w,&h);
|
||||
|
|
|
@ -153,10 +153,9 @@ END_EVENT_TABLE()
|
|||
//
|
||||
// ******************************
|
||||
|
||||
MainFrame::MainFrame(wxPoint pos_, wxSize size_)
|
||||
: wxFrame((wxFrame *) NULL, -1, wxT(APPNAME), wxPoint(-1, -1),
|
||||
size_, wxDEFAULT_FRAME_STYLE, wxT(APPNAME)),
|
||||
m_dic(NULL), m_game(NULL)
|
||||
MainFrame::MainFrame(wxPoint __UNUSED__ pos_, wxSize size_) :
|
||||
wxFrame((wxFrame *) NULL, -1, wxT(APPNAME), wxPoint(-1, -1),
|
||||
size_, wxDEFAULT_FRAME_STYLE, wxT(APPNAME)), m_dic(NULL), m_game(NULL)
|
||||
{
|
||||
#if defined(ENABLE_RESLIST_IN_MAIN)
|
||||
reslist = NULL;
|
||||
|
|
|
@ -112,7 +112,7 @@ GamePrintout::DrawStringJustif(wxDC *dc, wxString *str, long x, long y, long w,
|
|||
}
|
||||
|
||||
void
|
||||
GamePrintout::DrawHeadingLine(wxDC *dc, long heightH, float mmToLogical)
|
||||
GamePrintout::DrawHeadingLine(wxDC *dc, long __UNUSED__ heightH, float mmToLogical)
|
||||
{
|
||||
long i,x,w,y;
|
||||
wxString str;
|
||||
|
|
Loading…
Reference in a new issue