void
MediaWindow::SmartNode::_FreeNode()
{
	if (!IsSet())
		return;
	// TODO: check error codes
	BMediaRoster* roster = BMediaRoster::Roster();
	roster->StopWatching(fMessenger, *fNode, B_MEDIA_WILDCARD);
	roster->ReleaseNode(*fNode);
	delete fNode;
	fNode = NULL;
}
Beispiel #2
0
//------------------------------------------------------------------------
void CWeapon::CAnimationFiringLocator::Set()
{
	CRY_ASSERT(!IsSet());
	CRY_ASSERT(m_pOwnerWeapon);

	IWeaponFiringLocator* pPreviousFiringLocator = m_pOwnerWeapon->GetFiringLocator();
	if (pPreviousFiringLocator != this)
	{
		m_pPreviousFiringLocator = pPreviousFiringLocator;
		m_pOwnerWeapon->SetFiringLocator(this);
	}
}
Beispiel #3
0
/* ==================================== */
void empilevoisins(int32_t x, int32_t rs, int32_t N, Fifo *FIFOna, Fifo *FIFOea, Fifo *FIFOsa, Fifo *FIFOoa)
/* ==================================== */
{
  int32_t y, z, k;

  /* x est un point qui vient de passer a 0 */
  for (k = 0; k < 8; k++)
  {
    y = voisin(x, k, rs, N);
    if ((y!=-1) && !IsSet(y,MINI) && !IsSet(y,EN_FIFO) && nonbord(y,rs,N))
    { 
      z = voisin(y, NORD, rs, N);
      if ((z != 0) && IsSet(z, MINI))
      { FifoPush(FIFOna, y); Set(y, EN_FIFO); goto nextk; }
      z = voisin(y, SUD, rs, N);
      if ((z != 0) && IsSet(z, MINI))
      { FifoPush(FIFOsa, y); Set(y, EN_FIFO); goto nextk; }
      z = voisin(y, EST, rs, N);
      if ((z != 0) && IsSet(z, MINI))
      { FifoPush(FIFOea, y); Set(y, EN_FIFO); goto nextk; }
      z = voisin(y, OUEST, rs, N);
      if ((z != 0) && IsSet(z, MINI))
      { FifoPush(FIFOoa, y); Set(y, EN_FIFO); goto nextk; }
    }
nextk: ;
  }
} /* empilevoisins() */
	void SButton::Paint( GC& gc, const crect& paintRect )
	{
		crect cr = ClientRect();

		unsigned colorBg = UiGetColor( uiBackground, 0, 0, 0xFFFFFF );

		gc.SetFillColor( colorBg ); //CCC
		gc.FillRect( cr );

		if ( group > 0 )
		{
			DrawCE( gc, 1, ( cr.Height() - 13 ) / 2, IsSet() );
		}
		else
		{
			DrawCB( gc, 1, ( cr.Height() - 13 ) / 2, IsSet() );
		}

		gc.Set( GetFont() );
		cpoint tsize = text.GetTextExtents(gc);

		gc.SetFillColor( colorBg );
		//gc.SetTextColor( UiGetColor( uiColor, 0, 0, 0 ) );

		//gc.TextOutF( 14 + 1 + 1 + 1 , ( cr.Height() - tsize.y ) / 2, text.data() );
		UiCondList ucl;
		int color_text = UiGetColor(uiColor, uiItem, &ucl, 0x0);
		int color_hotkey = UiGetColor(uiHotkeyColor, uiItem, &ucl, 0x0);
		text.DrawItem(gc, 14 + 1 + 1 + 1, (cr.Height() - tsize.y) / 2, color_text, color_hotkey);

		if ( InFocus() )
		{
			crect rect;
			rect.left = 14 + 2;
			rect.top = ( cr.Height() - tsize.y - 2 ) / 2;
			rect.right = rect.left + tsize.x + 4;
			rect.bottom = rect.top + tsize.y + 2;
			DrawBorder( gc, rect, UiGetColor( uiFocusFrameColor, 0, 0, 0 ) ); //CCC
		}
	}
