Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

/Users/trevorw/projects/release/covered-0.7.4/src/arc.h File Reference


Detailed Description

Contains functions for handling FSM arc arrays.

Author:
Trevor Williams (phase1geo@gmail.com)
Date:
8/25/2003

#include <stdio.h>
#include "defines.h"

Go to the source code of this file.

Functions

fsm_tablearc_create ()
 Allocates and initializes new state transition array.

void arc_add (fsm_table *table, const vector *fr_st, const vector *to_st, int hit, bool exclude)
 Adds new state transition arc entry to specified table.

int arc_find_from_state (const fsm_table *table, const vector *st)
 Finds the specified FROM state in the given FSM table.

int arc_find_to_state (const fsm_table *table, const vector *st)
 Finds the specified TO state in the given FSM table.

int arc_find_arc (const fsm_table *table, unsigned int fr_index, unsigned int to_index)
 Finds the specified state transition in the given FSM table.

int arc_find_arc_by_exclusion_id (const fsm_table *table, int id)
 Finds the specified state transition in the given FSM table by the exclusion ID.

void arc_get_stats (const fsm_table *table, int *state_hits, int *state_total, int *arc_hits, int *arc_total, int *arc_excluded)
 Calculates all state and state transition values for reporting purposes.

void arc_db_write (const fsm_table *table, FILE *file)
 Writes specified arc array to specified CDD file.

void arc_db_read (fsm_table **table, char **line)
 Reads in arc array from CDD database string.

void arc_db_merge (fsm_table *table, char **line)
 Merges contents of arc table from line to specified base array.

void arc_merge (fsm_table *base, const fsm_table *other)
 Merges two FSM arcs, placing the results in the base arc.

void arc_get_states (char ***fr_states, unsigned int *fr_state_size, char ***to_states, unsigned int *to_state_size, const fsm_table *table, bool hit, bool any)
 Stores arc array state values to specified string array.

void arc_get_transitions (char ***from_states, char ***to_states, int **ids, int **excludes, char ***reasons, int *arc_size, const fsm_table *table, func_unit *funit, bool hit, bool any)
 Outputs arc array state transition values to specified output stream.

bool arc_are_any_excluded (const fsm_table *table)
 Specifies if any state transitions have been excluded from coverage.

void arc_dealloc (fsm_table *table)
 Deallocates memory for specified arcs array.


Function Documentation

void arc_add fsm_table table,
const vector fr_st,
const vector to_st,
int  hit,
bool  exclude
 

Adds new state transition arc entry to specified table.

If specified arcs array has not been created yet (value is set to NULL), allocate enough memory in the arc array to hold width number of state transitions. If the specified arcs array has been created but is currently full (arc array max_size and curr_size are equal to each other), add width number of more arc array entries to the current array. After memory has been allocated, create a state transition entry from the fr_st and to_st expressions, setting the hit bits in the entry to 0.

Parameters:
table  Pointer to FSM table to add state transition arc array to
fr_st  Pointer to vector containing the from state
to_st  Pointer to vector containing the to state
hit  Specifies if arc entry should be marked as hit
exclude  If new arc is created, sets the exclude bit to this value

00329   { PROFILE(ARC_ADD);
00330 
00331   int from_index;  /* Index of found from_state in states array */
00332   int to_index;    /* Index of found to_state in states array */
00333   int arcs_index;  /* Index of found state transition in arcs array */
00334 
00335   assert( table != NULL );
00336 
00337   if( (hit == 0) || (!vector_is_unknown( fr_st ) && !vector_is_unknown( to_st )) ) {
00338 
00339     /* Search for the from_state vector in the states array */
00340     if( (from_index = arc_find_from_state( table, fr_st )) == -1 ) {
00341       table->fr_states = (vector**)realloc_safe( table->fr_states, (sizeof( vector* ) * table->num_fr_states), (sizeof( vector* ) * (table->num_fr_states + 1)) );
00342       from_index    = table->num_fr_states;
00343       table->fr_states[from_index] = vector_create( fr_st->width, VTYPE_VAL, fr_st->suppl.part.data_type, TRUE );
00344       vector_copy( fr_st, table->fr_states[from_index] );
00345       table->num_fr_states++;
00346     }
00347 
00348     /* Search for the to_state vector in the states array */
00349     if( (to_index = arc_find_to_state( table, to_st )) == -1 ) {
00350       table->to_states = (vector**)realloc_safe( table->to_states, (sizeof( vector* ) * table->num_to_states), (sizeof( vector* ) * (table->num_to_states + 1)) );
00351       to_index      = table->num_to_states;
00352       table->to_states[to_index] = vector_create( to_st->width, VTYPE_VAL, to_st->suppl.part.data_type, TRUE );
00353       vector_copy( to_st, table->to_states[to_index] );
00354       table->num_to_states++;
00355     }
00356 
00357     /* If we need to add a new arc, do so now */
00358     if( (arcs_index = arc_find_arc( table, from_index, to_index )) == -1 ) {
00359 
00360       table->arcs = (fsm_table_arc**)realloc_safe( table->arcs, (sizeof( fsm_table_arc* ) * table->num_arcs), (sizeof( fsm_table_arc* ) * (table->num_arcs + 1)) );
00361       table->arcs[table->num_arcs] = (fsm_table_arc*)malloc_safe( sizeof( fsm_table_arc ) );
00362       table->arcs[table->num_arcs]->suppl.all           = 0;
00363       table->arcs[table->num_arcs]->suppl.part.hit      = hit;
00364       table->arcs[table->num_arcs]->suppl.part.excluded = exclude;
00365       table->arcs[table->num_arcs]->from                = from_index;
00366       table->arcs[table->num_arcs]->to                  = to_index;
00367       arcs_index = table->num_arcs;
00368       table->num_arcs++;
00369 
00370     /* Otherwise, adjust hit and exclude information */
00371     } else {
00372 
00373       table->arcs[arcs_index]->suppl.part.hit      |= hit;
00374       table->arcs[arcs_index]->suppl.part.excluded |= exclude;
00375 
00376     }
00377 
00378     /* If we have set a side with hit equal to 0, we are specifying a known transition. */
00379     if( hit == 0 ) {
00380       table->suppl.part.known = 1;
00381     }
00382 
00383   }
00384 
00385   PROFILE_END;
00386 
00387 }

bool arc_are_any_excluded const fsm_table table  ) 
 

Specifies if any state transitions have been excluded from coverage.

Returns:
Returns TRUE if any state transitions were excluded from coverage; otherwise, returns FALSE.
Parameters:
table  Pointer to state transition arc array

00843   { PROFILE(ARC_ARE_ANY_EXCLUDED);
00844 
00845   unsigned int i = 0;  /* Loop iterator */
00846 
00847   assert( table != NULL );
00848 
00849   while( (i < table->num_arcs) && (table->arcs[i]->suppl.part.excluded == 0) ) i++;
00850 
00851   PROFILE_END;
00852 
00853   return( i < table->num_arcs );
00854 
00855 }

fsm_table* arc_create  ) 
 

Allocates and initializes new state transition array.

Returns:
Returns a pointer to the newly created arc transition structure.
Allocates memory for a new state transition arc array and initializes its contents.

00291                         { PROFILE(ARC_CREATE);
00292 
00293   fsm_table* table;  /* Pointer to newly created FSM table */
00294 
00295   /* Allocate memory for the new table here */
00296   table = (fsm_table*)malloc_safe( sizeof( fsm_table ) );
00297 
00298   /* Initialize */
00299   table->suppl.all     = 0;
00300   table->id            = 0;
00301   table->fr_states     = NULL;
00302   table->num_fr_states = 0;
00303   table->to_states     = NULL;
00304   table->num_to_states = 0;
00305   table->arcs          = NULL;
00306   table->num_arcs      = 0;
00307 
00308   PROFILE_END;
00309 
00310   return( table );
00311 
00312 }

void arc_db_merge fsm_table base,
char **  line
 

Merges contents of arc table from line to specified base array.

