<aspect xmlns:src="http://www.sdml.info/srcML/src" 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="AllFunctionBeginCodeFragment">
  
<description>
      This aspect tests weaving rule 
<code>function_begin_codeFragment</code>. Besides the 
      weaving rule it also tests various pointcuts.
      
<author>O. Rohlik</author>
  
</description>
  
  
<advice type="begin" name="allFunctions">
      
<description>
          This advice inserts a single line comment to all functions.
      
</description>
    
<pointcut type="src:function" />
    
<codeModifier type="codeFragment">
        
<text>/* 1: This is codeFragment added by advice "allFunctions" */</text>
    
</codeModifier>
  
</advice>
 
  
<!-- First there will be the 'src:name' element -->
  
<advice type="begin" name="givenFunctionsInAllClasses">
      
<description>
          This advice inserts a single line comment to all methods
          with name 
<code>fOneParameter</code>.
      
</description>
        
<!-- Just 'name' gives the name incl. the class name => now it is name/name[2]-->  
        
<pointcut type="src:function" constraint="substring-after(src:name,'::')='fOneParameter'" />     
        
<codeModifier type="codeFragment">
            
<text>/* 2: This is codeFragment added by advice givenFunctionsInAllClasses to function definitions of class ${functionName} (= fOneParameter) */</text>
        
</codeModifier>
  
</advice>
  
  
<advice type="begin" name="allFunctionsOfGivenClass">
      
<description>
          This advice inserts a single line comment to all methods
          of class 
<code>Base</code>.
      
</description>
      
<pointcut type="src:function" constraint="substring-before(src:name,'::')='Base'" /> <!-- Just 'name' gives the name incl. the class name -->
      
<codeModifier type="codeFragment">
          
<text>/* 3: This is codeFragment added by advice allFunctionsOfGivenClass to function definitions of class ${className} (= Base) */</text>
      
</codeModifier>
  
</advice>
  
  
    
<advice type="begin" name="aFunctionOfGivenClass">
      
<description>
          This advice inserts a single line comment to method
          
<code>fOneParameter</code> of class <code>Base</code>.
      
</description>
      
<pointcut type="src:function" constraint="src:name='Base::fOneParameter'" /> <!-- Just 'name' gives the name incl. the class name -->
      
<codeModifier type="codeFragment">
          
<text>/* 4: This is codeFragment added by advice allFunctionsOfGivenClass to function definitions of class ${className} (= Base) */</text>
      
</codeModifier>
  
</advice>
  
  
<!-- Second there will be the 'src:type' element -->
  
<advice type="begin" name="intReturnValue">
      
<description>
          This advice inserts a single line comment to all methods that 
          returns type 
<code>int</code>.
      
</description>
      
<pointcut type="src:function" constraint="src:type = 'int'" />
      
<codeModifier type="codeFragment">
          
<text>/* 5: This is codeFragment added by advice intReturnValue to function definitions of type ${functionType} (= int) -- i.e. to functions that return int */</text>
      
</codeModifier>
  
</advice>
  
  
<advice type="begin" name="pointerReturnValue">
      
<description>
          This advice inserts a single line comment to all methods that 
          returns pointer. Such method are identified as those whose
          type contains character '*'. srcML is not powerful enough 
          to report user defined data type of type pointer.
      
</description>
      
<pointcut type="src:function" constraint="contains(src:type,'*')" />
      
<codeModifier type="codeFragment">
          
<text>/* 6: This is codeFragment added by advice pointerReturnValue to function definitions that return pointers */</text>
      
</codeModifier>
  
</advice> 
   
</aspect>






































v