Ejemplo n.º 1
0
void CAsyncApiMgr::AddJob(CAsyncApiJob* job)
{
	//r3dOutToLog("AddJob %s\n", job->desc); CLOG_INDENT;

	// search for less used worker
	int    workerIdx = 0;
	size_t minJobs   = 99;
	for(int i=0; i<NUM_WORKER_THREADS; i++)
	{
		CAsyncApiWorker& worker = workers_[i];
		r3dCSHolder cs1(worker.csJobs_);

		// check if we already have job with that customerid
		if(job->CustomerID)
		{
			if(worker.curJob_ && worker.curJob_->CustomerID == job->CustomerID)
			{
				workerIdx = i;
				break;
			}
			bool found = false;
			for(std::list<CAsyncApiJob*>::iterator it = worker.jobs_.begin(); it != worker.jobs_.end(); ++it)
			{
				if((*it)->CustomerID == job->CustomerID)
				{
					workerIdx = i;
					found     = true;
					break;
				}
			}
			if(found)
				break;
		}

		if(worker.jobs_.size() < minJobs)
		{
			minJobs   = worker.jobs_.size();
			workerIdx = i;
		}
	}

	// add job to worker
	CAsyncApiWorker& worker = workers_[workerIdx];
	r3dCSHolder cs1(worker.csJobs_);
	worker.jobs_.push_back(job);

	::SetEvent(worker.hStartEvt_);

	return;
}
Ejemplo n.º 2
0
void KURLBar::writeConfig(KConfig *config, const QString &itemGroup)
{
    KConfigGroupSaver cs1(config, itemGroup);
    if(!config->hasDefault("Speedbar IconSize") && m_iconSize == d->defaultIconSize)
        config->revertToDefault("Speedbar IconSize");
    else
        config->writeEntry("Speedbar IconSize", m_iconSize);

    if(!m_isModified)
        return;

    int i = 0;
    int numLocal = 0;
    KURLBarItem *item = static_cast< KURLBarItem * >(m_listBox->firstItem());

    while(item)
    {
        if(item->isPersistent()) // we only save persistent items
        {
            if(item->applicationLocal())
            {
                writeItem(item, numLocal, config, false);
                numLocal++;
            }

            i++;
        }
        item = static_cast< KURLBarItem * >(item->next());
    }
    config->writeEntry("Number of Entries", numLocal);


    // write the global entries to kdeglobals, if any
    bool haveGlobalEntries = (i > numLocal);
    if(m_useGlobal && haveGlobalEntries)
    {
        config->setGroup(itemGroup + " (Global)");

        int numGlobals = 0;
        item = static_cast< KURLBarItem * >(m_listBox->firstItem());

        while(item)
        {
            if(item->isPersistent()) // we only save persistent items
            {
                if(!item->applicationLocal())
                {
                    writeItem(item, numGlobals, config, true);
                    numGlobals++;
                }
            }

            item = static_cast< KURLBarItem * >(item->next());
        }
        config->writeEntry("Number of Entries", numGlobals, true, true);
    }

    m_isModified = false;
}
Ejemplo n.º 3
0
void CAsyncApiMgr::GetStatus(char* text)
{
	*text = 0;
	for(int i=0; i<NUM_WORKER_THREADS; i++)
	{
		r3dCSHolder cs1(workers_[i].csJobs_);
		sprintf(text + strlen(text), "%d ", workers_[i].jobs_.size());
	}
}
Ejemplo n.º 4
0
CAsyncApiJob* CAsyncApiWorker::GetNextJob()
{
	r3dCSHolder cs1(csJobs_);
	if(jobs_.size() == 0)
		return NULL;

	CAsyncApiJob* job = jobs_.front();
	jobs_.pop_front();

	return job;
}
Ejemplo n.º 5
0
// Calculates the transformation matrix between two coordinate systems
void mtransf(DMatrix csys1, DMatrix csys2, DMatrix &mat)
{
  DMatrix cs1(3,3), cs2(3,3);
  double size1, size2;
  int i, j, ito, ifrom, idot;

  // normalization
  for (i=1; i<=3; i++) {
    size1 = 0;
    size2 = 0;
    for (j=1; j<=3; j++) {
      size1 += pow(csys1(i,j),2);
      size2 += pow(csys2(i,j),2);
    }
    size1 = sqrt(size1);
    size2 = sqrt(size2);

    for (j=1; j<=3; j++) {
      cs1(i,j) = csys1(i,j) / size1;
      cs2(i,j) = csys2(i,j) / size2;
    }
  }

  // transformation
  for (ito=1; ito<=3; ito++) {
    for (ifrom=1; ifrom<=3; ifrom++) {
      mat(ito,ifrom) = 0;

      for (idot=1; idot<=3; idot++)
	mat(ito,ifrom) += cs2(ito,idot) * cs1(ifrom,idot);

      if (fabs(mat(ito,ifrom))<=1e-16)
	mat(ito,ifrom) = 0;
    }
  }
}
Ejemplo n.º 6
0
static void drawNews(CUpdater& updater)
{
  if(updater.newsStatus_ != 2)
    return;

  r3dCSHolder cs1(updater.csNews_);

  // check for survey
  static bool need_to_show_survey = true;
  if(!updater.surveyLinkIn_.empty() && need_to_show_survey) {
    need_to_show_survey = false;
    ShellExecute(NULL, "open", updater.surveyLinkIn_.c_str(), "", NULL, SW_SHOW);
  }

  drawNewsSection(0, 320, updater.newsData_, 5);

  return;
}
Ejemplo n.º 7
0
int CAsyncApiWorker::WorkerThread()
{
	while(true)
	{
		::WaitForSingleObject(hStartEvt_, INFINITE);

		while(CAsyncApiJob* job = GetNextJob())
		{
			ProcessJob(job);
		}

		r3dCSHolder cs1(csJobs_);
		if(jobs_.size() == 0 && needToExit_)
		{
			r3dOutToLog("CAsyncApiWorker %d finished\n", idx_);
			return 0;
		}
	}
}
Ejemplo n.º 8
0
      void svd_qr_shift(MatrixType & vcl_u,
                        MatrixType & vcl_v,
                        CPU_VectorType & q,
                        CPU_VectorType & e)
      {
        typedef typename MatrixType::value_type                                   ScalarType;
        typedef typename viennacl::result_of::cpu_value_type<ScalarType>::type    CPU_ScalarType;

        vcl_size_t n = q.size();
        int m = static_cast<int>(vcl_u.size1());

        detail::transpose(vcl_u);
        detail::transpose(vcl_v);

        std::vector<CPU_ScalarType> signs_v(n, 1);
        std::vector<CPU_ScalarType> cs1(n), ss1(n), cs2(n), ss2(n);

        viennacl::vector<CPU_ScalarType> tmp1(n, viennacl::traits::context(vcl_u)), tmp2(n, viennacl::traits::context(vcl_u));

        bool goto_test_conv = false;

        for (int k = static_cast<int>(n) - 1; k >= 0; k--)
        {
          // std::cout << "K = " << k << std::endl;

          vcl_size_t iter = 0;
          for (iter = 0; iter < detail::ITER_MAX; iter++)
          {
            // test for split
            int l;
            for (l = k; l >= 0; l--)
            {
              goto_test_conv = false;
              if (std::fabs(e[vcl_size_t(l)]) <= detail::EPS)
              {
                // set it
                goto_test_conv = true;
                break;
              }

              if (std::fabs(q[vcl_size_t(l) - 1]) <= detail::EPS)
              {
                // goto
                break;
              }
            }

            if (!goto_test_conv)
            {
              CPU_ScalarType c = 0.0;
              CPU_ScalarType s = 1.0;

              //int l1 = l - 1;
              //int l2 = k;

              for (int i = l; i <= k; i++)
              {
                CPU_ScalarType f = s * e[vcl_size_t(i)];
                e[vcl_size_t(i)] = c * e[vcl_size_t(i)];

                if (std::fabs(f) <= detail::EPS)
                {
                  //l2 = i - 1;
                  break;
                }

                CPU_ScalarType g = q[vcl_size_t(i)];
                CPU_ScalarType h = detail::pythag(f, g);
                q[vcl_size_t(i)] = h;
                c = g / h;
                s = -f / h;

                cs1[vcl_size_t(i)] = c;
                ss1[vcl_size_t(i)] = s;
              }

              // std::cout << "Hitted!" << l1 << " " << l2 << "\n";

              // for (int i = l; i <= l2; i++)
              // {
              //   for (int j = 0; j < m; j++)
              //   {
              //     CPU_ScalarType y = u(j, l1);
              //     CPU_ScalarType z = u(j, i);
              //     u(j, l1) = y * cs1[i] + z * ss1[i];
              //     u(j, i) = -y * ss1[i] + z * cs1[i];
              //   }
              // }
            }

            CPU_ScalarType z = q[vcl_size_t(k)];

            if (l == k)
            {
              if (z < 0)
              {
                q[vcl_size_t(k)] = -z;

                signs_v[vcl_size_t(k)] *= -1;
              }

              break;
            }

            if (iter >= detail::ITER_MAX - 1)
              break;

            CPU_ScalarType x = q[vcl_size_t(l)];
            CPU_ScalarType y = q[vcl_size_t(k) - 1];
            CPU_ScalarType g = e[vcl_size_t(k) - 1];
            CPU_ScalarType h = e[vcl_size_t(k)];
            CPU_ScalarType f = ((y - z) * (y + z) + (g - h) * (g + h)) / (2 * h * y);

            g = detail::pythag<CPU_ScalarType>(f, 1);

            if (f < 0) {
              f = ((x - z) * (x + z) + h * (y / (f - g) - h)) / x;
            } else {
              f = ((x - z) * (x + z) + h * (y / (f + g) - h)) / x;
            }

            CPU_ScalarType c = 1;
            CPU_ScalarType s = 1;

            for (vcl_size_t i = static_cast<vcl_size_t>(l) + 1; i <= static_cast<vcl_size_t>(k); i++)
            {
              g = e[i];
              y = q[i];
              h = s * g;
              g = c * g;
              CPU_ScalarType z2 = detail::pythag(f, h);
              e[i - 1] = z2;
              c = f / z2;
              s = h / z2;
              f = x * c + g * s;
              g = -x * s + g * c;
              h = y * s;
              y = y * c;

              cs1[i] = c;
              ss1[i] = s;

              z2 = detail::pythag(f, h);
              q[i - 1] = z2;
              c = f / z2;
              s = h / z2;
              f = c * g + s * y;
              x = -s * g + c * y;

              cs2[i] = c;
              ss2[i] = s;
            }

            {
              viennacl::copy(cs1, tmp1);
              viennacl::copy(ss1, tmp2);

              givens_prev(vcl_v, tmp1, tmp2, static_cast<int>(n), l, k);
            }

            {
              viennacl::copy(cs2, tmp1);
              viennacl::copy(ss2, tmp2);

              givens_prev(vcl_u, tmp1, tmp2, m, l, k);
            }

            e[vcl_size_t(l)] = 0.0;
            e[vcl_size_t(k)] = f;
            q[vcl_size_t(k)] = x;
          }

        }


        viennacl::copy(signs_v, tmp1);
        change_signs(vcl_v, tmp1, static_cast<int>(n));

        // transpose singular matrices again
        detail::transpose(vcl_u);
        detail::transpose(vcl_v);
      }