Exceptions:
anonymous Throw arc_db_read
Merges the specified FSM arc information from the current line into the base FSM arc information.
Parameters:
base  Pointer to arc table to merge data into
line  Pointer to read in line from CDD file to merge

00667   { PROFILE(ARC_DB_MERGE);
00668 
00669   /*@-mustfreeonly -mustfreefresh@*/
00670 
00671   fsm_table*   table;  /* Currently read FSM table */
00672   unsigned int i;      /* Loop iterator */
00673 
00674   /* Read in the table */
00675   arc_db_read( &table, line );
00676 
00677   /* Merge state transitions */
00678   for( i=0; i<table->num_arcs; i++ ) {
00679     arc_add( base, table->fr_states[table->arcs[i]->from], table->to_states[table->arcs[i]->to], table->arcs[i]->suppl.part.hit, table->arcs[i]->suppl.part.excluded );
00680   }
00681 
00682   /* Deallocate the merged table */
00683   arc_dealloc( table );
00684 
00685   PROFILE_END;
00686 
00687   /*@=mustfreeonly =mustfreefresh@*/
00688 
00689 }

void arc_db_read fsm_table **  table,
char **  line
 

Reads in arc array from CDD database string.

Exceptions:
anonymous Throw
Reads in specified state transition arc table, allocating the appropriate space to hold the table. Returns TRUE if the specified line contained an appropriately written arc transition table; otherwise, returns FALSE.
Parameters:
table  Pointer to state transition arc array
line  String containing current CDD line of arc information

00564   { PROFILE(ARC_DB_READ);
00565 
00566   /* Allocate table */
00567   *table = arc_create();
00568 
00569   Try {
00570 
00571     unsigned int num_fr_states;
00572     unsigned int num_to_states;
00573     int          chars_read;
00574 
00575     /*@-formatcode@*/
00576     if( sscanf( *line, "%hhx %u %u%n", &((*table)->suppl.all), &num_fr_states, &num_to_states, &chars_read ) == 3 ) {
00577     /*@=formatcode@*/
00578 
00579       unsigned int i;
00580       unsigned int num_arcs;
00581 
00582       *line += chars_read;
00583 
00584       /* Set exclusion ID */
00585       (*table)->id = curr_arc_id;
00586 
00587       /* Allocate and initialize fr_states array */
00588       (*table)->fr_states     = (vector**)malloc_safe( sizeof( vector* ) * num_fr_states );
00589       (*table)->num_fr_states = num_fr_states;
00590       for( i=0; i<num_fr_states; i++ ) {
00591         (*table)->fr_states[i] = NULL;
00592       }
00593 
00594       /* Read in from vectors */
00595       for( i=0; i<num_fr_states; i++ ) {
00596         vector_db_read( &((*table)->fr_states[i]), line );
00597       }
00598 
00599       /* Allocate and initialize to_states array */
00600       (*table)->to_states     = (vector**)malloc_safe( sizeof( vector* ) * num_to_states );
00601       (*table)->num_to_states = num_to_states;
00602       for( i=0; i<num_to_states; i++ ) {
00603         (*table)->to_states[i] = NULL;
00604       }
00605 
00606       /* Read in vectors */
00607       for( i=0; i<num_to_states; i++ ) {
00608         vector_db_read( &((*table)->to_states[i]), line );
00609       }
00610 
00611       if( sscanf( *line, "%u%n", &num_arcs, &chars_read ) == 1 ) {
00612 
00613         *line += chars_read;
00614 
00615         /* Allocate arcs array */
00616         (*table)->arcs     = (fsm_table_arc**)malloc_safe( sizeof( fsm_table_arc* ) * num_arcs );
00617         (*table)->num_arcs = num_arcs;
00618         for( i=0; i<num_arcs; i++ ) {
00619           (*table)->arcs[i] = NULL;
00620         }
00621 
00622         for( i=0; i<num_arcs; i++ ) {
00623 
00624           /* Allocate fsm_table_arc */
00625           (*table)->arcs[i] = (fsm_table_arc*)malloc_safe( sizeof( fsm_table_arc ) );
00626 
00627           /*@-formatcode@*/
00628           if( sscanf( *line, "%u %u %hhx%n", &((*table)->arcs[i]->from), &((*table)->arcs[i]->to), &((*table)->arcs[i]->suppl.all), &chars_read ) != 3 ) {
00629           /*@=formatcode@*/
00630             print_output( "Unable to parse FSM table information from database.  Unable to read.", FATAL, __FILE__, __LINE__ );
00631             Throw 0;
00632           } else {
00633             *line += chars_read;
00634             curr_arc_id++;
00635           }
00636 
00637         }
00638 
00639       } else {
00640         print_output( "Unable to parse FSM table information from database.  Unable to read.", FATAL, __FILE__, __LINE__ );
00641         Throw 0;
00642       }
00643 
00644     } else {
00645       print_output( "Unable to parse FSM table information from database.  Unable to read.", FATAL, __FILE__, __LINE__ );
00646       Throw 0;
00647     }
00648 
00649   } Catch_anonymous {
00650     arc_dealloc( *table );
00651     *table = NULL;
00652     Throw 0;
00653   }
00654 
00655   PROFILE_END;
00656 
00657 }

