//***************************************************************************** // Function : close Up // Caller : main() // Purpose : clear up all the memory allocations // Input : seq // : crik // Return : none // Display : none //***************************************************************************** int close_up(config* seq, global* crik) { disp(seq,DISP_ALL,"################################################################################################ Entering 'close_up''\n"); if(seq->srcFile != stdin) fclose(seq->srcFile); // input file closing if(seq->dispFile != stdout) fclose(seq->dispFile); // output file closing free_intrvl_luk_up_table(seq); // clean up interval look-up table free_parenthesis_look_up_table(seq); // clean up parenthesis look-up table free_cmpnt_list(seq, crik); // clean up component list 'crik->cmpntList' free_bundle_list(seq, crik); // clean up 2D bundle list 'crik->eden' free_whole_intrvl(crik); // clean up interval 'crik->interval' free_constraint(seq, crik); // clean up constraints 'seq->coVari', 'seq->v1Pairng', 'seq->s1Pairng', 'seq->chemMod', etc free(crik); free_recycle_bin(seq); // some not-yet cleaned todd stuff free(seq->ltr); free(seq->motifSeq); free(seq->motifStruc); free(seq->dotNParen); free(seq->mfe); free(seq); cleanup_stats(); return 0; } // end close_up
//----------------------------------------------------------------------------- // Main... process command line parameters, and then setup our listening // sockets and event loop. int main(int argc, char **argv) { system_data_t sysdata; ///============================================================================ /// Initialization. ///============================================================================ init_sysdata(&sysdata); init_settings(&sysdata); get_options(sysdata.settings, argc, argv); init_maxconns(&sysdata); init_daemon(&sysdata); init_events(&sysdata); init_logging(&sysdata); logger(sysdata.logging, 1, "System starting up"); init_signals(&sysdata); init_buffers(&sysdata); init_servers(&sysdata); init_stats(&sysdata); init_risp(&sysdata); init_nodes(&sysdata); init_msglist(&sysdata); init_queues(&sysdata); init_controllers(&sysdata); ///============================================================================ /// Main Event Loop. ///============================================================================ // enter the event loop. logger(sysdata.logging, 1, "Starting Event Loop"); assert(sysdata.evbase); event_base_loop(sysdata.evbase, 0); logger(sysdata.logging, 1, "Shutdown preparations complete. Shutting down now."); ///============================================================================ /// Shutdown ///============================================================================ cleanup_events(&sysdata); cleanup_controllers(&sysdata); cleanup_queues(&sysdata); cleanup_msglist(&sysdata); cleanup_nodes(&sysdata); cleanup_risp(&sysdata); cleanup_stats(&sysdata); cleanup_servers(&sysdata); cleanup_buffers(&sysdata); cleanup_signals(&sysdata); logger(sysdata.logging, 1, "Shutdown complete.\n"); cleanup_logging(&sysdata); cleanup_daemon(&sysdata); cleanup_maxconns(&sysdata); cleanup_settings(&sysdata); cleanup_sysdata(&sysdata); // good-bye. return 0; }