Debian Codegraph @

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

raw
1 #line 1 "example2/ah+cc+header/main.cc"
2 #ifndef __ac_FIRST__home_Tom_aspectcX43X43__
3 #define __ac_FIRST__home_Tom_aspectcX43X43__
4 #define __ac_FIRST_FILE__home_Tom_aspectcX43X43_example2_ahX43ccX43header_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 World;
94 #endif // __ac_FIRST__home_Tom_aspectcX43X43__
95 // commented out by ac++: #include "hello.h"
96 #line 1 "example2/ah+cc+header/hello.h"
97 #line 98 "main.acc"
98
99 #ifndef __ac_fwd_World__
100 #define __ac_fwd_World__
101 class World;
102 namespace AC {
103 __attribute((always_inline)) inline void invoke_World_World__a0_after ();
104 }
105 #endif
106
107 #ifndef __ac_need__home_Tom_aspectcX43X43_example2_ahX43ccX43header_world_ah__
108 #define __ac_need__home_Tom_aspectcX43X43_example2_ahX43ccX43header_world_ah__
109 #endif
110
111 #line 1 "example2/ah+cc+header/hello.h"
112
113 #line 1 "example2/ah+cc+header/hello.h"
114 #ifndef __HELLO_H__
115 #define __HELLO_H__
116
117 #include <iostream>
118
119 #line 120 "main.acc"
120
121 __attribute__((always_inline)) inline void __exec_old_hello();
122
123 #line 6 "example2/ah+cc+header/hello.h"
124
125 #line 6 "example2/ah+cc+header/hello.h"
126 void hello()
127 #line 128 "main.acc"
128 {
129 ::__exec_old_hello();
130 AC::invoke_World_World__a0_after ();
131
132 }
133 __attribute__((always_inline)) inline void __exec_old_hello()
134 #line 6 "example2/ah+cc+header/hello.h"
135
136 #line 6 "example2/ah+cc+header/hello.h"
137 {
138 std::cout << "Hello" << std::endl;
139 }
140
141 #endif
142 #line 95 "example2/ah+cc+header/main.cc"
143
144 int main(){
145 hello(); //print "Hello"
146 return 0;
147 }
148 #line 149 "main.acc"
149
150 #ifndef __ac_have_predefined_includes__
151 /*** begin of aspect includes ***/
152 // commented out by ac++: #include "world.ah"
153 /*** end of aspect includes ***/
154 #endif
155 #line 7 "example2/ah+cc+header/main.cc"
156
157 #line 7 "example2/ah+cc+header/main.cc"
158
159 #ifdef __ac_FIRST_FILE__home_Tom_aspectcX43X43_example2_ahX43ccX43header_main_cc__
160 #ifdef __ac_need__home_Tom_aspectcX43X43_example2_ahX43ccX43header_world_ah__
161 #ifndef __ac_have__home_Tom_aspectcX43X43_example2_ahX43ccX43header_world_ah__
162 #define __ac_have__home_Tom_aspectcX43X43_example2_ahX43ccX43header_world_ah__
163 // commented out by ac++: #include "world.ah"
164 #line 1 "example2/ah+cc+header/world.ah"
165 #ifndef __WORLD_AH__
166 #define __WORLD_AH__
167
168 // commented out by ac++: #include <iostream>
169
170 class World {
171 #line 172 "main.acc"
172 public:
173 template <typename, int = 0> struct __BYPASSWorld {};
174 template <typename, int> friend struct __BYPASSWorld;
175 private:
176 #line 6 "example2/ah+cc+header/world.ah"
177
178 #line 6 "example2/ah+cc+header/world.ah"
179
180
181 public: void __a0_after() {
182 //print "World" after execution of the 'hello()' function
183 std::cout << "World" << std::endl;
184 }
185
186 #line 187 "main.acc"
187
188 public:
189 static World *aspectof () {
190 static World __instance;
191 return &__instance;
192 }
193 static World *aspectOf () {
194 return aspectof ();
195 }
196 private:
197
198 #line 13 "example2/ah+cc+header/world.ah"
199
200 #line 13 "example2/ah+cc+header/world.ah"
201 }
202 #line 203 "main.acc"
203 ;
204 namespace AC {
205 __attribute((always_inline)) inline void invoke_World_World__a0_after () {
206 ::World::aspectof()->__a0_after ();
207 }
208 }
209
210 #line 13 "example2/ah+cc+header/world.ah"
211
212 #line 13 "example2/ah+cc+header/world.ah"
213 ;
214
215 #endif
216 #line 13 "example2/ah+cc+header/main.cc"
217 #endif
218 #endif
219 #undef __ac_FIRST__home_Tom_aspectcX43X43__
220 #undef __ac_FIRST_FILE__home_Tom_aspectcX43X43_example2_ahX43ccX43header_main_cc__
221 #endif // __ac_FIRST_FILE__home_Tom_aspectcX43X43_example2_ahX43ccX43header_main_cc__