diff --git a/src/main.c b/src/main.c index 9e78be14..ea62260e 100644 --- a/src/main.c +++ b/src/main.c @@ -230,11 +230,11 @@ int main(int argc, char **argv) if (!phonetic) { - strncat(input, "[", 256); + strncat(input, "[", 255); if (!TextToPhonemes((unsigned char *)input)) return 1; if (debug) printf("phonetic input: %s\n", input); - } else strncat(input, "\x9b", 256); + } else strncat(input, "\x9b", 255); #ifdef USESDL if ( SDL_Init(SDL_INIT_AUDIO) < 0 ) diff --git a/src/sam.c b/src/sam.c index 2334bdd2..3ed524f9 100644 --- a/src/sam.c +++ b/src/sam.c @@ -27,7 +27,7 @@ unsigned char mem56; unsigned char mem59=0; -unsigned char A, X, Y; +unsigned char B, R, S; unsigned char stress[256]; //numbers from 0 to 8 unsigned char phonemeLength[256]; //tab40160 @@ -150,14 +150,14 @@ int SAMMain() Code41240(); do { - A = phonemeindex[X]; - if (A > 80) + B = phonemeindex[R]; + if (B > 80) { - phonemeindex[X] = 255; + phonemeindex[R] = 255; break; // error: delete all behind it } - X++; - } while (X != 0); + R++; + } while (R != 0); //pos39848: InsertBreath(); @@ -177,45 +177,45 @@ int SAMMain() //void Code48547() void PrepareOutput() { - A = 0; - X = 0; - Y = 0; + B = 0; + R = 0; + S = 0; //pos48551: while(1) { - A = phonemeindex[X]; - if (A == 255) + B = phonemeindex[R]; + if (B == 255) { - A = 255; - phonemeIndexOutput[Y] = 255; + B = 255; + phonemeIndexOutput[S] = 255; Render(); return; } - if (A == 254) + if (B == 254) { - X++; - int temp = X; + R++; + int temp = R; //mem[48546] = X; - phonemeIndexOutput[Y] = 255; + phonemeIndexOutput[S] = 255; Render(); //X = mem[48546]; - X=temp; - Y = 0; + R=temp; + S = 0; continue; } - if (A == 0) + if (B == 0) { - X++; + R++; continue; } - phonemeIndexOutput[Y] = A; - phonemeLengthOutput[Y] = phonemeLength[X]; - stressOutput[Y] = stress[X]; - X++; - Y++; + phonemeIndexOutput[S] = B; + phonemeLengthOutput[S] = phonemeLength[R]; + stressOutput[S] = stress[R]; + R++; + S++; } } @@ -226,45 +226,45 @@ void InsertBreath() unsigned char mem55; unsigned char index; //variable Y mem54 = 255; - X++; + R++; mem55 = 0; unsigned char mem66 = 0; while(1) { //pos48440: - X = mem66; - index = phonemeindex[X]; + R = mem66; + index = phonemeindex[R]; if (index == 255) return; - mem55 += phonemeLength[X]; + mem55 += phonemeLength[R]; if (mem55 < 232) { if (index != 254) // ML : Prevents an index out of bounds problem { - A = flags2[index]&1; - if(A != 0) + B = flags2[index]&1; + if(B != 0) { - X++; + R++; mem55 = 0; - Insert(X, 254, mem59, 0); + Insert(R, 254, mem59, 0); mem66++; mem66++; continue; } } - if (index == 0) mem54 = X; + if (index == 0) mem54 = R; mem66++; continue; } - X = mem54; - phonemeindex[X] = 31; // 'Q*' glottal stop - phonemeLength[X] = 4; - stress[X] = 0; - X++; + R = mem54; + phonemeindex[R] = 31; // 'Q*' glottal stop + phonemeLength[R] = 4; + stress[R] = 0; + R++; mem55 = 0; - Insert(X, 254, mem59, 0); - X++; - mem66 = X; + Insert(R, 254, mem59, 0); + R++; + mem66 = R; } } @@ -291,33 +291,33 @@ void CopyStress() while(1) { // get the phomene - Y = phonemeindex[pos]; + S = phonemeindex[pos]; // exit at end of buffer - if (Y == 255) return; + if (S == 255) return; // if CONSONANT_FLAG set, skip - only vowels get stress - if ((flags[Y] & 64) == 0) {pos++; continue;} + if ((flags[S] & 64) == 0) {pos++; continue;} // get the next phoneme - Y = phonemeindex[pos+1]; - if (Y == 255) //prevent buffer overflow + S = phonemeindex[pos+1]; + if (S == 255) //prevent buffer overflow { pos++; continue; } else // if the following phoneme is a vowel, skip - if ((flags[Y] & 128) == 0) {pos++; continue;} + if ((flags[S] & 128) == 0) {pos++; continue;} // get the stress value at the next position - Y = stress[pos+1]; + S = stress[pos+1]; // if next phoneme is not stressed, skip - if (Y == 0) {pos++; continue;} + if (S == 0) {pos++; continue;} // if next phoneme is not a VOWEL OR ER, skip - if ((Y & 128) != 0) {pos++; continue;} + if ((S & 128) != 0) {pos++; continue;} // copy stress from prior phoneme to this one - stress[pos] = Y+1; + stress[pos] = S+1; // advance pointer pos++; @@ -400,9 +400,9 @@ int Parser1() unsigned char sign1; unsigned char sign2; unsigned char position = 0; - X = 0; - A = 0; - Y = 0; + R = 0; + B = 0; + S = 0; // CLEAR THE STRESS TABLE for(i=0; i<256; i++) @@ -413,7 +413,7 @@ int Parser1() while(1) { // GET THE FIRST CHARACTER FROM THE PHONEME BUFFER - sign1 = input[X]; + sign1 = input[R]; // TEST FOR 155 (�) END OF LINE MARKER if (sign1 == 155) { @@ -424,8 +424,8 @@ int Parser1() } // GET THE NEXT CHARACTER FROM THE BUFFER - X++; - sign2 = input[X]; + R++; + sign2 = input[R]; // NOW sign1 = FIRST CHARACTER OF PHONEME, AND sign2 = SECOND CHARACTER OF PHONEME @@ -433,28 +433,28 @@ int Parser1() // IGNORE PHONEMES IN TABLE ENDING WITH WILDCARDS // SET INDEX TO 0 - Y = 0; + S = 0; pos41095: // GET FIRST CHARACTER AT POSITION Y IN signInputTable // --> should change name to PhonemeNameTable1 - A = signInputTable1[Y]; + B = signInputTable1[S]; // FIRST CHARACTER MATCHES? - if (A == sign1) + if (B == sign1) { // GET THE CHARACTER FROM THE PhonemeSecondLetterTable - A = signInputTable2[Y]; + B = signInputTable2[S]; // NOT A SPECIAL AND MATCHES SECOND CHARACTER? - if ((A != '*') && (A == sign2)) + if ((B != '*') && (B == sign2)) { // STORE THE INDEX OF THE PHONEME INTO THE phomeneIndexTable - phonemeindex[position] = Y; + phonemeindex[position] = S; // ADVANCE THE POINTER TO THE phonemeIndexTable position++; // ADVANCE THE POINTER TO THE phonemeInputBuffer - X++; + R++; // CONTINUE PARSING continue; @@ -464,24 +464,24 @@ int Parser1() // NO MATCH, TRY TO MATCH ON FIRST CHARACTER TO WILDCARD NAMES (ENDING WITH '*') // ADVANCE TO THE NEXT POSITION - Y++; + S++; // IF NOT END OF TABLE, CONTINUE - if (Y != 81) goto pos41095; + if (S != 81) goto pos41095; // REACHED END OF TABLE WITHOUT AN EXACT (2 CHARACTER) MATCH. // THIS TIME, SEARCH FOR A 1 CHARACTER MATCH AGAINST THE WILDCARDS // RESET THE INDEX TO POINT TO THE START OF THE PHONEME NAME TABLE - Y = 0; + S = 0; pos41134: // DOES THE PHONEME IN THE TABLE END WITH '*'? - if (signInputTable2[Y] == '*') + if (signInputTable2[S] == '*') { // DOES THE FIRST CHARACTER MATCH THE FIRST LETTER OF THE PHONEME - if (signInputTable1[Y] == sign1) + if (signInputTable1[S] == sign1) { // SAVE THE POSITION AND MOVE AHEAD - phonemeindex[position] = Y; + phonemeindex[position] = S; // ADVANCE THE POINTER position++; @@ -490,24 +490,24 @@ int Parser1() continue; } } - Y++; - if (Y != 81) goto pos41134; //81 is size of PHONEME NAME table + S++; + if (S != 81) goto pos41134; //81 is size of PHONEME NAME table // FAILED TO MATCH WITH A WILDCARD. ASSUME THIS IS A STRESS // CHARACTER. SEARCH THROUGH THE STRESS TABLE // SET INDEX TO POSITION 8 (END OF STRESS TABLE) - Y = 8; + S = 8; // WALK BACK THROUGH TABLE LOOKING FOR A MATCH - while( (sign1 != stressInputTable[Y]) && (Y>0)) + while( (sign1 != stressInputTable[S]) && (S>0)) { // DECREMENT INDEX - Y--; + S--; } // REACHED THE END OF THE SEARCH WITHOUT BREAKING OUT OF LOOP? - if (Y == 0) + if (S == 0) { //mem[39444] = X; //41181: JSR 42043 //Error @@ -515,7 +515,7 @@ int Parser1() return 0; } // SET THE STRESS FOR THE PRIOR PHONEME - stress[position-1] = Y; + stress[position-1] = S; } //while } @@ -526,13 +526,13 @@ int Parser1() //void Code41203() void SetPhonemeLength() { - unsigned char A; + unsigned char B; int position = 0; while(phonemeindex[position] != 255 ) { - A = stress[position]; + B = stress[position]; //41218: BMI 41229 - if ((A == 0) || ((A&128) != 0)) + if ((B == 0) || ((B&128) != 0)) { phonemeLength[position] = phonemeLengthTable[phonemeindex[position]]; } else @@ -551,7 +551,7 @@ void Code41240() while(phonemeindex[pos] != 255) { unsigned char index; //register AC - X = pos; + R = pos; index = phonemeindex[pos]; if ((flags[index]&2) == 0) { @@ -568,14 +568,14 @@ void Code41240() do { - X++; - A = phonemeindex[X]; - } while(A==0); + R++; + B = phonemeindex[R]; + } while(B==0); - if (A != 255) + if (B != 255) { - if ((flags[A] & 8) != 0) {pos++; continue;} - if ((A == 36) || (A == 37)) {pos++; continue;} // '/H' '/X' + if ((flags[B] & 8) != 0) {pos++; continue;} + if ((B == 36) || (B == 37)) {pos++; continue;} // '/H' '/X' } Insert(pos+1, index+1, phonemeLengthTable[index+1], stress[pos]); @@ -622,15 +622,15 @@ void Parser2() while(1) { // SET X TO THE CURRENT POSITION - X = pos; + R = pos; // GET THE PHONEME AT THE CURRENT POSITION - A = phonemeindex[pos]; + B = phonemeindex[pos]; // DEBUG: Print phoneme and index - if (debug && A != 255) printf("%d: %c%c\n", X, signInputTable1[A], signInputTable2[A]); + if (debug && B != 255) printf("%d: %c%c\n", R, signInputTable1[B], signInputTable2[B]); // Is phoneme pause? - if (A == 0) + if (B == 0) { // Move ahead to the pos++; @@ -638,10 +638,10 @@ void Parser2() } // If end of phonemes flag reached, exit routine - if (A == 255) return; + if (B == 255) return; // Copy the current phoneme index to Y - Y = A; + S = B; // RULE: // -> WX @@ -650,23 +650,23 @@ void Parser2() // Check for DIPHTONG - if ((flags[A] & 16) == 0) goto pos41457; + if ((flags[B] & 16) == 0) goto pos41457; // Not a diphthong. Get the stress mem58 = stress[pos]; // End in IY sound? - A = flags[Y] & 32; + B = flags[S] & 32; // If ends with IY, use YX, else use WX - if (A == 0) A = 20; else A = 21; // 'WX' = 20 'YX' = 21 + if (B == 0) B = 20; else B = 21; // 'WX' = 20 'YX' = 21 //pos41443: // Insert at WX or YX following, copying the stress - if (debug) if (A==20) printf("RULE: insert WX following diphtong NOT ending in IY sound\n"); - if (debug) if (A==21) printf("RULE: insert YX following diphtong ending in IY sound\n"); - Insert(pos+1, A, mem59, mem58); - X = pos; + if (debug) if (B==20) printf("RULE: insert WX following diphtong NOT ending in IY sound\n"); + if (debug) if (B==21) printf("RULE: insert YX following diphtong ending in IY sound\n"); + Insert(pos+1, B, mem59, mem58); + R = pos; // Jump to ??? goto pos41749; @@ -679,21 +679,21 @@ void Parser2() // Example: MEDDLE // Get phoneme - A = phonemeindex[X]; + B = phonemeindex[R]; // Skip this rule if phoneme is not UL - if (A != 78) goto pos41487; // 'UL' - A = 24; // 'L' //change 'UL' to 'AX L' + if (B != 78) goto pos41487; // 'UL' + B = 24; // 'L' //change 'UL' to 'AX L' if (debug) printf("RULE: UL -> AX L\n"); pos41466: // Get current phoneme stress - mem58 = stress[X]; + mem58 = stress[R]; // Change UL to AX - phonemeindex[X] = 13; // 'AX' + phonemeindex[R] = 13; // 'AX' // Perform insert. Note code below may jump up here with different values - Insert(X+1, A, mem59, mem58); + Insert(R+1, B, mem59, mem58); pos++; // Move to next phoneme continue; @@ -705,9 +705,9 @@ void Parser2() // Example: ASTRONOMY // Skip rule if phoneme != UM - if (A != 79) goto pos41495; // 'UM' + if (B != 79) goto pos41495; // 'UM' // Jump up to branch - replaces current phoneme with AX and continues - A = 27; // 'M' //change 'UM' to 'AX M' + B = 27; // 'M' //change 'UM' to 'AX M' if (debug) printf("RULE: UM -> AX M\n"); goto pos41466; pos41495: @@ -718,10 +718,10 @@ void Parser2() // Skip rule if phoneme != UN - if (A != 80) goto pos41503; // 'UN' + if (B != 80) goto pos41503; // 'UN' // Jump up to branch - replaces current phoneme with AX and continues - A = 28; // 'N' //change UN to 'AX N' + B = 28; // 'N' //change UN to 'AX N' if (debug) printf("RULE: UN -> AX N\n"); goto pos41466; pos41503: @@ -730,49 +730,49 @@ void Parser2() // -> Q // EXAMPLE: AWAY EIGHT - Y = A; + S = B; // VOWEL set? - A = flags[A] & 128; + B = flags[B] & 128; // Skip if not a vowel - if (A != 0) + if (B != 0) { // Get the stress - A = stress[X]; + B = stress[R]; // If stressed... - if (A != 0) + if (B != 0) { // Get the following phoneme - X++; - A = phonemeindex[X]; + R++; + B = phonemeindex[R]; // If following phoneme is a pause - if (A == 0) + if (B == 0) { // Get the phoneme following pause - X++; - Y = phonemeindex[X]; + R++; + S = phonemeindex[R]; // Check for end of buffer flag - if (Y == 255) //buffer overflow + if (S == 255) //buffer overflow // ??? Not sure about these flags - A = 65&128; + B = 65&128; else // And VOWEL flag to current phoneme's flags - A = flags[Y] & 128; + B = flags[S] & 128; // If following phonemes is not a pause - if (A != 0) + if (B != 0) { // If the following phoneme is not stressed - A = stress[X]; - if (A != 0) + B = stress[R]; + if (B != 0) { // Insert a glottal stop and move forward if (debug) printf("RULE: Insert glottal stop between two stressed vowels with space between them\n"); // 31 = 'Q' - Insert(X, 31, mem59, 0); + Insert(R, 31, mem59, 0); pos++; continue; } @@ -788,15 +788,15 @@ void Parser2() // Get current position and phoneme - X = pos; - A = phonemeindex[pos]; - if (A != 23) goto pos41611; // 'R' + R = pos; + B = phonemeindex[pos]; + if (B != 23) goto pos41611; // 'R' // Look at prior phoneme - X--; - A = phonemeindex[pos-1]; + R--; + B = phonemeindex[pos-1]; //pos41567: - if (A == 69) // 'T' + if (B == 69) // 'T' { // Change T to CH if (debug) printf("RULE: T R -> CH R\n"); @@ -810,7 +810,7 @@ void Parser2() // Example: DRY // Prior phonemes D? - if (A == 57) // 'D' + if (B == 57) // 'D' { // Change D to J phonemeindex[pos-1] = 44; @@ -824,9 +824,9 @@ void Parser2() // If vowel flag is set change R to RX - A = flags[A] & 128; + B = flags[B] & 128; if (debug) printf("RULE: R -> RX\n"); - if (A != 0) phonemeindex[pos] = 18; // 'RX' + if (B != 0) phonemeindex[pos] = 18; // 'RX' // continue to next phoneme pos++; @@ -839,13 +839,13 @@ void Parser2() // Example: ALL // Is phoneme L? - if (A == 24) // 'L' + if (B == 24) // 'L' { // If prior phoneme does not have VOWEL flag set, move to next phoneme if ((flags[phonemeindex[pos-1]] & 128) == 0) {pos++; continue;} // Prior phoneme has VOWEL flag set, so change L to LX and move to next phoneme if (debug) printf("RULE: L -> LX\n"); - phonemeindex[X] = 19; // 'LX' + phonemeindex[R] = 19; // 'LX' pos++; continue; } @@ -858,7 +858,7 @@ void Parser2() // 2. Reciter already replaces GS -> GZ // Is current phoneme S? - if (A == 32) // 'S' + if (B == 32) // 'S' { // If prior phoneme is not G, move to next phoneme if (phonemeindex[pos-1] != 60) {pos++; continue;} @@ -874,19 +874,19 @@ void Parser2() // Example: COW // Is current phoneme K? - if (A == 72) // 'K' + if (B == 72) // 'K' { // Get next phoneme - Y = phonemeindex[pos+1]; + S = phonemeindex[pos+1]; // If at end, replace current phoneme with KX - if (Y == 255) phonemeindex[pos] = 75; // ML : prevents an index out of bounds problem + if (S == 255) phonemeindex[pos] = 75; // ML : prevents an index out of bounds problem else { // VOWELS AND DIPHTONGS ENDING WITH IY SOUND flag set? - A = flags[Y] & 32; - if (debug) if (A==0) printf("RULE: K -> KX \n"); + B = flags[S] & 32; + if (debug) if (B==0) printf("RULE: K -> KX \n"); // Replace with KX - if (A == 0) phonemeindex[pos] = 75; // 'KX' + if (B == 0) phonemeindex[pos] = 75; // 'KX' } } else @@ -897,7 +897,7 @@ void Parser2() // Is character a G? - if (A == 60) // 'G' + if (B == 60) // 'G' { // Get the following character unsigned char index = phonemeindex[pos+1]; @@ -924,20 +924,20 @@ void Parser2() // S KX -> S GX // Examples: SPY, STY, SKY, SCOWL - Y = phonemeindex[pos]; + S = phonemeindex[pos]; //pos41719: // Replace with softer version? - A = flags[Y] & 1; - if (A == 0) goto pos41749; - A = phonemeindex[pos-1]; - if (A != 32) // 'S' + B = flags[S] & 1; + if (B == 0) goto pos41749; + B = phonemeindex[pos-1]; + if (B != 32) // 'S' { - A = Y; + B = S; goto pos41812; } // Replace with softer version - if (debug) printf("RULE: S* %c%c -> S* %c%c\n", signInputTable1[Y], signInputTable2[Y],signInputTable1[Y-12], signInputTable2[Y-12]); - phonemeindex[pos] = Y-12; + if (debug) printf("RULE: S* %c%c -> S* %c%c\n", signInputTable1[S], signInputTable2[S],signInputTable1[S-12], signInputTable2[S-12]); + phonemeindex[pos] = S-12; pos++; continue; @@ -951,16 +951,16 @@ void Parser2() // UW -> UX - A = phonemeindex[X]; - if (A == 53) // 'UW' + B = phonemeindex[R]; + if (B == 53) // 'UW' { // ALVEOLAR flag set? - Y = phonemeindex[X-1]; - A = flags2[Y] & 4; + S = phonemeindex[R-1]; + B = flags2[S] & 4; // If not set, continue processing next phoneme - if (A == 0) {pos++; continue;} + if (B == 0) {pos++; continue;} if (debug) printf("RULE: UW -> UX\n"); - phonemeindex[X] = 16; + phonemeindex[R] = 16; pos++; continue; } @@ -970,11 +970,11 @@ void Parser2() // CH -> CH CH' (CH requires two phonemes to represent it) // Example: CHEW - if (A == 42) // 'CH' + if (B == 42) // 'CH' { // pos41783: if (debug) printf("CH -> CH CH+1\n"); - Insert(X+1, A+1, mem59, stress[X]); + Insert(R+1, B+1, mem59, stress[R]); pos++; continue; } @@ -986,10 +986,10 @@ void Parser2() // Example: JAY - if (A == 44) // 'J' + if (B == 44) // 'J' { if (debug) printf("J -> J J+1\n"); - Insert(X+1, A+1, mem59, stress[X]); + Insert(R+1, B+1, mem59, stress[R]); pos++; continue; } @@ -1006,40 +1006,40 @@ void Parser2() // Past this point, only process if phoneme is T or D - if (A != 69) // 'T' - if (A != 57) {pos++; continue;} // 'D' + if (B != 69) // 'T' + if (B != 57) {pos++; continue;} // 'D' //pos41825: // If prior phoneme is not a vowel, continue processing phonemes - if ((flags[phonemeindex[X-1]] & 128) == 0) {pos++; continue;} + if ((flags[phonemeindex[R-1]] & 128) == 0) {pos++; continue;} // Get next phoneme - X++; - A = phonemeindex[X]; + R++; + B = phonemeindex[R]; //pos41841 // Is the next phoneme a pause? - if (A != 0) + if (B != 0) { // If next phoneme is not a pause, continue processing phonemes - if ((flags[A] & 128) == 0) {pos++; continue;} + if ((flags[B] & 128) == 0) {pos++; continue;} // If next phoneme is stressed, continue processing phonemes // FIXME: How does a pause get stressed? - if (stress[X] != 0) {pos++; continue;} + if (stress[R] != 0) {pos++; continue;} //pos41856: // Set phonemes to DX if (debug) printf("RULE: Soften T or D following vowel or ER and preceding a pause -> DX\n"); phonemeindex[pos] = 30; // 'DX' } else { - A = phonemeindex[X+1]; - if (A == 255) //prevent buffer overflow - A = 65 & 128; + B = phonemeindex[R+1]; + if (B == 255) //prevent buffer overflow + B = 65 & 128; else // Is next phoneme a vowel or ER? - A = flags[A] & 128; - if (debug) if (A != 0) printf("RULE: Soften T or D following vowel or ER and preceding a pause -> DX\n"); - if (A != 0) phonemeindex[pos] = 30; // 'DX' + B = flags[B] & 128; + if (debug) if (B != 0) printf("RULE: Soften T or D following vowel or ER and preceding a pause -> DX\n"); + if (B != 0) phonemeindex[pos] = 30; // 'DX' } pos++; @@ -1071,7 +1071,7 @@ void AdjustLengths() // increased by (length * 1.5) + 1 // loop index - X = 0; + R = 0; unsigned char index; // iterate through the phoneme list @@ -1079,7 +1079,7 @@ void AdjustLengths() while(1) { // get a phoneme - index = phonemeindex[X]; + index = phonemeindex[R]; // exit loop if end on buffer token if (index == 255) break; @@ -1088,24 +1088,24 @@ void AdjustLengths() if((flags2[index] & 1) == 0) { // skip - X++; + R++; continue; } // hold index - loopIndex = X; + loopIndex = R; // Loop backwards from this point pos48644: // back up one phoneme - X--; + R--; // stop once the beginning is reached - if(X == 0) break; + if(R == 0) break; // get the preceding phoneme - index = phonemeindex[X]; + index = phonemeindex[R]; if (index != 255) //inserted to prevent access overrun if((flags[index] & 128) == 0) goto pos48644; // if not a vowel, continue looping @@ -1114,7 +1114,7 @@ void AdjustLengths() do { // test for vowel - index = phonemeindex[X]; + index = phonemeindex[R]; if (index != 255)//inserted to prevent access overrun // test for fricative/unvoiced or not voiced @@ -1124,25 +1124,25 @@ void AdjustLengths() //if(A == 0) goto pos48688; // get the phoneme length - A = phonemeLength[X]; + B = phonemeLength[R]; // change phoneme length to (length * 1.5) + 1 - A = (A >> 1) + A + 1; + B = (B >> 1) + B + 1; if (debug) printf("RULE: Lengthen or between and by 1.5\n"); if (debug) printf("PRE\n"); -if (debug) printf("phoneme %d (%c%c) length %d\n", X, signInputTable1[phonemeindex[X]], signInputTable2[phonemeindex[X]], phonemeLength[X]); +if (debug) printf("phoneme %d (%c%c) length %d\n", R, signInputTable1[phonemeindex[R]], signInputTable2[phonemeindex[R]], phonemeLength[R]); - phonemeLength[X] = A; + phonemeLength[R] = B; if (debug) printf("POST\n"); -if (debug) printf("phoneme %d (%c%c) length %d\n", X, signInputTable1[phonemeindex[X]], signInputTable2[phonemeindex[X]], phonemeLength[X]); +if (debug) printf("phoneme %d (%c%c) length %d\n", R, signInputTable1[phonemeindex[R]], signInputTable2[phonemeindex[R]], phonemeLength[R]); } // keep moving forward - X++; - } while (X != loopIndex); + R++; + } while (R != loopIndex); // if (X != loopIndex) goto pos48657; - X++; + R++; } // while // Similar to the above routine, but shorten vowels under some circumstances @@ -1154,19 +1154,19 @@ if (debug) printf("phoneme %d (%c%c) length %d\n", X, signInputTable1[phonemeind while(1) { // get a phoneme - X = loopIndex; - index = phonemeindex[X]; + R = loopIndex; + index = phonemeindex[R]; // exit routine at end token if (index == 255) return; // vowel? - A = flags[index] & 128; - if (A != 0) + B = flags[index] & 128; + if (B != 0) { // get next phoneme - X++; - index = phonemeindex[X]; + R++; + index = phonemeindex[R]; // get flags if (index == 255) @@ -1181,8 +1181,8 @@ if (debug) printf("phoneme %d (%c%c) length %d\n", X, signInputTable1[phonemeind if ((index == 18) || (index == 19)) // 'RX' & 'LX' { // get the next phoneme - X++; - index = phonemeindex[X]; + R++; + index = phonemeindex[R]; // next phoneme a consonant? if ((flags[index] & 64) != 0) { @@ -1233,18 +1233,18 @@ if (debug) printf("phoneme %d (%c%c) length %d\n", loopIndex, signInputTable1[ph // // move back - X--; + R--; if (debug) printf("RULE: - decrease vowel by 1/8th\n"); if (debug) printf("PRE\n"); -if (debug) printf("phoneme %d (%c%c) length %d\n", X, signInputTable1[phonemeindex[X]], signInputTable2[phonemeindex[X]], phonemeLength[X]); +if (debug) printf("phoneme %d (%c%c) length %d\n", R, signInputTable1[phonemeindex[R]], signInputTable2[phonemeindex[R]], phonemeLength[R]); // decrease length by 1/8th - mem56 = phonemeLength[X] >> 3; - phonemeLength[X] -= mem56; + mem56 = phonemeLength[R] >> 3; + phonemeLength[R] -= mem56; if (debug) printf("POST\n"); -if (debug) printf("phoneme %d (%c%c) length %d\n", X, signInputTable1[phonemeindex[X]], signInputTable2[phonemeindex[X]], phonemeLength[X]); +if (debug) printf("phoneme %d (%c%c) length %d\n", R, signInputTable1[phonemeindex[R]], signInputTable2[phonemeindex[R]], phonemeLength[R]); // move ahead loopIndex++; @@ -1256,14 +1256,14 @@ if (debug) printf("phoneme %d (%c%c) length %d\n", X, signInputTable1[phonemeind if (debug) printf("RULE: - increase vowel by 1/2 + 1\n"); if (debug) printf("PRE\n"); -if (debug) printf("phoneme %d (%c%c) length %d\n", X-1, signInputTable1[phonemeindex[X-1]], signInputTable2[phonemeindex[X-1]], phonemeLength[X-1]); +if (debug) printf("phoneme %d (%c%c) length %d\n", R-1, signInputTable1[phonemeindex[R-1]], signInputTable2[phonemeindex[R-1]], phonemeLength[R-1]); // decrease length - A = phonemeLength[X-1]; - phonemeLength[X-1] = (A >> 2) + A + 1; // 5/4*A + 1 + B = phonemeLength[R-1]; + phonemeLength[R-1] = (B >> 2) + B + 1; // 5/4*A + 1 if (debug) printf("POST\n"); -if (debug) printf("phoneme %d (%c%c) length %d\n", X-1, signInputTable1[phonemeindex[X-1]], signInputTable2[phonemeindex[X-1]], phonemeLength[X-1]); +if (debug) printf("phoneme %d (%c%c) length %d\n", R-1, signInputTable1[phonemeindex[R-1]], signInputTable2[phonemeindex[R-1]], phonemeLength[R-1]); // move ahead loopIndex++; @@ -1287,36 +1287,36 @@ if (debug) printf("phoneme %d (%c%c) length %d\n", X-1, signInputTable1[phonemei // M*, N*, NX, // get the next phoneme - X++; - index = phonemeindex[X]; + R++; + index = phonemeindex[R]; // end of buffer? if (index == 255) - A = 65&2; //prevent buffer overflow + B = 65&2; //prevent buffer overflow else - A = flags[index] & 2; // check for stop consonant + B = flags[index] & 2; // check for stop consonant // is next phoneme a stop consonant? - if (A != 0) + if (B != 0) // B*, D*, G*, GX, P*, T*, K*, KX { if (debug) printf("RULE: - set nasal = 5, consonant = 6\n"); if (debug) printf("POST\n"); -if (debug) printf("phoneme %d (%c%c) length %d\n", X, signInputTable1[phonemeindex[X]], signInputTable2[phonemeindex[X]], phonemeLength[X]); -if (debug) printf("phoneme %d (%c%c) length %d\n", X-1, signInputTable1[phonemeindex[X-1]], signInputTable2[phonemeindex[X-1]], phonemeLength[X-1]); +if (debug) printf("phoneme %d (%c%c) length %d\n", R, signInputTable1[phonemeindex[R]], signInputTable2[phonemeindex[R]], phonemeLength[R]); +if (debug) printf("phoneme %d (%c%c) length %d\n", R-1, signInputTable1[phonemeindex[R-1]], signInputTable2[phonemeindex[R-1]], phonemeLength[R-1]); // set stop consonant length to 6 - phonemeLength[X] = 6; + phonemeLength[R] = 6; // set nasal length to 5 - phonemeLength[X-1] = 5; + phonemeLength[R-1] = 5; if (debug) printf("POST\n"); -if (debug) printf("phoneme %d (%c%c) length %d\n", X, signInputTable1[phonemeindex[X]], signInputTable2[phonemeindex[X]], phonemeLength[X]); -if (debug) printf("phoneme %d (%c%c) length %d\n", X-1, signInputTable1[phonemeindex[X-1]], signInputTable2[phonemeindex[X-1]], phonemeLength[X-1]); +if (debug) printf("phoneme %d (%c%c) length %d\n", R, signInputTable1[phonemeindex[R]], signInputTable2[phonemeindex[R]], phonemeLength[R]); +if (debug) printf("phoneme %d (%c%c) length %d\n", R-1, signInputTable1[phonemeindex[R-1]], signInputTable2[phonemeindex[R-1]], phonemeLength[R-1]); } // move to next phoneme @@ -1339,8 +1339,8 @@ if (debug) printf("phoneme %d (%c%c) length %d\n", X-1, signInputTable1[phonemei do { // move ahead - X++; - index = phonemeindex[X]; + R++; + index = phonemeindex[R]; } while(index == 0); @@ -1358,13 +1358,13 @@ if (debug) printf("phoneme %d (%c%c) length %d\n", X-1, signInputTable1[phonemei // RULE: {optional silence} if (debug) printf("RULE: {optional silence} - shorten both to 1/2 + 1\n"); if (debug) printf("PRE\n"); -if (debug) printf("phoneme %d (%c%c) length %d\n", X, signInputTable1[phonemeindex[X]], signInputTable2[phonemeindex[X]], phonemeLength[X]); -if (debug) printf("phoneme %d (%c%c) length %d\n", X-1, signInputTable1[phonemeindex[X-1]], signInputTable2[phonemeindex[X-1]], phonemeLength[X-1]); +if (debug) printf("phoneme %d (%c%c) length %d\n", R, signInputTable1[phonemeindex[R]], signInputTable2[phonemeindex[R]], phonemeLength[R]); +if (debug) printf("phoneme %d (%c%c) length %d\n", R-1, signInputTable1[phonemeindex[R-1]], signInputTable2[phonemeindex[R-1]], phonemeLength[R-1]); // X gets overwritten, so hold prior X value for debug statement -int debugX = X; +int debugX = R; // shorten the prior phoneme length to (length/2 + 1) - phonemeLength[X] = (phonemeLength[X] >> 1) + 1; - X = loopIndex; + phonemeLength[R] = (phonemeLength[R] >> 1) + 1; + R = loopIndex; // also shorten this phoneme length to (length/2 +1) phonemeLength[loopIndex] = (phonemeLength[loopIndex] >> 1) + 1; @@ -1391,7 +1391,7 @@ if (debug) printf("phoneme %d (%c%c) length %d\n", debugX-1, signInputTable1[pho // R*, L*, W*, Y* // get the prior phoneme - index = phonemeindex[X-1]; + index = phonemeindex[R-1]; // prior phoneme a stop consonant> if((flags[index] & 2) != 0) { @@ -1399,13 +1399,13 @@ if (debug) printf("phoneme %d (%c%c) length %d\n", debugX-1, signInputTable1[pho if (debug) printf("RULE: - decrease by 2\n"); if (debug) printf("PRE\n"); -if (debug) printf("phoneme %d (%c%c) length %d\n", X, signInputTable1[phonemeindex[X]], signInputTable2[phonemeindex[X]], phonemeLength[X]); +if (debug) printf("phoneme %d (%c%c) length %d\n", R, signInputTable1[phonemeindex[R]], signInputTable2[phonemeindex[R]], phonemeLength[R]); // decrease the phoneme length by 2 frames (20 ms) - phonemeLength[X] -= 2; + phonemeLength[R] -= 2; if (debug) printf("POST\n"); -if (debug) printf("phoneme %d (%c%c) length %d\n", X, signInputTable1[phonemeindex[X]], signInputTable2[phonemeindex[X]], phonemeLength[X]); +if (debug) printf("phoneme %d (%c%c) length %d\n", R, signInputTable1[phonemeindex[R]], signInputTable2[phonemeindex[R]], phonemeLength[R]); } } @@ -1421,28 +1421,28 @@ if (debug) printf("phoneme %d (%c%c) length %d\n", X, signInputTable1[phonemeind void Code47503(unsigned char mem52) { - Y = 0; + S = 0; if ((mem53 & 128) != 0) { mem53 = -mem53; - Y = 128; + S = 128; } - mem50 = Y; - A = 0; - for(X=8; X > 0; X--) + mem50 = S; + B = 0; + for(R=8; R > 0; R--) { int temp = mem53; mem53 = mem53 << 1; - A = A << 1; - if (temp >= 128) A++; - if (A >= mem52) + B = B << 1; + if (temp >= 128) B++; + if (B >= mem52) { - A = A - mem52; + B = B - mem52; mem53++; } } - mem51 = A; + mem51 = B; if ((mem50 & 128) != 0) mem53 = -mem53; }