Ejemplo n.º 1
0
void CTobCompiler::Reset()
{
	m_line = 0;
	m_err.Empty();
	m_bin.RemoveAll();
	if(m_fsrc) { fclose(m_fsrc); m_fsrc = 0; }
	if(m_fdst) { fclose(m_fdst); m_fdst = 0; }

	POSITION p = m_defbin.GetStartPosition();
	CString str;
	CByteArray* bin;
	while(p)
	{
		m_defbin.GetNextAssoc(p, str, bin);
		delete bin;
	}
	m_defbin.RemoveAll();
	m_defbin.InitHashTable(251);

	m_label.RemoveAll();
	m_label.InitHashTable(251);
	for(int i = m_exp.GetSize() - 1; i >= 0; --i)
		delete m_exp.GetAt(i);
	m_exp.RemoveAll();
	m_change.RemoveAll();
	m_change.InitHashTable(251);
	m_bit_i = 32;
	m_bit_f = 32;
	m_maxc = -1;
	m_maxw = -1;
	m_maxs = -1;
}
Ejemplo n.º 2
0
int CGrfDoc::DeleteTags(bool WithPrompts)
  {
  Strng_List MyTags;
  GetTagList(MyTags);
  int nTags=MyTags.Length();
  int nTagsMultPgs=0;
  if (nTags>0)
    {
    CMap<LPTSTR, LPTSTR, Strng*, Strng*> MyTagMap;
    MyTagMap.InitHashTable(FindNextPrimeNumber(MyTags.Length()));
    for (Strng *pTag=MyTags.First(); pTag; pTag=MyTags.Next())
      {
      pTag->SetIndex(0);
      MyTagMap.SetAt(pTag->Str(), pTag);
      }

    for (int iTmpl=iGraphTemplate; iTmpl<=iVisioTemplate; iTmpl++)
      {
      if (ScdApp()->TemplateExists(iTmpl))
        {
        POSITION Pos = ScdApp()->Template(iTmpl).GetFirstDocPosition();
        while (Pos)
          {
          CGrfDoc* pOtherDoc = (CGrfDoc*)(ScdApp()->Template(iTmpl).GetNextDoc(Pos));
          if (pOtherDoc!=this)
            {
            Strng *pTag;
            Strng_List OtherTags;
            int NGrfTags = pOtherDoc->GetTagList(OtherTags);
            for (Strng *pOtherTag=OtherTags.First(); pOtherTag; pOtherTag=OtherTags.Next())
              if (MyTagMap.Lookup(pOtherTag->Str(), pTag))
                pTag->SetIndex(pTag->Index()+1);
            }
          }
        }
      }

    for (Strng *pTag=MyTags.First(); pTag; pTag=MyTags.Next())
      {
      if (pTag->Index()>0)
        nTagsMultPgs++;
      }

    int Ret=IDYES;
    if (WithPrompts)
      {
      CString S;
      if (nTagsMultPgs)
        S.Format("Do you want Delete %i Units (%i Units have Multiple References)", nTags-nTagsMultPgs, nTagsMultPgs);
      else
        S.Format("Do you want Delete %i Units", nTags);
      Ret=AfxMessageBox(S, MB_ICONQUESTION|MB_YESNOCANCEL);
      }
    if (Ret==IDCANCEL)
      return -1;
    if (Ret==IDYES)
      {
      Strng_List DelTags;
      int nMdlDeletes=0;
      int nDeletesFailedCnt=0;
      for (Strng *pTag=MyTags.First(); pTag; pTag=MyTags.Next())
        {
        if (pTag->Index()==0)
          {
          DelTags.Append(pTag->Str());
          }
        }

      int RetCode = gs_Exec.DeleteTags(DelTags);
      for (Strng *pTag=DelTags.First(); pTag; pTag=MyTags.Next())
        {
        if (pTag->Index()!=EODT_DONE)
          {
          //dbgpln("Mdl Not Deleted %s", pTag->Str());
          LogError(pTag->Str(), 0, "Model not deleted");
          nDeletesFailedCnt++;
          }
        else
          {
          //dbgpln("Mdl     Deleted %s", pTag->Str());
          nMdlDeletes++;
          }
        }
      if (nDeletesFailedCnt)
        {
        CString S;
        S.Format("%i Units Failed to Delete", nDeletesFailedCnt);
        AfxMessageBox(S, MB_ICONEXCLAMATION|MB_OK);
        }
      }
    }
  return nTags;
  };