Beispiel #5
0
    void ClientStore::_enumerateStreams(std::vector<StreamId>& out,
                                        StreamEnumFilter filter) const
    {
        std::vector<StreamId> ids;

        // Request the ids for the static streams. Since we are replicating
        // static streams on-demand, we cannot just query our local store but
        // must ask the server.
        Message response = {0};
        ClientPort& port = _getPort();

        port.call(&response, RpcApi::CCV_StreamEnumerate, filter);

        uint32_t n = response.parameter0;

        ThrowOn((response.payloadType != MessagePayloadType::MptData) ||
                ((response.data.payloadLength % sizeof(StreamId)) != 0) ||
                (response.data.payloadLength / sizeof(StreamId) != n),
                RpcMessageMalformedException);

        if (n > 0) {
            assert(response.data.payload != nullptr);
            assert(n <= SIMUTRACE_STORE_MAX_NUM_STREAMS);
            StreamId* buffer = reinterpret_cast<StreamId*>(response.data.payload);

            ids.assign(buffer, buffer + n);
        }

        // Now add the dynamic streams that this client session possesses.
        std::vector<Stream*> dynStreams;
        this->Store::_enumerateStreams(dynStreams, StreamEnumFilter::SefDynamic);
        for (auto stream : dynStreams) {
            assert(IsSet(stream->getFlags(), StreamFlags::SfDynamic));
            assert(!IsSet(stream->getFlags(), StreamFlags::SfHidden));

            ids.push_back(stream->getId());
        }

        std::swap(ids, out);
    }
Beispiel #6
0
bool RegExpMatch::MatchRange(RegExpContext &context ,const char *str)
{
    if (IsSet(M_START))
    {
        if (context.matchCount < 10)
        {
            context.matchStack[context.matchStackTop++] = context.matchCount;
            context.matchOffsets[context.matchCount][0] = str - context.beginning;
            context.matchOffsets[context.matchCount++][1] = 0;
            return true;
        }
    }
    if (IsSet(M_END))
    {
        if (context.matchStackTop)
        {
            context.matchOffsets[context.matchStack[--context.matchStackTop]][1] = str - context.beginning;
            return true;
        }
    }
    return false;
}
Beispiel #7
0
int CBitSet::GetSetCount()
{
    int nRet = 0;
    for (int i = 0; i < m_nSize; ++i)
    {
        if (IsSet(i))
        {
            nRet++;
        }
    }

    return nRet;
}
TOptional<FExpressionError> FTokenDefinitions::ConsumeTokens(FExpressionTokenConsumer& Consumer) const
{
	auto& Stream = Consumer.GetStream();
	while(!Stream.IsEmpty())
	{
		auto Error = ConsumeToken(Consumer);
		if (Error.IsSet())
		{
			return Error;
		}
	}

	return TOptional<FExpressionError>();
}
Beispiel #9
0
Int64 RarTime::GetRaw()
{
  if (!IsSet())
    return(0);
#ifdef _WIN_32
  FILETIME ft;
  GetWin32(&ft);
  return(int32to64(ft.dwHighDateTime,ft.dwLowDateTime));
#elif defined(_UNIX) || defined(_EMX)
  time_t ut=GetUnix();
  return(int32to64(0,ut)*10000000+rlt.Reminder);
#else
  return(0);
#endif
}
Beispiel #10
0
Datei: set.c Projekt: YurieCo/gap
Obj             FuncIS_EQUAL_SET (
    Obj                 self,
    Obj                 list1,
    Obj                 list2 )
{
    /* check the arguments, convert to sets if necessary                   */
    while ( ! IS_SMALL_LIST(list1) ) {
        list1 = ErrorReturnObj(
            "IsEqualSet: <list1> must be a small list (not a %s)",
            (Int)TNAM_OBJ(list1), 0L,
            "you can replace <list1> via 'return <list1>;'" );
    }
    if ( ! IsSet( list1 ) )  list1 = SetList( list1 );
    while ( ! IS_SMALL_LIST(list2) ) {
        list2 = ErrorReturnObj(
            "IsEqualSet: <list2> must be a small list (not a %s)",
            (Int)TNAM_OBJ(list2), 0L,
            "you can replace <list2> via 'return <list2>;'" );
    }
    if ( ! IsSet( list2 ) )  list2 = SetList( list2 );

    /* and now compare them                                                */
    return (EqSet( list1, list2 ) ? True : False );
}
NS_IMETHODIMP
InsertNodeTransaction::UndoTransaction()
{
  if (NS_WARN_IF(!mContentToInsert) ||
      NS_WARN_IF(!mPointToInsert.IsSet())) {
    return NS_ERROR_NOT_INITIALIZED;
  }
  // XXX If the inserted node has been moved to different container node or
  //     just removed from the DOM tree, this always fails.
  ErrorResult error;
  mPointToInsert.GetContainer()->RemoveChild(*mContentToInsert, error);
  if (NS_WARN_IF(error.Failed())) {
    return error.StealNSResult();
  }
  return NS_OK;
}
Beispiel #12
0
   /*=====================================================================*/
