MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / find_rule

Function find_rule

extlibs/soloud/src/audiosource/speech/tts.cpp:1096–1142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1094
1095
1096static int find_rule(darray *arg, char *word, int index, Rule *rules)
1097{
1098 for (;;) /* Search for the rule */
1099 {
1100 Rule *rule;
1101 const char *left,
1102 *match,
1103 *right,
1104 *output;
1105 int remainder;
1106 rule = rules++;
1107 match = (*rule)[1];
1108
1109 if (match == 0)
1110 /* bad symbol! */
1111 {
1112 fprintf(stderr, "Error: Can't find rule for: '%c' in \"%s\"\n",
1113 word[index], word);
1114 return index + 1; /* Skip it! */
1115 }
1116
1117 for (remainder = index; *match != '\0'; match++, remainder++)
1118 {
1119 if (*match != word[remainder])
1120 break;
1121 }
1122
1123 if (*match != '\0')
1124 continue; /* found missmatch */
1125
1126 left = (*rule)[0];
1127
1128 right = (*rule)[2];
1129
1130 if (!leftmatch(left, &word[index - 1]))
1131 continue;
1132
1133 if (!rightmatch(right, &word[remainder]))
1134 continue;
1135
1136 output = (*rule)[3];
1137
1138 phone_cat(arg, output);
1139
1140 return remainder;
1141 }
1142}
1143
1144static void guess_word(darray *arg, char *word)
1145{

Callers 1

guess_wordFunction · 0.85

Calls 4

fprintfFunction · 0.85
leftmatchFunction · 0.85
rightmatchFunction · 0.85
phone_catFunction · 0.85

Tested by

no test coverage detected