[dasher] Change to unsigned many ints storing probabilities / ranges 0-LP_NORMALIZATION
- From: Patrick Welche <pwelche src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dasher] Change to unsigned many ints storing probabilities / ranges 0-LP_NORMALIZATION
- Date: Mon, 17 May 2010 11:42:28 +0000 (UTC)
commit 549afe41cadffbc88754d4b4e87dd6f9ceb1ea0d
Author: Alan Lawrence <acl33 inf phy cam ac uk>
Date: Tue Apr 27 16:28:08 2010 +0100
Change to unsigned many ints storing probabilities / ranges 0-LP_NORMALIZATION
Also change AlphabetManager to use uint64 from DasherTypes.h, not #define again!
Src/DasherCore/AlphabetManager.cpp | 22 +++++++++-------------
Src/DasherCore/AlphabetManager.h | 12 ++++++------
Src/DasherCore/ControlManager.cpp | 8 ++++----
Src/DasherCore/ControlManager.h | 4 ++--
Src/DasherCore/ConversionHelper.cpp | 10 +++++-----
Src/DasherCore/ConversionHelper.h | 6 +++---
Src/DasherCore/ConversionManager.cpp | 10 +++++-----
Src/DasherCore/ConversionManager.h | 6 +++---
Src/DasherCore/DasherNode.cpp | 2 +-
Src/DasherCore/DasherNode.h | 22 +++++++++++-----------
Src/DasherCore/MandarinAlphMgr.cpp | 6 +++---
Src/DasherCore/MandarinAlphMgr.h | 6 +++---
Src/DasherCore/NodeCreationManager.cpp | 6 +++---
Src/DasherCore/NodeCreationManager.h | 6 +++---
Src/DasherCore/PinYinConversionHelper.cpp | 4 ++--
Src/DasherCore/PinYinConversionHelper.h | 4 ++--
16 files changed, 65 insertions(+), 69 deletions(-)
---
diff --git a/Src/DasherCore/AlphabetManager.cpp b/Src/DasherCore/AlphabetManager.cpp
index c82c2c4..ed52a2f 100644
--- a/Src/DasherCore/AlphabetManager.cpp
+++ b/Src/DasherCore/AlphabetManager.cpp
@@ -53,27 +53,27 @@ CAlphabetManager::CAlphabetManager(CDasherInterfaceBase *pInterface, CNodeCreati
}
-CAlphabetManager::CAlphNode::CAlphNode(CDasherNode *pParent, int iLbnd, int iHbnd, CDasherNode::SDisplayInfo *pDisplayInfo, CAlphabetManager *pMgr)
+CAlphabetManager::CAlphNode::CAlphNode(CDasherNode *pParent, unsigned int iLbnd, unsigned int iHbnd, CDasherNode::SDisplayInfo *pDisplayInfo, CAlphabetManager *pMgr)
: CDasherNode(pParent, iLbnd, iHbnd, pDisplayInfo), m_pMgr(pMgr), m_pProbInfo(NULL) {
};
-CAlphabetManager::CSymbolNode::CSymbolNode(CDasherNode *pParent, int iLbnd, int iHbnd, CDasherNode::SDisplayInfo *pDisplayInfo, CAlphabetManager *pMgr, symbol _iSymbol)
+CAlphabetManager::CSymbolNode::CSymbolNode(CDasherNode *pParent, unsigned int iLbnd, unsigned int iHbnd, CDasherNode::SDisplayInfo *pDisplayInfo, CAlphabetManager *pMgr, symbol _iSymbol)
: CAlphNode(pParent, iLbnd, iHbnd, pDisplayInfo, pMgr), iSymbol(_iSymbol) {
};
-CAlphabetManager::CGroupNode::CGroupNode(CDasherNode *pParent, int iLbnd, int iHbnd, CDasherNode::SDisplayInfo *pDisplayInfo, CAlphabetManager *pMgr, SGroupInfo *pGroup)
+CAlphabetManager::CGroupNode::CGroupNode(CDasherNode *pParent, unsigned int iLbnd, unsigned int iHbnd, CDasherNode::SDisplayInfo *pDisplayInfo, CAlphabetManager *pMgr, SGroupInfo *pGroup)
: CAlphNode(pParent, iLbnd, iHbnd, pDisplayInfo, pMgr), m_pGroup(pGroup) {
};
-CAlphabetManager::CSymbolNode *CAlphabetManager::makeSymbol(CDasherNode *pParent, int iLbnd, int iHbnd, CDasherNode::SDisplayInfo *pDisplayInfo, symbol iSymbol) {
+CAlphabetManager::CSymbolNode *CAlphabetManager::makeSymbol(CDasherNode *pParent, unsigned int iLbnd, unsigned int iHbnd, CDasherNode::SDisplayInfo *pDisplayInfo, symbol iSymbol) {
return new CSymbolNode(pParent, iLbnd, iHbnd, pDisplayInfo, this, iSymbol);
}
-CAlphabetManager::CGroupNode *CAlphabetManager::makeGroup(CDasherNode *pParent, int iLbnd, int iHbnd, CDasherNode::SDisplayInfo *pDisplayInfo, SGroupInfo *pGroup) {
+CAlphabetManager::CGroupNode *CAlphabetManager::makeGroup(CDasherNode *pParent, unsigned int iLbnd, unsigned int iHbnd, CDasherNode::SDisplayInfo *pDisplayInfo, SGroupInfo *pGroup) {
return new CGroupNode(pParent, iLbnd, iHbnd, pDisplayInfo, this, pGroup);
}
-CAlphabetManager::CAlphNode *CAlphabetManager::GetRoot(CDasherNode *pParent, int iLower, int iUpper, bool bEnteredLast, int iOffset) {
+CAlphabetManager::CAlphNode *CAlphabetManager::GetRoot(CDasherNode *pParent, unsigned int iLower, unsigned int iUpper, bool bEnteredLast, int iOffset) {
int iNewOffset(max(-1,iOffset-1));
@@ -366,16 +366,12 @@ void CAlphabetManager::IterateChildGroups(CAlphNode *pParent, SGroupInfo *pParen
bool bSymbol = !pCurrentNode //gone past last subgroup
|| i < pCurrentNode->iStart; //not reached next subgroup
const int iStart=i, iEnd = (bSymbol) ? i+1 : pCurrentNode->iEnd;
-#ifdef WIN32
- typedef unsigned __int64 temptype;
-#else
- typedef unsigned long long int temptype;
-#endif
+ //uint64 is platform-dependently #defined in DasherTypes.h as an (unsigned) 64-bit int ("__int64" or "long long int")
unsigned int iLbnd = (((*pCProb)[iStart-1] - (*pCProb)[iMin-1]) *
- (temptype)(m_pNCManager->GetLongParameter(LP_NORMALIZATION))) /
+ (uint64)(m_pNCManager->GetLongParameter(LP_NORMALIZATION))) /
((*pCProb)[iMax-1] - (*pCProb)[iMin-1]);
unsigned int iHbnd = (((*pCProb)[iEnd-1] - (*pCProb)[iMin-1]) *
- (temptype)(m_pNCManager->GetLongParameter(LP_NORMALIZATION))) /
+ (uint64)(m_pNCManager->GetLongParameter(LP_NORMALIZATION))) /
((*pCProb)[iMax-1] - (*pCProb)[iMin-1]);
if (bSymbol) {
diff --git a/Src/DasherCore/AlphabetManager.h b/Src/DasherCore/AlphabetManager.h
index 94ca091..14afdd1 100644
--- a/Src/DasherCore/AlphabetManager.h
+++ b/Src/DasherCore/AlphabetManager.h
@@ -50,7 +50,7 @@ namespace Dasher {
class CAlphNode : public CDasherNode {
public:
int mgrId() {return 0;}
- CAlphNode(CDasherNode *pParent, int iLbnd, int iHbnd, CDasherNode::SDisplayInfo *pDispInfo, CAlphabetManager *pMgr);
+ CAlphNode(CDasherNode *pParent, unsigned int iLbnd, unsigned int iHbnd, CDasherNode::SDisplayInfo *pDispInfo, CAlphabetManager *pMgr);
CLanguageModel::Context iContext;
///
/// Delete any storage alocated for this node
@@ -69,7 +69,7 @@ namespace Dasher {
};
class CSymbolNode : public CAlphNode {
public:
- CSymbolNode(CDasherNode *pParent, int iLbnd, int iHbnd, CDasherNode::SDisplayInfo *pDispInfo, CAlphabetManager *pMgr, symbol iSymbol);
+ CSymbolNode(CDasherNode *pParent, unsigned int iLbnd, unsigned int iHbnd, CDasherNode::SDisplayInfo *pDispInfo, CAlphabetManager *pMgr, symbol iSymbol);
///
/// Provide children for the supplied node
@@ -92,7 +92,7 @@ namespace Dasher {
class CGroupNode : public CAlphNode {
public:
- CGroupNode(CDasherNode *pParent, int iLbnd, int iHbnd, CDasherNode::SDisplayInfo *pDispInfo, CAlphabetManager *pMgr, SGroupInfo *pGroup);
+ CGroupNode(CDasherNode *pParent, unsigned int iLbnd, unsigned int iHbnd, CDasherNode::SDisplayInfo *pDispInfo, CAlphabetManager *pMgr, SGroupInfo *pGroup);
///
/// Provide children for the supplied node
@@ -114,14 +114,14 @@ namespace Dasher {
/// bEnteredLast - true if this "root" node should be considered as entering the preceding symbol
/// Offset is the index of the character which _child_ nodes (i.e. between which this root allows selection)
/// will enter. (Also used to build context for preceding characters.)
- virtual CAlphNode *GetRoot(CDasherNode *pParent, int iLower, int iUpper, bool bEnteredLast, int iOffset);
+ virtual CAlphNode *GetRoot(CDasherNode *pParent, unsigned int iLower, unsigned int iUpper, bool bEnteredLast, int iOffset);
protected:
///
/// Factory method for CAlphNode construction, so subclasses can override.
///
- virtual CSymbolNode *makeSymbol(CDasherNode *pParent, int iLbnd, int iHbnd, CDasherNode::SDisplayInfo *pDispInfo, symbol iSymbol);
- virtual CGroupNode *makeGroup(CDasherNode *pParent, int iLbnd, int iHbnd, CDasherNode::SDisplayInfo *pDispInfo, SGroupInfo *pGroup);
+ virtual CSymbolNode *makeSymbol(CDasherNode *pParent, unsigned int iLbnd, unsigned int iHbnd, CDasherNode::SDisplayInfo *pDispInfo, symbol iSymbol);
+ virtual CGroupNode *makeGroup(CDasherNode *pParent, unsigned int iLbnd, unsigned int iHbnd, CDasherNode::SDisplayInfo *pDispInfo, SGroupInfo *pGroup);
virtual CDasherNode *CreateSymbolNode(CAlphNode *pParent, symbol iSymbol, unsigned int iLbnd, unsigned int iHbnd);
virtual CLanguageModel::Context CreateSymbolContext(CAlphNode *pParent, symbol iSymbol);
diff --git a/Src/DasherCore/ControlManager.cpp b/Src/DasherCore/ControlManager.cpp
index fe7435a..0517681 100644
--- a/Src/DasherCore/ControlManager.cpp
+++ b/Src/DasherCore/ControlManager.cpp
@@ -267,7 +267,7 @@ void CControlManager::DisconnectNode(int iChild, int iParent) {
}
-CDasherNode *CControlManager::GetRoot(CDasherNode *pParent, int iLower, int iUpper, int iOffset) {
+CDasherNode *CControlManager::GetRoot(CDasherNode *pParent, unsigned int iLower, unsigned int iUpper, int iOffset) {
// TODO: Tie this structure to info contained in control map
CDasherNode::SDisplayInfo *pDisplayInfo = new CDasherNode::SDisplayInfo;
@@ -288,7 +288,7 @@ CDasherNode *CControlManager::GetRoot(CDasherNode *pParent, int iLower, int iUpp
return pNewNode;
}
-CControlManager::CContNode::CContNode(CDasherNode *pParent, int iLbnd, int iHbnd, CDasherNode::SDisplayInfo *pDisplayInfo, CControlManager *pMgr)
+CControlManager::CContNode::CContNode(CDasherNode *pParent, unsigned int iLbnd, unsigned int iHbnd, CDasherNode::SDisplayInfo *pDisplayInfo, CControlManager *pMgr)
: CDasherNode(pParent, iLbnd, iHbnd, pDisplayInfo), m_pMgr(pMgr) {
}
@@ -305,8 +305,8 @@ void CControlManager::CContNode::PopulateChildren() {
// FIXME - could do this better
- int iLbnd( iIdx*(m_pMgr->m_pNCManager->GetLongParameter(LP_NORMALIZATION)/iNChildren));
- int iHbnd( (iIdx+1)*(m_pMgr->m_pNCManager->GetLongParameter(LP_NORMALIZATION)/iNChildren));
+ unsigned int iLbnd( iIdx*(m_pMgr->m_pNCManager->GetLongParameter(LP_NORMALIZATION)/iNChildren));
+ unsigned int iHbnd( (iIdx+1)*(m_pMgr->m_pNCManager->GetLongParameter(LP_NORMALIZATION)/iNChildren));
if( *it == NULL ) {
// Escape back to alphabet
diff --git a/Src/DasherCore/ControlManager.h b/Src/DasherCore/ControlManager.h
index 7136485..e923f6f 100644
--- a/Src/DasherCore/ControlManager.h
+++ b/Src/DasherCore/ControlManager.h
@@ -72,7 +72,7 @@ namespace Dasher {
/// Get a new root node owned by this manager
///
- virtual CDasherNode *GetRoot(CDasherNode *pParent, int iLower, int iUpper, int iOffset);
+ virtual CDasherNode *GetRoot(CDasherNode *pParent, unsigned int iLower, unsigned int iUpper, int iOffset);
void RegisterNode( int iID, std::string strLabel, int iColour );
void ConnectNode(int iChild, int iParent, int iAfter);
void DisconnectNode(int iChild, int iParent);
@@ -89,7 +89,7 @@ namespace Dasher {
class CContNode : public CDasherNode {
public:
int mgrId() {return 1;}
- CContNode(CDasherNode *pParent, int iLbnd, int iHbnd, CDasherNode::SDisplayInfo *pDisplayInfo, CControlManager *pMgr);
+ CContNode(CDasherNode *pParent, unsigned int iLbnd, unsigned int iHbnd, CDasherNode::SDisplayInfo *pDisplayInfo, CControlManager *pMgr);
///
/// Provide children for the supplied node
///
diff --git a/Src/DasherCore/ConversionHelper.cpp b/Src/DasherCore/ConversionHelper.cpp
index e09af69..c201449 100644
--- a/Src/DasherCore/ConversionHelper.cpp
+++ b/Src/DasherCore/ConversionHelper.cpp
@@ -52,7 +52,7 @@ CConversionHelper::CConversionHelper(CNodeCreationManager *pNCManager, CAlphabet
}
-CConversionManager::CConvNode *CConversionHelper::GetRoot(CDasherNode *pParent, int iLower, int iUpper, int iOffset) {
+CConversionManager::CConvNode *CConversionHelper::GetRoot(CDasherNode *pParent, unsigned int iLower, unsigned int iUpper, int iOffset) {
CConvNode *pConvNode = CConversionManager::GetRoot(pParent, iLower, iUpper, iOffset);
//note that pConvNode is actually a CConvHNode, created by this CConversionHelper:
// the overridden CConversionManager::GetRoot creates the node the node it returns
@@ -109,8 +109,8 @@ void CConversionHelper::CConvHNode::PopulateChildren() {
// std::cout << "Current scec: " << pCurrentSCEChild << std::endl;
SCENode *pCurrentSCEChild(*it);
DASHER_ASSERT(pCurrentSCEChild != NULL);
- int iLbnd(iCum);
- int iHbnd(iCum + pCurrentSCEChild->NodeSize);
+ unsigned int iLbnd(iCum);
+ unsigned int iHbnd(iCum + pCurrentSCEChild->NodeSize);
//m_pNCManager->GetLongParameter(LP_NORMALIZATION));//
iCum = iHbnd;
@@ -198,12 +198,12 @@ void CConversionHelper::BuildTree(CConvHNode *pRoot) {
pRoot->pSCENode = pStartTemp;
}
-CConversionHelper::CConvHNode::CConvHNode(CDasherNode *pParent, int iLbnd, int iHbnd, CDasherNode::SDisplayInfo *pDispInfo, CConversionHelper *pMgr)
+CConversionHelper::CConvHNode::CConvHNode(CDasherNode *pParent, unsigned int iLbnd, unsigned int iHbnd, CDasherNode::SDisplayInfo *pDispInfo, CConversionHelper *pMgr)
: CConvNode(pParent, iLbnd, iHbnd, pDispInfo, pMgr) {
}
-CConversionHelper::CConvHNode *CConversionHelper::makeNode(CDasherNode *pParent, int iLbnd, int iHbnd, CDasherNode::SDisplayInfo *pDispInfo) {
+CConversionHelper::CConvHNode *CConversionHelper::makeNode(CDasherNode *pParent, unsigned int iLbnd, unsigned int iHbnd, CDasherNode::SDisplayInfo *pDispInfo) {
return new CConvHNode(pParent, iLbnd, iHbnd, pDispInfo, this);
}
diff --git a/Src/DasherCore/ConversionHelper.h b/Src/DasherCore/ConversionHelper.h
index 04f6c7e..ec7efc5 100644
--- a/Src/DasherCore/ConversionHelper.h
+++ b/Src/DasherCore/ConversionHelper.h
@@ -97,7 +97,7 @@ namespace Dasher{
/// Get a new root node owned by this manager
///
- virtual CConvNode *GetRoot(CDasherNode *pParent, int iLower, int iUpper, int iOffset);
+ virtual CConvNode *GetRoot(CDasherNode *pParent, unsigned int iLower, unsigned int iUpper, int iOffset);
///
/// Calculate sizes for each of the children - default
@@ -113,7 +113,7 @@ namespace Dasher{
protected:
class CConvHNode : public CConvNode {
public:
- CConvHNode(CDasherNode *pParent, int iLbnd, int iHbnd, CDasherNode::SDisplayInfo *pDispInfo, CConversionHelper *pMgr);
+ CConvHNode(CDasherNode *pParent, unsigned int iLbnd, unsigned int iHbnd, CDasherNode::SDisplayInfo *pDispInfo, CConversionHelper *pMgr);
///
/// Provide children for the supplied node
///
@@ -123,7 +123,7 @@ namespace Dasher{
protected:
inline CConversionHelper *mgr() {return static_cast<CConversionHelper *>(m_pMgr);}
};
- virtual CConvHNode *makeNode(CDasherNode *pParent, int iLbnd, int iHbnd, CDasherNode::SDisplayInfo *pDispInfo);
+ virtual CConvHNode *makeNode(CDasherNode *pParent, unsigned int iLbnd, unsigned int iHbnd, CDasherNode::SDisplayInfo *pDispInfo);
///
/// Build the conversion tree (lattice) for the given string -
/// evaluated late to prevent unnecessary conversions when the
diff --git a/Src/DasherCore/ConversionManager.cpp b/Src/DasherCore/ConversionManager.cpp
index b6564df..39413a3 100644
--- a/Src/DasherCore/ConversionManager.cpp
+++ b/Src/DasherCore/ConversionManager.cpp
@@ -55,11 +55,11 @@ CConversionManager::CConversionManager(CNodeCreationManager *pNCManager, CAlphab
*/
}
-CConversionManager::CConvNode *CConversionManager::makeNode(CDasherNode *pParent, int iLbnd, int iHbnd, CDasherNode::SDisplayInfo *pDispInfo) {
+CConversionManager::CConvNode *CConversionManager::makeNode(CDasherNode *pParent, unsigned int iLbnd, unsigned int iHbnd, CDasherNode::SDisplayInfo *pDispInfo) {
return new CConvNode(pParent, iLbnd, iHbnd, pDispInfo, this);
}
-CConversionManager::CConvNode *CConversionManager::GetRoot(CDasherNode *pParent, int iLower, int iUpper, int iOffset) {
+CConversionManager::CConvNode *CConversionManager::GetRoot(CDasherNode *pParent, unsigned int iLower, unsigned int iUpper, int iOffset) {
// TODO: Parameters here are placeholders - need to figure out what's right
@@ -87,7 +87,7 @@ CConversionManager::CConvNode *CConversionManager::GetRoot(CDasherNode *pParent,
return pNewNode;
}
-CConversionManager::CConvNode::CConvNode(CDasherNode *pParent, int iLbnd, int iHbnd, CDasherNode::SDisplayInfo *pDispInfo, CConversionManager *pMgr)
+CConversionManager::CConvNode::CConvNode(CDasherNode *pParent, unsigned int iLbnd, unsigned int iHbnd, CDasherNode::SDisplayInfo *pDispInfo, CConversionManager *pMgr)
: CDasherNode(pParent, iLbnd, iHbnd, pDispInfo), m_pMgr(pMgr) {
pMgr->m_iRefCount++;
}
@@ -99,8 +99,8 @@ void CConversionManager::CConvNode::PopulateChildren() {
// alphabet root. This should only happen in error cases, and the
// user should have been warned here.
//
- int iLbnd(0);
- int iHbnd(m_pMgr->m_pNCManager->GetLongParameter(LP_NORMALIZATION));
+ unsigned int iLbnd(0);
+ unsigned int iHbnd(m_pMgr->m_pNCManager->GetLongParameter(LP_NORMALIZATION));
CDasherNode *pNewNode = m_pMgr->m_pNCManager->GetAlphRoot(this, iLbnd, iHbnd, false, m_iOffset + 1);
diff --git a/Src/DasherCore/ConversionManager.h b/Src/DasherCore/ConversionManager.h
index a820dd7..3cfa1ed 100644
--- a/Src/DasherCore/ConversionManager.h
+++ b/Src/DasherCore/ConversionManager.h
@@ -81,7 +81,7 @@ namespace Dasher {
class CConvNode : public CDasherNode {
public:
int mgrId() {return 2;}
- CConvNode(CDasherNode *pParent, int iLbnd, int iHbnd, CDasherNode::SDisplayInfo *pDispInfo, CConversionManager *pMgr);
+ CConvNode(CDasherNode *pParent, unsigned int iLbnd, unsigned int iHbnd, CDasherNode::SDisplayInfo *pDispInfo, CConversionManager *pMgr);
///
/// Provide children for the supplied node
///
@@ -126,10 +126,10 @@ namespace Dasher {
/// Get a new root node owned by this manager
///
- virtual CConvNode *GetRoot(CDasherNode *pParent, int iLower, int iUpper, int iOffset);
+ virtual CConvNode *GetRoot(CDasherNode *pParent, unsigned int iLower, unsigned int iUpper, int iOffset);
protected:
- virtual CConvNode *makeNode(CDasherNode *pParent, int iLbnd, int iHbnd, CDasherNode::SDisplayInfo *pDispInfo);
+ virtual CConvNode *makeNode(CDasherNode *pParent, unsigned int iLbnd, unsigned int iHbnd, CDasherNode::SDisplayInfo *pDispInfo);
CNodeCreationManager *m_pNCManager;
diff --git a/Src/DasherCore/DasherNode.cpp b/Src/DasherCore/DasherNode.cpp
index f5301a9..88c66d4 100644
--- a/Src/DasherCore/DasherNode.cpp
+++ b/Src/DasherCore/DasherNode.cpp
@@ -42,7 +42,7 @@ static int iNumNodes = 0;
int Dasher::currentNumNodeObjects() {return iNumNodes;}
//TODO this used to be inline - should we make it so again?
-CDasherNode::CDasherNode(CDasherNode *pParent, int iLbnd, int iHbnd, SDisplayInfo *pDisplayInfo) {
+CDasherNode::CDasherNode(CDasherNode *pParent, unsigned int iLbnd, unsigned int iHbnd, SDisplayInfo *pDisplayInfo) {
// TODO: Check that these are disabled for debug builds, and that we're not shipping such a build
DASHER_ASSERT(iHbnd >= iLbnd);
DASHER_ASSERT(pDisplayInfo != NULL);
diff --git a/Src/DasherCore/DasherNode.h b/Src/DasherCore/DasherNode.h
index 4b0b06a..f15beb0 100644
--- a/Src/DasherCore/DasherNode.h
+++ b/Src/DasherCore/DasherNode.h
@@ -79,7 +79,7 @@ class Dasher::CDasherNode:private NoClones {
/// @param iHbnd Upper bound of node within parent
/// @param pDisplayInfo Struct containing information on how to display the node
///
- CDasherNode(CDasherNode *pParent, int iLbnd, int iHbnd, SDisplayInfo *pDisplayInfo);
+ CDasherNode(CDasherNode *pParent, unsigned int iLbnd, unsigned int iHbnd, SDisplayInfo *pDisplayInfo);
/// @brief Destructor
///
@@ -137,13 +137,13 @@ class Dasher::CDasherNode:private NoClones {
///
/// @return The lower bound
///
- inline int Lbnd() const;
+ inline unsigned int Lbnd() const;
/// @brief Get the upper bound of a node
///
/// @return The upper bound
///
- inline int Hbnd() const;
+ inline unsigned int Hbnd() const;
/// @brief Get the range of a node (upper - lower bound)
///
@@ -151,14 +151,14 @@ class Dasher::CDasherNode:private NoClones {
///
/// @todo Should this be here (trivial arithmethic of existing methods)
///
- inline int Range() const;
+ inline unsigned int Range() const;
/// @brief Reset the range of a node
///
/// @param iLower New lower bound
/// @param iUpper New upper bound
///
- inline void SetRange(int iLower, int iUpper);
+ inline void SetRange(unsigned int iLower, unsigned int iUpper);
/// @brief Get the probability of a node
///
@@ -279,8 +279,8 @@ class Dasher::CDasherNode:private NoClones {
SDisplayInfo *m_pDisplayInfo;
- int m_iLbnd;
- int m_iHbnd; // the cumulative lower and upper bound prob relative to parent
+ unsigned int m_iLbnd;
+ unsigned int m_iHbnd; // the cumulative lower and upper bound prob relative to parent
int m_iRefCount; // reference count if ancestor of (or equal to) root node
@@ -308,15 +308,15 @@ inline const CDasherNode::SDisplayInfo *CDasherNode::GetDisplayInfo() const {
return m_pDisplayInfo;
}
-inline int CDasherNode::Lbnd() const {
+inline unsigned int CDasherNode::Lbnd() const {
return m_iLbnd;
}
-inline int CDasherNode::Hbnd() const {
+inline unsigned int CDasherNode::Hbnd() const {
return m_iHbnd;
}
-inline int CDasherNode::Range() const {
+inline unsigned int CDasherNode::Range() const {
return m_iHbnd - m_iLbnd;
}
@@ -340,7 +340,7 @@ inline CDasherNode *CDasherNode::Parent() const {
return m_pParent;
}
-inline void CDasherNode::SetRange(int iLower, int iUpper) {
+inline void CDasherNode::SetRange(unsigned int iLower, unsigned int iUpper) {
m_iLbnd = iLower;
m_iHbnd = iUpper;
}
diff --git a/Src/DasherCore/MandarinAlphMgr.cpp b/Src/DasherCore/MandarinAlphMgr.cpp
index 5cb5eb4..5d1e462 100644
--- a/Src/DasherCore/MandarinAlphMgr.cpp
+++ b/Src/DasherCore/MandarinAlphMgr.cpp
@@ -50,7 +50,7 @@ CMandarinAlphMgr::CMandarinAlphMgr(CDasherInterfaceBase *pInterface, CNodeCreati
: CAlphabetManager(pInterface, pNCManager, pLanguageModel) {
}
-CAlphabetManager::CAlphNode *CMandarinAlphMgr::GetRoot(CDasherNode *pParent, int iLower, int iUpper, bool bEnteredLast, int iOffset) {
+CAlphabetManager::CAlphNode *CMandarinAlphMgr::GetRoot(CDasherNode *pParent, unsigned int iLower, unsigned int iUpper, bool bEnteredLast, int iOffset) {
CAlphNode *pNewNode;
if (!bEnteredLast) {
//(probably) escaping back to alphabet after conversion. At any rate, we'll duplicate a lot of
@@ -102,11 +102,11 @@ CLanguageModel::Context CMandarinAlphMgr::CreateSymbolContext(CAlphNode *pParent
return m_pLanguageModel->CloneContext(pParent->iContext);
}
-CMandarinAlphMgr::CMandNode::CMandNode(CDasherNode *pParent, int iLbnd, int iHbnd, CDasherNode::SDisplayInfo *pDispInfo, CAlphabetManager *pMgr, symbol iSymbol)
+CMandarinAlphMgr::CMandNode::CMandNode(CDasherNode *pParent, unsigned int iLbnd, unsigned int iHbnd, CDasherNode::SDisplayInfo *pDispInfo, CAlphabetManager *pMgr, symbol iSymbol)
: CSymbolNode(pParent, iLbnd, iHbnd, pDispInfo, pMgr, iSymbol) {
}
-CAlphabetManager::CSymbolNode *CMandarinAlphMgr::makeSymbol(CDasherNode *pParent, int iLbnd, int iHbnd, CDasherNode::SDisplayInfo *pDispInfo, symbol iSymbol) {
+CAlphabetManager::CSymbolNode *CMandarinAlphMgr::makeSymbol(CDasherNode *pParent, unsigned int iLbnd, unsigned int iHbnd, CDasherNode::SDisplayInfo *pDispInfo, symbol iSymbol) {
return new CMandNode(pParent, iLbnd, iHbnd, pDispInfo, this, iSymbol);
}
diff --git a/Src/DasherCore/MandarinAlphMgr.h b/Src/DasherCore/MandarinAlphMgr.h
index 906b02d..8af8d53 100644
--- a/Src/DasherCore/MandarinAlphMgr.h
+++ b/Src/DasherCore/MandarinAlphMgr.h
@@ -41,15 +41,15 @@ namespace Dasher {
/// Get a new root node owned by this manager
///
- virtual CAlphNode *GetRoot(CDasherNode *pParent, int iLower, int iUpper, bool bEnteredLast, int iOffset);
+ virtual CAlphNode *GetRoot(CDasherNode *pParent, unsigned int iLower, unsigned int iUpper, bool bEnteredLast, int iOffset);
protected:
class CMandNode : public CSymbolNode {
public:
- CMandNode(CDasherNode *pParent, int iLbnd, int iHbnd, CDasherNode::SDisplayInfo *pDispInfo, CAlphabetManager *pMgr, symbol iSymbol);
+ CMandNode(CDasherNode *pParent, unsigned int iLbnd, unsigned int iHbnd, CDasherNode::SDisplayInfo *pDispInfo, CAlphabetManager *pMgr, symbol iSymbol);
virtual void SetFlag(int iFlag, bool bValue);
};
- CSymbolNode *makeSymbol(CDasherNode *pParent, int iLbnd, int iHbnd, CDasherNode::SDisplayInfo *pDispInfo, symbol iSymbol);
+ CSymbolNode *makeSymbol(CDasherNode *pParent, unsigned int iLbnd, unsigned int iHbnd, CDasherNode::SDisplayInfo *pDispInfo, symbol iSymbol);
virtual CDasherNode *CreateSymbolNode(CAlphNode *pParent, symbol iSymbol, unsigned int iLbnd, unsigned int iHbnd);
virtual CLanguageModel::Context CreateSymbolContext(CAlphNode *pParent, symbol iSymbol);
};
diff --git a/Src/DasherCore/NodeCreationManager.cpp b/Src/DasherCore/NodeCreationManager.cpp
index 0bdc3e0..8854355 100644
--- a/Src/DasherCore/NodeCreationManager.cpp
+++ b/Src/DasherCore/NodeCreationManager.cpp
@@ -179,18 +179,18 @@ void CNodeCreationManager::DisconnectNode(int iChild, int iParent) {
m_pControlManager->DisconnectNode(iChild, iParent);
}
-CDasherNode *CNodeCreationManager::GetAlphRoot(Dasher::CDasherNode *pParent, int iLower, int iUpper, bool bEnteredLast, int iOffset) {
+CDasherNode *CNodeCreationManager::GetAlphRoot(Dasher::CDasherNode *pParent, unsigned int iLower, unsigned int iUpper, bool bEnteredLast, int iOffset) {
return m_pAlphabetManager->GetRoot(pParent, iLower, iUpper, bEnteredLast, iOffset);
}
-CDasherNode *CNodeCreationManager::GetCtrlRoot(Dasher::CDasherNode *pParent, int iLower, int iUpper, int iOffset) {
+CDasherNode *CNodeCreationManager::GetCtrlRoot(Dasher::CDasherNode *pParent, unsigned int iLower, unsigned int iUpper, int iOffset) {
if(m_pControlManager)
return m_pControlManager->GetRoot(pParent, iLower, iUpper, iOffset);
else
return NULL;
}
-CDasherNode *CNodeCreationManager::GetConvRoot(Dasher::CDasherNode *pParent, int iLower, int iUpper, int iOffset) {
+CDasherNode *CNodeCreationManager::GetConvRoot(Dasher::CDasherNode *pParent, unsigned int iLower, unsigned int iUpper, int iOffset) {
if(m_pConversionManager)
return m_pConversionManager->GetRoot(pParent, iLower, iUpper, iOffset);
return NULL;
diff --git a/Src/DasherCore/NodeCreationManager.h b/Src/DasherCore/NodeCreationManager.h
index 8bfd194..ce33a86 100644
--- a/Src/DasherCore/NodeCreationManager.h
+++ b/Src/DasherCore/NodeCreationManager.h
@@ -32,9 +32,9 @@ class CNodeCreationManager : public Dasher::CDasherComponent {
/// Get a root node of a particular type
///
- Dasher::CDasherNode *GetAlphRoot(Dasher::CDasherNode *pParent, int iLower, int iUpper, bool bEnteredLast, int iOffset);
- Dasher::CDasherNode *GetCtrlRoot(Dasher::CDasherNode *pParent, int iLower, int iUpper, int iOffset);
- Dasher::CDasherNode *GetConvRoot(Dasher::CDasherNode *pParent, int iLower, int iUpper, int iOffset);
+ Dasher::CDasherNode *GetAlphRoot(Dasher::CDasherNode *pParent, unsigned int iLower, unsigned int iUpper, bool bEnteredLast, int iOffset);
+ Dasher::CDasherNode *GetCtrlRoot(Dasher::CDasherNode *pParent, unsigned int iLower, unsigned int iUpper, int iOffset);
+ Dasher::CDasherNode *GetConvRoot(Dasher::CDasherNode *pParent, unsigned int iLower, unsigned int iUpper, int iOffset);
///
/// Register a control node
diff --git a/Src/DasherCore/PinYinConversionHelper.cpp b/Src/DasherCore/PinYinConversionHelper.cpp
index f0ce267..fc44fe7 100644
--- a/Src/DasherCore/PinYinConversionHelper.cpp
+++ b/Src/DasherCore/PinYinConversionHelper.cpp
@@ -233,11 +233,11 @@ void CPinYinConversionHelper::AssignSizes(const std::vector<SCENode *> &vChildre
// std::cout<<"Not equal! sum is "<<sumSize<<std::endl;
// }
-CPinYinConversionHelper::CPYConvNode *CPinYinConversionHelper::makeNode(CDasherNode *pParent, int iLbnd, int iHbnd, CDasherNode::SDisplayInfo *pDispInfo) {
+CPinYinConversionHelper::CPYConvNode *CPinYinConversionHelper::makeNode(CDasherNode *pParent, unsigned int iLbnd, unsigned int iHbnd, CDasherNode::SDisplayInfo *pDispInfo) {
return new CPYConvNode(pParent, iLbnd, iHbnd, pDispInfo, this);
}
-CPinYinConversionHelper::CPYConvNode::CPYConvNode(CDasherNode *pParent, int iLbnd, int iHbnd, CDasherNode::SDisplayInfo *pDispInfo, CPinYinConversionHelper *pMgr)
+CPinYinConversionHelper::CPYConvNode::CPYConvNode(CDasherNode *pParent, unsigned int iLbnd, unsigned int iHbnd, CDasherNode::SDisplayInfo *pDispInfo, CPinYinConversionHelper *pMgr)
: CConvHNode(pParent, iLbnd, iHbnd, pDispInfo, pMgr) {
};
diff --git a/Src/DasherCore/PinYinConversionHelper.h b/Src/DasherCore/PinYinConversionHelper.h
index 4a48e0c..0041d83 100644
--- a/Src/DasherCore/PinYinConversionHelper.h
+++ b/Src/DasherCore/PinYinConversionHelper.h
@@ -34,7 +34,7 @@ class CPinYinConversionHelper : public CConversionHelper {
protected:
class CPYConvNode : public CConvHNode {
public:
- CPYConvNode(CDasherNode *pParent, int iLbnd, int iHbnd, CDasherNode::SDisplayInfo *pDispInfo, CPinYinConversionHelper *pMgr);
+ CPYConvNode(CDasherNode *pParent, unsigned int iLbnd, unsigned int iHbnd, CDasherNode::SDisplayInfo *pDispInfo, CPinYinConversionHelper *pMgr);
//override to blank out learn-as-write for Mandarin Dasher
virtual void SetFlag(int iFlag, bool bValue);
@@ -46,7 +46,7 @@ protected:
protected:
inline CPinYinConversionHelper *mgr() {return static_cast<CPinYinConversionHelper *>(m_pMgr);}
};
- CPYConvNode *makeNode(CDasherNode *pParent, int iLbnd, int iHbnd, CDasherNode::SDisplayInfo *pDispInfo);
+ CPYConvNode *makeNode(CDasherNode *pParent, unsigned int iLbnd, unsigned int iHbnd, CDasherNode::SDisplayInfo *pDispInfo);
virtual CPPMPYLanguageModel *GetLanguageModel() {
return static_cast<CPPMPYLanguageModel *>(CConversionHelper::GetLanguageModel());
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]