static void printUsage( int msg ) { int i; static const char * const banner[]={ banner1w( "Multi-processor Disassembler", _WDISASM_VERSION_ ), banner2( "1995" ), banner3, banner3a, NULL }; const char * const *text; ChangePrintDest( STDERR_FILENO ); if( msg != 0 ) { BufferMsg( msg ); BufferConcatNL(); BufferConcatNL(); BufferPrint(); } text = banner; while( *text ) { Print( (char *)*text++ ); Print( "\n" ); } for( i = USAGE_1; i <= USAGE_LAST; i++ ) { BufferMsg( i ); BufferConcatNL(); BufferPrint(); } if( ObjFileName != NULL ) { MemFree( ObjFileName ); } MemClose(); exit( 1 ); }
void Fini( void ) { freeSectionList( &Sections ); freeLabelList( 0 ); ORLFileScan( ObjFileHnd, NULL, &SectionFini ); if( Options & PRINT_PUBLICS ) { freePublics(); } FreeHashTables(); FreeServicesUsed(); CloseFiles(); MemPrtList(); MemClose(); MsgFini(); }
void Init( void ) { char cmd_line[ CMD_LINE_LEN ]; return_val error; char **list; OutputDest = STDOUT_FILENO; ChangePrintDest( OutputDest ); relocSections.first = NULL; relocSections.last = NULL; if( !MsgInit() ) { // MsgInit does its own error message printing exit( -1 ); } MemOpen(); getcmd( cmd_line ); HandleArgs( cmd_line ); openFiles(); initGlobals(); error = initHashTables(); if( error == OKAY ) { error = initServicesUsed(); if( error == OKAY ) { error = initSectionTables(); if( error != OKAY ) { // free hash tables and services MemClose(); LeaveProgram( error, WHERE_CREATE_SEC_TABLES ); } } else { // free hash tables CloseFiles(); FreeHashTables(); // initServicesUsed does its own error message printing exit( error ); } } else { CloseFiles(); MemClose(); LeaveProgram( error, WHERE_INIT_HASH_TABLES ); } if( Options & PRINT_PUBLICS ) { CreatePublicsArray(); } if( IsMasmOutput() ) { CommentString = MASM_COMMENT_STRING; } if( IsIntelx86() ) { SkipRefTable = HashTableCreate( RECOGNITION_TABLE_SIZE, HASH_STRING, (hash_table_comparison_func) stricmp ); if( SkipRefTable ) { list = intelSkipRefList; while( *list ) { error = HashTableInsert( SkipRefTable, (hash_value) *list, (hash_data) *list ); if( error != OKAY ) break; list++; } } } if( !LabelChar ) { if( IsMasmOutput() ) { LabelChar = 'L'; } else { LabelChar = 'X'; } } }