#include <stdio.h>
#include "assertion.h"
#include "attr.h"
#include "defines.h"
#include "expr.h"
#include "func_unit.h"
#include "profiler.h"
#include "util.h"
Functions | |
attr_param * | attribute_create (const char *name, expression *expr) |
Creates new attribute parameter based on specified values. | |
void | attribute_parse (attr_param *ap, int line, const func_unit *funit, bool exclude) |
Parses and handles specified attribute parameter list. | |
void | attribute_dealloc (attr_param *ap) |
Deallocates entire attribute parameter list. |
attr_param* attribute_create | ( | const char * | name, | |
expression * | expr | |||
) |
Creates new attribute parameter based on specified values.
Allocates and initializes an attribute parameter entry.
name | String identifier of this attribute parameter | |
expr | Pointer to the expression assigned to the parameter identifier |
References attr_param_s::expr, attr_param_s::index, malloc_safe, attr_param_s::name, attr_param_s::next, attr_param_s::prev, PROFILE, PROFILE_END, and strdup_safe.
Referenced by db_create_attr_param().
00060 { PROFILE(ATTRIBUTE_CREATE); 00061 00062 attr_param* ap; /* Pointer to newly allocated attribute parameter */ 00063 00064 ap = (attr_param*)malloc_safe( sizeof( attr_param ) ); 00065 ap->name = strdup_safe( name ); 00066 ap->expr = expr; 00067 ap->index = 0; 00068 ap->next = NULL; 00069 ap->prev = NULL; 00070 00071 PROFILE_END; 00072 00073 return( ap ); 00074 00075 }
void attribute_dealloc | ( | attr_param * | ap | ) |
Deallocates entire attribute parameter list.
Deallocates all memory for the entire attribute parameter list.
ap | Pointer to the attribute parameter list to remove |
References attribute_dealloc(), attr_param_s::expr, expression_dealloc(), FALSE, free_safe, attr_param_s::name, attr_param_s::next, PROFILE, and PROFILE_END.
Referenced by attribute_dealloc(), and db_parse_attribute().
00115 { PROFILE(ATTRIBUTE_DEALLOC); 00116 00117 if( ap != NULL ) { 00118 00119 /* Deallocate the next attribute */ 00120 attribute_dealloc( ap->next ); 00121 00122 /* Deallocate the name string */ 00123 free_safe( ap->name, (strlen( ap->name ) + 1) ); 00124 00125 /* Deallocate the expression tree */ 00126 expression_dealloc( ap->expr, FALSE ); 00127 00128 /* Finally, deallocate myself */ 00129 free_safe( ap, sizeof( attr_param ) ); 00130 00131 } 00132 00133 PROFILE_END; 00134 00135 }
void attribute_parse | ( | attr_param * | ap, | |
int | line, | |||
const func_unit * | funit, | |||
bool | exclude | |||
) |
Parses and handles specified attribute parameter list.
anonymous | fsm_arg_parse_attr attribute_parse |
Parses the attribute parameter list in a recursive fashion. First, we go for the last entry and see if it refers to an attribute that covered should parse. If this attribute is identified by Covered as one of its own, it calls the appropriate function to handle the entire attribute parameter list.
ap | Pointer to current element of attribute parameter list to parse | |
line | First line of attribute | |
funit | Pointer to current functional unit containing this attribute | |
exclude | If set to 1, sets the exclude bits (if they exist) in the structure created by the attribute |
References assertion_parse_attr(), attribute_parse(), fsm_arg_parse_attr(), attr_param_s::name, attr_param_s::next, attr_param_s::prev, PROFILE, and PROFILE_END.
Referenced by attribute_parse(), and db_parse_attribute().
00090 { PROFILE(ATTRIBUTE_PARSE); 00091 00092 if( ap != NULL ) { 00093 00094 if( ap->next != NULL ) { 00095 attribute_parse( ap->next, line, funit, exclude ); 00096 } else { 00097 if( strcmp( ap->name, "covered_fsm" ) == 0 ) { 00098 fsm_arg_parse_attr( ap->prev, line, funit, exclude ); 00099 } else if( strcmp( ap->name, "covered_assert" ) == 0 ) { 00100 assertion_parse_attr( ap->prev, line, funit, exclude ); 00101 } 00102 } 00103 00104 } 00105 00106 PROFILE_END; 00107 00108 }