Example #1
0
TType::~TType(void)
{
    switch (form) {

	case fcSubrange:

	    //--Subrange:  Delete the base type object.
	    RemoveType(subrange.pBaseType);
	    break;

	case fcArray:

	    //--Array:  Delete the index and element type objects.
	    RemoveType(array.pIndexType);
	    RemoveType(array.pElmtType);
	    break;

	case fcRecord:

	    //--Record:  Delete the record fields symbol table.
	    delete record.pSymtab;
	    break;

	default:  break;
    }
}
Example #2
0
void RemovePredefinedTypes(void)
{
    RemoveType(pIntegerType);
    RemoveType(pRealType);
    RemoveType(pBooleanType);
    RemoveType(pCharType);
    RemoveType(pDummyType);
}
Example #3
0
TType *SetType(TType *&pTargetType, TType *pSourceType)
{
    if (!pTargetType) RemoveType(pTargetType);

    ++pSourceType->refCount;
    pTargetType = pSourceType;

    return pSourceType;
}
void MadFileAssociationDialog::WxButtonOKClick(wxCommandEvent& event)
{
	wxConfigBase *cfg=wxConfigBase::Get(false);
	wxString oldpath=cfg->GetPath();

	// clear old filetypes
	cfg->DeleteGroup(wxT("/AssociatedFileTypes"));

	cfg->SetPath(wxT("/AssociatedFileTypes"));

	// remove types
	int idx=0;
	int count = int(as_remove.Count());
	wxString type;
	while(idx<count)
	{
		type = as_remove[idx];
		if(DetectType(type))
		{
			RemoveType(type);
		}
		++idx;
	}

	// add types
	idx=0;
	count = int(WxListBoxAssociated->GetCount());
	while(idx<count)
	{
		type = WxListBoxAssociated->GetString(idx);
		AddType(type);
		cfg->Write(wxString()<<idx, type);
		++idx;
	}

	cfg->SetPath(oldpath);

	Close();
}
Example #5
0
bool HandleSystem::RemoveType(HandleType_t type, IdentityToken_t *ident)
{
	if (type == 0 || type >= HANDLESYS_TYPEARRAY_SIZE)
	{
		return false;
	}

	QHandleType *pType = &m_Types[type];

	if (pType->typeSec.ident
		&& pType->typeSec.ident != ident)
	{
		return false;
	}

	if (pType->dispatch == NULL)
	{
		return false;
	}

	/* Remove children if we have to */
	if (!(type & HANDLESYS_SUBTYPE_MASK))
	{
		QHandleType *childType;
		for (unsigned int i=1; i<=HANDLESYS_MAX_SUBTYPES; i++)
		{
			childType = &m_Types[type + i];
			if (childType->dispatch)
			{
				RemoveType(type + i, childType->typeSec.ident);
			}
		}
		/* Link us into the free chain */
		m_Types[++m_FreeTypes].freeID = type;
	}

	/* Make sure nothing is using this type. */
	if (pType->opened)
	{
		QHandle *pHandle;
		for (unsigned int i=1; i<=m_HandleTail; i++)
		{
			pHandle = &m_Handles[i];
			if (!pHandle->set || pHandle->type != type)
			{
				continue;
			}

			FreeHandle(pHandle, i);

			if (pType->opened == 0)
			{
				break;
			}
		}
	}

	/* Invalidate the type now */
	pType->dispatch = NULL;

	/* Remove it from the type cache. */
	if (pType->name)
		m_TypeLookup.remove(pType->name->chars());

	return true;
}
Example #6
0
bool HandleSystem::RemoveType(HandleType_t type, IdentityToken_t *ident)
{
    if (type == 0 || type >= HANDLESYS_TYPEARRAY_SIZE)
    {
        return false;
    }

    QHandleType *pType = &m_Types[type];

    if (pType->typeSec.ident
            && pType->typeSec.ident != ident)
    {
        return false;
    }

    if (pType->dispatch == NULL)
    {
        return false;
    }

    /* Remove children if we have to */
    if (!(type & HANDLESYS_SUBTYPE_MASK))
    {
        QHandleType *childType;
        for (unsigned int i=1; i<=HANDLESYS_MAX_SUBTYPES; i++)
        {
            childType = &m_Types[type + i];
            if (childType->dispatch)
            {
                RemoveType(type + i, childType->typeSec.ident);
            }
        }
        /* Link us into the free chain */
        m_Types[++m_FreeTypes].freeID = type;
    }

    /* Invalidate the type now */
    IHandleTypeDispatch *dispatch = pType->dispatch;
    pType->dispatch = NULL;

    /* Make sure nothing is using this type. */
    if (pType->opened)
    {
        QHandle *pHandle;
        for (unsigned int i=1; i<=m_HandleTail; i++)
        {
            pHandle = &m_Handles[i];
            if (!pHandle->set || pHandle->type != type)
            {
                continue;
            }
            if (pHandle->clone)
            {
                /* Get parent */
                QHandle *pOther = &m_Handles[pHandle->clone];
                if (--pOther->refcount == 0)
                {
                    /* Free! */
                    dispatch->OnHandleDestroy(type, pOther->object);
                    ReleasePrimHandle(pHandle->clone);
                }
                /* Unlink ourselves since we don't have a reference count */
                ReleasePrimHandle(i);
            } else {
                /* If it's not a clone, we still have to check the reference count.
                 * Either way, we'll be destroyed eventually because the handle types do not change.
                 */
                if (--pHandle->refcount == 0)
                {
                    /* Free! */
                    dispatch->OnHandleDestroy(type, pHandle->object);
                    ReleasePrimHandle(i);
                }
            }
            if (pType->opened == 0)
            {
                break;
            }
        }
    }

    /* Remove it from the type cache. */
    if (pType->nameIdx != -1)
    {
        const char *typeName;

        typeName = m_strtab->GetString(pType->nameIdx);
        sm_trie_delete(m_TypeLookup, typeName);
    }

    return true;
}