Extern C support for registering function overloads
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2019-09-14 10:19:56 +02:00
parent 3a9f1f976a
commit 45d3bc690b
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
2 changed files with 17 additions and 0 deletions

View File

@ -110,6 +110,17 @@ namespace Porygon{
return type;
}
ScriptType* RegisterUserDataFunctionScriptTypeOption(GenericFunctionScriptType* existing, ScriptType* returnType,
ScriptType* parameters[], size_t parameterCount){
vector<shared_ptr<const ScriptType>> vector(parameterCount);
for (size_t i = 0; i < parameterCount; i++){
vector[i] = shared_ptr<const ScriptType>(parameters[i]);
}
auto option = new UserData::UserDataFunctionOption(shared_ptr<const ScriptType>(returnType), vector);
existing->RegisterFunctionOption(option);
return existing;
}
TypeClass GetTypeClass(ScriptType* t){
return t->GetClass();
}

View File

@ -13,5 +13,11 @@ namespace Porygon::UserData{
t->RegisterOption(opt);
return t;
}
void RegisterFunctionEvalValueOption(const GenericFunctionEvalValue* val,
const Evaluation::EvalValue* (*func)(void*, const ScriptOptions*, const EvalValue* [], int ), void* obj){
auto opt = new UserDataFunction(func, obj);
val->RegisterOption(opt);
}
}
}