void arc_db_write const fsm_table table,
FILE *  file
 

Writes specified arc array to specified CDD file.

Writes the specified arcs array to the specified CDD output file. An arc array is output in a special format that is described in the above documentation for this file.

Parameters:
table  Pointer to state transition arc array to write
file  Pointer to CDD file to write

00522   { PROFILE(ARC_DB_WRITE);
00523 
00524   unsigned int  i;   /* Loop iterator */
00525 
00526   assert( table != NULL );
00527 
00528   /*@-formatcode@*/
00529   fprintf( file, " %hhx %u %u ", table->suppl.all, table->num_fr_states, table->num_to_states );
00530   /*@=formatcode@*/
00531 
00532   /* Output state information */
00533   for( i=0; i<table->num_fr_states; i++ ) {
00534     vector_db_write( table->fr_states[i], file, TRUE, FALSE );
00535     fprintf( file, "  " );
00536   }
00537   for( i=0; i<table->num_to_states; i++ ) {
00538     vector_db_write( table->to_states[i], file, TRUE, FALSE );
00539     fprintf( file, "  " );
00540   }
00541 
00542   /* Output arc information */
00543   fprintf( file, " %u", table->num_arcs );
00544   for( i=0; i<table->num_arcs; i++ ) {
00545     /*@-formatcode@*/
00546     fprintf( file, "  %u %u %hhx", table->arcs[i]->from, table->arcs[i]->to, table->arcs[i]->suppl.all );
00547     /*@=formatcode@*/
00548   }
00549 
00550   PROFILE_END;
00551 
00552 }

void arc_dealloc fsm_table table  ) 
 

Deallocates memory for specified arcs array.

Deallocates all allocated memory for the specified state transition arc array.

Parameters:
table  Pointer to state transition arc array

00863   { PROFILE(ARC_DEALLOC);
00864 
00865   if( table != NULL ) {
00866 
00867     unsigned int i;
00868 
00869     /* Deallocate fr_states */
00870     for( i=0; i<table->num_fr_states; i++ ) {
00871       vector_dealloc( table->fr_states[i] );
00872     }
00873     free_safe( table->fr_states, (sizeof( vector* ) * table->num_fr_states) );
00874 
00875     /* Deallocate to_states */
00876     for( i=0; i<table->num_to_states; i++ ) {
00877       vector_dealloc( table->to_states[i] );
00878     }
00879     free_safe( table->to_states, (sizeof( vector* ) * table->num_to_states) );
00880 
00881     /* Deallocate arcs */
00882     for( i=0; i<table->num_arcs; i++ ) {
00883       free_safe( table->arcs[i], sizeof( fsm_table_arc ) );
00884     }
00885     free_safe( table->arcs, (sizeof( fsm_table_arc* ) * table->num_arcs) );
00886 
00887     /* Now deallocate ourself */
00888     free_safe( table, sizeof( fsm_table ) );
00889 
00890   }
00891 
00892   PROFILE_END;
00893 
00894 }

int arc_find_arc const fsm_table table,
unsigned int  fr_index,
unsigned int  to_index
 

