Debian Codegraph @

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

raw
1 #line 1 "ah_builtin/main.cc"
2 #ifndef __ac_FIRST__home_Tom_aspectcX43X43__
3 #define __ac_FIRST__home_Tom_aspectcX43X43__
4 #define __ac_FIRST_FILE__home_Tom_aspectcX43X43_ah_builtin_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 { BUILTIN = 524288, 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, bool Qual> struct ConstQualify {};
41 template <typename T> struct ConstQualify<T, false> { typedef T type; };
42 template <typename T> struct ConstQualify<T, true> { typedef const T type; };
43 template <typename T> struct ConstQualify<const T, true> { typedef const T type; };
44 template <typename TL, unsigned int FC, int I> struct ArgCQ {
45 typedef typename ConstQualify<typename Arg<TL, I>::Type, ( FC >> I ) & 1>::type Type;
46 typedef typename Referred<Type>::type ReferredType;
47 };
48 template <typename T> int ttest(...);
49 template <typename T> char ttest(typename T::__TI const volatile *);
50 template<typename T> struct HasTypeInfo {
51 enum { RET=((sizeof(ttest<T>(0))==1)?1:0) };
52 };
53 template<typename T, int HAVE = HasTypeInfo<T>::RET> struct TypeInfo {
54 enum { AVAILABLE = 0, BASECLASSES = 0, MEMBERS = 0, FUNCTIONS = 0,
55 CONSTRUCTORS = 0, DESTRUCTORS = 0 };
56 typedef T That;
57 };
58 template<typename T> struct TypeInfo<T, 1> : T::__TI {
59 enum { AVAILABLE = 1 };
60 };
61 template<typename T> struct RT {};
62 template<typename T> RT<T> rt_deduce (const T&) { return RT<T>(); }
63 template<typename T> RT<T> rt_deduce (const volatile T&) { return RT<T>(); }
64 struct Cnv { template<typename T> operator RT<T>() const { return RT<T>(); }};
65 #define __AC_TYPEOF(expr) (1?AC::Cnv():AC::rt_deduce(expr))
66 template <class Aspect, int Index>
67 struct CFlow {
68 static int &instance () {
69 static int counter = 0;
70 return counter;
71 }
72 CFlow () { instance ()++; }
73 ~CFlow () { instance ()--; }
74 static bool active () { return instance () > 0; }
75 };
76
77 #ifdef __acdef_float
78 template <typename BASE, int ID=0> struct _FloatN {
79 BASE val;
80 _FloatN() {}
81 _FloatN(const BASE& v) : val(v) {}
82 operator BASE() const { return val; }
83 };
84 #endif
85 }
86
87 #ifdef __acdef_float
88 typedef AC::_FloatN<float> _Float32;
89 typedef AC::_FloatN<double> _Float32x;
90 typedef AC::_FloatN<long double, 0> _Float64;
91 typedef AC::_FloatN<long double, 1> _Float128;
92 typedef AC::_FloatN<long double, 2> _Float64x;
93 #endif
94
95 #if defined(__acweaving) && defined(__ARM_NEON)
96 typedef __attribute__ ((__neon_vector_type__ (4))) float __Float32x4_t;
97 typedef __attribute__ ((__neon_vector_type__ (2))) double __Float64x2_t;
98 #endif
99 #endif // __cplusplus
100 #endif // __ac_h_
101 class Hello;
102 #endif // __ac_FIRST__home_Tom_aspectcX43X43__
103 #line 104 "main.acc"
104
105 #ifndef __ac_fwd_Hello__
106 #define __ac_fwd_Hello__
107 class Hello;
108 namespace AC {
109 __attribute((always_inline)) inline void invoke_Hello_Hello__a0_before ();
110 }
111 #endif
112
113 #ifndef __ac_need__home_Tom_aspectcX43X43_ah_builtin_hello_world_ah__
114 #define __ac_need__home_Tom_aspectcX43X43_ah_builtin_hello_world_ah__
115 #endif
116
117 #line 1 "ah_builtin/main.cc"
118
119 #line 1 "ah_builtin/main.cc"
120 #include <iostream>
121
122 char exclamation;
123
124 #line 125 "main.acc"
125
126 template <typename TArg0, typename TArg1, typename TResult>
127 __attribute__((always_inline)) inline TResult &__Builtin__Z4mainv_0_0 (TArg0 arg0, TArg1 arg1, AC::RT<TResult>){
128 TResult *__result_buffer;
129 AC::invoke_Hello_Hello__a0_before ();
130 __result_buffer = &((arg0) = (arg1));
131 return *(TResult *&)__result_buffer;
132 }
133
134 #line 5 "ah_builtin/main.cc"
135
136 #line 5 "ah_builtin/main.cc"
137 int main(){
138 __Builtin__Z4mainv_0_0< char &, char > (exclamation , '!', __AC_TYPEOF((exclamation = '!')) );
139 std::cout << exclamation << std::endl; //print !
140 return 0;
141 }
142 #line 143 "main.acc"
143
144 #ifndef __ac_have_predefined_includes__
145 /*** begin of aspect includes ***/
146 // commented out by ac++: #include "hello_world.ah"
147 /*** end of aspect includes ***/
148 #endif
149 #line 10 "ah_builtin/main.cc"
150
151 #line 10 "ah_builtin/main.cc"
152
153 #ifdef __ac_FIRST_FILE__home_Tom_aspectcX43X43_ah_builtin_main_cc__
154 #ifdef __ac_need__home_Tom_aspectcX43X43_ah_builtin_hello_world_ah__
155 #ifndef __ac_have__home_Tom_aspectcX43X43_ah_builtin_hello_world_ah__
156 #define __ac_have__home_Tom_aspectcX43X43_ah_builtin_hello_world_ah__
157 // commented out by ac++: #include "hello_world.ah"
158 #line 1 "ah_builtin/hello_world.ah"
159 #ifndef __WORLD_AH__
160 #define __WORLD_AH__
161
162 // commented out by ac++: #include <iostream>
163 // commented out by ac++: #include <string>
164
165 class Hello{
166 #line 167 "main.acc"
167 public:
168 template <typename, int = 0> struct __BYPASSHello {};
169 template <typename, int> friend struct __BYPASSHello;
170 private:
171 #line 7 "ah_builtin/hello_world.ah"
172
173 #line 7 "ah_builtin/hello_world.ah"
174
175
176 public: __attribute__((always_inline)) inline void __a0_before() {
177 //print "Hello World" before the '!' is assigned
178 std::cout << "Hello World";
179 }
180
181 #line 182 "main.acc"
182
183 public:
184 static Hello *aspectof () {
185 static Hello __instance;
186 return &__instance;
187 }
188 static Hello *aspectOf () {
189 return aspectof ();
190 }
191 private:
192
193 #line 14 "ah_builtin/hello_world.ah"
194
195 #line 14 "ah_builtin/hello_world.ah"
196 }
197 #line 198 "main.acc"
198 ;
199 namespace AC {
200 __attribute((always_inline)) inline void invoke_Hello_Hello__a0_before () {
201 ::Hello::aspectof()->__a0_before ();
202 }
203 }
204
205 #line 14 "ah_builtin/hello_world.ah"
206
207 #line 14 "ah_builtin/hello_world.ah"
208 ;
209
210 #endif
211 #line 16 "ah_builtin/main.cc"
212 #endif
213 #endif
214 #undef __ac_FIRST__home_Tom_aspectcX43X43__
215 #undef __ac_FIRST_FILE__home_Tom_aspectcX43X43_ah_builtin_main_cc__
216 #endif // __ac_FIRST_FILE__home_Tom_aspectcX43X43_ah_builtin_main_cc__