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