| 2670 | } |
| 2671 | |
| 2672 | int asCScriptEngine::AddBehaviourFunction(asCScriptFunction &func, asSSystemFunctionInterface &internal) |
| 2673 | { |
| 2674 | asUINT n; |
| 2675 | |
| 2676 | int id = GetNextScriptFunctionId(); |
| 2677 | |
| 2678 | asSSystemFunctionInterface *newInterface = asNEW(asSSystemFunctionInterface)(internal); |
| 2679 | if( newInterface == 0 ) |
| 2680 | return asOUT_OF_MEMORY; |
| 2681 | |
| 2682 | asCScriptFunction *f = asNEW(asCScriptFunction)(this, 0, asFUNC_SYSTEM); |
| 2683 | if( f == 0 ) |
| 2684 | { |
| 2685 | asDELETE(newInterface, asSSystemFunctionInterface); |
| 2686 | return asOUT_OF_MEMORY; |
| 2687 | } |
| 2688 | |
| 2689 | asASSERT(func.name != "" && func.name != "f"); |
| 2690 | f->name = func.name; |
| 2691 | f->sysFuncIntf = newInterface; |
| 2692 | f->returnType = func.returnType; |
| 2693 | f->objectType = func.objectType; |
| 2694 | if( f->objectType ) |
| 2695 | f->objectType->AddRefInternal(); |
| 2696 | f->id = id; |
| 2697 | f->SetReadOnly(func.IsReadOnly()); |
| 2698 | f->accessMask = defaultAccessMask; |
| 2699 | f->parameterTypes = func.parameterTypes; |
| 2700 | f->parameterNames = func.parameterNames; |
| 2701 | f->inOutFlags = func.inOutFlags; |
| 2702 | f->traits = func.traits; |
| 2703 | for( n = 0; n < func.defaultArgs.GetLength(); n++ ) |
| 2704 | if( func.defaultArgs[n] ) |
| 2705 | f->defaultArgs.PushLast(asNEW(asCString)(*func.defaultArgs[n])); |
| 2706 | else |
| 2707 | f->defaultArgs.PushLast(0); |
| 2708 | |
| 2709 | AddScriptFunction(f); |
| 2710 | |
| 2711 | // If parameter type from other groups are used, add references |
| 2712 | currentGroup->AddReferencesForFunc(this, f); |
| 2713 | |
| 2714 | return id; |
| 2715 | } |
| 2716 | |
| 2717 | // interface |
| 2718 | int asCScriptEngine::RegisterGlobalProperty(const char *declaration, void *pointer) |
nothing calls this directly
no test coverage detected