Finds the specified state transition in the given FSM table.

Returns:
Returns the index of the found arc in the arcs array if it is found; otherwise, returns -1.
Searches for the arc in the arcs array of the given FSM table specified by the given state indices.
Parameters:
table  Pointer to FSM table to search in
fr_index  Index of from state to find
to_index  Index of to state to find

00247   { PROFILE(ARC_FIND_ARC);
00248 
00249   int          index = -1;
00250   unsigned int i     = 0;
00251 
00252   while( (i < table->num_arcs) && (index == -1) ) {
00253     if( (table->arcs[i]->from == fr_index) && (table->arcs[i]->to == to_index) ) {
00254       index = i;
00255     }
00256     i++;
00257   }
00258 
00259   PROFILE_END;
00260 
00261   return( index );
00262 
00263 }

int arc_find_arc_by_exclusion_id const fsm_table table,
int  id
 

Finds the specified state transition in the given FSM table by the exclusion ID.

Returns:
Returns the index of the found arc in the arcs array if it is found; otherwise, returns -1.
Parameters:
table  Pointer to FSM table structure to search
id  Exclusion ID to search for

00271   { PROFILE(ARC_FIND_ARC_BY_EXCLUSION_ID);
00272 
00273   int index = -1;
00274 
00275   if( (table->id <= id) && ((table->id + table->num_arcs) > id) ) {
00276     index = id - table->id;
00277   }
00278 
00279   PROFILE_END;
00280 
00281   return( index );
00282 
00283 }

int arc_find_from_state const fsm_table table,
const vector st
 

Finds the specified FROM state in the given FSM table.

Returns:
Returns the index of the found from_state in the fr_states array if one is found; otherwise, returns -1 to indicate that a match could not be found.
Searches the list of FROM states for a match to the given vector value.
Parameters:
table  Pointer to FSM table to search in
st  State to search for

00192   { PROFILE(ARC_FIND_FROM_STATE);
00193 
00194   int          index = -1;  /* Return value for this function */
00195   unsigned int i     = 0;   /* Loop iterator */
00196 
00197   assert( table != NULL );
00198 
00199   while( (i < table->num_fr_states) && !vector_ceq_ulong( st, table->fr_states[i] ) ) i++;
00200   if( i < table->num_fr_states ) {
00201     index = i;
00202   }
00203 
00204   PROFILE_END;
00205 
00206   return( index );
00207 
00208 }

int arc_find_to_state const fsm_table table,
const vector st
 

Finds the specified TO state in the given FSM table.

Returns:
Returns the index of the found to_state in the to_states array if one is found; otherwise, returns -1 to indicate that a match could not be found. that no match occurred.
Searches the list of TO states for a match to the given vector value.
Parameters:
table  Pointer to FSM table to search in
st  State to search for

00220   { PROFILE(ARC_FIND_TO_STATE);
00221 
00222   int          index = -1;  /* Return value for this function */
00223   unsigned int i     = 0;   /* Loop iterator */
00224 
00225   assert( table != NULL );
00226 
00227   while( (i < table->num_to_states) && !vector_ceq_ulong( st, table->to_states[i] ) ) i++;
00228   if( i < table->num_to_states ) {
00229     index = i;
00230   }
00231 
00232   PROFILE_END;
00233 
00234   return( index );
00235 
00236 }

void arc_get_states char ***  fr_states,
unsigned int *  fr_state_size,
char ***  to_states,
unsigned int *  to_state_size,
const fsm_table table,
bool  hit,
bool  any
 

Stores arc array state values to specified string array.

Traverses entire arc array, storing all states that were hit during simulation (if hit parameter is true or the any parameter is true) or missed during simulation (if hit parameter is false or the any parameter is true).

Parameters:
fr_states  Pointer to string array containing stringified state information
fr_state_size  Pointer to number of elements stored in states array
to_states  Pointer to string array containing stringified state information
to_state_size  Pointer to number of elements stored in states array
table  Pointer to FSM table
hit  Specifies if hit or missed transitions should be gathered
any  Specifies if we should gather any transition or only the type specified by hit

