ça devrait pas être trop mal, même si ya quelques trucs à rajouter, on va partir avec ça
AssembleCurrentSource (CurrentSource)
{
IsInstruction = 0;
Instruction.w = 0;
Size.w = 0
Arg1.l = 0;
Arg2.l = 0;
SkipFirstChar;
if (EOF)
{
if (IAmAMacro)
exit (ErrorNoEndmDirective);
return;
}
if (SomethingIsAtBeginningOfLine)
{
if (Comment)
{
SkipLine ();
Loop;
}
if (SymbolIsValid)
{
AddLabel ();
}
}
else // Line begins with a white space / tab
{
SkipSpaces ();
if (EOF)
{
if (IAmAMacro)
exit (ErrorNoEndmDirective);
}
// We should find an instruction, a directive, a macro, a macro argument or a comment
if (symbol = IsInstruction)
{
IsInstruction == true;
Instruction = symbol;
if (InstructionHas1Arg)
Arg1 = ReadArg();
if (InstructionHas2Args)
Arg2 = ReadArg ();
}
else if (symbol = IsDirective)
{
ExecDirective (symbol);
}
else if (IsArgOfMacro)
{
if (!IAmAMacro)
exit (ErrorMacroArgOutOfAMacro);
AddParentMacroFileInFilesList ();
...
}
else if (Comment)
{
SkipLine ();
Loop;
}
else // This must be a macro
{
if (FindMacro (symbol))
{
AddFileOfMacroInFilesList (); // Replace current source with the one which contains the macro
AssembleCurrentSource (); // Use a setjmp here. endm directive will come back with a longjmp
RemoveLastSource ();
}
else
{
exit (ErrorUnknownSymbol);
}
}
}
}