Esempio n. 1
0
void SQDbgServer::Break(HSQUIRRELVM v, SQInteger line, const SQChar *src, const SQChar *type, const SQChar *error)
{
    _line = line;
    _src = src;
    _break_type = src;
    if (!error) {
        BeginDocument();
        BeginElement(_SC("break"));
        Attribute(_SC("thread"), PtrToString(v));
        Attribute(_SC("line"), IntToString(line));
        Attribute(_SC("src"), src);
        Attribute(_SC("type"), type);
        SerializeState(v);
        EndElement(_SC("break"));
        EndDocument();
    }
    else {
        BeginDocument();
        BeginElement(_SC("break"));
        Attribute(_SC("thread"), PtrToString(v));
        Attribute(_SC("line"), IntToString(line));
        Attribute(_SC("src"), src);
        Attribute(_SC("type"), type);
        Attribute(_SC("error"), error);
        SerializeState(v);
        EndElement(_SC("break"));
        EndDocument();
    }
}
OutboundPacketStream& OutboundPacketStream::operator<<( const BeginMessage& rhs )
{
    if( IsMessageInProgress() )
        throw MessageInProgressException();

    CheckForAvailableMessageSpace( rhs.addressPattern );

    messageCursor_ = BeginElement( messageCursor_ );

    strcpy( messageCursor_, rhs.addressPattern );
    unsigned long rhsLength = strlen(rhs.addressPattern);
    messageCursor_ += rhsLength + 1;

    // zero pad to 4-byte boundary
    unsigned long i = rhsLength + 1;
    while( i & 0x3 ){
        *messageCursor_++ = '\0';
        ++i;
    }

    argumentCurrent_ = messageCursor_;
    typeTagsCurrent_ = end_;

    messageIsInProgress_ = true;

    return *this;
}
void
SVGAnimationElement::ActivateByHyperlink()
{
  FlushAnimations();

  // The behavior for when the target is an animation element is defined in
  // SMIL Animation:
  //   http://www.w3.org/TR/smil-animation/#HyperlinkSemantics
  nsSMILTimeValue seekTime = mTimedElement.GetHyperlinkTime();
  if (seekTime.IsDefinite()) {
    nsSMILTimeContainer* timeContainer = GetTimeContainer();
    if (timeContainer) {
      timeContainer->SetCurrentTime(seekTime.GetMillis());
      AnimationNeedsResample();
      // As with SVGSVGElement::SetCurrentTime, we need to trigger
      // a synchronous sample now.
      FlushAnimations();
    }
    // else, silently fail. We mustn't be part of an SVG document fragment that
    // is attached to the document tree so there's nothing we can do here
  } else {
    ErrorResult rv;
    BeginElement(rv);
  }
}
OutboundPacketStream& OutboundPacketStream::operator<<( const BeginMessage& rhs )
{
    check( !IsMessageInProgress() )

    state_ = CheckForAvailableMessageSpace( rhs.addressPattern );

    if(state_ == SUCCESS)
    {
        messageCursor_ = BeginElement( messageCursor_ );

        std::strcpy( messageCursor_, rhs.addressPattern );
        std::size_t rhsLength = std::strlen(rhs.addressPattern);
        messageCursor_ += rhsLength + 1;

        // zero pad to 4-byte boundary
        std::size_t i = rhsLength + 1;
        while( i & 0x3 ){
            *messageCursor_++ = '\0';
            ++i;
        }

        argumentCurrent_ = messageCursor_;
        typeTagsCurrent_ = end_;

        messageIsInProgress_ = true;
    }

    return *this;
}
//COMMANDS
void SQDbgServer::AddBreakpoint(BreakPoint &bp)
{
	_breakpoints.insert(bp);
	BeginDocument();
		BeginElement(_SC("addbreakpoint"));
			Attribute(_SC("line"),IntToString(bp._line));
			Attribute(_SC("src"),bp._src.c_str());
		EndElement(_SC("addbreakpoint"));
	EndDocument();
}
void SQDbgServer::RemoveBreakpoint(BreakPoint &bp)
{
	BreakPointSetItor itor=_breakpoints.find(bp);
	if(itor==_breakpoints.end()){
		BeginDocument();
			BeginElement(_SC("break"));
				Attribute(_SC("desc"),_SC("the breakpoint doesn't exists"));
			EndElement(_SC("break"));
		EndDocument();
	}
	else{
		BeginDocument();
			BeginElement(_SC("removebreakpoint"));
				Attribute(_SC("line"),IntToString(bp._line));
				Attribute(_SC("src"),bp._src.c_str());
			EndElement(_SC("removebreakpoint"));
		EndDocument();
		_breakpoints.erase(itor);
	}
}
void CXmlBufExternalizerImpl::Field(const TDesC& aName, TBasicType, const TDesC& aValue,
	TBool aIncludeBBType, const TTypeName& aBBType,
		TBool aAsAttribute)
{
	if (! aAsAttribute ) {
		BeginElement(aName, aIncludeBBType, aBBType);
		if (iInOpenElement) { iInOpenElement=EFalse; CloseOpenElement(); }
		CXmlBuf::Characters(aValue);
		EndElement(aName);
	} else {
		if (aIncludeBBType) User::Leave(KErrGeneral);
		Attribute(aName, aValue);
	}
}
void SQDbgServer::Break(int line,const SQChar *src,const SQChar *type,const SQChar *error)
{
	if(!error){
		BeginDocument();
			BeginElement(_SC("break"));
				Attribute(_SC("line"),IntToString(line));
				Attribute(_SC("src"),src);
				Attribute(_SC("type"),type);
				SerializeState();
			EndElement(_SC("break"));
		EndDocument();
	}else{
		BeginDocument();
			BeginElement(_SC("break"));
				Attribute(_SC("line"),IntToString(line));
				Attribute(_SC("src"),src);
				Attribute(_SC("type"),type);
				Attribute(_SC("error"),error);
				SerializeState();
			EndElement(_SC("break"));
		EndDocument();
	}
}
void SQDbgServer::RemoveWatch(int id)
{
	WatchSetItor itor=_watches.find(Watch(id,_SC("")));
	if(itor==_watches.end()){
		BeginDocument();
		BeginElement(_SC("error"));
			Attribute(_SC("desc"),_SC("the watch does not exists"));
		EndElement(_SC("error"));
	EndDocument();
	}
	else{
		_watches.erase(itor);
		scprintf(_SC("removed watch %d\n"),id);
	}
}
OutboundPacketStream& OutboundPacketStream::operator<<( const BundleInitiator& rhs )
{
    if( IsMessageInProgress() )
        throw MessageInProgressException();

    CheckForAvailableBundleSpace();

    messageCursor_ = BeginElement( messageCursor_ );

    memcpy( messageCursor_, "#bundle\0", 8 );
    FromUInt64( messageCursor_ + 8, rhs.timeTag );

    messageCursor_ += 16;
    argumentCurrent_ = messageCursor_;

    return *this;
}
OutboundPacketStream& OutboundPacketStream::operator<<( const BundleInitiator& rhs )
{
    check( !IsMessageInProgress() )

    state_ = CheckForAvailableBundleSpace();
    if(state_ == SUCCESS)
    {
        messageCursor_ = BeginElement( messageCursor_ );

        std::memcpy( messageCursor_, "#bundle\0", 8 );
        FromUInt64( messageCursor_ + 8, rhs.timeTag );

        messageCursor_ += 16;
        argumentCurrent_ = messageCursor_;
    }

    return *this;
}
Esempio n. 12
0
void XmlWriter::WriteNode(const std::string& name, const T& val) {
	BeginElement(name);
	Write<T>(val);
	EndElement(name);
}
Esempio n. 13
0
 void WriteElement(const char *name, T callback, Args... args) {
   BeginElement(name);
   callback(writer, args...);
   EndElement();
 }
