summaryrefslogtreecommitdiff
path: root/inputmethods/dasher/DasherNode.cpp
Unidiff
Diffstat (limited to 'inputmethods/dasher/DasherNode.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/dasher/DasherNode.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/inputmethods/dasher/DasherNode.cpp b/inputmethods/dasher/DasherNode.cpp
index 26af10f..3a984ef 100644
--- a/inputmethods/dasher/DasherNode.cpp
+++ b/inputmethods/dasher/DasherNode.cpp
@@ -1,83 +1,83 @@
1// DasherNode.cpp 1// DasherNode.cpp
2// 2//
3///////////////////////////////////////////////////////////////////////////// 3/////////////////////////////////////////////////////////////////////////////
4// 4//
5// Copyright (c) 2001-2002 David Ward 5// Copyright (c) 2001-2002 David Ward
6// 6//
7///////////////////////////////////////////////////////////////////////////// 7/////////////////////////////////////////////////////////////////////////////
8 8
9#include "DasherNode.h" 9#include "DasherNode.h"
10using namespace Dasher; 10using namespace Dasher;
11using namespace Opts; 11using namespace Opts;
12using namespace std; 12using namespace std;
13 13
14///////////////////////////////////////////////////////////////////////////// 14/////////////////////////////////////////////////////////////////////////////
15 15
16void CDasherNode::Dump_node () const 16void CDasherNode::Dump_node () const
17 { 17 {
18 /* TODO sort out 18 /* TODO sort out
19 dchar out[256]; 19 dchar out[256];
20 if (m_Symbol) 20 if (m_Symbol)
21 wsprintf(out,TEXT("%7x %3c %7x %5d %7x %5d %8x %8x \n"),this,m_Symbol,m_iGroup,m_context,m_Children,m_Cscheme,m_iLbnd,m_iHbnd); 21 wsprintf(out,TEXT("%7x %3c %7x %5d %7x %5d %8x %8x \n"),this,m_Symbol,m_iGroup,m_context,m_Children,m_Cscheme,m_iLbnd,m_iHbnd);
22 else 22 else
23 wsprintf(out,TEXT("%7x %7x %5d %7x %5d %8x %8x \n"),this,m_iGroup,m_context,m_Children,m_Cscheme,m_iLbnd,m_iHbnd); 23 wsprintf(out,TEXT("%7x %7x %5d %7x %5d %8x %8x \n"),this,m_iGroup,m_context,m_Children,m_Cscheme,m_iLbnd,m_iHbnd);
24 24
25 OutputDebugString(out); 25 OutputDebugString(out);
26 26
27 if (m_Children) { 27 if (m_Children) {
28 unsigned int i; 28 unsigned int i;
29 for (i=1;i<m_iChars;i++) 29 for (i=1;i<m_iChars;i++)
30 m_Children[i]->Dump_node(); 30 m_Children[i]->Dump_node();
31 } 31 }
32 */ 32 */
33} 33}
34 34
35void CDasherNode::Generic_Push_Node(CLanguageModel::CNodeContext *context) { 35void CDasherNode::Generic_Push_Node(CLanguageModel::CNodeContext *) {
36 36
37 m_iAge=0; 37 m_iAge=0;
38 m_bAlive=true; 38 m_bAlive=true;
39 if (m_Symbol && !m_iChars) // make sure it's a valid symbol and don't enter if already done 39 if (m_Symbol && !m_iChars) // make sure it's a valid symbol and don't enter if already done
40 m_languagemodel->EnterNodeSymbol(m_context,m_Symbol); 40 m_languagemodel->EnterNodeSymbol(m_context,m_Symbol);
41 41
42 42
43 vector<symbol> newchars; // place to put this list of characters 43 vector<symbol> newchars; // place to put this list of characters
44 vector<unsigned int> cum,groups; // for the probability list 44 vector<unsigned int> cum,groups; // for the probability list
45 m_languagemodel->GetNodeProbs(m_context,newchars,groups,cum,0.003); 45 m_languagemodel->GetNodeProbs(m_context,newchars,groups,cum,0.003);
46 m_iChars=newchars.size(); 46 m_iChars=newchars.size();
47 // work out cumulative probs 47 // work out cumulative probs
48 unsigned int i; 48 unsigned int i;
49 for (i=1;i<m_iChars;i++) 49 for (i=1;i<m_iChars;i++)
50 cum[i]+=cum[i-1]; 50 cum[i]+=cum[i-1];
51 51
52 m_Children =new CDasherNode *[m_iChars]; 52 m_Children =new CDasherNode *[m_iChars];
53 53
54 // create the children 54 // create the children
55 ColorSchemes NormalScheme, SpecialScheme; 55 ColorSchemes NormalScheme, SpecialScheme;
56 if ((m_ColorScheme==Nodes1) || (m_ColorScheme==Special1)) { 56 if ((m_ColorScheme==Nodes1) || (m_ColorScheme==Special1)) {
57 NormalScheme = Nodes2; 57 NormalScheme = Nodes2;
58 SpecialScheme = Special2; 58 SpecialScheme = Special2;
59 } else { 59 } else {
60 NormalScheme = Nodes1; 60 NormalScheme = Nodes1;
61 SpecialScheme = Special1; 61 SpecialScheme = Special1;
62 } 62 }
63 63
64 ColorSchemes ChildScheme; 64 ColorSchemes ChildScheme;
65 for (i=1;i<m_iChars;i++) { 65 for (i=1;i<m_iChars;i++) {
66 if (newchars[i]==this->m_languagemodel->GetSpaceSymbol()) 66 if (newchars[i]==this->m_languagemodel->GetSpaceSymbol())
67 ChildScheme = SpecialScheme; 67 ChildScheme = SpecialScheme;
68 else 68 else
69 ChildScheme = NormalScheme; 69 ChildScheme = NormalScheme;
70 m_Children[i]=new CDasherNode(this,newchars[i],groups[i],i,ChildScheme,cum[i-1],cum[i],m_languagemodel,m_languagemodel->GetColour(i)); 70 m_Children[i]=new CDasherNode(this,newchars[i],groups[i],i,ChildScheme,cum[i-1],cum[i],m_languagemodel,m_languagemodel->GetColour(i));
71 } 71 }
72} 72}
73 73
74///////////////////////////////////////////////////////////////////////////// 74/////////////////////////////////////////////////////////////////////////////
75 75
76void CDasherNode::Push_Node(CLanguageModel::CNodeContext *context) 76void CDasherNode::Push_Node(CLanguageModel::CNodeContext *context)
77// push a node copying the specified context 77// push a node copying the specified context
78{ 78{
79 79
80 if (m_Children) { 80 if (m_Children) {
81 // if there are children just give them a poke 81 // if there are children just give them a poke
82 unsigned int i; 82 unsigned int i;
83 for (i=1;i<m_iChars;i++) { 83 for (i=1;i<m_iChars;i++) {