?? object.c
字號:
/* Program: revava - Atmel Dis-Assembler File: Object.C, 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 <strings.h>#include <string.h>#include "Error.h"#include "Flash.h"#include "IntelHex.h"#include "Object.h"#include "Source.h"TObjectIn::TObjectIn(const char* infile, TFlash* pFlash){ TIntelHexRecord HexRec; FILE* pf; char s[256]; // FIXME - Magic Number char* pc; int line = 0; pf = fopen(infile, "r"); if( NULL == pf ) throw TFileError("Cannot open file:", infile); try{ while( fgets( s, 256, pf )) { // Replace the newline with '\0' //if( NULL != ( pc = rindex( s, '\n' ))) if( NULL != ( pc = strrchr( s, '\n' ))) *pc = '\0' ; line++; HexRec.StringToRecord( s ); if( 0 == HexRec.get_type()) pFlash->flashset( HexRec.get_addr(), HexRec.get_nbytes(), HexRec.get_data()); } } catch ( TGenericError E ){ char msg[ 80 ]; // FIXME - Magic Number sprintf( msg, "Error: File: %s, Line: %d\n", infile, line ); E.prepend_message( msg ); throw E ; } fclose(pf);}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -