int main( int argc, char **argv ) { char buff[256]; TID tid; APIRET rc; MemInit(); getcmd( buff ); CmdData = buff; DebugMain(); _SwitchOff( SW_ERROR_STARTUP ); DoInput(); VarInitInfo( &Locals ); DosCreateEventSem( NULL, &Requestsem, 0, false ); DosCreateEventSem( NULL, &Requestdonesem, 0, false ); DosPostEventSem( Requestdonesem ); // signal req done rc = DosCreateThread( &tid, ControlFunc, 0, 0, 32768 ); if( rc != 0 ) { printf( "Stubugger: Error creating thread!\n" ); } while( !Done ) { DlgCmd(); } DosCloseEventSem( Requestsem ); DosCloseEventSem( Requestdonesem ); DebugFini(); RunRequest( REQ_BYE ); MemFini(); return( 0 ); }
int main(int argc, char **argv ) /******************************/ { int retval = 0; MemInit(); #if defined( _BETAVER ) put( banner1w1( "Far Call Optimization Enabling Utility" ) ); put( banner1w2( _FCENABLE_VERSION_ ) ); #else put( banner1w( "Far Call Optimization Enabling Utility", _FCENABLE_VERSION_ ) ); #endif put( banner2 ); put( banner2a( "1990" ) ); put( banner3 ); put( banner3a ); InputBuffer = InitRecStuff(); InFile = NOFILE; OutFile = NOFILE; ClassList = MemAlloc( sizeof( name_list ) + sizeof( DEF_CLASS ) - 1 ); ClassList->next = NULL; ClassList->lnameidx = 0; memcpy( ClassList->name, DEF_CLASS, sizeof( DEF_CLASS ) - 1 ); if( ( argc < 2 ) || ( argv[1][0] == '?' ) ) { put( HelpMsg ); } else { argv++; // skip the program name retval = Spawn1( ProcessFiles, argv ); } FinalCleanup(); MemFini(); return( retval ); }
int main( int argc, char **argv ) { char buff[256]; DWORD tid; HANDLE hThread; MemInit(); SetErrorMode( SEM_FAILCRITICALERRORS ); getcmd( buff ); CmdData = buff; DebugMain(); _SwitchOff( SW_ERROR_STARTUP ); DoInput(); VarInitInfo( &Locals ); Requestsem = CreateSemaphore( NULL, 0, 1, NULL ); Requestdonesem = CreateSemaphore( NULL, 0, 1, NULL ); ReleaseSemaphore( Requestdonesem, 1, NULL ); // signal req done hThread = CreateThread( NULL, 0, ControlFunc, NULL, 0, &tid ); if (hThread == NULL) { MessageBox( NULL, "Error creating thread!", "Stubugger", MB_APPLMODAL+MB_OK ); } while( !Done ) { DlgCmd(); } CloseHandle( Requestsem ); CloseHandle( Requestdonesem ); DebugFini(); RunRequest( REQ_BYE ); MemFini(); return( 0 ); }
extern void main( void ) /**********************/ { MemInit(); UtilsInit(); Spawn( DoConvert ); FreeMemory(); MemFini(); }
int main( void ) /**********************/ { MemInit(); UtilsInit(); Spawn( DoConvert ); FreeMemory(); MemFini(); return( 0 ); }
int main( int argc, char **argv ) /*******************************/ { int rc; #ifndef __WATCOMC__ _argc = argc; _argv = argv; #endif if( argc <= 1 ) { /* no arguments: just tell the user who I am */ puts( "Usage: owcc [-?] [options] file ..." ); exit( EXIT_SUCCESS ); } errno = 0; /* Standard C does not require fopen failure to set errno */ if( (Fp = fopen( TEMPFILE, "w" )) == NULL ) { /* Message before banner decision as '@' option uses Fp in Parse() */ PrintMsg( WclMsgs[UNABLE_TO_OPEN_TEMPORARY_FILE], TEMPFILE, strerror( errno ) ); exit( EXIT_FAILURE ); } MemInit(); ProcMemInit(); /* destruct the temp. linker script in case of -? or parse errors */ atexit( ExitHandler ); rc = Parse( argc, argv ); if( rc == 0 ) { if( !Flags.be_quiet ) { print_banner(); } rc = CompLink(); } if( rc == 1 ) { fclose( Fp ); Fp = NULL; } if( Link_Name != NULL ) { if( strfcmp( Link_Name, TEMPFILE ) != 0 ) { remove( Link_Name ); rename( TEMPFILE, Link_Name ); } } else { remove( TEMPFILE ); } ProcMemFini(); MemFini(); return( rc == 0 ? 0 : 1 ); }
void CGMemFini( void ) /***********************/ { #if _MEMORY_TRACKING & _FULL_TRACKING char buff[80]; if( !GetEnvVar( "TRQUIET", buff, 7 ) ) { _trmem_prt_list( Handle ); } _trmem_close( Handle ); #elif _MEMORY_TRACKING & _CHUNK_TRACKING if( Chunks != 0 ) { _Zoiks( ZOIKS_002 ); } #endif MemFini(); }
static void cleanupHandler( void ) { char *p; if( outputFile[0] != '\0' ) { if( fileOut != NULL ) { ObjWriteClose( fileOut ); fileOut = NULL; } for( p = outputFile; p != &outputFile[ _MAX_PATH ]; ++p ) { if( *p == '\0' ) { unlink( outputFile ); break; } if( ! isprint( *p ) ) break; } } MsgFini(); MemFini(); }
void AsmShutDown( void ) /**********************/ { /* close ASM file */ if( AsmFiles.file[ASM] != NULL ) { if( fclose( AsmFiles.file[ASM] ) != 0 ) { Fatal( MSG_CANNOT_CLOSE_FILE, AsmFiles.fname[ASM] ); } } /* close OBJ file */ ObjWriteClose( pobjState.file_out ); ObjRecFini(); if( !write_to_file || Options.error_count > 0 ) { remove( AsmFiles.fname[OBJ] ); } AsmFree( AsmFiles.fname[ASM] ); AsmFree( AsmFiles.fname[ERR] ); AsmFree( AsmFiles.fname[LST] ); AsmFree( AsmFiles.fname[OBJ] ); MemFini(); }
void main( int argc, char *argv[] ) { #pragma on (unreferenced); uint i; uint num_files; cmdline_t *cmd; int multi_module; pobj_lib_info pli; atexit( cleanupHandler ); MemInit(); MsgInit( argv[0] ); cmd = CmdLineParse(); init(); while( cmd->action != NULL ) { ActionInit( cmd ); num_files = cmd->action->num_files; i = 0; do { ActionInfile( cmd, inputFile, i ); fileIn = ObjReadOpen( inputFile ); if( fileIn == NULL ) { Fatal( MSG_UNABLE_TO_OPEN_FILE, inputFile ); } if( cmd->need_output ) { ActionOutfile( cmd, outputFile, i ); fileOut = ObjWriteOpen( outputFile ); if( fileOut == NULL ) { Fatal( MSG_UNABLE_TO_OPEN_FILE, outputFile ); } } else { fileOut = NULL; } if( cmd->quiet == 0 ) { char msgbuff[MAX_RESOURCE_SIZE]; MsgGet( MSG_CONVERTING, msgbuff ); PrtFmt( msgbuff, inputFile ); PrtFmt( "\n" ); } pli.is_lib = 0; do { multi_module = PObj( fileIn, fileOut, &pli ); prune(); } while( multi_module ); ObjReadClose( fileIn ); if( fileOut != NULL ) { ObjWriteClose( fileOut ); ActionRename( cmd, inputFile, outputFile, i, pli.is_lib, pli.page_len ); } ++i; } while( i < num_files ); ActionFini( cmd ); } fini(); MsgFini(); MemFini(); outputFile[0] = '\0'; exit( EXIT_SUCCESS ); }
int main( int argc, char **argv ) //******************************* { static char *fname; #ifndef __WATCOMC__ _argv = argv; _argc = argc; #endif MemInit(); if( !AsMsgInit() ) { return( EXIT_FAILURE ); } if( argc == 1 ) { Banner(); Usage(); } else if( OptionsInit( --argc, ++argv ) ) { Banner(); if( _IsOption( PRINT_HELP ) ) { Usage(); *argv = NULL; } else if( !*argv ) { AsOutMessage( stderr, AS_MSG_ERROR ); AsOutMessage( stderr, NO_FILENAME_SPECIFIED ); fputc( '\n', stderr ); } while( *argv ) { fname = MakeAsmFilename( *argv ); if( PP_Init( fname, PPFLAG_ASM_COMMENT | PPFLAG_EMIT_LINE, NULL ) != 0 ) { AsOutMessage( stderr, UNABLE_TO_OPEN, fname ); fputc( '\n', stderr ); } else { OptionsPPDefine(); SymInit(); InsInit(); DirInit(); if( ObjInit( fname ) ) { if( setjmp( AsmParse ) == 0 ) { ErrorCountsReset(); DoReport = TRUE; if( !yyparse() ) { CurrLineno--; // This is the total # of lines ObjRelocsFini(); // Must be done before ErrorReport // and other finis } else { DoReport = FALSE; } } else { // AbortParse() was invoked DoReport = FALSE; } ErrorReport(); AsLexerFini(); ObjFini(); } DirFini(); InsFini(); SymFini(); } PP_Fini(); ++argv; } } OptionsFini(); AsMsgFini(); MemFini(); return( ExitStatus ); }
int main( int argc, char **argv ) /********************************/ { int rc; char *wcl_env; char *p; char *q; char *Cmd; /* command line parameters */ #ifndef __WATCOMC__ _argc = argc; _argv = argv; #endif CC_Opts[0] = '\0'; Switch_Chars[0] = '-'; Switch_Chars[1] = _dos_switch_char(); Switch_Chars[2] = '\0'; MemInit(); ProcMemInit(); Word = MemAlloc( MAX_CMD ); Cmd = MemAlloc( MAX_CMD * 2 ); /* enough for cmd line & wcl variable */ /* add wcl environment variable to Cmd */ /* unless /y is specified in either Cmd or wcl */ wcl_env = getenv( WCLENV ); if( wcl_env != NULL ) { strcpy( Cmd, wcl_env ); strcat( Cmd, " " ); p = Cmd + strlen( Cmd ); getcmd( p ); q = Cmd; while( (q = strpbrk( q, Switch_Chars )) != NULL ) { if( tolower( *(++q) ) == 'y' ) { getcmd( Cmd ); p = Cmd; break; } } } else { getcmd( Cmd ); p = Cmd; } p = SkipSpaces( p ); if( *p == '\0' || p[0] == '?' && ( p[1] == '\0' || p[1] == ' ' ) || p[0] == '-' && p[1] == '?' ) { Usage(); rc = 1; } else { errno = 0; /* Standard C does not require fopen failure to set errno */ if( (Fp = fopen( TEMPFILE, "w" )) == NULL ) { /* Message before banner decision as '@' option uses Fp in Parse() */ PrintMsg( WclMsgs[UNABLE_TO_OPEN_TEMPORARY_FILE], TEMPFILE, strerror( errno ) ); rc = 1; } else { initialize_Flags(); rc = Parse( Cmd ); if( rc == 0 ) { if( !Flags.be_quiet ) { print_banner(); } rc = CompLink(); } if( rc == 1 ) { fclose( Fp ); } if( Link_Name != NULL ) { if( fname_cmp( Link_Name, TEMPFILE ) != 0 ) { remove( Link_Name ); rename( TEMPFILE, Link_Name ); } } else { remove( TEMPFILE ); } } } ProcMemFini(); MemFree( Cmd ); MemFree( Word ); MemFini(); return( rc == 0 ? 0 : 1 ); }