- 32/64 bits types

- unused function parameters
This commit is contained in:
Antoine Fraboulet 2007-08-04 20:01:27 +00:00
parent 33e5b23004
commit d86bd2af4a
29 changed files with 198 additions and 184 deletions

View file

@ -1,34 +1,35 @@
.* .*
ABOUT-NLS 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
Makefile.in Makefile.in
aclocal.m4 aclocal.m4
autom4te.cache autom4te.cache
compile compile
depcomp config.cache
install-sh config.guess
missing config.h
mkinstalldirs config.h.*
stamp-* config.log
config.rpath
config.status
config.sub
configure
core
core.*
cscope.files cscope.files
cscope.out cscope.out
depcomp
dic/cscope.files dic/cscope.files
dic/cscope.out dic/cscope.out
game/cscope.files game/cscope.files
game/cscope.out game/cscope.out
gmon.out
install-sh
intl
m4
missing
mkinstalldirs
stamp-*
wxwin/cscope.files wxwin/cscope.files
wxwin/cscope.out wxwin/cscope.out
ylwrap

13
INSTALL
View file

@ -4,18 +4,23 @@ Installation sous Linux (Un*x) (bien/facile)
./bootstrap ./bootstrap
./configure --prefix=/usr/local/eliot ./configure
make make
make install make install
* Pour installer à partir de l'archive tar.gz * Pour installer à partir de l'archive tar.gz
./configure --prefix=/usr/local/eliot ./configure
make make
make install 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

View file

@ -19,11 +19,12 @@ AC_PROG_MAKE_SET
AC_PROG_RANLIB AC_PROG_RANLIB
AC_PROG_YACC 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]) AC_MSG_ERROR([Could not find the 'bison' program on your system])
fi fi
AM_PROG_LEX 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]) AC_MSG_ERROR([Could not find the 'flex' program on your system])
fi fi
@ -32,28 +33,39 @@ dnl Checks for compilation flags
dnl -------------------------------------------------------------- dnl --------------------------------------------------------------
CFLAGS_save="${CFLAGS}" CFLAGS_save="${CFLAGS}"
AC_CACHE_CHECK([if \$CC accepts -Wall], AC_CACHE_CHECK([if \$CC accepts -Wall],
[ac_cv_c_Wall], [ac_cv_c_Wall],
[CFLAGS="-Wall ${CFLAGS_save}" [CFLAGS="-Wall ${CFLAGS_save}"
AC_TRY_COMPILE([],,ac_cv_c_Wall=yes, ac_cv_c_Wall=no)]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[ac_cv_c_Wall=yes],[ac_cv_c_Wall=no])])
CFLAGS="${CFLAGS_save}" CFLAGS="${CFLAGS_save}"
if test "${ac_cv_c_Wall}" != "no"; then if test "${ac_cv_c_Wall}" != "no"; then
CFLAGS="-Wall ${CFLAGS}" CFLAGS+=" -Wall"
CXXFLAGS="-Wall ${CXXFLAGS}" 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 fi
dnl Debug mode dnl Debug mode
AC_ARG_ENABLE([debug],AC_HELP_STRING([--enable-debug],[debug mode (default disabled)])) AC_ARG_ENABLE([debug],AC_HELP_STRING([--enable-debug],[debug mode (default disabled)]))
if test "${enable_debug}" = "yes"; then if test "${enable_debug}" = "yes"; then
CFLAGS="${CFLAGS} -g -DDEBUG" CFLAGS+=" -g -DDEBUG"
CPPFLAGS="${CPPFLAGS} -g -DDEBUG" CXXFLAGS+=" -g -DDEBUG"
fi fi
dnl Profile mode dnl Profile mode
AC_ARG_ENABLE([profile],AC_HELP_STRING([--enable-profile],[profile mode (default disabled)])) AC_ARG_ENABLE([profile],AC_HELP_STRING([--enable-profile],[profile mode (default disabled)]))
if test "${enable_profile}" = "yes"; then if test "${enable_profile}" = "yes"; then
CFLAGS="${CFLAGS} -pg -DPROFILE" CFLAGS+=" -pg -DPROFILE"
CPPFLAGS="${CPPFLAGS} -pg -DPROFILE" CXXFLAGS+=" -pg -DPROFILE"
LDFLAGS="${LDFLAGS} -pg" LDFLAGS+=" -pg"
fi fi
dnl Regexp / Listdic / Compdic build enable dnl Regexp / Listdic / Compdic build enable

