?? main.c
字號:
#include <string.h>
#include <stdlib.h>
/*
Program: revava - Atmel Dis-Assembler
File: Main.C
Parts of this are Copyright (C) 1997-1999 Uros Platise
The rest of it is Copyright (C) 2001 Daniel J. Winker
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdio.h>
#include "Error.h"
#include "Flash.h"
#include "Object.h"
#include "Source.h"
#include "label.h"
const char* version = "Atmel Dis-Assembler 0.4\n";
const char* help =
"Syntax: revava [switches] file\n"
"Switches:\n"
" -d Dump Flash and exit.\n"
" -D Debug Dump Flash and exit (maybe should be Dubious Dump).\n"
" -e Use little endian (Intel byte order).\n"
" -o file Set output file name (to redirect the output to stdout: -o stdout)\n"
" -v Verbose (enable info - currently does nothing).\n"
" --help Print this help.\n"
" --version Output version information.\n";
#define FALSE 0
#define TRUE (!FALSE)
int arg_d = FALSE;
int arg_D = FALSE;
int arg_e = TRUE;
int arg_v = FALSE;
int main( int argc, char* argv[] ){
TFlash* pFlash;
TObjectIn* pObjectIn;
TSourceOut* pSourceOut;
char* infile = NULL;
char* OutFile = "out.s";
try{
for ( ai = 1; ai < argc; ai++ ){
if ( argv[ ai ][ 0 ] == '-' ){
if ( argv[ ai ][ 2 ] == '\0' ){
switch( argv[ ai ][ 1 ] ){
case 'd':
arg_d = TRUE;
break ;
case 'D':
arg_D = TRUE;
break ;
case 'e':
arg_e = TRUE;
break ;
case 'o':
if ( ++ai >= argc )
throw TGenericError( "-o: File name is missing." );
OutFile = argv[ ai ];
break ;
case 'v':
arg_v = TRUE;
break ;
default:
throw TGenericError("Invalid switch:", argv[ai]);
}
}
else if ( argv[ ai ][ 1 ] == '-' ){
if ( strcmp( &argv[ ai ][ 2 ], "help" ) == 0 ){
printf( "%s\n\n%s\n", version, help );
exit( 1 );
}
else if ( strcmp( &argv[ ai ][ 2 ], "version" ) == 0 ){
printf( "%s\n", version );
exit( 1 );
}
else{
throw TGenericError( "Invalid switch:", argv[ ai ] );
}
}
}
else{
infile = argv[ ai ];
}
}
if ( !infile ){
printf( "%s\n\n%s\n", version, help );
exit( 1 );
}
// Set up the Memory
pFlash = new TFlash();
// Read the code into the fake flash
pObjectIn = new TObjectIn( infile, pFlash );
// Fix Big Endian/Little Endian if that's a problem.
if( arg_e )
pFlash->FlipEndian();
if( arg_d ) {
pFlash->Dump();
} else if ( arg_D ) {
pFlash->DebugDump();
}
else {
//pObjectIn->~TObjectIn();
pSourceOut = new TSourceOut( "tmp.txt", pFlash );
}
}
catch ( TGenericError E ){
E.report();
}
catch ( TFileError E ){
E.report();
}
TLabel label("tmp.txt",OutFile);
return 0 ;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -