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

Method SetArgByte

sdk/angelscript/source/as_context.cpp:1041–1082  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1039}
1040
1041int asCContext::SetArgByte(asUINT arg, asBYTE value)
1042{
1043 if( m_status != asEXECUTION_PREPARED )
1044 return asCONTEXT_NOT_PREPARED;
1045
1046 if( arg >= (unsigned)m_initialFunction->parameterTypes.GetLength() )
1047 {
1048 m_status = asEXECUTION_ERROR;
1049 return asINVALID_ARG;
1050 }
1051
1052 // Verify the type of the argument
1053 asCDataType *dt = &m_initialFunction->parameterTypes[arg];
1054 if( dt->IsObject() || dt->IsFuncdef() || dt->IsReference() )
1055 {
1056 m_status = asEXECUTION_ERROR;
1057 return asINVALID_TYPE;
1058 }
1059
1060 if( dt->GetSizeInMemoryBytes() != 1 )
1061 {
1062 m_status = asEXECUTION_ERROR;
1063 return asINVALID_TYPE;
1064 }
1065
1066 // Determine the position of the argument
1067 int offset = 0;
1068 if( m_initialFunction->objectType )
1069 offset += AS_PTR_SIZE;
1070
1071 // If function returns object by value an extra pointer is pushed on the stack
1072 if( m_returnValueSize )
1073 offset += AS_PTR_SIZE;
1074
1075 for( asUINT n = 0; n < arg; n++ )
1076 offset += m_initialFunction->parameterTypes[n].GetSizeOnStackDWords();
1077
1078 // Set the value
1079 *(asBYTE*)&m_regs.stackFramePointer[offset] = value;
1080
1081 return 0;
1082}
1083
1084int asCContext::SetArgWord(asUINT arg, asWORD value)
1085{

Callers 1

TestFunction · 0.80

Calls 6

IsObjectMethod · 0.80
IsFuncdefMethod · 0.80
GetSizeInMemoryBytesMethod · 0.80
GetSizeOnStackDWordsMethod · 0.80
GetLengthMethod · 0.45
IsReferenceMethod · 0.45

Tested by 1

TestFunction · 0.64