Menu

#53 add comments to blocks

open
nobody
5
2008-01-29
2008-01-29
No

Years ago I found a formatting tool for normal borland pascal that did something I really got used to.
It adds comments to block structures as shown in the example :

PROCEDURE Tmyclass.myproc(Sender: TObject);

BEGIN { PROCEDURE Tmyclass.myproc }
CASE marker OF
$25 :
BEGIN
code here
END;{ CASE marker OF $25: }
$45 :
BEGIN
code here
END;{ CASE marker OF $45: }
$85 :
BEGIN
code here
END;{ CASE marker OF $85: }
END;{ CASE marker }
END;{ PROCEDURE Tmyclass.myproc }

This goes for any block as if / then / else etc.

The comments are set in {}, these comments are deleted when the source code is prepared for converting.

Discussion

  • Werner Teichert

    Werner Teichert - 2008-01-29

    Logged In: YES
    user_id=1994679
    Originator: YES

    Sorry, the formatting is not shown correctly.
    Werner

     
  • Nobody/Anonymous

    Logged In: NO

    Yes! I'm voting for this feature.! There is example of our code. It would be great if this will be automatic.
    Possible block comments (behing "end") are:

    {if ... begin}
    {for ... begin}
    {while ... begin}
    {case}
    {else ... begin}
    {try ... finally}
    {try ... except}

    function TRswSQLDatabase.TableExists(const TableName: WideString): Boolean;
    var
    TempTableNames: TStringList;
    begin
    Result := True;
    try
    ConnectToDatabase;
    TempTableNames := TStringList.Create;
    try
    FConnection.GetTableNames(TempTableNames, False);
    if TempTableNames.IndexOf(TableName) < 0 then
    Result := False;
    finally
    TempTableNames.Free;
    end;{try ... finally}
    except
    Result := False;
    end;{try ... except}
    end;{TableExists}

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.