xpcline.cpp

来自「eC++编译器源码」· C++ 代码 · 共 41 行

CPP
41
字号
/*This program is used to invert program error positions back to
  a source line number.  The input is a PC position (in hex) and
  a module name (case sensitive).
*/

#include <iostream.h>
#include <Symbol.h>
#include <BaseIO.h>
#include <search.h>
#include <cstring.h>

void main()
{
Module m;
unsigned int pc, line;
long start, end;
char fileName[64];
char hexBuffer[64];
 for ( ;; ) {
   cout<<"enter fileName: ";
   cin>>fileName;
  if (strstr(fileName, ".rfc")<0) {
    strcat(fileName, ".RFC");
  };
  cout<<fileName<<'\n';
  if (Search(fileName) && Open(m, fileName,noKey)) {
    cout<<"opened the module\n";
    cout<<"Enter PC value (in hex): ";
    cin>>hexBuffer;
    StringToBit ( pc , hexBuffer , 16 ) ;
    GetErrPosition(m, pc, start, end);
    line = GetLineno(m, start);
    cout<<"errStart="<<start<<" errStop="<<end<<'\n';
    cout<<"line="<<line<<'\n';
    Close(m);
  } else {
    cout<<"failed to open\n";
  };
}; /*loop*/
};

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?