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

Function CallSystemFunctionNative

sdk/angelscript/source/as_callfunc_ppc.cpp:485–668  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

483}
484
485asQWORD CallSystemFunctionNative(asCContext *context, asCScriptFunction *descr, void *obj, asDWORD *args, void *retPointer, asQWORD &/*retQW2*/, void */*secondObject*/)
486{
487 // TODO: PPC does not yet support THISCALL_OBJFIRST/LAST
488
489 // use a working array of types, we'll configure the final one in stackArgs
490 asBYTE argsType[2*AS_PPC_MAX_ARGS + 1 + 1 + 1];
491 memset( argsType, 0, sizeof(argsType));
492
493 asCScriptEngine *engine = context->m_engine;
494 asSSystemFunctionInterface *sysFunc = descr->sysFuncIntf;
495
496 asQWORD retQW = 0;
497 void *func = (void*)sysFunc->func;
498 int paramSize = sysFunc->paramSize;
499 asDWORD *vftable = NULL;
500 int a, s;
501
502 // convert the parameters that are < 4 bytes from little endian to big endian
503 int argDwordOffset = 0;
504 for( a = 0; a < (int)descr->parameterTypes.GetLength(); a++ )
505 {
506 int numBytes = descr->parameterTypes[a].GetSizeInMemoryBytes();
507 if( numBytes >= 4 || descr->parameterTypes[a].IsReference() || descr->parameterTypes[a].IsObjectHandle() )
508 {
509 argDwordOffset += descr->parameterTypes[a].GetSizeOnStackDWords();
510 continue;
511 }
512
513 // flip
514 asASSERT( numBytes == 1 || numBytes == 2 );
515 switch( numBytes )
516 {
517 case 1:
518 {
519 volatile asBYTE *bPtr = (asBYTE*)ARG_DW(args[argDwordOffset]);
520 asBYTE t = bPtr[0];
521 bPtr[0] = bPtr[3];
522 bPtr[3] = t;
523 t = bPtr[1];
524 bPtr[1] = bPtr[2];
525 bPtr[2] = t;
526 }
527 break;
528 case 2:
529 {
530 volatile asWORD *wPtr = (asWORD*)ARG_DW(args[argDwordOffset]);
531 asWORD t = wPtr[0];
532 wPtr[0] = wPtr[1];
533 wPtr[1] = t;
534 }
535 break;
536 }
537 argDwordOffset++;
538 }
539
540 // mark all float/double/int arguments
541 if( !sysFunc->takesObjByVal )
542 {

Callers

nothing calls this directly

Calls 15

GetSizeInMemoryBytesMethod · 0.80
IsObjectHandleMethod · 0.80
GetSizeOnStackDWordsMethod · 0.80
IsFloatTypeMethod · 0.80
IsDoubleTypeMethod · 0.80
IsObjectMethod · 0.80
GetTypeInfoMethod · 0.80
CallFreeMethod · 0.80
GetSizeInMemoryDWordsMethod · 0.80
SetInternalExceptionMethod · 0.80
CallCDeclFunctionFunction · 0.70
CallThisCallFunctionFunction · 0.70

Tested by

no test coverage detected