Example #1
0
void DefineGlobalItem (CCodeChain &CC, const CString &sVar, const CItem &Item)

//	DefineGlobalItem
//
//	Defines a global variable and assigns it the given item

	{
	ICCItem *pItem = CreateListFromItem(CC, Item);
	CC.DefineGlobal(sVar, pItem);
	pItem->Discard(&CC);
	}
Example #2
0
ICCItem *CItemCtx::CreateItemVariable(CCodeChain &CC)

//	CreateItemVariable
//
//	Creates a variable for the item (or Nil)

	{
	const CItem *pItem = GetItemPointer();
	if (pItem == NULL)
		return CC.CreateNil();

	return CreateListFromItem(CC, *pItem);
	}
void CCodeChainCtx::DefineItem (const CString &sVar, const CItem &Item)

//	DefineItem
//
//	Defines a CItem variable

	{
	if (Item.GetType())
		{
		ICCItem *pItem = CreateListFromItem(m_CC, Item);
		m_CC.DefineGlobal(sVar, pItem);
		pItem->Discard(&m_CC);
		}
	else
		m_CC.DefineGlobal(sVar, m_CC.CreateNil());
	}