interface
| 382 | |
| 383 | // interface |
| 384 | int asCContext::PushFunction(asIScriptFunction *func, void *object) |
| 385 | { |
| 386 | asCScriptFunction *realFunc = static_cast<asCScriptFunction*>(func); |
| 387 | |
| 388 | if( realFunc == 0 ) |
| 389 | { |
| 390 | asCString str; |
| 391 | str.Format(TXT_FAILED_IN_FUNC_s_s_d, "PushFunction", errorNames[-asINVALID_ARG], asINVALID_ARG); |
| 392 | m_engine->WriteMessage("", 0, 0, asMSGTYPE_ERROR, str.AddressOf()); |
| 393 | return asINVALID_ARG; |
| 394 | } |
| 395 | |
| 396 | if( m_status != asEXECUTION_DESERIALIZATION ) |
| 397 | { |
| 398 | asCString str; |
| 399 | str.Format(TXT_FAILED_IN_FUNC_s_s_d, "PushFunction", errorNames[-asCONTEXT_NOT_PREPARED], asCONTEXT_NOT_PREPARED); |
| 400 | m_engine->WriteMessage("", 0, 0, asMSGTYPE_ERROR, str.AddressOf()); |
| 401 | return asCONTEXT_NOT_PREPARED; |
| 402 | } |
| 403 | |
| 404 | if( realFunc->funcType == asFUNC_DELEGATE ) |
| 405 | { |
| 406 | asASSERT(object == 0); |
| 407 | |
| 408 | object = realFunc->objForDelegate; |
| 409 | realFunc = realFunc->funcForDelegate; |
| 410 | } |
| 411 | |
| 412 | realFunc = GetRealFunc(realFunc, &object); |
| 413 | |
| 414 | if( GetCallstackSize() == 0 ) |
| 415 | { |
| 416 | m_status = asEXECUTION_UNINITIALIZED; |
| 417 | Prepare(realFunc); |
| 418 | if(object) |
| 419 | *(asPWORD*)&m_regs.stackFramePointer[0] = (asPWORD)object; |
| 420 | m_status = asEXECUTION_DESERIALIZATION; |
| 421 | } |
| 422 | else |
| 423 | { |
| 424 | if(realFunc->funcType == asFUNC_INTERFACE || realFunc->funcType == asFUNC_VIRTUAL) |
| 425 | CallInterfaceMethod(realFunc); |
| 426 | else |
| 427 | CallScriptFunction(realFunc); |
| 428 | |
| 429 | if(object) |
| 430 | *(asPWORD*)&m_regs.stackFramePointer[0] = (asPWORD)object; |
| 431 | } |
| 432 | |
| 433 | asASSERT(m_currentFunction->funcType != asFUNC_DELEGATE); |
| 434 | |
| 435 | return asSUCCESS; |
| 436 | } |
| 437 | |
| 438 | // interface |
| 439 | int asCContext::GetStateRegisters(asUINT stackLevel, asIScriptFunction **_callingSystemFunction, asIScriptFunction **_initialFunction, asDWORD *_originalStackPointer, asDWORD *_argumentSize, asQWORD *_valueRegister, void **_objectRegister, asITypeInfo **_objectRegisterType) |