rank.h File Reference

Contains functions for rank command. More...

Go to the source code of this file.

Functions

void command_rank (int argc, int last_arg, const char **argv)
 Parses command-line for rank options and performs rank command.

Detailed Description

Contains functions for rank command.

Author:
Trevor Williams (phase1geo@gmail.com)
Date:
6/28/2008

Function Documentation

void command_rank ( int  argc,
int  last_arg,
const char **  argv 
)

Parses command-line for rank options and performs rank command.

Performs merge command functionality.

Parameters:
argc Number of arguments in command-line to parse
last_arg Index of last parsed argument from list
argv List of arguments from command-line to parse

References allow_multi_expr, Catch_anonymous, COVERED_HEADER, FALSE, free_safe, HEADER, largest_malloc_size, str_link_s::next, NORMAL, print_output(), PROFILE, PROFILE_END, rank_dealloc_comp_cdd_cov(), rank_file, rank_output(), rank_parse_args(), rank_perform(), rank_read_cdd(), rank_verbose, report_assertion, report_combination, report_fsm, report_line, report_memory, report_toggle, str_link_s::str, str_link_delete_list(), str_link_s::suppl, Throw, TRUE, Try, user_msg, and USER_MSG_LENGTH.

Referenced by main().

01733   { PROFILE(COMMAND_RANK);
01734 
01735   int            i, j;
01736   unsigned int   rv;
01737   comp_cdd_cov** comp_cdds    = NULL;
01738   unsigned int   comp_cdd_num = 0;
01739   bool           error        = FALSE;
01740 
01741   /* Output header information */
01742   rv = snprintf( user_msg, USER_MSG_LENGTH, COVERED_HEADER );
01743   assert( rv < USER_MSG_LENGTH );
01744   print_output( user_msg, HEADER, __FILE__, __LINE__ );
01745 
01746   Try {
01747 
01748     unsigned int rv;
01749     bool         first  = TRUE;
01750     str_link*    strl;
01751     timer*       atimer = NULL;
01752 
01753     /* Parse score command-line */
01754     if( !rank_parse_args( argc, last_arg, argv ) ) {
01755 
01756       /* Make sure that all coverage points are accumulated */
01757       report_line        = TRUE;
01758       report_toggle      = TRUE;
01759       report_combination = TRUE;
01760       report_fsm         = TRUE;
01761       report_assertion   = TRUE;
01762       report_memory      = TRUE;
01763       allow_multi_expr   = FALSE;
01764 
01765       /* Start timer */
01766       if( rank_verbose ) {
01767         timer_clear( &atimer );
01768         timer_start( &atimer );
01769       }
01770 
01771       /* Read in databases to merge */
01772       strl = rank_in_head;
01773       while( strl != NULL ) {
01774         rv = snprintf( user_msg, USER_MSG_LENGTH, "Reading CDD file \"%s\"", strl->str );
01775         assert( rv < USER_MSG_LENGTH );
01776         print_output( user_msg, NORMAL, __FILE__, __LINE__ );
01777         rv = fflush( stdout );
01778         assert( rv == 0 );
01779         rank_read_cdd( strl->str, (strl->suppl == 1), first, &comp_cdds, &comp_cdd_num );
01780         first = FALSE;
01781         strl  = strl->next;
01782       }
01783 
01784       if( rank_verbose ) {
01785         timer_stop( &atimer );
01786         rv = snprintf( user_msg, USER_MSG_LENGTH, "Completed reading in CDD files in %s", timer_to_string( atimer ) );
01787         assert( rv < USER_MSG_LENGTH );
01788         print_output( user_msg, NORMAL, __FILE__, __LINE__ );
01789         free_safe( atimer, sizeof( timer ) );
01790       }
01791 
01792       /* Peaform the ranking algorithm */
01793       rank_perform( comp_cdds, comp_cdd_num );
01794 
01795       /* Output the results */
01796       rank_output( comp_cdds, comp_cdd_num );
01797 
01798       /*@-duplicatequals -formatcode -formattype@*/
01799       rv = snprintf( user_msg, USER_MSG_LENGTH, "Dynamic memory allocated:   %" FMT64 "u bytes", largest_malloc_size );
01800       assert( rv < USER_MSG_LENGTH );
01801       /*@=duplicatequals =formatcode =formattype@*/
01802       print_output( "", NORMAL, __FILE__, __LINE__ );
01803       print_output( user_msg, NORMAL, __FILE__, __LINE__ );
01804       print_output( "", NORMAL, __FILE__, __LINE__ );
01805 
01806     }
01807 
01808   } Catch_anonymous {
01809     error = TRUE;
01810   }
01811 
01812   /* Deallocate other allocated variables */
01813   str_link_delete_list( rank_in_head );
01814 
01815   /* Deallocate the compressed CDD coverage structures */
01816   for( i=0; i<comp_cdd_num; i++ ) {
01817     rank_dealloc_comp_cdd_cov( comp_cdds[i] );
01818   }
01819   free_safe( comp_cdds, (sizeof( comp_cdd_cov* ) * comp_cdd_num) );
01820 
01821   free_safe( rank_file, (strlen( rank_file ) + 1) );
01822 
01823   if( error ) {
01824     Throw 0;
01825   }
01826 
01827   PROFILE_END;
01828 
01829 }

Generated on Sun Nov 21 00:55:40 2010 for Covered by  doxygen 1.6.3