Changes in libcfa/prelude/prelude-gen.cc [c41c18a6:e523b07]
- File:
-
- 1 edited
-
libcfa/prelude/prelude-gen.cc (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/prelude/prelude-gen.cc
rc41c18a6 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 : Tue Apr 2 17:18:24 201913 // Update Count : 3714 //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 }; … … 118 103 { "?!=?", false, "signed int", Normal, "" }, 119 104 { "?=?", true, "", Normal, "" }, // void * LHS, zero_t RHS ??? 120 // { "*?", false, "&", Normal, " | sized(DT)" }, // & ??? 121 { "*?", false, "&", Normal, "" }, // & ??? 105 { "*?", false, "&", Normal, " | sized(DT)" }, // & ??? 122 106 123 107 { "?-?", false, "ptrdiff_t", Normal, " | sized(DT)" }, … … 166 150 cout << endl; 167 151 168 cout << "signed int ?==?( zero_t, zero_t ), ?!=?( zero_t, zero_t );" << endl;169 cout << "signed int ?==?( one_t, one_t ), ?!=?( one_t, one_t );" << endl;170 cout << "signed int ?==?( _Bool, _Bool ), ?!=?( _Bool, _Bool );" << endl;171 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; 172 156 173 157 for (auto op : arithmeticOperators) { … … 204 188 cout << "// Arithmetic Constructors //" << endl; 205 189 cout << "/////////////////////////////" << endl; 206 cout << endl;207 208 190 auto otype = [](const std::string & type, bool do_volatile = false) { 209 cout << "void ?{} (" << type << " &);" << endl;210 cout << "void ?{} (" << type << " &, " << type << ");" << endl;211 cout << type << " ?=? (" << type << " &, " << type << ")";212 if ( do_volatile ) {213 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 << " )"; 214 196 } 215 197 cout << ";" << endl; 216 cout << "void ^?{}( " << type << " & );" << endl;198 cout << "void \t^?{}( " << type << " & );" << endl; 217 199 }; 218 200 219 201 otype("zero_t"); 220 cout << endl;221 202 otype("one_t"); 222 cout << endl;223 203 otype("_Bool", true); 224 cout << endl; 204 otype("char", true); 205 otype("signed char", true); 206 otype("unsigned char", true); 225 207 226 208 for (auto type : basicTypes) { 227 cout << "void ?{}(" << type.name << " &);" << endl; 228 cout << "void ?{}(" << type.name << " &, " << type.name << ");" << endl; 229 cout << "void ?{}(" << type.name << " &, zero_t);" << endl; 230 cout << "void ?{}(" << type.name << " &, one_t);" << endl; 209 cout << "void ?{}(" << type.name << " &);" << endl; 210 cout << "void ?{}(" << type.name << " &, " << type.name << ");" << endl; 231 211 cout << "void ^?{}(" << type.name << " &);" << endl; 232 212 cout << endl; … … 237 217 cout << "// Pointer Constructors //" << endl; 238 218 cout << "//////////////////////////" << endl; 239 cout << endl; 240 241 cout << "forall(ftype FT) void ?{}( FT *&, FT * );" << endl; 242 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; 243 221 244 222 // generate qualifiers … … 264 242 for (auto cvq : qualifiersPair) { 265 243 for (auto is_vol : { " ", "volatile" }) { 266 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; 267 245 } 268 246 } 269 247 for (auto cvq : qualifiersSingle) { 270 248 for (auto is_vol : { " ", "volatile" }) { 271 cout << "forall(dtype DT) void ?{}(" << cvq << type << " * " << is_vol << " &);" << endl;249 cout << "forall(dtype DT) void ?{}(" << cvq << type << " * " << is_vol << " &);" << endl; 272 250 } 273 251 for (auto is_vol : { " ", "volatile" }) { … … 291 269 cout << "forall(ftype FT) FT * ?=?( FT * &, zero_t );" << endl; 292 270 cout << "forall(ftype FT) FT * ?=?( FT * volatile &, zero_t );" << endl; 293 cout << "forall( ftype FT) void ?{}( FT * & );" << endl;294 cout << "forall( ftype FT) void ^?{}( FT * & );" << endl;271 cout << "forall( ftype FT ) void ?{}( FT * & );" << endl; 272 cout << "forall( ftype FT ) void ^?{}( FT * & );" << endl; 295 273 cout << endl; 296 274 … … 299 277 cout << "///////////////////////" << endl; 300 278 301 cout << "forall(ftype FT) FT * ?=?( FT *&, FT * );" << endl; 302 cout << "forall(ftype FT) FT * ?=?( FT * volatile &, FT * );" << endl; 303 cout << "forall(ftype FT) int !?( FT * );" << endl; 304 cout << "forall(ftype FT) signed int ?==?( FT *, FT * );" << endl; 305 cout << "forall(ftype FT) signed int ?!=?( FT *, FT * );" << endl; 306 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 307 286 308 287 for (auto op : pointerOperators) { … … 408 387 } 409 388 410 // Local Variables: //411 // tab-width: 4 //412 // End: //
Note:
See TracChangeset
for help on using the changeset viewer.