Example #1
0
File: main.cpp Project: CCJY/coliru
int main(void)
{

	MyClass m(100);
	m.SetI(99, -100);
	m.SetI(1, 100);

	std::string str("ABC");

	std::cout << "Size int: " << sizeof(int) << std::endl;
	std::cout << "Size float *: " << sizeof(float *) << std::endl;
	std::cout << "Size std::string : " << sizeof(std::string ) << std::endl;
	std::cout << "Size std::string &: " << sizeof(std::string &) << std::endl;
	std::cout << "Size std::string &&: " << sizeof(std::string &&) << std::endl;
	std::cout << "Size const std::string *: " << sizeof(const std::string *) << std::endl;


	AddCallback("CALLBACK_5", (void *)func_5, 5, sizeof(char), sizeof(double), sizeof(std::string *), sizeof(MyClass *), sizeof(long long));
	DoSomething("CALLBACK_5", 'C', 10.01, &str, &m, 0xffffffffffffffffull );

	AddCallback("CALLBACK_0", (void *)func_0, 0);
	DoSomething("CALLBACK_0");

	AddCallback("CALLBACK_1", (void *)func_2, 2, sizeof(short), sizeof(double));
	DoSomething("CALLBACK_1", 32768, 10.01);

	std::cout << "=========\nstr: " << str << std::endl;
	std::cout << "m[1]: " << m.GetI(1) << std::endl;

	return 0;
}
Example #2
0
void    pfGUIButtonMod::HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers )
{

    // make sure that we got the down click first
    if ( !fClicking )
        return;

    fClicking = false;
    if( fAnimationKeys.GetCount() > 0 )
    {
        plAnimCmdMsg *msg = new plAnimCmdMsg();
        msg->SetCmd( plAnimCmdMsg::kContinue );
        msg->SetCmd( plAnimCmdMsg::kSetBackwards );
        msg->SetCmd( plAnimCmdMsg::kGoToEnd );  
        msg->SetAnimName( fAnimName );
        msg->AddReceivers( fAnimationKeys );
        plgDispatch::MsgSend( msg );
    }

    IPlaySound( kMouseUp );

    // Don't run the command if the mouse is outside our bounds
    if( !fBounds.IsInside( &mousePt ) && fNotifyType != kNotifyOnUpAndDown )
        return;     

    if ( fNotifyType == kNotifyOnUp || fNotifyType == kNotifyOnUpAndDown)
        fTriggering = true;
    DoSomething();
    fTriggering = false;
}
Example #3
0
// -----------------------------------------------------------------------
// main entry
// -----------------------------------------------------------------------
main()
{
  cout << "in main - beginning of test program" << endl;

  //
  // Must place all EH_REGISTER lines right before EH_TRY line
  //
  EH_REGISTER(EH_ARITHMETIC_OVERFLOW);                  // <--- xxxxx
  EH_REGISTER(EH_OUT_OF_RANGE);                         // <--- xxxxx
  EH_TRY                                                // <--- try block
  {
    cout << "in main - in try block before calling DoSomething" << endl;
    DoSomething();
    DoSomething2();
  }
  EH_END_TRY                                            // <--- xxxxx
  EH_CATCH(EH_ARITHMETIC_OVERFLOW)                      // <--- catch block
  {
    cout << "in main - in Arithmetic Overflow catch block" << endl;
  }
  EH_CATCH(EH_OUT_OF_RANGE)                             // <--- catch block
  {
    cout << "in main - in Out of Range catch block" << endl
         << "in main - line " << __LINE__ << " : "
         << " *** Error *** This line is not supposed to be printed" << endl;
  }

  cout << "in main - end of test program" << endl
       << "-----------------------------" << endl;
  return 0;
}
Example #4
0
void ExecuteInterpreterOpCode (usf_state_t * state) {


	if (*state->WaitMode) state->Timers->Timer = -1;

	if (!r4300i_LW_VAddr(state, state->PROGRAM_COUNTER, &state->Opcode.u.Hex)) {
		DoTLBMiss(state, state->NextInstruction == JUMP,state->PROGRAM_COUNTER);
		state->NextInstruction = NORMAL;
		return;
	}
    
#ifdef DEBUG_INFO
    {
        char opcode[256];
        char arguments[256];
        r4300_decode_op(state->Opcode.u.Hex, opcode, arguments, state->PROGRAM_COUNTER);
        fprintf(state->debug_log, "%08x: %-16s %s\n", state->PROGRAM_COUNTER, opcode, arguments);
    }
#endif

	COUNT_REGISTER += 2;
	state->Timers->Timer -= 2;

	RANDOM_REGISTER -= 1;
	if ((int32_t)RANDOM_REGISTER < (int32_t)WIRED_REGISTER) {
		RANDOM_REGISTER = 31;
	}

	R4300i_Opcode[ state->Opcode.u.b.op ](state);

	if (state->GPR[0].DW != 0) {
		state->GPR[0].DW = 0;
	}

	switch (state->NextInstruction) {
	case NORMAL:
		state->PROGRAM_COUNTER += 4;
		break;
	case DELAY_SLOT:
		state->NextInstruction = JUMP;
		state->PROGRAM_COUNTER += 4;
		break;
	case JUMP:
		if (
#ifdef DEBUG_INFO
            0 &&
#endif
            state->cpu_hle_entry_count &&
			DoCPUHLE(state, state->JumpToLocation)) {
            state->PROGRAM_COUNTER = state->GPR[31].UW[0];
            state->NextInstruction = NORMAL;
        }
		else {
			state->PROGRAM_COUNTER = state->JumpToLocation;
			state->NextInstruction = NORMAL;
		}
		if ((int32_t)state->Timers->Timer < 0) { TimerDone(state); }
		if (state->CPU_Action->DoSomething) { DoSomething(state); }
	}
}
Example #5
0
BOOL CFolderScanHandler::EnumFiles(SStringT strPath,HSTREEITEM hParent)
{
    BOOL bRet = TRUE;
    WIN32_FIND_DATA fd;
    SStringT strFind = strPath + _T("\\*.*");
    HANDLE hFind=FindFirstFile(strFind,&fd);
    if(hFind != INVALID_HANDLE_VALUE)
    {
        while(bRet && FindNextFile(hFind,&fd))
        {
            SStringT strName= fd.cFileName;
            BOOL bFolder = fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY;
            if(bFolder && (strName == _T(".") || strName == _T("..")))
                continue;
            __int64 nSize = ((__int64)fd.nFileSizeHigh)<<32|fd.nFileSizeLow;
            HSTREEITEM hItem = m_pTreelist->GetFolderTreeCtrl()->InsertItem(strName,bFolder,nSize,hParent);
            if(!DoSomething())
            {
                bRet = FALSE;
            }else if(bFolder)
            {
                bRet = EnumFiles(strPath + _T("\\") + strName,hItem);
            }
        }
        FindClose(hFind);
    }
    return bRet;
}
Example #6
0
ReturnType ClassName::ReallyLongFunctionName(const Type& par_name1,
                                             Type* par_name2) {
    
    // 局部变量命名
    QwtPlotCurve *m_curve;
    
    bool retval = DoSomething(averyveryveryverylongargument1,
                              argument2, argument3);
                              
    if (condition) {
        for (int i = 0; i < kSomeNumber; ++i) {
            if (this_one_thing > this_other_thing &&
                a_third_thing == a_fourth_thing) {
                // TODO
            }
        }
    } else {
        nt j = g();
    }
    
    switch (var) {
        case 0: break;
        default: assert(false);
    }
    
    return x;
}
Example #7
0
// -----------------------------------------------------------------------
// main entry
// -----------------------------------------------------------------------
main()
{
  cout << "in main - beginning of test program" << endl;

  EH_REGISTER(EH_ARITHMETIC_OVERFLOW);                  // <---
  EH_REGISTER(EH_OUT_OF_RANGE);                         // <---
  EH_TRY                                                // <---
  {
    cout << "in main - in try block before calling DoSomething" << endl;
    DoSomething();
  }
  EH_END_TRY                                            // <---
  EH_CATCH(EH_ARITHMETIC_OVERFLOW)                      // <---
  {
    cout << "in main - in Arithmetic Overflow catch block" << endl;
  }
  EH_CATCH(EH_OUT_OF_RANGE)                             // <---
  {
    cout << "in main - in Out of Range catch block" << endl;
  }

  cout << "in main - end of test program" << endl
       << "-----------------------------" << endl;
  return 0;
}
void Demo(int x,int a)
{
	// 赋值运算和比较运算的优先级不清晰
	if (x = a < 0)
	{
		DoSomething();
	}
	
}
Example #9
0
void MyObject::start()
{
    QTimer *timer = new QTimer(this);
    timer->setInterval(1000);
    connect(timer, SIGNAL(timeout()), SLOT(DoSomething()));
    MyThread *t = new MyThread(this);
    connect(t, SIGNAL(finished()), SLOT(onFinished()));
    connect(t, SIGNAL(finished()), timer, SLOT(start()));
    t->start();
}
main()
{
    void interrupt(*oldTimer)();
    oldTimer=getvect(0X1c);
    setvect(0X1c,beNoisy);
    playtune(song);
    DoSomething();
    setvect(0X1c,oldTimer);
    nosound();
}
Example #11
0
void lazy() {
  Status s = DoSomething();
  if (!s.ok()) return;
  Status &rs = DoSomethingElse();
  if (!rs.ok()) return;
  Status *ps = DoAnotherThing();
  if (!ps->ok()) return;
  Status **pps = DoYetAnotherThing();
  if (!(*pps)->ok()) return;

  (void)DoSomething();
  (void)DoSomethingElse();
  (void)DoAnotherThing();
  (void)DoYetAnotherThing();

  DoSomething(); // expected-warning {{ignoring return value}}
  DoSomethingElse();
  DoAnotherThing();
  DoYetAnotherThing();
}
Example #12
0
void    pfGUIKnobCtrl::HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers )
{
    float oldValue = fValue, newValue = fDragValue;

    if( fDragRangeMin != -1 )
    {
        if( HasFlag( kLeftRightOrientation ) )
        {
            if( mousePt.fX < fDragRangeMin )
                newValue = fMin;
            else if( mousePt.fX > fDragRangeMax )
                newValue = fMax;
            else
                newValue = ( ( mousePt.fX - fDragRangeMin ) / ( fDragRangeMax - fDragRangeMin ) ) *
                            ( fMax - fMin ) + fMin;
        }
        else
        {
            if( mousePt.fY > fDragRangeMin )
                newValue = fMin;
            else if( mousePt.fY < fDragRangeMax )
                newValue = fMax;
            else
                newValue = ( (  fDragRangeMin - mousePt.fY) / ( fDragRangeMin - fDragRangeMax ) ) *
                            ( fMax - fMin ) + fMin;
        }

        if( HasFlag( kReverseValues ) )
            SetCurrValue( fMax - ( newValue - fMin ) );
        else
            SetCurrValue( newValue );
    }
    else
    {
        float diff;
        if( HasFlag( kLeftRightOrientation ) )
            diff = ( mousePt.fX - fDragStart.fX ) * 20.f;
        else
            diff = ( fDragStart.fY - mousePt.fY ) * 20.f;

        if( HasFlag( kReverseValues ) )
            SetCurrValue( fDragValue - diff );
        else
            SetCurrValue( fDragValue + diff );
    }

    // !fDragging = We're mousing-up, so if we're still dragging, we need to not have the only-
    // on-mouse-up flag set. Just FYI
    if( !fDragging || !HasFlag( kTriggerOnlyOnMouseUp ) )
        DoSomething();
}
void    pfGUIDraggableMod::HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers )
{
    if( fDragging )
    {
        fLastMousePt = mousePt;
        fDragging = false;
        SetObjectCenter( mousePt.fX + fDragOffset.fX, mousePt.fY + fDragOffset.fY );

        DoSomething();

        if( HasFlag( kAlwaysSnapBackToStart ) )
            SetObjectCenter( fOrigCenter.fX, fOrigCenter.fY );
    }
}
Example #14
0
void    pfGUICheckBoxCtrl::HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers )
{
    if( fClicking )
    {
        fClicking = false;

        if(fPlaySound)
            IPlaySound( kMouseUp );

        // Don't run the command if the mouse is outside our bounds
        if( fBounds.IsInside( &mousePt ) )
        {
            SetChecked( !fChecked );
            DoSomething();
        }
    }
}
void ExecuteInterpreterOpCode (usf_state_t * state) {


	if (*state->WaitMode) state->Timers->Timer = -1;

	if (!r4300i_LW_VAddr(state, state->PROGRAM_COUNTER, &state->Opcode.u.Hex)) {
		DoTLBMiss(state, state->NextInstruction == JUMP,state->PROGRAM_COUNTER);
		state->NextInstruction = NORMAL;
		return;
	}

	COUNT_REGISTER += 2;
	state->Timers->Timer -= 2;

	RANDOM_REGISTER -= 1;
	if ((int32_t)RANDOM_REGISTER < (int32_t)WIRED_REGISTER) {
		RANDOM_REGISTER = 31;
	}

	R4300i_Opcode[ state->Opcode.u.b.op ](state);

	if (state->GPR[0].DW != 0) {
		state->GPR[0].DW = 0;
	}

	switch (state->NextInstruction) {
	case NORMAL:
		state->PROGRAM_COUNTER += 4;
		break;
	case DELAY_SLOT:
		state->NextInstruction = JUMP;
		state->PROGRAM_COUNTER += 4;
		break;
	case JUMP:
		state->PROGRAM_COUNTER  = state->JumpToLocation;
		state->NextInstruction = NORMAL;
		if ((int32_t)state->Timers->Timer < 0) {  TimerDone(state); }
		if (state->CPU_Action->DoSomething) { DoSomething(state); }

	}
}
Example #16
0
void    pfGUIButtonMod::HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers )
{
    fClicking = true;
    if( fAnimationKeys.GetCount() > 0 )
    {
        plAnimCmdMsg *msg = new plAnimCmdMsg();
        msg->SetCmd( plAnimCmdMsg::kContinue );
        msg->SetCmd( plAnimCmdMsg::kSetForewards );
        msg->SetCmd( plAnimCmdMsg::kGoToBegin );    
        msg->SetAnimName( fAnimName );
        msg->AddReceivers( fAnimationKeys );
        plgDispatch::MsgSend( msg );
    }

    IPlaySound( kMouseDown );

    fOrigMouseDownPt = mousePt;
    if ( fNotifyType == kNotifyOnDown || fNotifyType == kNotifyOnUpAndDown)
    {
        fTriggering = true;
        DoSomething();
        fTriggering = false;
    }
}
Example #17
0
File: main.cpp Project: CCJY/coliru
int main() {
  Blah::S s;
  
  DoSomething(s);
}
Example #18
0
int main()
{
	auto sobject = Singleton::GetInstance();
	sobject->DoSomething();
	return 0;
}
Example #19
0
std::string AskForAction(const std::tuple<Args...> & t) {
    return DoSomething(t, len_tuple<sizeof...(Args)>());
}
Example #20
0
std::string DoSomething(const Tuple & t, len_tuple<Id>) {
    std::cout << std::get<std::tuple_size<Tuple>::value - Id>(t) << std::endl;
    return std::get<std::tuple_size<Tuple>::value - Id>(t) + DoSomething(t, len_tuple<Id-1>());
}
Example #21
0
File: main.cpp Project: CCJY/coliru
void Func(T t)
{
    DoSomething(t);    
}
Example #22
0
void foo(Something* pX)
{
  DoSomething(1);		// { dg-error "could not convert" }
  pX->DoSomething(1);		// { dg-error "no matching" } 
  (*pX).DoSomething(1);		// { dg-error "no matching" } 
}