void
GUIContainer::MouseButton( const SDL_MouseButtonEvent& rcEvent )
{
	static std::vector<GUIMain*>::size_type stvector;
	static GUIMain* pguimain;

// We return immediatly if this is NOT visible
	if ( IsSet( OC_GUIMAIN_VISIBLE ) == false )
		return;

// Send the mouse button event to all objects
	for ( stvector = 0; stvector < this->vectorpguimain.size(); stvector++ ) {
		if ( (pguimain = vectorpguimain[ stvector ]) != NULL )
			pguimain->MouseButton( rcEvent );
	}
}
Beispiel #13
0
bool SchedulerTask::Run(time_t time)
{
    if (!IsSet() || !IsEnabled())
        return true;
        
    if (time >= timeToFire)
    {
        pCallback();
        
        if (countDown != DO_IT_FOREVER)
            countDown --;
            
        UpdateTime();
    }
    return true;
}
Beispiel #14
0
EXPORT int update_abp_tax_icb_rate(ABP_DBHANDLE dbhandle, ABP_TAX_ICB_RATE tax_icb_rate)
{
  int retval;
  Arb_connection *connection;
  CUSTOMER_ID_ACCT_MAP_DATA *cid;
  TAX_UNIV_ICB_DATA *tui;
  int count;

  if (WRONG_OBJ_TYPE(tax_icb_rate, API_TAX_ICB_RATE))
    return ABP_ARGERR;
  if (NotCustDbhandle(dbhandle))
    return ABP_ARGERR;
  connection = dbhandle->cust_connection;

  ((ABP_ERR_DATA *)connection->user_data)->is_set = FALSE;

  cid = tax_icb_rate->customer_id_acct_map_data;
  tui = tax_icb_rate->tax_univ_icb_data;

  if (!IsSet(tax_univ_icb_tui_id,tui)){
      abp_put_misc_message(connection, ABP_NO_VALUE_ERR, "tui_id");
      return ABP_MISC_ERR;
  }

  Unset(tax_univ_icb_tax_pkg_inst_id, tui);
  Unset(tax_univ_icb_tax_class, tui);
  Unset(tax_univ_icb_account_no, tui);

  if ((retval = abp_begin_transaction_inner(dbhandle, "abp_update_tax_icb_rate"))
      != ABP_STATUS_OK)
    return ABP_DBERR;

    if (update_tax_univ_icb(connection,tui)==FAILURE )
     return ABP_DBERR;

  count = arb_dbcount(connection);
  if (count != 1) {
        abp_put_misc_message(connection, count ? ABP_ROW_NOT_UNIQUE : ABP_ROW_NOT_FOUND, "TAX_UNIV_ICB");
        retval = ABP_MISC_ERR;
        goto rollback;
  }

  return abp_commit_transaction_inner(dbhandle, "abp_update_tax_icb_rate");
 rollback:
  abp_roll_back_transaction_inner(dbhandle, "abp_update_tax_icb_rate");
  return retval;
}
Beispiel #15
0
    std::unique_ptr<Stream> ClientStore::_createStream(StreamId id,
        StreamDescriptor& desc, BufferId buffer)
    {
        assert(id == INVALID_STREAM_ID);

        Message response = {0};
        ClientPort& port = _getPort();

        StreamBuffer* buf = _getStreamBuffer(buffer);
        ThrowOnNull(buf, NotFoundException,
                    stringFormat("stream buffer with id %d", buffer));

        if (IsSet(desc.flags, SfDynamic)) {
            const DynamicStreamDescriptor& dyndesc =
                reinterpret_cast<DynamicStreamDescriptor&>(desc);

            // For regular streams the server generates a valid id. For
            // dynamic streams we have to do this on our own, as dynamic
            // streams are local to the client. The ids must not collide!
            // The server generates ids for regular streams in the lower
            // positive integer range. We therefore generate the ids for
            // dynamic streams in the high positive integer range. The
            // limit for the number of streams (see Version.h) prevents a
            // collision.
            StreamId sid = --_dynamicStreamIdBoundary;

        #ifdef _DEBUG
            std::vector<StreamId> ids;
            _enumerateStreams(ids, StreamEnumFilter::SefRegular);

            StreamId max = *std::max_element(ids.cbegin(), ids.cend());
            assert(max < sid);
        #endif

            return std::unique_ptr<Stream>(
                    new DynamicStream(sid, dyndesc, *buf, getSession()));
        } else {
            port.call(&response, RpcApi::CCV_StreamRegister, &desc,
                      sizeof(StreamDescriptor), buffer);

            StreamId rid = static_cast<StreamId>(response.parameter0);

            return std::unique_ptr<Stream>(
                        new StaticStream(rid, desc, *buf, getSession()));
        }
    }
