clustal-omega-1.2.4/src/clustal/progress.c
/**
 * @brief Prints a progress update (and a carriage return)
 *
 * @param[in] prProgress
 * Pointer to the progress structure
 * @param[in] iStep
 * Current step number
 * @param[in] iTotalSteps
 * Total step number
 * @param[in] bForceOutput
 * If percentage hasn't changed output is normally supressed
 * normally. Output can be forced with this flag.
 *
 */
@brief Prints a progress update (and a carriage return)

@param[in] prProgress
Pointer to the progress structure
@param[in] iStep
Current step number
@param[in] iTotalSteps
Total step number
@param[in] bForceOutput
If percentage hasn't changed output is normally supressed
normally. Output can be forced with this flag.
@brief Prints a progress update ( and a carriage return ) @param [ in ] prProgress Pointer to the progress structure @param [ in ] iStep Current step number @param [ in ] iTotalSteps Total step number @param [ in ] bForceOutput If percentage hasn ' t changed output is normally supressed normally . Output can be forced with this flag .
void
ProgressLog(progress_t *prProgress, 
            unsigned long int iStep, unsigned long int iTotalSteps, 
            bool bForceOutput)
{
    char pcLogMsg[1024];
    assert(0!=iTotalSteps);
    if (rLog.iLogLevelEnabled>LOGLEVEL_THRESHOLD) {
        return;
    }
    (void) snprintf(pcLogMsg, sizeof(pcLogMsg), "%s: %lu %%",
                    prProgress->pcPrefix, (unsigned long int)(iStep/(float)iTotalSteps*100.0));
    if (! bForceOutput) {
        if (STR_EQ(pcLogMsg, prProgress->pcLastLogMsg)) {
            return;
        }
    }
    strncpy(prProgress->pcLastLogMsg, pcLogMsg,
            sizeof(prProgress->pcLastLogMsg));
    fprintf(prProgress->prFile, "%s (%lu out of %lu)", pcLogMsg, iStep, iTotalSteps);
    if (prProgress->bPrintCR) {
        fprintf(prProgress->prFile, "\r");
    } else {
        fprintf(prProgress->prFile, "\n");
    }
    (void) fflush(prProgress->prFile);
    return; 
}
void ProgressLog ( progress_t * prProgress , unsigned long int iStep , unsigned long int iTotalSteps , bool bForceOutput ) { char pcLogMsg [ 1024 ] ; assert ( 0 != iTotalSteps ) ; if ( rLog . iLogLevelEnabled > LOGLEVEL_THRESHOLD ) { return ; } ( void ) snprintf ( pcLogMsg , sizeof ( pcLogMsg ) , " " , prProgress -> pcPrefix , ( unsigned long int ) ( iStep / ( float ) iTotalSteps * 100.0 ) ) ; if ( ! bForceOutput ) { if ( STR_EQ ( pcLogMsg , prProgress -> pcLastLogMsg ) ) { return ; } } strncpy ( prProgress -> pcLastLogMsg , pcLogMsg , sizeof ( prProgress -> pcLastLogMsg ) ) ; fprintf ( prProgress -> prFile , " " , pcLogMsg , iStep , iTotalSteps ) ; if ( prProgress -> bPrintCR ) { fprintf ( prProgress -> prFile , " \r " ) ; } else { fprintf ( prProgress -> prFile , " \n " ) ; } ( void ) fflush ( prProgress -> prFile ) ; return ; }
@brief Prints a progress update (and a carriage return)
@brief Prints a progress update ( and a carriage return )
/* Skip logging, if we've just logged the same message */