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

📄 automakeview.cpp

📁 一个大学时候做的编译原理的实验.实验内容是正则表达式到NFA到DFA到最小化DFA最终生成词法分析代码的整个过程的演示.那时由于时间关系,词法分析代码自动生成部分还没完成.
💻 CPP
字号:
// AutoMakeView.cpp : implementation of the CAutoMakeView class
//

#include "stdafx.h"
#include "AutoMake.h"

#include "AutoMakeDoc.h"
#include "AutoMakeView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CAutoMakeView

IMPLEMENT_DYNCREATE(CAutoMakeView, CView)

BEGIN_MESSAGE_MAP(CAutoMakeView, CView)
	//{{AFX_MSG_MAP(CAutoMakeView)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CAutoMakeView construction/destruction

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

}

CAutoMakeView::~CAutoMakeView()
{
}

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

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CAutoMakeView drawing

void CAutoMakeView::OnDraw(CDC* pDC)
{
	CAutoMakeDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
	CRect rc;
	GetClientRect(&rc);
    CFont font;
	font.CreatePointFont(rc.Width()/4,"宋体");
	CFont *pOldFont;
	pOldFont=pDC->SelectObject(&font);
	pDC->FillRect(&rc,&CBrush(RGB(0,255,0)));
	pDC->SetTextColor(RGB(0,0,255));
	pDC->SetBkMode(TRANSPARENT);
	pDC->DrawText("正则表达式转换为DFA 或DFA转换为分析程序",&rc,DT_CENTER|DT_SINGLELINE|DT_VCENTER);
	pDC->SelectObject(pOldFont);
}

/////////////////////////////////////////////////////////////////////////////
// CAutoMakeView diagnostics

#ifdef _DEBUG
void CAutoMakeView::AssertValid() const
{
	CView::AssertValid();
}

void CAutoMakeView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

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

/////////////////////////////////////////////////////////////////////////////
// CAutoMakeView message handlers

⌨️ 快捷键说明

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