get rid of NODE_CAN_4. Not change to post-compiled code

This commit is contained in:
Eric House 2012-08-01 20:29:15 -07:00
parent b8ba3c5906
commit 464696566d
10 changed files with 4 additions and 74 deletions

View file

@ -33,7 +33,6 @@ local_DEFINES += \
-DFEATURE_TRAY_EDIT \ -DFEATURE_TRAY_EDIT \
-DMAX_ROWS=32 \ -DMAX_ROWS=32 \
-DINITIAL_CLIENT_VERS=2 \ -DINITIAL_CLIENT_VERS=2 \
-DNODE_CAN_4 \
-DRELAY_ROOM_DEFAULT=\"\"\ -DRELAY_ROOM_DEFAULT=\"\"\
-D__LITTLE_ENDIAN \ -D__LITTLE_ENDIAN \

View file

@ -37,7 +37,6 @@ local_DEFINES += \
-DHASH_STREAM \ -DHASH_STREAM \
-DXWFEATURE_BASE64 \ -DXWFEATURE_BASE64 \
-DINITIAL_CLIENT_VERS=2 \ -DINITIAL_CLIENT_VERS=2 \
-DNODE_CAN_4 \
-DRELAY_ROOM_DEFAULT=\"\" \ -DRELAY_ROOM_DEFAULT=\"\" \
-D__LITTLE_ENDIAN \ -D__LITTLE_ENDIAN \

View file

@ -34,7 +34,6 @@ local_DEFINES += \
-DHASH_STREAM \ -DHASH_STREAM \
-DXWFEATURE_BASE64 \ -DXWFEATURE_BASE64 \
-DINITIAL_CLIENT_VERS=2 \ -DINITIAL_CLIENT_VERS=2 \
-DNODE_CAN_4 \
-DRELAY_ROOM_DEFAULT=\"\" \ -DRELAY_ROOM_DEFAULT=\"\" \
-D__LITTLE_ENDIAN \ -D__LITTLE_ENDIAN \

View file

@ -376,13 +376,8 @@ parseDict( AndDictionaryCtxt* ctxt, XP_U8 const* ptr, XP_U32 dictLength,
CHECK_PTR( ptr, sizeof(offset), end ); CHECK_PTR( ptr, sizeof(offset), end );
offset = n_ptr_tohl( &ptr ); offset = n_ptr_tohl( &ptr );
dictLength -= sizeof(offset); dictLength -= sizeof(offset);
#ifdef NODE_CAN_4
XP_ASSERT( dictLength % ctxt->super.nodeSize == 0 ); XP_ASSERT( dictLength % ctxt->super.nodeSize == 0 );
*numEdges = dictLength / ctxt->super.nodeSize; *numEdges = dictLength / ctxt->super.nodeSize;
#else
XP_ASSERT( dictLength % 3 == 0 );
*numEdges = dictLength / 3;
#endif
#ifdef DEBUG #ifdef DEBUG
ctxt->super.numEdges = *numEdges; ctxt->super.numEdges = *numEdges;
#endif #endif
@ -392,12 +387,8 @@ parseDict( AndDictionaryCtxt* ctxt, XP_U8 const* ptr, XP_U32 dictLength,
if ( dictLength > 0 ) { if ( dictLength > 0 ) {
ctxt->super.base = (array_edge*)ptr; ctxt->super.base = (array_edge*)ptr;
#ifdef NODE_CAN_4
ctxt->super.topEdge = ctxt->super.base ctxt->super.topEdge = ctxt->super.base
+ (offset * ctxt->super.nodeSize); + (offset * ctxt->super.nodeSize);
#else
ctxt->super.topEdge = ctxt->super.base + (offset * 3);
#endif
} else { } else {
ctxt->super.topEdge = (array_edge*)NULL; ctxt->super.topEdge = (array_edge*)NULL;
ctxt->super.base = (array_edge*)NULL; ctxt->super.base = (array_edge*)NULL;

View file

@ -66,9 +66,7 @@ typedef struct dawg_header {
unsigned char charTableRecNum; unsigned char charTableRecNum;
unsigned char valTableRecNum; unsigned char valTableRecNum;
unsigned char reserved[3]; /* worst case this points to a new resource */ unsigned char reserved[3]; /* worst case this points to a new resource */
#ifdef NODE_CAN_4
unsigned short flags; unsigned short flags;
#endif
} dawg_header; } dawg_header;
/* Part of xwords3 dictionaries on PalmOS */ /* Part of xwords3 dictionaries on PalmOS */

View file

@ -600,7 +600,6 @@ dict_super_edge_for_index( const DictionaryCtxt* dict, XP_U32 index )
result = NULL; result = NULL;
} else { } else {
XP_ASSERT( index < dict->numEdges ); XP_ASSERT( index < dict->numEdges );
#ifdef NODE_CAN_4
/* avoid long-multiplication lib call on Palm... */ /* avoid long-multiplication lib call on Palm... */
if ( dict->nodeSize == 3 ) { if ( dict->nodeSize == 3 ) {
index += (index << 1); index += (index << 1);
@ -608,9 +607,6 @@ dict_super_edge_for_index( const DictionaryCtxt* dict, XP_U32 index )
XP_ASSERT( dict->nodeSize == 4 ); XP_ASSERT( dict->nodeSize == 4 );
index <<= 2; index <<= 2;
} }
#else
index += (index << 1);
#endif
result = &dict->base[index]; result = &dict->base[index];
} }
return result; return result;
@ -627,7 +623,6 @@ dict_super_index_from( const DictionaryCtxt* dict, array_edge* p_edge )
{ {
unsigned long result; unsigned long result;
#ifdef NODE_CAN_4
array_edge_new* edge = (array_edge_new*)p_edge; array_edge_new* edge = (array_edge_new*)p_edge;
result = ((edge->highByte << 8) | edge->lowByte) & 0x0000FFFF; result = ((edge->highByte << 8) | edge->lowByte) & 0x0000FFFF;
@ -639,14 +634,6 @@ dict_super_index_from( const DictionaryCtxt* dict, array_edge* p_edge )
result |= 0x00010000; /* using | instead of + saves 4 bytes */ result |= 0x00010000; /* using | instead of + saves 4 bytes */
} }
} }
#else
array_edge_old* edge = (array_edge_old*)p_edge;
result = ((edge->highByte << 8) | edge->lowByte) & 0x0000FFFF;
if ( (edge->bits & EXTRABITMASK_OLD) != 0 ) {
result |= 0x00010000; /* using | instead of + saves 4 bytes */
}
#endif
return result; return result;
} /* dict_super_index_from */ } /* dict_super_index_from */
@ -673,11 +660,7 @@ dict_super_edge_with_tile( const DictionaryCtxt* dict, array_edge* from,
from = NULL; from = NULL;
break; break;
} }
#ifdef NODE_CAN_4
from += dict->nodeSize; from += dict->nodeSize;
#else
from += 3;
#endif
} }
return from; return from;

