Debian Codegraph @

terps/alan3/dictionary.c

raw symbols SCIP
1 /*----------------------------------------------------------------------*\
2
3 dictionary
4
5 \*----------------------------------------------------------------------*/
6 #include "dictionary.h"
7
8 /* IMPORTS */
9 #include "word.h"
10 #include "lists.h"
11
12 /* PUBLIC DATA */
13 DictionaryEntry *dictionary; /* Dictionary pointer */
14 int dictionarySize;
15 int conjWord; /* First conjunction in dictionary, for ',' */
16
17
18
19 /* Word class query methods, move to Word.c */
20 /* Word classes are numbers but in the dictionary they are generated as bits */
21 static bool isVerb(int wordCode) {
22 return wordCode < dictionarySize && (dictionary[wordCode].classBits&VERB_BIT)!=0;
23 }
24
25 bool isVerbWord(int wordIndex) {
26 return isVerb(playerWords[wordIndex].code);
27 }
28
29 bool isConjunction(int wordCode) {
30 return wordCode < dictionarySize && (dictionary[wordCode].classBits&CONJUNCTION_BIT)!=0;
31 }
32
33 bool isConjunctionWord(int wordIndex) {
34 return isConjunction(playerWords[wordIndex].code);
35 }
36
37 static bool isExcept(int wordCode) {
38 return wordCode < dictionarySize && (dictionary[wordCode].classBits&EXCEPT_BIT)!=0;
39 }
40
41 bool isExceptWord(int wordIndex) {
42 return isExcept(playerWords[wordIndex].code);
43 }
44
45 static bool isThem(int wordCode) {
46 return wordCode < dictionarySize && (dictionary[wordCode].classBits&THEM_BIT)!=0;
47 }
48
49 bool isThemWord(int wordIndex) {
50 return isThem(playerWords[wordIndex].code);
51 }
52
53 static bool isIt(int wordCode) {
54 return wordCode < dictionarySize && (dictionary[wordCode].classBits&IT_BIT)!=0;
55 }
56
57 bool isItWord(int wordIndex) {
58 return isIt(playerWords[wordIndex].code);
59 }
60
61 static bool isNoun(int wordCode) {
62 return wordCode < dictionarySize && (dictionary[wordCode].classBits&NOUN_BIT)!=0;
63 }
64
65 bool isNounWord(int wordIndex) {
66 return isNoun(playerWords[wordIndex].code);
67 }
68
69 static bool isAdjective(int wordCode) {
70 return wordCode < dictionarySize && (dictionary[wordCode].classBits&ADJECTIVE_BIT)!=0;
71 }
72
73 bool isAdjectiveWord(int wordIndex) {
74 return isAdjective(playerWords[wordIndex].code);
75 }
76
77 static bool isPreposition(int wordCode) {
78 return wordCode < dictionarySize && (dictionary[wordCode].classBits&PREPOSITION_BIT)!=0;
79 }
80
81 bool isPrepositionWord(int wordIndex) {
82 return isPreposition(playerWords[wordIndex].code);
83 }
84
85 bool isAll(int wordCode) {
86 return wordCode < dictionarySize && (dictionary[wordCode].classBits&ALL_BIT)!=0;
87 }
88
89 bool isAllWord(int wordIndex) {
90 return isAll(playerWords[wordIndex].code);
91 }
92
93 static bool isDir(int wordCode) {
94 return wordCode < dictionarySize && (dictionary[wordCode].classBits&DIRECTION_BIT)!=0;
95 }
96
97 bool isDirectionWord(int wordIndex) {
98 return isDir(playerWords[wordIndex].code);
99 }
100
101 bool isNoise(int wordCode) {
102 return wordCode < dictionarySize && (dictionary[wordCode].classBits&NOISE_BIT)!=0;
103 }
104
105 bool isPronoun(int wordCode) {
106 return wordCode < dictionarySize && (dictionary[wordCode].classBits&PRONOUN_BIT)!=0;
107 }
108
109 bool isPronounWord(int wordIndex) {
110 return isPronoun(playerWords[wordIndex].code);
111 }
112
113 bool isLiteralWord(int wordIndex) {
114 return playerWords[wordIndex].code >= dictionarySize;
115 }