Exemple #1
0
int main( int argc, char *argv[] )
/********************************/
{
    int     i;
    char    *fn;

    if( argc == 1 )
        usage();
    for( i = 1; i < argc; ++i ) {
        fn = DoWildCard( argv[i] );
        while( fn != NULL ) {
            process_file_pubdef( fn );
            fn = DoWildCard( NULL );
        }
        DoWildCardClose();
    }
    return( 0 );
}
Exemple #2
0
int main( int argc, char *argv[] )
/********************************/
{
    int     i;
    char    *fn;

    pubdef_tab = SymbolInit();
    for( i = 1; i < argc; ++i ) {
        if( argv[i][0] == '-' ) {
            switch( tolower( argv[i][1] ) ) {
            case 'i':
                if( argv[i][2] == '=' ) {
                    process_except_file( argv[i] + 3 );
                    break;
                }
            default:
                usage();
                return( 1 );
            }
        } else {
            break;
        }
    }
    if( i == argc ) {
        usage();
        return( 1 );
    }
    extdef_tab = SymbolInit();
    for( ; i < argc; ++i ) {
        fn = DoWildCard( argv[i] );
        while( fn != NULL ) {
            process_file_modref( fn );
            fn = DoWildCard( NULL );
        }
        DoWildCardClose();
    }
    SymbolFini( pubdef_tab );
    SymbolFini( extdef_tab );
    return( 0 );
}
Exemple #3
0
static  int     CompLink( void ) {
//================================

    int         rc;
    const char  *file;
    bool        comp_err;
    PGROUP      pg;
    int         i;
    list        *currobj;
    list        *nextobj;

    if( Flags.quiet ) {
        Fputnl( "option quiet", Fp );
    }
    fputs( DebugOptions[ DebugFlag ], Fp );
    if( Flags.link_for_sys ) {
        fputs( "system ", Fp );
        Fputnl( SystemName, Fp );
    } else {
#if defined( __QNX__ )
        Fputnl( "system qnx", Fp );
#elif defined( __LINUX__ )
        Fputnl( "system linux", Fp );
#elif _CPU == 386
    #if defined( __OS2__ )
        Fputnl( "system os2v2", Fp );
    #elif defined( __NT__ )
        Fputnl( "system nt", Fp );
    #else
        Fputnl( "system dos4g", Fp );
    #endif
#elif _CPU == 8086
        if( Flags.windows ) {
            Fputnl( "system windows", Fp );
        } else if( Flags.link_for_dos ) {
            Fputnl( "system dos", Fp );
        } else if( Flags.link_for_os2 ) {
            Fputnl( "system os2", Fp );
        } else {
    #if defined( __OS2__ )
            Fputnl( "system os2", Fp );
    #else
            Fputnl( "system dos", Fp );
    #endif
        }
#elif _CPU == _AXP
        Fputnl( "system ntaxp", Fp );
#else
    #error Unknown System
#endif

    }

    comp_err = false;
    ObjList = NULL;
    for( currobj = FileList; currobj != NULL; currobj = nextobj ) {
        strcpy( Word, currobj->filename );
        MakeName( Word, ".for" );   // if no extension, assume ".for"
        file = DoWildCard( Word );
        while( file != NULL ) {     // while more filenames:
            strcpy( Word, file );
#ifndef __UNIX__
            strlwr( Word );
#endif
            _splitpath2( Word, pg.buffer, &pg.drive, &pg.dir, &pg.fname, &pg.ext );
            if( strcmp( pg.ext, OBJ_EXT ) != 0 ) {  // if not object, compile
                rc = tool_exec( TYPE_FOR, Word, CmpOpts );
                if( rc != 0 ) {
                    comp_err = true;
                    if( ( rc == -1 ) || ( rc == 255 ) ) {
                        rc = 1;
                        break;
                    }
                }
            }
            _makepath( Word, NULL, NULL, pg.fname, NULL );
            if( ExeName[0] == '\0' ) {
                fputs( "name '", Fp );
                fputs( Word, Fp );
                Fputnl( "'", Fp );
                strcpy( ExeName, Word );
            }
            _makepath( Word, NULL, NULL, pg.fname, OBJ_EXT );
            AddName( Word, Fp );        // add obj filename

            file = DoWildCard( NULL );  // get next filename
        }
        DoWildCardClose();
        nextobj = currobj->next;
        free( currobj->filename );
        free( currobj );
    }
    for( currobj = LibList; currobj != NULL; currobj = nextobj ) {
        fputs( "library ", Fp );
        Fputnl( currobj->filename, Fp );
        nextobj = currobj->next;
        free( currobj->filename );
        free( currobj );
    }
    fclose( Fp );   // close TempFile

    if( comp_err ) {
        rc = 1;
    } else {
        rc = 0;
        if( ( ObjList != NULL ) && !Flags.no_link ) {
            rc = tool_exec( TYPE_LINK, "@" TEMPFILE, NULL );
            if( rc == 0 && Flags.do_cvpack ) {
                rc = tool_exec( TYPE_PACK, ExeName, NULL );
            }
            if( rc != 0 ) {
                rc = 2;    // return 2 to show Temp_File already closed
            }
        }
    }
    for( currobj = ObjList; currobj != NULL; currobj = nextobj ) {
        nextobj = currobj->next;
        free( currobj->filename );
        free( currobj );
    }
    for( i = 0; i < TYPE_MAX; ++i ) {
        if( tools[i].path != NULL ) {
            free( tools[i].path );
            tools[i].path = NULL;
        }
    }
    return( rc );
}