Example #1
0
UInteger16 msgPackManagement(void *buf, MsgManagement *manage, PtpClock *ptpClock)
{
  *(UInteger8*)((char*)buf + 20) = 2;  /* messageType */
  *(Integer32*)((char*)buf + 28) = shift16(flip16(ptpClock->port_id_field), 0) | shift16(flip16(ptpClock->last_general_event_sequence_number), 1);
  *(UInteger8*)((char*)buf + 32) = PTP_MANAGEMENT_MESSAGE;  /* control */
  clearFlag(((char*)buf + 34), PTP_SYNC_BURST);
  clearFlag(((char*)buf + 34), PARENT_STATS);
  *(Integer32*)((char*)buf + 40) = shift8(manage->targetCommunicationTechnology, 1);
  memcpy((char*)buf + 42, manage->targetUuid, 6);
  *(Integer32*)((char*)buf + 48) = shift16(flip16(manage->targetPortId), 0) | shift16(flip16(MM_STARTING_BOUNDARY_HOPS), 1);
  *(Integer32*)((char*)buf + 52) = shift16(flip16(MM_STARTING_BOUNDARY_HOPS), 0);
  
  *(UInteger8*)((char*)buf + 55) = manage->managementMessageKey;
  
  switch(manage->managementMessageKey)
  {
  case PTP_MM_GET_FOREIGN_DATA_SET:
    *(UInteger16*)((char*)buf + 62) = manage->recordKey;
    *(Integer32*)((char*)buf + 56) = shift16(flip16(4), 1);
    return 64;
    
  default:
    *(Integer32*)((char*)buf + 56) = shift16(flip16(0), 1);
    return 60;
  }
}
Example #2
0
int Monster::cleanMobForSaving() {

    // No saving pets!
    if(isPet())
        return(-1);

    // Clear the inventory
    clearMobInventory();

    // Clear any flags that shouldn't be set
    clearFlag(M_WILL_BE_LOGGED);

//  // If the creature is possessed, clean that up
    if(flagIsSet(M_DM_FOLLOW)) {
        clearFlag(M_DM_FOLLOW);
        Player* master;
        if(getMaster() != nullptr && (master = getMaster()->getAsPlayer()) != nullptr) {
            master->clearFlag(P_ALIASING);
            master->getAsPlayer()->setAlias(0);
            master->print("%1M's soul was saved.\n", this);
            removeFromGroup(false);
        }
    }

    // Success
    return(1);
}
Example #3
0
//////////////////////////////////////////////////////////////////////////
// onDetach
//virtual
void ScnComponent::onDetach( ScnEntityWeakRef Parent )
{
	BcAssertMsg( ParentEntity_ == Parent, "Attempting to detach component from an entity it isn't attached to!" );
	BcAssertMsg( isFlagSet( scnCF_ATTACHED ), "ScnComponent: Not attached!" );
	BcAssertMsg( isFlagSet( scnCF_PENDING_DETACH ), "ScnComponent: Not pending detach!" );

	clearFlag( scnCF_PENDING_DETACH );
	clearFlag( scnCF_ATTACHED );
	setFlag( scnCF_PENDING_DESTROY );
	ParentEntity_ = nullptr;
}
Example #4
0
void msgPackFollowUp(void *buf, UInteger16 associatedSequenceId,
  TimeRepresentation *preciseOriginTimestamp, PtpClock *ptpClock)
{
  *(UInteger8*)((char*)buf + 20) = 2;  /* messageType */
  *(Integer32*)((char*)buf + 28) = shift16(flip16(ptpClock->port_id_field), 0) | shift16(flip16(ptpClock->last_general_event_sequence_number), 1);
  *(UInteger8*)((char*)buf + 32) = PTP_FOLLOWUP_MESSAGE;  /* control */
  clearFlag(((char*)buf + 34), PTP_SYNC_BURST);
  clearFlag(((char*)buf + 34), PARENT_STATS);
  
  *(Integer32*)((char*)buf + 40) = shift16(flip16(associatedSequenceId), 1);
  *(Integer32*)((char*)buf + 44) = flip32(preciseOriginTimestamp->seconds);
  *(Integer32*)((char*)buf + 48) = flip32(preciseOriginTimestamp->nanoseconds);
}
Example #5
0
void msgPackDelayResp(void *buf, MsgHeader *header,
  TimeRepresentation *delayReceiptTimestamp, PtpClock *ptpClock)
{
  *(UInteger8*)((char*)buf + 20) = 2;  /* messageType */
  *(Integer32*)((char*)buf + 28) = shift16(flip16(ptpClock->port_id_field), 0) | shift16(flip16(ptpClock->last_general_event_sequence_number), 1);
  *(UInteger8*)((char*)buf + 32) = PTP_DELAY_RESP_MESSAGE;  /* control */
  clearFlag(((char*)buf + 34), PTP_SYNC_BURST);
  clearFlag(((char*)buf + 34), PARENT_STATS);
  
  *(Integer32*)((char*)buf + 40) = flip32(delayReceiptTimestamp->seconds);
  *(Integer32*)((char*)buf + 44) = flip32(delayReceiptTimestamp->nanoseconds);
  *(Integer32*)((char*)buf + 48) = shift8(header->sourceCommunicationTechnology, 1);
  memcpy((char*)buf + 50, header->sourceUuid, 6);
  *(Integer32*)((char*)buf + 56) = shift16(flip16(header->sourcePortId), 0) | shift16(flip16(header->sequenceId), 1);
}
Example #6
0
bool QWindowsWindow::handleWmPaint(HWND hwnd, UINT message,
                                         WPARAM, LPARAM)
{
    // Ignore invalid update bounding rectangles
    if (!GetUpdateRect(m_data.hwnd, 0, FALSE))
        return false;
    if (message == WM_ERASEBKGND) // Backing store - ignored.
        return true;
    PAINTSTRUCT ps;
    if (testFlag(OpenGLSurface)) {
        // Observed painting problems with Aero style disabled (QTBUG-7865).
        if (testFlag(OpenGLDoubleBuffered))
            InvalidateRect(hwnd, 0, false);
        BeginPaint(hwnd, &ps);
        QWindowSystemInterface::handleSynchronousExposeEvent(window(),
                                                             QRegion(qrectFromRECT(ps.rcPaint)));
        EndPaint(hwnd, &ps);
    } else {
        releaseDC();
        m_hdc = BeginPaint(hwnd, &ps);
        setFlag(WithinWmPaint);

        const QRect updateRect = qrectFromRECT(ps.rcPaint);
        if (QWindowsContext::verboseIntegration)
            qDebug() << __FUNCTION__ << this << window() << updateRect;

        QWindowSystemInterface::handleSynchronousExposeEvent(window(), QRegion(updateRect));
        clearFlag(WithinWmPaint);
        m_hdc = 0;
        EndPaint(hwnd, &ps);
    }
    return true;
}
Example #7
0
bool Object::toggleFlag(int flag) {
    if(flagIsSet(flag))
        clearFlag(flag);
    else
        setFlag(flag);
    return(flagIsSet(flag));
}
// *************************************************************************************************
// @fn          simpliciti_main_tx_only
// @brief       Get data through callback. Transfer data when external trigger is set.
// @param       none
// @return      none
// *************************************************************************************************
void simpliciti_main_tx_only(void)
{
    while (1)
    {
        // Get end device data from callback function
        simpliciti_get_ed_data_callback();

        // Send data when flag bit SIMPLICITI_TRIGGER_SEND_DATA is set
        if (getFlag(simpliciti_flag, SIMPLICITI_TRIGGER_SEND_DATA))
        {
            // Get radio ready. Wakes up in IDLE state.
            SMPL_Ioctl(IOCTL_OBJ_RADIO, IOCTL_ACT_RADIO_AWAKE, 0);

            // Acceleration / button events packets are 4 bytes long
            SMPL_SendOpt(sLinkID1, simpliciti_data, 4, SMPL_TXOPTION_NONE);

            // Put radio back to SLEEP state
            SMPL_Ioctl(IOCTL_OBJ_RADIO, IOCTL_ACT_RADIO_SLEEP, 0);

            clearFlag(simpliciti_flag, SIMPLICITI_TRIGGER_SEND_DATA);
        }

        // Exit when flag bit SIMPLICITI_TRIGGER_STOP is set
        if (getFlag(simpliciti_flag, SIMPLICITI_TRIGGER_STOP))
        {
            // Clean up SimpliciTI stack to enable restarting
            sInit_done = 0;
            break;
        }
    }
}
Example #9
0
extLong ExprRep::degreeBound() {
  if (d_e() == EXTLONG_ONE) // no radical nodes below
    return EXTLONG_ONE;
  count();
  clearFlag();
  return d_e();
}
Example #10
0
SWORD Socket::recvToBuf()
{
	SWORD retcode = 0;
	if(isSetFlag(s_incompleteRead))
	{
		clearFlag(s_incompleteRead);
		goto do_select;
	}
	m_recvQueue.wrReserve(s_maxDataBufferSize);
	retcode = TEMP_FAILURE_RETRY(::recv(m_sock,m_recvQueue.wrBuffer(),m_recvQueue.wrSize(),MSG_NOSIGNAL));
	
	/// 如果出错,且阻塞或者再次尝试
	if(retcode == -1 && (errno == EAGAIN || errno == EWOULDBLOCK))
	{
		do_select:
			retcode = waitForRead();
			CheckConditonReturn(retcode==1,retcode);
			retcode = TEMP_FAILURE_RETRY(::recv(m_sock,m_recvQueue.wrBuffer(),m_recvQueue.wrSize(),MSG_NOSIGNAL));
	}
	if(retcode > 0)
	{
		successRecv(retcode);
	}
	return retcode;
}
void RenderWidget::hideEvent( QHideEvent* /*event*/ )
{
    if (checkFlag(Window::eFlags_IsVisible))
    {
        clearFlag(Window::eFlags_IsVisible);
        Hidden();
    }
}
Example #12
0
//////////////////////////////////////////////////////////////////////////
// onAttach
//virtual
void ScnComponent::onAttach( ScnEntityWeakRef Parent )
{
	BcAssertMsg( !isFlagSet( scnCF_ATTACHED ), "Attempting to attach component when it's already attached!" );
	BcAssertMsg( isFlagSet( scnCF_PENDING_ATTACH ), "ScnComponent: Not pending attach!" );

	clearFlag( scnCF_PENDING_ATTACH );
	setFlag( scnCF_ATTACHED );

	ParentEntity_ = Parent;
}
Example #13
0
void
deleteAssoc(Any obj)
{ if ( isObject(obj) && onFlag(obj, F_ASSOC) )
  { PceITFSymbol symbol = getMemberHashTable(ObjectToITFTable, obj);
    if ( symbol )
    { symbol->object = NULL;
      deleteHashTable(ObjectToITFTable, obj);
      clearFlag(obj, F_ASSOC);
    }
  }
}
void RequestInjectionData::resetCPUTimer(int seconds /* = 0 */) {
  if (seconds == 0) {
    seconds = getCPUTimeout();
  } else if (seconds < 0) {
    if (!getCPUTimeout()) return;
    seconds = -seconds;
    if (seconds < getRemainingCPUTime()) return;
  }
  setCPUTimeout(seconds);
  clearFlag(CPUTimedOutFlag);
}
Example #15
0
///@description	Perform a complete conversion. Should only be used when waiting isn't a problem.
uint16_t ANALOG::read(){
		
	//start conversion
	start();
	
	//wait for conversion to finish (interrupt flag is set)
	while( isReading() && !isInterruptFlagSet());
	
	clearFlag();
	return (ADC);
}
Example #16
0
QMargins QWindowsWindow::frameMargins() const
{
    // Frames are invalidated by style changes (window state, flags).
    // As they are also required for geometry calculations in resize
    // event sequences, introduce a dirty flag mechanism to be able
    // to cache results.
    if (testFlag(FrameDirty)) {
        m_data.frame = QWindowsGeometryHint::frame(style(), exStyle());
        clearFlag(FrameDirty);
    }
    return m_data.frame;
}
Example #17
0
void 
msgPackSync(void *buf, Boolean burst,
    TimeRepresentation * originTimestamp, PtpClock * ptpClock)
{
	*(UInteger8 *) (buf + 20) = 1;	/* messageType */
	*(Integer32 *) (buf + 28) = shift16(flip16(ptpClock->port_id_field), 0) | shift16(flip16(ptpClock->last_sync_event_sequence_number), 1);
	*(UInteger8 *) (buf + 32) = PTP_SYNC_MESSAGE;	/* control */
	if (ptpClock->burst_enabled && burst)
		setFlag((buf + 34), PTP_SYNC_BURST);
	else
		clearFlag((buf + 34), PTP_SYNC_BURST);
	if (ptpClock->parent_stats)
		setFlag((buf + 34), PARENT_STATS);
	else
		clearFlag((buf + 34), PARENT_STATS);


	*(Integer32 *) (buf + 40) = flip32(originTimestamp->seconds);
	*(Integer32 *) (buf + 44) = flip32(originTimestamp->nanoseconds);
	*(Integer32 *) (buf + 48) = shift16(flip16(ptpClock->epoch_number), 0) | shift16(flip16(ptpClock->current_utc_offset), 1);
	*(Integer32 *) (buf + 52) = shift8(ptpClock->grandmaster_communication_technology, 1);
	memcpy((buf + 54), ptpClock->grandmaster_uuid_field, 6);
	*(Integer32 *) (buf + 60) = shift16(flip16(ptpClock->grandmaster_port_id_field), 0) | shift16(flip16(ptpClock->grandmaster_sequence_number), 1);
	*(Integer32 *) (buf + 64) = shift8(ptpClock->grandmaster_stratum, 3);
	memcpy((buf + 68), ptpClock->grandmaster_identifier, 4);
	*(Integer32 *) (buf + 72) = shift16(flip16(ptpClock->grandmaster_variance), 1);
	*(Integer32 *) (buf + 76) = shift16(flip16(ptpClock->grandmaster_preferred), 0) | shift16(flip16(ptpClock->grandmaster_is_boundary_clock), 1);
	*(Integer32 *) (buf + 80) = shift16(flip16(ptpClock->sync_interval), 1);
	*(Integer32 *) (buf + 84) = shift16(flip16(ptpClock->clock_variance), 1);
	*(Integer32 *) (buf + 88) = shift16(flip16(ptpClock->steps_removed), 1);
	*(Integer32 *) (buf + 92) = shift8(ptpClock->clock_stratum, 3);
	memcpy((buf + 96), ptpClock->clock_identifier, 4);
	*(Integer32 *) (buf + 100) = shift8(ptpClock->parent_communication_technology, 1);
	memcpy((buf + 102), ptpClock->parent_uuid, 6);
	*(Integer32 *) (buf + 108) = shift16(flip16(ptpClock->parent_port_id), 1);
	*(Integer32 *) (buf + 112) = shift16(flip16(ptpClock->observed_variance), 1);
	*(Integer32 *) (buf + 116) = flip32(ptpClock->observed_drift);
	*(Integer32 *) (buf + 120) = shift8(ptpClock->utc_reasonable, 3);
}
Example #18
0
bool TextBuffer::saveFile()
{
  if (testFlag(EditFlags::NeedsSave))
    if (file.existsAsFile())
      {
	file.replaceWithText(getText());
	clearFlag(EditFlags::NeedsSave);
        Preferences::getInstance()->recentlyOpened.addFile(file);
	return true;
      }
    else
      return saveFileAs(file);
  return false;
}
Example #19
0
void Player::defineColors() {
    if(mySock->getColorOpt() == ANSI_COLOR) {
        setFlag(P_ANSI_COLOR);
        clearFlag(P_MXP_ENABLED);
        clearFlag(P_MIRC);
        clearFlag(P_NEWLINE_AFTER_PROMPT);
    } else if(mySock->getColorOpt() == NO_COLOR) {
        clearFlag(P_ANSI_COLOR);
        clearFlag(P_MXP_ENABLED);
        clearFlag(P_MIRC);
        clearFlag(P_NEWLINE_AFTER_PROMPT);
    }
}
Example #20
0
void Monster::checkSpellWearoff() {
    long t = time(0);

    /*
    if(flagIsSet(M_WILL_MOVE_FOR_CASH)) {
        if(t > LT(this, LT_MOB_PASV_GUARD)) {
            // Been 30 secs, time to stand guard again
            setFlag(M_PASSIVE_EXIT_GUARD);
        }
    }
     */

    if(t > LT(this, LT_CHARMED) && flagIsSet(M_CHARMED)) {
        printColor("^y%M's demeanor returns to normal.\n", this);
        clearFlag(M_CHARMED);
    }
}
Example #21
0
void AbstractOptionStorage::finishSet()
{
    GMX_RELEASE_ASSERT(bInSet_, "startSet() not called");
    bInSet_ = false;
    // We mark the option as set even when there are errors to avoid additional
    // errors from required options not set.
    // TODO: There could be a separate flag for this purpose.
    setFlag(efOption_Set);
    if (!bSetValuesHadErrors_)
    {
        // TODO: Correct handling of the efOption_ClearOnNextSet requires
        // processSet() and/or convertValue() to check it internally.
        // OptionStorageTemplate takes care of it, but it's error-prone if
        // a custom option is implemented that doesn't use it.
        processSet();
    }
    bSetValuesHadErrors_ = false;
    clearFlag(efOption_ClearOnNextSet);
    clearSet();
}
Example #22
0
bool TextBuffer::saveFileAs(File defaultfile)
{
  if (defaultfile==File::nonexistent)
    if (file.existsAsFile())
      defaultfile=file.getParentDirectory();
    else
      defaultfile=File::getCurrentWorkingDirectory();
  FileChooser choose (T("Save File As"), defaultfile, T("*.*"), true);
  if (choose.browseForFileToSave(true))
    {
      File sav=choose.getResult();
      sav.replaceWithText(getText());
      file=sav;
      clearFlag(EditFlags::NeedsSave);
      updateWindowTitle();
      Preferences::getInstance()->recentlyOpened.addFile(sav);
      return true;
    }
  else
    return false;
}
Example #23
0
void QWindowsWindow::setParent_sys(const QPlatformWindow *parent) const
{
    HWND parentHWND = 0;
    if (parent) {
        const QWindowsWindow *parentW = static_cast<const QWindowsWindow *>(parent);
        parentHWND = parentW->handle();

    }

    const bool wasTopLevel = window()->isTopLevel();
    const bool isTopLevel = parentHWND == 0;

    setFlag(WithinSetParent);
    SetParent(m_data.hwnd, parentHWND);
    clearFlag(WithinSetParent);

    // WS_CHILD/WS_POPUP must be manually set/cleared in addition
    // to dialog frames, etc (see  SetParent() ) if the top level state changes.
    if (wasTopLevel != isTopLevel) {
        const unsigned flags = isTopLevel ? unsigned(0) : unsigned(WindowCreationData::ForceChild);
        setWindowFlags_sys(window()->windowFlags(), flags);
    }
}
Example #24
0
SWORD Socket::sendRawData(const void *pBuffer,const DWORD size)
{
	SWORD retcode = -1;
	if(isSetFlag(s_incompleteWrite))
	{
		clearFlag(s_incompleteWrite);
		goto do_select;
	}
	retcode = TEMP_FAILURE_RETRY(::send(m_sock,pBuffer,size,MSG_NOSIGNAL));
	//套接字出错且阻塞或者再试
	if(retcode == -1 && (errno == EAGAIN || errno == EWOULDBLOCK))
	{
		do_select:
			retcode = waitForWrite();
			CheckConditonReturn(retcode==1,retcode);
			retcode = TEMP_FAILURE_RETRY(::send(m_sock,pBuffer,size,MSG_NOSIGNAL));
	}
	//没有发送完毕
	if(retcode > 0 && retcode < size)
	{
		setFlag(s_incompleteWrite);
	}
	return retcode;
}
Example #25
0
bool TextBuffer::revertFile()
{
  bool doit=false;
  if (testFlag(EditFlags::NeedsSave) && file.existsAsFile()) 
    doit=Alerts::showOkCancelBox(AlertWindow::QuestionIcon,
				      T("Revert File"),
				      T("Revert to last saved version?"),
#ifdef WINDOWS
				      T("Revert"),
				      T("Cancel"));
#else
				      T("Revert"),
				      T("Don't Revert"));
