MCPcopy Create free account
hub / github.com/anjo76/angelscript / SetArgAddress

Method SetArgAddress

sdk/angelscript/source/as_context.cpp:1299–1334  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1297}
1298
1299int asCContext::SetArgAddress(asUINT arg, void *value)
1300{
1301 if( m_status != asEXECUTION_PREPARED )
1302 return asCONTEXT_NOT_PREPARED;
1303
1304 if( arg >= (unsigned)m_initialFunction->parameterTypes.GetLength() )
1305 {
1306 m_status = asEXECUTION_ERROR;
1307 return asINVALID_ARG;
1308 }
1309
1310 // Verify the type of the argument
1311 asCDataType *dt = &m_initialFunction->parameterTypes[arg];
1312 if( !dt->IsReference() && !dt->IsObjectHandle() )
1313 {
1314 m_status = asEXECUTION_ERROR;
1315 return asINVALID_TYPE;
1316 }
1317
1318 // Determine the position of the argument
1319 int offset = 0;
1320 if( m_initialFunction->objectType )
1321 offset += AS_PTR_SIZE;
1322
1323 // If function returns object by value an extra pointer is pushed on the stack
1324 if( m_returnValueSize )
1325 offset += AS_PTR_SIZE;
1326
1327 for( asUINT n = 0; n < arg; n++ )
1328 offset += m_initialFunction->parameterTypes[n].GetSizeOnStackDWords();
1329
1330 // Set the value
1331 *(asPWORD*)(&m_regs.stackFramePointer[offset]) = (asPWORD)value;
1332
1333 return 0;
1334}
1335
1336int asCContext::SetArgObject(asUINT arg, void *obj)
1337{

Callers 9

CopyFromAsMethod · 0.80
CompareRelationFunction · 0.80
CompareEqualityFunction · 0.80
SetValueMethod · 0.80
SortMethod · 0.80
CopyBufferMethod · 0.80
instantializeClassFunction · 0.80
TestFunction · 0.80

Calls 4

IsObjectHandleMethod · 0.80
GetSizeOnStackDWordsMethod · 0.80
GetLengthMethod · 0.45
IsReferenceMethod · 0.45

Tested by 2

instantializeClassFunction · 0.64
TestFunction · 0.64