void WPDipInit( void ) /********************/ { char *dip_name; unsigned dip_count; dip_status dip_stat; dip_stat = DIPInit(); if( dip_stat != DS_OK ) { fatal( LIT( Dip_Init_Failed ), dip_stat&~DS_ERR ); } dip_count = 0; if( WProfDips == NULL ) { dip_name = DIPDefaults; } else { dip_name = WProfDips; } for( ; *dip_name != NULLCHAR; dip_name += strlen( dip_name ) + 1 ) { if( loadDIP( dip_name, true, true ) ) { dip_count++; } } if( dip_count == 0 ) { DIPFini(); fatal( LIT( Dip_Find_Failed )); } }
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 ); }
/** * 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 ); }
/* * FiniSymbols */ void FiniSymbols( void ) { if( dipIsLoaded ) { DIPFini(); FiniDipMsgs(); } }
void WPDipFini( void ) /********************/ { DIPFini(); }