Changeset 7a780ad for src/BasicTypes-gen.cc
- Timestamp:
- Apr 18, 2024, 5:19:17 PM (4 months ago)
- Branches:
- master
- Children:
- 38093ae
- Parents:
- 60c5b6d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/BasicTypes-gen.cc
r60c5b6d r7a780ad 249 249 } // for 250 250 } // for 251 int lastInteger = NUMBER_OF_BASIC_TYPES; 251 252 252 253 for ( int r = 0; r < NUMBER_OF_BASIC_TYPES; r += 1 ) { // perform breath-first traversal to generate cost graph … … 259 260 } // for 260 261 } // for 262 263 // Find the last integer type. 264 // Assumes at least 1, and all come before the floating types. 265 for ( int i = 1 ; i < NUMBER_OF_BASIC_TYPES ; i += 1 ) { 266 if ( Floating == graph[i].sign ) { 267 lastInteger = (i - 1); 268 break; 269 } 270 } 261 271 262 272 #define STARTMK "// GENERATED START, DO NOT EDIT" … … 272 282 size_t start, end; 273 283 274 #define TypeH_AST TOP_SRCDIR "src/AST/ Type.hpp"284 #define TypeH_AST TOP_SRCDIR "src/AST/BasicKind.hpp" 275 285 resetInput( file, TypeH_AST, buffer, code, str ); 276 286 … … 279 289 code << str.substr( 0, start ); 280 290 281 code << "\t" <<BYMK << endl;282 code << " \tenumKind {" << endl;291 code << BYMK << endl; 292 code << "enum BasicKind {" << endl; 283 293 for ( int r = 0; r < NUMBER_OF_BASIC_TYPES; r += 1 ) { 284 code << "\t \t" << graph[r].name << "," << endl;285 } // for 286 code << "\t \tNUMBER_OF_BASIC_TYPES" << endl;287 code << "\t } kind;" << endl;288 code << " \t"; // indentation for end marker294 code << "\t" << graph[r].name << "," << endl; 295 } // for 296 code << "\tNUMBER_OF_BASIC_TYPES," << endl; 297 code << "\tMAX_INTEGER_TYPE = " << graph[lastInteger].name << "," << endl; 298 code << "};" << endl; 289 299 290 300 if ( (start = str.find( ENDMK, start + 1 )) == string::npos ) Abort( "end", TypeH_AST ); … … 347 357 348 358 code << "\t" << BYMK << endl; 349 code << "\tstatic const int costMatrix[ast::Basic Type::NUMBER_OF_BASIC_TYPES][ast::BasicType::NUMBER_OF_BASIC_TYPES] = { // path length from root to node" << endl359 code << "\tstatic const int costMatrix[ast::BasicKind::NUMBER_OF_BASIC_TYPES][ast::BasicKind::NUMBER_OF_BASIC_TYPES] = { // path length from root to node" << endl 350 360 << "\t\t/* "; 351 361 for ( int r = 0; r < NUMBER_OF_BASIC_TYPES; r += 1 ) { // titles … … 372 382 373 383 code << "\t" << BYMK << endl; 374 code << "\tstatic const int signMatrix[ast::Basic Type::NUMBER_OF_BASIC_TYPES][ast::BasicType::NUMBER_OF_BASIC_TYPES] = { // number of sign changes in safe conversion" << endl384 code << "\tstatic const int signMatrix[ast::BasicKind::NUMBER_OF_BASIC_TYPES][ast::BasicKind::NUMBER_OF_BASIC_TYPES] = { // number of sign changes in safe conversion" << endl 375 385 << "\t\t/* "; 376 386 for ( int r = 0; r < NUMBER_OF_BASIC_TYPES; r += 1 ) { // titles … … 404 414 enum { PER_ROW = 6 }; 405 415 code << "\t" << BYMK << endl; 406 code << "\t#define BT ast::Basic Type::" << endl;416 code << "\t#define BT ast::BasicKind::" << endl; 407 417 code << "\tstatic const BT Kind commonTypes[BT NUMBER_OF_BASIC_TYPES][BT NUMBER_OF_BASIC_TYPES] = { // nearest common ancestor" << endl 408 418 << "\t\t/*\t\t "; … … 460 470 "// - \"Ds\" char16_t\n"; 461 471 462 code << "const std::string basicTypes[ast::Basic Type::NUMBER_OF_BASIC_TYPES] = {" << endl;472 code << "const std::string basicTypes[ast::BasicKind::NUMBER_OF_BASIC_TYPES] = {" << endl; 463 473 for ( int r = 0; r < NUMBER_OF_BASIC_TYPES; r += 1 ) { 464 474 code << "\t\"" << graph[r].mangled << "\"," << setw(9 - strlen(graph[r].mangled)) << ' ' << "// " << graph[r].type << endl;
Note: See TracChangeset
for help on using the changeset viewer.