void MtlBlinnSW3D::Transmit(ShadeContext3D &sc)
{
	BlinnBlock &block = (BlinnBlock &) sc.GetMaterialBlock(this);
	const Vector4f &vertexColor = IsSet(block.VertexColor) ? *block.VertexColor : WHITE4F;

	Color4f diffuseMtl;

	if (DiffuseMtl)
	{
		DiffuseMtl->Shade(sc);
		diffuseMtl = *block.Color;
	}
	else
		diffuseMtl = WHITE4F;

	Color4f Kd = Mul(PreDiffuse, Mul(diffuseMtl, vertexColor));

	if (fabs(Kd.A) < 0.0001f)
		Kd = Color4f(1.0f, 1.0f, 1.0f, 0.0f);
	else
	{
		Kd.R /= Kd.A;
		Kd.G /= Kd.A;
		Kd.B /= Kd.A;
	}

	float32 y = Kd.Luminance();
	Color4f satColor = Lerp(Color4f(y, y, y, 1.0f), Kd, Saturation);
	satColor.A = 1.0f;

	Color4f textureDetail = Lerp(Color4f(0.0f, 0.0f, 0.0f, 1.0f), satColor, ColorDetail);
	textureDetail.A = 1.0f;

	float32 alphaDetail = Lerp(0.0f, 1.0f - Kd.A, AlphaDetail);
	Color4f outTrans = (1.0f - alphaDetail) * textureDetail + Color4f(alphaDetail);			// compute 1 - (1 - ad) * (1 - td)

	outTrans = Color4f(1.0f) - Mul(Color4f(1.0f) - outTrans, Color4f(1.0f) - Transmittance);

	sc.Transmittance.R = max(min(outTrans.R, 1.0f), 0.0f);
	sc.Transmittance.G = max(min(outTrans.G, 1.0f), 0.0f);
	sc.Transmittance.B = max(min(outTrans.B, 1.0f), 0.0f);
	sc.Transmittance.A = outTrans.A;

	FuASSERT(sc.Transmittance.A >= 0.0f && sc.Transmittance.A <= 1.002f, (""));
}
TOptional<FExpressionError> FTokenDefinitions::ConsumeToken(FExpressionTokenConsumer& Consumer) const
{
	auto& Stream = Consumer.GetStream();
	
	// Skip over whitespace
	if (bIgnoreWhitespace)
	{
		TOptional<FStringToken> Whitespace = Stream.ParseWhitespace();
		if (Whitespace.IsSet())
		{
			Stream.SetReadPos(Whitespace.GetValue());
		}
	}

	if (Stream.IsEmpty())
	{
		// Trailing whitespace in the expression.
		return TOptional<FExpressionError>();
	}

	const auto* Pos = Stream.GetRead();

	// Try each token in turn. First come first served.
	for (const auto& Def : Definitions)
	{
		// Call the token definition
		auto Error = Def(Consumer);
		if (Error.IsSet())
		{
			return Error;
		}
		// If the stream has moved on, the definition added one or more tokens, so 
		else if (Stream.GetRead() != Pos)
		{
			return TOptional<FExpressionError>();
		}
	}

	// No token definition matched the stream at its current position - fatal error
	FFormatOrderedArguments Args;
	Args.Add(FText::FromString(Consumer.GetStream().GetErrorContext()));
	Args.Add(Consumer.GetStream().GetPosition());
	return FExpressionError(FText::Format(LOCTEXT("LexicalError", "Unrecognized token '{0}' at character {1}"), Args));
}
Beispiel #18
0
/** \author Portable Random number generator by George Marsaglia
  * \author Amber 3.0 Rev A implementation by George Seibel
  *
  * This random number generator originally appeared in 'Toward a Universal
  * Random Number Generator' by George Marsaglia and Arif Zaman.  Florida
  * State University Report: FSU-SCRI-87-50 (1987)
  *
  * It was later modified by F. James and published in 'A Review of Pseudo-
  * random Number Generators'
  *
  * This is claimed to be the best known random number generator available.
  * It passes ALL of the tests for random number generators and has a
  * period of 2^144, is completely portable (gives bit identical results on
  * all machines with at least 24-bit mantissas in the floating point
  * representation).
  *
  * The algorithm is a combination of a Fibonacci sequence (with lags of 97
  * and 33, and operation "subtraction plus one, modulo one") and an
  * "arithmetic sequence" (using subtraction).
  *
  * \return A random number between 0.0 and 1.0
  * \return -1.0 if the random number generator is not initialized.
  */
