Contains VCD parser functions. More...
Go to the source code of this file.
Functions | |
void | vcd_parse (const char *vcd_file) |
Parses specified VCD file, storing information into database. |
Contains VCD parser functions.
void vcd_parse | ( | const char * | vcd_file | ) |
Parses specified VCD file, storing information into database.
anonymous | Throw Throw vcd_parse_def vcd_parse_sim |
Reads specified VCD file for relevant information and calls the database functions when appropriate to store this information. This replaces the need for a lexer and parser which should increase performance.
vcd_file | Name of VCD file to parse |
References Catch_anonymous, FATAL, free_safe, malloc_safe_nolimit, print_output(), PROFILE, PROFILE_END, symtable_create(), symtable_dealloc(), Throw, Try, vcd_parse_def(), vcd_parse_sim(), and vcd_symtab_size.
Referenced by parse_and_score_dumpfile().
00428 { PROFILE(VCD_PARSE); 00429 00430 FILE* vcd_handle; /* Pointer to opened VCD file */ 00431 00432 if( (vcd_handle = fopen( vcd_file, "r" )) != NULL ) { 00433 00434 unsigned int rv; 00435 00436 /* Create initial symbol table */ 00437 vcd_symtab = symtable_create(); 00438 00439 Try { 00440 00441 vcd_parse_def( vcd_handle ); 00442 00443 /* Create timestep symbol table array */ 00444 if( vcd_symtab_size > 0 ) { 00445 timestep_tab = malloc_safe_nolimit( sizeof( symtable*) * vcd_symtab_size ); 00446 } 00447 00448 vcd_parse_sim( vcd_handle ); 00449 00450 } Catch_anonymous { 00451 symtable_dealloc( vcd_symtab ); 00452 free_safe( timestep_tab, (sizeof( symtable*) * vcd_symtab_size) ); 00453 rv = fclose( vcd_handle ); 00454 assert( rv == 0 ); 00455 Throw 0; 00456 } 00457 00458 /* Deallocate memory */ 00459 symtable_dealloc( vcd_symtab ); 00460 free_safe( timestep_tab, (sizeof( symtable*) * vcd_symtab_size) ); 00461 00462 /* Close VCD file */ 00463 rv = fclose( vcd_handle ); 00464 assert( rv == 0 ); 00465 00466 } else { 00467 00468 print_output( "Unable to open specified VCD file", FATAL, __FILE__, __LINE__ ); 00469 Throw 0; 00470 00471 } 00472 00473 PROFILE_END; 00474 00475 }