interface
| 5700 | |
| 5701 | // interface |
| 5702 | int asCContext::SetLineCallback(const asSFuncPtr &callback, void *obj, int callConv) |
| 5703 | { |
| 5704 | // First turn off the line callback to avoid a second thread |
| 5705 | // attempting to call it while the new one is still being set |
| 5706 | m_lineCallback = false; |
| 5707 | |
| 5708 | m_lineCallbackObj = obj; |
| 5709 | bool isObj = false; |
| 5710 | if( (unsigned)callConv == asCALL_GENERIC || (unsigned)callConv == asCALL_THISCALL_OBJFIRST || (unsigned)callConv == asCALL_THISCALL_OBJLAST ) |
| 5711 | { |
| 5712 | m_regs.doProcessSuspend = m_doSuspend; |
| 5713 | return asNOT_SUPPORTED; |
| 5714 | } |
| 5715 | if( (unsigned)callConv >= asCALL_THISCALL ) |
| 5716 | { |
| 5717 | isObj = true; |
| 5718 | if( obj == 0 ) |
| 5719 | { |
| 5720 | m_regs.doProcessSuspend = m_doSuspend; |
| 5721 | return asINVALID_ARG; |
| 5722 | } |
| 5723 | } |
| 5724 | |
| 5725 | int r = DetectCallingConvention(isObj, callback, callConv, 0, &m_lineCallbackFunc); |
| 5726 | |
| 5727 | // Turn on the line callback after setting both the function pointer and object pointer |
| 5728 | if( r >= 0 ) m_lineCallback = true; |
| 5729 | |
| 5730 | // The BC_SUSPEND instruction should be processed if either line |
| 5731 | // callback is set or if the application has requested a suspension |
| 5732 | m_regs.doProcessSuspend = m_doSuspend || m_lineCallback; |
| 5733 | |
| 5734 | return r; |
| 5735 | } |
| 5736 | |
| 5737 | void asCContext::CallLineCallback() |
| 5738 | { |