cmpl.cpp

来自「本软件实现了模拟cpu的基本工作原理和工作过程」· C++ 代码 · 共 75 行

CPP
75
字号
// CMPL.cpp : implementation file
//

#include "stdafx.h"
#include "AM.h"
#include "CMPL.h"

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

/////////////////////////////////////////////////////////////////////////////
// CMPL dialog


CMPL::CMPL(CWnd* pParent /*=NULL*/)
	: CDialog(CMPL::IDD, pParent)
{
	//{{AFX_DATA_INIT(CMPL)
	m_code = _T("");
	//}}AFX_DATA_INIT
}


void CMPL::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CMPL)
	DDX_Text(pDX, IDC_CODE_EDIT, m_code);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CMPL, CDialog)
	//{{AFX_MSG_MAP(CMPL)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMPL message handlers

void CMPL::OnOK() 
{
	lines.clear();
	int len=m_code.GetLength();

	char* temp=new char[len+1];
	strcpy(temp,m_code.GetBuffer(10));

	int i=0,j=0;
	char* ptr=temp;
	while(1){
		if(temp[i]==13){
			temp[i]=0;
			lines.insert(j++,*ptr);
			i+=2;
			ptr=&temp[i];
		}
		else if(temp[i]==0)break;
		else i++;
	}
	CDialog::OnOK();
}
int CMPL::compile()
{
	for(int i=0;i<lines.size();i++){
		
	}
	return 0;
}


⌨️ 快捷键说明

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