mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-11 08:48:06 +01:00
load synonyms for specials correctly. So now Catalan works: wordlists
load, and search for "l-l" will find "L·L".
This commit is contained in:
parent
cae631eeb0
commit
c8332a9665
1 changed files with 16 additions and 0 deletions
|
@ -163,10 +163,14 @@ andLoadSpecialData( AndDictionaryCtxt* ctxt, XP_U8 const** ptrp,
|
||||||
XP_U8 const* ptr = *ptrp;
|
XP_U8 const* ptr = *ptrp;
|
||||||
Tile ii;
|
Tile ii;
|
||||||
XP_UCHAR** texts;
|
XP_UCHAR** texts;
|
||||||
|
XP_UCHAR** textEnds;
|
||||||
SpecialBitmaps* bitmaps;
|
SpecialBitmaps* bitmaps;
|
||||||
|
|
||||||
texts = (XP_UCHAR**)XP_MALLOC( ctxt->super.mpool,
|
texts = (XP_UCHAR**)XP_MALLOC( ctxt->super.mpool,
|
||||||
nSpecials * sizeof(*texts) );
|
nSpecials * sizeof(*texts) );
|
||||||
|
textEnds = (XP_UCHAR**)XP_MALLOC( ctxt->super.mpool,
|
||||||
|
nSpecials * sizeof(*textEnds) );
|
||||||
|
|
||||||
bitmaps = (SpecialBitmaps*)
|
bitmaps = (SpecialBitmaps*)
|
||||||
XP_CALLOC( ctxt->super.mpool, nSpecials * sizeof(*bitmaps) );
|
XP_CALLOC( ctxt->super.mpool, nSpecials * sizeof(*bitmaps) );
|
||||||
|
|
||||||
|
@ -180,11 +184,20 @@ andLoadSpecialData( AndDictionaryCtxt* ctxt, XP_U8 const** ptrp,
|
||||||
CHECK_PTR( ptr, txtlen, end );
|
CHECK_PTR( ptr, txtlen, end );
|
||||||
XP_UCHAR* text = (XP_UCHAR*)XP_MALLOC(ctxt->super.mpool, txtlen+1);
|
XP_UCHAR* text = (XP_UCHAR*)XP_MALLOC(ctxt->super.mpool, txtlen+1);
|
||||||
texts[(int)*facep] = text;
|
texts[(int)*facep] = text;
|
||||||
|
textEnds[(int)*facep] = text + txtlen + 1;
|
||||||
XP_MEMCPY( text, ptr, txtlen );
|
XP_MEMCPY( text, ptr, txtlen );
|
||||||
ptr += txtlen;
|
ptr += txtlen;
|
||||||
text[txtlen] = '\0';
|
text[txtlen] = '\0';
|
||||||
XP_ASSERT( *facep < nSpecials ); /* firing */
|
XP_ASSERT( *facep < nSpecials ); /* firing */
|
||||||
|
|
||||||
|
/* 0 is never part of a multi-byte utf8 char, so this little hack
|
||||||
|
is safe */
|
||||||
|
for ( ; '\0' != *text; ++text ) {
|
||||||
|
if ( *text == SYNONYM_DELIM ) {
|
||||||
|
*text = '\0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( !andMakeBitmap( ctxt, &ptr, end,
|
if ( !andMakeBitmap( ctxt, &ptr, end,
|
||||||
&bitmaps[(int)*facep].largeBM ) ) {
|
&bitmaps[(int)*facep].largeBM ) ) {
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -201,6 +214,7 @@ andLoadSpecialData( AndDictionaryCtxt* ctxt, XP_U8 const** ptrp,
|
||||||
success = XP_FALSE;
|
success = XP_FALSE;
|
||||||
done:
|
done:
|
||||||
ctxt->super.chars = texts;
|
ctxt->super.chars = texts;
|
||||||
|
ctxt->super.charEnds = textEnds;
|
||||||
ctxt->super.bitmaps = bitmaps;
|
ctxt->super.bitmaps = bitmaps;
|
||||||
|
|
||||||
*ptrp = ptr;
|
*ptrp = ptr;
|
||||||
|
@ -483,6 +497,8 @@ and_dictionary_destroy( DictionaryCtxt* dict )
|
||||||
}
|
}
|
||||||
XP_FREE( ctxt->super.mpool, ctxt->super.chars );
|
XP_FREE( ctxt->super.mpool, ctxt->super.chars );
|
||||||
}
|
}
|
||||||
|
XP_FREEP( ctxt->super.mpool, &ctxt->super.charEnds );
|
||||||
|
|
||||||
if ( !!ctxt->super.bitmaps ) {
|
if ( !!ctxt->super.bitmaps ) {
|
||||||
for ( ii = 0; ii < nSpecials; ++ii ) {
|
for ( ii = 0; ii < nSpecials; ++ii ) {
|
||||||
jobject bitmap = ctxt->super.bitmaps[ii].largeBM;
|
jobject bitmap = ctxt->super.bitmaps[ii].largeBM;
|
||||||
|
|
Loading…
Add table
Reference in a new issue