$ent->comments()

Syntax

$ent->comments( [$style [,$format [,$refkindstring]]] ) 

Description

Returns a formatted string based on the comments associated with an entity. Only the C and Ada versions of Understand currently store information about associated comments.

Arguments

The optional argument $style specifies which comments are to be used. By default, comments after the entity declaration are processed. The valid values for $style are:

Argument Values
Description
after
Process comments after the entity declaration. (This is the default.)
before
Process comments before the entity declaration.
longest
Process “before” or “after” comments, whichever are longest.

The optional argument $format is used to specify what kind of formatting, if any, is applied to the comment text. The valid values for $format are shown in the following table:

Argument Values
Description
<no value>
Removes comment characters and certain repeating characters, while retaining the original newlines. (This is the default.)
raw
Return an array of comment strings in original format, including comment characters.

If the optional $refkindstring argument is specified, it should be a language-specific reference filter string. See Entity and Reference Kinds for lists of kinds.

Example

@funcs = $db->ents("function ~unresolved ~unknown, 
                   procedure"); 
foreach $func (sort {lc($a->longname()) cmp 
                     lc($b->longname());} @funcs) { 
  if ($func->library() ne "Standard") { 
    $comment = $func->comments("before"); 
    if ($comment) { 
        print "-----\n"; 
        print $func->longname(),":\n"; 
        print $comment,"\n"; 
        print "-----\n\n"; 
    } 
  } 
} 

Scientific Toolworks, Inc.
http://www.scitools.com