double Random_Number::rn_gen() {
  if (!IsSet()) { 
    mprinterr("Error: random number generator not initialized.");
    return -1.0;
  }
  
  double uni = RN_generator.u[RN_generator.i97] - RN_generator.u[RN_generator.j97];
  if (uni < 0.0) uni += 1.0;
  RN_generator.u[RN_generator.i97] = uni;
  RN_generator.i97--;
  if (RN_generator.i97 == -1) RN_generator.i97 = 96;
  RN_generator.j97--;
  if (RN_generator.j97 == -1) RN_generator.j97 = 96;
  RN_generator.c -= RN_generator.cd;
  if (RN_generator.c < 0.0) RN_generator.c += RN_generator.cm;
  uni -= RN_generator.c;
  if (uni < 0.0) uni += 1.0; 
  return uni;
}
static int
  cease_emf_products(Arb_connection *connection, PRODUCT_VIEW_DATA *data, 
		     char *szcease_date)
{
  /* 
   * Perform the indicated disconnect.  Return status.
   */
  int retval;
  short disconnect_reason;
  Arb_date cease_date;

  if (IsSet(product_view_disconnect_reason, data))
    disconnect_reason = data->disconnect_reason;
  else
    if ((retval = find_default_disconnect_reason(connection, 
						 &disconnect_reason)) 
	!= ABP_STATUS_OK)
      return retval;
   if (szcease_date && (*szcease_date != '\0')) {
	if (api_string_to_Arbdate(szcease_date,&cease_date, 1) == FAILURE) {
		abp_put_misc_message(connection, ABP_BAD_DATE_STRING, szcease_date);
		return ABP_MISC_ERR;
	}
   }
/*   arb_setup_proc_exec(connection, &proc_api_cease_serv_inst_product, SQL_EXECUTE_NOW,
		"tracking_id", data->tracking_id, ARG_NOT_NULL,
		"tracking_id_serv", data->tracking_id_serv, ARG_NOT_NULL,
		"cease_date", &cease_date, (szcease_date && (*szcease_date != '\0')) ? ARG_NOT_NULL : ARG_IS_NULL,
		"disconnect_reason", disconnect_reason, ARG_NOT_NULL, NO_MORE_ARGS);*/

  arb_setup_proc_exec(connection,&proc_api_pp_disc_alacarte_product, SQL_EXECUTE_NOW,
         "track_id",data->tracking_id, ARG_NOT_NULL,
         "track_id_serv",data->tracking_id_serv, ARG_NOT_NULL,
         "level",1,ARG_NOT_NULL, /* 1 signifies service level product */
         "product_stop", &cease_date, (szcease_date && (*szcease_date != '\0')) ? ARG_NOT_NULL : ARG_IS_NULL,
         "disc_reason",disconnect_reason, ARG_NOT_NULL, NO_MORE_ARGS);

   if (arb_query_status(connection) == FAILURE)
     return ABP_DBERR;
   else 
     return ABP_STATUS_OK;
}
Beispiel #20
0
TString CBorderLine::save(const TString& tag) const
{
if ( !IsSet() )
    {
    return TString();
    }
std::stringstream border;
border << '<' << tag << " style=\"" << g_styles[ m_style ] << '\"';
if ( m_color.IsSet() )
    {
    border << '>' << '\n';
    border << "<color" << m_color.save() << '/' << '>' << '\n';
    border << '<' << '/' << tag << '>' << '\n';
    }
else
    {
    border << '/' << '>' << '\n';
    }
return border.str();
}
Beispiel #21
0
void RarTime::GetText(wchar *DateStr,size_t MaxSize,bool FullYear,bool FullMS)
{
  if (IsSet())
  {
    RarLocalTime lt;
    GetLocal(&lt);
    if (FullMS)
      swprintf(DateStr,MaxSize,L"%u-%02u-%02u %02u:%02u,%03u",lt.Year,lt.Month,lt.Day,lt.Hour,lt.Minute,lt.Reminder/10000);
    else
      if (FullYear)
        swprintf(DateStr,MaxSize,L"%02u-%02u-%u %02u:%02u",lt.Day,lt.Month,lt.Year,lt.Hour,lt.Minute);
      else
        swprintf(DateStr,MaxSize,L"%02u-%02u-%02u %02u:%02u",lt.Day,lt.Month,lt.Year%100,lt.Hour,lt.Minute);
  }
  else
  {
    // We use escape before '?' to avoid weird C trigraph characters.
    wcscpy(DateStr,FullYear ? L"\?\?-\?\?-\?\?\?\? \?\?:\?\?":L"\?\?-\?\?-\?\? \?\?:\?\?");
  }
}
Beispiel #22
0
void Parser::FlushDerived()
{
    if(IsSet(FLAG_UNOPENED))
    {
        int size = mIdentifiers.size();
        if(size > 0)
        {
            int ssize = mScopes.size();
            if(ssize > 0)
            {
                Scope *pScope = mScopes[ssize-1];
                if(pScope->isClass)
                {
                    Identifier *pIdentifier = mIdentifiers[size-1];
                    mpGenerator->DerivesFrom(GetFullScopeName(), pIdentifier->mpName);
                    mIdentifiers.clear();
                }
            }
        }
    }
}
Beispiel #23
0
void CServerApp::SetServState( int nStateFlags )
{
    Lock();
    if( m_nStateFlags!=nStateFlags ) {
        m_nStateFlags = nStateFlags;
        if( IsClr(m_nStateFlags, SYSTEM_SUSPEND_SERVICE) ) {
            //change the running process priority.
            SetPriority( nStateFlags );
        }
    }
    //always check suspend service
    if( IsSet(m_nStateFlags, SYSTEM_SUSPEND_SERVICE) ) {
        //service must stop, kill the running processes
        list<HANDLE>::iterator iter = m_lstProcHandles.begin();
        while( iter!=m_lstProcHandles.end() ) {
            HANDLE hProc = *iter++;
            KillProcess( hProc );
        }
    }
    Unlock();
}
Beispiel #24
0
//
// Intercept WM_PAINT to redirect from TWindow to the underlying control iff
// this Owl object is just a wrapper for a predefined class.
//
void
TFlatComboBox::EvPaint()
{
  TComboBox::EvPaint();

  if (IsFlat()){
    TWindowDC dc(GetHandle());
    TRect rect = GetClientRect();
    TFlatPainter::Paint(dc, rect);

    if(!IsSet(fpMouseIn) || !IsWindowEnabled()){
      // We draw the "untracked" situation
      rect.left = rect.right - TUIMetric::CxHThumb;// + 1;
#ifdef TEST
       dc.FrameRect(rect, TBrush(TColor::LtGreen));
#else
       dc.FrameRect(rect, TBrush(TColor::SysWindow));
#endif
    }
  }
}
Beispiel #25
0
   /*=====================================================================*/