View file

@ -83,10 +83,8 @@ struct DictionaryCtxt {
XP_LangCode langCode; XP_LangCode langCode;
XP_U8 nFaces; XP_U8 nFaces;
#ifdef NODE_CAN_4
XP_U8 nodeSize; XP_U8 nodeSize;
XP_Bool is_4_byte; XP_Bool is_4_byte;
#endif
XP_S8 blankTile; /* negative means there's no known blank */ XP_S8 blankTile; /* negative means there's no known blank */
XP_Bool isUTF8; XP_Bool isUTF8;
@ -130,22 +128,13 @@ struct DictionaryCtxt {
#define dict_edge_with_tile(d,e,t) (*((d)->func_dict_edge_with_tile))(d,e,t) #define dict_edge_with_tile(d,e,t) (*((d)->func_dict_edge_with_tile))(d,e,t)
#define dict_getShortName(d) (*((d)->func_dict_getShortName))(d) #define dict_getShortName(d) (*((d)->func_dict_getShortName))(d)
#ifdef NODE_CAN_4 #define ISACCEPTING(d,e) \
# define ISACCEPTING(d,e) \
((ACCEPTINGMASK_NEW & ((array_edge_old*)(e))->bits) != 0) ((ACCEPTINGMASK_NEW & ((array_edge_old*)(e))->bits) != 0)
# define IS_LAST_EDGE(d,e) \ #define IS_LAST_EDGE(d,e) \
((LASTEDGEMASK_NEW & ((array_edge_old*)(e))->bits) != 0) ((LASTEDGEMASK_NEW & ((array_edge_old*)(e))->bits) != 0)
# define EDGETILE(d,edge) \ #define EDGETILE(d,edge) \
((Tile)(((array_edge_old*)(edge))->bits & \ ((Tile)(((array_edge_old*)(edge))->bits & \
((d)->is_4_byte?LETTERMASK_NEW_4:LETTERMASK_NEW_3))) ((d)->is_4_byte?LETTERMASK_NEW_4:LETTERMASK_NEW_3)))
#else
# define ISACCEPTING(d,e) \
((ACCEPTINGMASK_OLD & ((array_edge_old*)(e))->bits) != 0)
# define IS_LAST_EDGE(d,e) \
((LASTEDGEMASK_OLD & ((array_edge_old*)(e))->bits) != 0)
# define EDGETILE(d,edge) \
((Tile)(((array_edge_old*)(edge))->bits & LETTERMASK_OLD))
#endif
XP_Bool dict_tilesAreSame( const DictionaryCtxt* dict1, XP_Bool dict_tilesAreSame( const DictionaryCtxt* dict1,
const DictionaryCtxt* dict2 ); const DictionaryCtxt* dict2 );

View file

@ -716,11 +716,7 @@ figureCrosschecks( EngineCtxt* engine, XP_U16 x, XP_U16 y, XP_U16* scoreP,
if ( IS_LAST_EDGE(dict,candidateEdge ) ) { if ( IS_LAST_EDGE(dict,candidateEdge ) ) {
break; break;
} }
#ifdef NODE_CAN_4
candidateEdge += dict->nodeSize; candidateEdge += dict->nodeSize;
#else
candidateEdge += 3;
#endif
} }
} }
outer: outer:
@ -893,9 +889,7 @@ leftPart( EngineCtxt* engine, Tile* tiles, XP_U16 tileLength,
anchorCol, row ); anchorCol, row );
if ( !engine->returnNOW ) { if ( !engine->returnNOW ) {
if ( (limit > 0) && (edge != NULL) ) { if ( (limit > 0) && (edge != NULL) ) {
#ifdef NODE_CAN_4
XP_U16 nodeSize = engine->dict->nodeSize; XP_U16 nodeSize = engine->dict->nodeSize;
#endif
if ( engine->nTilesMax > 0 ) { if ( engine->nTilesMax > 0 ) {
for ( ; ; ) { for ( ; ; ) {
XP_Bool isBlank; XP_Bool isBlank;
@ -911,12 +905,7 @@ leftPart( EngineCtxt* engine, Tile* tiles, XP_U16 tileLength,
if ( IS_LAST_EDGE( dict, edge ) || engine->returnNOW ) { if ( IS_LAST_EDGE( dict, edge ) || engine->returnNOW ) {
break; break;
} }
#ifdef NODE_CAN_4
edge += nodeSize; edge += nodeSize;
#else
edge += 3;
#endif
} }
} }
} }
@ -980,11 +969,7 @@ extendRight( EngineCtxt* engine, Tile* tiles, XP_U16 tileLength,
if ( IS_LAST_EDGE( dict, edge ) ) { if ( IS_LAST_EDGE( dict, edge ) ) {
break; break;
} }
#ifdef NODE_CAN_4
edge += dict->nodeSize; edge += dict->nodeSize;
#else
edge += 3;
#endif
} }
} }

