Changes in libcfa/prelude/prelude-gen.cc [e523b07:b830e046]
- File:
-
- 1 edited
-
libcfa/prelude/prelude-gen.cc (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/prelude/prelude-gen.cc
re523b07 rb830e046 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2018 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // prelude-gen.cc -- 8 // 9 // Author : Rob Schluntz and Thierry Delisle 10 // Created On : Sat Feb 16 08:44:58 2019 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Mar 8 16:00:22 2019 13 // Update Count : 26 14 // 15 1 16 #include <algorithm> 2 17 #include <array> … … 11 26 bool hasComparison; 12 27 } basicTypes[] = { 13 //{ "char" , false, true , },14 //{ "signed char" , false, true , },15 //{ "unsigned char" , false, true , },28 { "char" , false, true , }, 29 { "signed char" , false, true , }, 30 { "unsigned char" , false, true , }, 16 31 { "signed short" , false, true , }, 17 32 { "unsigned short" , false, true , }, … … 34 49 #if defined(__i386__) || defined(__ia64__) || defined(__x86_64__) 35 50 { "__float80" , true , true , }, 36 { "_ Float128", true , true , },51 { "__float128" , true , true , }, 37 52 #endif 38 53 }; … … 150 165 cout << endl; 151 166 152 cout << "signed int ?==?( zero_t, zero_t ), ?!=?( zero_t, zero_t );" << endl;153 cout << "signed int ?==?( one_t, one_t ), ?!=?( one_t, one_t );" << endl;154 cout << "signed int ?==?( _Bool, _Bool ), ?!=?( _Bool, _Bool );" << endl;155 cout << "signed int !?( _Bool );" << endl;167 cout << "signed int ?==?( zero_t, zero_t ), ?!=?( zero_t, zero_t );" << endl; 168 cout << "signed int ?==?( one_t, one_t ), ?!=?( one_t, one_t );" << endl; 169 cout << "signed int ?==?( _Bool, _Bool ), ?!=?( _Bool, _Bool );" << endl; 170 cout << "signed int !?( _Bool );" << endl; 156 171 157 172 for (auto op : arithmeticOperators) { … … 188 203 cout << "// Arithmetic Constructors //" << endl; 189 204 cout << "/////////////////////////////" << endl; 205 cout << endl; 206 190 207 auto otype = [](const std::string & type, bool do_volatile = false) { 191 cout << "void \t?{} ( " << type << " &);" << endl;192 cout << "void \t?{} ( " << type << " &, " << type << ");" << endl;193 cout << type << " \t?=? ( " << type << " &, " << type << ")";194 if ( do_volatile ) {195 cout << ", \t?=?( volatile " << type << " &, " << type << ")";208 cout << "void ?{} (" << type << " &);" << endl; 209 cout << "void ?{} (" << type << " &, " << type << ");" << endl; 210 cout << type << " ?=? (" << type << " &, " << type << ")"; 211 if ( do_volatile ) { 212 cout << ", ?=?(volatile " << type << " &, " << type << ")"; 196 213 } 197 214 cout << ";" << endl; 198 cout << "void \t^?{}( " << type << " & );" << endl;215 cout << "void ^?{}( " << type << " & );" << endl; 199 216 }; 200 217 … … 202 219 otype("one_t"); 203 220 otype("_Bool", true); 204 otype("char", true); 205 otype("signed char", true); 206 otype("unsigned char", true); 221 cout << endl; 207 222 208 223 for (auto type : basicTypes) { 209 cout << "void ?{}(" << type.name << " &);" << endl; 210 cout << "void ?{}(" << type.name << " &, " << type.name << ");" << endl; 224 cout << "void ?{}(" << type.name << " &);" << endl; 225 cout << "void ?{}(" << type.name << " &, " << type.name << ");" << endl; 226 cout << "void ?{}(" << type.name << " &, zero_t);" << endl; 211 227 cout << "void ^?{}(" << type.name << " &);" << endl; 212 228 cout << endl; … … 217 233 cout << "// Pointer Constructors //" << endl; 218 234 cout << "//////////////////////////" << endl; 219 cout << "forall(ftype FT) void ?{}( FT *&, FT * );" << endl; 220 cout << "forall(ftype FT) void ?{}( FT * volatile &, FT * );" << endl; 235 cout << endl; 236 237 cout << "forall(ftype FT) void ?{}( FT *&, FT * );" << endl; 238 cout << "forall(ftype FT) void ?{}( FT * volatile &, FT * );" << endl; 221 239 222 240 // generate qualifiers … … 242 260 for (auto cvq : qualifiersPair) { 243 261 for (auto is_vol : { " ", "volatile" }) { 244 cout << "forall(dtype DT) void ?{}(" << cvq.first << type << " * " << is_vol << " &, " << cvq.second << "DT *);" << endl;262 cout << "forall(dtype DT) void ?{}(" << cvq.first << type << " * " << is_vol << " &, " << cvq.second << "DT *);" << endl; 245 263 } 246 264 } 247 265 for (auto cvq : qualifiersSingle) { 248 266 for (auto is_vol : { " ", "volatile" }) { 249 cout << "forall(dtype DT) void ?{}(" << cvq << type << " * " << is_vol << " &);" << endl;267 cout << "forall(dtype DT) void ?{}(" << cvq << type << " * " << is_vol << " &);" << endl; 250 268 } 251 269 for (auto is_vol : { " ", "volatile" }) { … … 269 287 cout << "forall(ftype FT) FT * ?=?( FT * &, zero_t );" << endl; 270 288 cout << "forall(ftype FT) FT * ?=?( FT * volatile &, zero_t );" << endl; 271 cout << "forall( ftype FT) void ?{}( FT * & );" << endl;272 cout << "forall( ftype FT) void ^?{}( FT * & );" << endl;289 cout << "forall(ftype FT) void ?{}( FT * & );" << endl; 290 cout << "forall(ftype FT) void ^?{}( FT * & );" << endl; 273 291 cout << endl; 274 292 … … 277 295 cout << "///////////////////////" << endl; 278 296 279 cout << "forall( ftype FT ) FT * ?=?( FT *&, FT * );" << endl; 280 cout << "forall( ftype FT ) FT * ?=?( FT * volatile &, FT * );" << endl; 281 cout << "forall( ftype FT ) int !?( FT * );" << endl; 282 cout << "forall( ftype FT ) signed int ?==?( FT *, FT * );" << endl; 283 cout << "forall( ftype FT ) signed int ?!=?( FT *, FT * );" << endl; 284 cout << "forall( ftype FT ) FT & *?( FT * );" << endl; 285 297 cout << "forall(ftype FT) FT * ?=?( FT *&, FT * );" << endl; 298 cout << "forall(ftype FT) FT * ?=?( FT * volatile &, FT * );" << endl; 299 cout << "forall(ftype FT) int !?( FT * );" << endl; 300 cout << "forall(ftype FT) signed int ?==?( FT *, FT * );" << endl; 301 cout << "forall(ftype FT) signed int ?!=?( FT *, FT * );" << endl; 302 cout << "forall(ftype FT) FT & *?( FT * );" << endl; 286 303 287 304 for (auto op : pointerOperators) { … … 387 404 } 388 405 406 // Local Variables: // 407 // tab-width: 4 // 408 // End: //
Note:
See TracChangeset
for help on using the changeset viewer.