Debian Codegraph @

AspectC++/doc/CompilerManual/aspectc++ code transformation/acc-examples/pointcut_functions.acc

raw
1 #line 1 "pointcut_function/main.cc"
2 #ifndef __ac_FIRST__home_Tom_aspectcX43X43__
3 #define __ac_FIRST__home_Tom_aspectcX43X43__
4 #define __ac_FIRST_FILE__home_Tom_aspectcX43X43_pointcut_function_main_cc__
5 #ifndef __ac_have_predefined_includes__
6 #define __ac_have_predefined_includes__
7 #endif // __ac_have_predefined_includes__
8
9 #ifndef __ac_h_
10 #define __ac_h_
11 #ifdef __cplusplus
12 namespace AC {
13 typedef const char* Type;
14 enum JPType { CALL = 262144, EXECUTION = 16777216, CONSTRUCTION = 33554432, DESTRUCTION = 67108864 };
15 enum Protection { PROT_NONE, PROT_PRIVATE, PROT_PROTECTED, PROT_PUBLIC };
16 enum Specifiers { SPEC_NONE = 0x0 , SPEC_STATIC = 0x1, SPEC_MUTABLE = 0x2, SPEC_VIRTUAL = 0x4 };
17 struct Action {
18 void **_args; void *_result; void *_entity; void *_target; void *_that; void *_fptr;
19 void (*_wrapper)(Action &);
20 inline void trigger () { _wrapper (*this); }
21 };
22 template <typename T> struct ResultBuffer {
23 char _data[sizeof (T)];
24 void operator = (const T& t) { *this = (const ResultBuffer &)t; }
25 };
26 template <typename T, typename N> struct TL {
27 typedef T type; typedef N next; enum { ARGS = next::ARGS + 1 };
28 };
29 struct TLE { enum { ARGS = 0 }; };
30 template <typename T> struct Referred { typedef T type; };
31 template <typename T> struct Referred<T &> { typedef T type; };
32 template <typename TL, int I> struct Arg {
33 typedef typename Arg<typename TL::next, I - 1>::Type Type;
34 typedef typename Referred<Type>::type ReferredType;
35 };
36 template <typename TL> struct Arg<TL, 0> {
37 typedef typename TL::type Type;
38 typedef typename Referred<Type>::type ReferredType;
39 };
40 template <typename T> int ttest(...);
41 template <typename T> char ttest(typename T::__TI const volatile *);
42 template<typename T> struct HasTypeInfo {
43 enum { RET=((sizeof(ttest<T>(0))==1)?1:0) };
44 };
45 template<typename T, int HAVE = HasTypeInfo<T>::RET> struct TypeInfo {
46 enum { AVAILABLE = 0, BASECLASSES = 0, MEMBERS = 0, FUNCTIONS = 0,
47 CONSTRUCTORS = 0, DESTRUCTORS = 0 };
48 typedef T That;
49 };
50 template<typename T> struct TypeInfo<T, 1> : T::__TI {
51 enum { AVAILABLE = 1 };
52 };
53 template<typename T> struct RT {};
54 template<typename T> RT<T> rt_deduce (const T&) { return RT<T>(); }
55 template<typename T> RT<T> rt_deduce (const volatile T&) { return RT<T>(); }
56 struct Cnv { template<typename T> operator RT<T>() const { return RT<T>(); }};
57 #define __AC_TYPEOF(expr) (1?AC::Cnv():AC::rt_deduce(expr))
58 template <class Aspect, int Index>
59 struct CFlow {
60 static int &instance () {
61 static int counter = 0;
62 return counter;
63 }
64 CFlow () { instance ()++; }
65 ~CFlow () { instance ()--; }
66 static bool active () { return instance () > 0; }
67 };
68
69 #ifdef __acdef_float
70 template <typename BASE, int ID=0> struct _FloatN {
71 BASE val;
72 _FloatN() {}
73 _FloatN(const BASE& v) : val(v) {}
74 operator BASE() const { return val; }
75 };
76 #endif
77 }
78
79 #ifdef __acdef_float
80 typedef AC::_FloatN<float> _Float32;
81 typedef AC::_FloatN<double> _Float32x;
82 typedef AC::_FloatN<long double, 0> _Float64;
83 typedef AC::_FloatN<long double, 1> _Float128;
84 typedef AC::_FloatN<long double, 2> _Float64x;
85 #endif
86
87 #if defined(__acweaving) && defined(__ARM_NEON)
88 typedef __attribute__ ((__neon_vector_type__ (4))) float __Float32x4_t;
89 typedef __attribute__ ((__neon_vector_type__ (2))) double __Float64x2_t;
90 #endif
91 #endif // __cplusplus
92 #endif // __ac_h_
93 class Example;
94 #endif // __ac_FIRST__home_Tom_aspectcX43X43__
95 #line 96 "main.acc"
96
97 #ifndef __ac_fwd_Example__
98 #define __ac_fwd_Example__
99 class Example;
100 namespace AC {
101 template <class JoinPoint>
102 __attribute((always_inline)) inline void invoke_Example_Example__a0_before (JoinPoint *tjp);
103 }
104 #endif
105
106 #ifndef __ac_need__home_Tom_aspectcX43X43_pointcut_function_example_ah__
107 #define __ac_need__home_Tom_aspectcX43X43_pointcut_function_example_ah__
108 #endif
109
110 #line 1 "pointcut_function/main.cc"
111
112 #line 1 "pointcut_function/main.cc"
113 #include <string>
114
115 #include <iostream>
116
117 #line 118 "main.acc"
118
119 __attribute__((always_inline)) inline void __exec_old_give_int(int i);
120
121 template <typename TResult, typename TThat, typename TTarget, typename TEntity, typename TArgs> struct TJP__Z8give_inti_0 {
122 typedef TJP__Z8give_inti_0 __TJP;
123 typedef TResult Result;
124 typedef TThat That;
125 typedef TTarget Target;
126 typedef TEntity Entity;
127 enum { DIMS = 0 };
128 typedef void * MemberPtr;
129 enum { ARGS = TArgs::ARGS };
130 template <int I> struct Arg : AC::Arg<TArgs, I> {};
131 static const AC::JPType JPTYPE = (AC::JPType)16777216;
132 struct Res {
133 typedef TResult Type;
134 typedef TResult ReferredType;
135 };
136
137 void *_args[ARGS];
138
139 inline void * arg (int n) {return _args[n];}
140 template <int I> typename Arg<I>::ReferredType *arg () {
141 return (typename Arg<I>::ReferredType*)arg (I);
142 }
143
144 struct Binding_Example_Example__a0_before {
145 typedef __TJP TJP;
146 template <int I, int DUMMY = 0> struct Arg {
147 void val (TJP *tjp) {} // for VC7
148 };
149 template <int DUMMY> struct Arg<0, DUMMY> {
150 static typename TJP::template Arg<0>::ReferredType &val (TJP *tjp) { return *tjp->template arg<0> (); }
151 };
152 };
153 };
154
155
156 #line 5 "pointcut_function/main.cc"
157
158 #line 5 "pointcut_function/main.cc"
159 void give_int(int i)
160 #line 161 "main.acc"
161 {
162 typedef TJP__Z8give_inti_0< void, void, void, void (int), AC::TL< int, AC::TLE > > __TJP;
163 __TJP tjp;
164 tjp._args[0] = (void*)&i;
165 AC::invoke_Example_Example__a0_before<__TJP> (&tjp);
166 ::__exec_old_give_int(i);
167
168 }
169 __attribute__((always_inline)) inline void __exec_old_give_int(int i)
170 #line 5 "pointcut_function/main.cc"
171
172 #line 5 "pointcut_function/main.cc"
173 {
174 std::cout << "Got the Int!" << std::endl;
175 }
176
177 int main(){
178 give_int(42);
179 return 0;
180 }
181 #line 182 "main.acc"
182
183 #ifndef __ac_have_predefined_includes__
184 /*** begin of aspect includes ***/
185 // commented out by ac++: #include "example.ah"
186 /*** end of aspect includes ***/
187 #endif
188 #line 13 "pointcut_function/main.cc"
189
190 #line 13 "pointcut_function/main.cc"
191
192 #ifdef __ac_FIRST_FILE__home_Tom_aspectcX43X43_pointcut_function_main_cc__
193 #ifdef __ac_need__home_Tom_aspectcX43X43_pointcut_function_example_ah__
194 #ifndef __ac_have__home_Tom_aspectcX43X43_pointcut_function_example_ah__
195 #define __ac_have__home_Tom_aspectcX43X43_pointcut_function_example_ah__
196 // commented out by ac++: #include "example.ah"
197 #line 1 "pointcut_function/example.ah"
198 #ifndef __EXAMPLE_AH__
199 #define __EXAMPLE_AH__
200
201 // commented out by ac++: #include <iostream>
202
203 class Example {
204 #line 205 "main.acc"
205 public:
206 template <typename, int = 0> struct __BYPASSExample {};
207 template <typename, int> friend struct __BYPASSExample;
208 private:
209 #line 6 "pointcut_function/example.ah"
210
211 #line 6 "pointcut_function/example.ah"
212
213
214 public: void __a0_before(int wert) {
215 std::cout << wert << std::endl; // args() pointcut function
216 }
217
218 #line 219 "main.acc"
219
220 public:
221 static Example *aspectof () {
222 static Example __instance;
223 return &__instance;
224 }
225 static Example *aspectOf () {
226 return aspectof ();
227 }
228 private:
229
230 #line 12 "pointcut_function/example.ah"
231
232 #line 12 "pointcut_function/example.ah"
233 }
234 #line 235 "main.acc"
235 ;
236 namespace AC {
237 template <class JoinPoint>
238 __attribute((always_inline)) inline void invoke_Example_Example__a0_before (JoinPoint *tjp) {
239 typedef typename JoinPoint::Binding_Example_Example__a0_before::template Arg<0> Arg0;
240 ::Example::aspectof()->__a0_before ((int)Arg0::val (tjp));
241 }
242 }
243
244 #line 12 "pointcut_function/example.ah"
245
246 #line 12 "pointcut_function/example.ah"
247 ;
248
249 #endif
250 #line 19 "pointcut_function/main.cc"
251 #endif
252 #endif
253 #undef __ac_FIRST__home_Tom_aspectcX43X43__
254 #undef __ac_FIRST_FILE__home_Tom_aspectcX43X43_pointcut_function_main_cc__
255 #endif // __ac_FIRST_FILE__home_Tom_aspectcX43X43_pointcut_function_main_cc__