Press enter to see results or esc to cancel.

Compilation Progress and Status Display

During the compilation Turbo Pascal displays current module and source line number (if command line switch for quiet compilation was not used).

Procedure WriteCompilationProgress (LastFile: PFileStructure);
begin
  If QuietCompile then Exit;
  If LastFile = @EndOfFileStructure then Exit;
  WriteModuleNameWithCurrentLineNumber (LastFile);
  Asm
    MOV AH, $0B
    INT $21
    CLD
  end
end;

This procedure checks if there is enough memory for stack and writes compilation progress. It is called before moving to the next token and before processing each statement.

Procedure CheckStack;
begin
  If (SPtr - $200) < StackLimit then Error (InternalStackOverflow);
  If QuietCompile then Exit;
  If InterruptCounter - StatusReportInterruptCounter < 5 then Exit;
  StatusReportInterruptCounter := InterruptCounter;
  WriteCompilationProgress (CurrentSourceFile);
end;

This procedure wites current module name and source line number. Since the text is displayed on the same line the procedure also overwrites the remaining old text with spaces. Error reporting also uses this procedure.

Procedure WriteModuleNameWithCurrentLineNumber (LastFile: PFileStructure);
Var StringDifference: Integer;
    LineNumberStr: String [10];
    N: Byte;
begin
  If LastStringLength <> 0 then Write (#13);
  Str (LastFile^.CurrentLineNumber, LineNumberStr);
  Write (PChar (@LastFile^.Name.Chr), '(', LastFile^.CurrentLineNumber, ')');
  StringDifference := LastStringLength - (Length (LineNumberStr) + LastFile^.Name.Len + 2);
  LastStringLength := Length (LineNumberStr) + LastFile^.Name.Len + 2;
  If StringDifference <= 0 then Exit;
  For N := 1 to StringDifference do Write (' ');
  For N := 1 to StringDifference do Write (#8);
end;

At the end of successful compilation Turbo Pascal reports the time taken to compile and the size of the compiled program.

Procedure WriteCompilationStatus;
Const TimeConstant = 1 / 1.82064673;
Var   Time: Longint;
begin
  Write (LineCounter, ' lines, ');
  Time := Round (TimeConstant * (StopCounter - StartCounter));
  If Time <> 0 then Write (Time div 10, '.', Time mod 10, ' seconds, ');
  Writeln (CodeBytes, ' bytes code, ', DataBytes, ' bytes data.');
  Asm
    MOV AH, $0B
    INT $21
    CLD
  end
end;

This procedure is called when Turbo Pascal finishes compiling a module.

Procedure WritelnModuleNameWithCurrentLineNumber (LastFile: Pointer);
begin
  If QuietCompile then Exit;
  WriteModuleNameWithCurrentLineNumber (LastFile);
  Writeln;
  Asm
    MOV AH, $0B
    INT $21
    CLD
  end
end;