📄 parsedlg.cpp
字号:
// ParseDlg.cpp : implementation file
//
#include "stdafx.h"
#include "PascalCompiler.h"
#include "ParseDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
FILE *pfile;
/////////////////////////////////////////////////////////////////////////////
// CParseDlg dialog
CParseDlg::CParseDlg(CWnd* pParent /*=NULL*/)
: CDialog(CParseDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CParseDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CParseDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CParseDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
DDX_Control(pDX, IDC_COMBO1, m_myCom);
DDX_Control(pDX, IDC_EDIT1, m_edit1);
DDX_Control(pDX, IDC_EDIT2, m_edit2);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CParseDlg, CDialog)
//{{AFX_MSG_MAP(CParseDlg)
ON_BN_CLICKED(IDB_EXITPARSE, OnExitparse)
ON_BN_CLICKED(IDB_SHOWTEXT, OnShowtext)
ON_BN_CLICKED(IDB_STARTPARSE, OnStartparse)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CParseDlg message handlers
BOOL CParseDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_myCom.AddString("d:/token.txt");
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CParseDlg::OnExitparse()
{
// TODO: Add your control notification handler code here
CDialog::OnCancel();
}
void CParseDlg::OnShowtext()
{
// TODO: Add your control notification handler code here
CString str;
m_myCom.GetWindowText(str);
CFile file;
if(str=="")
MessageBox("请先输入或选择源文件!");
else
{
if(file.Open(str,CFile::modeRead))
{
int len=file.GetLength();
char *buf=new char[len+1];
file.Read(buf,len);
file.Close();
buf[len]='\0';
m_edit1.SetWindowText(CString(buf));
UpdateData(FALSE);
delete buf;
}
}
}
void CParseDlg::OnStartparse()
{
// TODO: Add your control notification handler code here
CString str;
m_myCom.GetWindowText(str);
if(str == "")
MessageBox("请先输入或选择源文件!");
else
{
if (NULL == (pfile=fopen(str,"r")))
return;
m_parse.PASCALparse();
m_edit2.SetWindowText(m_parse.returnError());
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -