示例#1
0
int ProcessCODFile(char * File, DWORD FileLen) {
	char * CurrentPos = File;
	char Label[40];
	DWORD Address;
	int Length;

	while ( CurrentPos < File + FileLen ) {
		if (*CurrentPos != '0') { return FALSE; }
		CurrentPos += 1;
		if (*CurrentPos != 'x') { return FALSE; }
		CurrentPos += 1;
	
		if (strchr(CurrentPos,',') - CurrentPos != 8) { return FALSE; }
		Address = AsciiToHex (CurrentPos);
		CurrentPos += 9;


		if (strchr(CurrentPos,'\r') == NULL) {
			Length = strchr(CurrentPos,'\n') - CurrentPos;
		} else {
			Length = strchr(CurrentPos,'\r') - CurrentPos;
			if (Length > (strchr(CurrentPos,'\n') - CurrentPos)) {
				Length = strchr(CurrentPos,'\n') - CurrentPos;
			}
		}

		if (Length > 40) { Length = 40; }
		memcpy(Label,CurrentPos,Length);
		Label[Length] = '\0';

		AddMapEntry (Address, Label);
		CurrentPos = strchr(CurrentPos,'\n') + 1;
	}
	return TRUE;
}
示例#2
0
LRESULT CVariablePage::OnCbnSelchange(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
	int iCurClass = m_Classes.GetCurSel();
	if (iCurClass == -1)
		return 0;
	m_Variables.DeleteAllItems();
	int iClass = (int)m_Classes.GetItemData(iCurClass);
	if (iClass == -1)
		return 0;

	VSClass* pCurClass = (*m_pClassVector)[iClass];
	pCurClass->RetriveItems();
	*m_piCurrentClass = iClass;
	m_DDXManager.Init(pCurClass, &(*m_pModifications)[iClass]);

	if (pCurClass->IsDialog())
	{
		m_pDDXMap = pCurClass->GetMap(CString(_T("DDX")));
	}
	else
	{
		m_pDDXMap = NULL;
	}
	UpdateIDs(pCurClass);
	if (!m_pDDXMap)
	{
		return 0;
	}
	for (size_t i = 0; i < m_pDDXMap->MapEntries.GetCount(); i++)
	{
		VSMapEntry* pMapEntry = m_pDDXMap->MapEntries[i];
		CString ID, Var;
		ID = pMapEntry->Parameters[0]->Name;
		Var = pMapEntry->Parameters[1]->Name;
		for (size_t j = 0; j != pCurClass->Variables.GetCount(); j++)
		{
			if ((pCurClass->Variables[j])->Name == Var)
			{
				pMapEntry->pData = pCurClass->Variables[j];
				break;
			}
		}
		AddMapEntry(ID, Var, pMapEntry);
	}
	
	return 0;
}
示例#3
0
LRESULT CVariablePage::OnAddVar(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
	int iSel = m_IDs.GetCurSel();
	if (iSel == -1)
	{
		MessageBox(_T("Not selected ID"));
		return 0;
	}
	
	CString ControlID, MemberName;
	VSMapEntry* pMapEntry = m_DDXManager.AddVariable(iSel, ControlID, MemberName);
	if (pMapEntry)
	{
		AddMapEntry(ControlID, MemberName, pMapEntry);
		SetModified();
	}

	return 0;
}