📄 obj_viewer_h.h
字号:
//---------------------------------------------------------------------------
// OBJ_Viewer_H.h
//---------------------------------------------------------------------------
#ifndef OBJ_Viewer_H.h // 防止被重复引用
#define OBJ_Viewer_H.h
//---------------------------------------------------------------------------
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include "Astring_H.h"
//---------------------------------------------------------------------------
//
// 目标文件查看器
//
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
class OBJ_Viewer
{ private:
FILE* SrcPt;
FILE* DesPt;
bool Detail; //
bool Origin; // 列出源OBJ内容
// -------- private functions ----------
void FindREC();
void PRrec(int8u buf[],int16u len);
void PR_Bin2Asc(int8u* buf, int8u len);
void showSEGINFO(int8u buf);
void showSYMINFO(int8u buf);
int8u showStr(const int8u *buf);
// -------------------------------------
void show02(int8u buf[]);
void show04(int8u buf[]);
void show06(int8u buf[], int16u rlen);
void show07(int8u buf[], int16u rlen);
void show09(int8u buf[], int16u rlen);
void show0F(int8u buf[], int16u rlen);
void show10(int8u buf[]);
void show12(int8u buf[], int16u rlen);
void show17(int8u buf[], int16u rlen);
void show19(int8u buf[], int16u rlen);
void show23(int8u buf[], int16u rlen);
void show24(int8u buf[]);
void show70(int8u buf[]);
// -------------------------------------
public:
int8u buf[65536];
OBJ_Viewer():SrcPt(NULL),DesPt(stdout), Detail(true),Origin(true)
{} // end constructor
~OBJ_Viewer() {} // end destructor
// -------- public functions -----------
void SetDetail(bool b) { Detail = b; }
void SetOrigin(bool b) { Origin = b; }
bool Open(const char* fname); // 打开一个目标文件来读。
bool Close(); // 读完后关闭目标文件。
bool SetOutput(const char* fname); // 设置输出文件。
// 把内容写到DiskFile上,NULL表示写到屏幕上。
ERR ViewBy(const char* ObjFile, const char* DiskFile = NULL);
// -------- 字符数据区 -----------
static const char* ppline;
}; // end OBJ_Viewer
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// 打开一个*.OBJ目标文件来读。
//---------------------------------------------------------------------------
inline bool OBJ_Viewer::Open(const char* fname)
{ SrcPt = fopen(fname,"rb");
return SrcPt;
} // end Open
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// 读完后关闭目标文件。
//---------------------------------------------------------------------------
inline bool OBJ_Viewer::Close()
{ return !(fclose(DesPt) | fclose(SrcPt));
} // end Close
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// 设置输出文件。可以是NULL。默认为屏幕。
//---------------------------------------------------------------------------
inline bool OBJ_Viewer::SetOutput(const char* fname)
{ if(fname == NULL)
{ DesPt = stdout; return true; } // endif
// fname != NULL
DesPt = fopen(fname,"w");
return (bool)DesPt;
} // end SetOutput
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#endif
//---------------------------------------------------------------------------
// Written by JamesyFront. ZLGmcu Dev.Co.Ltd. 2002.
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -