Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 'out' arguments for javascript bindings #190

Merged
merged 10 commits into from
Jul 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ startingpath="$(pwd)"
basepath="$(cd "$(dirname "$0")" && pwd)"
cd "$basepath/../Source"

Sources="actutils.go automaticcomponenttoolkit.go buildbindingccpp.go buildbindingccppdocumentation.go buildbindingcsharp.go buildbindinggo.go buildbindingnode.go buildbindingpascal.go buildbindingpython.go buildbindingjava.go buildimplementationcpp.go buildimplementationpascal.go componentdefinition.go componentdiff.go languagewriter.go languagec.go languagecpp.go languagepascal.go"
Sources="actutils.go automaticcomponenttoolkit.go buildbindingccpp.go buildbindingccppdocumentation.go buildbindingcsharp.go buildbindinggo.go buildbindingnode.go buildbindingpascal.go buildbindingpython.go buildbindingjava.go buildimplementationcpp.go buildimplementationpascal.go componentdefinition.go componentdiff.go languagewriter.go languagec.go languagecpp.go languagepascal.go buildimplementationjs.go"

echo "Build act.win64.exe"
export GOARCH="amd64"
Expand Down
13 changes: 7 additions & 6 deletions Source/buildimplementationcpp.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ func buildCPPInternalException(wHeader LanguageWriter, wImpl LanguageWriter, Nam
wHeader.Writeln("#define __%s_INTERFACEEXCEPTION_HEADER", strings.ToUpper(NameSpace));
wHeader.Writeln("");

wHeader.Writeln("#include <string>");
wHeader.Writeln("#include <exception>");
wHeader.Writeln("#include <stdexcept>");

Expand Down Expand Up @@ -912,7 +913,7 @@ func buildOutCacheTemplateParameters (method ComponentDefinitionMethod, NameSpac

cppParamType := getCppParamType(param, NameSpace, true);
if param.ParamType == "class" || param.ParamType == "optionalclass" {
cppParamType = fmt.Sprintf("I%s%s*", ClassIdentifier, BaseClassName)
cppParamType = fmt.Sprintf("I%s%s*", ClassIdentifier, param.ParamClass)
}
result += cppParamType;
}
Expand Down Expand Up @@ -1727,7 +1728,7 @@ func generatePrePostCallCPPFunctionCode(component ComponentDefinition, method Co
case "class", "optionalclass":
checkInputCode = append(checkInputCode, fmt.Sprintf("if (p%s == nullptr)", param.ParamName))
checkInputCode = append(checkInputCode, fmt.Sprintf(" throw E%sInterfaceException (%s_ERROR_INVALIDPARAM);", NameSpace, strings.ToUpper(NameSpace)))

paramNameSpace, paramClassName, _ := decomposeParamClassName(param.ParamClass)
if len(paramNameSpace) > 0 {
outVarName := fmt.Sprintf("p%s%s", paramNameSpace, param.ParamName)
Expand All @@ -1739,10 +1740,10 @@ func generatePrePostCallCPPFunctionCode(component ComponentDefinition, method Co
callParameters = callParameters + outVarName
outCallParameters = outCallParameters + outVarName
} else {
preCallCode = append(preCallCode, fmt.Sprintf("I%s* pBase%s(nullptr);", paramClassName, param.ParamName))
postCallCode = append(postCallCode, fmt.Sprintf("*%s = (%s*)(pBase%s);", variableName, IBaseClassName, param.ParamName));
callParameters = callParameters + "pBase" + param.ParamName
outCallParameters = outCallParameters + "pBase" + param.ParamName
preCallCode = append(preCallCode, fmt.Sprintf("I%s* pClass%s(nullptr);", paramClassName, param.ParamName))
postCallCode = append(postCallCode, fmt.Sprintf("*%s = (%s*)(pClass%s);", variableName, IBaseClassName, param.ParamName));
callParameters = callParameters + "pClass" + param.ParamName
outCallParameters = fmt.Sprintf("%s pClass%s", outCallParameters, param.ParamName)
}


Expand Down
Loading