00724   { PROFILE(ARC_GET_STATES);
00725 
00726   unsigned int i, j;  /* Loop iterator */
00727 
00728   /*@-nullstate@*/
00729 
00730   assert( fr_states != NULL );
00731   assert( fr_state_size != NULL );
00732   assert( to_states != NULL );
00733   assert( to_state_size != NULL );
00734 
00735   /* Initialize states array pointers and sizes */
00736   *fr_states     = NULL;
00737   *fr_state_size = 0;
00738   *to_states     = NULL;
00739   *to_state_size = 0;
00740 
00741   /* Iterate through the fr_states array, gathering all matching states */
00742   for( i=0; i<table->num_fr_states; i++ ) {
00743     bool state_hit = any;
00744     for( j=0; j<table->num_arcs; j++ ) {
00745       if( table->arcs[j]->from == i ) {
00746         state_hit = state_hit || (table->arcs[j]->suppl.part.hit == 1);
00747       }
00748     }
00749     if( state_hit == hit ) {
00750       *fr_states                     = (char**)realloc_safe( *fr_states, (sizeof( char* ) * (*fr_state_size)), (sizeof( char* ) * ((*fr_state_size) + 1)) );
00751       (*fr_states)[(*fr_state_size)] = vector_to_string( table->fr_states[i], HEXIDECIMAL, TRUE );
00752       (*fr_state_size)++;
00753     }
00754   }
00755 
00756   /* Iterate through the to_states array, gathering all matching states */
00757   for( i=0; i<table->num_to_states; i++ ) {
00758     bool state_hit = any;
00759     for( j=0; j<table->num_arcs; j++ ) { 
00760       if( table->arcs[j]->to == i ) {
00761         state_hit = state_hit || (table->arcs[j]->suppl.part.hit == 1);
00762       }
00763     }
00764     if( state_hit == hit ) {
00765       *to_states                     = (char**)realloc_safe( *to_states, (sizeof( char* ) * (*to_state_size)), (sizeof( char* ) * ((*to_state_size) + 1)) );
00766       (*to_states)[(*to_state_size)] = vector_to_string( table->to_states[i], HEXIDECIMAL, TRUE );
00767       (*to_state_size)++;
00768     }
00769   }
00770 
00771   PROFILE_END;
00772 
00773 }

void arc_get_stats const fsm_table table,
int *  state_hits,
int *  state_total,
int *  arc_hits,
int *  arc_total,
int *  arc_excluded
 

Calculates all state and state transition values for reporting purposes.

Calculates values for all specified totals from given state transition arc array. If the state and state transition totals are not known (i.e., user specified state variables without specifying legal states and state transitions and/or the user specified state variables and state table was not able to be automatically extracted), return a value of -1 for total values to indicate to the calling function that a different report output is required.

Parameters:
table  Pointer to FSM table
state_hits  Pointer to total number of states hit during simulation
state_total  Pointer to total number of states in table
arc_hits  Pointer to total number of state transitions hit during simulation
arc_total  Pointer to total number of state transitions in table
arc_excluded  Pointer to total number of excluded arcs

00494   { PROFILE(ARC_GET_STATS);
00495 
00496   /* First get hits */
00497   *state_hits   += arc_state_hits( table );
00498   *arc_hits     += arc_transition_hits( table );
00499   *arc_excluded += arc_transition_excluded( table );
00500   
00501   /* If the state transitions are known, calculate them; otherwise, return -1 for totals */
00502   if( table->suppl.part.known == 0 ) {
00503     *state_total = -1;
00504     *arc_total   = -1;
00505   } else {
00506     *state_total += table->num_fr_states;
00507     *arc_total   += table->num_arcs;
00508   }
00509 
00510   PROFILE_END;
00511 
00512 }

void arc_get_transitions char ***  from_states,
char ***  to_states,
int **  ids,
int **  excludes,
char ***  reasons,
int *  arc_size,
const fsm_table table,
func_unit funit,
bool  hit,
bool  any
 

Outputs arc array state transition values to specified output stream.

