// DlgProperties.cpp : implementation file
//
#include "stdafx.h"
#include "grammaride.h"
#include "DlgProperties.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDlgProperties dialog
CDlgProperties::CDlgProperties(cxtPackage *pPkg, const cxaParseElement *papeElem, CWnd* pParent /*=NULL*/)
: CDialog(CDlgProperties::IDD, pParent)
{
//{{AFX_DATA_INIT(CDlgProperties)
m_strProperties = _T("");
//}}AFX_DATA_INIT
if(papeElem->fIsNode())
{
m_strCaption = "cxaParseNode Properties";
m_strProperties.Format(
"ID-Value:\t\t%d\r\n"
"AtmType:\t\t%d\r\n"
"Text:\t\t%s\r\n",
papeElem->nGetIDValue(),
papeElem->nGetAtmType(),
(papeElem->lpszGetElemText()!=NULL)?papeElem->lpszGetElemText():"NULL");
}
else
{
m_strCaption = "cxaParseBranch Properties";
const cxAnalyzerMain::ae_vec_type& aevec = pPkg->pamGetParser()->paevecGetExpressionsVector();
cxAnalyzerMain::ae_vec_type::const_iterator it;
const std::tstring *pstr = NULL;
for(it=aevec.begin();it!=aevec.end();it++)
{
if( (*it)->nGetIDValue()==papeElem->nGetIDValue())
pstr = (*it)->pstrGetInitString();
}
m_strProperties.Format(
"ID-Value:\t\t%d\r\n"
"AtmType:\t\t%d\r\n"
"Prec.Prio:\t\t%d\r\n"
"Init:\t\t%s\r\n",
papeElem->nGetIDValue(),
papeElem->nGetAtmType(),
papeElem->papbElem()->nGetPrecPrio(),
(pstr!=NULL)?pstr->c_str():"NULL");
}
}
CDlgProperties::CDlgProperties(cxtPackage *pPkg, int nAtmType, CWnd* pParent /*=NULL*/)
: CDialog(CDlgProperties::IDD, pParent)
{
//{{AFX_DATA_INIT(CDlgProperties)
m_strProperties = _T("");
//}}AFX_DATA_INIT
m_strCaption = "Analyzer Expression Class Properties";
const cxAnalyzerTypeInfo *pInfo = pPkg->patmGetAnalyzerMap()->patiGetTypeInfo(nAtmType);
if(pInfo!=NULL)
{
LPCTSTR lpszMType = "NULL";
LPCTSTR lpszSubType = "NULL";
if(pInfo->nGetMType()==ATM_MTYPE_TOKEN)
lpszMType="ATM_MTYPE_TOKEN";
if(pInfo->nGetMType()==ATM_MTYPE_COMP_TOKEN)
lpszMType="ATM_MTYPE_COMP_TOKEN";
if(pInfo->nGetMType()==ATM_MTYPE_RULE)
lpszMType="ATM_MTYPE_RULE";
if(pInfo->nGetSubType()==ATM_SUBT_RULE_UNDEF)
lpszSubType="ATM_SUBT_RULE_UNDEF";
if(pInfo->nGetSubType()==ATM_SUBT_RULE_FINITE)
lpszSubType="ATM_SUBT_RULE_FINITE";
if(pInfo->nGetSubType()==ATM_SUBT_RULE_OPEN)
lpszSubType="ATM_SUBT_RULE_OPEN";
m_strProperties.Format(
"nAtmType:\t%d\r\n"
"MType:\t\t%s\r\n"
"SubType:\t\t%s\r\n",
pInfo->nGetAtmType(),
lpszMType,
lpszSubType);
}
else
m_strProperties = "<NULL>";
}
CDlgProperties::CDlgProperties(cxtPackage *pPkg, const cxaTokenStream* patsTokens, CWnd* pParent /*=NULL*/)
: CDialog(CDlgProperties::IDD, pParent)
{
//{{AFX_DATA_INIT(CDlgProperties)
m_strProperties = _T("");
//}}AFX_DATA_INIT
m_strCaption = "Raw token stream";
cxaTokenStream::const_iterator it;
for(it=patsTokens->begin(); it!=patsTokens->end(); it++)
{
CString strTemp;
strTemp.Format("AtmType:%3d, IDValue:%5d, TOID:%4d, Text: [%s]\r\n",
(*it).nAtmType, (*it).nIDValue, (*it).nToid,
((*it).lpszTokenText==NULL)?"<<NULL>>":(*it).lpszTokenText);
m_strProperties += strTemp;
}
}
void CDlgProperties::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgProperties)
DDX_Text(pDX, IDC_PROPERTIES, m_strProperties);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgProperties, CDialog)
//{{AFX_MSG_MAP(CDlgProperties)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgProperties message handlers
BOOL CDlgProperties::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
SetWindowText(m_strCaption);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}