Chip,

I wrote some code to do that for Foundation it relies on some discipline in
creating your header comments of course.

<macro name="FHead">
<text>// ----------------------------------------------------
// Project Method: <method_name/> --> ReturnType
// Description
// Access: Shared
// Parameters:
//   $1 : Type : Description
//   $x : Type : Description (optional)

// Returns:
//   $0 : Type : Description

// Created by Wayne Stewart (<date format="9"/>)
//     [email protected]
// ----------------------------------------------------
</text>
</macro>

   // ----------------------------------------------------
   // Project Method: Fnd_Shell_WriteComments {(Method Name; Do not use)}

   // This method will create documentation comments
   //   it is based on the assumption that you format your
   //    method header comments in the same manner as Foundation
   //  The second paramater is just used to trigger the method
   //   starting in a new process, you should not pass anything in this
parameter

   // Access: Shared

   // Parameters:
   //   $1 : Text : Either pass
   //       (a) "" - All methods (or don't pass any parameters)
   //       (b) "Prefix" - Only methods which match a prefix (Eg. Fnd_Art)
   //       (c) "Specific method name" - write comments for that method
   //   $2 : Longint : Do not use this

   // Created by Wayne Stewart
   // ----------------------------------------------------

C_TEXT($1)
C_LONGINT($2)

C_LONGINT($CurrentMethod_i;$NumberOfMethods_i;$Position_i;$ProcessID_i;$StackSize_i)
C_TEXT($FirstChars_t;$MethodCode_t;$MethodName_t;$ThreadSafe_t;$ThreadSafeSection_t)
C_OBJECT($Attributes_o)

ARRAY TEXT($MethodCode_at;0)
ARRAY TEXT($MethodNames_at;0)

If (False)
   C_TEXT(Fnd_Shell_WriteComments ;$1)
   C_LONGINT(Fnd_Shell_WriteComments ;$2)
End if


$StackSize_i:=0

If (Count parameters=2)

   METHOD GET PATHS(Path project method;$MethodNames_at)

   $MethodName_t:=$1

   If (Length($MethodName_t)>0)  //  A method name or prefix has been
specified

     $NumberOfMethods_i:=Count in array($MethodNames_at;$MethodName_t)

     If ($NumberOfMethods_i=1)  // exactly one match (use this specific
method)
       APPEND TO ARRAY($MethodNames_at;$MethodName_t)
     Else

       $NumberOfMethods_i:=Size of array($MethodNames_at)
       For ($CurrentMethod_i;$NumberOfMethods_i;1;-1)  // Go Backwards
         If ($MethodNames_at{$CurrentMethod_i}=($MethodName_t+"@"))
         Else
           DELETE FROM ARRAY($MethodNames_at;$CurrentMethod_i)
         End if

       End for

     End if

   End if

   $NumberOfMethods_i:=Size of array($MethodNames_at)

   METHOD GET CODE($MethodNames_at;$MethodCode_at)

   ARRAY TEXT($MethodComments_at;$NumberOfMethods_i)

   For ($CurrentMethod_i;1;$NumberOfMethods_i)
     $MethodCode_t:=$MethodCode_at{$CurrentMethod_i}

     $Position_i:=Position("comment added and reserved by
4D.\r";$MethodCode_t)

     $MethodCode_t:=Substring($MethodCode_t;$Position_i+Length("comment
added and reserved by 4D.\r"))

       //  Threadsafe?
     METHOD GET ATTRIBUTES($MethodNames_at{$CurrentMethod_i};$Attributes_o)
     $ThreadSafe_t:=OB Get($Attributes_o;"preemptive")

     Case of
       : ($ThreadSafe_t="capable")
         $ThreadSafeSection_t:="\rPreemptive\r"

       : ($ThreadSafe_t="incapable")
         $ThreadSafeSection_t:="\rCooperative\r"

       : ($ThreadSafe_t="indifferent")
         $ThreadSafeSection_t:="\rPreemptive capable\r"

     End case

     $MethodCode_t:=Replace string($MethodCode_t;"\r  // Access:
Shared\r";"\r  // Access: Shared\r"+$ThreadSafeSection_t)
     $MethodCode_t:=Replace string($MethodCode_t;"\r  // Access:
Private\r";"\r  // Access: Shared\r"+$ThreadSafeSection_t)

       //  End Threadsafe section

     $MethodCode_t:=Replace string($MethodCode_t;"  //
----------------------------------------------------\r";"")
     $MethodCode_t:=Replace string($MethodCode_t;"//
----------------------------------------------------\r";"")

     $MethodCode_t:=Replace string($MethodCode_t;"  // Project Method: ";"")
     $MethodCode_t:=Replace string($MethodCode_t;"// Project Method: ";"")

     $MethodCode_t:=Replace string($MethodCode_t;"  // ";"")
     $MethodCode_t:=Replace string($MethodCode_t;"// ";"")

     $Position_i:=Position("Created by";$MethodCode_t)

     $MethodCode_t:=Substring($MethodCode_t;1;($Position_i-3))

     $FirstChars_t:=Substring($MethodCode_t;1;2)
     While ($FirstChars_t="\r\r")
       $MethodCode_t:=Substring($MethodCode_t;2)
       $FirstChars_t:=Substring($MethodCode_t;1;2)
     End while

     $MethodComments_at{$CurrentMethod_i}:=$MethodCode_t

   End for

   METHOD SET COMMENTS($MethodNames_at;$MethodComments_at)

Else

   If (Count parameters=1)
     $MethodName_t:=$1
   Else
     $MethodName_t:=""
   End if

     // This version allows for any number of processes
     // $ProcessID_i:=New Process(Current method name;$StackSize_i;Current
method name;0)

     // On the other hand, this version allows for one unique process
   $ProcessID_i:=New process(Current method name;$StackSize_i;Current method
name;$MethodName_t;0;*)

   RESUME PROCESS($ProcessID_i)
   SHOW PROCESS($ProcessID_i)
   BRING TO FRONT($ProcessID_i)
End if


Regards,

Wayne


Wayne Stewart
about.me/waynestewart




On Tue, 8 May 2018 at 07:40, Dani Beaubien via 4D_Tech
<[email protected]>
wrote:

> Hi Chip,

> You can use "METHOD SET COMMENTS” to set the method comments using code.

> I actually use that call in my Code Analysis component. I have a feature
that will look at each method, grab the comment lines at the top of the
method until it hits a line that is not a comment, and then put those
comments into the method comments using "METHOD SET COMMENTS”. Really
useful for ensuring all the shared methods in a component have a comment
can then be seen as a tip in a host database.

> The Code Analysis component can be grabbed from here. Source code is
there as well.
> http://openroaddevelopment.com/downloads.html

> Dani


> > On May 7, 2018, at 3:04 PM, Chip Scheide via 4D_Tech <
[email protected]> wrote:
> >
> > I have not looked into this much...
> > Is there a way in code to access the method comments (form the Explorer
> > Pane)?
> >
> > I would like to be able to, as a start, copy the actual method header
> > comments into this area.
> >
> > any info appreciated.
> >
> > Thanks
> > Chip
> >
> > ---------------
> > Gas is for washing parts
> > Alcohol is for drinkin'
> > Nitromethane is for racing
> > **********************************************************************
> > 4D Internet Users Group (4D iNUG)
> > FAQ:  http://lists.4d.com/faqnug.html
> > Archive:  http://lists.4d.com/archives.html
> > Options: https://lists.4d.com/mailman/options/4d_tech
> > Unsub:  mailto:[email protected]
> > **********************************************************************

> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:[email protected]
> **********************************************************************
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to