Example #1
0
BOOL LoadTheDips( void ) {

    int         rc;
    unsigned    i;
    char        *ptr;
    char        buf[256];
    char        status[80];
    BOOL        diploaded;

    diploaded = FALSE;
    i = 0;
    initDipMsgs();
    ptr = DIPDefaults;
    while( *ptr != '\0' ) {
        rc = DIPLoad( ptr );
        if( rc & DS_ERR ) {
            rc &= ~DS_ERR;
            switch( rc ) {
            case DS_FOPEN_FAILED:
                CopyRCString( STR_DIP_NOT_FOUND, status, sizeof( status ) );
                break;
            case DS_INVALID_DIP_VERSION:
                CopyRCString( STR_WRONG_DIP_VERSION, status, sizeof( status ) );
                break;
            case DS_INVALID_DIP:
                CopyRCString( STR_BAD_DIP, status, sizeof( status) );
                break;
            case DS_TOO_MANY_DIPS:
                CopyRCString( STR_TOO_MANY_DIPS, status, sizeof( status) );
                break;
            default:
                CopyRCString( STR_DIP_ERR_OTHER, status, sizeof( status) );
                break;
            }
        } else {
            CopyRCString( STR_DIP_LOADED, status, sizeof( status) );
            diploaded = TRUE;
        }
        sprintf( buf, "%-18s %s", ptr, status );
        theLoadInfo[i].loadmsg = MemAlloc( strlen( buf ) + 1 );
        theLoadInfo[i].loaded = !( rc & DS_ERR );
#ifdef __WINDOWS__
        if( theLoadInfo[i].loaded ) {
            theLoadInfo[i].hinst = DIPLastHandle;
        }
#endif
        strcpy( theLoadInfo[i].loadmsg, buf );
        ptr += strlen( ptr ) + 1;
        i++;
    }
    if( !diploaded ) {
        RCMessageBox( NULL, STR_NO_DIPS_LOADED, AppName,
                      MB_OK | MB_ICONEXCLAMATION );
        ShowDIPStatus( NULL );
        DIPFini();
        return( FALSE );
    }
    return( TRUE );
}
Example #2
0
STATIC bool loadDIP( char *dip, bool defaults, bool fail_big )
/************************************************************/
{
    dip_status  ret;

    ret = DIPLoad( dip );
    if( ret != DS_OK ) {
        if( defaults && (ret == (DS_ERR|DS_FOPEN_FAILED)) ) {
            return( false );
        }
        if( fail_big ) {
            fatal( LIT( Dip_Load_Failed ), dip, errMsgText( ret ) );
        }
        ErrorMsg( LIT( Dip_Load_Failed ), dip, errMsgText( ret ) );
        return( false );
    }
    return( true );
}
Example #3
0
/**
 * Initializes DIP.
 *
 * @returns success indicator.
 * @param   dips    Pointer to an array of dip names terminated by a NULL entry.
 */
static bool InitDIP( char **dips )
{
    bool    rc = false;

    if( !(DIPInit() & DS_ERR) ) {
        char        *ptr;
        unsigned    dips_loaded = 0;

        for( ptr = *dips++; ptr; ptr = *dips++ ) {
            int     rc = DIPLoad( ptr );

            if( rc & DS_ERR ) {
                rc &= ~DS_ERR;
                switch( rc ) {
                case DS_FOPEN_FAILED:
                    ErrorMsg( "%s - not found\n", ptr );
                    break;
                case DS_INVALID_DIP_VERSION:
                    ErrorMsg( "%s - wrong DIP version\n", ptr );
                    break;
                case DS_INVALID_DIP:
                    ErrorMsg( "%s - invalid DIP\n", ptr );
                    break;
                case DS_TOO_MANY_DIPS:
                    ErrorMsg( "%s - too many DIPs\n", ptr );
                    break;
                default:
                    ErrorMsg( "%s - rc=%#x (%d)\n", ptr, rc, rc );
                    break;
                }
            } else {
                InfoMsg( "Loaded DIP %s\n", ptr);
                dips_loaded++;
            }
        }

        rc = dips_loaded > 0;
        if( !dips_loaded ) {
            ErrorMsg( "Failed to load any DIPs!\n");
            DIPFini();
        }
    }
    return( rc );
}