Ignore:
Timestamp:
Nov 9, 2010, 12:21:56 PM (14 years ago)
Author:
george
Message:
  • Modified: Tokenizer was using slow Text property of TStringList. Replaced by fast native string variable.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/IDE/Forms/UMainForm.pas

    r14 r20  
    7373    Project: TProject;
    7474    Compiler: TCompiler;
    75     function GetSource(Name: string; Source: TStringList): Boolean;
     75    function GetSource(Name: string; var SourceCode: string): Boolean;
    7676  end;
    7777
     
    112112end;
    113113
    114 function TMainForm.GetSource(Name: string; Source: TStringList): Boolean;
     114function TMainForm.GetSource(Name: string; var SourceCode: string): Boolean;
    115115var
    116116  FileName: string;
     117  F: TFileStream;
    117118begin
    118119  FileName := Project.GetDir(True) + Name + '.pas';
    119   if FileExists(FileName) then begin
    120     Source.LoadFromFile(FileName);
     120  if FileExists(FileName) then
     121  try
     122    F := TFileStream.Create(FileName, fmOpenRead);
     123    SetLength(SourceCode, F.Size);
     124    if F.Size > 0 then
     125      F.Read(SourceCode[1], F.Size);
    121126    Result := True;
     127  finally
     128    F.Free;
    122129  end else Result := False;
    123130end;
Note: See TracChangeset for help on using the changeset viewer.