Traverses entire arc array, storing all state transitions that were hit during simulation (if hit parameter is true or the any parameter is true) or missed during simulation (if hit parameter is false or the any parameter is true).

Parameters:
from_states  Pointer to string array containing from_state values
to_states  Pointer to string array containing to_state values
ids  List of arc IDs
excludes  Pointer to integer array containing exclude values
reasons  Pointer to string array containing exclude reasons
arc_size  Number of elements in both the from_states and to_states arrays
table  Pointer to FSM table
funit  Pointer to functional unit containing this FSM
hit  Specifies if hit or missed transitions should be gathered
any  Specifies if all arc transitions or just the ones that meet the hit criteria should be gathered

00791   { PROFILE(ARC_GET_TRANSITIONS);
00792 
00793   unsigned int i;  /* Loop iterator */
00794 
00795   assert( table != NULL );
00796 
00797   /* Initialize state arrays and arc_size */
00798   *from_states = NULL;
00799   *to_states   = NULL;
00800   *ids         = NULL;
00801   *excludes    = NULL;
00802   *reasons     = NULL;
00803   *arc_size    = 0;
00804 
00805   /* Iterate through arc transitions */
00806   for( i=0; i<table->num_arcs; i++ ) {
00807 
00808     if( (table->arcs[i]->suppl.part.hit == hit) || any ) {
00809       exclude_reason* er;
00810 
00811       *from_states                = (char**)realloc_safe( *from_states, (sizeof( char* ) * (*arc_size)), (sizeof( char* ) * (*arc_size + 1)) );
00812       *to_states                  = (char**)realloc_safe( *to_states,   (sizeof( char* ) * (*arc_size)), (sizeof( char* ) * (*arc_size + 1)) );
00813       *ids                        = (int*)realloc_safe( *ids, (sizeof( int ) * (*arc_size)), (sizeof( int ) * (*arc_size + 1)) );
00814       *excludes                   = (int*)realloc_safe( *excludes, (sizeof( int ) * (*arc_size)), (sizeof( int ) * (*arc_size + 1)) );
00815       *reasons                    = (char**)realloc_safe( *reasons, (sizeof( char* ) * (*arc_size)), (sizeof( char* ) * (*arc_size + 1)) );
00816       (*from_states)[(*arc_size)] = vector_to_string( table->fr_states[table->arcs[i]->from], HEXIDECIMAL, TRUE );
00817       (*to_states)[(*arc_size)]   = vector_to_string( table->to_states[table->arcs[i]->to],   HEXIDECIMAL, TRUE );
00818       (*ids)[(*arc_size)]         = table->id + i;
00819       (*excludes)[(*arc_size)]    = table->arcs[i]->suppl.part.excluded;
00820 
00821       /* If the assertion is currently excluded, check to see if there's a reason associated with it */
00822       if( (table->arcs[i]->suppl.part.excluded == 1) && ((er = exclude_find_exclude_reason( 'F', (table->id + i), funit )) != NULL) ) {
00823         (*reasons)[(*arc_size)] = strdup_safe( er->reason );
00824       } else {
00825         (*reasons)[(*arc_size)] = NULL;
00826       }
00827 
00828       (*arc_size)++;
00829     }
00830 
00831   }
00832 
00833   PROFILE_END;
00834 
00835 }

void arc_merge fsm_table base,
const fsm_table other
 

Merges two FSM arcs, placing the results in the base arc.

Merges two FSM arcs into one, placing the result back into the base FSM arc. This function is used to calculate module coverage for the GUI.

00698   { PROFILE(ARC_MERGE);
00699 
00700   unsigned int i;  /* Loop iterator */
00701 
00702   /* Merge state transitions */
00703   for( i=0; i<other->num_arcs; i++ ) {
00704     arc_add( base, other->fr_states[other->arcs[i]->from], other->to_states[other->arcs[i]->to], other->arcs[i]->suppl.part.hit, other->arcs[i]->suppl.part.excluded );
00705   }
00706 
00707   PROFILE_END;
00708 
00709 }


Generated on Wed Jun 17 22:19:20 2009 for Covered by doxygen 1.3.4