⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pl0view.cpp

📁 一、 pl0文法:适用于递归下降分析算法
💻 CPP
字号:
// pl0View.cpp : implementation of the CPl0View class
//

#include "stdafx.h"
#include "pl0.h"

#include "pl0Doc.h"
#include "pl0View.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CPl0View

IMPLEMENT_DYNCREATE(CPl0View, CEditView)

BEGIN_MESSAGE_MAP(CPl0View, CEditView)
	//{{AFX_MSG_MAP(CPl0View)
	ON_COMMAND(ID_COM_COM, OnComCom)
	ON_COMMAND(ID_COM_RUN, OnComRun)
	//}}AFX_MSG_MAP
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, CEditView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CEditView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CEditView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPl0View construction/destruction

CPl0View::CPl0View()
{
	// TODO: add construction code here

}

CPl0View::~CPl0View()
{
}

BOOL CPl0View::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	BOOL bPreCreated = CEditView::PreCreateWindow(cs);
	cs.style &= ~(ES_AUTOHSCROLL|WS_HSCROLL);	// Enable word-wrapping

	return bPreCreated;
}

/////////////////////////////////////////////////////////////////////////////
// CPl0View drawing

void CPl0View::OnDraw(CDC* pDC)
{
	CPl0Doc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
}

/////////////////////////////////////////////////////////////////////////////
// CPl0View printing

BOOL CPl0View::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default CEditView preparation
	return CEditView::OnPreparePrinting(pInfo);
}

void CPl0View::OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo)
{
	// Default CEditView begin printing.
	CEditView::OnBeginPrinting(pDC, pInfo);
}

void CPl0View::OnEndPrinting(CDC* pDC, CPrintInfo* pInfo)
{
	// Default CEditView end printing
	CEditView::OnEndPrinting(pDC, pInfo);
}

/////////////////////////////////////////////////////////////////////////////
// CPl0View diagnostics

#ifdef _DEBUG
void CPl0View::AssertValid() const
{
	CEditView::AssertValid();
}

void CPl0View::Dump(CDumpContext& dc) const
{
	CEditView::Dump(dc);
}

CPl0Doc* CPl0View::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CPl0Doc)));
	return (CPl0Doc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CPl0View message handlers

void CPl0View::OnComCom() 
{
	// TODO: Add your command handler code here
	CPl0Doc *pDoc=this->GetDocument();
	this->GetWindowText(pDoc->m_text);
	pDoc->m_parser.pl0(pDoc->m_text);
	CString s;
	pDoc->m_parser.getCode(s);
	if(s.GetLength())
		MessageBox(s);
}

void CPl0View::OnComRun() 
{
	// TODO: Add your command handler code here
	CPl0Doc *pDoc=this->GetDocument();
	this->GetWindowText(pDoc->m_text);
	pDoc->m_parser.Execute(pDoc->m_text);
}

⌨️ 快捷键说明

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