~ubuntu-branches/ubuntu/maverick/aspectc++/maverick

« back to all changes in this revision

Viewing changes to AspectC++/tests/Bug316/main.cc

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2008-04-10 17:40:52 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20080410174052-xdnsm7oi8hauyyf1
Tags: 1.0pre4~svn.20080409+dfsg-3
Fix another missing include, this time in Ag++/StdSystem.cc

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <stdio.h>
 
2
 
 
3
class X {
 
4
    struct Y; // this one is private!
 
5
public:
 
6
    static void fx();
 
7
};
 
8
 
 
9
struct X::Y {
 
10
    void fy(Y *arg);
 
11
};
 
12
 
 
13
// this is a member of a private class, thus Y cannot be used in TJP so far
 
14
void X::Y::fy(Y *arg) {
 
15
 
16
 
 
17
// this function may call fy
 
18
void X::fx () {
 
19
    Y y;
 
20
    y.fy (&y);
 
21
}
 
22
 
 
23
aspect Bug316 {
 
24
  advice execution ("% ...::f%(...)") : around () {
 
25
    printf ("e1: before %s\n",JoinPoint::signature ());
 
26
    tjp->proceed ();
 
27
    printf ("e1: after %s\n",JoinPoint::signature ());
 
28
  }
 
29
  advice execution ("% ...::f%(...)") : around () {
 
30
    printf ("e2: before %s\n",JoinPoint::signature ());
 
31
    tjp->proceed ();
 
32
    printf ("e2: after %s\n",JoinPoint::signature ());
 
33
  }
 
34
  // this call advice still does not work!
 
35
//   advice call ("% ...::f%(...)") : around () {
 
36
//     printf ("c1: before %s\n",JoinPoint::signature ());
 
37
//     tjp->proceed ();
 
38
//     printf ("c1: after %s\n",JoinPoint::signature ());
 
39
//   }
 
40
//   advice call ("% ...::f%(...)") : around () {
 
41
//     printf ("c2: before %s\n",JoinPoint::signature ());
 
42
//     tjp->action ().trigger ();
 
43
//     printf ("c2: after %s\n",JoinPoint::signature ());
 
44
//   }
 
45
};
 
46
 
 
47
int main () {
 
48
    X::fx ();
 
49
    return 0;
 
50
}
 
51
 
 
52
// moegliche Loesung ...
 
53
 
 
54
// #include <stdio.h>
 
55
 
 
56
// template <int>
 
57
// struct TJP {};
 
58
 
 
59
 
 
60
// class X {
 
61
//     template <int> friend struct TJP;
 
62
//     struct Y; // this one is private!
 
63
// public:
 
64
//     static void fx();
 
65
// };
 
66
 
 
67
// struct X::Y {
 
68
//     void old_fy();
 
69
//     void fy();
 
70
// };
 
71
 
 
72
// template <> struct TJP<1> {
 
73
//     typedef X::Y That;
 
74
//     typedef X::Y Target;
 
75
//     X::Y *_that;
 
76
//     X::Y *that () { return _that; }
 
77
//     X::Y *target () { return 0; }
 
78
//     static const char *signature () { return "X::Y::fy"; }
 
79
//     void proceed () { _that->old_fy (); }
 
80
// };
 
81
 
 
82
// template <typename JP> void adv (JP *tjp) {
 
83
//     printf ("before %s\n", JP::signature ());
 
84
//     tjp->proceed ();
 
85
// }
 
86
 
 
87
// // this is a member of a private class, thus Y cannot be used in TJP so far
 
88
// void X::Y::fy() {
 
89
//     TJP<1> tjp = { this };
 
90
//     adv< TJP<1> >(&tjp);
 
91
// } 
 
92
// // this is a member of a private class, thus Y cannot be used in TJP so far
 
93
// void X::Y::old_fy() {
 
94
//     printf ("X::Y::old_fy\n");
 
95
// } 
 
96
 
 
97
// // this function may call fy
 
98
// void X::fx () {
 
99
//     Y y;
 
100
//     y.fy ();
 
101
// }
 
102
 
 
103
// int main () {
 
104
//     X::fx ();
 
105
//     return 0;
 
106
// }