MCPcopy Create free account
hub / github.com/MayaPosch/NymphCast / SetArgAddress

Method SetArgAddress

src/server/angelscript/angelscript/source/as_context.cpp:1005–1040  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1003}
1004
1005int 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
1042int asCContext::SetArgObject(asUINT arg, void *obj)
1043{

Callers 4

CopyFromAsMethod · 0.80
CompareRelationFunction · 0.80
CompareEqualityFunction · 0.80
SortMethod · 0.80

Calls 4

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

Tested by

no test coverage detected