Menu

Comments before methods in D2006

Help
sinaghino
2007-02-28
2012-07-18
  • sinaghino

    sinaghino - 2007-02-28

    I'm using D2006 and I noticed the following behavior when a new method is automatically added to the code by using ctrl+shift+c key combination:

    {
    comment for procedure A
    }
    procedure A;
    begin
    end;

    {
    comment for procedure C
    }
    procedure B;
    begin
    end;

    procedure C;
    begin
    end;

    Originally I had procedure A and C, when I add procedure B as prototype and then use ctrl+shift+c to have Delphi automatically create the actual procedure in the implementation section, the procedure B is automatically created between A and C but the comments don't follow the right procedure. So, having comments before the actual procedure doesn't seem to be the standard in D2006, having comments between "procedure" and "begin" lines work ok, however, DelphiCodeToDoc does not recognize this location. Is it easy enough to add an option to select comments before or after the method? Thanks a lot, this change (if possible) will be howsome for us and a lot of other D2005/D2006 users.

     
    • TridenT

      TridenT - 2007-03-08

      Yes, I have the same issue on my projets ...

      >>>So, having comments before the actual procedure doesn't seem to be the standard in D2006
      I've never seen another way to do !

      Writing comments between PROCEDURE and BEGIN keywords looks strange, i've never seen this, and it is not like the JavaDoc "standard".

      So, for the moment, I will not add this possibility, but I will ask CodeGear about it, I'm sure they will answer me !
      I'm sorry not to have a solution for this, I know it is very annoying.

       
      • Erik De Laet

        Erik De Laet - 2009-07-17

        >>> Writing comments between PROCEDURE and BEGIN keywords looks strange, i've never seen this, and it is not like the JavaDoc "standard". <<<

        I totally disagree. As with many things, it's all a habit, but I have been writing comments between the procedure heading and the var since I started programming in PL1 on the main frame way back.
        Writing comments between PROCEDURE and BEGIN keywords looks strange, i've never seen this, and it is not like the JavaDoc "standard".

        If you look at the following code. You will find that after a while you never have to look at the procedure or function name to find a routine, but in stead you look at the name of the routine inside the box (having spaces it's much easier and quicker to read).

        And this solves the problem with any way Borland/CodeGear or whoever is automatically formatting the source.

        My idea is that comments are an integral part of the routine itself and therefore need to be present between the beginning of the routine (procedure or function header) and the end of the routine ( the end; line). That way there never is any doubt as to which routine some comment code belongs.

        function DelString ( sSource:string ; sToRemove:string) : string;
        {___________
        |
        | 'Del String'
        |___________
        }
        var i : integer;
        begin
        i := Pos(sToRemove,sSource);
        while i > 0 do
        begin
        System.Delete(sSource,i,Length(sToRemove));
        i := Pos(sToRemove,sSource);
        end;
        Result := sSource;
        end;
        function DelText ( sSource:string ; sToRemove:string) : string;
        {___________
        | !13.05.2007
        | 'Del Text'
        |
        | Case insensitive.
        |___________
        }
        var i : integer;
        begin
        i := Included(sToRemove,sSource);
        while i > 0 do
        begin
        System.Delete(sSource,i,Length(sToRemove));
        i := Pos(sToRemove,sSource);
        end;
        Result := sSource;
        end;

         
        • TridenT

          TridenT - 2009-07-17

          Hi edelcom,

          i must admit I changed my mind since one year. I've meet many developers writing comments this way, and for good reasons.
          So today, I totally agree with you !

          that's why I've modified DelphiCodeToDoc to support comments between between PROCEDURE and BEGIN keywords. The latest version has this feature.

          thx for you comments !

           
          • Erik De Laet

            Erik De Laet - 2009-07-17

            Hi Trident,
            Thanks for answering so quickly :)
            What version is this ? I am using build 0.23 but see no comments from the implementation section inside the generated documentation.
            I do have the 'Parse implementation section (ReadOnly) check box checked.

            btw: Is there any chance that you assign short cuts to the various commands (ctrl-s for save, F9 or Ctrl-F9 for build etc ...). I have done that my self some version ago but I have to change this every time there is a new version. Also a recent file project list should be very handy in deed (because I use your program to document all of my projects).

             
            • TridenT

              TridenT - 2009-07-21

              have a look to this example !
              https://dephicodetodoc.svn.sourceforge.net/svnroot/dephicodetodoc/trunk/DelphiCodeToDoc/Test/TestFiles/CommentAfterProcedure/CommentAfterProcedure.pas

              I hope this is what your are looking for !
              Concerning shortcuts and recent file list ... well, I'm not a good user interface designer, so ... any help or advice apreciated !
              You can send me a fixed version, and I will merge it back to official version.

               
              • Erik De Laet

                Erik De Laet - 2009-07-23

                Problem is that I am still using Delphi 7 as my main development system (I don't use the Jedi components but have a subscription of the Dev.Express Delphi library).

                I do have Delphi 2009 installed so I will set that up with the Jedi components (I uninstalled Delphi 2006 recently to preserve space).

                Is there a place where I can download the daily build source codes ? I will try out the daily build of yesterday with the comment changes later today or tomorrow. But if I make changes with short cuts and the like, I might as well do it on the latest daily build, no ?

                 
                • TridenT

                  TridenT - 2009-07-23

                  Hi,

                  yes, you need Delphi2009 to compile the application.
                  To get the source code, two ways for you:
                  * Export DelphiCodeToDoc with Subversion (TortoiseSVN is perfect).
                  See https://sourceforge.net/projects/dephicodetodoc/develop

                  Ask any question if you have difficulties.

                   
                  • Erik De Laet

                    Erik De Laet - 2009-07-23

                    Hi,
                    I installed Turtoise SVN, the Jedi library and the latest daily build 0.23.1.895.
                    I added shortcuts to a lot of the menu items and actions, and added a nicer looking icon for the Tag Quality. I updated the build number to 0.23.1.896.
                    I think I posted the changes using Turtoise SVN (at least I think I have).
                    Can you plese check that you have received the latest version ?

                     
                    • TridenT

                      TridenT - 2009-07-23

                      what a quick work ;)
                      You can't commit (send changes to repository) until you are a member of DelphiCodeToDoc project.
                      So for the moment, it is not possible to send your modification this way.
                      What you can do is to send me a patch.
                      To build it, just Right-clic in the DCTD root folder and select TortoiseSVN>Create patch.
                      It will create a file with all your modifications, then you can send it to me @ trident_job@hotmail.com

                      thx for your help !

                       
    • TridenT

      TridenT - 2007-03-08

      CodeGear already had an open bug here :

      http://qc.codegear.com/wc/qcmain.aspx?d=602

      TridenT

       
    • TridenT

      TridenT - 2009-07-21

      With your example below :
      function DelString ( sSource:string ; sToRemove:string) : string;
      {___________
      |
      | 'Del String'
      |___________
      }
      ...

      To enable JavaDoc, you have two choice.
      Add the standard JavaDoc prefix ('*' character) inside your comments, so your code will be :

      function DelString ( sSource:string ; sToRemove:string) : string;
      {*___________
      |
      | 'Del String'
      |____________}
      ...

      or, you can setup DelphiCodeToDoc to change the JavaDoc prefix from '*' to '_', so your code will be documented this time.

      Does it solves your issue ?

       

Log in to post a comment.