View file

@ -27,6 +27,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "alist.h" #include "alist.h"
#define __UNUSED__ __attribute__((unused))
struct alist_elt_t { struct alist_elt_t {
void* info; void* info;
@ -166,7 +167,7 @@ alist_get_first(alist l)
} }
alist_elt alist_elt
alist_get_next(alist l, alist_elt e) alist_get_next(alist __UNUSED__ l, alist_elt e)
{ {
return e->next; return e->next;
} }

View file

@ -72,8 +72,6 @@ static Automaton s_automaton_create ();
static void s_automaton_delete (Automaton a); static void s_automaton_delete (Automaton a);
static alist s_automaton_id_create (int id); 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 astate s_automaton_state_create (alist id);
static void s_automaton_add_state (Automaton a, astate s); 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_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_NFA_to_DFA (Automaton a, struct search_RegE_list_t *list);
static automaton s_automaton_finalize (Automaton a); static automaton s_automaton_finalize (Automaton a);
#ifdef DEBUG_AUTOMATON #ifdef DEBUG_AUTOMATON
static char* s_automaton_id_to_str (alist id);
static void s_automaton_dump (Automaton a, char* filename); static void s_automaton_dump (Automaton a, char* filename);
#endif #endif
@ -114,8 +114,7 @@ struct automaton_t {
exported functions for static automata exported functions for static automata
* ************************************************** */ * ************************************************** */
automaton automaton automaton_build(int init_state, int *ptl, int *PS, struct search_RegE_list_t *list)
automaton_build(int init_state, int *ptl, int *PS, struct search_RegE_list_t *list)
{ {
Automaton nfa,dfa; Automaton nfa,dfa;
automaton final; automaton final;
@ -137,8 +136,7 @@ automaton_build(int init_state, int *ptl, int *PS, struct search_RegE_list_t *li
return final; return final;
} }
void void automaton_delete(automaton a)
automaton_delete(automaton a)
{ {
int i; int i;
free(a->accept); free(a->accept);
@ -148,32 +146,27 @@ automaton_delete(automaton a)
free(a); free(a);
} }
inline int inline int automaton_get_nstates(automaton a)
automaton_get_nstates(automaton a)
{ {
return a->nstates; return a->nstates;
} }
inline int inline int automaton_get_init(automaton a)
automaton_get_init(automaton a)
{ {
return a->init; return a->init;
} }
inline int inline int automaton_get_accept(automaton a, int state)
automaton_get_accept(automaton a, int state)
{ {
return a->accept[state]; return a->accept[state];
} }
inline int inline int automaton_get_next_state(automaton a, int state, char l)
automaton_get_next_state(automaton a, int state, char l)
{ {
return a->trans[state][(int)l]; return a->trans[state][(int)l];
} }
void void automaton_dump(automaton a, char* filename)
automaton_dump(automaton a, char* filename)
{ {
int i,l; int i,l;
FILE* f; FILE* f;
@ -223,16 +216,14 @@ automaton_dump(automaton a, char* filename)
* ************************************************** * * ************************************************** *
* ************************************************** */ * ************************************************** */
void void state_delete_fun(void* ps)
state_delete_fun(void* ps)
{ {
astate s = ps; astate s = ps;
alist_delete(s->id); alist_delete(s->id);
free(s); free(s);
} }
static Automaton static Automaton s_automaton_create()
s_automaton_create()
{ {
Automaton a; Automaton a;
a = (Automaton)malloc(sizeof(struct Automaton_t)); a = (Automaton)malloc(sizeof(struct Automaton_t));
@ -244,37 +235,20 @@ s_automaton_create()
} }
static void static void s_automaton_delete(Automaton a)
s_automaton_delete(Automaton a)
{ {
alist_delete(a->states); alist_delete(a->states);
free(a); free(a);
} }
static alist static alist s_automaton_id_create(int id)
s_automaton_id_create(int id)
{ {
alist a = alist_create(); alist a = alist_create();
alist_add(a,(void*)id); alist_add(a,(void*)((unsigned long)id));
return a; return a;
} }
static char* s_automaton_id_to_str(alist id) static astate s_automaton_state_create(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)
{ {
astate s; astate s;
s = (astate)malloc(sizeof(struct automaton_state_t)); s = (astate)malloc(sizeof(struct automaton_state_t));
@ -285,16 +259,14 @@ s_automaton_state_create(alist id)
return s; return s;
} }
static void static void s_automaton_add_state(Automaton a, astate s)
s_automaton_add_state(Automaton a, astate s)
{ {
a->nstates ++; a->nstates ++;
alist_add(a->states,(void*)s); alist_add(a->states,(void*)s);
DMSG(printf("** state %s added to automaton\n",s_automaton_id_to_str(s->id))); DMSG(printf("** state %s added to automaton\n",s_automaton_id_to_str(s->id)));
} }
static astate static astate s_automaton_get_state(Automaton a, alist id)
s_automaton_get_state(Automaton a, alist id)
{ {
astate s; astate s;
alist_elt ptr; alist_elt ptr;
@ -314,8 +286,7 @@ s_automaton_get_state(Automaton a, alist id)
* ************************************************** * * ************************************************** *
* ************************************************** */ * ************************************************** */
Automaton Automaton s_automaton_PS_to_NFA(int init_state_id, int *ptl, int *PS)
s_automaton_PS_to_NFA(int init_state_id, int *ptl, int *PS)
{ {
int p; int p;
int maxpos = PS[0]; 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++) for(pos = 1; pos <= maxpos; pos++)
{ {
if (ptl[pos] == current_letter && 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]; ens |= PS[pos];
} }
/* 5: transition from current_state to temp_state */ /* 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)) for(ptr = alist_get_first(nfa->states); ptr ; ptr = alist_get_next(nfa->states,ptr))
{ {
astate s = (astate)alist_elt_get_value(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; s->accept = 1;
} }
@ -394,8 +365,7 @@ s_automaton_PS_to_NFA(int init_state_id, int *ptl, int *PS)
* ************************************************** * * ************************************************** *
* ************************************************** */ * ************************************************** */
static alist static alist s_automaton_successor(alist S, int letter, Automaton nfa, struct search_RegE_list_t *list)
s_automaton_successor(alist S, int letter, Automaton nfa, struct search_RegE_list_t *list)
{ {
alist R,r; alist R,r;
alist_elt ptr; alist_elt ptr;
@ -406,7 +376,7 @@ s_automaton_successor(alist S, int letter, Automaton nfa, struct search_RegE_lis
int i; int i;
alist t, Ry; astate y,z; 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); t = s_automaton_id_create(i);
assert(y = s_automaton_get_state(nfa,t)); assert(y = s_automaton_get_state(nfa,t));
alist_delete(t); alist_delete(t);
@ -461,8 +431,7 @@ s_automaton_successor(alist S, int letter, Automaton nfa, struct search_RegE_lis
return R; return R;
} }
static void static void s_automaton_node_set_accept(astate s, Automaton nfa)
s_automaton_node_set_accept(astate s, Automaton nfa)
{ {
void* idx; void* idx;
alist_elt ptr; alist_elt ptr;
@ -482,8 +451,7 @@ s_automaton_node_set_accept(astate s, Automaton nfa)
DMSG(printf("\n")); DMSG(printf("\n"));
} }
static Automaton static Automaton s_automaton_NFA_to_DFA(Automaton nfa, struct search_RegE_list_t *list)
s_automaton_NFA_to_DFA(Automaton nfa, struct search_RegE_list_t *list)
{ {
Automaton dfa = NULL; Automaton dfa = NULL;
alist temp_id; alist temp_id;
@ -555,8 +523,7 @@ s_automaton_NFA_to_DFA(Automaton nfa, struct search_RegE_list_t *list)
* ************************************************** * * ************************************************** *
* ************************************************** */ * ************************************************** */
static automaton static automaton s_automaton_finalize(Automaton a)
s_automaton_finalize(Automaton a)
{ {
int i,l; int i,l;
automaton fa = NULL; automaton fa = NULL;
@ -609,8 +576,24 @@ s_automaton_finalize(Automaton a)
* ************************************************** * * ************************************************** *
* ************************************************** */ * ************************************************** */
static void #ifdef DEBUG_AUTOMATON
s_automaton_print_nodes(FILE* f, Automaton 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;
}
#endif // DEBUG_AUTOMATON
#ifdef DEBUG_AUTOMATON
static void s_automaton_print_nodes(FILE* f, Automaton a)
{ {
char * sid; char * sid;
astate s; astate s;
@ -632,9 +615,10 @@ s_automaton_print_nodes(FILE* f, Automaton a)
} }
fprintf(f,"\n"); fprintf(f,"\n");
} }
#endif // DEBUG_AUTOMATON
static void #ifdef DEBUG_AUTOMATON
s_automaton_print_edges(FILE* f, Automaton a) static void s_automaton_print_edges(FILE* f, Automaton a)
{ {
int letter; int letter;
char * sid; char * sid;
@ -657,9 +641,10 @@ s_automaton_print_edges(FILE* f, Automaton a)
} }
} }
} }
#endif // DEBUG_AUTOMATON
static void #ifdef DEBUG_AUTOMATON
s_automaton_dump(Automaton a, char* filename) static void s_automaton_dump(Automaton a, char* filename)
{ {
FILE* f; FILE* f;
#ifdef HAVE_SYS_WAIT_H #ifdef HAVE_SYS_WAIT_H
@ -686,6 +671,7 @@ s_automaton_dump(Automaton a, char* filename)
} }
#endif #endif
} }
#endif // DEBUG_AUTOMATON
/* ************************************************** * /* ************************************************** *
* ************************************************** * * ************************************************** *

View file

@ -119,14 +119,14 @@ void
print_header_info(Dict_header *header) print_header_info(Dict_header *header)
{ {
printf("============================\n"); printf("============================\n");
printf("keyword length %u bytes\n", strlen(_COMPIL_KEYWORD_)); printf("keyword length %lu bytes\n", (unsigned long)strlen(_COMPIL_KEYWORD_));
printf("keyword size %u bytes\n", sizeof(_COMPIL_KEYWORD_)); printf("keyword size %lu bytes\n", (unsigned long)sizeof(_COMPIL_KEYWORD_));
printf("header size %u bytes\n", sizeof(Dict_header)); printf("header size %lu bytes\n", (unsigned long)sizeof(Dict_header));
printf("\n"); printf("\n");
printf("%d words\n",header->nwords); printf("%d words\n",header->nwords);
printf("\n"); printf("\n");
printf("root : %7d (edge)\n",header->root); 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("\n");
printf("nodes : %d+%d\n",header->nodesused, header->nodessaved); printf("nodes : %d+%d\n",header->nodesused, header->nodessaved);
printf("edges : %d+%d\n",header->edgesused, header->edgessaved); 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 rootnode = {0,0,0,0,0};
Dawg_edge specialnode = {0,0,0,0,0}; Dawg_edge specialnode = {0,0,0,0,0};
int size;
char* outfilename; char* outfilename;
char outfilenamedefault[] = "dict.daw"; char outfilenamedefault[] = "dict.daw";
clock_t starttime, endtime; clock_t starttime, endtime;
@ -290,13 +291,14 @@ main(int argc, char* argv[])
exit(1); exit(1);
} }
dicsize = file_length (argv[1]); size = file_length (argv[1]);
if (dicsize < 0) if (size < 0)
{ {
fprintf(stderr,"Cannot stat uncompressed dictionary %s\n",argv[1]); fprintf(stderr,"Cannot stat uncompressed dictionary %s\n",argv[1]);
exit(1); exit(1);
} }
dicsize = size;
outfilename = (argc == 3) ? argv[2] : outfilenamedefault; outfilename = (argc == 3) ? argv[2] : outfilenamedefault;
if ((global_outfile = fopen (outfilename,"wb")) == NULL) if ((global_outfile = fopen (outfilename,"wb")) == NULL)

View file

@ -34,6 +34,8 @@
#include "dic_internals.h" #include "dic_internals.h"
#include "dic.h" #include "dic.h"
#define __UNUSED__ __attribute__((unused))
#if defined(WORDS_BIGENDIAN) #if defined(WORDS_BIGENDIAN)
static uint32_t swap4(uint32_t v) static uint32_t swap4(uint32_t v)
{ {
@ -87,7 +89,7 @@ Dic_check_header(Dict_header *header, const char *path)
} }
static void static void
Dic_convert_data_to_arch(Dictionary dic) Dic_convert_data_to_arch(Dictionary __UNUSED__ dic)
{ {
#if defined(WORDS_BIGENDIAN) #if defined(WORDS_BIGENDIAN)
int i; int i;

View file

@ -87,12 +87,12 @@ struct _Dict_header {
char ident[sizeof(_COMPIL_KEYWORD_)]; char ident[sizeof(_COMPIL_KEYWORD_)];
char unused_1; char unused_1;
char unused_2; char unused_2;
int root; int32_t root;
int nwords; int32_t nwords;
unsigned int edgesused; uint32_t edgesused;
unsigned int nodesused; uint32_t nodesused;
unsigned int nodessaved; uint32_t nodessaved;
unsigned int edgessaved; uint32_t edgessaved;
}; };

View file

@ -33,19 +33,17 @@
#include "dic.h" #include "dic.h"
#include "regexp.h" #include "regexp.h"
#include "dic_search.h" #include "dic_search.h"
#include "libdic_a-er.h" /* generated by bison */ #include "libdic_a-ery.h" /* generated by bison */
#include "scanner.h" /* generated by flex */ #include "libdic_a-erl.h" /* generated by flex */
#include "automaton.h" #include "automaton.h"
/* /**
* shut down the compiler * function prototype for bison generated parser
*/ */
static int yy_init_globals (yyscan_t yyscanner ) int regexpparse(yyscan_t scanner, NODE** root,
{ struct search_RegE_list_t *list,
yy_init_globals(yyscanner); struct regexp_error_report_t *err);
return 0;
}
/** /**
* Dic_seel_edgeptr * Dic_seel_edgeptr
* walk the dictionary until the end of the word * 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 void
Dic_search_RegE_inner(const Dictionary dic, const char* re, Dic_search_RegE_inner(const Dictionary dic, const char* re,
char wordlist[RES_REGE_MAX][DIC_WORD_MAX], 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], wchar_t wordlist[RES_REGE_MAX][DIC_WORD_MAX],
struct search_RegE_list_t *list) struct search_RegE_list_t *list)
{ {
int i, j; int i;
char tmp_buff[RES_REGE_MAX][DIC_WORD_MAX]; char tmp_buff[RES_REGE_MAX][DIC_WORD_MAX];
char *tmp_re = malloc(wcslen(re) + 1); char *tmp_re = malloc(wcslen(re) + 1);
sprintf(tmp_re, "%ls", re); sprintf(tmp_re, "%ls", re);

View file

@ -102,20 +102,20 @@ print_header(char* filename)
Dic_check_header(&header,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("Dictionary header information\n");
printf("0x%02x ident : %s\n", OO(ident) ,header.ident); printf("0x%02lx 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%02lx 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%02lx 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%02lx 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%02lx 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%02lx 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%02lx 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%02lx 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 edges saved : %6d %06x\n",OO(edgessaved),header.edgessaved,header.edgessaved);
printf("\n"); 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]; ee.e = dic->dawg[i];
printf("0x%04x %08x |%4d ptr=%8d t=%d l=%d f=%d chr=%2d (%c)\n", printf("0x%04lx %08x |%4d ptr=%8d t=%d l=%d f=%d chr=%2d (%c)\n",
i*sizeof(ee), (unsigned int)(ee.s), (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); i, ee.e.ptr, ee.e.term, ee.e.last, ee.e.fill, ee.e.chr, ee.e.chr +'a' -1);
} }

View file

@ -33,6 +33,8 @@
#include "regexp.h" #include "regexp.h"
#include "dic_search.h" #include "dic_search.h"
#define __UNUSED__ __attribute__((unused))
/********************************************************/ /********************************************************/
/********************************************************/ /********************************************************/
/********************************************************/ /********************************************************/
@ -85,7 +87,7 @@ void init_letter_lists(struct search_RegE_list_t *list)
/********************************************************/ /********************************************************/
/********************************************************/ /********************************************************/
void void
usage(int argc, char* argv[]) usage(int __UNUSED__ argc, char* argv[])
{ {
fprintf(stderr,"usage: %s dictionary\n",argv[0]); fprintf(stderr,"usage: %s dictionary\n",argv[0]);
fprintf(stderr," dictionary : path to dawg eliot dictionary\n"); fprintf(stderr," dictionary : path to dawg eliot dictionary\n");

View file

@ -27,6 +27,7 @@
#include "results.h" #include "results.h"
#include "board.h" #include "board.h"
#include "debug.h" #include "debug.h"
#include "game.h"
#define oo 0 #define oo 0
#define __ 1 #define __ 1
@ -345,9 +346,9 @@ int Board::checkRoundAux(Matrix<Tile> &iTilesMx,
} }
/* Set the iPointsMx and bonus */ /* 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.setPoints(pts);
iRound.setBonus(fromrack == 7); iRound.setBonus(fromrack == Game::RACK_SIZE);
return 0; 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]" #define CELL_STRING_FORMAT "[%s:%2d]"
string Board::getCellContent_row(int row, int col) const string Board::getCellContent_row(int row, int col) const

View file

@ -26,6 +26,7 @@
#include "board.h" #include "board.h"
#include "encoding.h" #include "encoding.h"
#include "debug.h" #include "debug.h"
#include "game.h"
/* /*
* computes the score of a word, coordinates may be changed to reflect * computes the score of a word, coordinates may be changed to reflect
@ -74,8 +75,9 @@ static void BoardSearchEvalMove(const Board &iBoard,
fromrack++; 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); iWord.setPoints(pts);
if (iWord.getCoord().getDir() == Coord::VERTICAL) if (iWord.getCoord().getDir() == Coord::VERTICAL)
@ -89,8 +91,6 @@ static void BoardSearchEvalMove(const Board &iBoard,
// Restore the coordinates // Restore the coordinates
iWord.accessCoord().swap(); iWord.accessCoord().swap();
} }
/* fprintf(stdout,"eval: %s\n",convertToMb(iWord.toString()).c_str()); */
} }

View file

@ -35,8 +35,8 @@
#include "debug.h" #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): Game::Game(const Dictionary &iDic):
m_dic(&iDic) m_dic(&iDic)

View file

@ -46,6 +46,11 @@ using namespace std;
class Game class Game
{ {
public: public:
/// Game specs.
static const int RACK_SIZE;
static const int BONUS_POINTS;
Game(const Dictionary &iDic); Game(const Dictionary &iDic);
virtual ~Game(); virtual ~Game();
@ -136,7 +141,6 @@ public:
* 2 : the rack check was set on and failed * 2 : the rack check was set on and failed
* 3 : the rack cannot be completed (Game_*_setrackrandom only) * 3 : the rack cannot be completed (Game_*_setrackrandom only)
*************************/ *************************/
static const int RACK_SIZE;
enum set_rack_mode {RACK_ALL, RACK_NEW, RACK_MANUAL}; enum set_rack_mode {RACK_ALL, RACK_NEW, RACK_MANUAL};
int setRack(int player, set_rack_mode mode, bool check, const wstring& str); int setRack(int player, set_rack_mode mode, bool check, const wstring& str);

View file

@ -88,7 +88,8 @@ const Turn& History::getPreviousTurn() const
const Turn& History::getTurn(unsigned int n) 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]); return *(m_history[n]);
} }

View file

@ -29,6 +29,8 @@
#define FROMRACK 0x2 #define FROMRACK 0x2
#define JOKER 0x4 #define JOKER 0x4
#define __UNUSED__ __attribute__((unused))
Round::Round() 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. // c is unused.
m_word.pop_back(); 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. // c is unused.
m_word.pop_back(); m_word.pop_back();

View file

@ -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) const wchar_t *delim, wchar_t **state)
{ {
/* /*

View file

@ -30,6 +30,7 @@
using namespace std; using namespace std;
#define __UNUSED__ __attribute__((unused))
void GameIO::printBoard(ostream &out, const Game &iGame) 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; out << convertToMb(iGame.getCurrentPlayer().getCurrentRack().toString(PlayedRack::RACK_SIMPLE)) << endl;
} }

View file

@ -22,7 +22,7 @@ bin_PROGRAMS = eliot
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/dic -I$(top_srcdir)/game 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 = \ eliot_SOURCES = \
configdb.cc configdb.h \ configdb.cc configdb.h \
@ -36,6 +36,7 @@ eliot_SOURCES = \
mainframe.cc mainframe.h \ mainframe.cc mainframe.h \
main.cc ewx.h main.cc ewx.h
## eliot_CPPFLAGS=
eliot_LDADD = @WX_LIBS@ ../dic/libdic.a ../game/libgame.a eliot_LDADD = @WX_LIBS@ ../dic/libdic.a ../game/libgame.a
EXTRA_DIST = \ EXTRA_DIST = \

View file

@ -167,7 +167,7 @@ BagFrame::BagFrame(wxFrame* parent, Game& iGame):
} }
void void
BagFrame::Refresh(refresh_t force) BagFrame::Refresh(refresh_t __UNUSED__ force)
{ {
//debug(" BagFrame::Refresh\n"); //debug(" BagFrame::Refresh\n");
int n,index; int n,index;
@ -210,7 +210,7 @@ SearchFrame::SearchFrame(wxFrame *parent, Dictionary _dic):
} }
void void
SearchFrame::Refresh(refresh_t force) SearchFrame::Refresh(refresh_t __UNUSED__ force)
{ {
//debug(" SearchFrame::Refresh\n"); //debug(" SearchFrame::Refresh\n");
} }
@ -269,7 +269,7 @@ VerifFrame::OnText(wxCommandEvent&)
} }
void void
VerifFrame::Refresh(refresh_t force) VerifFrame::Refresh(refresh_t __UNUSED__ force)
{ {
//debug(" VerifFrame::Refresh\n"); //debug(" VerifFrame::Refresh\n");
} }
@ -313,7 +313,7 @@ AuxFrameList::AuxFrameList(wxFrame* parent, int _id, wxString _name, wxString _c
} }
void void
AuxFrameList::OnCopy(wxCommandEvent& event) AuxFrameList::OnCopy(wxCommandEvent __UNUSED__ &event)
{ {
wxString textdata; wxString textdata;
@ -338,7 +338,7 @@ AuxFrameList::Waiting()
} }
void void
AuxFrameList::Refresh(refresh_t force) AuxFrameList::Refresh(refresh_t __UNUSED__ force)
{ {
//debug(" %s : Refresh start\n",(const char*)name.mb_str()); //debug(" %s : Refresh start\n",(const char*)name.mb_str());
if (game == NULL) if (game == NULL)
@ -518,7 +518,7 @@ GameFrame::GameFrame(wxFrame* parent, Game& iGame):
} }
void void
GameFrame::Refresh(refresh_t force) GameFrame::Refresh(refresh_t __UNUSED__ force)
{ {
std::ostringstream mos; std::ostringstream mos;
m_game.save(mos); m_game.save(mos);
@ -591,7 +591,7 @@ ResultFrame::GetSelected()
} }
void void
ResultFrame::OnSize(wxSizeEvent& e) ResultFrame::OnSize(wxSizeEvent __UNUSED__ &e)
{ {
int w,h; int w,h;
GetClientSize(&w,&h); GetClientSize(&w,&h);

View file

@ -88,7 +88,7 @@ public:
void SwitchDisplay(); void SwitchDisplay();
void Reload(); void Reload();
virtual void Refresh(refresh_t force = REFRESH) {}; virtual void Refresh(refresh_t __UNUSED__ force = REFRESH) {};
}; };
/** /**

View file

@ -412,7 +412,7 @@ ConfDimDlg::writeconf()
} }
void void
ConfDimDlg::OnCloseWindow(wxCloseEvent& event) ConfDimDlg::OnCloseWindow(wxCloseEvent __UNUSED__ &event)
{ {
if (IsModal() == TRUE) if (IsModal() == TRUE)
EndModal(1); EndModal(1);
@ -421,7 +421,7 @@ ConfDimDlg::OnCloseWindow(wxCloseEvent& event)
} }
void void
ConfDimDlg::OnButtonOk(wxCommandEvent& event) ConfDimDlg::OnButtonOk(wxCommandEvent __UNUSED__ &event)
{ {
writeconf(); writeconf();
if (IsModal() == TRUE) if (IsModal() == TRUE)
@ -431,7 +431,7 @@ ConfDimDlg::OnButtonOk(wxCommandEvent& event)
} }
void void
ConfDimDlg::OnButtonCancel(wxCommandEvent &event) ConfDimDlg::OnButtonCancel(wxCommandEvent __UNUSED__ &event)
{ {
if (IsModal() == TRUE) if (IsModal() == TRUE)
EndModal(1); EndModal(1);
@ -440,13 +440,13 @@ ConfDimDlg::OnButtonCancel(wxCommandEvent &event)
} }
void void
ConfDimDlg::OnButtonSave(wxCommandEvent& event) ConfDimDlg::OnButtonSave(wxCommandEvent __UNUSED__ &event)
{ {
writeconf(); writeconf();
} }
void void
ConfDimDlg::OnConfPage(wxCommandEvent& event) ConfDimDlg::OnConfPage(wxCommandEvent __UNUSED__ &event)
{ {
//#if defined(__WXGTK__) //#if defined(__WXGTK__)
pagesetupdata = printdata; pagesetupdata = printdata;
@ -462,7 +462,7 @@ ConfDimDlg::OnConfPage(wxCommandEvent& event)
} }
void void
ConfDimDlg::OnConfPrinter(wxCommandEvent& event) ConfDimDlg::OnConfPrinter(wxCommandEvent __UNUSED__ &event)
{ {
//#if defined(__WXGTK__) //#if defined(__WXGTK__)
wxPrintDialogData printDialogData(printdata); wxPrintDialogData printDialogData(printdata);
@ -479,13 +479,13 @@ ConfDimDlg::OnConfPrinter(wxCommandEvent& event)
} }
void void
ConfDimDlg::OnConfFontHead(wxCommandEvent& event) ConfDimDlg::OnConfFontHead(wxCommandEvent __UNUSED__ &event)
{ {
headfont = config.ChooseFont((wxFrame*)this,headfont); headfont = config.ChooseFont((wxFrame*)this,headfont);
} }
void void
ConfDimDlg::OnConfFontText(wxCommandEvent& event) ConfDimDlg::OnConfFontText(wxCommandEvent __UNUSED__ &event)
{ {
textfont = config.ChooseFont((wxFrame*)this,textfont); textfont = config.ChooseFont((wxFrame*)this,textfont);
} }

View file

@ -627,7 +627,7 @@ float ConfigDB::getPrintLineScale()
return 0.2; return 0.2;
} }
void ConfigDB::setPrintLineScale(float s) void ConfigDB::setPrintLineScale(float)
{ {
} }

View file

@ -42,6 +42,8 @@
# define TODO(x...) # define TODO(x...)
#endif #endif
#define __UNUSED__ __attribute__((unused))
#if defined(__WIN32__) || defined(__WIN95__) || defined(__WXMSW__) #if defined(__WIN32__) || defined(__WIN95__) || defined(__WXMSW__)
# define ENABLE_LC_NO_HEADER # define ENABLE_LC_NO_HEADER
# define ENABLE_RESLIST_IN_MAIN # define ENABLE_RESLIST_IN_MAIN

View file

@ -92,7 +92,7 @@ GfxBoard::~GfxBoard(void)
*/ */
void void
GfxBoard::OnSize(wxSizeEvent& e) GfxBoard::OnSize(wxSizeEvent __UNUSED__ &e)
{ {
GFXDEBUG(std::cerr << "On size : "); GFXDEBUG(std::cerr << "On size : ");

View file

@ -217,7 +217,7 @@ GfxResult::OnListCtrlActivated(wxListEvent& event)
/* ************************************************** */ /* ************************************************** */
void void
GfxResult::OnSize(wxSizeEvent& e) GfxResult::OnSize(wxSizeEvent __UNUSED__ &e)
{ {
int w,h; int w,h;
GetClientSize(&w,&h); GetClientSize(&w,&h);

View file

@ -153,10 +153,9 @@ END_EVENT_TABLE()
// //
// ****************************** // ******************************
MainFrame::MainFrame(wxPoint pos_, wxSize size_) MainFrame::MainFrame(wxPoint __UNUSED__ pos_, wxSize size_) :
: wxFrame((wxFrame *) NULL, -1, wxT(APPNAME), wxPoint(-1, -1), wxFrame((wxFrame *) NULL, -1, wxT(APPNAME), wxPoint(-1, -1),
size_, wxDEFAULT_FRAME_STYLE, wxT(APPNAME)), size_, wxDEFAULT_FRAME_STYLE, wxT(APPNAME)), m_dic(NULL), m_game(NULL)
m_dic(NULL), m_game(NULL)
{ {
#if defined(ENABLE_RESLIST_IN_MAIN) #if defined(ENABLE_RESLIST_IN_MAIN)
reslist = NULL; reslist = NULL;

View file

@ -112,7 +112,7 @@ GamePrintout::DrawStringJustif(wxDC *dc, wxString *str, long x, long y, long w,
} }
void void
GamePrintout::DrawHeadingLine(wxDC *dc, long heightH, float mmToLogical) GamePrintout::DrawHeadingLine(wxDC *dc, long __UNUSED__ heightH, float mmToLogical)
{ {
long i,x,w,y; long i,x,w,y;
wxString str; wxString str;