View file

@ -78,7 +78,7 @@ endif
include ../common/config.mk include ../common/config.mk
DEFINES += -DPLATFORM_LINUX -DKEY_SUPPORT -DKEYBOARD_NAV -DNODE_CAN_4 \ DEFINES += -DPLATFORM_LINUX -DKEY_SUPPORT -DKEYBOARD_NAV \
-DSCROLL_DRAG_THRESHHOLD=1 -DNUM_SAVED_ENGINE_MOVES=32 -DSCROLL_DRAG_THRESHHOLD=1 -DNUM_SAVED_ENGINE_MOVES=32
# DEFINES += -DSTUBBED_DICT # DEFINES += -DSTUBBED_DICT
ifdef DO_GTK ifdef DO_GTK

View file

@ -252,7 +252,6 @@ initFromDictFile( LinuxDictionaryCtxt* dctx, const char* fileName )
flags &= ~DICT_HEADER_MASK; flags &= ~DICT_HEADER_MASK;
XP_DEBUGF( "has header!" ); XP_DEBUGF( "has header!" );
} }
#ifdef NODE_CAN_4
if ( flags == 0x0001 ) { if ( flags == 0x0001 ) {
dctx->super.nodeSize = 3; dctx->super.nodeSize = 3;
charSize = 1; charSize = 1;
@ -281,10 +280,6 @@ initFromDictFile( LinuxDictionaryCtxt* dctx, const char* fileName )
XP_ASSERT(0); XP_ASSERT(0);
} }
#else
XP_ASSERT( flags == 0x0001 );
#endif
if ( formatOk ) { if ( formatOk ) {
XP_U8 numFaceBytes, numFaces; XP_U8 numFaceBytes, numFaces;
@ -351,17 +346,9 @@ initFromDictFile( LinuxDictionaryCtxt* dctx, const char* fileName )
} }
if ( dictLength > 0 ) { if ( dictLength > 0 ) {
# ifdef NODE_CAN_4
numEdges = dictLength / dctx->super.nodeSize; numEdges = dictLength / dctx->super.nodeSize;
# else
numEdges = dictLength / 3;
# endif
#ifdef DEBUG #ifdef DEBUG
# ifdef NODE_CAN_4
XP_ASSERT( (dictLength % dctx->super.nodeSize) == 0 ); XP_ASSERT( (dictLength % dctx->super.nodeSize) == 0 );
# else
XP_ASSERT( (dictLength % 3) == 0 );
# endif
dctx->super.numEdges = numEdges; dctx->super.numEdges = numEdges;
#endif #endif
dctx->super.base = (array_edge*)ptr; dctx->super.base = (array_edge*)ptr;