| 1211 | } |
| 1212 | |
| 1213 | int asCContext::SetArgFloat(asUINT arg, float value) |
| 1214 | { |
| 1215 | if( m_status != asEXECUTION_PREPARED ) |
| 1216 | return asCONTEXT_NOT_PREPARED; |
| 1217 | |
| 1218 | if( arg >= (unsigned)m_initialFunction->parameterTypes.GetLength() ) |
| 1219 | { |
| 1220 | m_status = asEXECUTION_ERROR; |
| 1221 | return asINVALID_ARG; |
| 1222 | } |
| 1223 | |
| 1224 | // Verify the type of the argument |
| 1225 | asCDataType *dt = &m_initialFunction->parameterTypes[arg]; |
| 1226 | if( dt->IsObject() || dt->IsFuncdef() || dt->IsReference() ) |
| 1227 | { |
| 1228 | m_status = asEXECUTION_ERROR; |
| 1229 | return asINVALID_TYPE; |
| 1230 | } |
| 1231 | |
| 1232 | if( dt->GetSizeOnStackDWords() != 1 ) |
| 1233 | { |
| 1234 | m_status = asEXECUTION_ERROR; |
| 1235 | return asINVALID_TYPE; |
| 1236 | } |
| 1237 | |
| 1238 | // Determine the position of the argument |
| 1239 | int offset = 0; |
| 1240 | if( m_initialFunction->objectType ) |
| 1241 | offset += AS_PTR_SIZE; |
| 1242 | |
| 1243 | // If function returns object by value an extra pointer is pushed on the stack |
| 1244 | if( m_returnValueSize ) |
| 1245 | offset += AS_PTR_SIZE; |
| 1246 | |
| 1247 | for( asUINT n = 0; n < arg; n++ ) |
| 1248 | offset += m_initialFunction->parameterTypes[n].GetSizeOnStackDWords(); |
| 1249 | |
| 1250 | // Set the value |
| 1251 | *(float*)(&m_regs.stackFramePointer[offset]) = value; |
| 1252 | |
| 1253 | return 0; |
| 1254 | } |
| 1255 | |
| 1256 | int asCContext::SetArgDouble(asUINT arg, double value) |
| 1257 | { |