#endif
  if (doit)
    {
      setText(file.loadFileAsString());
      clearFlag(EditFlags::NeedsSave);
      colorizeAll();
      return true;
    }
  else
    return false;
}
Example #26
0
/**
 * Record a trace, this is a blocking function.
 * Use the ext interupt 0 and 1.
 * Use the timer 1.
 */
uchar* recordTrace(int *size) {
    uchar charIndex = 0;
    uchar charBuffer;

    uint state = STATE_BEGINING;

    uchar i = 0;
    uchar t0 = (uchar) 0x00;
    uint tmpEtu = NO_ETU_CHANGE;
    uchar protocol;
    uchar convention;

    convention = CONVENTION_DIRECTE;
    protocol = PROTOCOL_T0;

    initialiseInterupt();

    if(!waitForIO())
    {
        reInit();
        return NULL;
    }

    /* Configure the interupt on IO to answer on each falling edge*/
    ConfigINT2(EXT_INT_ENABLE | FALLING_EDGE_INT | EXT_INT_PRI_1);

    /* Configure the warm reset to trigger on falling edge*/
    ConfigINT1(EXT_INT_ENABLE | FALLING_EDGE_INT | EXT_INT_PRI_1);

    while( (STATE_TERMINATED != state))
    {
        state = getState();
        if( (isData() > 0) && dataIndex < DATA_SIZE)
        {
            charBuffer = 0x00;
            for(charIndex = 0 ; charIndex < 8 ; charIndex++ )
            {
                if(CONVENTION_INVERSE == convention)
                {
                    charBuffer ^= (getAcq() << (7-charIndex));
                }
                else if(CONVENTION_DIRECTE == convention)
                {
                    charBuffer ^= (getAcq() << charIndex);
                }
            }
            if(CONVENTION_INVERSE == convention)
            {
                charBuffer = 0xff ^ charBuffer;
            }
            dataArray[dataIndex] = charBuffer;

            dataIndex++;
            clearFlag();

            if(STATE_TS == state)
            {
                if((uchar) 0x3b == charBuffer)
                {
                    convention = CONVENTION_DIRECTE;
                }

                /* 0x03 is the way the byte 3f will be read with the tool
                 * For information, by default the Direct convention is used
                 * so we don't see directly the byte 3F but the byte 3f coded
                 * in direct convention = 0x03 */
                if((uchar) 0x03 == charBuffer)
                {
                    convention = CONVENTION_INVERSE;
                    dataArray[dataIndex-1] = 0x3f;
                }

                setState(STATE_T0);
            }
            else if(STATE_T0 == state)
            {
                t0 = charBuffer;
                setState(STATE_ATR);
            } /*Then we treats TAx, TBx, TCx, TDx,... and finaly hist bytes */
            else if(0 < (t0 & 0x10) )
            {
                t0 = t0 ^ 0x10;
                /* It's a TAx */
                if(0 == i) /* It's Ta1*/
                {
                    /*Configuring the new ATR value*/
                    tmpEtu = computeEtu(charBuffer);
                }
            }
            else if(0 < (t0 & 0x20) )
            {
                /*It's a TBx*/
                t0 = t0 ^ 0x20;
            }
            else if(0 < (t0 & 0x40) )
            {
                /*It's a TCx*/
                t0 = t0 ^ 0x40;
            }
            else if(0 < (t0 & 0x80) )
            {
                /*It's a TDx*/
                t0 = t0 ^ 0x80;
                /* t0 is only compose of the historical bytes We verify if
                 the TD bytes implies other bytes*/
                t0 ^= (charBuffer & 0xf0);
                i++;

                /* We also verify if it's a T=1 protocol */
                if( ((uchar) 0x01) == ((uchar) charBuffer ^ 0x01) )
                {
                    /*It's a t=1 card set the value to T=1*/
                    protocol = PROTOCOL_T1;
                }

            }
            else if(0 < (t0 & 0x0F))
            {
                /* This is historical bytes */
                t0--;
                if(t0 == 0)
                {
                    if(PROTOCOL_T1 == protocol)
                    {
                        setState(STATE_ATR_CRC);
                    }
                    else
                    {
                        setState(STATE_PROCESSING);
                        fixEtu(tmpEtu);
                    }
                }
            }
            else if(STATE_ATR_CRC == state) {
                setState(STATE_PROCESSING);
                fixEtu(tmpEtu);
            }
        }/*end of if(isData() > 0 )*/
        else if(STATE_RESET == getState()) {
            charIndex = 0;
            convention = CONVENTION_DIRECTE;
            warmAtrOffset = dataIndex;
            t0 = 0x00;
            setState(STATE_BEGINING);
        }
        if( !isData() && !PIN_VCC )
        {
            setState(STATE_TERMINATED);
        }
        if(dataIndex >= DATA_SIZE )
        {
#ifdef DEBUG
            sendDataBuffer("Array overflow\n");
#endif
            setState(STATE_TERMINATED);
        }
    }//End of while

    /* Stop the interupt on IO */
    ConfigINT0(EXT_INT_DISABLE);

    /* Stop the warm reset */
    ConfigINT1(EXT_INT_DISABLE);

#ifdef DEBUG
    sendDataBuffer("Trace recorded : \n");
#endif

    /* End of debug information */
    *size = dataIndex;
    reInit();
    return dataArray;
}
Example #27
0
inline static UINT8 setFlagTo(UINT8 ccr, UINT8 flag, bool set) {
	return set ? setFlag(ccr, flag) : clearFlag(ccr, flag);
}
Example #28
0
bool BlueForceGlobals::removeFlag(int flagNum) {
	bool result = getFlag(flagNum);
	clearFlag(flagNum);
	return result;
}
Example #29
0
inline static uint8_t setFlagTo(uint8_t ccr, uint8_t flag, bool set) {
	return set ? setFlag(ccr, flag) : clearFlag(ccr, flag);
}
Example #30
0
// ***************************************************************************
void	CAnimatedMaterial::update()
{
    if(isTouched(OwnerBit) && _Material!=NULL /*&& _Material->isLighted()*/)
    {

        // well, just update all...  :)

        // diffuse part.
        CRGBA	diff= _Diffuse.Value;
        sint c= (sint)(_Opacity.Value*255);
        clamp(c, 0, 255);
        diff.A= c;

        // setup material.
        if (_Material->isLighted())
        {
            _Material->setLighting(true, _Emissive.Value, _Ambient.Value, diff, _Specular.Value, _Shininess.Value);
        }
        else
        {
            _Material->setColor(diff);
        }

        // clear flags.
        clearFlag(AmbientValue);
        clearFlag(DiffuseValue);
        clearFlag(SpecularValue);
        clearFlag(ShininessValue);
        clearFlag(EmissiveValue);
        clearFlag(OpacityValue);


        // Texture Anim.
        if(isTouched(TextureValue))
        {
            nlassert(_MaterialBase);

            uint32	id= _Texture.Value;
            if(_MaterialBase->validAnimatedTexture(id))
            {
                _Material->setTexture(0, _MaterialBase->getAnimatedTexture(id) );
            }
            clearFlag(TextureValue);
        }

        // Get texture matrix from animated value to setup the material
        for (uint k = 0; k < IDRV_MAT_MAXTEXTURES; ++k)
        {
            if (_Material->isUserTexMatEnabled(k))
            {
                const CTexAnimatedMatValues &texMatAV = _TexAnimatedMatValues[k];

                CMatrix convMat; // exported v are already inverted (todo : optim this if needed, this matrix shouldn't be necessary)
                convMat.setRot(CVector::I, -CVector::J, CVector::K);
                convMat.setPos(CVector::J);
                float fCos = cosf(texMatAV._WRot.Value);
                float fSin = sinf(texMatAV._WRot.Value);
                CMatrix SR;
                SR.setRot(CVector(texMatAV._UScale.Value * fCos, texMatAV._VScale.Value * fSin, 0.f),
                          CVector(- texMatAV._UScale.Value * fSin, texMatAV._VScale.Value * fCos, 0.f),
                          CVector::K);
                CVector half(0.5f, 0.5f, 0.f);
                SR.setPos(SR.mulVector(- half - CVector(texMatAV._UTrans.Value, texMatAV._VTrans.Value, 0.f)) + half);
                _Material->setUserTexMat(k, convMat * SR * convMat);
            }
        }

        // We are OK!
        IAnimatable::clearFlag(OwnerBit);
    }
}