| 1003 | } |
| 1004 | |
| 1005 | int asCContext::SetArgAddress(asUINT arg, void *value) |
| 1006 | { |
| 1007 | if( m_status != asEXECUTION_PREPARED ) |
| 1008 | return asCONTEXT_NOT_PREPARED; |
| 1009 | |
| 1010 | if( arg >= (unsigned)m_initialFunction->parameterTypes.GetLength() ) |
| 1011 | { |
| 1012 | m_status = asEXECUTION_ERROR; |
| 1013 | return asINVALID_ARG; |
| 1014 | } |
| 1015 | |
| 1016 | // Verify the type of the argument |
| 1017 | asCDataType *dt = &m_initialFunction->parameterTypes[arg]; |
| 1018 | if( !dt->IsReference() && !dt->IsObjectHandle() ) |
| 1019 | { |
| 1020 | m_status = asEXECUTION_ERROR; |
| 1021 | return asINVALID_TYPE; |
| 1022 | } |
| 1023 | |
| 1024 | // Determine the position of the argument |
| 1025 | int offset = 0; |
| 1026 | if( m_initialFunction->objectType ) |
| 1027 | offset += AS_PTR_SIZE; |
| 1028 | |
| 1029 | // If function returns object by value an extra pointer is pushed on the stack |
| 1030 | if( m_returnValueSize ) |
| 1031 | offset += AS_PTR_SIZE; |
| 1032 | |
| 1033 | for( asUINT n = 0; n < arg; n++ ) |
| 1034 | offset += m_initialFunction->parameterTypes[n].GetSizeOnStackDWords(); |
| 1035 | |
| 1036 | // Set the value |
| 1037 | *(asPWORD*)(&m_regs.stackFramePointer[offset]) = (asPWORD)value; |
| 1038 | |
| 1039 | return 0; |
| 1040 | } |
| 1041 | |
| 1042 | int asCContext::SetArgObject(asUINT arg, void *obj) |
| 1043 | { |
no test coverage detected