Esempio n. 14
0
 void WriteElement(T callback, Args... args) {
   BeginElement();
   callback(writer, args...);
   EndElement();
 }
void CXmlBufExternalizerImpl::BeginCompound(const TDesC& aName, TBool aIncludeBBType, const TTypeName& aBBType)
{
	BeginElement(aName, aIncludeBBType, aBBType);
}
void SQDbgServer::Terminated()
{
	BeginElement(_SC("terminated"));
	EndElement(_SC("terminated"));
	::usleep(200);
}
//ab Add Breakpoint
//rb Remove Breakpoint
//sp Suspend
void SQDbgServer::ParseMsg(const char *msg)
{
	
	switch(*((unsigned short *)msg)){
		case MSG_ID('a','b'): {
			BreakPoint bp;
			if(ParseBreakpoint(msg+3,bp)){
				AddBreakpoint(bp);
				scprintf(_SC("added bp %d %s\n"),bp._line,bp._src.c_str());
			}
			else
				scprintf(_SC("error parsing add breakpoint"));
							 }
			break;
		case MSG_ID('r','b'): {
			BreakPoint bp;
			if(ParseBreakpoint(msg+3,bp)){
				RemoveBreakpoint(bp);
				scprintf(_SC("removed bp %d %s\n"),bp._line,bp._src.c_str());
			}else
				scprintf(_SC("error parsing remove breakpoint"));
							}
			break;
		case MSG_ID('g','o'):
			if(_state!=eDBG_Running){
				_state=eDBG_Running;
				BeginDocument();
					BeginElement(_SC("resumed"));
					EndElement(_SC("resumed"));
				EndDocument();
//				Send(_SC("<resumed/>\r\n"));
				scprintf(_SC("go (execution resumed)\n"));
			}
			break;
		case MSG_ID('s','p'):
			if(_state!=eDBG_Suspended){
				_state=eDBG_Suspended;
				scprintf(_SC("suspend\n"));
			}
			break;
		case MSG_ID('s','o'):
			if(_state==eDBG_Suspended){
				_state=eDBG_StepOver;
			}
			break;
		case MSG_ID('s','i'):
			if(_state==eDBG_Suspended){
				_state=eDBG_StepInto;
				scprintf(_SC("step into\n"));
			}
			break;
		case MSG_ID('s','r'):
			if(_state==eDBG_Suspended){
				_state=eDBG_StepReturn;
				scprintf(_SC("step return\n"));
			}
			break;
		case MSG_ID('d','i'):
			if(_state!=eDBG_Disabled){
				_state=eDBG_Disabled;
				scprintf(_SC("disabled\n"));
			}
			break;
		case MSG_ID('a','w'): {
			Watch w;
			if(ParseWatch(msg+3,w))
			{
				AddWatch(w);
				scprintf(_SC("added watch %d %s\n"),w._id,w._exp.c_str());
			}
			else
				scprintf(_SC("error parsing add watch"));
								}
			break;
		case MSG_ID('r','w'): {
			int id;
			if(ParseRemoveWatch(msg+3,id))
			{
				RemoveWatch(id);
				scprintf(_SC("added watch %d\n"),id);
			}
			else
				scprintf(_SC("error parsing remove watch"));
								}
			break;
		case MSG_ID('t','r'):
			scprintf(_SC("terminate from user\n"));
			break;
		case MSG_ID('r','d'):
			scprintf(_SC("ready\n"));
			_ready=true;
			break;
		default:
			scprintf(_SC("unknown packet"));

	}
}