Skip to content

Commit 6164449

Browse files
committed
fixing crash in french with chocolate
1 parent 841e63a commit 6164449

File tree

4 files changed

+27
-20
lines changed

4 files changed

+27
-20
lines changed

SRC/dictionaryMore.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@
138138
#define Index2Word(n) (dictionaryBase+n)
139139
#define Word2Index(D) ((uint64) (D-dictionaryBase))
140140
#define GetMeanings(D) ((MEANING*) Index2Heap(D->meanings))
141-
#define GetMeaning(D,k) GetMeanings(D)[k]
141+
MEANING GetMeaning(WORDP D, int index);
142142
#define GetMeaningsFromMeaning(T) (GetMeanings(Meaning2Word(T)))
143143
#define Meaning2Index(x) ((int)((x & INDEX_BITS) >> (int)INDEX_OFFSET)) // which dict entry meaning
144144

SRC/dictionarySystem.cpp

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ bool TraceHierarchyTest(int x)
108108
return x == 0; // must exactly have been trace hierarchy
109109
}
110110

111+
MEANING GetMeaning(WORDP D, int index)
112+
{
113+
MEANING* meanings = GetMeanings(D);
114+
return (meanings) ? meanings[index] : NULL;
115+
}
116+
111117
void RemoveConceptTopic(int list[256], WORDP D,int index)
112118
{
113119
MEANING M = MakeMeaning(D);
@@ -1656,10 +1662,10 @@ static WORDP ReadBinaryEntry(FILE* in)
16561662
MEANING* meanings = (MEANING*) AllocateHeap(NULL,(c+1),sizeof(MEANING));
16571663
memset(meanings,0,(c+1) * sizeof(MEANING));
16581664
D->meanings = Heap2Index((char*)meanings);
1659-
GetMeaning(D,0) = c;
1665+
GetMeanings(D)[0] = c;
16601666
for (unsigned int i = 1; i <= c; ++i)
16611667
{
1662-
GetMeaning(D,i) = Read32(0);
1668+
GetMeanings(D)[i] = Read32(0);
16631669
if (GetMeaning(D,i) == 0)
16641670
{
16651671
ReportBug((char*)"FATAL: binary entry meaning is null %s",name)
@@ -1998,7 +2004,7 @@ MEANING AddMeaning(WORDP D,MEANING M)
19982004
{
19992005
meanings = (MEANING*) AllocateHeap(NULL,(count<<1),sizeof(MEANING));
20002006
memset(meanings,0,(count<<1) * sizeof(MEANING)); // just to be purist
2001-
memcpy(meanings+1,&GetMeaning(D,1),oldCount * sizeof(MEANING));
2007+
memcpy(meanings+1,&GetMeanings(D)[1],oldCount * sizeof(MEANING));
20022008
D->meanings = Heap2Index((char*)meanings);
20032009
}
20042010
meanings[0] = count;
@@ -2047,7 +2053,7 @@ void RemoveMeaning(MEANING M, MEANING M1)
20472053
{
20482054
if ((GetMeaning(D,i) & STDMEANING) == M1) // he points to ourself
20492055
{
2050-
GetMeaning(D,i) = 0;
2056+
GetMeanings(D)[i]= 0;
20512057
unsigned int g = GetGlossIndex(D,i);
20522058
if (g) D->w.glosses[g] = 0; // kill the gloss also if any
20532059
}
@@ -2195,7 +2201,7 @@ bool ReadDictionary(char* file)
21952201
{
21962202
ReadALine(readBuffer,in);
21972203
char* p = ReadCompiledWord(readBuffer,junk);
2198-
GetMeaning(D,i) = ReadMeaning(junk,true,true);
2204+
GetMeanings(D)[i] = ReadMeaning(junk,true,true);
21992205
if (*p == '(') p = strchr(p,')') + 2; // point after the )
22002206
if (glossCount && *p && GetMeaning(D,i) & SYNSET_MARKER)
22012207
D->w.glosses[++glossIndex] = Heap2Index(AllocateHeap(p)) + (i << 24);
@@ -3798,7 +3804,7 @@ static void FixSynsets(WORDP D, uint64 data)
37983804
{
37993805
MEANING M = GetMeaning(D, k);
38003806
M |= (unsigned int)(D->properties & BASIC_POS);
3801-
GetMeaning(D, k) = M; // type flagged for consistency
3807+
GetMeanings(D)[k] = M; // type flagged for consistency
38023808
WORDP m = Meaning2Word(M);
38033809
int64 age = m->systemFlags & AGE_LEARNED;
38043810
if (age > bestage || (age == bestage && m->length > Meaning2Word(name)->length)) // is this more common or longer?
@@ -3810,8 +3816,8 @@ static void FixSynsets(WORDP D, uint64 data)
38103816
}
38113817
if (best != -1)
38123818
{
3813-
GetMeaning(D, best) = GetMeaning(D, 1);
3814-
GetMeaning(D, 1) = name;
3819+
GetMeanings(D)[best] = GetMeaning(D, 1);
3820+
GetMeanings(D)[1] = name;
38153821
WORDP X = Meaning2Word(name);
38163822
int xx = 0;
38173823
}
@@ -3859,10 +3865,10 @@ static void ExtractSynsets(WORDP D, uint64 data) // now rearrange to get synsets
38593865
Meaning2Word(GetMeaning(referent, offset))->word, Meaning2Index(GetMeaning(referent, offset)));
38603866
myexit(0);
38613867
}
3862-
GetMeaning(referent, offset) = oldmeaning; // change his synset ptr to be our new master
3868+
GetMeanings(referent)[offset] = oldmeaning; // change his synset ptr to be our new master
38633869
oldmeaning = M;
38643870
}
3865-
GetMeaning(E, index) = oldmeaning | SYNSET_MARKER; // circular loop complete and stamp
3871+
GetMeanings(E)[index] = oldmeaning | SYNSET_MARKER; // circular loop complete and stamp
38663872
if (D->w.glosses)
38673873
{
38683874
char* gloss = Index2Heap(D->w.glosses[1] & 0x00ffffff);
@@ -3963,7 +3969,7 @@ static void PurgeDictionary(WORDP D, uint64 data)
39633969
if (M && !(Meaning2Word(M)->internalBits & WORDNET_ID) && Meaning2Word(M) != D) //invalid link
39643970
{
39653971
ReportBug("bad xlink %s %s", D->word, Meaning2Word(M)->word)
3966-
GetMeaning(D, i) = 0;
3972+
GetMeanings(D)[i] = 0;
39673973
M = 0;
39683974
}
39693975
if (!M) // was deleted
@@ -4004,7 +4010,7 @@ static void PurgeDictionary(WORDP D, uint64 data)
40044010
{
40054011
MEANING newMeaning = remap[j]; // a self ptr to the NEW slot of self
40064012
if (newMeaning == GetMeaning(D, j) || !newMeaning) continue; // unchanged or already killed off
4007-
GetMeaning(D, j) = newMeaning;
4013+
GetMeanings(D)[j] = newMeaning;
40084014

40094015
// update facts pointing to the OLD self to new self ptr
40104016
FACT* F = GetSubjectHead(D);
@@ -4037,8 +4043,8 @@ static void PurgeDictionary(WORDP D, uint64 data)
40374043

40384044
if (!master) // remove defunct meaning
40394045
{
4040-
memmove(&GetMeaning(D, i), &GetMeaning(D, i + 1), sizeof(MEANING) * (GetMeaningCount(D) - i));
4041-
--GetMeaning(D, 0);
4046+
memmove(&GetMeanings(D)[i], &GetMeanings(D)[i + 1], sizeof(MEANING) * (GetMeaningCount(D) - i));
4047+
--GetMeanings(D)[0];
40424048
--i;
40434049
}
40444050
else if (master != D) AddMeaning(master, MakeMeaning(D, i) | (M & TYPE_RESTRICTION)); // we now link synset head back to word
@@ -4235,8 +4241,8 @@ static void readIndex(char* file, uint64 prior)
42354241
if (j != actual) // occurs later or earlier, must move it here by swap
42364242
{
42374243
MEANING M = GetMeaning(D, actual);
4238-
GetMeaning(D, actual) = masterMeaning;
4239-
GetMeaning(D, j) = M;
4244+
GetMeanings(D)[actual] = masterMeaning;
4245+
GetMeanings(D)[j] = M;
42404246
}
42414247
++actual;
42424248
break;
@@ -6847,12 +6853,12 @@ static void CleanDead(WORDP D, uint64 junk) // insure all synonym circulars poin
68476853
}
68486854
if (X == D) M = MakeMeaning(X, index) | (M & TYPE_RESTRICTION) | SYNSET_MARKER; // we completed the loop, everyone else is dead, make us generic
68496855
if (seenMarker) M |= SYNSET_MARKER; // replace synset header with us or found unit since synset head is dead
6850-
GetMeaning(D, i) = M; // use this marker unchanged or changed
6856+
GetMeanings(D)[i] = M; // use this marker unchanged or changed
68516857
}
68526858

68536859
// seenmarker will be true if we are the synset head that results. our uppath will need to change perhaps. synhead will have been the original head
68546860

6855-
if (GetMeaning(D, i) & SYNSET_MARKER) // we are the synset head, adjust our links upward to be dead or not
6861+
if (GetMeanings(D)[i] & SYNSET_MARKER) // we are the synset head, adjust our links upward to be dead or not
68566862
{
68576863
MEANING M = MakeMeaning(D, i); // correct ptr to use for uplink has no flags on it
68586864
MEANING base = M;

SRC/markSystem.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ static int MarkSetPath(bool ucase,MEANING M, int start, int end, unsigned int de
284284
}
285285
else if (!index && Meaning2Index(F->subject)) // we are all meanings (limited by pos use) and he is a specific meaning
286286
{
287+
TraceFact(F);
287288
unsigned int which = Meaning2Index(F->subject);
288289
WORDP H = Meaning2Word(F->subject);
289290
MEANING M = GetMeaning(H,which);

SRC/tagger.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ void DumpSentence(int start,int end)
396396
else if (!stricmp(wordStarts[start],(char*)"what") && subject != 1 && object != 1) strcat(buffer,(char*)"(:what) ");
397397
else if (!stricmp(wordStarts[start],(char*)"how")) strcat(buffer,(char*)"(:how) ");
398398

399-
if (tokenFlags & QUESTIONMARK) strcat(buffer,(char*)"? (char*)");
399+
if (tokenFlags & QUESTIONMARK) strcat(buffer,(char*)"? ");
400400

401401
if (tokenFlags & PAST) strcat(buffer,(char*)" PAST ");
402402
else if (tokenFlags & FUTURE) strcat(buffer,(char*)" FUTURE ");

0 commit comments

Comments
 (0)