Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main.cc

    r711eee5 r7b937575  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // main.cc --
     7// main.cc -- 
    88//
    99// Author           : Richard C. Bilson
    1010// Created On       : Fri May 15 23:12:02 2015
    11 // Last Modified By : Rob Schluntz
    12 // Last Modified On : Wed May 04 16:54:52 2016
    13 // Update Count     : 199
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Wed May  4 23:32:59 2016
     13// Update Count     : 203
    1414//
    1515
     
    4141#include "InitTweak/Mutate.h"
    4242#include "InitTweak/RemoveInit.h"
    43 #include "InitTweak/FixGlobalInit.h"
    4443//#include "Explain/GenProlog.h"
    4544//#include "Try/Visit.h"
     
    9897        std::ostream *output = &std::cout;
    9998        int long_index;
    100         std::list< Declaration* > translationUnit;
     99        std::list< Declaration * > translationUnit;
     100        const char *filename = NULL;;
    101101
    102102        opterr = 0;                                                                                     // prevent getopt from printing error messages
    103 
     103       
    104104        int c;
    105         while ( (c = getopt_long( argc, argv, "abefglnpqrstvyzD:", long_opts, &long_index )) != -1 ) {
     105        while ( (c = getopt_long( argc, argv, "abefglnpqrstvyzD:F:", long_opts, &long_index )) != -1 ) {
    106106                switch ( c ) {
    107107                  case Ast:
     
    163163                        break;
    164164                  case 'D':                                                                             // ignore -Dxxx
     165                        break;
     166                  case 'F':                                                                             // source file-name without suffix
     167                        filename = optarg;
    165168                        break;
    166169                  case '?':
     
    173176
    174177        try {
    175                 std::string fileName;
    176 
    177178                // choose to read the program from a file or stdin
    178179                if ( optind < argc ) {
    179180                        input = fopen( argv[ optind ], "r" );
    180181                        if ( ! input ) {
    181                                 std::cout << "Error: can't open " << argv[ optind ] << std::endl;
     182                                std::cout << "Error: can't open " << argv[optind] << std::endl;
    182183                                exit( 1 );
    183184                        } // if
    184185                        optind += 1;
    185 
    186                         // assert( optind < argc );
    187                         fileName = argv[ optind-1 ]; // placeholder
    188                         // optind += 1;
    189186                } else {
    190187                        input = stdin;
     
    194191                        output = new ofstream( argv[ optind ] );
    195192                } // if
    196 
     193       
    197194                Parser::get_parser().set_debug( grammarp );
    198195
     
    215212                                        exit( 1 );
    216213                                } // if
    217 
     214                   
    218215                                parse( prelude, LinkageSpec::Intrinsic );
    219216                        } // if
    220217                } // if
    221218
    222                 parse( input, libcfap ? LinkageSpec::Intrinsic : LinkageSpec::Cforall, grammarp );
    223 
     219                parse( input, libcfap ? LinkageSpec::Intrinsic : LinkageSpec::Cforall, grammarp );     
     220 
    224221                if ( parsep ) {
    225222                        Parser::get_parser().get_parseTree()->printList( std::cout );
     
    256253                OPTPRINT( "mutate" )
    257254                ControlStruct::mutate( translationUnit );
    258                 OPTPRINT( "fixNames" )
     255                OPTPRINT( "fixNames" ) 
    259256                CodeGen::fixNames( translationUnit );
    260                 OPTPRINT( "fixGlobalInit" );
    261                 InitTweak::fixGlobalInit( translationUnit, fileName );
    262257                OPTPRINT( "tweak" )
    263258                InitTweak::tweak( translationUnit );
     
    287282                OPTPRINT( "box" )
    288283                GenPoly::box( translationUnit );
    289 
     284               
    290285                // print tree right before code generation
    291286                if ( codegenp ) {
     
    343338        std::list< Declaration * > decls;
    344339        if ( noprotop ) {
    345                 filter( translationUnit.begin(), translationUnit.end(),
     340                filter( translationUnit.begin(), translationUnit.end(), 
    346341                                std::back_inserter( decls ), notPrelude );
    347342        } else {
Note: See TracChangeset for help on using the changeset viewer.