Changes in / [ae144af:0a73148]


Ignore:
Location:
src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/TypedefTable.cc

    rae144af r0a73148  
    1010// Created On       : Sat May 16 15:20:13 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jul 11 11:47:47 2018
    13 // Update Count     : 255
     12// Last Modified On : Fri Jul 13 18:35:54 2018
     13// Update Count     : 257
    1414//
    1515
     
    100100void TypedefTable::up( bool forall ) {
    101101        level += 1;
    102         kindTable.getNote( kindTable.currentScope() ) = (Note){ level, static_cast<bool>(forall | getEnclForall()) };
     102        kindTable.getNote( kindTable.currentScope() ) = (Note){ level, forall || getEnclForall() };
    103103        debugPrint( cerr << "Up " << " level " << level << " note " << kindTable.getNote( level ).level << ", " << kindTable.getNote( level ).forall << endl; );
    104104} // TypedefTable::up
  • src/Parser/parser.yy

    rae144af r0a73148  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jul 12 13:47:44 2018
    13 // Update Count     : 3755
     12// Last Modified On : Thu Jul 12 16:16:25 2018
     13// Update Count     : 3756
    1414//
    1515
     
    18661866        | aggregate_key attribute_list_opt no_attr_identifier fred
    18671867                {
    1868                         typedefTable.makeTypedef( *$3, forall | typedefTable.getEnclForall() ? TYPEGENname : TYPEDEFname ); // create typedef
     1868                        typedefTable.makeTypedef( *$3, forall || typedefTable.getEnclForall() ? TYPEGENname : TYPEDEFname ); // create typedef
    18691869                        forall = false;                                                         // reset
    18701870                }
     
    18741874                {
    18751875                        // 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 typedef
     1876                        typedefTable.makeTypedef( *$3->type->leafName(), forall || typedefTable.getEnclForall() ? TYPEGENname : TYPEDEFname ); // create typedef
    18771877                        forall = false;                                                         // reset
    18781878                }
     
    18921892        aggregate_key attribute_list_opt no_attr_identifier fred
    18931893                {
    1894                         typedefTable.makeTypedef( *$3, forall | typedefTable.getEnclForall() ? TYPEGENname : TYPEDEFname );
     1894                        typedefTable.makeTypedef( *$3, forall || typedefTable.getEnclForall() ? TYPEGENname : TYPEDEFname );
    18951895                        forall = false;                                                         // reset
    18961896                        $$ = DeclarationNode::newAggregate( $1, $3, nullptr, nullptr, false )->addQualifiers( $2 );
  • src/driver/cc1.cc

    rae144af r0a73148  
    1010// Created On       : Fri Aug 26 14:23:51 2005
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat May 12 16:11:53 2018
    13 // Update Count     : 94
     12// Last Modified On : Fri Jul 13 17:40:10 2018
     13// Update Count     : 110
    1414//
    1515
     
    4444} // prefix
    4545
     46enum { NumSuffixes = 2 };
     47const string suffixes[NumSuffixes] = { "cfa", "hfa", };
     48
     49bool 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        } // for
     58        return false;
     59} // suffix
     60
    4661
    4762void checkEnv( const char *args[], int &nargs ) {
     
    5166        if ( value != NULL ) {
    5267                compiler_name = value;
    53 #ifdef __DEBUG_H__
     68                #ifdef __DEBUG_H__
    5469                cerr << "env arg:\"" << compiler_name << "\"" << endl;
    55 #endif // __DEBUG_H__
     70                #endif // __DEBUG_H__
    5671        } // if
    5772
     
    5974        if ( value != NULL ) {
    6075                args[nargs] = ( *new string( value ) ).c_str(); // pass the argument along
    61 #ifdef __DEBUG_H__
     76                #ifdef __DEBUG_H__
    6277                cerr << "env arg:\"" << args[nargs] << "\"" << endl;
    63 #endif // __DEBUG_H__
     78                #endif // __DEBUG_H__
    6479                nargs += 1;
    6580        } // if
     
    6883        if ( value != NULL ) {
    6984                args[nargs] = ( *new string( value ) ).c_str(); // pass the argument along
    70 #ifdef __DEBUG_H__
     85                #ifdef __DEBUG_H__
    7186                cerr << "env arg:\"" << args[nargs] << "\"" << endl;
    72 #endif // __DEBUG_H__
     87                #endif // __DEBUG_H__
    7388                nargs += 1;
    7489        } // if
     
    115130        signal( SIGTERM, sigTermHandler );
    116131
    117 #ifdef __DEBUG_H__
     132        #ifdef __DEBUG_H__
    118133        cerr << "Stage1" << endl;
    119 #endif // __DEBUG_H__
     134        #endif // __DEBUG_H__
    120135
    121136        // process all the arguments
     
    124139
    125140        for ( i = 1; i < argc; i += 1 ) {
    126 #ifdef __DEBUG_H__
     141                #ifdef __DEBUG_H__
    127142                cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl;
    128 #endif // __DEBUG_H__
     143                #endif // __DEBUG_H__
    129144                arg = argv[i];
    130 #ifdef __DEBUG_H__
     145                #ifdef __DEBUG_H__
    131146                cerr << "arg:\"" << arg << "\"" << endl;
    132 #endif // __DEBUG_H__
     147                #endif // __DEBUG_H__
    133148                if ( prefix( arg, "-" ) ) {
    134149                        // strip g++ flags that are inappropriate or cause duplicates in subsequent passes
     
    164179                                ncargs += 1;
    165180                                i += 1;                                                                 // and the argument
    166                         } 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
     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 along
     185                        //      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 along
     190                        //      nargs += 1;
     191                        //      i += 1;                                                                 // and the argument
    177192                        } else if ( prefix( arg, D__GCC_BPREFIX__ ) ) {
    178193                                bprefix = arg.substr( D__GCC_BPREFIX__.size() );
     
    196211                                        args[nargs] = argv[i];                          // pass the argument along
    197212                                        nargs += 1;
    198 #ifdef __DEBUG_H__
     213                                        #ifdef __DEBUG_H__
    199214                                        cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl;
    200 #endif // __DEBUG_H__
     215                                        #endif // __DEBUG_H__
    201216                                } else if ( arg == "-MD" || arg == "-MMD" ) {
    202217                                        args[nargs] = "-MF";                            // insert before file
     
    205220                                        args[nargs] = argv[i];                          // pass the argument along
    206221                                        nargs += 1;
    207 #ifdef __DEBUG_H__
     222                                        #ifdef __DEBUG_H__
    208223                                        cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl;
    209 #endif // __DEBUG_H__
     224                                        #endif // __DEBUG_H__
    210225                                } // if
    211226                        } // if
     
    213228                        if ( cpp_in == NULL ) {
    214229                                cpp_in = argv[i];
    215 #ifdef __DEBUG_H__
     230                                #ifdef __DEBUG_H__
    216231                                cerr << "cpp_in:\"" << cpp_in << "\"" << endl;
    217 #endif // __DEBUG_H__
     232                                #endif // __DEBUG_H__
    218233                        } else if ( cpp_out == NULL ) {
    219234                                cpp_out = argv[i];
    220 #ifdef __DEBUG_H__
     235                                #ifdef __DEBUG_H__
    221236                                cerr << "cpp_out:\"" << cpp_out << "\""<< endl;
    222 #endif // __DEBUG_H__
     237                                #endif // __DEBUG_H__
    223238                        } else {
    224239                                cerr << "Usage: " << argv[0] << " input-file [output-file] [options]" << endl;
     
    228243        } // for
    229244
    230 #ifdef __DEBUG_H__
     245        #ifdef __DEBUG_H__
    231246        cerr << "args:";
    232247        for ( i = 1; i < nargs; i += 1 ) {
     
    236251        if ( cpp_out != NULL ) cerr << " " << cpp_out;
    237252        cerr << endl;
    238 #endif // __DEBUG_H__
     253        #endif // __DEBUG_H__
    239254
    240255        if ( cpp_in == NULL ) {
     
    258273                args[nargs] = NULL;                                                             // terminate argument list
    259274
    260 #ifdef __DEBUG_H__
     275                #ifdef __DEBUG_H__
    261276                cerr << "nargs: " << nargs << endl;
    262277                for ( i = 0; args[i] != NULL; i += 1 ) {
     
    264279                } // for
    265280                cerr << endl;
    266 #endif // __DEBUG_H__
     281                #endif // __DEBUG_H__
    267282
    268283                execvp( args[0], (char *const *)args );                 // should not return
     
    279294        } // if
    280295
    281 #ifdef __DEBUG_H__
     296        #ifdef __DEBUG_H__
    282297        cerr << "tmpname:" << tmpname << " tmpfilefd:" << tmpfilefd << endl;
    283 #endif // __DEBUG_H__
     298        #endif // __DEBUG_H__
    284299
    285300        // Run the C preprocessor and save the output in tmpfile.
     
    295310
    296311                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                } // if
    297318                args[nargs] = cpp_in;                                                   // input to cpp
    298319                nargs += 1;
    299320                args[nargs] = NULL;                                                             // terminate argument list
    300321
    301 #ifdef __DEBUG_H__
     322                #ifdef __DEBUG_H__
    302323                cerr << "cpp nargs: " << nargs << endl;
    303324                for ( i = 0; args[i] != NULL; i += 1 ) {
     
    305326                } // for
    306327                cerr << endl;
    307 #endif // __DEBUG_H__
     328                #endif // __DEBUG_H__
    308329
    309330                execvp( args[0], (char *const *)args );                 // should not return
     
    314335        wait( &code );                                                                          // wait for child to finish
    315336
    316 #ifdef __DEBUG_H__
     337        #ifdef __DEBUG_H__
    317338        cerr << "return code from cpp:" << WEXITSTATUS(code) << endl;
    318 #endif // __DEBUG_H__
     339        #endif // __DEBUG_H__
    319340
    320341        if ( WIFSIGNALED(code) != 0 ) {                                         // child failed ?
     
    352373                cargs[ncargs] = NULL;                                                   // terminate argument list
    353374
    354 #ifdef __DEBUG_H__
     375                #ifdef __DEBUG_H__
    355376                cerr << "cfa-cpp ncargs: " << o_name << " " << CFA_flag << " " << ncargs << endl;
    356377                for ( i = 0; cargs[i] != NULL; i += 1 ) {
     
    358379                } // for
    359380                cerr << endl;
    360 #endif // __DEBUG_H__
     381                #endif // __DEBUG_H__
    361382
    362383                execvp( cargs[0], (char * const *)cargs );              // should not return
     
    367388        wait( &code );                                                                          // wait for child to finish
    368389
    369 #ifdef __DEBUG_H__
     390        #ifdef __DEBUG_H__
    370391        cerr << "return code from cfa-cpp:" << WEXITSTATUS(code) << endl;
    371 #endif // __DEBUG_H__
     392        #endif // __DEBUG_H__
    372393
    373394        // Must unlink here because file must exist across execvp.
     
    393414        int nargs = 1;                                                                          // number of arguments in args list; 0 => command name
    394415
    395 #ifdef __DEBUG_H__
     416        #ifdef __DEBUG_H__
    396417        cerr << "Stage2" << endl;
    397 #endif // __DEBUG_H__
     418        #endif // __DEBUG_H__
    398419
    399420        // process all the arguments
     
    402423
    403424        for ( i = 1; i < argc; i += 1 ) {
    404 #ifdef __DEBUG_H__
     425                #ifdef __DEBUG_H__
    405426                cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl;
    406 #endif // __DEBUG_H__
     427                #endif // __DEBUG_H__
    407428                arg = argv[i];
    408 #ifdef __DEBUG_H__
     429                #ifdef __DEBUG_H__
    409430                cerr << "arg:\"" << arg << "\"" << endl;
    410 #endif // __DEBUG_H__
     431                #endif // __DEBUG_H__
    411432                if ( prefix( arg, "-" ) ) {
    412433                        // strip inappropriate flags
    413434
    414435                        if ( arg == "-quiet" || arg == "-version" || arg == "-fpreprocessed" ||
    415                                  // Currently CFA does not suppose precompiled .h files.
    416                                  prefix( arg, "--output-pch" ) ) {
     436                                // Currently CFA does not suppose precompiled .h files.
     437                                prefix( arg, "--output-pch" ) ) {
    417438
    418439                                // strip inappropriate flags with an argument
     
    420441                        } else if ( arg == "-auxbase" || arg == "-auxbase-strip" || arg == "-dumpbase" ) {
    421442                                i += 1;
    422 #ifdef __DEBUG_H__
     443                                #ifdef __DEBUG_H__
    423444                                cerr << "arg:\"" << argv[i] << "\"" << endl;
    424 #endif // __DEBUG_H__
     445                                #endif // __DEBUG_H__
    425446
    426447                                // all other flags
     
    433454                                        args[nargs] = argv[i];                          // pass the argument along
    434455                                        nargs += 1;
    435 #ifdef __DEBUG_H__
     456                #ifdef __DEBUG_H__
    436457                                        cerr << "arg:\"" << argv[i] << "\"" << endl;
    437 #endif // __DEBUG_H__
     458                #endif // __DEBUG_H__
    438459                                } // if
    439460                        } // if
     
    441462                        if ( cpp_in == NULL ) {
    442463                                cpp_in = argv[i];
    443 #ifdef __DEBUG_H__
     464                                #ifdef __DEBUG_H__
    444465                                cerr << "cpp_in:\"" << cpp_in << "\"" << endl;
    445 #endif // __DEBUG_H__
     466                                #endif // __DEBUG_H__
    446467                        } else {
    447468                                cerr << "Usage: " << argv[0] << " input-file [output-file] [options]" << endl;
     
    451472        } // for
    452473
    453 #ifdef __DEBUG_H__
     474        #ifdef __DEBUG_H__
    454475        cerr << "args:";
    455476        for ( i = 1; i < nargs; i += 1 ) {
     
    458479        cerr << endl;
    459480        if ( cpp_in != NULL ) cerr << " " << cpp_in;
    460 #endif // __DEBUG_H__
     481        #endif // __DEBUG_H__
    461482
    462483        args[0] = compiler_name.c_str();
     
    467488        args[nargs] = NULL;                                                                     // terminate argument list
    468489
    469 #ifdef __DEBUG_H__
     490        #ifdef __DEBUG_H__
    470491        cerr << "stage2 nargs: " << nargs << endl;
    471492        for ( i = 0; args[i] != NULL; i += 1 ) {
     
    473494        } // for
    474495        cerr << endl;
    475 #endif // __DEBUG_H__
     496        #endif // __DEBUG_H__
    476497
    477498        execvp( args[0], (char * const *)args );                        // should not return
     
    482503
    483504int main( const int argc, const char * const argv[], __attribute__((unused)) const char * const env[] ) {
    484 #ifdef __DEBUG_H__
     505        #ifdef __DEBUG_H__
    485506        for ( int i = 0; env[i] != NULL; i += 1 ) {
    486507                cerr << env[i] << endl;
    487508        } // for
    488 #endif // __DEBUG_H__
     509        #endif // __DEBUG_H__
    489510
    490511        string arg = argv[1];
  • src/driver/cfa.cc

    rae144af r0a73148  
    1010// Created On       : Tue Aug 20 13:44:49 2002
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon May 14 14:16:33 2018
    13 // Update Count     : 244
     12// Last Modified On : Fri Jul 13 17:40:12 2018
     13// Update Count     : 258
    1414//
    1515
     
    3737} // prefix
    3838
     39enum { NumSuffixes = 2 };
     40const string suffixes[NumSuffixes] = { "cfa", "hfa", };
     41
     42bool 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        } // for
     51        return false;
     52} // suffix
     53
    3954
    4055void shuffle( const char *args[], int S, int E, int N ) {
    4156        // S & E index 1 passed the end so adjust with -1
    42 #ifdef __DEBUG_H__
     57        #ifdef __DEBUG_H__
    4358        cerr << "shuffle:" << S << " " << E << " " << N << endl;
    44 #endif // __DEBUG_H__
     59        #endif // __DEBUG_H__
    4560        for ( int j = E-1 + N; j > S-1 + N; j -=1 ) {
    46 #ifdef __DEBUG_H__
     61                #ifdef __DEBUG_H__
    4762                cerr << "\t" << j << " " << j-N << endl;
    48 #endif // __DEBUG_H__
     63                #endif // __DEBUG_H__
    4964                args[j] = args[j-N];
    5065        } // for
     
    7994        bool std_flag = false;                                                          // -std= flag
    8095        bool noincstd_flag = false;                                                     // -no-include-stdhdr= flag
     96        bool xflag = false;                                                                     // user supplied -x flag
    8197        bool debugging __attribute(( unused )) = false;         // -g flag
    8298
     
    88104        int nlibs = 0;
    89105
    90 #ifdef __DEBUG_H__
     106        #ifdef __DEBUG_H__
    91107        cerr << "CFA:" << endl;
    92 #endif // __DEBUG_H__
     108        #endif // __DEBUG_H__
    93109
    94110        // process command-line arguments
    95111
    96112        for ( int i = 1; i < argc; i += 1 ) {
    97 #ifdef __DEBUG_H__
     113                #ifdef __DEBUG_H__
    98114                cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl;
    99 #endif // __DEBUG_H__
     115                #endif // __DEBUG_H__
    100116                arg = argv[i];                                                                  // convert to string value
    101 #ifdef __DEBUG_H__
     117                #ifdef __DEBUG_H__
    102118                cerr << "arg:\"" << arg << "\"" << endl;
    103 #endif // __DEBUG_H__
     119                #endif // __DEBUG_H__
    104120                if ( prefix( arg, "-" ) ) {
    105121                        // pass through arguments
     
    162178                                args[nargs] = argv[i];                                  // pass the argument along
    163179                                nargs += 1;
    164                         } else if ( arg == "-x" ) {                                     // lost so force along
     180                        } else if ( arg == "-x" ) {
     181                                xflag = true;
    165182                                args[nargs] = argv[i];                                  // pass the argument along
    166183                                nargs += 1;
     
    168185                                args[nargs] = argv[i];                                  // pass the argument along
    169186                                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;
     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;
    177195                        } else if ( arg == "-w" ) {
    178196                                args[nargs] = argv[i];                                  // pass the argument along
     
    246264                        } // if
    247265                } 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 -x
     273                                // nargs += 1;
     274                                opt = true;
     275                        } // if
    248276                        // concatenate other arguments
    249277                        args[nargs] = argv[i];
    250278                        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 -x
     285                                // nargs += 1;
     286                        } // if
    251287                        nonoptarg = true;
     288                        xflag = false;
    252289                } // if
    253290        } // for
    254291
    255 #ifdef __x86_64__
     292        #ifdef __x86_64__
    256293        args[nargs] = "-mcx16";                                                         // allow double-wide CAA
    257294        nargs += 1;
    258 #endif // __x86_64__
    259 
    260 #ifdef __DEBUG_H__
     295        #endif // __x86_64__
     296
     297        #ifdef __DEBUG_H__
    261298        cerr << "args:";
    262299        for ( int i = 1; i < nargs; i += 1 ) {
     
    264301        } // for
    265302        cerr << endl;
    266 #endif // __DEBUG_H__
     303        #endif // __DEBUG_H__
    267304
    268305        if ( cpp_flag && CFA_flag ) {
     
    283320        nargs += 1;
    284321
    285 #ifdef HAVE_LIBCFA
     322        #ifdef HAVE_LIBCFA
    286323        if ( link ) {
    287324                #if ! defined(HAVE_LIBCFA_RELEASE)
    288                         if ( ! debug ) {
    289                                 cerr << "error: Option -nodebug is unavailable, libcfa was not installed." << endl;
    290                                 exit( EXIT_FAILURE );
    291                         } // if
     325                if ( ! debug ) {
     326                        cerr << "error: Option -nodebug is unavailable, libcfa was not installed." << endl;
     327                        exit( EXIT_FAILURE );
     328                } // if
    292329                #endif
    293330                #if ! defined(HAVE_LIBCFA_DEBUG)
    294                         if ( debug ) {
    295                                 cerr << "error: Option -debug is unavailable, libcfa-d was not installed." << endl;
    296                                 exit( EXIT_FAILURE );
    297                         } // if
     331                if ( debug ) {
     332                        cerr << "error: Option -debug is unavailable, libcfa-d was not installed." << endl;
     333                        exit( EXIT_FAILURE );
     334                } // if
    298335                #endif
    299336
     
    323360                nargs += 1;
    324361        } // if
    325 #endif // HAVE_LIBCFA
     362        #endif // HAVE_LIBCFA
    326363
    327364        // Add exception flags (unconditionally)
     
    419456        args[nargs] = NULL;                                                                     // terminate with NULL
    420457
    421 #ifdef __DEBUG_H__
     458        #ifdef __DEBUG_H__
    422459        cerr << "nargs: " << nargs << endl;
    423460        cerr << "args:" << endl;
     
    425462                cerr << " \"" << args[i] << "\"" << endl;
    426463        } // for
    427 #endif // __DEBUG_H__
     464        #endif // __DEBUG_H__
    428465
    429466        if ( ! quiet ) {
  • src/libcfa/math

    rae144af r0a73148  
    1010// Created On       : Mon Apr 18 23:37:04 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jul 11 21:12:54 2018
    13 // Update Count     : 109
     12// Last Modified On : Fri Jul 13 11:02:15 2018
     13// Update Count     : 116
    1414//
    1515
     
    352352#include "common"
    353353
     354//---------------------------------------
     355
     356forall( otype T | { void ?{}( T &, one_t ); T ?+?( T, T ); T ?-?( T, T );T ?*?( T, T ); } )
     357T lerp( T x, T y, T a ) { return x * ((T){1} - a) + y * a; }
     358
     359forall( otype T | { void ?{}( T &, zero_t ); void ?{}( T &, one_t ); int ?<?( T, T ); } )
     360T step( T edge, T x ) { return x < edge ? (T){0} : (T){1}; }
     361
     362forall( otype T | { void ?{}( T &, int ); T clamp( T, T, T ); T ?-?( T, T ); T ?*?( T, T ); T ?/?( T, T ); } )
     363T 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
    354365// Local Variables: //
    355366// mode: c //
Note: See TracChangeset for help on using the changeset viewer.