Changes in / [0a73148:ae144af]
- Location:
- src
- Files:
-
- 5 edited
-
Parser/TypedefTable.cc (modified) (2 diffs)
-
Parser/parser.yy (modified) (4 diffs)
-
driver/cc1.cc (modified) (32 diffs)
-
driver/cfa.cc (modified) (12 diffs)
-
libcfa/math (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/TypedefTable.cc
r0a73148 rae144af 10 10 // Created On : Sat May 16 15:20:13 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 13 18:35:54201813 // Update Count : 25 712 // Last Modified On : Wed Jul 11 11:47:47 2018 13 // Update Count : 255 14 14 // 15 15 … … 100 100 void TypedefTable::up( bool forall ) { 101 101 level += 1; 102 kindTable.getNote( kindTable.currentScope() ) = (Note){ level, forall || getEnclForall() };102 kindTable.getNote( kindTable.currentScope() ) = (Note){ level, static_cast<bool>(forall | getEnclForall()) }; 103 103 debugPrint( cerr << "Up " << " level " << level << " note " << kindTable.getNote( level ).level << ", " << kindTable.getNote( level ).forall << endl; ); 104 104 } // TypedefTable::up -
src/Parser/parser.yy
r0a73148 rae144af 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jul 12 1 6:16:25201813 // Update Count : 375 612 // Last Modified On : Thu Jul 12 13:47:44 2018 13 // Update Count : 3755 14 14 // 15 15 … … 1866 1866 | aggregate_key attribute_list_opt no_attr_identifier fred 1867 1867 { 1868 typedefTable.makeTypedef( *$3, forall | |typedefTable.getEnclForall() ? TYPEGENname : TYPEDEFname ); // create typedef1868 typedefTable.makeTypedef( *$3, forall | typedefTable.getEnclForall() ? TYPEGENname : TYPEDEFname ); // create typedef 1869 1869 forall = false; // reset 1870 1870 } … … 1874 1874 { 1875 1875 // for type_name can be a qualified type name S.T, in which case only the last name in the chain needs a typedef (other names in the chain should already have one) 1876 typedefTable.makeTypedef( *$3->type->leafName(), forall | |typedefTable.getEnclForall() ? TYPEGENname : TYPEDEFname ); // create typedef1876 typedefTable.makeTypedef( *$3->type->leafName(), forall | typedefTable.getEnclForall() ? TYPEGENname : TYPEDEFname ); // create typedef 1877 1877 forall = false; // reset 1878 1878 } … … 1892 1892 aggregate_key attribute_list_opt no_attr_identifier fred 1893 1893 { 1894 typedefTable.makeTypedef( *$3, forall | |typedefTable.getEnclForall() ? TYPEGENname : TYPEDEFname );1894 typedefTable.makeTypedef( *$3, forall | typedefTable.getEnclForall() ? TYPEGENname : TYPEDEFname ); 1895 1895 forall = false; // reset 1896 1896 $$ = DeclarationNode::newAggregate( $1, $3, nullptr, nullptr, false )->addQualifiers( $2 ); -
src/driver/cc1.cc
r0a73148 rae144af 10 10 // Created On : Fri Aug 26 14:23:51 2005 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 13 17:40:10201813 // Update Count : 11012 // Last Modified On : Sat May 12 16:11:53 2018 13 // Update Count : 94 14 14 // 15 15 … … 44 44 } // prefix 45 45 46 enum { NumSuffixes = 2 };47 const string suffixes[NumSuffixes] = { "cfa", "hfa", };48 49 bool suffix( string arg ) {50 //std::cerr << arg << std::endl;51 size_t dot = arg.find_last_of( "." );52 //std::cerr << dot << " " << (dot != string::npos ? arg.substr( dot + 1 ) : "fred" ) << std::endl;53 if ( dot == string::npos ) return false;54 string sx = arg.substr( dot + 1 );55 for ( int i = 0; i < NumSuffixes; i += 1 ) {56 if ( sx == suffixes[i] ) return true;57 } // for58 return false;59 } // suffix60 61 46 62 47 void checkEnv( const char *args[], int &nargs ) { … … 66 51 if ( value != NULL ) { 67 52 compiler_name = value; 68 #ifdef __DEBUG_H__53 #ifdef __DEBUG_H__ 69 54 cerr << "env arg:\"" << compiler_name << "\"" << endl; 70 #endif // __DEBUG_H__55 #endif // __DEBUG_H__ 71 56 } // if 72 57 … … 74 59 if ( value != NULL ) { 75 60 args[nargs] = ( *new string( value ) ).c_str(); // pass the argument along 76 #ifdef __DEBUG_H__61 #ifdef __DEBUG_H__ 77 62 cerr << "env arg:\"" << args[nargs] << "\"" << endl; 78 #endif // __DEBUG_H__63 #endif // __DEBUG_H__ 79 64 nargs += 1; 80 65 } // if … … 83 68 if ( value != NULL ) { 84 69 args[nargs] = ( *new string( value ) ).c_str(); // pass the argument along 85 #ifdef __DEBUG_H__70 #ifdef __DEBUG_H__ 86 71 cerr << "env arg:\"" << args[nargs] << "\"" << endl; 87 #endif // __DEBUG_H__72 #endif // __DEBUG_H__ 88 73 nargs += 1; 89 74 } // if … … 130 115 signal( SIGTERM, sigTermHandler ); 131 116 132 #ifdef __DEBUG_H__117 #ifdef __DEBUG_H__ 133 118 cerr << "Stage1" << endl; 134 #endif // __DEBUG_H__119 #endif // __DEBUG_H__ 135 120 136 121 // process all the arguments … … 139 124 140 125 for ( i = 1; i < argc; i += 1 ) { 141 #ifdef __DEBUG_H__126 #ifdef __DEBUG_H__ 142 127 cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl; 143 #endif // __DEBUG_H__128 #endif // __DEBUG_H__ 144 129 arg = argv[i]; 145 #ifdef __DEBUG_H__130 #ifdef __DEBUG_H__ 146 131 cerr << "arg:\"" << arg << "\"" << endl; 147 #endif // __DEBUG_H__132 #endif // __DEBUG_H__ 148 133 if ( prefix( arg, "-" ) ) { 149 134 // strip g++ flags that are inappropriate or cause duplicates in subsequent passes … … 179 164 ncargs += 1; 180 165 i += 1; // and the argument 181 //} else if ( prefix( arg, D__GCC_X__ ) ) {182 //args[nargs] = "-x";183 //nargs += 1;184 //args[nargs] = ( *new string( arg.substr( D__GCC_X__.size() ) ) ).c_str(); // pass the flag along185 //nargs += 1;186 //} else if ( arg == "-D" && prefix( argv[i + 1], D__GCC_X__.substr(2) ) ) {187 //args[nargs] = "-x";188 //nargs += 1;189 //args[nargs] = ( *new string( string( argv[i + 1] ).substr( D__GCC_X__.size() - 2 ) ) ).c_str(); // pass the flag along190 //nargs += 1;191 //i += 1; // and the argument166 } else if ( prefix( arg, D__GCC_X__ ) ) { 167 args[nargs] = "-x"; 168 nargs += 1; 169 args[nargs] = ( *new string( arg.substr( D__GCC_X__.size() ) ) ).c_str(); // pass the flag along 170 nargs += 1; 171 } else if ( arg == "-D" && prefix( argv[i + 1], D__GCC_X__.substr(2) ) ) { 172 args[nargs] = "-x"; 173 nargs += 1; 174 args[nargs] = ( *new string( string( argv[i + 1] ).substr( D__GCC_X__.size() - 2 ) ) ).c_str(); // pass the flag along 175 nargs += 1; 176 i += 1; // and the argument 192 177 } else if ( prefix( arg, D__GCC_BPREFIX__ ) ) { 193 178 bprefix = arg.substr( D__GCC_BPREFIX__.size() ); … … 211 196 args[nargs] = argv[i]; // pass the argument along 212 197 nargs += 1; 213 #ifdef __DEBUG_H__198 #ifdef __DEBUG_H__ 214 199 cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl; 215 #endif // __DEBUG_H__200 #endif // __DEBUG_H__ 216 201 } else if ( arg == "-MD" || arg == "-MMD" ) { 217 202 args[nargs] = "-MF"; // insert before file … … 220 205 args[nargs] = argv[i]; // pass the argument along 221 206 nargs += 1; 222 #ifdef __DEBUG_H__207 #ifdef __DEBUG_H__ 223 208 cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl; 224 #endif // __DEBUG_H__209 #endif // __DEBUG_H__ 225 210 } // if 226 211 } // if … … 228 213 if ( cpp_in == NULL ) { 229 214 cpp_in = argv[i]; 230 #ifdef __DEBUG_H__215 #ifdef __DEBUG_H__ 231 216 cerr << "cpp_in:\"" << cpp_in << "\"" << endl; 232 #endif // __DEBUG_H__217 #endif // __DEBUG_H__ 233 218 } else if ( cpp_out == NULL ) { 234 219 cpp_out = argv[i]; 235 #ifdef __DEBUG_H__220 #ifdef __DEBUG_H__ 236 221 cerr << "cpp_out:\"" << cpp_out << "\""<< endl; 237 #endif // __DEBUG_H__222 #endif // __DEBUG_H__ 238 223 } else { 239 224 cerr << "Usage: " << argv[0] << " input-file [output-file] [options]" << endl; … … 243 228 } // for 244 229 245 #ifdef __DEBUG_H__230 #ifdef __DEBUG_H__ 246 231 cerr << "args:"; 247 232 for ( i = 1; i < nargs; i += 1 ) { … … 251 236 if ( cpp_out != NULL ) cerr << " " << cpp_out; 252 237 cerr << endl; 253 #endif // __DEBUG_H__238 #endif // __DEBUG_H__ 254 239 255 240 if ( cpp_in == NULL ) { … … 273 258 args[nargs] = NULL; // terminate argument list 274 259 275 #ifdef __DEBUG_H__260 #ifdef __DEBUG_H__ 276 261 cerr << "nargs: " << nargs << endl; 277 262 for ( i = 0; args[i] != NULL; i += 1 ) { … … 279 264 } // for 280 265 cerr << endl; 281 #endif // __DEBUG_H__266 #endif // __DEBUG_H__ 282 267 283 268 execvp( args[0], (char *const *)args ); // should not return … … 294 279 } // if 295 280 296 #ifdef __DEBUG_H__281 #ifdef __DEBUG_H__ 297 282 cerr << "tmpname:" << tmpname << " tmpfilefd:" << tmpfilefd << endl; 298 #endif // __DEBUG_H__283 #endif // __DEBUG_H__ 299 284 300 285 // Run the C preprocessor and save the output in tmpfile. … … 310 295 311 296 args[0] = compiler_name.c_str(); 312 if ( suffix( cpp_in ) ) {313 args[nargs] = "-x";314 nargs += 1;315 args[nargs] = "c";316 nargs += 1;317 } // if318 297 args[nargs] = cpp_in; // input to cpp 319 298 nargs += 1; 320 299 args[nargs] = NULL; // terminate argument list 321 300 322 #ifdef __DEBUG_H__301 #ifdef __DEBUG_H__ 323 302 cerr << "cpp nargs: " << nargs << endl; 324 303 for ( i = 0; args[i] != NULL; i += 1 ) { … … 326 305 } // for 327 306 cerr << endl; 328 #endif // __DEBUG_H__307 #endif // __DEBUG_H__ 329 308 330 309 execvp( args[0], (char *const *)args ); // should not return … … 335 314 wait( &code ); // wait for child to finish 336 315 337 #ifdef __DEBUG_H__316 #ifdef __DEBUG_H__ 338 317 cerr << "return code from cpp:" << WEXITSTATUS(code) << endl; 339 #endif // __DEBUG_H__318 #endif // __DEBUG_H__ 340 319 341 320 if ( WIFSIGNALED(code) != 0 ) { // child failed ? … … 373 352 cargs[ncargs] = NULL; // terminate argument list 374 353 375 #ifdef __DEBUG_H__354 #ifdef __DEBUG_H__ 376 355 cerr << "cfa-cpp ncargs: " << o_name << " " << CFA_flag << " " << ncargs << endl; 377 356 for ( i = 0; cargs[i] != NULL; i += 1 ) { … … 379 358 } // for 380 359 cerr << endl; 381 #endif // __DEBUG_H__360 #endif // __DEBUG_H__ 382 361 383 362 execvp( cargs[0], (char * const *)cargs ); // should not return … … 388 367 wait( &code ); // wait for child to finish 389 368 390 #ifdef __DEBUG_H__369 #ifdef __DEBUG_H__ 391 370 cerr << "return code from cfa-cpp:" << WEXITSTATUS(code) << endl; 392 #endif // __DEBUG_H__371 #endif // __DEBUG_H__ 393 372 394 373 // Must unlink here because file must exist across execvp. … … 414 393 int nargs = 1; // number of arguments in args list; 0 => command name 415 394 416 #ifdef __DEBUG_H__395 #ifdef __DEBUG_H__ 417 396 cerr << "Stage2" << endl; 418 #endif // __DEBUG_H__397 #endif // __DEBUG_H__ 419 398 420 399 // process all the arguments … … 423 402 424 403 for ( i = 1; i < argc; i += 1 ) { 425 #ifdef __DEBUG_H__404 #ifdef __DEBUG_H__ 426 405 cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl; 427 #endif // __DEBUG_H__406 #endif // __DEBUG_H__ 428 407 arg = argv[i]; 429 #ifdef __DEBUG_H__408 #ifdef __DEBUG_H__ 430 409 cerr << "arg:\"" << arg << "\"" << endl; 431 #endif // __DEBUG_H__410 #endif // __DEBUG_H__ 432 411 if ( prefix( arg, "-" ) ) { 433 412 // strip inappropriate flags 434 413 435 414 if ( arg == "-quiet" || arg == "-version" || arg == "-fpreprocessed" || 436 // Currently CFA does not suppose precompiled .h files.437 prefix( arg, "--output-pch" ) ) {415 // Currently CFA does not suppose precompiled .h files. 416 prefix( arg, "--output-pch" ) ) { 438 417 439 418 // strip inappropriate flags with an argument … … 441 420 } else if ( arg == "-auxbase" || arg == "-auxbase-strip" || arg == "-dumpbase" ) { 442 421 i += 1; 443 #ifdef __DEBUG_H__422 #ifdef __DEBUG_H__ 444 423 cerr << "arg:\"" << argv[i] << "\"" << endl; 445 #endif // __DEBUG_H__424 #endif // __DEBUG_H__ 446 425 447 426 // all other flags … … 454 433 args[nargs] = argv[i]; // pass the argument along 455 434 nargs += 1; 456 #ifdef __DEBUG_H__435 #ifdef __DEBUG_H__ 457 436 cerr << "arg:\"" << argv[i] << "\"" << endl; 458 #endif // __DEBUG_H__437 #endif // __DEBUG_H__ 459 438 } // if 460 439 } // if … … 462 441 if ( cpp_in == NULL ) { 463 442 cpp_in = argv[i]; 464 #ifdef __DEBUG_H__443 #ifdef __DEBUG_H__ 465 444 cerr << "cpp_in:\"" << cpp_in << "\"" << endl; 466 #endif // __DEBUG_H__445 #endif // __DEBUG_H__ 467 446 } else { 468 447 cerr << "Usage: " << argv[0] << " input-file [output-file] [options]" << endl; … … 472 451 } // for 473 452 474 #ifdef __DEBUG_H__453 #ifdef __DEBUG_H__ 475 454 cerr << "args:"; 476 455 for ( i = 1; i < nargs; i += 1 ) { … … 479 458 cerr << endl; 480 459 if ( cpp_in != NULL ) cerr << " " << cpp_in; 481 #endif // __DEBUG_H__460 #endif // __DEBUG_H__ 482 461 483 462 args[0] = compiler_name.c_str(); … … 488 467 args[nargs] = NULL; // terminate argument list 489 468 490 #ifdef __DEBUG_H__469 #ifdef __DEBUG_H__ 491 470 cerr << "stage2 nargs: " << nargs << endl; 492 471 for ( i = 0; args[i] != NULL; i += 1 ) { … … 494 473 } // for 495 474 cerr << endl; 496 #endif // __DEBUG_H__475 #endif // __DEBUG_H__ 497 476 498 477 execvp( args[0], (char * const *)args ); // should not return … … 503 482 504 483 int main( const int argc, const char * const argv[], __attribute__((unused)) const char * const env[] ) { 505 #ifdef __DEBUG_H__484 #ifdef __DEBUG_H__ 506 485 for ( int i = 0; env[i] != NULL; i += 1 ) { 507 486 cerr << env[i] << endl; 508 487 } // for 509 #endif // __DEBUG_H__488 #endif // __DEBUG_H__ 510 489 511 490 string arg = argv[1]; -
src/driver/cfa.cc
r0a73148 rae144af 10 10 // Created On : Tue Aug 20 13:44:49 2002 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 13 17:40:12201813 // Update Count : 2 5812 // Last Modified On : Mon May 14 14:16:33 2018 13 // Update Count : 244 14 14 // 15 15 … … 37 37 } // prefix 38 38 39 enum { NumSuffixes = 2 };40 const string suffixes[NumSuffixes] = { "cfa", "hfa", };41 42 bool suffix( string arg ) {43 //std::cerr << arg << std::endl;44 size_t dot = arg.find_last_of( "." );45 //std::cerr << dot << " " << (dot != string::npos ? arg.substr( dot + 1 ) : "fred" ) << std::endl;46 if ( dot == string::npos ) return false;47 string sx = arg.substr( dot + 1 );48 for ( int i = 0; i < NumSuffixes; i += 1 ) {49 if ( sx == suffixes[i] ) return true;50 } // for51 return false;52 } // suffix53 54 39 55 40 void shuffle( const char *args[], int S, int E, int N ) { 56 41 // S & E index 1 passed the end so adjust with -1 57 #ifdef __DEBUG_H__42 #ifdef __DEBUG_H__ 58 43 cerr << "shuffle:" << S << " " << E << " " << N << endl; 59 #endif // __DEBUG_H__44 #endif // __DEBUG_H__ 60 45 for ( int j = E-1 + N; j > S-1 + N; j -=1 ) { 61 #ifdef __DEBUG_H__46 #ifdef __DEBUG_H__ 62 47 cerr << "\t" << j << " " << j-N << endl; 63 #endif // __DEBUG_H__48 #endif // __DEBUG_H__ 64 49 args[j] = args[j-N]; 65 50 } // for … … 94 79 bool std_flag = false; // -std= flag 95 80 bool noincstd_flag = false; // -no-include-stdhdr= flag 96 bool xflag = false; // user supplied -x flag97 81 bool debugging __attribute(( unused )) = false; // -g flag 98 82 … … 104 88 int nlibs = 0; 105 89 106 #ifdef __DEBUG_H__90 #ifdef __DEBUG_H__ 107 91 cerr << "CFA:" << endl; 108 #endif // __DEBUG_H__92 #endif // __DEBUG_H__ 109 93 110 94 // process command-line arguments 111 95 112 96 for ( int i = 1; i < argc; i += 1 ) { 113 #ifdef __DEBUG_H__97 #ifdef __DEBUG_H__ 114 98 cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl; 115 #endif // __DEBUG_H__99 #endif // __DEBUG_H__ 116 100 arg = argv[i]; // convert to string value 117 #ifdef __DEBUG_H__101 #ifdef __DEBUG_H__ 118 102 cerr << "arg:\"" << arg << "\"" << endl; 119 #endif // __DEBUG_H__103 #endif // __DEBUG_H__ 120 104 if ( prefix( arg, "-" ) ) { 121 105 // pass through arguments … … 178 162 args[nargs] = argv[i]; // pass the argument along 179 163 nargs += 1; 180 } else if ( arg == "-x" ) { 181 xflag = true; 164 } else if ( arg == "-x" ) { // lost so force along 182 165 args[nargs] = argv[i]; // pass the argument along 183 166 nargs += 1; … … 185 168 args[nargs] = argv[i]; // pass the argument along 186 169 nargs += 1; 187 // args[nargs] = ( *new string( string("-D__GCC_X__=") + argv[i] ) ).c_str(); // add the argument for -x 188 // nargs += 1; 189 } else if ( prefix( arg, "-x" ) ) { 190 xflag = true; 191 args[nargs] = argv[i]; // pass the argument along 192 nargs += 1; 193 // args[nargs] = ( *new string( string("-D__GCC_X__=") + arg.substr(2) ) ).c_str(); // add the argument for -x 194 // nargs += 1; 170 args[nargs] = ( *new string( string("-D__GCC_X__=") + argv[i] ) ).c_str(); // add the argument for -x 171 nargs += 1; 172 } else if ( prefix( arg, "-x" ) ) { // lost so force along 173 args[nargs] = argv[i]; // pass the argument along 174 nargs += 1; 175 args[nargs] = ( *new string( string("-D__GCC_X__=") + arg.substr(2) ) ).c_str(); // add the argument for -x 176 nargs += 1; 195 177 } else if ( arg == "-w" ) { 196 178 args[nargs] = argv[i]; // pass the argument along … … 264 246 } // if 265 247 } else { 266 bool opt = false;267 if ( ! xflag && suffix( arg ) ) {268 args[nargs] = "-x";269 nargs += 1;270 args[nargs] = "c";271 nargs += 1;272 // args[nargs] = ( *new string( string("-D__GCC_X__=c") ) ).c_str(); // add the argument for -x273 // nargs += 1;274 opt = true;275 } // if276 248 // concatenate other arguments 277 249 args[nargs] = argv[i]; 278 250 nargs += 1; 279 if ( opt ) {280 args[nargs] = "-x";281 nargs += 1;282 args[nargs] = "none";283 nargs += 1;284 // args[nargs] = ( *new string( string("-D__GCC_X__=none") ) ).c_str(); // add the argument for -x285 // nargs += 1;286 } // if287 251 nonoptarg = true; 288 xflag = false;289 252 } // if 290 253 } // for 291 254 292 #ifdef __x86_64__255 #ifdef __x86_64__ 293 256 args[nargs] = "-mcx16"; // allow double-wide CAA 294 257 nargs += 1; 295 #endif // __x86_64__296 297 #ifdef __DEBUG_H__258 #endif // __x86_64__ 259 260 #ifdef __DEBUG_H__ 298 261 cerr << "args:"; 299 262 for ( int i = 1; i < nargs; i += 1 ) { … … 301 264 } // for 302 265 cerr << endl; 303 #endif // __DEBUG_H__266 #endif // __DEBUG_H__ 304 267 305 268 if ( cpp_flag && CFA_flag ) { … … 320 283 nargs += 1; 321 284 322 #ifdef HAVE_LIBCFA285 #ifdef HAVE_LIBCFA 323 286 if ( link ) { 324 287 #if ! defined(HAVE_LIBCFA_RELEASE) 325 if ( ! debug ) {326 cerr << "error: Option -nodebug is unavailable, libcfa was not installed." << endl;327 exit( EXIT_FAILURE );328 } // if288 if ( ! debug ) { 289 cerr << "error: Option -nodebug is unavailable, libcfa was not installed." << endl; 290 exit( EXIT_FAILURE ); 291 } // if 329 292 #endif 330 293 #if ! defined(HAVE_LIBCFA_DEBUG) 331 if ( debug ) {332 cerr << "error: Option -debug is unavailable, libcfa-d was not installed." << endl;333 exit( EXIT_FAILURE );334 } // if294 if ( debug ) { 295 cerr << "error: Option -debug is unavailable, libcfa-d was not installed." << endl; 296 exit( EXIT_FAILURE ); 297 } // if 335 298 #endif 336 299 … … 360 323 nargs += 1; 361 324 } // if 362 #endif // HAVE_LIBCFA325 #endif // HAVE_LIBCFA 363 326 364 327 // Add exception flags (unconditionally) … … 456 419 args[nargs] = NULL; // terminate with NULL 457 420 458 #ifdef __DEBUG_H__421 #ifdef __DEBUG_H__ 459 422 cerr << "nargs: " << nargs << endl; 460 423 cerr << "args:" << endl; … … 462 425 cerr << " \"" << args[i] << "\"" << endl; 463 426 } // for 464 #endif // __DEBUG_H__427 #endif // __DEBUG_H__ 465 428 466 429 if ( ! quiet ) { -
src/libcfa/math
r0a73148 rae144af 10 10 // Created On : Mon Apr 18 23:37:04 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 13 11:02:15201813 // Update Count : 1 1612 // Last Modified On : Wed Jul 11 21:12:54 2018 13 // Update Count : 109 14 14 // 15 15 … … 352 352 #include "common" 353 353 354 //---------------------------------------355 356 forall( otype T | { void ?{}( T &, one_t ); T ?+?( T, T ); T ?-?( T, T );T ?*?( T, T ); } )357 T lerp( T x, T y, T a ) { return x * ((T){1} - a) + y * a; }358 359 forall( otype T | { void ?{}( T &, zero_t ); void ?{}( T &, one_t ); int ?<?( T, T ); } )360 T step( T edge, T x ) { return x < edge ? (T){0} : (T){1}; }361 362 forall( otype T | { void ?{}( T &, int ); T clamp( T, T, T ); T ?-?( T, T ); T ?*?( T, T ); T ?/?( T, T ); } )363 T smoothstep( T edge0, T edge1, T x ) { T t = clamp( (x - edge0) / (edge1 - edge0), (T){0}, (T){1} ); return t * t * ((T){3} - (T){2} * t); }364 365 354 // Local Variables: // 366 355 // mode: c //
Note:
See TracChangeset
for help on using the changeset viewer.