Ejemplo n.º 9
0
// Return true iff S1 is a prefix of S2
static bool is_prefix(const MString& m1, const MString& m2)
{
    XmString s1 = m1.xmstring();
    XmString s2 = m2.xmstring();

    XmStringContext c1;
    XmStringContext c2;

    XmStringInitContext(&c1, s1);
    XmStringInitContext(&c2, s2);

    XmStringComponentType t1 = XmSTRING_COMPONENT_UNKNOWN;
    XmStringComponentType t2 = XmSTRING_COMPONENT_UNKNOWN;

    while (t1 != XmSTRING_COMPONENT_END && t2 != XmSTRING_COMPONENT_END)
    {
	char *s_text1            = 0;
	XmStringCharSet s_cs1    = 0;
	XmStringDirection d1     = XmSTRING_DIRECTION_DEFAULT;
	XmStringComponentType u1 = XmSTRING_COMPONENT_UNKNOWN;
	unsigned short ul1       = 0;
	unsigned char *s_uv1     = 0;
	
	t1 = XmStringGetNextComponent(c1, &s_text1, &s_cs1, &d1, 
				      &u1, &ul1, &s_uv1);

	char *s_text2            = 0;
	XmStringCharSet s_cs2    = 0;
	XmStringDirection d2     = XmSTRING_DIRECTION_DEFAULT;
	XmStringComponentType u2 = XmSTRING_COMPONENT_UNKNOWN;
	unsigned short ul2       = 0;
	unsigned char *s_uv2     = 0;

	t2 = XmStringGetNextComponent(c2, &s_text2, &s_cs2, &d2,
				      &u2, &ul2, &s_uv2);

	// Upon EOF in LessTif 0.82, XmStringGetNextComponent()
	// returns XmSTRING_COMPONENT_UNKNOWN instead of
	// XmSTRING_COMPONENT_END.  Work around this.
	if (t1 == XmSTRING_COMPONENT_UNKNOWN && s_uv1 == 0)
	    t1 = XmSTRING_COMPONENT_END;
	if (t2 == XmSTRING_COMPONENT_UNKNOWN && s_uv2 == 0)
	    t2 = XmSTRING_COMPONENT_END;

	// Place string values in strings
	string text1(s_text1 == 0 ? "" : s_text1);
	string text2(s_text2 == 0 ? "" : s_text2);
	string cs1(s_cs1 == 0 ? "" : s_cs1);
	string cs2(s_cs2 == 0 ? "" : s_cs2);
	string uv1;
	string uv2;
	if (s_uv1 != 0)
	    uv1 = string((char *)s_uv1, ul1);
	if (s_uv2 != 0)
	    uv2 = string((char *)s_uv2, ul2);

	// Free unused memory
	XtFree(s_text1);
	XtFree(s_text2);
	XtFree(s_cs1);
	XtFree(s_cs2);
	XtFree((char *)s_uv1);
	XtFree((char *)s_uv2);

	if (t1 != t2)
	{
	    goto done;		// Differing tags
	}

	switch (t1)
	{
	case XmSTRING_COMPONENT_CHARSET:
	{
	    if (cs1.empty())	// In LessTif 0.82, XmStringGetNextComponent()
		cs1 = text1;	// swaps CS and TEXT.  Work around this.
	    if (cs2.empty())
		cs2 = text2;

	    if (cs1 != cs2)
		goto done;	// Differing character sets
	    break;
	}

	case XmSTRING_COMPONENT_TEXT:
#if XmVersion >= 1002
	case XmSTRING_COMPONENT_LOCALE_TEXT:
#endif
#if XmVersion >= 2000
	case XmSTRING_COMPONENT_WIDECHAR_TEXT:
#endif
	{
	    if (text1.empty())	// In LessTif 0.82, XmStringGetNextComponent()
		text1 = cs1;	// swaps CS and TEXT.  Work around this.
	    if (text2.empty())
		text2 = cs2;

	    if (!text2.contains(text1, 0))
		goto done;
	    XmStringComponentType next2 = XmStringPeekNextComponent(c2);

	    // In LessTif 0.82, XmStringPeekNextComponent() returns
	    // XmSTRING_COMPONENT_UNKNOWN instead of
	    // XmSTRING_COMPONENT_END.  Work around this.
	    if (next2 != XmSTRING_COMPONENT_END && 
		next2 != XmSTRING_COMPONENT_UNKNOWN)
		goto done;
	    break;
	}

	case XmSTRING_COMPONENT_DIRECTION:
	{
	    if (d1 != d2)
		goto done;
	    break;
	}

	case XmSTRING_COMPONENT_SEPARATOR:
	case XmSTRING_COMPONENT_END:
	{
	    // These are the same by definition
	    break;
	}

	case XmSTRING_COMPONENT_UNKNOWN:
	{
	    if (uv1 != uv2)
		goto done;	// Differing unknown tags
	    break;
	}

	default:
	{
	    break;		// Skip everything else
	}
	}
    }
 done:

    XmStringFreeContext(c2);
    XmStringFreeContext(c1);

    return t1 == XmSTRING_COMPONENT_END;
}
Ejemplo n.º 10
0
void CAsyncApiMgr::Tick()
{
	for(int i=0; i<NUM_WORKER_THREADS; i++)
	{
		CAsyncApiWorker& worker = workers_[i];

		r3dCSHolder cs1(worker.csJobs_);

		for(std::list<CAsyncApiJob*>::iterator it = worker.finished_.begin(); it != worker.finished_.end(); ++it)
		{
			CAsyncApiJob* job = *it;

			// log that job is failed
			if(job->ResultCode != 0)
			{
				r3dOutToLog("CAsyncApiWorker %d job %s failed\n", worker.idx_, job->desc);

				if(strcmp(job->desc, "CJobAddLogInfo") != 0) // do NOT log it, or we can get into infinite loop
				{
					CJobAddLogInfo* job2 = new CJobAddLogInfo();
					job2->CheatID    = PKT_S2C_CheatWarning_s::CHEAT_Api;
					job2->CustomerID = job->CustomerID;
					job2->CharID     = job->CharID;
					job2->IP         = gServerLogic.GetExternalIP();
					sprintf(job2->Msg,  "Api");
					sprintf(job2->Data, "%d %d job: %d %s", job->CustomerID, job->CharID, job->ResultCode, job->desc);
					AddJob(job2);
				}
			}

			// peerless job
			if(job->peerId == -1)
			{
				job->OnSuccess();
				delete job;
				continue;
			}

			// see if this is still a valid peer
			ServerGameLogic::peerInfo_s& peer = gServerLogic.GetPeer(job->peerId);
			if(peer.CustomerID != job->CustomerID || peer.SessionID != job->SessionID)
			{
				//r3dOutToLog("CAsyncApiWorker %d job %s peer already disconnected\n", worker.idx_, job->desc);
			}
			else if(job->ResultCode != 0)
			{
				// prevent player from updating it's loadout after error
				//if(peer.player) 
				//peer.player->wasDisconnected_ = true;

				// player job failed, disconnect him
				//gServerLogic.DisconnectPeer(job->peerId, false, "API FAILED");
			}
			else
			{
				job->OnSuccess();
			}

			delete job;
		}

		worker.finished_.clear();
	}
}
Ejemplo n.º 11
0
int main()
{
  Point p1(-253.357, -123.36);
  Point p2(-190.03, 216.606);
  Point p3(-343.349, 286.6);
  Point p4(141.604, 279.934);
  Point p5(276.591, -46.7012);
  Point p6(251.593, -263.347);
  Point p7(-3.38184, -343.339);
  Point p8(-380.012, -173.355);
  Point p9(-98.3726, 39.957);
  Point p10(133.271, 124.949);
  Point p11(289.923, 301.598);
  Point p12(421.577, 23.292);
  Point p13(79.9434, -93.3633);
  Point p14(-40.0449, 366.592);
  Point p15(311.587, 374.924);
  Point p16(431.576, 214.94);
  Point p17(426.576, -131.693);
  Point p18(-265.023, -285.011);
  Point p19(369.915, 89.9521);
  Point p20(368.249, -15.0376);
  Point p21(484.904, 18.2925);
  Point p22(-411.675, 283.267);
  Point p23(-250.024, 124.949);
  Point p24(-80.041, -78.3647);
  Point p25(-360.014, 31.6245);
  Point p26(-305.019, 356.593);
  
  // built Delaunay triangulation
  PS.insert(p1); PS.insert(p2); PS.insert(p3); PS.insert(p4);
  PS.insert(p5); PS.insert(p6); PS.insert(p7); PS.insert(p8);  
  PS.insert(p9); PS.insert(p10); PS.insert(p11); PS.insert(p12);
  PS.insert(p13); PS.insert(p14); PS.insert(p15); PS.insert(p16);  
  PS.insert(p17); PS.insert(p18); PS.insert(p19); PS.insert(p20);
  PS.insert(p21); PS.insert(p22); PS.insert(p23); PS.insert(p24);
  PS.insert(p25); PS.insert(p26);
  
  std::list<Vertex_handle> LV;
  
  bool correct = true;
  
  // circle emptiness check
  Circle cs1(Point(-23.3799, 108.284), 1124.78);
  check_empty checker(cs1);
  
  CGAL::range_search(PS,cs1,std::back_inserter(LV),checker,true);
   
  if (checker.get_result()) {
    std::cout << "circle not empty !\n";
    std::cout <<  "this is an error !\n"; correct=false;
  }
  else std::cout << "circle was empty !\n";  
  
  Circle cs2(Point(-255.024, -100.029), 23551);
  check_empty checker2(cs2);
  
  CGAL::range_search(PS,cs2,std::back_inserter(LV),checker2,true);
   
  if (checker2.get_result()) std::cout << "circle not empty !\n";
  else {
    std::cout << "circle was empty !\n";   
    std::cout <<  "this is an error !\n"; correct=false;
  } 
  
  // triangle check
  Triangle t1(Point(-21.7134, -123.36), Point(84.9429, 74.9536), Point(209.931, -161.69)); 
  Triangle t2(Point(-61.7095, 164.945), Point(-88.3735, 101.618), Point(49.9463, 101.618));
  
  check_empty_triangle tchecker1(t1);
  CGAL::range_search(PS,t1.vertex(0),t1.vertex(1),t1.vertex(2),std::back_inserter(LV),tchecker1,true);
   
  if (tchecker1.get_result()) std::cout << "triangle not empty !\n";
  else {
    std::cout << "triangle was empty !\n";   
    std::cout <<  "this is an error !\n"; correct=false;
  }
  
  check_empty_triangle tchecker2(t2);
  CGAL::range_search(PS,t2.vertex(0),t2.vertex(1),t2.vertex(2),std::back_inserter(LV),tchecker2,true);
   
  if (tchecker2.get_result()) {
     std::cout << "triangle not empty !\n";
     std::cout <<  "this is an error !\n"; correct=false;
  }
  else std::cout << "triangle was empty !\n";   
  
  // rectangle check
  Rectangle_2 r1(-290.021, -175.022, -125.037, -35.0356);       
  Rectangle_2 r2(-48.3774, 136.614, -23.3799, 251.603);   

  check_empty_rectangle rchecker1(r1);
  CGAL::range_search(PS,r1.vertex(0),r1.vertex(1),r1.vertex(2),r1.vertex(3),std::back_inserter(LV),rchecker1,true);
   
  if (rchecker1.get_result()) std::cout << "rectangle not empty !\n";
  else {
    std::cout << "rectangle was empty !\n";
    std::cout <<  "this is an error !\n"; correct=false;
  }
   
  check_empty_rectangle rchecker2(r2);
  CGAL::range_search(PS,r2.vertex(0),r2.vertex(1),r2.vertex(2),r2.vertex(3),std::back_inserter(LV),rchecker2,true);
   
  if (rchecker2.get_result()) {
    std::cout << "rectangle not empty !\n";
    std::cout <<  "this is an error !\n"; correct=false;
  }
  else std::cout << "rectangle was empty !\n";
 
  if (correct) return 0;
  
  return 1;
}
Ejemplo n.º 12
0
zSHORT OPERATION
CompareCell( ZColorItem *pColorItem, zLONG lColumn,
             zCPCHAR cpcValue, zBOOL bTestBoth )
{
   if ( (pColorItem->m_lClrFlags & zALWAYS_EQUAL) &&
        lColumn == pColorItem->m_lColumn )
   {
      return( 0 );
   }

   if ( bTestBoth &&   // check long value as well as string value
        lColumn &&     // match any column
        lColumn != pColorItem->m_lColumn )
   {
      return( -1 );    // not equal
   }

   zSHORT nRC;

   if ( (pColorItem->m_lClrFlags & zNZ) == zNZ ||   // null or zero
        (pColorItem->m_lClrFlags & zNN) == zNN )    // not null/zero
   {
      zPCHAR pch = (zPCHAR) cpcValue;
      while ( pch && *pch && (*pch == '0' || *pch == '.' || isspace( *pch )) )
         pch++;

      if ( pch && *pch )
      {
         if ( (pColorItem->m_lClrFlags & zNZ) == zNZ )  // null or zero
            return( -1 );  // it is N0T null or zero
         else
      // if ( (pColorItem->m_lClrFlags & zNN) == zNN )  // not null/zero
            return( 0 );   // it is not null/zero
      }
      else
      {
         if ( (pColorItem->m_lClrFlags & zNZ) == zNZ )  // null or zero
            return( 0 ); // it is null or zero
         else
      // if ( (pColorItem->m_lClrFlags & zNN) == zNN )  // not null/zero
            return( -1 );
      }
   }
   else
   if ( pColorItem->m_lClrFlags & zNUMERIC_COMPARE )    // vs. string compare
   {
      double d1 = atof( cpcValue );
      double d2 = atof( pColorItem->m_csValue );
      d1 -= d2;
      if ( d1 < 0 )
         nRC = -1;
      else
      if ( d1 == 0 )
         nRC = 0;
      else
      if ( d1 > 0 )
         nRC = 1;
   }
   else
   if ( pColorItem->m_lClrFlags & 0x000f0000 ) // contains, starts with (NOT)
   {
      CString cs1( pColorItem->m_csValue );
      CString cs2( cpcValue );
      cs1.MakeUpper( );
      cs2.MakeUpper( );
      int nFind = cs2.Find( cs1 );
      nRC = -1;
      if ( nFind >= 0 )
      {
         if ( (pColorItem->m_lClrFlags & zIN) == zIN )  // in (contains)
            nRC = 0;
         else
         if ( nFind == 0 )
         {
            if ( (pColorItem->m_lClrFlags & zSW) == zSW ) // starts with
               nRC = 0;
         }
         else
         {
            if ( (pColorItem->m_lClrFlags & zNS) == zNS ) // does not start with
               nRC = 0;
         }
      }
      else
      if ( (pColorItem->m_lClrFlags & zNI) == zNI || // not in (does not contain)
           (pColorItem->m_lClrFlags & zNS) == zNS )  // does not start with
      {
         nRC = 0;
      }

      return( nRC );
   }
   else
   {
      if ( (pColorItem->m_lClrFlags & zIGNORE_CASE) == zIGNORE_CASE )
         nRC = zstricmp( cpcValue, pColorItem->m_csValue );
      else
         nRC = zstrcmp( cpcValue, pColorItem->m_csValue );
   }

   switch ( pColorItem->m_lClrFlags & 0x0fff0000 )
   {
      case zLT:    // less than
         if ( nRC < 0 )
            nRC = 0;
         else
            nRC = -1;

         break;

      case zLE:    // less than or equal
         if ( nRC <= 0 )
            nRC = 0;
         else
            nRC = -1;

         break;

      case zGE:    // greater than or equal
         if ( nRC >= 0 )
            nRC = 0;
         else
            nRC = -1;

         break;

      case zGT:    // greater than
         if ( nRC > 0 )
            nRC = 0;
         else
            nRC = -1;

         break;

      case zNE:    // not equal
         if ( nRC )
            nRC = 0;
         else
            nRC = -1;

         break;

      default:
      case zEQ:    // equal (default)
         break;
   }

   return( nRC );
}