<aspect xmlns:src="http://www.sdml.info/srcML/src" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:cpp="http://www.sdml.info/srcML/cpp" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://control.ee.ethz.ch/XWeaver/AspectX" xsi:schemaLocation="http://control.ee.ethz.ch/XWeaver/AspectX ../../../../src/xsd/aspectX.xsd" name="AddFunctionComment_2">

 
<description>Sample aspect program to modify a function comment. This aspect program defines a text fragment that can be
 added to the comment of a set of target functions. The target functions are defined through the return type. The target functions are
 those that have return type 
<code>void</code>.
 A related aspect program (
<code>AddFunctionComment_1</code>) shows an alternative way to modify function comments.
 
<author>I. Birrer</author>
 
<see>AddFunctionComment_1</see>
 
</description>
 
    
<pointcut name="targetFunction" type="src:function" constraint="src:type/src:name='void'">
          
<description>Points to the target functions whose comment should be modified. The target functions are 
          identified as follows. In srcML, functions are described by a 
<code>function</code> 
          element which have a subelement called 
<code>type</code> which
          holds the return type of the function. The type of the function is itself enclosed 
          by a 
<code>name</code> element. The target 
          functions are identified using an XPath expression that identifies all function elements which
          have the return type 
<code>void</code>.</description>
     
</pointcut>


    
<pointcut name="targetFunctionComment" type="src:comment">
            
<description>Points to the comments that must be modified. These comments are defined as the comments that are 
            followed by the 
<code>targetFunction</code> pointcut. </description>
            
<restriction type="followedBy">
              
<pointcutRef type="src:function" ref="targetFunction" />
            
</restriction>
     
</pointcut>


     
<advice name="addFunctionComment" type="end">
           
<description>Add a comment at the end of the comment of the target function. A <code>CDATA</code> section is used in order to allow use of
           HTML tags in the comment text. Aspect program 
<code>AddFunctionComment_1</code> shows an alternative way to express the HTML tag.</description>
          
<pointcutRef ref="targetFunctionComment" type="src:comment" />
          
<codeModifier type="comment">
            
<text>&lt;p&gt;
This comment fragment was automatically inserted by an aspect program. The name of the aspect 
program is: &lt;code&gt;AddFunctionComment_2&lt;/code&gt;.&lt;/p&gt;
</text>
          
</codeModifier>
      
</advice>
</aspect>






































v