static int checkAttr (const widechar c,
const TranslationTableCharacterAttributes a, int nm);
static int putCharacter (widechar c);
-static int makeCorrections (void);
-static int passDoTest (void);
-static int passDoAction (void);
+static int makeCorrections ();
+static int passDoTest ();
+static int passDoAction ();
static int passVariables[NUMVAR];
static int passCharDots;
static int passSrc;
static int *inputPositions;
static int cursorPosition;
static int cursorStatus;
+static const TranslationTableRule **appliedRules;
+static int maxAppliedRules;
+static int appliedRulesCount;
static TranslationTableCharacter *
findCharOrDots (widechar c, int m)
}
static int
-findAttribOrSwapRules (void)
+findAttribOrSwapRules ()
{
int save_transCharslen = transCharslen;
const TranslationTableRule *save_transRule = transRule;
}
static int
-makeCorrections (void)
+makeCorrections ()
{
- int k;
if (!table->corrections)
return 1;
src = 0;
dest = 0;
srcIncremented = 1;
- for (k = 0; k < NUMVAR; k++)
- passVariables[k] = 0;
+ memset (passVariables, 0, sizeof(int) * NUMVAR);
while (src < srcmax)
{
int length = srcmax - src;
currentOutput[dest++] = currentInput[src++];
break;
case CTO_Correct:
+ if (appliedRules != NULL && appliedRulesCount < maxAppliedRules)
+ appliedRules[appliedRulesCount++] = transRule;
if (!passDoAction ())
goto failure;
if (endReplace == src)
break;
}
}
+
+ { // We have to transform typebuf accordingly
+ int pos;
+ unsigned short *typebuf_temp;
+ if ((typebuf_temp = malloc (dest * sizeof (unsigned short))) == NULL)
+ outOfMemory ();
+ for (pos = 0; pos < dest; pos++)
+ typebuf_temp[pos] = typebuf[srcMapping[pos]];
+ memcpy (typebuf, typebuf_temp, dest * sizeof (unsigned short));
+ free (typebuf_temp);
+ }
+
failure:
realInlen = src;
return 1;
}
static int
-matchcurrentInput (void)
+matchCurrentInput ()
{
int k;
int kk = passSrc;
static widechar groupingOp;
static int
-replaceGrouping (void)
+replaceGrouping ()
{
widechar startCharDots = groupingRule->charsdots[2 * passCharDots];
widechar endCharDots = groupingRule->charsdots[2 * passCharDots + 1];
}
static int
-removeGrouping (void)
+removeGrouping ()
{
widechar startCharDots = groupingRule->charsdots[2 * passCharDots];
widechar endCharDots = groupingRule->charsdots[2 * passCharDots + 1];
static int searchSrc;
static int
-doPassSearch (void)
+doPassSearch ()
{
int level = 0;
int k, kk;
}
static int
-passDoTest (void)
+passDoTest ()
{
int k;
int not = 0;
- TranslationTableOffset ruleOffset;
- TranslationTableRule *rule;
- TranslationTableCharacterAttributes attributes;
+ TranslationTableOffset ruleOffset = 0;
+ TranslationTableRule *rule = NULL;
+ TranslationTableCharacterAttributes attributes = 0;
groupingRule = NULL;
passSrc = src;
passInstructions = &transRule->charsdots[transCharslen];
continue;
case pass_string:
case pass_dots:
- itsTrue = matchcurrentInput ();
+ itsTrue = matchCurrentInput ();
passSrc += passInstructions[passIC + 1];
passIC += passInstructions[passIC + 1] + 2;
break;
}
static int
-passDoAction (void)
+passDoAction ()
{
int k;
- TranslationTableOffset ruleOffset;
- TranslationTableRule *rule;
+ TranslationTableOffset ruleOffset = 0;
+ TranslationTableRule *rule = NULL;
if ((dest + startReplace - startMatch) > destmax)
return 0;
if (transOpcode != CTO_Context)
}
static int
-checkDots (void)
+checkDots ()
{
int k;
int kk = src;
}
static void
-passSelectRule (void)
+passSelectRule ()
{
int length = srcmax - src;
const TranslationTableCharacter *dots;
}
static int
-translatePass (void)
+translatePass ()
{
- int k;
prevTransOpcode = CTO_None;
src = dest = 0;
srcIncremented = 1;
- for (k = 0; k < NUMVAR; k++)
- passVariables[k] = 0;
+ memset (passVariables, 0, sizeof(int) * NUMVAR);
while (src < srcmax)
{ /*the main multipass translation loop */
passSelectRule ();
case CTO_Pass2:
case CTO_Pass3:
case CTO_Pass4:
+ if (appliedRules != NULL && appliedRulesCount < maxAppliedRules)
+ appliedRules[appliedRulesCount++] = transRule;
if (!passDoAction ())
goto failure;
if (endReplace == src)