mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-01 06:19:57 +01:00
add option to dump an .xwd file, meant to replace dawg2dict.pl which
is becoming a pain to maintain.
This commit is contained in:
parent
07cfdad699
commit
195e6bfad3
2 changed files with 208 additions and 167 deletions
|
@ -257,6 +257,9 @@ debcheck:
|
|||
|
||||
all: debcheck $(TARGET)
|
||||
|
||||
dawg2dict: $(TARGET)
|
||||
ln -sf $< $@
|
||||
|
||||
help:
|
||||
@echo "make [MEMDEBUG=TRUE] [CURSES_ONLY=TRUE] [GTK_ONLY=TRUE]"
|
||||
|
||||
|
|
|
@ -1423,6 +1423,20 @@ walk_dict_test_all( const LaunchParams* params, GSList* testDicts,
|
|||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
dumpDict( DictionaryCtxt* dict )
|
||||
{
|
||||
DictIter iter;
|
||||
dict_initIter( &iter, dict, 0, MAX_COLS_DICT );
|
||||
for ( XP_Bool result = dict_firstWord( &iter );
|
||||
result;
|
||||
result = dict_getNextWord( &iter ) ) {
|
||||
XP_UCHAR buf[32];
|
||||
dict_wordToString( &iter, buf, VSIZE(buf) );
|
||||
fprintf( stdout, "%s\n", buf );
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
trimDictPath( const char* input, char* buf, int bufsiz, char** path, char** dict )
|
||||
{
|
||||
|
@ -1506,6 +1520,23 @@ listDicts( const LaunchParams *params )
|
|||
return result;
|
||||
}
|
||||
|
||||
static int
|
||||
dawg2dict( const LaunchParams* params, GSList* testDicts )
|
||||
{
|
||||
guint count = g_slist_length( testDicts );
|
||||
for ( int ii = 0; ii < count; ++ii ) {
|
||||
DictionaryCtxt* dict =
|
||||
linux_dictionary_make( MPPARM(params->util->mpool) params,
|
||||
g_slist_nth_data( testDicts, ii ),
|
||||
params->useMmap );
|
||||
if ( NULL != dict ) {
|
||||
dumpDict( dict );
|
||||
dict_destroy( dict );
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
main( int argc, char** argv )
|
||||
{
|
||||
|
@ -1925,6 +1956,10 @@ main( int argc, char** argv )
|
|||
}
|
||||
}
|
||||
|
||||
int result;
|
||||
if ( g_str_has_suffix( argv[0], "dawg2dict" ) ) {
|
||||
result = dawg2dict( &mainParams, testDicts );
|
||||
} else {
|
||||
XP_ASSERT( mainParams.gi.nPlayers == mainParams.nLocalPlayers
|
||||
+ mainParams.info.serverInfo.nRemotePlayers );
|
||||
|
||||
|
@ -2129,7 +2164,10 @@ main( int argc, char** argv )
|
|||
|
||||
free( mainParams.util );
|
||||
|
||||
result = 0;
|
||||
}
|
||||
|
||||
XP_LOGF( "%s exiting main", argv[0] );
|
||||
return 0;
|
||||
return result;
|
||||
} /* main */
|
||||
|
||||
|
|
Loading…
Reference in a new issue