const uint
GUIContainer::GetClick() const
{
	static std::vector<GUIMain*>::size_type stvector;
	static GUIMain* pguimain;

// We return immediatly if this is NOT visible
	if ( IsSet( OC_GUIMAIN_VISIBLE ) == false )
		return 0;

// FOR each object DO
// IF we find a object which is clicked and has mouseover THEN
	for ( stvector = 0; stvector < this->vectorpguimain.size(); stvector++ ) {
		if ( (pguimain = vectorpguimain[ stvector ]) != NULL )
		if ( pguimain->IsSet( OC_GUIMAIN_CLICKED | OC_GUIMAIN_MOUSEOVER ) == true )
			return ++stvector;
	}

// There's no clicked object
	return 0;
}
Beispiel #26
0
CSeq_entry_Handle CSeq_entry_Handle::GetSingleSubEntry(void) const
{
    if ( !IsSet() ) {
        NCBI_THROW(CObjMgrException, eModifyDataError,
                   "CSeq_entry_Handle::GetSingleSubEntry: "
                   "Seq-entry is not Bioseq-set");
    }
    CSeq_entry_CI iter(*this);
    if ( !iter ) {
        NCBI_THROW(CObjMgrException, eModifyDataError,
                   "CSeq_entry_Handle::GetSingleSubEntry: "
                   "Seq-entry is empty");
    }
    CSeq_entry_Handle entry = *iter;
    if ( ++iter ) {
        NCBI_THROW(CObjMgrException, eModifyDataError,
                   "CSeq_entry_Handle::GetSingleSubEntry: "
                   "Seq-entry contains more than one sub entry");
    }
    return entry;
}
Beispiel #27
0
int parse_command(CONNECTION *connection, char *cmd_buf) {
	char cmd[32] = {'\0'};
	char *p = cmd;
	int i;

	// skip any preceding whitespace
	while(isspace(*cmd_buf) && *cmd_buf != '\0') {
		cmd_buf++;
	}
	// copy until whitespace or EOF
	while(!isspace(*cmd_buf) && *cmd_buf != '\0') {
		*p++ = *cmd_buf++;
	}
	*p = '\0';

	// check if command exists
	for(i = 0; commands[i].name; i++) {
		if(!strcmp(commands[i].name, cmd)) {
			break;
		}
	}

	if(commands[i].name == 0) {
		connection_write(connection, "Unknown command");
		return false;
	}

	if(!IsSet(commands[i].connection_states, connection->state)) {
		connection_write(connection, "Invalid connection state for command.");
		return false;
	}

	// check rank here
//	if(commands[i].rank ...)

	// call function
	(*commands[i].function) (connection);
	return true;
}
Beispiel #28
0
void ErrorInfo::
SetVa(uint16_t subsys, uint16_t code, const char *fmt, va_list ap)
{
	Container *contp;

	if (IsSet())
		abort();

	contp = new Container(subsys, code);
	if (!contp) {
		SetNoMem();
		return;
	}

	if (!contp->m_desc.AppendFmtVa(fmt, ap)) {
		delete contp;
		SetNoMem();
		return;
	}

	m_error = contp;
}
Beispiel #29
0
void generatePrimes(char * buffer, int bufferSize, int maxNumber)
{
    setAllBitsOn(buffer, bufferSize);
    int lastprime = 2;
    while (lastprime < maxNumber)
    {
        for (int i = lastprime * 2; i <= maxNumber; i += lastprime)
        {
            OffBit(i - 1, buffer);
        }

        while (lastprime <= maxNumber)
        {
            lastprime++;
            if (IsSet(lastprime - 1, buffer))
            {
                break;
            }
        }

    }
}
Beispiel #30
0
void
TFlatPainter::Paint(TDC& dc, TRect& rect)
{
  TWindow* wnd = TYPESAFE_DOWNCAST(this, TWindow);
  if(!wnd)
    return;

  if(IsSet(fpMouseIn) && wnd->IsWindowEnabled()){
    // We draw the "tracked" situation
#ifdef TEST
    TBrush brush (TColor::LtRed);
#else
    TBrush brush (TColor::Sys3dFace);
#endif
    dc.FrameRect(rect, brush);
    rect.Inflate(-1, -1);
    dc.FrameRect(rect, brush);
    rect.Inflate(-1, -1);
    dc.FrameRect(rect, brush);
    rect.Inflate(1, 1);
    TUIBorder::DrawEdge(dc, rect, TUIBorder::SunkenOuter, TUIBorder::Rect);
  }
  else{
    // We draw the "untracked" situation
#ifdef TEST
    TBrush brush(TColor::LtBlue);
    TBrush brush2(TColor::LtGreen);
#else
    TBrush brush(TColor::Sys3dFace);
    TBrush brush2(TColor::SysWindow);
#endif

    dc.FrameRect(rect,brush);
    rect.Inflate(-1, -1);
    dc.FrameRect(rect,brush);
    rect.Inflate(-1, -1);
    dc.FrameRect(rect, brush2);
  }
}