Einzelnen Beitrag anzeigen

Koma-Code
(Gast)

n/a Beiträge
 
#1

SC-Tool: Zur Quelltextformatierung

  Alt 7. Jun 2005, 17:38
Hi,

ich habe mir ein kleines Tool geschrieben, welches den Quelltext automatisch
formatiert.

Ich habe die Formatierungsart sehr an meinen Stil angepaßt und hoffe dass es
Fehlerfrei funktioniert.

Die Quelltextinformationen (wie oft procedure, function vorkommt, wieviel Zeichen das Projekt hat, ...) sind sehr langsam, bei langen Texten!

Ein Formatierungsbeispiel:


Delphi-Quellcode:
procedure Execute (test: String);
var
e, f : Integer;
TempList : TStringList;

begin
TempList := TStringList.Create;
TempList.Clear;
 
For e := 0 to 10 Do
if e < 0 then TempList.Add ('test');
 
For e := 0 to 10 Do
if e < 0 then
TempList.Add ('test');
 
For e := 0 to 10 Do
begin
 if e < 0 then
begin
TempList.Add ('test');
end
else
begin
TempList.Add ('test');
end;
 
if e <0 then f := 4
else f:=5;
end;
end;
zu

Delphi-Quellcode:
procedure Execute (test: String);
var
 e, f : Integer;
 TempList : TStringList;
 
begin
 TempList := TStringList.Create;
 TempList.Clear;
  
 For e := 0 to 10 Do
  if e < 0 then TempList.Add ('test');
  
 For e := 0 to 10 Do
  if e < 0 then
   TempList.Add ('test');
  
 For e := 0 to 10 Do
  begin
   if e < 0 then
    begin
     TempList.Add ('test');
    end
   else
    begin
     TempList.Add ('test');
    end;
    
   if e <0 then f := 4
    else f:=5;
  end;
end;

Download (ca. 300 kb):
www.koma-code.de/ProgsZip/SC_Tool.zip


Grüße,

KM

[edit=alcaeus]Delphi- statt Code-Tags verwendet. Mfg, alcaeus[/edit]
  Mit Zitat antworten Zitat