mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-18 22:26:30 +01:00
name change only
It was confusing using dict_ as the prefix for two "classes"
This commit is contained in:
parent
b2bc4e34cf
commit
e7c96290ea
7 changed files with 118 additions and 122 deletions
|
@ -83,9 +83,9 @@ public class DictBrowseDelegate extends DelegateBase
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
|
|
||||||
XwJNI.dict_iter_setMinMax( m_dictClosure, m_browseState.m_minShown,
|
XwJNI.di_setMinMax( m_dictClosure, m_browseState.m_minShown,
|
||||||
m_browseState.m_maxShown );
|
m_browseState.m_maxShown );
|
||||||
m_nWords = XwJNI.dict_iter_wordCount( m_dictClosure );
|
m_nWords = XwJNI.di_wordCount( m_dictClosure );
|
||||||
|
|
||||||
int format = m_browseState.m_minShown == m_browseState.m_maxShown ?
|
int format = m_browseState.m_minShown == m_browseState.m_maxShown ?
|
||||||
R.string.dict_browse_title1_fmt : R.string.dict_browse_title_fmt;
|
R.string.dict_browse_title1_fmt : R.string.dict_browse_title_fmt;
|
||||||
|
@ -98,7 +98,7 @@ public class DictBrowseDelegate extends DelegateBase
|
||||||
{
|
{
|
||||||
TextView text = (TextView)
|
TextView text = (TextView)
|
||||||
inflate( android.R.layout.simple_list_item_1 );
|
inflate( android.R.layout.simple_list_item_1 );
|
||||||
String str = XwJNI.dict_iter_nthWord( m_dictClosure, position, null );
|
String str = XwJNI.di_nthWord( m_dictClosure, position, null );
|
||||||
if ( null != str ) {
|
if ( null != str ) {
|
||||||
text.setText( str );
|
text.setText( str );
|
||||||
text.setOnClickListener( DictBrowseDelegate.this );
|
text.setOnClickListener( DictBrowseDelegate.this );
|
||||||
|
@ -141,8 +141,8 @@ public class DictBrowseDelegate extends DelegateBase
|
||||||
@Override
|
@Override
|
||||||
public Object[] getSections()
|
public Object[] getSections()
|
||||||
{
|
{
|
||||||
m_prefixes = XwJNI.dict_iter_getPrefixes( m_dictClosure );
|
m_prefixes = XwJNI.di_getPrefixes( m_dictClosure );
|
||||||
m_indices = XwJNI.dict_iter_getIndices( m_dictClosure );
|
m_indices = XwJNI.di_getIndices( m_dictClosure );
|
||||||
return m_prefixes;
|
return m_prefixes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -169,10 +169,10 @@ public class DictBrowseDelegate extends DelegateBase
|
||||||
|
|
||||||
String[] names = { name };
|
String[] names = { name };
|
||||||
DictUtils.DictPairs pairs = DictUtils.openDicts( m_activity, names );
|
DictUtils.DictPairs pairs = DictUtils.openDicts( m_activity, names );
|
||||||
m_dictClosure = XwJNI.dict_iter_init( pairs.m_bytes[0],
|
m_dictClosure = XwJNI.di_init( pairs.m_bytes[0],
|
||||||
name, pairs.m_paths[0] );
|
name, pairs.m_paths[0] );
|
||||||
|
|
||||||
String desc = XwJNI.dict_iter_getDesc( m_dictClosure );
|
String desc = XwJNI.di_getDesc( m_dictClosure );
|
||||||
Log.d( TAG, "got desc: %s", desc );
|
Log.d( TAG, "got desc: %s", desc );
|
||||||
if ( null != desc ) {
|
if ( null != desc ) {
|
||||||
TextView view = (TextView)findViewById( R.id.desc );
|
TextView view = (TextView)findViewById( R.id.desc );
|
||||||
|
@ -190,7 +190,7 @@ public class DictBrowseDelegate extends DelegateBase
|
||||||
}
|
}
|
||||||
if ( null == m_browseState.m_counts ) {
|
if ( null == m_browseState.m_counts ) {
|
||||||
m_browseState.m_counts =
|
m_browseState.m_counts =
|
||||||
XwJNI.dict_iter_getCounts( m_dictClosure );
|
XwJNI.di_getCounts( m_dictClosure );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( null == m_browseState.m_counts ) {
|
if ( null == m_browseState.m_counts ) {
|
||||||
|
@ -249,7 +249,7 @@ public class DictBrowseDelegate extends DelegateBase
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy()
|
protected void onDestroy()
|
||||||
{
|
{
|
||||||
XwJNI.dict_iter_destroy( m_dictClosure );
|
XwJNI.di_destroy( m_dictClosure );
|
||||||
m_dictClosure = 0;
|
m_dictClosure = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,7 +258,7 @@ public class DictBrowseDelegate extends DelegateBase
|
||||||
public void finalize()
|
public void finalize()
|
||||||
{
|
{
|
||||||
Assert.assertTrueNR( m_dictClosure == 0 );
|
Assert.assertTrueNR( m_dictClosure == 0 );
|
||||||
XwJNI.dict_iter_destroy( m_dictClosure );
|
XwJNI.di_destroy( m_dictClosure );
|
||||||
try {
|
try {
|
||||||
super.finalize();
|
super.finalize();
|
||||||
} catch ( java.lang.Throwable err ){
|
} catch ( java.lang.Throwable err ){
|
||||||
|
@ -276,7 +276,7 @@ public class DictBrowseDelegate extends DelegateBase
|
||||||
final byte[][] choices = (byte[][])params[0];
|
final byte[][] choices = (byte[][])params[0];
|
||||||
final String[] strs = new String[choices.length];
|
final String[] strs = new String[choices.length];
|
||||||
for ( int ii = 0; ii < choices.length; ++ii ) {
|
for ( int ii = 0; ii < choices.length; ++ii ) {
|
||||||
strs[ii] = XwJNI.dict_iter_tilesToStr( m_dictClosure, choices[ii], "." );
|
strs[ii] = XwJNI.di_tilesToStr( m_dictClosure, choices[ii], "." );
|
||||||
}
|
}
|
||||||
final int[] chosen = {0};
|
final int[] chosen = {0};
|
||||||
dialog = makeAlertBuilder()
|
dialog = makeAlertBuilder()
|
||||||
|
@ -374,7 +374,7 @@ public class DictBrowseDelegate extends DelegateBase
|
||||||
if ( null != text && 0 < text.length() ) {
|
if ( null != text && 0 < text.length() ) {
|
||||||
m_browseState.m_prefix = text;
|
m_browseState.m_prefix = text;
|
||||||
|
|
||||||
byte[][] choices = XwJNI.dict_iter_strToTiles( m_dictClosure, text );
|
byte[][] choices = XwJNI.di_strToTiles( m_dictClosure, text );
|
||||||
if ( null == choices || 0 == choices.length ) {
|
if ( null == choices || 0 == choices.length ) {
|
||||||
String msg = getString( R.string.no_tiles_exist, text, m_name );
|
String msg = getString( R.string.no_tiles_exist, text, m_name );
|
||||||
makeOkOnlyBuilder( msg ).show();
|
makeOkOnlyBuilder( msg ).show();
|
||||||
|
@ -402,11 +402,11 @@ public class DictBrowseDelegate extends DelegateBase
|
||||||
{
|
{
|
||||||
if ( null != prefix && 0 < prefix.length ) {
|
if ( null != prefix && 0 < prefix.length ) {
|
||||||
// Here's the search
|
// Here's the search
|
||||||
int pos = XwJNI.dict_iter_getStartsWith( m_dictClosure, prefix );
|
int pos = XwJNI.di_getStartsWith( m_dictClosure, prefix );
|
||||||
if ( 0 <= pos ) {
|
if ( 0 <= pos ) {
|
||||||
m_list.setSelection( pos );
|
m_list.setSelection( pos );
|
||||||
} else {
|
} else {
|
||||||
String text = XwJNI.dict_iter_tilesToStr( m_dictClosure, prefix, null );
|
String text = XwJNI.di_tilesToStr( m_dictClosure, prefix, null );
|
||||||
DbgUtils.showf( m_activity, R.string.dict_browse_nowords_fmt,
|
DbgUtils.showf( m_activity, R.string.dict_browse_nowords_fmt,
|
||||||
m_name, text );
|
m_name, text );
|
||||||
}
|
}
|
||||||
|
|
|
@ -514,25 +514,21 @@ public class XwJNI {
|
||||||
|
|
||||||
// Dict iterator
|
// Dict iterator
|
||||||
public final static int MAX_COLS_DICT = 15; // from dictiter.h
|
public final static int MAX_COLS_DICT = 15; // from dictiter.h
|
||||||
public static long dict_iter_init( byte[] dict, String name,
|
public static long di_init( byte[] dict, String name, String path )
|
||||||
String path )
|
|
||||||
{
|
{
|
||||||
return dict_iter_init( getJNI().m_ptrGlobals, dict, name, path );
|
return di_init( getJNI().m_ptrGlobals, dict, name, path );
|
||||||
}
|
}
|
||||||
public static native void dict_iter_setMinMax( long closure,
|
public static native void di_setMinMax( long closure, int min, int max );
|
||||||
int min, int max );
|
public static native void di_destroy( long closure );
|
||||||
public static native void dict_iter_destroy( long closure );
|
public static native int di_wordCount( long closure );
|
||||||
public static native int dict_iter_wordCount( long closure );
|
public static native int[] di_getCounts( long closure );
|
||||||
public static native int[] dict_iter_getCounts( long closure );
|
public static native String di_nthWord( long closure, int nn, String delim );
|
||||||
public static native String dict_iter_nthWord( long closure, int nn, String delim );
|
public static native String[] di_getPrefixes( long closure );
|
||||||
public static native String[] dict_iter_getPrefixes( long closure );
|
public static native int[] di_getIndices( long closure );
|
||||||
public static native int[] dict_iter_getIndices( long closure );
|
public static native byte[][] di_strToTiles( long closure, String str );
|
||||||
public static native byte[][] dict_iter_strToTiles( long closure,
|
public static native int di_getStartsWith( long closure, byte[] prefix );
|
||||||
String str );
|
public static native String di_getDesc( long closure );
|
||||||
public static native int dict_iter_getStartsWith( long closure,
|
public static native String di_tilesToStr( long closure, byte[] tiles, String delim );
|
||||||
byte[] prefix );
|
|
||||||
public static native String dict_iter_getDesc( long closure );
|
|
||||||
public static native String dict_iter_tilesToStr( long closure, byte[] tiles, String delim );
|
|
||||||
|
|
||||||
// Private methods -- called only here
|
// Private methods -- called only here
|
||||||
private static native long initGlobals( DUtilCtxt dutil, JNIUtils jniu );
|
private static native long initGlobals( DUtilCtxt dutil, JNIUtils jniu );
|
||||||
|
@ -551,8 +547,8 @@ public class XwJNI {
|
||||||
String name, String path,
|
String name, String path,
|
||||||
boolean check,
|
boolean check,
|
||||||
DictInfo info );
|
DictInfo info );
|
||||||
private static native long dict_iter_init( long jniState, byte[] dict,
|
private static native long di_init( long jniState, byte[] dict,
|
||||||
String name, String path );
|
String name, String path );
|
||||||
|
|
||||||
private static native byte[][]
|
private static native byte[][]
|
||||||
smsproto_prepOutbound( long jniState, SMS_CMD cmd, int gameID, byte[] buf,
|
smsproto_prepOutbound( long jniState, SMS_CMD cmd, int gameID, byte[] buf,
|
||||||
|
|
|
@ -2414,7 +2414,7 @@ static void makeIndex( DictIterData* data );
|
||||||
static void freeIndices( DictIterData* data );
|
static void freeIndices( DictIterData* data );
|
||||||
|
|
||||||
JNIEXPORT jlong JNICALL
|
JNIEXPORT jlong JNICALL
|
||||||
Java_org_eehouse_android_xw4_jni_XwJNI_dict_1iter_1init
|
Java_org_eehouse_android_xw4_jni_XwJNI_di_1init
|
||||||
( JNIEnv* env, jclass C, jlong jniGlobalPtr, jbyteArray jDictBytes,
|
( JNIEnv* env, jclass C, jlong jniGlobalPtr, jbyteArray jDictBytes,
|
||||||
jstring jname, jstring jpath )
|
jstring jname, jstring jpath )
|
||||||
{
|
{
|
||||||
|
@ -2443,19 +2443,19 @@ Java_org_eehouse_android_xw4_jni_XwJNI_dict_1iter_1init
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
Java_org_eehouse_android_xw4_jni_XwJNI_dict_1iter_1setMinMax
|
Java_org_eehouse_android_xw4_jni_XwJNI_di_1setMinMax
|
||||||
( JNIEnv* env, jclass C, jlong closure, jint min, jint max )
|
( JNIEnv* env, jclass C, jlong closure, jint min, jint max )
|
||||||
{
|
{
|
||||||
DictIterData* data = (DictIterData*)closure;
|
DictIterData* data = (DictIterData*)closure;
|
||||||
if ( NULL != data ) {
|
if ( NULL != data ) {
|
||||||
dict_initIter( &data->iter, data->dict, min, max );
|
di_initIter( &data->iter, data->dict, min, max );
|
||||||
makeIndex( data );
|
makeIndex( data );
|
||||||
(void)dict_firstWord( &data->iter );
|
(void)di_firstWord( &data->iter );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
Java_org_eehouse_android_xw4_jni_XwJNI_dict_1iter_1destroy
|
Java_org_eehouse_android_xw4_jni_XwJNI_di_1destroy
|
||||||
( JNIEnv* env, jclass C, jlong closure )
|
( JNIEnv* env, jclass C, jlong closure )
|
||||||
{
|
{
|
||||||
DictIterData* data = (DictIterData*)closure;
|
DictIterData* data = (DictIterData*)closure;
|
||||||
|
@ -2474,7 +2474,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_dict_1iter_1destroy
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL
|
JNIEXPORT jint JNICALL
|
||||||
Java_org_eehouse_android_xw4_jni_XwJNI_dict_1iter_1wordCount
|
Java_org_eehouse_android_xw4_jni_XwJNI_di_1wordCount
|
||||||
(JNIEnv* env, jclass C, jlong closure )
|
(JNIEnv* env, jclass C, jlong closure )
|
||||||
{
|
{
|
||||||
jint result = 0;
|
jint result = 0;
|
||||||
|
@ -2486,17 +2486,17 @@ Java_org_eehouse_android_xw4_jni_XwJNI_dict_1iter_1wordCount
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jintArray JNICALL
|
JNIEXPORT jintArray JNICALL
|
||||||
Java_org_eehouse_android_xw4_jni_XwJNI_dict_1iter_1getCounts
|
Java_org_eehouse_android_xw4_jni_XwJNI_di_1getCounts
|
||||||
(JNIEnv* env, jclass C, jlong closure )
|
(JNIEnv* env, jclass C, jlong closure )
|
||||||
{
|
{
|
||||||
jintArray result = NULL;
|
jintArray result = NULL;
|
||||||
DictIterData* data = (DictIterData*)closure;
|
DictIterData* data = (DictIterData*)closure;
|
||||||
if ( NULL != data ) {
|
if ( NULL != data ) {
|
||||||
DictIter iter;
|
DictIter iter;
|
||||||
dict_initIter( &iter, data->dict, 0, MAX_COLS_DICT );
|
di_initIter( &iter, data->dict, 0, MAX_COLS_DICT );
|
||||||
|
|
||||||
LengthsArray lens;
|
LengthsArray lens;
|
||||||
if ( 0 < dict_countWords( &iter, &lens ) ) {
|
if ( 0 < di_countWords( &iter, &lens ) ) {
|
||||||
XP_ASSERT( sizeof(jint) == sizeof(lens.lens[0]) );
|
XP_ASSERT( sizeof(jint) == sizeof(lens.lens[0]) );
|
||||||
result = makeIntArray( env, VSIZE(lens.lens), (jint*)&lens.lens,
|
result = makeIntArray( env, VSIZE(lens.lens), (jint*)&lens.lens,
|
||||||
sizeof(lens.lens[0]) );
|
sizeof(lens.lens[0]) );
|
||||||
|
@ -2506,7 +2506,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_dict_1iter_1getCounts
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jobjectArray JNICALL
|
JNIEXPORT jobjectArray JNICALL
|
||||||
Java_org_eehouse_android_xw4_jni_XwJNI_dict_1iter_1getPrefixes
|
Java_org_eehouse_android_xw4_jni_XwJNI_di_1getPrefixes
|
||||||
( JNIEnv* env, jclass C, jlong closure )
|
( JNIEnv* env, jclass C, jlong closure )
|
||||||
{
|
{
|
||||||
jobjectArray result = NULL;
|
jobjectArray result = NULL;
|
||||||
|
@ -2529,7 +2529,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_dict_1iter_1getPrefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jintArray JNICALL
|
JNIEXPORT jintArray JNICALL
|
||||||
Java_org_eehouse_android_xw4_jni_XwJNI_dict_1iter_1getIndices
|
Java_org_eehouse_android_xw4_jni_XwJNI_di_1getIndices
|
||||||
( JNIEnv* env, jclass C, jlong closure )
|
( JNIEnv* env, jclass C, jlong closure )
|
||||||
{
|
{
|
||||||
jintArray jindices = NULL;
|
jintArray jindices = NULL;
|
||||||
|
@ -2545,17 +2545,17 @@ Java_org_eehouse_android_xw4_jni_XwJNI_dict_1iter_1getIndices
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jstring JNICALL
|
JNIEXPORT jstring JNICALL
|
||||||
Java_org_eehouse_android_xw4_jni_XwJNI_dict_1iter_1nthWord
|
Java_org_eehouse_android_xw4_jni_XwJNI_di_1nthWord
|
||||||
( JNIEnv* env, jclass C, jlong closure, jint nn, jstring jdelim )
|
( JNIEnv* env, jclass C, jlong closure, jint nn, jstring jdelim )
|
||||||
{
|
{
|
||||||
jstring result = NULL;
|
jstring result = NULL;
|
||||||
DictIterData* data = (DictIterData*)closure;
|
DictIterData* data = (DictIterData*)closure;
|
||||||
if ( NULL != data ) {
|
if ( NULL != data ) {
|
||||||
if ( dict_getNthWord( &data->iter, nn, data->depth, &data->idata ) ) {
|
if ( di_getNthWord( &data->iter, nn, data->depth, &data->idata ) ) {
|
||||||
XP_UCHAR buf[64];
|
XP_UCHAR buf[64];
|
||||||
const XP_UCHAR* delim = NULL == jdelim ? NULL
|
const XP_UCHAR* delim = NULL == jdelim ? NULL
|
||||||
: (*env)->GetStringUTFChars( env, jdelim, NULL );
|
: (*env)->GetStringUTFChars( env, jdelim, NULL );
|
||||||
dict_wordToString( &data->iter, buf, VSIZE(buf), delim );
|
di_wordToString( &data->iter, buf, VSIZE(buf), delim );
|
||||||
result = (*env)->NewStringUTF( env, buf );
|
result = (*env)->NewStringUTF( env, buf );
|
||||||
if ( !!delim ) {
|
if ( !!delim ) {
|
||||||
(*env)->ReleaseStringUTFChars( env, jdelim, delim );
|
(*env)->ReleaseStringUTFChars( env, jdelim, delim );
|
||||||
|
@ -2581,7 +2581,7 @@ onFoundTiles( void* closure, const Tile* tiles, int nTiles )
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jobjectArray JNICALL
|
JNIEXPORT jobjectArray JNICALL
|
||||||
Java_org_eehouse_android_xw4_jni_XwJNI_dict_1iter_1strToTiles
|
Java_org_eehouse_android_xw4_jni_XwJNI_di_1strToTiles
|
||||||
( JNIEnv* env, jclass C, jlong closure, jstring jstr )
|
( JNIEnv* env, jclass C, jlong closure, jstring jstr )
|
||||||
{
|
{
|
||||||
jobjectArray result = NULL;
|
jobjectArray result = NULL;
|
||||||
|
@ -2605,7 +2605,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_dict_1iter_1strToTiles
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL
|
JNIEXPORT jint JNICALL
|
||||||
Java_org_eehouse_android_xw4_jni_XwJNI_dict_1iter_1getStartsWith
|
Java_org_eehouse_android_xw4_jni_XwJNI_di_1getStartsWith
|
||||||
( JNIEnv* env, jclass C, jlong closure, jbyteArray jtiles )
|
( JNIEnv* env, jclass C, jlong closure, jbyteArray jtiles )
|
||||||
{
|
{
|
||||||
jint result = -1;
|
jint result = -1;
|
||||||
|
@ -2613,8 +2613,8 @@ Java_org_eehouse_android_xw4_jni_XwJNI_dict_1iter_1getStartsWith
|
||||||
XP_U16 nTiles = (*env)->GetArrayLength( env, jtiles );
|
XP_U16 nTiles = (*env)->GetArrayLength( env, jtiles );
|
||||||
jbyte* tiles = (*env)->GetByteArrayElements( env, jtiles, NULL );
|
jbyte* tiles = (*env)->GetByteArrayElements( env, jtiles, NULL );
|
||||||
|
|
||||||
if ( 0 <= dict_findStartsWith( &data->iter, (Tile*)tiles, nTiles ) ) {
|
if ( 0 <= di_findStartsWith( &data->iter, (Tile*)tiles, nTiles ) ) {
|
||||||
result = dict_getPosition( &data->iter );
|
result = di_getPosition( &data->iter );
|
||||||
}
|
}
|
||||||
|
|
||||||
(*env)->ReleaseByteArrayElements( env, jtiles, tiles, 0 );
|
(*env)->ReleaseByteArrayElements( env, jtiles, tiles, 0 );
|
||||||
|
@ -2623,7 +2623,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_dict_1iter_1getStartsWith
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jstring JNICALL
|
JNIEXPORT jstring JNICALL
|
||||||
Java_org_eehouse_android_xw4_jni_XwJNI_dict_1iter_1tilesToStr
|
Java_org_eehouse_android_xw4_jni_XwJNI_di_1tilesToStr
|
||||||
( JNIEnv* env, jclass C, jlong closure, jbyteArray jtiles, jstring jdelim )
|
( JNIEnv* env, jclass C, jlong closure, jbyteArray jtiles, jstring jdelim )
|
||||||
{
|
{
|
||||||
jstring result = NULL;
|
jstring result = NULL;
|
||||||
|
@ -2654,7 +2654,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_dict_1iter_1tilesToStr
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jstring JNICALL
|
JNIEXPORT jstring JNICALL
|
||||||
Java_org_eehouse_android_xw4_jni_XwJNI_dict_1iter_1getDesc
|
Java_org_eehouse_android_xw4_jni_XwJNI_di_1getDesc
|
||||||
( JNIEnv* env, jclass C, jlong closure )
|
( JNIEnv* env, jclass C, jlong closure )
|
||||||
{
|
{
|
||||||
jstring result = NULL;
|
jstring result = NULL;
|
||||||
|
@ -2701,7 +2701,7 @@ makeIndex( DictIterData* data )
|
||||||
count * sizeof(*idata->indices) );
|
count * sizeof(*idata->indices) );
|
||||||
idata->count = count;
|
idata->count = count;
|
||||||
|
|
||||||
dict_makeIndex( &data->iter, data->depth, idata );
|
di_makeIndex( &data->iter, data->depth, idata );
|
||||||
if ( 0 < idata->count ) {
|
if ( 0 < idata->count ) {
|
||||||
idata->prefixes = XP_REALLOC( data->mpool, idata->prefixes,
|
idata->prefixes = XP_REALLOC( data->mpool, idata->prefixes,
|
||||||
idata->count * data->depth *
|
idata->count * data->depth *
|
||||||
|
|
|
@ -224,9 +224,9 @@ wordsEqual( const DictIter* word1, const DictIter* word2 )
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dict_initIterFrom( DictIter* dest, const DictIter* src )
|
initIterFrom( DictIter* dest, const DictIter* src )
|
||||||
{
|
{
|
||||||
dict_initIter( dest, src->dict,
|
di_initIter( dest, src->dict,
|
||||||
#ifdef XWFEATURE_WALKDICT_FILTER
|
#ifdef XWFEATURE_WALKDICT_FILTER
|
||||||
src->min, src->max
|
src->min, src->max
|
||||||
#else
|
#else
|
||||||
|
@ -249,10 +249,10 @@ firstWord( DictIter* iter )
|
||||||
}
|
}
|
||||||
|
|
||||||
XP_U32
|
XP_U32
|
||||||
dict_countWords( const DictIter* iter, LengthsArray* lens )
|
di_countWords( const DictIter* iter, LengthsArray* lens )
|
||||||
{
|
{
|
||||||
DictIter counter;
|
DictIter counter;
|
||||||
dict_initIterFrom( &counter, iter );
|
initIterFrom( &counter, iter );
|
||||||
|
|
||||||
if ( NULL != lens ) {
|
if ( NULL != lens ) {
|
||||||
XP_MEMSET( lens, 0, sizeof(*lens) );
|
XP_MEMSET( lens, 0, sizeof(*lens) );
|
||||||
|
@ -275,8 +275,8 @@ dict_countWords( const DictIter* iter, LengthsArray* lens )
|
||||||
#define ASSERT_INITED( iter ) XP_ASSERT( (iter)->guard == GUARD_VALUE )
|
#define ASSERT_INITED( iter ) XP_ASSERT( (iter)->guard == GUARD_VALUE )
|
||||||
|
|
||||||
void
|
void
|
||||||
dict_initIter( DictIter* iter, const DictionaryCtxt* dict,
|
di_initIter( DictIter* iter, const DictionaryCtxt* dict,
|
||||||
XP_U16 min, XP_U16 max )
|
XP_U16 min, XP_U16 max )
|
||||||
{
|
{
|
||||||
XP_MEMSET( iter, 0, sizeof(*iter) );
|
XP_MEMSET( iter, 0, sizeof(*iter) );
|
||||||
iter->dict = dict;
|
iter->dict = dict;
|
||||||
|
@ -364,7 +364,7 @@ indexOne( XP_U16 depth, Tile* tiles, IndexData* data, DictIter* prevIter,
|
||||||
DictPosition* prevIndex )
|
DictPosition* prevIndex )
|
||||||
{
|
{
|
||||||
DictIter curIter;
|
DictIter curIter;
|
||||||
dict_initIterFrom( &curIter, prevIter );
|
initIterFrom( &curIter, prevIter );
|
||||||
if ( findWordStartsWith( &curIter, tiles, depth ) ) {
|
if ( findWordStartsWith( &curIter, tiles, depth ) ) {
|
||||||
while ( !wordsEqual( &curIter, prevIter ) ) {
|
while ( !wordsEqual( &curIter, prevIter ) ) {
|
||||||
++*prevIndex;
|
++*prevIndex;
|
||||||
|
@ -401,7 +401,7 @@ doOneDepth( const Tile* allTiles, XP_U16 nTiles, Tile* prefix,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dict_makeIndex( const DictIter* iter, XP_U16 depth, IndexData* data )
|
di_makeIndex( const DictIter* iter, XP_U16 depth, IndexData* data )
|
||||||
{
|
{
|
||||||
ASSERT_INITED( iter );
|
ASSERT_INITED( iter );
|
||||||
const DictionaryCtxt* dict = iter->dict;
|
const DictionaryCtxt* dict = iter->dict;
|
||||||
|
@ -433,7 +433,7 @@ dict_makeIndex( const DictIter* iter, XP_U16 depth, IndexData* data )
|
||||||
*/
|
*/
|
||||||
data->count = 0;
|
data->count = 0;
|
||||||
DictIter prevIter;
|
DictIter prevIter;
|
||||||
dict_initIterFrom( &prevIter, iter );
|
initIterFrom( &prevIter, iter );
|
||||||
if ( firstWord( &prevIter ) ) {
|
if ( firstWord( &prevIter ) ) {
|
||||||
DictPosition prevIndex = 0;
|
DictPosition prevIndex = 0;
|
||||||
Tile prefix[depth];
|
Tile prefix[depth];
|
||||||
|
@ -452,11 +452,11 @@ dict_makeIndex( const DictIter* iter, XP_U16 depth, IndexData* data )
|
||||||
static void
|
static void
|
||||||
initWord( DictIter* iter )
|
initWord( DictIter* iter )
|
||||||
{
|
{
|
||||||
iter->nWords = dict_countWords( iter, NULL );
|
iter->nWords = di_countWords( iter, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
XP_Bool
|
XP_Bool
|
||||||
dict_firstWord( DictIter* iter )
|
di_firstWord( DictIter* iter )
|
||||||
{
|
{
|
||||||
ASSERT_INITED( iter );
|
ASSERT_INITED( iter );
|
||||||
XP_Bool success = firstWord( iter );
|
XP_Bool success = firstWord( iter );
|
||||||
|
@ -469,7 +469,7 @@ dict_firstWord( DictIter* iter )
|
||||||
}
|
}
|
||||||
|
|
||||||
XP_Bool
|
XP_Bool
|
||||||
dict_getNextWord( DictIter* iter )
|
di_getNextWord( DictIter* iter )
|
||||||
{
|
{
|
||||||
ASSERT_INITED( iter );
|
ASSERT_INITED( iter );
|
||||||
XP_Bool success = nextWord( iter );
|
XP_Bool success = nextWord( iter );
|
||||||
|
@ -480,7 +480,7 @@ dict_getNextWord( DictIter* iter )
|
||||||
}
|
}
|
||||||
|
|
||||||
XP_Bool
|
XP_Bool
|
||||||
dict_lastWord( DictIter* iter )
|
di_lastWord( DictIter* iter )
|
||||||
{
|
{
|
||||||
ASSERT_INITED( iter );
|
ASSERT_INITED( iter );
|
||||||
iter->nEdges = 1;
|
iter->nEdges = 1;
|
||||||
|
@ -496,7 +496,7 @@ dict_lastWord( DictIter* iter )
|
||||||
}
|
}
|
||||||
|
|
||||||
XP_Bool
|
XP_Bool
|
||||||
dict_getPrevWord( DictIter* iter )
|
di_getPrevWord( DictIter* iter )
|
||||||
{
|
{
|
||||||
ASSERT_INITED( iter );
|
ASSERT_INITED( iter );
|
||||||
XP_Bool success = prevWord( iter );
|
XP_Bool success = prevWord( iter );
|
||||||
|
@ -510,8 +510,8 @@ dict_getPrevWord( DictIter* iter )
|
||||||
sought. OR if we're father than necessary from what's sought, start over
|
sought. OR if we're father than necessary from what's sought, start over
|
||||||
at the closer end. Then move as many steps as necessary to reach it. */
|
at the closer end. Then move as many steps as necessary to reach it. */
|
||||||
XP_Bool
|
XP_Bool
|
||||||
dict_getNthWord( DictIter* iter, DictPosition position, XP_U16 depth,
|
di_getNthWord( DictIter* iter, DictPosition position, XP_U16 depth,
|
||||||
const IndexData* data )
|
const IndexData* data )
|
||||||
{
|
{
|
||||||
ASSERT_INITED( iter );
|
ASSERT_INITED( iter );
|
||||||
const DictionaryCtxt* dict = iter->dict;
|
const DictionaryCtxt* dict = iter->dict;
|
||||||
|
@ -519,7 +519,7 @@ dict_getNthWord( DictIter* iter, DictPosition position, XP_U16 depth,
|
||||||
XP_Bool validWord = 0 < iter->nEdges;
|
XP_Bool validWord = 0 < iter->nEdges;
|
||||||
if ( validWord ) { /* uninitialized */
|
if ( validWord ) { /* uninitialized */
|
||||||
wordCount = iter->nWords;
|
wordCount = iter->nWords;
|
||||||
XP_ASSERT( wordCount == dict_countWords( iter, NULL ) );
|
XP_ASSERT( wordCount == di_countWords( iter, NULL ) );
|
||||||
} else {
|
} else {
|
||||||
wordCount = dict_getWordCount( dict );
|
wordCount = dict_getWordCount( dict );
|
||||||
}
|
}
|
||||||
|
@ -532,9 +532,9 @@ dict_getNthWord( DictIter* iter, DictPosition position, XP_U16 depth,
|
||||||
success = XP_TRUE;
|
success = XP_TRUE;
|
||||||
/* do nothing; we're done */
|
/* do nothing; we're done */
|
||||||
} else if ( iter->position == position - 1 ) {
|
} else if ( iter->position == position - 1 ) {
|
||||||
success = dict_getNextWord( iter );
|
success = di_getNextWord( iter );
|
||||||
} else if ( iter->position == position + 1 ) {
|
} else if ( iter->position == position + 1 ) {
|
||||||
success = dict_getPrevWord( iter );
|
success = di_getPrevWord( iter );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -557,9 +557,9 @@ dict_getNthWord( DictIter* iter, DictPosition position, XP_U16 depth,
|
||||||
|
|
||||||
if ( !validWord ) {
|
if ( !validWord ) {
|
||||||
if ( position >= wordCount ) {
|
if ( position >= wordCount ) {
|
||||||
dict_lastWord( iter );
|
di_lastWord( iter );
|
||||||
} else {
|
} else {
|
||||||
dict_firstWord( iter );
|
di_firstWord( iter );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wordIndex = iter->position;
|
wordIndex = iter->position;
|
||||||
|
@ -585,14 +585,14 @@ dict_getNthWord( DictIter* iter, DictPosition position, XP_U16 depth,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return success;
|
return success;
|
||||||
} /* dict_getNthWord */
|
} /* di_getNthWord */
|
||||||
|
|
||||||
static DictPosition
|
static DictPosition
|
||||||
figurePosition( DictIter* iter )
|
figurePosition( DictIter* iter )
|
||||||
{
|
{
|
||||||
DictPosition result = 0;
|
DictPosition result = 0;
|
||||||
DictIter iterZero;
|
DictIter iterZero;
|
||||||
dict_initIterFrom( &iterZero, iter );
|
initIterFrom( &iterZero, iter );
|
||||||
if ( !firstWord( &iterZero ) ) {
|
if ( !firstWord( &iterZero ) ) {
|
||||||
XP_ASSERT( 0 );
|
XP_ASSERT( 0 );
|
||||||
}
|
}
|
||||||
|
@ -608,7 +608,7 @@ figurePosition( DictIter* iter )
|
||||||
}
|
}
|
||||||
|
|
||||||
XP_S16
|
XP_S16
|
||||||
dict_findStartsWith( DictIter* iter, const Tile* prefix, XP_U16 len )
|
di_findStartsWith( DictIter* iter, const Tile* prefix, XP_U16 len )
|
||||||
{
|
{
|
||||||
ASSERT_INITED( iter );
|
ASSERT_INITED( iter );
|
||||||
XP_S16 offset = findStartsWithTiles( iter, prefix, len );
|
XP_S16 offset = findStartsWithTiles( iter, prefix, len );
|
||||||
|
@ -630,15 +630,15 @@ dict_findStartsWith( DictIter* iter, const Tile* prefix, XP_U16 len )
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dict_wordToString( const DictIter* iter, XP_UCHAR* buf, XP_U16 buflen,
|
di_wordToString( const DictIter* iter, XP_UCHAR* buf, XP_U16 buflen,
|
||||||
const XP_UCHAR* delim )
|
const XP_UCHAR* delim )
|
||||||
{
|
{
|
||||||
ASSERT_INITED( iter );
|
ASSERT_INITED( iter );
|
||||||
iterToString( iter, buf, buflen, delim );
|
iterToString( iter, buf, buflen, delim );
|
||||||
}
|
}
|
||||||
|
|
||||||
DictPosition
|
DictPosition
|
||||||
dict_getPosition( const DictIter* iter )
|
di_getPosition( const DictIter* iter )
|
||||||
{
|
{
|
||||||
ASSERT_INITED( iter );
|
ASSERT_INITED( iter );
|
||||||
return iter->position;
|
return iter->position;
|
||||||
|
|
|
@ -63,21 +63,21 @@ typedef struct _LengthsArray {
|
||||||
XP_U32 lens[MAX_COLS_DICT+1];
|
XP_U32 lens[MAX_COLS_DICT+1];
|
||||||
} LengthsArray;
|
} LengthsArray;
|
||||||
|
|
||||||
void dict_initIter( DictIter* iter, const DictionaryCtxt* dict,
|
void di_initIter( DictIter* iter, const DictionaryCtxt* dict,
|
||||||
XP_U16 min, XP_U16 max );
|
XP_U16 min, XP_U16 max );
|
||||||
XP_U32 dict_countWords( const DictIter* iter, LengthsArray* lens );
|
XP_U32 di_countWords( const DictIter* iter, LengthsArray* lens );
|
||||||
void dict_makeIndex( const DictIter* iter, XP_U16 depth, IndexData* data );
|
void di_makeIndex( const DictIter* iter, XP_U16 depth, IndexData* data );
|
||||||
XP_Bool dict_firstWord( DictIter* iter );
|
XP_Bool di_firstWord( DictIter* iter );
|
||||||
XP_Bool dict_lastWord( DictIter* iter );
|
XP_Bool di_lastWord( DictIter* iter );
|
||||||
XP_Bool dict_getNextWord( DictIter* iter );
|
XP_Bool di_getNextWord( DictIter* iter );
|
||||||
XP_Bool dict_getPrevWord( DictIter* iter );
|
XP_Bool di_getPrevWord( DictIter* iter );
|
||||||
XP_Bool dict_getNthWord( DictIter* iter, DictPosition position, XP_U16 depth,
|
XP_Bool di_getNthWord( DictIter* iter, DictPosition position, XP_U16 depth,
|
||||||
const IndexData* data );
|
const IndexData* data );
|
||||||
void dict_wordToString( const DictIter* iter, XP_UCHAR* buf, XP_U16 buflen,
|
void di_wordToString( const DictIter* iter, XP_UCHAR* buf, XP_U16 buflen,
|
||||||
const XP_UCHAR* delim );
|
const XP_UCHAR* delim );
|
||||||
XP_S16 dict_findStartsWith( DictIter* iter, const Tile* prefix, XP_U16 nTiles );
|
XP_S16 di_findStartsWith( DictIter* iter, const Tile* prefix, XP_U16 nTiles );
|
||||||
void dict_stringToTiles( const XP_UCHAR* str, Tile out[], XP_U16* nTiles );
|
void di_stringToTiles( const XP_UCHAR* str, Tile out[], XP_U16* nTiles );
|
||||||
DictPosition dict_getPosition( const DictIter* iter );
|
DictPosition di_getPosition( const DictIter* iter );
|
||||||
#ifdef CPLUS
|
#ifdef CPLUS
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -591,8 +591,8 @@ dict_getWordCount( const DictionaryCtxt* dict )
|
||||||
#ifdef XWFEATURE_WALKDICT
|
#ifdef XWFEATURE_WALKDICT
|
||||||
if ( 0 == nWords ) {
|
if ( 0 == nWords ) {
|
||||||
DictIter iter;
|
DictIter iter;
|
||||||
dict_initIter( &iter, dict, 0, MAX_COLS_DICT );
|
di_initIter( &iter, dict, 0, MAX_COLS_DICT );
|
||||||
nWords = dict_countWords( &iter, NULL );
|
nWords = di_countWords( &iter, NULL );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return nWords;
|
return nWords;
|
||||||
|
|
|
@ -1903,16 +1903,16 @@ testGetNthWord( const DictionaryCtxt* dict, char** XP_UNUSED_DBG(words),
|
||||||
XP_U32 ii, jj;
|
XP_U32 ii, jj;
|
||||||
DictIter iter;
|
DictIter iter;
|
||||||
|
|
||||||
dict_initIter( &iter, dict, min, max );
|
di_initIter( &iter, dict, min, max );
|
||||||
XP_U32 half = dict_countWords( &iter, NULL ) / 2;
|
XP_U32 half = di_countWords( &iter, NULL ) / 2;
|
||||||
XP_U32 interval = half / 100;
|
XP_U32 interval = half / 100;
|
||||||
if ( interval == 0 ) {
|
if ( interval == 0 ) {
|
||||||
++interval;
|
++interval;
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( ii = 0, jj = half; ii < half; ii += interval, jj += interval ) {
|
for ( ii = 0, jj = half; ii < half; ii += interval, jj += interval ) {
|
||||||
if ( dict_getNthWord( &iter, ii, depth, data ) ) {
|
if ( di_getNthWord( &iter, ii, depth, data ) ) {
|
||||||
dict_wordToString( &iter, buf, VSIZE(buf), "." );
|
di_wordToString( &iter, buf, VSIZE(buf), "." );
|
||||||
XP_ASSERT( 0 == strcmp( buf, words[ii] ) );
|
XP_ASSERT( 0 == strcmp( buf, words[ii] ) );
|
||||||
# ifdef PRINT_ALL
|
# ifdef PRINT_ALL
|
||||||
XP_LOGF( "%s: word[%ld]: %s", __func__, ii, buf );
|
XP_LOGF( "%s: word[%ld]: %s", __func__, ii, buf );
|
||||||
|
@ -1920,8 +1920,8 @@ testGetNthWord( const DictionaryCtxt* dict, char** XP_UNUSED_DBG(words),
|
||||||
} else {
|
} else {
|
||||||
XP_ASSERT( 0 );
|
XP_ASSERT( 0 );
|
||||||
}
|
}
|
||||||
if ( dict_getNthWord( &iter, jj, depth, data ) ) {
|
if ( di_getNthWord( &iter, jj, depth, data ) ) {
|
||||||
dict_wordToString( &iter, buf, VSIZE(buf), "." );
|
di_wordToString( &iter, buf, VSIZE(buf), "." );
|
||||||
XP_ASSERT( 0 == strcmp( buf, words[jj] ) );
|
XP_ASSERT( 0 == strcmp( buf, words[jj] ) );
|
||||||
# ifdef PRINT_ALL
|
# ifdef PRINT_ALL
|
||||||
XP_LOGF( "%s: word[%ld]: %s", __func__, jj, buf );
|
XP_LOGF( "%s: word[%ld]: %s", __func__, jj, buf );
|
||||||
|
@ -1943,25 +1943,25 @@ static XP_Bool
|
||||||
onFoundTiles( void* closure, const Tile* tiles, int nTiles )
|
onFoundTiles( void* closure, const Tile* tiles, int nTiles )
|
||||||
{
|
{
|
||||||
FTData* ftp = (FTData*)closure;
|
FTData* ftp = (FTData*)closure;
|
||||||
XP_S16 lenMatched = dict_findStartsWith( ftp->iter, tiles, nTiles );
|
XP_S16 lenMatched = di_findStartsWith( ftp->iter, tiles, nTiles );
|
||||||
if ( 0 <= lenMatched ) {
|
if ( 0 <= lenMatched ) {
|
||||||
XP_UCHAR buf[32];
|
XP_UCHAR buf[32];
|
||||||
XP_UCHAR bufPrev[32] = {0};
|
XP_UCHAR bufPrev[32] = {0};
|
||||||
dict_wordToString( ftp->iter, buf, VSIZE(buf), "." );
|
di_wordToString( ftp->iter, buf, VSIZE(buf), "." );
|
||||||
|
|
||||||
/* This doesn't work with synonyms like "L-L" for "L·L" */
|
/* This doesn't work with synonyms like "L-L" for "L·L" */
|
||||||
// XP_ASSERT( 0 == strncasecmp( buf, prefix, lenMatched ) );
|
// XP_ASSERT( 0 == strncasecmp( buf, prefix, lenMatched ) );
|
||||||
|
|
||||||
DictPosition pos = dict_getPosition( ftp->iter );
|
DictPosition pos = di_getPosition( ftp->iter );
|
||||||
XP_ASSERT( 0 == strcmp( buf, ftp->words[pos] ) );
|
XP_ASSERT( 0 == strcmp( buf, ftp->words[pos] ) );
|
||||||
if ( pos > 0 ) {
|
if ( pos > 0 ) {
|
||||||
if ( !dict_getNthWord( ftp->iter, pos-1, ftp->depth, ftp->data ) ) {
|
if ( !di_getNthWord( ftp->iter, pos-1, ftp->depth, ftp->data ) ) {
|
||||||
XP_ASSERT( 0 );
|
XP_ASSERT( 0 );
|
||||||
}
|
}
|
||||||
dict_wordToString( ftp->iter, bufPrev, VSIZE(bufPrev), "." );
|
di_wordToString( ftp->iter, bufPrev, VSIZE(bufPrev), "." );
|
||||||
XP_ASSERT( 0 == strcmp( bufPrev, ftp->words[pos-1] ) );
|
XP_ASSERT( 0 == strcmp( bufPrev, ftp->words[pos-1] ) );
|
||||||
}
|
}
|
||||||
XP_LOGF( "dict_getStartsWith(%s) => %s (prev=%s)",
|
XP_LOGF( "di_getStartsWith(%s) => %s (prev=%s)",
|
||||||
ftp->prefix, buf, bufPrev );
|
ftp->prefix, buf, bufPrev );
|
||||||
} else {
|
} else {
|
||||||
XP_LOGFF( "nothing starts with %s", ftp->prefix );
|
XP_LOGFF( "nothing starts with %s", ftp->prefix );
|
||||||
|
@ -1985,9 +1985,9 @@ walk_dict_test( MPFORMAL const DictionaryCtxt* dict,
|
||||||
max = MAX_COLS_DICT;
|
max = MAX_COLS_DICT;
|
||||||
}
|
}
|
||||||
|
|
||||||
dict_initIter( &iter, dict, min, max );
|
di_initIter( &iter, dict, min, max );
|
||||||
LengthsArray lens;
|
LengthsArray lens;
|
||||||
XP_U32 count = dict_countWords( &iter, &lens );
|
XP_U32 count = di_countWords( &iter, &lens );
|
||||||
|
|
||||||
XP_U32 sum = 0;
|
XP_U32 sum = 0;
|
||||||
for ( jj = 0; jj < VSIZE(lens.lens); ++jj ) {
|
for ( jj = 0; jj < VSIZE(lens.lens); ++jj ) {
|
||||||
|
@ -2000,12 +2000,12 @@ walk_dict_test( MPFORMAL const DictionaryCtxt* dict,
|
||||||
char** words = g_malloc( count * sizeof(char*) );
|
char** words = g_malloc( count * sizeof(char*) );
|
||||||
XP_ASSERT( !!words );
|
XP_ASSERT( !!words );
|
||||||
|
|
||||||
for ( jj = 0, gotOne = dict_firstWord( &iter );
|
for ( jj = 0, gotOne = di_firstWord( &iter );
|
||||||
gotOne;
|
gotOne;
|
||||||
gotOne = dict_getNextWord( &iter ) ) {
|
gotOne = di_getNextWord( &iter ) ) {
|
||||||
XP_ASSERT( dict_getPosition( &iter ) == jj );
|
XP_ASSERT( di_getPosition( &iter ) == jj );
|
||||||
XP_UCHAR buf[64];
|
XP_UCHAR buf[64];
|
||||||
dict_wordToString( &iter, buf, VSIZE(buf), "." );
|
di_wordToString( &iter, buf, VSIZE(buf), "." );
|
||||||
# ifdef PRINT_ALL
|
# ifdef PRINT_ALL
|
||||||
fprintf( stderr, "%.6ld: %s\n", jj, buf );
|
fprintf( stderr, "%.6ld: %s\n", jj, buf );
|
||||||
# endif
|
# endif
|
||||||
|
@ -2016,12 +2016,12 @@ walk_dict_test( MPFORMAL const DictionaryCtxt* dict,
|
||||||
}
|
}
|
||||||
XP_ASSERT( count == jj );
|
XP_ASSERT( count == jj );
|
||||||
|
|
||||||
for ( jj = 0, gotOne = dict_lastWord( &iter );
|
for ( jj = 0, gotOne = di_lastWord( &iter );
|
||||||
gotOne;
|
gotOne;
|
||||||
++jj, gotOne = dict_getPrevWord( &iter ) ) {
|
++jj, gotOne = di_getPrevWord( &iter ) ) {
|
||||||
XP_ASSERT( dict_getPosition(&iter) == count-jj-1 );
|
XP_ASSERT( di_getPosition(&iter) == count-jj-1 );
|
||||||
XP_UCHAR buf[64];
|
XP_UCHAR buf[64];
|
||||||
dict_wordToString( &iter, buf, VSIZE(buf), "." );
|
di_wordToString( &iter, buf, VSIZE(buf), "." );
|
||||||
# ifdef PRINT_ALL
|
# ifdef PRINT_ALL
|
||||||
fprintf( stderr, "%.6ld: %s\n", jj, buf );
|
fprintf( stderr, "%.6ld: %s\n", jj, buf );
|
||||||
# endif
|
# endif
|
||||||
|
@ -2049,7 +2049,7 @@ walk_dict_test( MPFORMAL const DictionaryCtxt* dict,
|
||||||
depth * data.count * sizeof(data.prefixes[0]) );
|
depth * data.count * sizeof(data.prefixes[0]) );
|
||||||
|
|
||||||
XP_LOGF( "making index..." );
|
XP_LOGF( "making index..." );
|
||||||
dict_makeIndex( &iter, depth, &data );
|
di_makeIndex( &iter, depth, &data );
|
||||||
XP_LOGF( "DONE making index" );
|
XP_LOGF( "DONE making index" );
|
||||||
|
|
||||||
data.indices = XP_REALLOC( mpool, data.indices,
|
data.indices = XP_REALLOC( mpool, data.indices,
|
||||||
|
@ -2122,12 +2122,12 @@ static void
|
||||||
dumpDict( DictionaryCtxt* dict )
|
dumpDict( DictionaryCtxt* dict )
|
||||||
{
|
{
|
||||||
DictIter iter;
|
DictIter iter;
|
||||||
dict_initIter( &iter, dict, 0, MAX_COLS_DICT );
|
di_initIter( &iter, dict, 0, MAX_COLS_DICT );
|
||||||
for ( XP_Bool result = dict_firstWord( &iter );
|
for ( XP_Bool result = di_firstWord( &iter );
|
||||||
result;
|
result;
|
||||||
result = dict_getNextWord( &iter ) ) {
|
result = di_getNextWord( &iter ) ) {
|
||||||
XP_UCHAR buf[32];
|
XP_UCHAR buf[32];
|
||||||
dict_wordToString( &iter, buf, VSIZE(buf), "." );
|
di_wordToString( &iter, buf, VSIZE(buf), "." );
|
||||||
fprintf( stdout, "%s\n", buf );
|
fprintf( stdout, "%s\n", buf );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue