~ubuntu-branches/ubuntu/wily/aspectc++/wily

« back to all changes in this revision

Viewing changes to AspectC++/tests/Result/PointerTracker.ah

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2005-12-23 10:49:40 UTC
  • Revision ID: james.westby@ubuntu.com-20051223104940-ig4klhoi991zs7km
Tags: upstream-0.99+1.0pre2
ImportĀ upstreamĀ versionĀ 0.99+1.0pre2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef __PointerTracker_ah__
 
2
#define __PointerTracker_ah__
 
3
 
 
4
#include <stdio.h>
 
5
 
 
6
aspect PointerTracker {
 
7
  advice call ("% ...::%(...)") && result("% *") : before () {
 
8
    printf ("  call to '%s'\n", tjp->signature ());
 
9
  }
 
10
 
 
11
  advice execution ("% ...::%(...)") && result("% *") : after () {
 
12
    printf ("  executed '%s' -> 0x%lu\n", tjp->signature (),
 
13
                                     (unsigned long)*(void**)tjp->result ());
 
14
  }
 
15
 
 
16
  advice call ("% %(...)") && result(res) : after (long **res) {
 
17
    printf ("  result after call: 0x%lu\n", (unsigned long)res);
 
18
  }
 
19
};
 
20
 
 
21
aspect ResultManipulator {
 
22
  advice call ("% select_v()") && result ("int &") : after () {
 
23
    static int new_result = 815;
 
24
    JoinPoint::Result * result = tjp->result ();
 
25
    printf ("  changing result! now: %d\n", **result);
 
26
    *result = &new_result;
 
27
  }
 
28
};
 
29
 
 
30
#endif // __PointerTracker_ah__