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

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


Detailed Description

Contains functions for handling attributes.

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

#include "defines.h"

Go to the source code of this file.

Functions

attr_paramattribute_create (const char *name, expression *expr)
 Creates new attribute parameter based on specified values.

void attribute_parse (attr_param *ap, const func_unit *mod, bool exclude)
 Parses and handles specified attribute parameter list.

void attribute_dealloc (attr_param *ap)
 Deallocates entire attribute parameter list.


Function Documentation

attr_param* attribute_create const char *  name,
expression expr
 

Creates new attribute parameter based on specified values.

Returns:
Returns a pointer to the newly allocated/initialized attribute parameter.
Allocates and initializes an attribute parameter entry.
Parameters:
name  String identifier of this attribute parameter
expr  Pointer to the expression assigned to the parameter identifier

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.

Parameters:
ap  Pointer to the attribute parameter list to remove

00114   { PROFILE(ATTRIBUTE_DEALLOC);
00115 
00116   if( ap != NULL ) {
00117 
00118     /* Deallocate the next attribute */
00119     attribute_dealloc( ap->next );
00120 
00121     /* Deallocate the name string */
00122     free_safe( ap->name, (strlen( ap->name ) + 1) );
00123 
00124     /* Deallocate the expression tree */
00125     expression_dealloc( ap->expr, FALSE );
00126 
00127     /* Finally, deallocate myself */
00128     free_safe( ap, sizeof( attr_param ) );
00129 
00130   }
00131 
00132   PROFILE_END;
00133 
00134 }

void attribute_parse attr_param ap,
const func_unit funit,
bool  exclude
 

Parses and handles specified attribute parameter list.

Exceptions:
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.
Parameters:
ap  Pointer to current element of attribute parameter list to parse
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

00089   { PROFILE(ATTRIBUTE_PARSE);
00090 
00091   if( ap != NULL ) {
00092 
00093     if( ap->next != NULL ) {
00094       attribute_parse( ap->next, funit, exclude );
00095     } else {
00096       if( strcmp( ap->name, "covered_fsm" ) == 0 ) {
00097         fsm_arg_parse_attr( ap->prev, funit, exclude );
00098       } else if( strcmp( ap->name, "covered_assert" ) == 0 ) {
00099         assertion_parse_attr( ap->prev, funit, exclude );
00100       }
00101     }
00102 
00103   }
00104 
00105   PROFILE_END;
00106 
00107 }


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